xref: /aoo41x/main/svx/source/inc/fmPropBrw.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef SVX_FMPROPBRW_HXX
28 #define SVX_FMPROPBRW_HXX
29 
30 /** === begin UNO includes === **/
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 #include <com/sun/star/awt/XControlContainer.hpp>
33 #include <com/sun/star/frame/XFrame.hpp>
34 #include <com/sun/star/inspection/XObjectInspectorModel.hpp>
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 /** === end UNO includes === **/
37 
38 #include <sfx2/basedlgs.hxx>
39 #include <sfx2/ctrlitem.hxx>
40 #include <sfx2/childwin.hxx>
41 #include "svx/fmtools.hxx"
42 
43 //========================================================================
44 class FmPropBrwMgr : public SfxChildWindow
45 {
46 public:
47 	FmPropBrwMgr(Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo);
48 	SFX_DECL_CHILDWINDOW(FmPropBrwMgr);
49 };
50 
51 class FmPropControl;
52 class SfxBindings;
53 class FmFormShell;
54 //========================================================================
55 class FmPropBrw : public SfxFloatingWindow, public SfxControllerItem
56 {
57 	sal_Bool		m_bInitialStateChange;
58     bool            m_bInStateChange;
59     ::rtl::OUString m_sLastActivePage;
60     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
61                         m_xInspectorContext;
62 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
63 					m_xORB;
64 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
65 					m_xMeAsFrame;
66 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
67 					m_xLastKnownDocument;
68     ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorModel >
69                     m_xInspectorModel;
70 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
71 					m_xBrowserController;
72 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
73 					m_xBrowserComponentWindow;
74 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
75                     m_xFrameContainerWindow;
76 
77 protected:
78 	virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
79 	virtual void FillInfo( SfxChildWinInfo& rInfo ) const;
80 	virtual sal_Bool Close();
81 
82 	DECL_LINK( OnAsyncGetFocus, void* );
83 
84 	void implSetNewSelection( const InterfaceBag& _rSelection );
85 	void implDetachController();
86     bool implIsReadOnlyModel() const;
87     ::rtl::OUString getCurrentPage() const;
88 
89 public:
90 	FmPropBrw(
91         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&	_xORB,
92         SfxBindings* pBindings,
93         SfxChildWindow* pMgr,
94         Window* pParent,
95         const SfxChildWinInfo* _pInfo
96     );
97 	virtual ~FmPropBrw();
98 
99     using SfxFloatingWindow::StateChanged;
100 
101 protected:
102     virtual void        Resize();
103 
104 private:
105     /** creates the PropertyBrowser (aka ObjectInspector) and plugs it into our frame
106 
107         This method ensures that a new component is created every time the XModel which
108         we're working for changed. This is necessary since this model is part of the
109         ComponentContext we use to create the ObjectInspector.
110     */
111     void    impl_ensurePropertyBrowser_nothrow( FmFormShell* _pFormShell );
112 
113     /** creates a property browser
114 
115         After this method returns, m_xBrowserController and m_xBrowserComponentWindow are
116         not <NULL/>.
117 
118     @precond
119         we don't have an ObjectInspector, yet, i.e. m_xBrowserController and m_xBrowserComponentWindow
120         are <NULL/>.
121     */
122     void    impl_createPropertyBrowser_throw( FmFormShell* _pFormShell );
123 };
124 #endif //SVX_FMPROPBRW_HXX
125