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