コード例 #1
0
    def createNewPreviewFrame(self, xMSF, listener):
        xToolkit = None
        try:
            xToolkit = xMSF.createInstance("com.sun.star.awt.Toolkit")
        except Exception:
            # TODO Auto-generated catch block
            traceback.print_exc()

        #describe the window and its properties
        aDescriptor = WindowDescriptor()
        aDescriptor.Type = TOP
        aDescriptor.WindowServiceName = "window"
        aDescriptor.ParentIndex = -1
        aDescriptor.Parent = None
        aDescriptor.Bounds = Rectangle(10, 10, 640, 480)

        #Set Window Attributes
        gnDefaultWindowAttributes = \
            com_sun_star_awt_WindowAttribute_BORDER + \
            com_sun_star_awt_WindowAttribute_MOVEABLE + \
            com_sun_star_awt_WindowAttribute_SIZEABLE + \
            com_sun_star_awt_VclWindowPeerAttribute_CLIPCHILDREN

        aDescriptor.WindowAttributes = gnDefaultWindowAttributes
        #create a new blank container window
        xPeer = None
        try:
            xPeer = xToolkit.createWindow(aDescriptor)
        except IllegalArgumentException:
            traceback.print_exc()

        #define some further properties of the frame window
        #if it's needed .-)
        #xPeer->setBackground(...);
        #create new empty frame and set window on it
        xFrame = None
        try:
            xFrame = xMSF.createInstance("com.sun.star.frame.Frame")
        except Exception:
            traceback.print_exc()

        xFrame.initialize(xPeer)
        #from now this frame is useable ...
        #and not part of the desktop tree.
        #You are alone with him .-)
        if listener is not None:
            Desktop.getDesktop(xMSF).addTerminateListener(
                TerminateListenerProcAdapter(listener))

        return xFrame
コード例 #2
0
ファイル: OfficeDocument.py プロジェクト: rohanKanojia/core
    def createNewPreviewFrame(self, xMSF, listener):
        xToolkit = None
        try:
            xToolkit = xMSF.createInstance("com.sun.star.awt.Toolkit")
        except Exception:
            # TODO Auto-generated catch block
            traceback.print_exc()

        #describe the window and its properties
        aDescriptor = WindowDescriptor()
        aDescriptor.Type = TOP
        aDescriptor.WindowServiceName = "window"
        aDescriptor.ParentIndex = -1
        aDescriptor.Parent = None
        aDescriptor.Bounds = Rectangle(10, 10, 640, 480)

        #Set Window Attributes
        gnDefaultWindowAttributes = \
            com_sun_star_awt_WindowAttribute_BORDER + \
            com_sun_star_awt_WindowAttribute_MOVEABLE + \
            com_sun_star_awt_WindowAttribute_SIZEABLE + \
            com_sun_star_awt_VclWindowPeerAttribute_CLIPCHILDREN

        aDescriptor.WindowAttributes = gnDefaultWindowAttributes
        #create a new blank container window
        xPeer = None
        try:
            xPeer = xToolkit.createWindow(aDescriptor)
        except IllegalArgumentException:
            traceback.print_exc()

        #define some further properties of the frame window
        #if it's needed .-)
        #xPeer->setBackground(...);
        #create new empty frame and set window on it
        xFrame = None
        try:
            xFrame = xMSF.createInstance("com.sun.star.frame.Frame")
        except Exception:
            traceback.print_exc()

        xFrame.initialize(xPeer)
        #from now this frame is usable ...
        #and not part of the desktop tree.
        #You are alone with him .-)
        if listener is not None:
            Desktop.getDesktop(xMSF).addTerminateListener(listener)

        return xFrame
コード例 #3
0
 def createPreviewFrame(self, xmsf, xControl):
     controlPeer = xControl.Peer
     r = xControl.PosSize
     toolkit = xmsf.createInstance("com.sun.star.awt.Toolkit")
     aDescriptor = WindowDescriptor()
     aDescriptor.Type = SIMPLE
     aDescriptor.WindowServiceName = "window"
     aDescriptor.ParentIndex = -1
     aDescriptor.Parent = controlPeer
     #xWindowPeer; #argument !
     aDescriptor.Bounds = Rectangle(0, 0, r.Width, r.Height)
     aDescriptor.WindowAttributes = CLIPCHILDREN | SHOW
     self.xWindow = toolkit.createWindow(aDescriptor)
     self.xFrame = xmsf.createInstance("com.sun.star.frame.Frame")
     self.xFrame.initialize(self.xWindow)
     self.xWindow.setVisible(True)
コード例 #4
0
 def createPreviewFrame(self, xmsf, xControl):
     controlPeer = xControl.Peer
     r = xControl.PosSize
     toolkit = xmsf.createInstance("com.sun.star.awt.Toolkit")
     aDescriptor = WindowDescriptor()
     aDescriptor.Type = SIMPLE
     aDescriptor.WindowServiceName = "window"
     aDescriptor.ParentIndex = -1
     aDescriptor.Parent = controlPeer
     #xWindowPeer; #argument !
     aDescriptor.Bounds = Rectangle(0, 0, r.Width, r.Height)
     aDescriptor.WindowAttributes = CLIPCHILDREN | SHOW
     self.xWindow = toolkit.createWindow(aDescriptor)
     self.xFrame = xmsf.createInstance("com.sun.star.frame.Frame")
     self.xFrame.initialize(self.xWindow)
     self.xWindow.setVisible(True)