xref: /aoo41x/main/svx/source/inc/fmexpl.hxx (revision 3334a7e6)
1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*3334a7e6SAndrew Rist  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*3334a7e6SAndrew Rist  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19*3334a7e6SAndrew Rist  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir #ifndef _SVX_FMEXPL_HXX
24cdf0e10cSrcweir #define _SVX_FMEXPL_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <svl/lstner.hxx>
27cdf0e10cSrcweir #include <svl/brdcst.hxx>
28cdf0e10cSrcweir #include <vcl/window.hxx>
29cdf0e10cSrcweir #include <sfx2/childwin.hxx>
30cdf0e10cSrcweir #include <svl/poolitem.hxx>
31cdf0e10cSrcweir #include <sfx2/bindings.hxx>
32cdf0e10cSrcweir #include <sfx2/dockwin.hxx>
33cdf0e10cSrcweir #include <sfx2/ctrlitem.hxx>
34cdf0e10cSrcweir #include <vcl/image.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir /** === begin UNO includes === **/
37cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
38cdf0e10cSrcweir #include <com/sun/star/form/XForm.hpp>
39cdf0e10cSrcweir #include <com/sun/star/form/XFormComponent.hpp>
40cdf0e10cSrcweir #include <com/sun/star/beans/PropertyChangeEvent.hpp>
41cdf0e10cSrcweir #include <com/sun/star/container/XContainerListener.hpp>
42cdf0e10cSrcweir #include <com/sun/star/container/XContainer.hpp>
43cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp>
44cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp>
45cdf0e10cSrcweir /** === end UNO includes === **/
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include <svtools/svtreebx.hxx>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #include <vcl/dialog.hxx>
50cdf0e10cSrcweir #include <vcl/group.hxx>
51cdf0e10cSrcweir #include <vcl/button.hxx>
52cdf0e10cSrcweir #include <vcl/fixed.hxx>
53cdf0e10cSrcweir #include <vcl/edit.hxx>
54cdf0e10cSrcweir #include <vcl/dockwin.hxx>
55cdf0e10cSrcweir #include <svx/fmview.hxx>
56cdf0e10cSrcweir 
57cdf0e10cSrcweir #include "fmexch.hxx"
58cdf0e10cSrcweir 
59cdf0e10cSrcweir class SdrObjListIter;
60cdf0e10cSrcweir class FmFormShell;
61cdf0e10cSrcweir class SdrObject;
62cdf0e10cSrcweir class FmFormModel;
63cdf0e10cSrcweir class FmFormView;
64cdf0e10cSrcweir class SdrMarkList;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir //========================================================================
67cdf0e10cSrcweir class FmEntryData;
68cdf0e10cSrcweir class FmNavInsertedHint : public SfxHint
69cdf0e10cSrcweir {
70cdf0e10cSrcweir 	FmEntryData* pEntryData;
71cdf0e10cSrcweir 	sal_uInt32 nPos;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir public:
74cdf0e10cSrcweir 	TYPEINFO();
75cdf0e10cSrcweir 	FmNavInsertedHint( FmEntryData* pInsertedEntryData, sal_uInt32 nRelPos );
76cdf0e10cSrcweir 	virtual ~FmNavInsertedHint();
77cdf0e10cSrcweir 
GetEntryData() const78cdf0e10cSrcweir 	FmEntryData* GetEntryData() const { return pEntryData; }
GetRelPos() const79cdf0e10cSrcweir 	sal_uInt32 GetRelPos() const { return nPos; }
80cdf0e10cSrcweir };
81cdf0e10cSrcweir 
82cdf0e10cSrcweir //========================================================================
83cdf0e10cSrcweir class FmNavModelReplacedHint : public SfxHint
84cdf0e10cSrcweir {
85cdf0e10cSrcweir 	FmEntryData* pEntryData;	// die Daten des Eintrages, der ein neues Model bekommen hat
86cdf0e10cSrcweir 
87cdf0e10cSrcweir public:
88cdf0e10cSrcweir 	TYPEINFO();
89cdf0e10cSrcweir 	FmNavModelReplacedHint( FmEntryData* pAffectedEntryData );
90cdf0e10cSrcweir 	virtual ~FmNavModelReplacedHint();
91cdf0e10cSrcweir 
GetEntryData() const92cdf0e10cSrcweir 	FmEntryData* GetEntryData() const { return pEntryData; }
93cdf0e10cSrcweir };
94cdf0e10cSrcweir 
95cdf0e10cSrcweir //========================================================================
96cdf0e10cSrcweir class FmNavRemovedHint : public SfxHint
97cdf0e10cSrcweir {
98cdf0e10cSrcweir 	FmEntryData* pEntryData;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir public:
101cdf0e10cSrcweir 	TYPEINFO();
102cdf0e10cSrcweir 	FmNavRemovedHint( FmEntryData* pInsertedEntryData );
103cdf0e10cSrcweir 	virtual ~FmNavRemovedHint();
104cdf0e10cSrcweir 
GetEntryData() const105cdf0e10cSrcweir 	FmEntryData* GetEntryData() const { return pEntryData; }
106cdf0e10cSrcweir };
107cdf0e10cSrcweir 
108cdf0e10cSrcweir //========================================================================
109cdf0e10cSrcweir class FmNavNameChangedHint : public SfxHint
110cdf0e10cSrcweir {
111cdf0e10cSrcweir 	FmEntryData*    pEntryData;
112cdf0e10cSrcweir 	::rtl::OUString          aNewName;
113cdf0e10cSrcweir 
114cdf0e10cSrcweir public:
115cdf0e10cSrcweir 	TYPEINFO();
116cdf0e10cSrcweir 	FmNavNameChangedHint( FmEntryData* pData, const ::rtl::OUString& rNewName );
117cdf0e10cSrcweir 	virtual ~FmNavNameChangedHint();
118cdf0e10cSrcweir 
GetEntryData() const119cdf0e10cSrcweir 	FmEntryData*    GetEntryData() const { return pEntryData; }
GetNewName() const120cdf0e10cSrcweir 	::rtl::OUString          GetNewName() const { return aNewName; }
121cdf0e10cSrcweir };
122cdf0e10cSrcweir 
123cdf0e10cSrcweir //========================================================================
124cdf0e10cSrcweir class FmNavClearedHint : public SfxHint
125cdf0e10cSrcweir {
126cdf0e10cSrcweir public:
127cdf0e10cSrcweir 	TYPEINFO();
128cdf0e10cSrcweir 	FmNavClearedHint();
129cdf0e10cSrcweir 	virtual ~FmNavClearedHint();
130cdf0e10cSrcweir };
131cdf0e10cSrcweir 
132cdf0e10cSrcweir //========================================================================
133cdf0e10cSrcweir class FmNavViewMarksChanged : public SfxHint
134cdf0e10cSrcweir {
135cdf0e10cSrcweir 	FmFormView* pView;
136cdf0e10cSrcweir public:
137cdf0e10cSrcweir 	TYPEINFO();
FmNavViewMarksChanged(FmFormView * pWhichView)138cdf0e10cSrcweir 	FmNavViewMarksChanged(FmFormView* pWhichView) { pView = pWhichView; }
~FmNavViewMarksChanged()139cdf0e10cSrcweir 	virtual ~FmNavViewMarksChanged() {}
140cdf0e10cSrcweir 
GetAffectedView()141cdf0e10cSrcweir 	FmFormView* GetAffectedView() { return pView; }
142cdf0e10cSrcweir };
143cdf0e10cSrcweir 
144cdf0e10cSrcweir //========================================================================
145cdf0e10cSrcweir class FmEntryDataList;
146cdf0e10cSrcweir class FmEntryData
147cdf0e10cSrcweir {
148cdf0e10cSrcweir private:
149cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >		m_xNormalizedIFace;
150cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >	m_xProperties;
151cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XChild >		m_xChild;
152cdf0e10cSrcweir 
153cdf0e10cSrcweir protected:
154cdf0e10cSrcweir 	Image				m_aNormalImage;
155cdf0e10cSrcweir 	Image				m_aHCImage;
156cdf0e10cSrcweir 	::rtl::OUString		aText;
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 	FmEntryDataList*    pChildList;
159cdf0e10cSrcweir 	FmEntryData*        pParent;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir protected:
162cdf0e10cSrcweir 	void	newObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace );
163cdf0e10cSrcweir 
164cdf0e10cSrcweir public:
165cdf0e10cSrcweir 	TYPEINFO();
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 	FmEntryData( FmEntryData* pParentData, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rIFace );
168cdf0e10cSrcweir 	FmEntryData( const FmEntryData& rEntryData );
169cdf0e10cSrcweir 	virtual ~FmEntryData();
170cdf0e10cSrcweir 
171cdf0e10cSrcweir 	void    Clear();
SetText(const::rtl::OUString & rText)172cdf0e10cSrcweir 	void    SetText( const ::rtl::OUString& rText ){ aText = rText; }
SetParent(FmEntryData * pParentData)173cdf0e10cSrcweir 	void    SetParent( FmEntryData* pParentData ){ pParent = pParentData; }
174cdf0e10cSrcweir 
GetNormalImage() const175cdf0e10cSrcweir 	const Image&	GetNormalImage() const { return m_aNormalImage; }
GetHCImage() const176cdf0e10cSrcweir 	const Image&	GetHCImage() const { return m_aHCImage; }
177cdf0e10cSrcweir 
GetText() const178cdf0e10cSrcweir 	::rtl::OUString          GetText() const { return aText; }
GetParent() const179cdf0e10cSrcweir 	FmEntryData*    GetParent() const { return pParent; }
GetChildList() const180cdf0e10cSrcweir 	FmEntryDataList* GetChildList() const { return pChildList; }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 	virtual sal_Bool IsEqualWithoutChilds( FmEntryData* pEntryData );
183cdf0e10cSrcweir 	virtual FmEntryData* Clone() = 0;
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 	// note that the interface returned is normalized, i.e. querying the given XInterface of the object
186cdf0e10cSrcweir 	// for XInterface must return the interface itself.
GetElement() const187cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& GetElement() const
188cdf0e10cSrcweir 	{
189cdf0e10cSrcweir 		return m_xNormalizedIFace;
190cdf0e10cSrcweir 	}
191cdf0e10cSrcweir 
GetPropertySet() const192cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& GetPropertySet() const
193cdf0e10cSrcweir 	{
194cdf0e10cSrcweir 		return m_xProperties;
195cdf0e10cSrcweir 	}
196cdf0e10cSrcweir 
GetChildIFace() const197cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild >& GetChildIFace() const
198cdf0e10cSrcweir 	{
199cdf0e10cSrcweir 		return m_xChild;
200cdf0e10cSrcweir 	}
201cdf0e10cSrcweir };
202cdf0e10cSrcweir 
203cdf0e10cSrcweir //========================================================================
204cdf0e10cSrcweir DECLARE_LIST( FmEntryDataBaseList, FmEntryData* )
205cdf0e10cSrcweir 
206cdf0e10cSrcweir class FmEntryDataList : public FmEntryDataBaseList
207cdf0e10cSrcweir {
208cdf0e10cSrcweir public:
209cdf0e10cSrcweir 	FmEntryDataList();
210cdf0e10cSrcweir 	virtual ~FmEntryDataList();
211cdf0e10cSrcweir };
212cdf0e10cSrcweir 
213cdf0e10cSrcweir //========================================================================
214cdf0e10cSrcweir // FmNavRequestSelectHint - jemand teilt dem NavigatorTree mit, dass er bestimmte Eintraege selektieren soll
215cdf0e10cSrcweir 
216cdf0e10cSrcweir typedef FmEntryData* FmEntryDataPtr;
217cdf0e10cSrcweir SV_DECL_PTRARR_SORT( FmEntryDataArray, FmEntryDataPtr, 16, 16 )
218cdf0e10cSrcweir 
219cdf0e10cSrcweir class FmNavRequestSelectHint : public SfxHint
220cdf0e10cSrcweir {
221cdf0e10cSrcweir 	FmEntryDataArray    m_arredToSelect;
222cdf0e10cSrcweir 	sal_Bool                m_bMixedSelection;
223cdf0e10cSrcweir public:
224cdf0e10cSrcweir 	TYPEINFO();
FmNavRequestSelectHint()225cdf0e10cSrcweir 	FmNavRequestSelectHint() { }
~FmNavRequestSelectHint()226cdf0e10cSrcweir 	virtual ~FmNavRequestSelectHint() {}
227cdf0e10cSrcweir 
SetMixedSelection(sal_Bool bMixedSelection)228cdf0e10cSrcweir 	void SetMixedSelection(sal_Bool bMixedSelection) { m_bMixedSelection = bMixedSelection; }
IsMixedSelection()229cdf0e10cSrcweir 	sal_Bool IsMixedSelection() { return m_bMixedSelection; }
AddItem(FmEntryData * pEntry)230cdf0e10cSrcweir 	void AddItem(FmEntryData* pEntry) { m_arredToSelect.Insert(pEntry); }
ClearItems()231cdf0e10cSrcweir 	void ClearItems() { m_arredToSelect.Remove(sal_uInt16(0), m_arredToSelect.Count()); }
GetItems()232cdf0e10cSrcweir 	FmEntryDataArray& GetItems() { return m_arredToSelect; }
233cdf0e10cSrcweir };
234cdf0e10cSrcweir 
235cdf0e10cSrcweir //========================================================================
236cdf0e10cSrcweir class FmFormData : public FmEntryData
237cdf0e10cSrcweir {
238cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >			m_xForm;
239cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >	m_xContainer;
240cdf0e10cSrcweir 
241cdf0e10cSrcweir public:
242cdf0e10cSrcweir 	TYPEINFO();
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 	FmFormData(
245cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
246cdf0e10cSrcweir 		const ImageList& _rNormalImages,
247cdf0e10cSrcweir 		const ImageList& _rHCImages,
248cdf0e10cSrcweir 		FmFormData* _pParent = NULL
249cdf0e10cSrcweir 	);
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 	FmFormData( const FmFormData& rFormData );
252cdf0e10cSrcweir 	virtual ~FmFormData();
253cdf0e10cSrcweir 
SetForm(const::com::sun::star::uno::Reference<::com::sun::star::form::XForm> & xForm)254cdf0e10cSrcweir 	void SetForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm )
255cdf0e10cSrcweir 	{
256cdf0e10cSrcweir 		m_xForm = xForm;
257cdf0e10cSrcweir 		m_xContainer = m_xContainer.query( m_xForm );
258cdf0e10cSrcweir 		newObject( m_xForm );
259cdf0e10cSrcweir 	}
260cdf0e10cSrcweir 
GetFormIface() const261cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& GetFormIface() const { return m_xForm; }
GetContainer() const262cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& GetContainer() const { return m_xContainer; }
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 	virtual sal_Bool IsEqualWithoutChilds( FmEntryData* pEntryData );
265cdf0e10cSrcweir 	virtual FmEntryData* Clone();
266cdf0e10cSrcweir };
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 
269cdf0e10cSrcweir //========================================================================
270cdf0e10cSrcweir class FmControlData : public FmEntryData
271cdf0e10cSrcweir {
272cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >  m_xFormComponent;
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 	Image GetImage(const ImageList& ilNavigatorImages) const;
275cdf0e10cSrcweir 
276cdf0e10cSrcweir public:
277cdf0e10cSrcweir 	TYPEINFO();
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 	FmControlData(
280cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxComponent,
281cdf0e10cSrcweir 		const ImageList& _rNormalImages,
282cdf0e10cSrcweir 		const ImageList& _rHCImages,
283cdf0e10cSrcweir 		FmFormData* _pParent
284cdf0e10cSrcweir 	);
285cdf0e10cSrcweir 	FmControlData( const FmControlData& rControlData );
286cdf0e10cSrcweir 	virtual ~FmControlData();
287cdf0e10cSrcweir 
GetFormComponent() const288cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& GetFormComponent() const { return m_xFormComponent; }
289cdf0e10cSrcweir 	virtual sal_Bool IsEqualWithoutChilds( FmEntryData* pEntryData );
290cdf0e10cSrcweir 	virtual FmEntryData* Clone();
291cdf0e10cSrcweir 
292cdf0e10cSrcweir 	void ModelReplaced(
293cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxNew,
294cdf0e10cSrcweir 		const ImageList& _rNormalImages,
295cdf0e10cSrcweir 		const ImageList& _rHCImages
296cdf0e10cSrcweir 	);
297cdf0e10cSrcweir };
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 
300cdf0e10cSrcweir //========================================================================
301cdf0e10cSrcweir //............................................................................
302cdf0e10cSrcweir namespace svxform
303cdf0e10cSrcweir {
304cdf0e10cSrcweir //............................................................................
305cdf0e10cSrcweir 
306cdf0e10cSrcweir 	class NavigatorTreeModel;
307cdf0e10cSrcweir 	//========================================================================
308cdf0e10cSrcweir 	// class OFormComponentObserver
309cdf0e10cSrcweir 	//========================================================================
310cdf0e10cSrcweir 	class OFormComponentObserver
311cdf0e10cSrcweir 		:public ::cppu::WeakImplHelper2	<	::com::sun::star::beans::XPropertyChangeListener
312cdf0e10cSrcweir 										,	::com::sun::star::container::XContainerListener
313cdf0e10cSrcweir 										>
314cdf0e10cSrcweir 	{
315cdf0e10cSrcweir 		::svxform::NavigatorTreeModel*	m_pNavModel;
316cdf0e10cSrcweir 		sal_uInt32 m_nLocks;
317cdf0e10cSrcweir 		sal_Bool   m_bCanUndo;
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 	public:
320cdf0e10cSrcweir 		OFormComponentObserver( ::svxform::NavigatorTreeModel* pModel );
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 	// XEventListenerListener
323cdf0e10cSrcweir 		virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 	// ::com::sun::star::beans::XPropertyChangeListener
326cdf0e10cSrcweir 		virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 	// ::com::sun::star::container::XContainerListener
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 		virtual void SAL_CALL elementInserted(const  ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
331cdf0e10cSrcweir 		virtual void SAL_CALL elementReplaced(const  ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
332cdf0e10cSrcweir 		virtual void SAL_CALL elementRemoved(const  ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
333cdf0e10cSrcweir 
Lock()334cdf0e10cSrcweir 		void Lock() { m_nLocks++; }
UnLock()335cdf0e10cSrcweir 		void UnLock() { m_nLocks--; }
IsLocked() const336cdf0e10cSrcweir 		sal_Bool IsLocked() const { return m_nLocks != 0; }
CanUndo() const337cdf0e10cSrcweir 		sal_Bool CanUndo() const { return m_bCanUndo; }
ReleaseModel()338cdf0e10cSrcweir 		void ReleaseModel() { m_pNavModel = NULL; }
339cdf0e10cSrcweir 	protected:
340cdf0e10cSrcweir 		void Insert(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xIface, sal_Int32 nIndex);
341cdf0e10cSrcweir 		void Remove( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement );
342cdf0e10cSrcweir 	};
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 	//========================================================================
345cdf0e10cSrcweir 	//= NavigatorTreeModel
346cdf0e10cSrcweir 	//========================================================================
347cdf0e10cSrcweir 	class NavigatorTreeModel : public SfxBroadcaster
348cdf0e10cSrcweir 						   ,public SfxListener
349cdf0e10cSrcweir 	{
350cdf0e10cSrcweir 		friend class NavigatorTree;
351cdf0e10cSrcweir 		friend class OFormComponentObserver;
352cdf0e10cSrcweir 
353cdf0e10cSrcweir 		FmEntryDataList*            m_pRootList;
354cdf0e10cSrcweir 		FmFormShell*                m_pFormShell;
355cdf0e10cSrcweir 		FmFormPage*                 m_pFormPage;
356cdf0e10cSrcweir 		FmFormModel*                m_pFormModel;
357cdf0e10cSrcweir 		OFormComponentObserver*		m_pPropChangeList;
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 		ImageList					m_aNormalImages;
360cdf0e10cSrcweir 		ImageList					m_aHCImages;
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 		void UpdateContent( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xForms );
363cdf0e10cSrcweir 		FmControlData* CreateControlData( ::com::sun::star::form::XFormComponent* pFormComponent );
364cdf0e10cSrcweir 
365cdf0e10cSrcweir 		void InsertForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm, sal_uInt32 nRelPos);
366cdf0e10cSrcweir 		void RemoveForm(FmFormData* pFormData);
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 		void InsertFormComponent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xComp, sal_uInt32 nRelPos);
369cdf0e10cSrcweir 		void RemoveFormComponent(FmControlData* pControlData);
370cdf0e10cSrcweir 		void InsertSdrObj(const SdrObject* pSdrObj);
371cdf0e10cSrcweir 		void RemoveSdrObj(const SdrObject* pSdrObj);
372cdf0e10cSrcweir 
373cdf0e10cSrcweir 		void ReplaceFormComponent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xOld, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xNew);
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 		void BroadcastMarkedObjects(const SdrMarkList& mlMarked);
376cdf0e10cSrcweir 			// einen RequestSelectHint mit den aktuell markierten Objekten broadcasten
377cdf0e10cSrcweir 		sal_Bool InsertFormComponent(FmNavRequestSelectHint& rHint, SdrObject* pObject);
378cdf0e10cSrcweir 			// ist ein Helper fuer vorherige, managet das Abteigen in SdrObjGroups
379cdf0e10cSrcweir 			// Rueckgabe sal_True, wenn das Objekt eine FormComponent ist (oder rekursiv nur aus solchen besteht)
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 	public:
382cdf0e10cSrcweir 		NavigatorTreeModel( const ImageList& _rNormalImages, const ImageList& _rHCImages );
383cdf0e10cSrcweir 		virtual ~NavigatorTreeModel();
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 		void FillBranch( FmFormData* pParentData );
386cdf0e10cSrcweir 		void ClearBranch( FmFormData* pParentData );
387cdf0e10cSrcweir 		void UpdateContent( FmFormShell* pNewShell );
388cdf0e10cSrcweir 
389cdf0e10cSrcweir 		void Insert( FmEntryData* pEntryData, sal_uLong nRelPos = LIST_APPEND,
390cdf0e10cSrcweir 											  sal_Bool bAlterModel = sal_False );
391cdf0e10cSrcweir 		void Remove( FmEntryData* pEntryData, sal_Bool bAlterModel = sal_False );
392cdf0e10cSrcweir 
393cdf0e10cSrcweir 		sal_Bool Rename( FmEntryData* pEntryData, const ::rtl::OUString& rNewText );
394cdf0e10cSrcweir 		sal_Bool IsNameAlreadyDefined( const ::rtl::OUString& rName, FmFormData* pParentData );
395cdf0e10cSrcweir 		void Clear();
396cdf0e10cSrcweir 		sal_Bool CheckEntry( FmEntryData* pEntryData );
397cdf0e10cSrcweir 		void SetModified( sal_Bool bMod=sal_True );
398cdf0e10cSrcweir 
399cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >    GetForms() const;
GetFormShell() const400cdf0e10cSrcweir 		FmFormShell*        GetFormShell() const { return m_pFormShell; }
GetFormPage() const401cdf0e10cSrcweir 		FmFormPage*			GetFormPage() const { return m_pFormPage; }
402cdf0e10cSrcweir 		FmEntryData*        FindData( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xElement, FmEntryDataList* pDataList, sal_Bool bRecurs=sal_True );
403cdf0e10cSrcweir 		FmEntryData*        FindData( const ::rtl::OUString& rText, FmFormData* pParentData, sal_Bool bRecurs=sal_True );
GetRootList() const404cdf0e10cSrcweir 		FmEntryDataList*    GetRootList() const { return m_pRootList; }
405cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >   GetFormComponents( FmFormData* pParentFormData );
406cdf0e10cSrcweir 		SdrObject*          GetSdrObj( FmControlData* pControlData );
407cdf0e10cSrcweir 		SdrObject*          Search(SdrObjListIter& rIter, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xComp);
408cdf0e10cSrcweir 
409cdf0e10cSrcweir 		virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
410cdf0e10cSrcweir 	};
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 	//========================================================================
413cdf0e10cSrcweir 	typedef SvLBoxEntry* SvLBoxEntryPtr;
414cdf0e10cSrcweir 	SV_DECL_PTRARR_SORT( SvLBoxEntrySortedArray, SvLBoxEntryPtr, 16, 16 )
415cdf0e10cSrcweir 
416cdf0e10cSrcweir 	class NavigatorTree : public SvTreeListBox, public SfxListener
417cdf0e10cSrcweir 	{
418cdf0e10cSrcweir 		enum DROP_ACTION        { DA_SCROLLUP, DA_SCROLLDOWN, DA_EXPANDNODE };
419cdf0e10cSrcweir 		enum SELDATA_ITEMS      { SDI_DIRTY, SDI_ALL, SDI_NORMALIZED, SDI_NORMALIZED_FORMARK };
420cdf0e10cSrcweir 
421cdf0e10cSrcweir 		// beim Droppen will ich scrollen und Folder aufklappen koennen, dafuer :
422cdf0e10cSrcweir 		AutoTimer           m_aDropActionTimer;
423cdf0e10cSrcweir 		Timer               m_aSynchronizeTimer;
424cdf0e10cSrcweir 		// die Meta-Daten ueber meine aktuelle Selektion
425cdf0e10cSrcweir 		SvLBoxEntrySortedArray  m_arrCurrentSelection;
426cdf0e10cSrcweir 		// the entries which, in the view, are currently marked as "cut" (painted semi-transparent)
427cdf0e10cSrcweir 		ListBoxEntrySet         m_aCutEntries;
428cdf0e10cSrcweir 		// die Images, die ich brauche (und an FormDatas und EntryDatas weiterreiche)
429cdf0e10cSrcweir 		ImageList           m_aNavigatorImages;
430cdf0e10cSrcweir 		ImageList           m_aNavigatorImagesHC;
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 		::svxform::OControlExchangeHelper	m_aControlExchange;
433cdf0e10cSrcweir 
434cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >	m_xORB;
435cdf0e10cSrcweir 		NavigatorTreeModel* m_pNavModel;
436cdf0e10cSrcweir 		SvLBoxEntry*        m_pRootEntry;
437cdf0e10cSrcweir 		SvLBoxEntry*        m_pEditEntry;
438cdf0e10cSrcweir 
439cdf0e10cSrcweir 		sal_uLong               nEditEvent;
440cdf0e10cSrcweir 
441cdf0e10cSrcweir 		SELDATA_ITEMS       m_sdiState;
442cdf0e10cSrcweir 		Point               m_aTimerTriggered;      // die Position, an der der DropTimer angeschaltet wurde
443cdf0e10cSrcweir 		DROP_ACTION         m_aDropActionType;
444cdf0e10cSrcweir 
445cdf0e10cSrcweir 		sal_uInt16          m_nSelectLock;
446cdf0e10cSrcweir 		sal_uInt16          m_nFormsSelected;
447cdf0e10cSrcweir 		sal_uInt16          m_nControlsSelected;
448cdf0e10cSrcweir 		sal_uInt16          m_nHiddenControls;      // (die Zahl geht in m_nControlsSelected mit ein)
449cdf0e10cSrcweir 
450cdf0e10cSrcweir 		unsigned short      m_aTimerCounter;
451cdf0e10cSrcweir 
452cdf0e10cSrcweir 		sal_Bool            m_bDragDataDirty		: 1;    // dito
453cdf0e10cSrcweir 		sal_Bool            m_bPrevSelectionMixed	: 1;
454cdf0e10cSrcweir 		sal_Bool            m_bMarkingObjects		: 1;    // wenn das sal_True ist, brauche ich auf die RequestSelectHints nicht reagieren
455cdf0e10cSrcweir 		sal_Bool            m_bRootSelected			: 1;
456cdf0e10cSrcweir 		sal_Bool            m_bInitialUpdate		: 1;   // bin ich das erste Mal im UpdateContent ?
457cdf0e10cSrcweir 		sal_Bool			m_bKeyboardCut			: 1;
458cdf0e10cSrcweir 
459cdf0e10cSrcweir 
460cdf0e10cSrcweir 		void            UpdateContent();
461cdf0e10cSrcweir 		sal_Bool        IsDeleteAllowed();
462cdf0e10cSrcweir 		FmControlData*  NewControl( const ::rtl::OUString& rServiceName, SvLBoxEntry* pParentEntry, sal_Bool bEditName = sal_True );
463cdf0e10cSrcweir 		void            NewForm( SvLBoxEntry* pParentEntry );
464cdf0e10cSrcweir 		SvLBoxEntry*    Insert( FmEntryData* pEntryData, sal_uLong nRelPos=LIST_APPEND );
465cdf0e10cSrcweir 		void            Remove( FmEntryData* pEntryData );
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 		void CollectSelectionData(SELDATA_ITEMS sdiHow);
469cdf0e10cSrcweir 			// sammelt in m_arrCurrentSelection die aktuell selektierten Eintraege, normalisiert die Liste wenn verlangt
470cdf0e10cSrcweir 			// SDI_NORMALIZED bedeutet einfach, dass alle Eintraege, die schon einen selektierten Vorfahren haben, nicht mit gesammelt
471cdf0e10cSrcweir 			// werden.
472cdf0e10cSrcweir 			// SDI_NORMALIZED_FORMARK bedeutet, dass wie bei SDI_NORMALIZED verfahren wird, aber Eintraege, deren direktes Elter nicht
473cdf0e10cSrcweir 			// selektiert ist, aufgenommen werden (unabhaengig vom Status weiterer Vorfahren), desgleichen Formulare, die selektiert sind,
474cdf0e10cSrcweir 			// unabhaengig vom Status irgendwelcher Vorfahren
475cdf0e10cSrcweir 			// Bei beiden Normalized-Modi enthalten die m_nFormsSelected, ... die richtige Anzahl, auch wenn nicht alle dieser Eintraege
476cdf0e10cSrcweir 			// in m_arrCurrentSelection landen.
477cdf0e10cSrcweir 			// SDI_DIRTY ist natuerlich nicht erlaubt als Parameter
478cdf0e10cSrcweir 
479cdf0e10cSrcweir 		// ein einziges Interface fuer alle selektierten Eintraege zusammensetzen
480cdf0e10cSrcweir 		void    ShowSelectionProperties(sal_Bool bForce = sal_False);
481cdf0e10cSrcweir 		// alle selektierten Elemnte loeschen
482cdf0e10cSrcweir 		void    DeleteSelection();
483cdf0e10cSrcweir 
484cdf0e10cSrcweir 		void SynchronizeSelection(FmEntryDataArray& arredToSelect);
485cdf0e10cSrcweir 			// nach dem Aufruf dieser Methode sind genau die Eintraege selektiert, die in dem Array bezeichnet sind
486cdf0e10cSrcweir 		void SynchronizeSelection();
487cdf0e10cSrcweir 			// macht das selbe, nimmt die MarkList der ::com::sun::star::sdbcx::View
488cdf0e10cSrcweir 		void SynchronizeMarkList();
489cdf0e10cSrcweir 			// umgekehrte Richtung von SynchronizeMarkList : markiert in der ::com::sun::star::sdbcx::View alle der aktuellen Selektion entsprechenden Controls
490cdf0e10cSrcweir 
491cdf0e10cSrcweir         void CollectObjects(FmFormData* pFormData, sal_Bool bDeep, ::std::set< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > >& _rObjects);
492cdf0e10cSrcweir 
493cdf0e10cSrcweir 		// im Select aktualisiere ich normalerweise die Marklist der zugehoerigen ::com::sun::star::sdbcx::View, mit folgenden Funktionen
494cdf0e10cSrcweir 		// kann ich das Locking dieses Verhaltens steuern
LockSelectionHandling()495cdf0e10cSrcweir 		void LockSelectionHandling() { ++m_nSelectLock; }
UnlockSelectionHandling()496cdf0e10cSrcweir 		void UnlockSelectionHandling() { --m_nSelectLock; }
IsSelectionHandlingLocked() const497cdf0e10cSrcweir 		sal_Bool IsSelectionHandlingLocked() const { return m_nSelectLock>0; }
498cdf0e10cSrcweir 
499cdf0e10cSrcweir 		sal_Bool IsHiddenControl(FmEntryData* pEntryData);
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 		DECL_LINK( OnEdit, void* );
502cdf0e10cSrcweir 		DECL_LINK( OnDropActionTimer, void* );
503cdf0e10cSrcweir 
504cdf0e10cSrcweir 		DECL_LINK(OnEntrySelDesel, NavigatorTree*);
505cdf0e10cSrcweir 		DECL_LINK(OnSynchronizeTimer, void*);
506cdf0e10cSrcweir 
507cdf0e10cSrcweir 		DECL_LINK( OnClipboardAction, void* );
508cdf0e10cSrcweir 
509cdf0e10cSrcweir 	protected:
510cdf0e10cSrcweir 		virtual void	Command( const CommandEvent& rEvt );
511cdf0e10cSrcweir 
512cdf0e10cSrcweir 		virtual sal_Int8	AcceptDrop( const AcceptDropEvent& rEvt );
513cdf0e10cSrcweir 		virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
514cdf0e10cSrcweir 		virtual void		StartDrag( sal_Int8 nAction, const Point& rPosPixel );
515cdf0e10cSrcweir 
516cdf0e10cSrcweir 	public:
517cdf0e10cSrcweir 		NavigatorTree(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&	_xORB, Window* pParent );
518cdf0e10cSrcweir 		virtual ~NavigatorTree();
519cdf0e10cSrcweir 
520cdf0e10cSrcweir 		void Clear();
521cdf0e10cSrcweir 		void UpdateContent( FmFormShell* pFormShell );
522cdf0e10cSrcweir 		void MarkViewObj( FmFormData* pFormData, sal_Bool bMark, sal_Bool bDeep = sal_False );
523cdf0e10cSrcweir 		void MarkViewObj( FmControlData* pControlData, sal_Bool bMarkHandles, sal_Bool bMark );
524cdf0e10cSrcweir 		void UnmarkAllViewObj();
525cdf0e10cSrcweir 
526cdf0e10cSrcweir 		sal_Bool IsFormEntry( SvLBoxEntry* pEntry );
527cdf0e10cSrcweir 		sal_Bool IsFormComponentEntry( SvLBoxEntry* pEntry );
528cdf0e10cSrcweir 
529cdf0e10cSrcweir 		::rtl::OUString GenerateName( FmEntryData* pEntryData );
530cdf0e10cSrcweir 
GetNavModel() const531cdf0e10cSrcweir 		NavigatorTreeModel*    GetNavModel() const { return m_pNavModel; }
532cdf0e10cSrcweir 		SvLBoxEntry*        FindEntry( FmEntryData* pEntryData );
533cdf0e10cSrcweir 
534cdf0e10cSrcweir 		virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const XubString& rNewText );
535cdf0e10cSrcweir 		virtual sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True );
536cdf0e10cSrcweir 		virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& );
537cdf0e10cSrcweir 		virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
538cdf0e10cSrcweir 		virtual void KeyInput( const KeyEvent& rKEvt );
539cdf0e10cSrcweir 
540cdf0e10cSrcweir 		virtual void ModelHasRemoved( SvListEntry* _pEntry );
541cdf0e10cSrcweir 
542cdf0e10cSrcweir         using SvTreeListBox::Insert;
543cdf0e10cSrcweir         using SvTreeListBox::ExecuteDrop;
544cdf0e10cSrcweir         using SvTreeListBox::Select;
545cdf0e10cSrcweir         using SvTreeListBox::Notify;
546cdf0e10cSrcweir 
547cdf0e10cSrcweir 	private:
548cdf0e10cSrcweir 		sal_Int8	implAcceptDataTransfer( const DataFlavorExVector& _rFlavors, sal_Int8 _nAction, const Point& _rDropPos, sal_Bool _bDnD );
549cdf0e10cSrcweir 		sal_Int8	implAcceptDataTransfer( const DataFlavorExVector& _rFlavors, sal_Int8 _nAction, SvLBoxEntry* _pTargetEntry, sal_Bool _bDnD );
550cdf0e10cSrcweir 
551cdf0e10cSrcweir 		sal_Int8	implExecuteDataTransfer( const OControlTransferData& _rData, sal_Int8 _nAction, const Point& _rDropPos, sal_Bool _bDnD );
552cdf0e10cSrcweir 		sal_Int8	implExecuteDataTransfer( const OControlTransferData& _rData, sal_Int8 _nAction, SvLBoxEntry* _pTargetEntry, sal_Bool _bDnD );
553cdf0e10cSrcweir 
554cdf0e10cSrcweir 		// check if a cut, copy, or drag operation can be started in the current situation
555cdf0e10cSrcweir 		sal_Bool	implAllowExchange( sal_Int8 _nAction, sal_Bool* _pHasNonHidden = NULL );
556cdf0e10cSrcweir 		// check if a paste with the current clipboard content can be accepted
557cdf0e10cSrcweir 		sal_Bool	implAcceptPaste( );
558cdf0e10cSrcweir 
559cdf0e10cSrcweir 		// fills m_aControlExchange in preparation of a DnD or clipboard operation
560cdf0e10cSrcweir 		sal_Bool	implPrepareExchange( sal_Int8 _nAction );
561cdf0e10cSrcweir 
562cdf0e10cSrcweir 		void		doPaste();
563cdf0e10cSrcweir 		void		doCopy();
564cdf0e10cSrcweir 		void		doCut();
565cdf0e10cSrcweir 
doingKeyboardCut() const566cdf0e10cSrcweir 		sal_Bool	doingKeyboardCut( ) const { return m_bKeyboardCut; }
567cdf0e10cSrcweir 	};
568cdf0e10cSrcweir 
569cdf0e10cSrcweir 	//========================================================================
570cdf0e10cSrcweir 	class NavigatorFrame : public SfxDockingWindow, public SfxControllerItem
571cdf0e10cSrcweir 	{
572cdf0e10cSrcweir 	private:
573cdf0e10cSrcweir 		::svxform::NavigatorTree* m_pNavigatorTree;
574cdf0e10cSrcweir 
575cdf0e10cSrcweir 	protected:
576cdf0e10cSrcweir 		virtual void Resize();
577cdf0e10cSrcweir 		virtual sal_Bool Close();
578cdf0e10cSrcweir 		virtual void GetFocus();
579cdf0e10cSrcweir 		virtual Size CalcDockingSize( SfxChildAlignment );
580cdf0e10cSrcweir 		virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment );
581cdf0e10cSrcweir 
582cdf0e10cSrcweir         using SfxDockingWindow::StateChanged;
583cdf0e10cSrcweir 
584cdf0e10cSrcweir 	public:
585cdf0e10cSrcweir 		NavigatorFrame( SfxBindings *pBindings, SfxChildWindow *pMgr,
586cdf0e10cSrcweir 					   Window* pParent );
587cdf0e10cSrcweir 		virtual ~NavigatorFrame();
588cdf0e10cSrcweir 
589cdf0e10cSrcweir 		void UpdateContent( FmFormShell* pFormShell );
590cdf0e10cSrcweir 		void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
591cdf0e10cSrcweir 		void FillInfo( SfxChildWinInfo& rInfo ) const;
592cdf0e10cSrcweir 	};
593cdf0e10cSrcweir 
594cdf0e10cSrcweir 	//========================================================================
595cdf0e10cSrcweir 	class SVX_DLLPUBLIC NavigatorFrameManager : public SfxChildWindow
596cdf0e10cSrcweir 	{
597cdf0e10cSrcweir 	public:
598cdf0e10cSrcweir 		SVX_DLLPRIVATE NavigatorFrameManager( Window *pParent, sal_uInt16 nId, SfxBindings *pBindings,
599cdf0e10cSrcweir 						  SfxChildWinInfo *pInfo );
600cdf0e10cSrcweir 		SFX_DECL_CHILDWINDOW( NavigatorFrameManager );
601cdf0e10cSrcweir 	};
602cdf0e10cSrcweir 
603cdf0e10cSrcweir //............................................................................
604cdf0e10cSrcweir }	// namespace svxform
605cdf0e10cSrcweir //............................................................................
606cdf0e10cSrcweir 
607cdf0e10cSrcweir #endif // _SVX_FMEXPL_HXX
608cdf0e10cSrcweir 
609