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