Beispiel #1
0
 def _get_pdf_config_access(self):
     """Access the PDF configuration."""
     aNamedValue = NamedValue()
     aNamedValue.Name = "nodepath"
     aNamedValue.Value = "/org.openoffice.Office.Common/Filter/PDF/Export/"
     xConfigurationUpdateAccess = self._config.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", (aNamedValue,) )
     return xConfigurationUpdateAccess
Beispiel #2
0
    def generate1(self, xmsf, layout, doc, fileAccess, targetPath, task):
        # a map that contains xsl templates. the keys are the xsl file names.
        templates = layout.getTemplates(xmsf)
        self.node = doc

        task.advance1(True, TASK_GENERATE_XSL)

        # each template generates a page.
        for key in templates:
            temp = templates[key]

            # The target file name is like the xsl template filename
            # without the .xsl extension.
            fn = fileAccess.getPath(targetPath, key[:len(key) - 4])

            args = list(range(1))
            nv = NamedValue()
            nv.Name = "StylesheetURL"
            nv.Value = temp
            args[0] = nv
            arguments = list(range(1))
            arguments[0] = tuple(args)

            self.tf = Process.createTransformer(xmsf, arguments)

            self.node.normalize()
            task.advance(True)

            # we want to be notfied when the processing is done...
            self.tf.addListener(
                StreamListenerProcAdapter(self, self.streamTerminatedHandler,
                                          self.streamStartedHandler,
                                          self.streamClosedHandler,
                                          self.streamErrorHandler))

            # create pipe
            pipeout = xmsf.createInstance("com.sun.star.io.Pipe")
            pipein = pipeout

            # connect sax writer to pipe
            self.xSaxWriter = xmsf.createInstance(
                "com.sun.star.xml.sax.Writer")
            self.xSaxWriter.setOutputStream(pipeout)

            # connect pipe to transformer
            self.tf.setInputStream(pipein)

            # connect transformer to output
            xOutputStream = fileAccess.xInterface.openFileWrite(fn)
            self.tf.setOutputStream(xOutputStream)

            self.tf.start()
            while (not self.tfCompleted):
                pass
            self.tf.terminate()
            task.advance(True)
Beispiel #3
0
    def generate1(self, xmsf, layout, doc, fileAccess, targetPath, task):
        # a map that contains xsl templates. the keys are the xsl file names.
        templates = layout.getTemplates(xmsf)
        self.node = doc

        task.advance1(True, TASK_GENERATE_XSL)

        # each template generates a page.
        for key in templates:
            temp = templates[key]

            # The target file name is like the xsl template filename
            # without the .xsl extension.
            fn = fileAccess.getPath(targetPath, key[:len(key) - 4])

            args = list(range(1))
            nv = NamedValue()
            nv.Name = "StylesheetURL"
            nv.Value = temp
            args[0] = nv
            arguments = list(range(1))
            arguments[0] = tuple(args)

            self.tf = Process.createTransformer(xmsf, arguments)

            self.node.normalize()
            task.advance(True)

            # we want to be notfied when the processing is done...
            self.tf.addListener(StreamListenerProcAdapter(self,
                                                          self.streamTerminatedHandler,
                                                          self.streamStartedHandler,
                                                          self.streamClosedHandler,
                                                          self.streamErrorHandler))

            # create pipe
            pipeout = xmsf.createInstance("com.sun.star.io.Pipe")
            pipein = pipeout

            # connect sax writer to pipe
            self.xSaxWriter = xmsf.createInstance( "com.sun.star.xml.sax.Writer" )
            self.xSaxWriter.setOutputStream(pipeout)

            # connect pipe to transformer
            self.tf.setInputStream(pipein)

            # connect transformer to output
            xOutputStream = fileAccess.xInterface.openFileWrite(fn)
            self.tf.setOutputStream(xOutputStream)

            self.tf.start()
            while (not self.tfCompleted):
                pass
            self.tf.terminate()
            task.advance(True)
Beispiel #4
0
def CreateNamedValue(name, value):
    v = NamedValue()
    v.Name = name
    v.Value = value
    return v