LCOV - code coverage report
Current view: top level - svx/source/inc - fmexpl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 49 4.1 %
Date: 2012-08-25 Functions: 2 49 4.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 12 8.3 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _SVX_FMEXPL_HXX
      29                 :            : #define _SVX_FMEXPL_HXX
      30                 :            : 
      31                 :            : #include <svl/lstner.hxx>
      32                 :            : #include <svl/brdcst.hxx>
      33                 :            : #include <vcl/window.hxx>
      34                 :            : #include <sfx2/childwin.hxx>
      35                 :            : #include <svl/poolitem.hxx>
      36                 :            : #include <sfx2/bindings.hxx>
      37                 :            : #include <sfx2/dockwin.hxx>
      38                 :            : #include <sfx2/ctrlitem.hxx>
      39                 :            : #include <vcl/image.hxx>
      40                 :            : 
      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                 :            : 
      50                 :            : #include <svtools/svtreebx.hxx>
      51                 :            : 
      52                 :            : #include <vcl/dialog.hxx>
      53                 :            : #include <vcl/group.hxx>
      54                 :            : #include <vcl/button.hxx>
      55                 :            : #include <vcl/fixed.hxx>
      56                 :            : #include <vcl/edit.hxx>
      57                 :            : #include <vcl/dockwin.hxx>
      58                 :            : #include <svx/fmview.hxx>
      59                 :            : 
      60                 :            : #include "fmexch.hxx"
      61                 :            : #include <vector>
      62                 :            : #include <set>
      63                 :            : 
      64                 :            : class SdrObjListIter;
      65                 :            : class FmFormShell;
      66                 :            : class SdrObject;
      67                 :            : class FmFormModel;
      68                 :            : class FmFormView;
      69                 :            : class SdrMarkList;
      70                 :            : 
      71                 :            : //========================================================================
      72                 :            : class FmEntryData;
      73                 :            : class FmNavInsertedHint : public SfxHint
      74                 :            : {
      75                 :            :     FmEntryData* pEntryData;
      76                 :            :     sal_uInt32 nPos;
      77                 :            : 
      78                 :            : public:
      79                 :            :     TYPEINFO();
      80                 :            :     FmNavInsertedHint( FmEntryData* pInsertedEntryData, sal_uInt32 nRelPos );
      81                 :            :     virtual ~FmNavInsertedHint();
      82                 :            : 
      83                 :          0 :     FmEntryData* GetEntryData() const { return pEntryData; }
      84                 :          0 :     sal_uInt32 GetRelPos() const { return nPos; }
      85                 :            : };
      86                 :            : 
      87                 :            : //========================================================================
      88                 :            : class FmNavModelReplacedHint : public SfxHint
      89                 :            : {
      90                 :            :     FmEntryData* pEntryData;    // die Daten des Eintrages, der ein neues Model bekommen hat
      91                 :            : 
      92                 :            : public:
      93                 :            :     TYPEINFO();
      94                 :            :     FmNavModelReplacedHint( FmEntryData* pAffectedEntryData );
      95                 :            :     virtual ~FmNavModelReplacedHint();
      96                 :            : 
      97                 :          0 :     FmEntryData* GetEntryData() const { return pEntryData; }
      98                 :            : };
      99                 :            : 
     100                 :            : //========================================================================
     101                 :            : class FmNavRemovedHint : public SfxHint
     102                 :            : {
     103                 :            :     FmEntryData* pEntryData;
     104                 :            : 
     105                 :            : public:
     106                 :            :     TYPEINFO();
     107                 :            :     FmNavRemovedHint( FmEntryData* pInsertedEntryData );
     108                 :            :     virtual ~FmNavRemovedHint();
     109                 :            : 
     110                 :          0 :     FmEntryData* GetEntryData() const { return pEntryData; }
     111                 :            : };
     112                 :            : 
     113                 :            : //========================================================================
     114                 :            : class FmNavNameChangedHint : public SfxHint
     115                 :            : {
     116                 :            :     FmEntryData*    pEntryData;
     117                 :            :     ::rtl::OUString          aNewName;
     118                 :            : 
     119                 :            : public:
     120                 :            :     TYPEINFO();
     121                 :            :     FmNavNameChangedHint( FmEntryData* pData, const ::rtl::OUString& rNewName );
     122                 :            :     virtual ~FmNavNameChangedHint();
     123                 :            : 
     124                 :          0 :     FmEntryData*    GetEntryData() const { return pEntryData; }
     125                 :          0 :     ::rtl::OUString          GetNewName() const { return aNewName; }
     126                 :            : };
     127                 :            : 
     128                 :            : //========================================================================
     129                 :            : class FmNavClearedHint : public SfxHint
     130                 :            : {
     131                 :            : public:
     132                 :            :     TYPEINFO();
     133                 :            :     FmNavClearedHint();
     134                 :            :     virtual ~FmNavClearedHint();
     135                 :            : };
     136                 :            : 
     137                 :            : //========================================================================
     138                 :            : class FmNavViewMarksChanged : public SfxHint
     139                 :            : {
     140                 :            :     FmFormView* pView;
     141                 :            : public:
     142                 :            :     TYPEINFO();
     143                 :        296 :     FmNavViewMarksChanged(FmFormView* pWhichView) { pView = pWhichView; }
     144         [ -  + ]:        296 :     virtual ~FmNavViewMarksChanged() {}
     145                 :            : 
     146                 :          0 :     FmFormView* GetAffectedView() { return pView; }
     147                 :            : };
     148                 :            : 
     149                 :            : //========================================================================
     150                 :            : class FmEntryDataList;
     151                 :            : class FmEntryData
     152                 :            : {
     153                 :            : private:
     154                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >       m_xNormalizedIFace;
     155                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >   m_xProperties;
     156                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild >     m_xChild;
     157                 :            : 
     158                 :            : protected:
     159                 :            :     Image               m_aNormalImage;
     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                 :          0 :     void    SetText( const ::rtl::OUString& rText ){ aText = rText; }
     177                 :          0 :     void    SetParent( FmEntryData* pParentData ){ pParent = pParentData; }
     178                 :            : 
     179                 :          0 :     const Image&    GetNormalImage() const { return m_aNormalImage; }
     180                 :            : 
     181                 :          0 :     ::rtl::OUString          GetText() const { return aText; }
     182                 :          0 :     FmEntryData*    GetParent() const { return pParent; }
     183                 :          0 :     FmEntryDataList* GetChildList() const { return pChildList; }
     184                 :            : 
     185                 :            :     virtual sal_Bool IsEqualWithoutChildren( FmEntryData* pEntryData );
     186                 :            :     virtual FmEntryData* Clone() = 0;
     187                 :            : 
     188                 :            :     // note that the interface returned is normalized, i.e. querying the given XInterface of the object
     189                 :            :     // for XInterface must return the interface itself.
     190                 :          0 :     const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& GetElement() const
     191                 :            :     {
     192                 :          0 :         return m_xNormalizedIFace;
     193                 :            :     }
     194                 :            : 
     195                 :          0 :     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& GetPropertySet() const
     196                 :            :     {
     197                 :          0 :         return m_xProperties;
     198                 :            :     }
     199                 :            : 
     200                 :          0 :     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild >& GetChildIFace() const
     201                 :            :     {
     202                 :          0 :         return m_xChild;
     203                 :            :     }
     204                 :            : };
     205                 :            : 
     206                 :            : //========================================================================
     207                 :            : typedef ::std::vector< FmEntryData* > FmEntryDataBaseList;
     208                 :            : 
     209                 :            : class FmEntryDataList
     210                 :            : {
     211                 :            : private:
     212                 :            :     FmEntryDataBaseList maEntryDataList;
     213                 :            : 
     214                 :            : public:
     215                 :            :     FmEntryDataList();
     216                 :            :     virtual ~FmEntryDataList();
     217                 :            : 
     218                 :          0 :     FmEntryData*    at( size_t Index )
     219         [ #  # ]:          0 :         { return ( Index < maEntryDataList.size() ) ? maEntryDataList[ Index ] : NULL; }
     220                 :            : 
     221                 :          0 :     size_t          size() const { return maEntryDataList.size(); }
     222                 :            :     FmEntryData*    remove( FmEntryData* pItem );
     223                 :            :     void            insert( FmEntryData* pItem, size_t Index );
     224                 :            :     void            clear();
     225                 :            : };
     226                 :            : 
     227                 :            : //========================================================================
     228                 :            : // FmNavRequestSelectHint - jemand teilt dem NavigatorTree mit, dass er bestimmte Eintraege selektieren soll
     229                 :            : 
     230                 :            : typedef std::set<FmEntryData*> FmEntryDataArray;
     231                 :            : 
     232                 :            : class FmNavRequestSelectHint : public SfxHint
     233                 :            : {
     234                 :            :     FmEntryDataArray    m_arredToSelect;
     235                 :            :     sal_Bool                m_bMixedSelection;
     236                 :            : public:
     237                 :            :     TYPEINFO();
     238         [ #  # ]:          0 :     FmNavRequestSelectHint() { }
     239         [ #  # ]:          0 :     virtual ~FmNavRequestSelectHint() {}
     240                 :            : 
     241                 :          0 :     void SetMixedSelection(sal_Bool bMixedSelection) { m_bMixedSelection = bMixedSelection; }
     242                 :          0 :     sal_Bool IsMixedSelection() { return m_bMixedSelection; }
     243                 :          0 :     void AddItem(FmEntryData* pEntry) { m_arredToSelect.insert(pEntry); }
     244                 :          0 :     void ClearItems() { m_arredToSelect.clear(); }
     245                 :          0 :     FmEntryDataArray& GetItems() { return m_arredToSelect; }
     246                 :            : };
     247                 :            : 
     248                 :            : //========================================================================
     249                 :            : class FmFormData : public FmEntryData
     250                 :            : {
     251                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >           m_xForm;
     252                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer > m_xContainer;
     253                 :            : 
     254                 :            : public:
     255                 :            :     TYPEINFO();
     256                 :            : 
     257                 :            :     FmFormData(
     258                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
     259                 :            :         const ImageList& _rNormalImages,
     260                 :            :         FmFormData* _pParent = NULL
     261                 :            :     );
     262                 :            : 
     263                 :            :     FmFormData( const FmFormData& rFormData );
     264                 :            :     virtual ~FmFormData();
     265                 :            : 
     266                 :            :     void SetForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm )
     267                 :            :     {
     268                 :            :         m_xForm = xForm;
     269                 :            :         m_xContainer = m_xContainer.query( m_xForm );
     270                 :            :         newObject( m_xForm );
     271                 :            :     }
     272                 :            : 
     273                 :          0 :     const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& GetFormIface() const { return m_xForm; }
     274                 :          0 :     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& GetContainer() const { return m_xContainer; }
     275                 :            : 
     276                 :            :     virtual sal_Bool IsEqualWithoutChildren( FmEntryData* pEntryData );
     277                 :            :     virtual FmEntryData* Clone();
     278                 :            : };
     279                 :            : 
     280                 :            : 
     281                 :            : //========================================================================
     282                 :            : class FmControlData : public FmEntryData
     283                 :            : {
     284                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >  m_xFormComponent;
     285                 :            : 
     286                 :            :     Image GetImage(const ImageList& ilNavigatorImages) const;
     287                 :            : 
     288                 :            : public:
     289                 :            :     TYPEINFO();
     290                 :            : 
     291                 :            :     FmControlData(
     292                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxComponent,
     293                 :            :         const ImageList& _rNormalImages,
     294                 :            :         FmFormData* _pParent
     295                 :            :     );
     296                 :            :     FmControlData( const FmControlData& rControlData );
     297                 :            :     virtual ~FmControlData();
     298                 :            : 
     299                 :          0 :     const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& GetFormComponent() const { return m_xFormComponent; }
     300                 :            :     virtual sal_Bool IsEqualWithoutChildren( FmEntryData* pEntryData );
     301                 :            :     virtual FmEntryData* Clone();
     302                 :            : 
     303                 :            :     void ModelReplaced(
     304                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxNew,
     305                 :            :         const ImageList& _rNormalImages
     306                 :            :     );
     307                 :            : };
     308                 :            : 
     309                 :            : 
     310                 :            : //========================================================================
     311                 :            : //............................................................................
     312                 :            : namespace svxform
     313                 :            : {
     314                 :            : //............................................................................
     315                 :            : 
     316                 :            :     class NavigatorTreeModel;
     317                 :            :     //========================================================================
     318                 :            :     // class OFormComponentObserver
     319                 :            :     //========================================================================
     320         [ #  # ]:          0 :     class OFormComponentObserver
     321                 :            :         :public ::cppu::WeakImplHelper2 <   ::com::sun::star::beans::XPropertyChangeListener
     322                 :            :                                         ,   ::com::sun::star::container::XContainerListener
     323                 :            :                                         >
     324                 :            :     {
     325                 :            :         ::svxform::NavigatorTreeModel*  m_pNavModel;
     326                 :            :         sal_uInt32 m_nLocks;
     327                 :            :         sal_Bool   m_bCanUndo;
     328                 :            : 
     329                 :            :     public:
     330                 :            :         OFormComponentObserver( ::svxform::NavigatorTreeModel* pModel );
     331                 :            : 
     332                 :            :     // XEventListenerListener
     333                 :            :         virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
     334                 :            : 
     335                 :            :     // ::com::sun::star::beans::XPropertyChangeListener
     336                 :            :         virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
     337                 :            : 
     338                 :            :     // ::com::sun::star::container::XContainerListener
     339                 :            : 
     340                 :            :         virtual void SAL_CALL elementInserted(const  ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
     341                 :            :         virtual void SAL_CALL elementReplaced(const  ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
     342                 :            :         virtual void SAL_CALL elementRemoved(const  ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
     343                 :            : 
     344                 :          0 :         void Lock() { m_nLocks++; }
     345                 :          0 :         void UnLock() { m_nLocks--; }
     346                 :          0 :         sal_Bool IsLocked() const { return m_nLocks != 0; }
     347                 :          0 :         sal_Bool CanUndo() const { return m_bCanUndo; }
     348                 :          0 :         void ReleaseModel() { m_pNavModel = NULL; }
     349                 :            :     protected:
     350                 :            :         void Insert(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xIface, sal_Int32 nIndex);
     351                 :            :         void Remove( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement );
     352                 :            :     };
     353                 :            : 
     354                 :            :     //========================================================================
     355                 :            :     //= NavigatorTreeModel
     356                 :            :     //========================================================================
     357                 :            :     class NavigatorTreeModel : public SfxBroadcaster
     358                 :            :                            ,public SfxListener
     359                 :            :     {
     360                 :            :         friend class NavigatorTree;
     361                 :            :         friend class OFormComponentObserver;
     362                 :            : 
     363                 :            :         FmEntryDataList*            m_pRootList;
     364                 :            :         FmFormShell*                m_pFormShell;
     365                 :            :         FmFormPage*                 m_pFormPage;
     366                 :            :         FmFormModel*                m_pFormModel;
     367                 :            :         OFormComponentObserver*     m_pPropChangeList;
     368                 :            : 
     369                 :            :         ImageList                   m_aNormalImages;
     370                 :            : 
     371                 :            :         void UpdateContent( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xForms );
     372                 :            :         FmControlData* CreateControlData( ::com::sun::star::form::XFormComponent* pFormComponent );
     373                 :            : 
     374                 :            :         void InsertForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm, sal_uInt32 nRelPos);
     375                 :            :         void RemoveForm(FmFormData* pFormData);
     376                 :            : 
     377                 :            :         void InsertFormComponent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xComp, sal_uInt32 nRelPos);
     378                 :            :         void RemoveFormComponent(FmControlData* pControlData);
     379                 :            :         void InsertSdrObj(const SdrObject* pSdrObj);
     380                 :            :         void RemoveSdrObj(const SdrObject* pSdrObj);
     381                 :            : 
     382                 :            :         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);
     383                 :            : 
     384                 :            :         void BroadcastMarkedObjects(const SdrMarkList& mlMarked);
     385                 :            :             // einen RequestSelectHint mit den aktuell markierten Objekten broadcasten
     386                 :            :         sal_Bool InsertFormComponent(FmNavRequestSelectHint& rHint, SdrObject* pObject);
     387                 :            :             // ist ein Helper fuer vorherige, managet das Abteigen in SdrObjGroups
     388                 :            :             // Rueckgabe sal_True, wenn das Objekt eine FormComponent ist (oder rekursiv nur aus solchen besteht)
     389                 :            : 
     390                 :            :     public:
     391                 :            :         NavigatorTreeModel( const ImageList& _rNormalImages );
     392                 :            :         virtual ~NavigatorTreeModel();
     393                 :            : 
     394                 :            :         void FillBranch( FmFormData* pParentData );
     395                 :            :         void ClearBranch( FmFormData* pParentData );
     396                 :            :         void UpdateContent( FmFormShell* pNewShell );
     397                 :            : 
     398                 :            :         void Insert( FmEntryData* pEntryData, sal_uLong nRelPos = LIST_APPEND,
     399                 :            :                                               sal_Bool bAlterModel = sal_False );
     400                 :            :         void Remove( FmEntryData* pEntryData, sal_Bool bAlterModel = sal_False );
     401                 :            : 
     402                 :            :         sal_Bool Rename( FmEntryData* pEntryData, const ::rtl::OUString& rNewText );
     403                 :            : 
     404                 :            :         void Clear();
     405                 :            :         void SetModified( sal_Bool bMod=sal_True );
     406                 :            : 
     407                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >    GetForms() const;
     408                 :          0 :         FmFormShell*        GetFormShell() const { return m_pFormShell; }
     409                 :          0 :         FmFormPage*         GetFormPage() const { return m_pFormPage; }
     410                 :            :         FmEntryData*        FindData( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xElement, FmEntryDataList* pDataList, sal_Bool bRecurs=sal_True );
     411                 :            :         FmEntryData*        FindData( const ::rtl::OUString& rText, FmFormData* pParentData, sal_Bool bRecurs=sal_True );
     412                 :          0 :         FmEntryDataList*    GetRootList() const { return m_pRootList; }
     413                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >   GetFormComponents( FmFormData* pParentFormData );
     414                 :            :         SdrObject*          Search(SdrObjListIter& rIter, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xComp);
     415                 :            : 
     416                 :            :         virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
     417                 :            :     };
     418                 :            : 
     419                 :            :     //========================================================================
     420                 :            :     typedef std::set<SvLBoxEntry*> SvLBoxEntrySortedArray;
     421                 :            : 
     422                 :            :     class NavigatorTree : public SvTreeListBox, public SfxListener
     423                 :            :     {
     424                 :            :         enum DROP_ACTION        { DA_SCROLLUP, DA_SCROLLDOWN, DA_EXPANDNODE };
     425                 :            :         enum SELDATA_ITEMS      { SDI_DIRTY, SDI_ALL, SDI_NORMALIZED, SDI_NORMALIZED_FORMARK };
     426                 :            : 
     427                 :            :         // beim Droppen will ich scrollen und Folder aufklappen koennen, dafuer :
     428                 :            :         AutoTimer           m_aDropActionTimer;
     429                 :            :         Timer               m_aSynchronizeTimer;
     430                 :            :         // die Meta-Daten ueber meine aktuelle Selektion
     431                 :            :         SvLBoxEntrySortedArray  m_arrCurrentSelection;
     432                 :            :         // the entries which, in the view, are currently marked as "cut" (painted semi-transparent)
     433                 :            :         ListBoxEntrySet         m_aCutEntries;
     434                 :            :         // die Images, die ich brauche (und an FormDatas und EntryDatas weiterreiche)
     435                 :            :         ImageList           m_aNavigatorImages;
     436                 :            : 
     437                 :            :         ::svxform::OControlExchangeHelper   m_aControlExchange;
     438                 :            : 
     439                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >    m_xORB;
     440                 :            :         NavigatorTreeModel* m_pNavModel;
     441                 :            :         SvLBoxEntry*        m_pRootEntry;
     442                 :            :         SvLBoxEntry*        m_pEditEntry;
     443                 :            : 
     444                 :            :         sal_uLong               nEditEvent;
     445                 :            : 
     446                 :            :         SELDATA_ITEMS       m_sdiState;
     447                 :            :         Point               m_aTimerTriggered;      // die Position, an der der DropTimer angeschaltet wurde
     448                 :            :         DROP_ACTION         m_aDropActionType;
     449                 :            : 
     450                 :            :         sal_uInt16          m_nSelectLock;
     451                 :            :         sal_uInt16          m_nFormsSelected;
     452                 :            :         sal_uInt16          m_nControlsSelected;
     453                 :            :         sal_uInt16          m_nHiddenControls;      // (die Zahl geht in m_nControlsSelected mit ein)
     454                 :            : 
     455                 :            :         unsigned short      m_aTimerCounter;
     456                 :            : 
     457                 :            :         sal_Bool            m_bDragDataDirty        : 1;    // dito
     458                 :            :         sal_Bool            m_bPrevSelectionMixed   : 1;
     459                 :            :         sal_Bool            m_bMarkingObjects       : 1;    // wenn das sal_True ist, brauche ich auf die RequestSelectHints nicht reagieren
     460                 :            :         sal_Bool            m_bRootSelected         : 1;
     461                 :            :         sal_Bool            m_bInitialUpdate        : 1;   // bin ich das erste Mal im UpdateContent ?
     462                 :            :         sal_Bool            m_bKeyboardCut          : 1;
     463                 :            : 
     464                 :            : 
     465                 :            :         void            UpdateContent();
     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                 :          0 :         void LockSelectionHandling() { ++m_nSelectLock; }
     500                 :          0 :         void UnlockSelectionHandling() { --m_nSelectLock; }
     501                 :          0 :         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                 :          0 :         NavigatorTreeModel*    GetNavModel() const { return m_pNavModel; }
     536                 :            :         SvLBoxEntry*        FindEntry( FmEntryData* pEntryData );
     537                 :            : 
     538                 :            :         virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const rtl::OUString& 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                 :          0 :         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         [ #  # ]:          0 :     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                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10