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