예제 #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);
        }
        private void Start()
        {
            controller = null;

            SetDisplay();

            presentation.start();

            int i = 1;
            while (controller == null && i < 150)
            {
                Thread.Sleep(100);
                i++;
                controller = presentation.getController();
            }

            if (controller == null)
                throw new InvalidOperationException();

            controller.addSlideShowListener(listener);

            if (!isEndless.HasValue)
                isEndless = controller.isEndless();

            controller.gotoSlideIndex(restoreSlideIndex.HasValue ? restoreSlideIndex.Value : 0);

            IntPtr presenterConsoleHandle;

            GetWindowHandles(out presenterConsoleHandle, out presentationHandle);

            WordsLive.Presentation.Wpf.Interop.RemoveFromAeroPeek(presentationHandle);

            if (presenterConsoleHandle != IntPtr.Zero)
            {
                ShowWindow(presenterConsoleHandle, 0); // hide presenter console
            }

            ResizeWindow();

            if (!isShown)
            {
                ShowWindow(presentationHandle,11); // hide presentation window if needed // 0

                IntPtr child = FindWindowEx(presentationHandle, IntPtr.Zero, "SALOBJECT", null);
                IntPtr child2 = FindWindowEx(child, IntPtr.Zero, "SALOBJECTCHILD", null);

                ShowWindow(child, 11);
            }

            if (preview != null)
            {
                (preview as LiveWindowPreviewProvider).UpdateSource(presentationHandle);
            }

            Controller.Dispatcher.Invoke(new Action(() => Controller.FocusMainWindow(true)));
        }
예제 #3
0
        private void Start()
        {
            controller = null;

            SetDisplay();

            presentation.start();

            int i = 1;

            while (controller == null && i < 150)
            {
                Thread.Sleep(100);
                i++;
                controller = presentation.getController();
            }

            if (controller == null)
            {
                throw new InvalidOperationException();
            }

            controller.addSlideShowListener(listener);

            if (!isEndless.HasValue)
            {
                isEndless = controller.isEndless();
            }

            controller.gotoSlideIndex(restoreSlideIndex.HasValue ? restoreSlideIndex.Value : 0);

            IntPtr presenterConsoleHandle;

            GetWindowHandles(out presenterConsoleHandle, out presentationHandle);

            WordsLive.Presentation.Wpf.Interop.RemoveFromAeroPeek(presentationHandle);

            if (presenterConsoleHandle != IntPtr.Zero)
            {
                ShowWindow(presenterConsoleHandle, 0);                 // hide presenter console
            }

            ResizeWindow();

            if (!isShown)
            {
                ShowWindow(presentationHandle, 11);                // hide presentation window if needed // 0

                IntPtr child  = FindWindowEx(presentationHandle, IntPtr.Zero, "SALOBJECT", null);
                IntPtr child2 = FindWindowEx(child, IntPtr.Zero, "SALOBJECTCHILD", null);

                ShowWindow(child, 11);
            }

            if (preview != null)
            {
                (preview as LiveWindowPreviewProvider).UpdateSource(presentationHandle);
            }

            Controller.Dispatcher.Invoke(new Action(() => Controller.FocusMainWindow(true)));
        }