Files
libreoffice/svx/source/inc/fmexpl.hxx

610 lines
25 KiB
C++
Raw Normal View History

2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 16:07:07 +00:00
*
* Copyright 2008 by Sun Microsystems, Inc.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:07:07 +00:00
*
* $RCSfile: fmexpl.hxx,v $
* $Revision: 1.18 $
2000-09-18 16:07:07 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 16:07:07 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 16:07:07 +00:00
*
************************************************************************/
#ifndef _SVX_FMEXPL_HXX
#define _SVX_FMEXPL_HXX
#include <svtools/lstner.hxx>
#include <svtools/brdcst.hxx>
#include <vcl/window.hxx>
#include <sfx2/childwin.hxx>
#include <svtools/poolitem.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dockwin.hxx>
#include <sfx2/ctrlitem.hxx>
#include <vcl/image.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/form/XForm.hpp>
2000-09-18 16:07:07 +00:00
#include <com/sun/star/form/XFormComponent.hpp>
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/container/XContainer.hpp>
2000-09-18 16:07:07 +00:00
#include <svtools/svtreebx.hxx>
#include <vcl/dialog.hxx>
#include <vcl/group.hxx>
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <vcl/edit.hxx>
#include <vcl/dockwin.hxx>
#include <svx/fmview.hxx>
2000-09-18 16:07:07 +00:00
2001-04-09 10:19:35 +00:00
#include "fmexch.hxx"
#include "fmtools.hxx"
2000-09-18 16:07:07 +00:00
class SdrObjListIter;
class FmFormShell;
class SdrObject;
class FmFormModel;
CWS-TOOLING: integrate CWS dba31e 2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
2008-12-01 12:31:27 +00:00
class FmFormView;
class SdrMarkList;
2000-09-18 16:07:07 +00:00
//========================================================================
class FmEntryData;
class FmNavInsertedHint : public SfxHint
2000-09-18 16:07:07 +00:00
{
FmEntryData* pEntryData;
sal_uInt32 nPos;
public:
TYPEINFO();
FmNavInsertedHint( FmEntryData* pInsertedEntryData, sal_uInt32 nRelPos );
virtual ~FmNavInsertedHint();
2000-09-18 16:07:07 +00:00
FmEntryData* GetEntryData() const { return pEntryData; }
sal_uInt32 GetRelPos() const { return nPos; }
};
//========================================================================
class FmNavModelReplacedHint : public SfxHint
2000-09-18 16:07:07 +00:00
{
FmEntryData* pEntryData; // die Daten des Eintrages, der ein neues Model bekommen hat
public:
TYPEINFO();
FmNavModelReplacedHint( FmEntryData* pAffectedEntryData );
virtual ~FmNavModelReplacedHint();
2000-09-18 16:07:07 +00:00
FmEntryData* GetEntryData() const { return pEntryData; }
};
//========================================================================
class FmNavRemovedHint : public SfxHint
2000-09-18 16:07:07 +00:00
{
FmEntryData* pEntryData;
public:
TYPEINFO();
FmNavRemovedHint( FmEntryData* pInsertedEntryData );
virtual ~FmNavRemovedHint();
2000-09-18 16:07:07 +00:00
FmEntryData* GetEntryData() const { return pEntryData; }
};
//========================================================================
class FmNavNameChangedHint : public SfxHint
2000-09-18 16:07:07 +00:00
{
FmEntryData* pEntryData;
::rtl::OUString aNewName;
public:
TYPEINFO();
FmNavNameChangedHint( FmEntryData* pData, const ::rtl::OUString& rNewName );
virtual ~FmNavNameChangedHint();
2000-09-18 16:07:07 +00:00
FmEntryData* GetEntryData() const { return pEntryData; }
::rtl::OUString GetNewName() const { return aNewName; }
};
//========================================================================
class FmNavClearedHint : public SfxHint
2000-09-18 16:07:07 +00:00
{
public:
TYPEINFO();
FmNavClearedHint();
virtual ~FmNavClearedHint();
2000-09-18 16:07:07 +00:00
};
//========================================================================
class FmNavViewMarksChanged : public SfxHint
2000-09-18 16:07:07 +00:00
{
FmFormView* pView;
public:
TYPEINFO();
FmNavViewMarksChanged(FmFormView* pWhichView) { pView = pWhichView; }
virtual ~FmNavViewMarksChanged() {}
2000-09-18 16:07:07 +00:00
FmFormView* GetAffectedView() { return pView; }
};
//========================================================================
class FmEntryDataList;
class FmEntryData
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xNormalizedIFace;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xProperties;
::com::sun::star::uno::Reference< ::com::sun::star::container::XChild > m_xChild;
2000-09-18 16:07:07 +00:00
protected:
2002-05-17 07:41:57 +00:00
Image m_aNormalImage;
Image m_aHCImage;
::rtl::OUString aText;
2000-09-18 16:07:07 +00:00
FmEntryDataList* pChildList;
FmEntryData* pParent;
protected:
void newObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace );
2000-09-18 16:07:07 +00:00
public:
TYPEINFO();
FmEntryData( FmEntryData* pParentData, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rIFace );
2000-09-18 16:07:07 +00:00
FmEntryData( const FmEntryData& rEntryData );
virtual ~FmEntryData();
void Clear();
void SetText( const ::rtl::OUString& rText ){ aText = rText; }
void SetParent( FmEntryData* pParentData ){ pParent = pParentData; }
2002-05-17 07:41:57 +00:00
const Image& GetNormalImage() const { return m_aNormalImage; }
const Image& GetHCImage() const { return m_aHCImage; }
2000-09-18 16:07:07 +00:00
::rtl::OUString GetText() const { return aText; }
FmEntryData* GetParent() const { return pParent; }
FmEntryDataList* GetChildList() const { return pChildList; }
virtual sal_Bool IsEqualWithoutChilds( FmEntryData* pEntryData );
virtual FmEntryData* Clone() = 0;
// note that the interface returned is normalized, i.e. querying the given XInterface of the object
// for XInterface must return the interface itself.
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& GetElement() const
{
return m_xNormalizedIFace;
}
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& GetPropertySet() const
{
return m_xProperties;
}
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild >& GetChildIFace() const
{
return m_xChild;
}
2000-09-18 16:07:07 +00:00
};
//========================================================================
DECLARE_LIST( FmEntryDataBaseList, FmEntryData* )
2000-09-18 16:07:07 +00:00
class FmEntryDataList : public FmEntryDataBaseList
{
public:
FmEntryDataList();
virtual ~FmEntryDataList();
};
//========================================================================
// FmNavRequestSelectHint - jemand teilt dem NavigatorTree mit, dass er bestimmte Eintraege selektieren soll
2000-09-18 16:07:07 +00:00
typedef FmEntryData* FmEntryDataPtr;
SV_DECL_PTRARR_SORT( FmEntryDataArray, FmEntryDataPtr, 16, 16 )
class FmNavRequestSelectHint : public SfxHint
2000-09-18 16:07:07 +00:00
{
FmEntryDataArray m_arredToSelect;
sal_Bool m_bMixedSelection;
public:
TYPEINFO();
FmNavRequestSelectHint() { }
virtual ~FmNavRequestSelectHint() {}
2000-09-18 16:07:07 +00:00
void SetMixedSelection(sal_Bool bMixedSelection) { m_bMixedSelection = bMixedSelection; }
sal_Bool IsMixedSelection() { return m_bMixedSelection; }
void AddItem(FmEntryData* pEntry) { m_arredToSelect.Insert(pEntry); }
void ClearItems() { m_arredToSelect.Remove(sal_uInt16(0), m_arredToSelect.Count()); }
FmEntryDataArray& GetItems() { return m_arredToSelect; }
};
//========================================================================
class FmFormData : public FmEntryData
{
::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xForm;
::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer > m_xContainer;
2000-09-18 16:07:07 +00:00
public:
TYPEINFO();
2002-05-17 07:41:57 +00:00
FmFormData(
const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
const ImageList& _rNormalImages,
const ImageList& _rHCImages,
FmFormData* _pParent = NULL
);
2000-09-18 16:07:07 +00:00
FmFormData( const FmFormData& rFormData );
virtual ~FmFormData();
void SetForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm )
{
m_xForm = xForm;
m_xContainer = m_xContainer.query( m_xForm );
newObject( m_xForm );
}
2000-09-18 16:07:07 +00:00
const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& GetFormIface() const { return m_xForm; }
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& GetContainer() const { return m_xContainer; }
2000-09-18 16:07:07 +00:00
virtual sal_Bool IsEqualWithoutChilds( FmEntryData* pEntryData );
virtual FmEntryData* Clone();
};
//========================================================================
class FmControlData : public FmEntryData
{
::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > m_xFormComponent;
Image GetImage(const ImageList& ilNavigatorImages) const;
public:
TYPEINFO();
2002-05-17 07:41:57 +00:00
FmControlData(
const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxComponent,
const ImageList& _rNormalImages,
const ImageList& _rHCImages,
FmFormData* _pParent
);
2000-09-18 16:07:07 +00:00
FmControlData( const FmControlData& rControlData );
virtual ~FmControlData();
const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& GetFormComponent() const { return m_xFormComponent; }
virtual sal_Bool IsEqualWithoutChilds( FmEntryData* pEntryData );
virtual FmEntryData* Clone();
2002-05-17 07:41:57 +00:00
void ModelReplaced(
const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxNew,
const ImageList& _rNormalImages,
const ImageList& _rHCImages
);
2000-09-18 16:07:07 +00:00
};
2000-09-18 16:07:07 +00:00
//========================================================================
//............................................................................
namespace svxform
2000-09-18 16:07:07 +00:00
{
//............................................................................
2000-09-18 16:07:07 +00:00
class NavigatorTreeModel;
//========================================================================
// class OFormComponentObserver
//========================================================================
class OFormComponentObserver
:public ::cppu::WeakImplHelper2 < ::com::sun::star::beans::XPropertyChangeListener
, ::com::sun::star::container::XContainerListener
>
{
::svxform::NavigatorTreeModel* m_pNavModel;
sal_uInt32 m_nLocks;
sal_Bool m_bCanUndo;
2000-09-18 16:07:07 +00:00
public:
OFormComponentObserver( ::svxform::NavigatorTreeModel* pModel );
2000-09-18 16:07:07 +00:00
// XEventListenerListener
virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
2000-09-18 16:07:07 +00:00
// ::com::sun::star::beans::XPropertyChangeListener
virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
2000-09-18 16:07:07 +00:00
// ::com::sun::star::container::XContainerListener
2000-09-18 16:07:07 +00:00
virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
2000-09-18 16:07:07 +00:00
void Lock() { m_nLocks++; }
void UnLock() { m_nLocks--; }
sal_Bool IsLocked() const { return m_nLocks != 0; }
sal_Bool CanUndo() const { return m_bCanUndo; }
void ReleaseModel() { m_pNavModel = NULL; }
protected:
void Insert(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xIface, sal_Int32 nIndex);
void Remove( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement );
};
//========================================================================
//= NavigatorTreeModel
//========================================================================
class NavigatorTreeModel : public SfxBroadcaster
,public SfxListener
{
friend class NavigatorTree;
friend class OFormComponentObserver;
FmEntryDataList* m_pRootList;
FmFormShell* m_pFormShell;
FmFormPage* m_pFormPage;
FmFormModel* m_pFormModel;
2002-05-17 07:41:57 +00:00
OFormComponentObserver* m_pPropChangeList;
2002-05-17 07:41:57 +00:00
ImageList m_aNormalImages;
ImageList m_aHCImages;
void UpdateContent( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xForms );
FmControlData* CreateControlData( ::com::sun::star::form::XFormComponent* pFormComponent );
void InsertForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm, sal_uInt32 nRelPos);
void RemoveForm(FmFormData* pFormData);
void InsertFormComponent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xComp, sal_uInt32 nRelPos);
void RemoveFormComponent(FmControlData* pControlData);
void InsertSdrObj(const SdrObject* pSdrObj);
void RemoveSdrObj(const SdrObject* pSdrObj);
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);
void BroadcastMarkedObjects(const SdrMarkList& mlMarked);
// einen RequestSelectHint mit den aktuell markierten Objekten broadcasten
sal_Bool InsertFormComponent(FmNavRequestSelectHint& rHint, SdrObject* pObject);
// ist ein Helper fuer vorherige, managet das Abteigen in SdrObjGroups
// Rueckgabe sal_True, wenn das Objekt eine FormComponent ist (oder rekursiv nur aus solchen besteht)
public:
2002-05-17 07:41:57 +00:00
NavigatorTreeModel( const ImageList& _rNormalImages, const ImageList& _rHCImages );
virtual ~NavigatorTreeModel();
void FillBranch( FmFormData* pParentData );
void ClearBranch( FmFormData* pParentData );
void UpdateContent( FmFormShell* pNewShell );
void Insert( FmEntryData* pEntryData, ULONG nRelPos = LIST_APPEND,
sal_Bool bAlterModel = sal_False );
void Remove( FmEntryData* pEntryData, sal_Bool bAlterModel = sal_False );
sal_Bool Rename( FmEntryData* pEntryData, const ::rtl::OUString& rNewText );
sal_Bool IsNameAlreadyDefined( const ::rtl::OUString& rName, FmFormData* pParentData );
void Clear();
sal_Bool CheckEntry( FmEntryData* pEntryData );
void SetModified( sal_Bool bMod=sal_True );
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetForms() const;
FmFormShell* GetFormShell() const { return m_pFormShell; }
FmFormPage* GetFormPage() const { return m_pFormPage; }
FmEntryData* FindData( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xElement, FmEntryDataList* pDataList, sal_Bool bRecurs=sal_True );
FmEntryData* FindData( const ::rtl::OUString& rText, FmFormData* pParentData, sal_Bool bRecurs=sal_True );
FmEntryDataList* GetRootList() const { return m_pRootList; }
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > GetFormComponents( FmFormData* pParentFormData );
SdrObject* GetSdrObj( FmControlData* pControlData );
SdrObject* Search(SdrObjListIter& rIter, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xComp);
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
};
//========================================================================
typedef SvLBoxEntry* SvLBoxEntryPtr;
SV_DECL_PTRARR_SORT( SvLBoxEntrySortedArray, SvLBoxEntryPtr, 16, 16 )
class NavigatorTree : public SvTreeListBox, public SfxListener
{
enum DROP_ACTION { DA_SCROLLUP, DA_SCROLLDOWN, DA_EXPANDNODE };
enum SELDATA_ITEMS { SDI_DIRTY, SDI_ALL, SDI_NORMALIZED, SDI_NORMALIZED_FORMARK };
// beim Droppen will ich scrollen und Folder aufklappen koennen, dafuer :
AutoTimer m_aDropActionTimer;
Timer m_aSynchronizeTimer;
// die Meta-Daten ueber meine aktuelle Selektion
SvLBoxEntrySortedArray m_arrCurrentSelection;
// the entries which, in the view, are currently marked as "cut" (painted semi-transparent)
ListBoxEntrySet m_aCutEntries;
// die Images, die ich brauche (und an FormDatas und EntryDatas weiterreiche)
2002-05-17 07:41:57 +00:00
ImageList m_aNavigatorImages;
ImageList m_aNavigatorImagesHC;
::svxform::OControlExchangeHelper m_aControlExchange;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
NavigatorTreeModel* m_pNavModel;
SvLBoxEntry* m_pRootEntry;
SvLBoxEntry* m_pEditEntry;
ULONG nEditEvent;
SELDATA_ITEMS m_sdiState;
Point m_aTimerTriggered; // die Position, an der der DropTimer angeschaltet wurde
DROP_ACTION m_aDropActionType;
sal_uInt16 m_nSelectLock;
sal_uInt16 m_nFormsSelected;
sal_uInt16 m_nControlsSelected;
sal_uInt16 m_nHiddenControls; // (die Zahl geht in m_nControlsSelected mit ein)
unsigned short m_aTimerCounter;
sal_Bool m_bDragDataDirty : 1; // dito
sal_Bool m_bPrevSelectionMixed : 1;
sal_Bool m_bMarkingObjects : 1; // wenn das sal_True ist, brauche ich auf die RequestSelectHints nicht reagieren
sal_Bool m_bRootSelected : 1;
sal_Bool m_bInitialUpdate : 1; // bin ich das erste Mal im UpdateContent ?
sal_Bool m_bKeyboardCut : 1;
void UpdateContent();
sal_Bool IsDeleteAllowed();
FmControlData* NewControl( const ::rtl::OUString& rServiceName, SvLBoxEntry* pParentEntry, sal_Bool bEditName = sal_True );
void NewForm( SvLBoxEntry* pParentEntry );
SvLBoxEntry* Insert( FmEntryData* pEntryData, ULONG nRelPos=LIST_APPEND );
void Remove( FmEntryData* pEntryData );
void CollectSelectionData(SELDATA_ITEMS sdiHow);
// sammelt in m_arrCurrentSelection die aktuell selektierten Eintraege, normalisiert die Liste wenn verlangt
// SDI_NORMALIZED bedeutet einfach, dass alle Eintraege, die schon einen selektierten Vorfahren haben, nicht mit gesammelt
// werden.
// SDI_NORMALIZED_FORMARK bedeutet, dass wie bei SDI_NORMALIZED verfahren wird, aber Eintraege, deren direktes Elter nicht
// selektiert ist, aufgenommen werden (unabhaengig vom Status weiterer Vorfahren), desgleichen Formulare, die selektiert sind,
// unabhaengig vom Status irgendwelcher Vorfahren
// Bei beiden Normalized-Modi enthalten die m_nFormsSelected, ... die richtige Anzahl, auch wenn nicht alle dieser Eintraege
// in m_arrCurrentSelection landen.
// SDI_DIRTY ist natuerlich nicht erlaubt als Parameter
// ein einziges Interface fuer alle selektierten Eintraege zusammensetzen
void ShowSelectionProperties(sal_Bool bForce = sal_False);
// alle selektierten Elemnte loeschen
void DeleteSelection();
void SynchronizeSelection(FmEntryDataArray& arredToSelect);
// nach dem Aufruf dieser Methode sind genau die Eintraege selektiert, die in dem Array bezeichnet sind
void SynchronizeSelection();
// macht das selbe, nimmt die MarkList der ::com::sun::star::sdbcx::View
void SynchronizeMarkList();
// umgekehrte Richtung von SynchronizeMarkList : markiert in der ::com::sun::star::sdbcx::View alle der aktuellen Selektion entsprechenden Controls
// im Select aktualisiere ich normalerweise die Marklist der zugehoerigen ::com::sun::star::sdbcx::View, mit folgenden Funktionen
// kann ich das Locking dieses Verhaltens steuern
void LockSelectionHandling() { ++m_nSelectLock; }
void UnlockSelectionHandling() { --m_nSelectLock; }
sal_Bool IsSelectionHandlingLocked() const { return m_nSelectLock>0; }
sal_Bool IsHiddenControl(FmEntryData* pEntryData);
DECL_LINK( OnEdit, void* );
DECL_LINK( OnDropActionTimer, void* );
DECL_LINK(OnEntrySelDesel, NavigatorTree*);
DECL_LINK(OnSynchronizeTimer, void*);
DECL_LINK( OnClipboardAction, void* );
protected:
virtual void Command( const CommandEvent& rEvt );
virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
public:
NavigatorTree(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB, Window* pParent );
virtual ~NavigatorTree();
void Clear();
void UpdateContent( FmFormShell* pFormShell );
void MarkViewObj( FmFormData* pFormData, sal_Bool bMark, sal_Bool bDeep = sal_False );
void MarkViewObj( FmControlData* pControlData, sal_Bool bMarkHandles, sal_Bool bMark );
void UnmarkAllViewObj();
sal_Bool IsFormEntry( SvLBoxEntry* pEntry );
sal_Bool IsFormComponentEntry( SvLBoxEntry* pEntry );
::rtl::OUString GenerateName( FmEntryData* pEntryData );
NavigatorTreeModel* GetNavModel() const { return m_pNavModel; }
SvLBoxEntry* FindEntry( FmEntryData* pEntryData );
virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const XubString& rNewText );
virtual sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True );
virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& );
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
virtual void KeyInput( const KeyEvent& rKEvt );
virtual void ModelHasRemoved( SvListEntry* _pEntry );
using SvTreeListBox::Insert;
using SvTreeListBox::ExecuteDrop;
using SvTreeListBox::Select;
using SvTreeListBox::Notify;
private:
sal_Int8 implAcceptDataTransfer( const DataFlavorExVector& _rFlavors, sal_Int8 _nAction, const Point& _rDropPos, sal_Bool _bDnD );
sal_Int8 implAcceptDataTransfer( const DataFlavorExVector& _rFlavors, sal_Int8 _nAction, SvLBoxEntry* _pTargetEntry, sal_Bool _bDnD );
sal_Int8 implExecuteDataTransfer( const OControlTransferData& _rData, sal_Int8 _nAction, const Point& _rDropPos, sal_Bool _bDnD );
sal_Int8 implExecuteDataTransfer( const OControlTransferData& _rData, sal_Int8 _nAction, SvLBoxEntry* _pTargetEntry, sal_Bool _bDnD );
// check if a cut, copy, or drag operation can be started in the current situation
sal_Bool implAllowExchange( sal_Int8 _nAction, sal_Bool* _pHasNonHidden = NULL );
// check if a paste with the current clipboard content can be accepted
sal_Bool implAcceptPaste( );
// fills m_aControlExchange in preparation of a DnD or clipboard operation
sal_Bool implPrepareExchange( sal_Int8 _nAction );
void doPaste();
void doCopy();
void doCut();
sal_Bool doingKeyboardCut( ) const { return m_bKeyboardCut; }
};
//========================================================================
class NavigatorFrame : public SfxDockingWindow, public SfxControllerItem
{
private:
::svxform::NavigatorTree* m_pNavigatorTree;
protected:
virtual void Resize();
virtual sal_Bool Close();
virtual void GetFocus();
virtual Size CalcDockingSize( SfxChildAlignment );
virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment );
using SfxDockingWindow::StateChanged;
public:
NavigatorFrame( SfxBindings *pBindings, SfxChildWindow *pMgr,
Window* pParent );
virtual ~NavigatorFrame();
void UpdateContent( FmFormShell* pFormShell );
void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
void FillInfo( SfxChildWinInfo& rInfo ) const;
};
//========================================================================
class NavigatorFrameManager : public SfxChildWindow
{
public:
NavigatorFrameManager( Window *pParent, sal_uInt16 nId, SfxBindings *pBindings,
SfxChildWinInfo *pInfo );
SFX_DECL_CHILDWINDOW( NavigatorFrameManager );
};
//............................................................................
} // namespace svxform
//............................................................................
2000-09-18 16:07:07 +00:00
#endif // _SVX_FMEXPL_HXX