Changeset 8858


Ignore:
Timestamp:
03/03/07 21:56:31 (5 years ago)
Author:
sys
Message:

Intégration MML

Location:
trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Jav_BDP/com/scenari/m/bdp/facet/SourceFacet.java

    r6862 r8858  
    3030public class SourceFacet implements IHSource { 
    3131         
     32        /** Constante spécifiant de prendre la date de dernière modif de la source enveloppée par cet objet. */ 
     33        public static final long GET_WRAPPED_SOURCE = -99; 
     34         
    3235        IHSource fSource = null; 
    3336         
    34         long fLastUpdt = -1; 
     37        long fLastUpdt = GET_WRAPPED_SOURCE; 
    3538         
    3639        String fContentType = null; 
     
    9194 
    9295        public long hGetLastModif() throws Exception { 
    93                 if(fLastUpdt>=0) return fLastUpdt; 
     96                if(fLastUpdt != GET_WRAPPED_SOURCE) return fLastUpdt; 
    9497                return fSource.hGetLastModif(); 
    9598        } 
    9699 
    97100        public long hGetLastModifWithChilds() throws Exception { 
    98                 if(fLastUpdt>=0) return fLastUpdt; 
     101                if(fLastUpdt!= GET_WRAPPED_SOURCE) return fLastUpdt; 
    99102                return fSource.hGetLastModifWithChilds(); 
    100103        } 
  • trunk/Jav_BDP/com/scenari/m/bdp/facet/wraptransf/FacetWrapTransformer.java

    r6861 r8858  
    4040 
    4141import com.scenari.m.bdp.facet.Facet; 
    42 import com.scenari.m.bdp.facet.SourceFacet; 
    4342import com.scenari.m.bdp.item.IHItemDef; 
    4443import com.scenari.m.bdp.itemcontent.IHContentAccess; 
     
    105104                IHSource vResult = null; 
    106105                if (vPathFile != null) { 
    107                         vResult = new SourceFacet(new HSourceFs(null, vPathFile), -1, ""); 
     106                        vResult = new HSourceFs(null, vPathFile); 
    108107                        if (vParams == null && fCheckAutoMultiRes) { 
    109108                                if (vResult.hGetStatus() == IHSource.STATUS_FOLDER) { 
  • trunk/Jav_CO/com/scenari/s/co/transform/xml/HTransformerXml.java

    r8827 r8858  
    250250                        vInput = (InputStream) pSrc; 
    251251                } else { 
    252                         vInput = new BufferedInputStream(new FileInputStream((File) pSrc)); 
     252                        File vSrc = (File)pSrc; 
     253                        if (vSrc.isDirectory()) { 
     254                                //Dossier => on essaye sur fichier dans le dossier avec le même nom. 
     255                                vSrc = new File(vSrc, vSrc.getName()); 
     256                        } 
     257                        vInput = new BufferedInputStream(new FileInputStream(vSrc)); 
    253258                } 
    254259                try { 
  • trunk/Jav_Main/initCommon.xml

    r8691 r8858  
    6363                <transformation code="xml2xmlponc" type="com.scenari.s.co.transform.xml.HTransformerPonctuation"/> 
    6464                <transformation code="xml" type="com.scenari.s.co.transform.xml.HTransformerXml"/> 
    65                  
    66                 <!--  
    67                 <transformation code="mml2img" type="com.scenari.s.co.transform.mml.HTransformerMml"/> 
    68                 <transformation code="svg2img" type="com.scenari.s.co.transform.svg.HTransformerSvg"/> 
    69                 <transformation code="latex" type="com.scenari.s.co.transform.mml.HTransformerLatex"/> 
    70                  --> 
     65                <transformation code="xmlResolveEntities" type="com.scenari.s.co.transform.xml.HTransformerXml"> 
     66                        <property key="entities" src="file:entities.properties"/> 
     67                </transformation> 
    7168                  
    7269                <transformation code="img2props" type="com.scenari.s.co.transform.img.HTransformerProps"/> 
     
    248245                        <property key="extension" value=".mml"/> 
    249246                </transformation> 
     247                <transformation code="mml2swf" type="com.scenari.s.co.transform.oo.HTransformerOo"> 
     248                        <property key="ooTransformerClassName" value="com.scenari.s.oo.transform.TransformerExportOdfViaDraw"/> 
     249                        <property key="filterName" value="draw_flash_Export"/> 
     250                        <property key="extension" value=".swf"/> 
     251                        <property key="source" value="mml"/> 
     252                </transformation> 
     253                <transformation code="mml2png" type="com.scenari.s.co.transform.oo.HTransformerOo"> 
     254                        <property key="ooTransformerClassName" value="com.scenari.s.oo.transform.TransformerExportOdfViaDraw"/> 
     255                        <property key="filterName" value="draw_png_Export"/> 
     256                        <property key="extension" value=".png"/> 
     257                        <property key="source" value="mml"/> 
     258                </transformation> 
     259                <transformation code="mml2gif" type="com.scenari.s.co.transform.oo.HTransformerOo"> 
     260                        <property key="ooTransformerClassName" value="com.scenari.s.oo.transform.TransformerExportOdfViaDraw"/> 
     261                        <property key="filterName" value="draw_gif_Export"/> 
     262                        <property key="extension" value=".gif"/> 
     263                        <property key="source" value="mml"/> 
     264                </transformation> 
    250265                 
    251266                <transformation code="od2props" type="com.scenari.s.co.transform.oo.HTransformerOo"> 
  • trunk/Jav_Oo/com/scenari/s/oo/transform/TransformerExportOdfViaDraw.java

    r7759 r8858  
    4343import java.io.InputStream; 
    4444 
     45import com.scenari.s.co.odstorage.OdFile; 
     46import com.scenari.s.co.source.fs.WSourceElemFs; 
     47import com.scenari.s.co.transform.HTransformParams; 
     48import com.scenari.s.fw.log.HLogMgr; 
     49import com.scenari.s.fw.utils.stream.HStream; 
    4550import com.sun.star.awt.Point; 
    4651import com.sun.star.awt.Size; 
     
    6267import com.sun.star.view.XSelectionSupplier; 
    6368 
    64 import com.scenari.s.co.odstorage.OdFile; 
    65 import com.scenari.s.co.source.fs.WSourceElemFs; 
    66 import com.scenari.s.co.transform.HTransformParams; 
    67 import com.scenari.s.fw.log.HLogMgr; 
    68 import com.scenari.s.fw.utils.stream.HStream; 
    69  
    7069/** 
    7170 * Transforme un document ODF par les fonctions d'export d'openOffice via l'application draw. 
     
    102101public class TransformerExportOdfViaDraw extends TransformerExportImgBase { 
    103102 
    104     protected static File sMasterOd = null; 
    105  
    106     /** 
    107      *  
    108      * @see com.scenari.s.co.transform.IHTransformer#hTransform(Object, Object, com.scenari.s.co.transform.HTransformParams) 
    109      */ 
    110     public void hTransform(Object pSrc, Object pRes, HTransformParams pParams) throws Exception { 
    111         File vOdgFile = null; 
    112         Object vDocDraw = null; 
    113         OdFile vOdFile = null; 
    114         try { 
    115  
    116             int vMarginTop = getMarginTop(pParams); 
    117             int vMarginLeft = getMarginLeft(pParams); 
    118             int vWMargin = vMarginLeft + getMarginRight(pParams); 
    119             int vHMargin = vMarginTop + getMarginBottom(pParams); 
    120  
    121             //Récupération du component loader 
    122             OoBootstrap.checkConnection(); 
     103        protected static File sMasterOd = null; 
     104 
     105        protected boolean fFromMml = false; 
     106 
     107        /** 
     108         *  
     109         * @see com.scenari.s.co.transform.IHTransformer#hTransform(Object, Object, com.scenari.s.co.transform.HTransformParams) 
     110         */ 
     111        public void hTransform(Object pSrc, Object pRes, HTransformParams pParams) throws Exception { 
     112                File vOdgFile = null; 
     113                File vTmpOdf = null; 
     114                Object vDocDraw = null; 
     115                OdFile vOdFile = null; 
     116 
     117                try { 
     118 
     119                        int vMarginTop = getMarginTop(pParams); 
     120                        int vMarginLeft = getMarginLeft(pParams); 
     121                        int vWMargin = vMarginLeft + getMarginRight(pParams); 
     122                        int vHMargin = vMarginTop + getMarginBottom(pParams); 
     123 
     124                        //Récupération du component loader 
     125                        OoBootstrap.checkConnection(); 
    123126                        XComponentLoader vCompLoader = OoBootstrap.getComponentLoader(); 
    124127 
    125             vOdFile = new OdFile(); 
    126             vOdFile.initFromOdFile(getMaster()); 
    127             vOdFile.includeOd("Object 1/", new WSourceElemFs(((File) pSrc).getPath()), false); 
    128             vOdgFile = File.createTempFile("transformOdfViaDraw", ".odg"); 
    129             vOdFile.export(new WSourceElemFs(vOdgFile.getPath())); 
    130  
    131             // On charge le doc source 
    132             String vUrl = "file://".concat(vOdgFile.toURL().toExternalForm().substring(5)); 
    133             PropertyValue vProps[] = new PropertyValue[1]; 
    134             vProps[0] = new PropertyValue(); 
    135             vProps[0].Name = "Hidden"; 
    136             vProps[0].Value = Boolean.TRUE; 
    137             vDocDraw = vCompLoader.loadComponentFromURL(vUrl, "_blank", 0, vProps); 
    138             XDrawPagesSupplier vDrawPagesSupplier_DocDraw = (XDrawPagesSupplier) UnoRuntime.queryInterface(XDrawPagesSupplier.class, vDocDraw); 
    139             XIndexAccess vIndexedDrawPages = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, vDrawPagesSupplier_DocDraw.getDrawPages()); 
    140             XDrawPage vDrawPage = (XDrawPage) UnoRuntime.queryInterface(XDrawPage.class, vIndexedDrawPages.getByIndex(0)); 
    141  
    142             //On sélectionne le shape OLE 
    143             XShape vOleShape = (XShape) UnoRuntime.queryInterface(XShape.class, vDrawPage.getByIndex(0)); 
    144             XController vController = ((XModel) UnoRuntime.queryInterface(XModel.class, vDocDraw)).getCurrentController(); 
    145             XFrame vFrameDoc = vController.getFrame(); 
    146  
    147  
    148             // NOTE : pour contourner un bug OO de blocage 
    149             long vOdFileSize = vOdgFile.length(); 
    150             long vTimeMs = vOdFileSize / 1000; 
    151             Thread.sleep(vTimeMs); 
    152              
    153             XSelectionSupplier vSelSupplier = (XSelectionSupplier) UnoRuntime.queryInterface(XSelectionSupplier.class, vController); 
    154             vSelSupplier.select(vOleShape); 
    155  
    156             //On rafarichit les dimensions du shape 
    157             XDispatchHelper vDipatchHelper = (XDispatchHelper) UnoRuntime.queryInterface(XDispatchHelper.class, OoBootstrap.createService("com.sun.star.frame.DispatchHelper")); 
    158             vDipatchHelper.executeDispatch((XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, vFrameDoc), ".uno:OriginalSize", "", 0, null); 
    159  
    160             //On met à jour les dimensions de la page 
    161             Size vSize = vOleShape.getSize(); 
    162  
    163             //On applique les transformations. 
    164             if (applyTransform(pParams, vSize)) { 
    165                 //On réapplique les nouevlles Dim 
    166                 vOleShape.setSize(vSize); 
    167             } 
    168  
    169             //On replace en fonction des margin 
    170             vOleShape.setPosition(new Point(vMarginTop, vMarginLeft)); 
    171  
    172             //On met à jour les dimensions de la page 
    173             XPropertySet vProps_DrawPage = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, vDrawPage); 
    174             vProps_DrawPage.setPropertyValue("Width", new Integer(vSize.Width + vWMargin)); 
    175             vProps_DrawPage.setPropertyValue("Height", new Integer(vSize.Height + vHMargin)); 
    176  
    177             //On interroge le docDraw par son interface XStorable. 
    178             XStorable vStorableDocDraw = (XStorable) UnoRuntime.queryInterface(XStorable.class, vDocDraw); 
    179  
    180             // Propriétés de conversion 
    181             vProps = new PropertyValue[2]; 
    182             vProps[0] = new PropertyValue(); 
    183             vProps[0].Name = "Overwrite"; 
    184             vProps[0].Value = Boolean.TRUE; 
    185             vProps[1] = new PropertyValue(); 
    186             vProps[1].Name = "FilterName"; 
    187             vProps[1].Value = fFilterName; 
    188  
    189             //On transforme. 
    190             vStorableDocDraw.storeToURL("file://".concat(((File) pRes).toURL().toExternalForm().substring(5)), vProps); 
    191  
    192             /* 
    193              ######### GraphicExportFilter : impossible Flash impossible. ############### 
    194              Object vGraphicExportFilter = OoBootstrap.createService("com.sun.star.drawing.GraphicExportFilter"); 
    195  
    196              XExporter vExporter_GraphicExportFilter = (XExporter) UnoRuntime.queryInterface(XExporter.class, vGraphicExportFilter); 
    197              vExporter_GraphicExportFilter.setSourceDocument((XComponent) UnoRuntime.queryInterface(XComponent.class, vOle_Shape)); 
    198              XMimeTypeInfo vInfo = (XMimeTypeInfo) UnoRuntime.queryInterface(XMimeTypeInfo.class, vGraphicExportFilter); 
    199              String[] vList = vInfo.getSupportedMimeTypeNames(); 
    200              for (int i = 0; i < vList.length; i++) { 
    201              System.out.println(vList[i]); 
    202              } 
    203  
    204              vProps = new PropertyValue[3]; 
    205              vProps[0] = new PropertyValue(); 
    206              //vProps[0].Name = "MediaType"; 
    207              //vProps[0].Value = "image/png"; 
    208              //vProps[0].Value = "application/x-shockwave-flash"; 
    209              vProps[0].Name = "FilterName"; 
    210              vProps[0].Value = "WMF"; 
    211              //vProps[3] = new PropertyValue(); 
    212              //vProps[3].Name = "FilterName"; 
    213              //vProps[3].Value = fFilterName; 
    214               
    215              vProps[1] = new PropertyValue(); 
    216              vProps[1].Name = "URL"; 
    217              vProps[1].Value = "file://".concat(((File) pRes).toURL().toExternalForm().substring(5)); 
    218              vProps[2] = new PropertyValue(); 
    219              vProps[2].Name = "Overwrite"; 
    220              vProps[2].Value = Boolean.TRUE; 
    221              XFilter vFilter_GraphicExportFilter = (XFilter) UnoRuntime.queryInterface(XFilter.class, vGraphicExportFilter); 
    222              vFilter_GraphicExportFilter.filter(vProps); 
    223              */ 
    224  
    225         } catch (Exception e) { 
    226             throw (Exception) HLogMgr.hAddMessage(e, "Echec à la transformation d'une ressource OpenDocument."); 
    227         } finally { 
    228             try { 
    229                 //On clos le doc. 
    230                 XCloseable vCloseableDoc = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, vDocDraw); 
    231                 vCloseableDoc.close(false); 
    232             } catch (Exception e) { 
    233                 HLogMgr.hPublishException(e); 
    234             } 
     128                        if (fFromMml) { 
     129                                vTmpOdf = File.createTempFile("transformOdfViaDraw", ".odf"); 
     130                                OdFile vOdf = new OdFile(); 
     131                                vOdf.initEmptyFile(OdFile.MIME_ODF); 
     132                                vOdf.addFile("content.xml", new WSourceElemFs(((File) pSrc).getPath())); 
     133                                vOdf.export(new FileOutputStream(vTmpOdf)); 
     134                                pSrc = vTmpOdf; 
     135                        } 
     136 
     137                        vOdFile = new OdFile(); 
     138                        vOdFile.initFromOdFile(getMaster()); 
     139                        vOdFile.includeOd("Object 1/", new WSourceElemFs(((File) pSrc).getPath()), false); 
     140                        vOdgFile = File.createTempFile("transformOdfViaDraw", ".odg"); 
     141                        vOdFile.export(new WSourceElemFs(vOdgFile.getPath())); 
     142 
     143                        // On charge le doc source 
     144                        String vUrl = "file://".concat(vOdgFile.toURL().toExternalForm().substring(5)); 
     145                        PropertyValue vProps[] = new PropertyValue[1]; 
     146                        vProps[0] = new PropertyValue(); 
     147                        vProps[0].Name = "Hidden"; 
     148                        vProps[0].Value = Boolean.TRUE; 
     149                        vDocDraw = vCompLoader.loadComponentFromURL(vUrl, "_blank", 0, vProps); 
     150                        XDrawPagesSupplier vDrawPagesSupplier_DocDraw = (XDrawPagesSupplier) UnoRuntime.queryInterface(XDrawPagesSupplier.class, vDocDraw); 
     151                        XIndexAccess vIndexedDrawPages = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, vDrawPagesSupplier_DocDraw.getDrawPages()); 
     152                        XDrawPage vDrawPage = (XDrawPage) UnoRuntime.queryInterface(XDrawPage.class, vIndexedDrawPages.getByIndex(0)); 
     153 
     154                        //On sélectionne le shape OLE 
     155                        XShape vOleShape = (XShape) UnoRuntime.queryInterface(XShape.class, vDrawPage.getByIndex(0)); 
     156                        XController vController = ((XModel) UnoRuntime.queryInterface(XModel.class, vDocDraw)).getCurrentController(); 
     157                        XFrame vFrameDoc = vController.getFrame(); 
     158 
     159                        // NOTE : pour contourner un bug OO de blocage 
     160                        long vOdFileSize = vOdgFile.length(); 
     161                        long vTimeMs = vOdFileSize / 1000; 
     162                        Thread.sleep(vTimeMs); 
     163 
     164                        XSelectionSupplier vSelSupplier = (XSelectionSupplier) UnoRuntime.queryInterface(XSelectionSupplier.class, vController); 
     165                        vSelSupplier.select(vOleShape); 
     166 
     167                        //On rafarichit les dimensions du shape 
     168                        XDispatchHelper vDipatchHelper = (XDispatchHelper) UnoRuntime.queryInterface(XDispatchHelper.class, OoBootstrap.createService("com.sun.star.frame.DispatchHelper")); 
     169                        vDipatchHelper.executeDispatch((XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, vFrameDoc), ".uno:OriginalSize", "", 0, null); 
     170 
     171                        //On met à jour les dimensions de la page 
     172                        Size vSize = vOleShape.getSize(); 
     173 
     174                        //On applique les transformations. 
     175                        if (applyTransform(pParams, vSize)) { 
     176                                //On réapplique les nouevlles Dim 
     177                                vOleShape.setSize(vSize); 
     178                        } 
     179 
     180                        //On replace en fonction des margin 
     181                        vOleShape.setPosition(new Point(vMarginTop, vMarginLeft)); 
     182 
     183                        //On met à jour les dimensions de la page 
     184                        XPropertySet vProps_DrawPage = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, vDrawPage); 
     185                        vProps_DrawPage.setPropertyValue("Width", new Integer(vSize.Width + vWMargin)); 
     186                        vProps_DrawPage.setPropertyValue("Height", new Integer(vSize.Height + vHMargin)); 
     187 
     188                        //On interroge le docDraw par son interface XStorable. 
     189                        XStorable vStorableDocDraw = (XStorable) UnoRuntime.queryInterface(XStorable.class, vDocDraw); 
     190 
     191                        // Propriétés de conversion 
     192                        vProps = new PropertyValue[2]; 
     193                        vProps[0] = new PropertyValue(); 
     194                        vProps[0].Name = "Overwrite"; 
     195                        vProps[0].Value = Boolean.TRUE; 
     196                        vProps[1] = new PropertyValue(); 
     197                        vProps[1].Name = "FilterName"; 
     198                        vProps[1].Value = fFilterName; 
     199 
     200                        //On transforme. 
     201                        vStorableDocDraw.storeToURL("file://".concat(((File) pRes).toURL().toExternalForm().substring(5)), vProps); 
     202 
     203                        /* 
     204                         ######### GraphicExportFilter : impossible Flash impossible. ############### 
     205                         Object vGraphicExportFilter = OoBootstrap.createService("com.sun.star.drawing.GraphicExportFilter"); 
     206 
     207                         XExporter vExporter_GraphicExportFilter = (XExporter) UnoRuntime.queryInterface(XExporter.class, vGraphicExportFilter); 
     208                         vExporter_GraphicExportFilter.setSourceDocument((XComponent) UnoRuntime.queryInterface(XComponent.class, vOle_Shape)); 
     209                         XMimeTypeInfo vInfo = (XMimeTypeInfo) UnoRuntime.queryInterface(XMimeTypeInfo.class, vGraphicExportFilter); 
     210                         String[] vList = vInfo.getSupportedMimeTypeNames(); 
     211                         for (int i = 0; i < vList.length; i++) { 
     212                         System.out.println(vList[i]); 
     213                         } 
     214 
     215                         vProps = new PropertyValue[3]; 
     216                         vProps[0] = new PropertyValue(); 
     217                         //vProps[0].Name = "MediaType"; 
     218                         //vProps[0].Value = "image/png"; 
     219                         //vProps[0].Value = "application/x-shockwave-flash"; 
     220                         vProps[0].Name = "FilterName"; 
     221                         vProps[0].Value = "WMF"; 
     222                         //vProps[3] = new PropertyValue(); 
     223                         //vProps[3].Name = "FilterName"; 
     224                         //vProps[3].Value = fFilterName; 
     225                          
     226                         vProps[1] = new PropertyValue(); 
     227                         vProps[1].Name = "URL"; 
     228                         vProps[1].Value = "file://".concat(((File) pRes).toURL().toExternalForm().substring(5)); 
     229                         vProps[2] = new PropertyValue(); 
     230                         vProps[2].Name = "Overwrite"; 
     231                         vProps[2].Value = Boolean.TRUE; 
     232                         XFilter vFilter_GraphicExportFilter = (XFilter) UnoRuntime.queryInterface(XFilter.class, vGraphicExportFilter); 
     233                         vFilter_GraphicExportFilter.filter(vProps); 
     234                         */ 
     235 
     236                } catch (Exception e) { 
     237                        throw (Exception) HLogMgr.hAddMessage(e, "Echec à la transformation d'une ressource OpenDocument."); 
     238                } finally { 
     239                        try { 
     240                                //On clos le doc. 
     241                                XCloseable vCloseableDoc = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, vDocDraw); 
     242                                vCloseableDoc.close(false); 
     243                        } catch (Exception e) { 
     244                                HLogMgr.hPublishException(e); 
     245                        } 
    235246                        if (vOdFile != null) { 
    236247                                try { 
     
    247258                                } 
    248259                        } 
    249         } 
    250     } 
    251  
    252     /** 
    253      * TEST 
    254      *  
    255      * java com.scenari.s.oo.transform.HTransformerExport "c:\test.odt" "c:\res.pdf" "writer_pdf_Export" "scale=1" 
    256      *  
    257      */ 
    258     public static void main(String pArgs[]) { 
    259         try { 
    260             TransformerExportOdfViaDraw vTransf = new TransformerExportOdfViaDraw(); 
    261             vTransf.wSetProperty("filterName", pArgs[2]); //"HTML (StarWriter)";//"XHTML Writer File"; //"writer_pdf_Export"; 
    262  
    263             //for (int i = 1; i < 1000; i++) { 
    264             //    long vT0 = System.currentTimeMillis(); 
    265  
    266             vTransf.hTransform(new File(pArgs[0]), new File(pArgs[1]), HTransformParams.hNewParamsTransformByQueryString("transform=od2x&" + pArgs[3], "UTF-8")); 
    267  
    268             //    System.out.println("Time "+i+" = "+((System.currentTimeMillis()-vT0))); 
    269             //} 
    270  
    271             System.exit(0); 
    272         } catch (Exception e) { 
    273             e.printStackTrace(); 
    274             System.exit(0); 
    275         } 
    276     } 
    277  
    278     protected static synchronized File getMaster() throws Exception { 
    279         if (sMasterOd == null || !sMasterOd.isFile()) { 
    280             InputStream vInput = TransformerExportOdfViaDraw.class.getResourceAsStream("FormulaInDrawMaster.odg"); 
    281             sMasterOd = File.createTempFile("masterOdf", ".odg"); 
    282             sMasterOd.deleteOnExit(); 
    283             HStream.hWrite(vInput, new FileOutputStream(sMasterOd)); 
    284         } 
    285         return sMasterOd; 
    286     } 
    287  
     260                        if (vTmpOdf != null) { 
     261                                try { 
     262                                        vTmpOdf.delete(); 
     263                                } catch (Exception e) { 
     264                                        HLogMgr.hPublishException(e); 
     265                                } 
     266 
     267                        } 
     268                } 
     269        } 
     270 
     271        /** 
     272         * TEST 
     273         *  
     274         * java com.scenari.s.oo.transform.TransformerExportOdfViaDraw "c:\test.mml" "c:\res.odf" "draw_png_Export" "scale=1" 
     275         *  
     276         */ 
     277        public static void main(String pArgs[]) { 
     278                try { 
     279                        TransformerExportOdfViaDraw vTransf = new TransformerExportOdfViaDraw(); 
     280                        vTransf.fFromMml = true; 
     281                        vTransf.wSetProperty("filterName", pArgs[2]); // "draw_flash_Export", "draw_pdf_Export", "draw_png_Export" 
     282 
     283                        //for (int i = 1; i < 1000; i++) { 
     284                        //    long vT0 = System.currentTimeMillis(); 
     285 
     286                        vTransf.hTransform(new File(pArgs[0]), new File(pArgs[1]), HTransformParams.hNewParamsTransformByQueryString("transform=od2x&" + pArgs[3], "UTF-8")); 
     287 
     288                        //    System.out.println("Time "+i+" = "+((System.currentTimeMillis()-vT0))); 
     289                        //} 
     290 
     291                        System.exit(0); 
     292                } catch (Exception e) { 
     293                        e.printStackTrace(); 
     294                        System.exit(0); 
     295                } 
     296        } 
     297 
     298        protected static synchronized File getMaster() throws Exception { 
     299                if (sMasterOd == null || !sMasterOd.isFile()) { 
     300                        InputStream vInput = TransformerExportOdfViaDraw.class.getResourceAsStream("FormulaInDrawMaster.odg"); 
     301                        sMasterOd = File.createTempFile("masterOdf", ".odg"); 
     302                        sMasterOd.deleteOnExit(); 
     303                        HStream.hWrite(vInput, new FileOutputStream(sMasterOd)); 
     304                } 
     305                return sMasterOd; 
     306        } 
     307 
     308 
     309        public void wSetProperty(String pKey, String pValue) { 
     310                if (pKey.equals("source") && pValue.equals("mml")) { 
     311                        fFromMml = true; 
     312                } else { 
     313                        super.wSetProperty(pKey, pValue); 
     314                } 
     315        } 
    288316} 
  • trunk/Wsp_Modeling/spaces/gen/modelBuilder/bs.doss/sm_freePrim.xml

    r7846 r8858  
    176176                                        <xsl0:template match="sm:freePrim"> 
    177177                                                <xsl0:apply-templates select="sm:namespaceToDeclare"/> 
    178                                                 <xsl0:value-of select="sm:storageSheet/sm:xslGenAttrRefs/text()" disable-output-escaping="yes"/> 
     178                                                <xsl0:value-of select="string(sm:storageSheet/sm:xslGenAttrRefs)" disable-output-escaping="yes"/> 
    179179                                        </xsl0:template> 
    180180                                        <xsl0:template match="sm:namespaceToDeclare"> 
     
    201201                                        <xsl0:template match="sm:freePrim"> 
    202202                                                <xsl0:apply-templates select="sm:namespaceToDeclare"/> 
    203                                                 <xsl0:value-of select="sm:storageSheet/sm:relaxNg/text()" disable-output-escaping="yes"/> 
    204                                                 <xsl0:if test="not(sm:storageSheet/sm:relaxNg/text())"> 
     203                                                <xsl0:value-of select="string(sm:storageSheet/sm:relaxNg)" disable-output-escaping="yes"/> 
     204                                                <xsl0:if test="not(string(sm:storageSheet/sm:relaxNg))"> 
    205205                                                        <sng:define name="{resultatAgent('//codeModel')}"> 
    206206                                                                <!-- Name de l'élément racine à revoir ? --> 
     
    247247        <!-- @API Item public : Utilisé par le WSP pour construire le pack.js --> 
    248248        <valeur code="registerModelInPack"> 
    249                 <source type="xpath-dynamique">concat( 
    250                                 resultatAgent('standAloneItem'), 
    251                                 '/*', resultatAgent('copyStaticRes'),'*/', 
    252                                 '/*', resultatAgent('copyDynamicRes'),'*/')      
    253                                 </source> 
    254                 <valeur code="standAloneItem" racine="sm:editionSheet/sm:standAloneItem"> 
    255                         <source type="inclusion-dynamique"> 
    256                                 <source type="contextuel-dynamique"> 
    257                                         <choose> 
    258                                                 <case xpath="sm:registerModelInPack/text()" returnXpath="true"/> 
    259                                                 <default> vModel = new ModelBase( "[![agent=//codeModel]!]", "[![agent=//iconFolderPath]!]", "[![agent=//nameModelInJs]!]", "[![agent=//mainview.xul;arguments=act:]!]" ); vPack.registerModel(vModel); </default> 
    260                                         </choose> 
    261                                 </source> 
    262                         </source> 
     249                <source type="inclusion-dynamique"> 
     250                        <source type="xpathOnSrc-dynamique">concat( 
     251                                        si(sm:editionSheet/sm:standAloneItem/sm:registerModelInPack, sm:editionSheet/sm:standAloneItem/sm:registerModelInPack, resultatAgent('standAloneItem')), 
     252                                        execute(resultatAgent('copyStaticRes'), resultatAgent('copyDynamicRes')) 
     253                                        )        
     254                        </source> 
     255                </source> 
     256                <valeur code="standAloneItem" racine="sm:editionSheet/sm:standAloneItem[not(sm:registerModelInPack)]"> 
     257                        <source> 
     258        vModel = new ModelBase( "[![agent=//codeModel]!]", 
     259                "[![agent=//iconFolderPath]!]", 
     260                "[![agent=//nameModelInJs]!]", 
     261                "[![agent=//mainview.xul;arguments=act:]!]"); 
     262        vPack.registerModel(vModel); </source> 
    263263                </valeur> 
    264264                <!-- copie des ressource statiques --> 
     
    295295        <valeur code="creatorItemInPack" racine="sm:editionSheet/sm:standAloneItem"> 
    296296                <source type="inclusion-dynamique"> 
    297                         <source type="xpath-statique">sm:creatorItemInPack/text()</source> 
     297                        <source type="xpath-statique">string(sm:creatorItemInPack)</source> 
    298298                </source> 
    299299        </valeur> 
     
    320320                                <source type="contextuel-dynamique"> 
    321321                                        <choose> 
    322                                                 <case xpath="sm:editionSheet/sm:previewXslRoot/text()" returnXpath="true"/> 
     322                                                <case xpath="string(sm:editionSheet/sm:previewXslRoot)" returnXpath="true"/> 
    323323                                                <default type="composition-dynamique"> 
    324324                                                        <c:composition xmlns:c="composition" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
     
    368368                                        <xsl0:template match="sm:freePrim"> 
    369369                                                <xsl0:apply-templates select="sm:namespaceToDeclare"/> 
    370                                                 <xsl0:value-of select="sm:editionSheet/sm:previewXslTemplates/text()" disable-output-escaping="yes"/> 
     370                                                <xsl0:value-of select="string(sm:editionSheet/sm:previewXslTemplates)" disable-output-escaping="yes"/> 
    371371                                        </xsl0:template> 
    372372                                        <xsl0:template match="sm:namespaceToDeclare"> 
     
    491491        </valeur> 
    492492         
     493        <!-- @API (pour la freePrim) Item public : permet de construire manuellement une url chrome vers une ressource static.  --> 
     494        <valeur code="prefixChromeUrl"> 
     495                <source type="xpath-dynamique">concat('chrome://', resultatAgent('@@/chromeCode'), '/content')</source> 
     496        </valeur> 
     497         
    493498</structure> 
Note: See TracChangeset for help on using the changeset viewer.