xref: /aoo4110/main/svx/source/inc/fmPropBrw.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef SVX_FMPROPBRW_HXX
24 #define SVX_FMPROPBRW_HXX
25 
26 /** === begin UNO includes === **/
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <com/sun/star/awt/XControlContainer.hpp>
29 #include <com/sun/star/frame/XFrame.hpp>
30 #include <com/sun/star/inspection/XObjectInspectorModel.hpp>
31 #include <com/sun/star/uno/XComponentContext.hpp>
32 /** === end UNO includes === **/
33 
34 #include <sfx2/basedlgs.hxx>
35 #include <sfx2/ctrlitem.hxx>
36 #include <sfx2/childwin.hxx>
37 #include "svx/fmtools.hxx"
38 
39 //========================================================================
40 class FmPropBrwMgr : public SfxChildWindow
41 {
42 public:
43 	FmPropBrwMgr(Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo);
44 	SFX_DECL_CHILDWINDOW(FmPropBrwMgr);
45 };
46 
47 class FmPropControl;
48 class SfxBindings;
49 class FmFormShell;
50 //========================================================================
51 class FmPropBrw : public SfxFloatingWindow, public SfxControllerItem
52 {
53 	sal_Bool		m_bInitialStateChange;
54     bool            m_bInStateChange;
55     ::rtl::OUString m_sLastActivePage;
56     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
57                         m_xInspectorContext;
58 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
59 					m_xORB;
60 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
61 					m_xMeAsFrame;
62 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
63 					m_xLastKnownDocument;
64     ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorModel >
65                     m_xInspectorModel;
66 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
67 					m_xBrowserController;
68 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
69 					m_xBrowserComponentWindow;
70 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
71                     m_xFrameContainerWindow;
72 
73 protected:
74 	virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
75 	virtual void FillInfo( SfxChildWinInfo& rInfo ) const;
76 	virtual sal_Bool Close();
77 
78 	DECL_LINK( OnAsyncGetFocus, void* );
79 
80 	void implSetNewSelection( const InterfaceBag& _rSelection );
81 	void implDetachController();
82     bool implIsReadOnlyModel() const;
83     ::rtl::OUString getCurrentPage() const;
84 
85 public:
86 	FmPropBrw(
87         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&	_xORB,
88         SfxBindings* pBindings,
89         SfxChildWindow* pMgr,
90         Window* pParent,
91         const SfxChildWinInfo* _pInfo
92     );
93 	virtual ~FmPropBrw();
94 
95     using SfxFloatingWindow::StateChanged;
96 
97 protected:
98     virtual void        Resize();
99 
100 private:
101     /** creates the PropertyBrowser (aka ObjectInspector) and plugs it into our frame
102 
103         This method ensures that a new component is created every time the XModel which
104         we're working for changed. This is necessary since this model is part of the
105         ComponentContext we use to create the ObjectInspector.
106     */
107     void    impl_ensurePropertyBrowser_nothrow( FmFormShell* _pFormShell );
108 
109     /** creates a property browser
110 
111         After this method returns, m_xBrowserController and m_xBrowserComponentWindow are
112         not <NULL/>.
113 
114     @precond
115         we don't have an ObjectInspector, yet, i.e. m_xBrowserController and m_xBrowserComponentWindow
116         are <NULL/>.
117     */
118     void    impl_createPropertyBrowser_throw( FmFormShell* _pFormShell );
119 };
120 #endif //SVX_FMPROPBRW_HXX
121