Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*************************************************************************
3 : *
4 : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : *
6 : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : *
8 : * OpenOffice.org - a multi-platform office productivity suite
9 : *
10 : * This file is part of OpenOffice.org.
11 : *
12 : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : * it under the terms of the GNU Lesser General Public License version 3
14 : * only, as published by the Free Software Foundation.
15 : *
16 : * OpenOffice.org is distributed in the hope that it will be useful,
17 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : * GNU Lesser General Public License version 3 for more details
20 : * (a copy is included in the LICENSE file that accompanied this code).
21 : *
22 : * You should have received a copy of the GNU Lesser General Public License
23 : * version 3 along with OpenOffice.org. If not, see
24 : * <http://www.openoffice.org/license.html>
25 : * for a copy of the LGPLv3 License.
26 : *
27 : ************************************************************************/
28 :
29 : #ifndef __SO_INSTANCE_HXX__
30 : #define __SO_INSTANCE_HXX__
31 :
32 : #include <com/sun/star/lang/XServiceInfo.hpp>
33 : #include <osl/diagnose.h>
34 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 : #include <com/sun/star/io/XActiveDataSource.hpp>
36 : #include <com/sun/star/bridge/XUnoUrlResolver.hpp>
37 : #include <com/sun/star/uno/XNamingService.hpp>
38 : #include <com/sun/star/connection/ConnectionSetupException.hpp>
39 : #include <com/sun/star/frame/XComponentLoader.hpp>
40 : #include <com/sun/star/util/URL.hpp>
41 : #include <com/sun/star/frame/XStorable.hpp>
42 : #include <com/sun/star/io/XSeekable.hpp>
43 :
44 : #include <com/sun/star/uno/XComponentContext.hpp>
45 : #include <com/sun/star/util/XCloseListener.hpp>
46 : #include <cppuhelper/bootstrap.hxx>
47 : #include <com/sun/star/awt/WindowDescriptor.hpp>
48 : #include <rtl/ustring.hxx>
49 : #include <com/sun/star/awt/XWindow.hpp>
50 : #include <com/sun/star/frame/XFrame.hpp>
51 : #include <com/sun/star/frame/XDispatchHelper.hpp>
52 :
53 : #include "ns_debug.hxx"
54 :
55 : typedef sal_Int32 NSP_HWND;
56 :
57 : class PluginDocumentClosePreventer;
58 : class SoPluginInstance
59 : {
60 :
61 : private:
62 : // Service manager of remote Soffice
63 : static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxRemoteMSF;
64 : // Dir where Soffice is in, ie. /Soffice7/program
65 : static char sSO_Dir[NPP_PATH_MAX];
66 : int m_nWidth;
67 : int m_nHeight;
68 : int m_nX;
69 : int m_nY;
70 : sal_Int16 m_nFlag; // Set to 12 during initialization
71 : ::rtl::OUString m_sURL; // URL of the document to be loaded
72 : sal_Bool m_bInit; // If the Plugin instance is initilaized.
73 : NSP_HWND m_hParent; // Windows handle of parent window
74 : long m_pParent; // ID of this instance - get from NPP
75 : // StarOffice window
76 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xUnoWin;
77 : // StarOffice component window
78 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xComponent;
79 : // StarOffice frame for this Plugin
80 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
81 : // Frames of StarOffice
82 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrames > m_xFrames;
83 : // Dispatcher of frame
84 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchHelper > m_xDispatcher;
85 : // DispatchProvider of frame
86 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider;
87 :
88 : // the closelistener that will prevent document closing
89 : PluginDocumentClosePreventer* m_pCloseListener;
90 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener > m_xCloseListener;
91 :
92 : sal_Bool LoadDocument(NSP_HWND hParent);
93 :
94 : long m_dParentStyl; // Old Windows style of parent window
95 :
96 :
97 : public:
98 : SoPluginInstance(long iInstance, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF);
99 : virtual ~SoPluginInstance(void);
100 : virtual sal_Bool SetURL(char* aURL);
101 0 : virtual sal_Bool IsInit(void){return m_bInit;};
102 : virtual sal_Bool SetWindow(NSP_HWND hParent, int x, int y, int w, int h) ;
103 : virtual sal_Bool Destroy(void) ;
104 : virtual sal_Bool Print(void) ;
105 :
106 : static sal_Bool ShutDown(void);
107 : static char* GetSODir(void) {return sSO_Dir;};
108 0 : long GetParent(void) {return m_pParent;};
109 : };
110 :
111 : #endif
112 :
113 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|