Beispiel #1
0
        void PerformLoad()
        {
            // Start LibreOffice and load file
            unoidl.com.sun.star.uno.XComponentContext     localContext        = uno.util.Bootstrap.bootstrap();
            unoidl.com.sun.star.lang.XMultiServiceFactory multiServiceFactory = (unoidl.com.sun.star.lang.XMultiServiceFactory)localContext.getServiceManager();
            desktop = (XDesktop)multiServiceFactory.createInstance("com.sun.star.frame.Desktop");
            var componentLoader = (XComponentLoader)desktop;

            component = componentLoader.loadComponentFromURL(CreateFileUrl(file.FullName), "_blank", 0, new PropertyValue[] { });

            // TODO: while/before loading, set the viewsettings ViewId:=view1, PageKind:=0 to reset to the default view
            // (instead of notes or outline view). Unfortunately these settings aren't accesible in the API ...

            // Get the main window's handle and hide the window
            document = (XModel)component;
            XWindow window = document.getCurrentController().getFrame().getContainerWindow();

            window.setVisible(false);
            XSystemDependentWindowPeer xWindowPeer = (XSystemDependentWindowPeer)(window);

            mainHandle = new IntPtr((int)xWindowPeer.getWindowHandle(new byte[] { }, SystemDependent.SYSTEM_WIN32).Value);
            //ShowWindow(mainHandle, 0);

            presentation = (XPresentation2)((XPresentationSupplier)component).getPresentation();

            CreateThumbnails();

            listener.SlideTransitionStarted += (sender, args) =>
            {
                OnSlideIndexChanged();
            };

            Start();
            controller.gotoSlideIndex(0);

            LoadPreviewProvider();

            base.OnLoaded(true);
        }
        void PerformLoad()
        {
            // Start LibreOffice and load file
            unoidl.com.sun.star.uno.XComponentContext localContext = uno.util.Bootstrap.bootstrap();
            unoidl.com.sun.star.lang.XMultiServiceFactory multiServiceFactory = (unoidl.com.sun.star.lang.XMultiServiceFactory)localContext.getServiceManager();
            desktop = (XDesktop)multiServiceFactory.createInstance("com.sun.star.frame.Desktop");
            var componentLoader = (XComponentLoader)desktop;
            component = componentLoader.loadComponentFromURL(CreateFileUrl(file.FullName), "_blank", 0, new PropertyValue[] { });

            // TODO: while/before loading, set the viewsettings ViewId:=view1, PageKind:=0 to reset to the default view
            // (instead of notes or outline view). Unfortunately these settings aren't accesible in the API ...

            // Get the main window's handle and hide the window
            document = (XModel)component;
            XWindow window = document.getCurrentController().getFrame().getContainerWindow();
            window.setVisible(false);
            XSystemDependentWindowPeer xWindowPeer = (XSystemDependentWindowPeer)(window);
            mainHandle = new IntPtr((int)xWindowPeer.getWindowHandle(new byte[] { }, SystemDependent.SYSTEM_WIN32).Value);
            //ShowWindow(mainHandle, 0);

            presentation = (XPresentation2)((XPresentationSupplier)component).getPresentation();

            CreateThumbnails();

            listener.SlideTransitionStarted += (sender, args) =>
            {
                OnSlideIndexChanged();
            };

            Start();
            controller.gotoSlideIndex(0);

            LoadPreviewProvider();

            base.OnLoaded(true);
        }