11d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 31d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 41d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 51d2dbeb0SAndrew Rist * distributed with this work for additional information 61d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 71d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 81d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 91d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 111d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 131d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 141d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 151d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 161d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 171d2dbeb0SAndrew Rist * specific language governing permissions and limitations 181d2dbeb0SAndrew Rist * under the License. 19cdf0e10cSrcweir * 201d2dbeb0SAndrew Rist *************************************************************/ 211d2dbeb0SAndrew Rist 221d2dbeb0SAndrew Rist 23cdf0e10cSrcweir #ifndef _CONTTREE_HXX 24cdf0e10cSrcweir #define _CONTTREE_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <svtools/svtreebx.hxx> 27cdf0e10cSrcweir #include "swcont.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir class SwWrtShell; 30cdf0e10cSrcweir class SwContentType; 31cdf0e10cSrcweir class SwNavigationPI; 32cdf0e10cSrcweir class SwNavigationConfig; 33cdf0e10cSrcweir class Menu; 34cdf0e10cSrcweir class ToolBox; 35cdf0e10cSrcweir class SwGlblDocContents; 36cdf0e10cSrcweir class SwGlblDocContent; 37cdf0e10cSrcweir class SfxObjectShell; 38cdf0e10cSrcweir 39*ca62e2c2SSteve Yin //IAccessibility2 Implementation 2009----- 40*ca62e2c2SSteve Yin //Solution: Include SdrObject class 41*ca62e2c2SSteve Yin class SdrObject; 42*ca62e2c2SSteve Yin //-----IAccessibility2 Implementation 2009 43cdf0e10cSrcweir 44cdf0e10cSrcweir #define EDIT_MODE_EDIT 0 45cdf0e10cSrcweir #define EDIT_MODE_UPD_IDX 1 46cdf0e10cSrcweir #define EDIT_MODE_RMV_IDX 2 47cdf0e10cSrcweir #define EDIT_UNPROTECT_TABLE 3 48cdf0e10cSrcweir #define EDIT_MODE_DELETE 4 49cdf0e10cSrcweir #define EDIT_MODE_RENAME 5 50cdf0e10cSrcweir 51cdf0e10cSrcweir //---------------------------------------------------------------------------- 52cdf0e10cSrcweir //---------------------------------------------------------------------------- 53cdf0e10cSrcweir 54cdf0e10cSrcweir class SwContentTree : public SvTreeListBox 55cdf0e10cSrcweir { 56cdf0e10cSrcweir ImageList aEntryImages; 57cdf0e10cSrcweir String sSpace; 58cdf0e10cSrcweir AutoTimer aUpdTimer; 59cdf0e10cSrcweir 60cdf0e10cSrcweir SwContentType* aActiveContentArr[CONTENT_TYPE_MAX]; 61cdf0e10cSrcweir SwContentType* aHiddenContentArr[CONTENT_TYPE_MAX]; 62cdf0e10cSrcweir String aContextStrings[CONTEXT_COUNT + 1]; 63cdf0e10cSrcweir String sRemoveIdx; 64cdf0e10cSrcweir String sUpdateIdx; 65cdf0e10cSrcweir String sUnprotTbl; 66cdf0e10cSrcweir String sRename; 67cdf0e10cSrcweir String sReadonlyIdx; 68cdf0e10cSrcweir String sInvisible; 69cdf0e10cSrcweir String sPostItShow; 70cdf0e10cSrcweir String sPostItHide; 71cdf0e10cSrcweir String sPostItDelete; 72cdf0e10cSrcweir 73cdf0e10cSrcweir SwWrtShell* pHiddenShell; // gedropptes Doc 74cdf0e10cSrcweir SwWrtShell* pActiveShell; // die aktive oder eine konst. offene View 75cdf0e10cSrcweir SwNavigationConfig* pConfig; 76cdf0e10cSrcweir 77cdf0e10cSrcweir sal_Int32 nActiveBlock; 78cdf0e10cSrcweir sal_uInt16 nHiddenBlock; 79cdf0e10cSrcweir sal_uInt16 nRootType; 80cdf0e10cSrcweir sal_uInt16 nLastSelType; 81cdf0e10cSrcweir sal_uInt8 nOutlineLevel; 82cdf0e10cSrcweir 83cdf0e10cSrcweir sal_Bool bIsActive :1; 84cdf0e10cSrcweir sal_Bool bIsConstant :1; 85cdf0e10cSrcweir sal_Bool bIsHidden :1; 86cdf0e10cSrcweir sal_Bool bDocChgdInDragging :1; 87cdf0e10cSrcweir sal_Bool bIsInternalDrag :1; 88cdf0e10cSrcweir sal_Bool bIsRoot :1; 89cdf0e10cSrcweir sal_Bool bIsIdleClear :1; 90cdf0e10cSrcweir sal_Bool bIsLastReadOnly :1; 91cdf0e10cSrcweir sal_Bool bIsOutlineMoveable :1; 92cdf0e10cSrcweir sal_Bool bViewHasChanged :1; 93cdf0e10cSrcweir sal_Bool bIsImageListInitialized : 1; 94cdf0e10cSrcweir 95cdf0e10cSrcweir static sal_Bool bIsInDrag; 96*ca62e2c2SSteve Yin //IAccessibility2 Implementation 2009----- 97*ca62e2c2SSteve Yin sal_Bool bIsKeySpace; 98*ca62e2c2SSteve Yin Rectangle oldRectangle; 99*ca62e2c2SSteve Yin //-----IAccessibility2 Implementation 2009 100cdf0e10cSrcweir void FindActiveTypeAndRemoveUserData(); 101cdf0e10cSrcweir 102cdf0e10cSrcweir using SvLBox::ExecuteDrop; 103cdf0e10cSrcweir using SvTreeListBox::EditEntry; 104cdf0e10cSrcweir using SvListView::Expand; 105cdf0e10cSrcweir using SvListView::Collapse; 106cdf0e10cSrcweir using SvListView::Select; 107cdf0e10cSrcweir 108cdf0e10cSrcweir protected: 109cdf0e10cSrcweir // virtual void Command( const CommandEvent& rCEvt ); 110cdf0e10cSrcweir virtual void RequestHelp( const HelpEvent& rHEvt ); 111cdf0e10cSrcweir virtual void InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&,SvLBoxButtonKind); 112cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 113cdf0e10cSrcweir 114cdf0e10cSrcweir SwNavigationPI* GetParentWindow(){return 115cdf0e10cSrcweir (SwNavigationPI*)Window::GetParent();} 116cdf0e10cSrcweir 117cdf0e10cSrcweir virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); 118cdf0e10cSrcweir virtual void DragFinished( sal_Int8 ); 119cdf0e10cSrcweir virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); 120cdf0e10cSrcweir 121cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir sal_Bool FillTransferData( TransferDataContainer& rTransfer, 124cdf0e10cSrcweir sal_Int8& rDragMode ); 125cdf0e10cSrcweir sal_Bool HasContentChanged(); 126cdf0e10cSrcweir 127cdf0e10cSrcweir virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData, 128cdf0e10cSrcweir SvLBoxEntry* ); 129cdf0e10cSrcweir virtual sal_Bool NotifyAcceptDrop( SvLBoxEntry* ); 130cdf0e10cSrcweir 131cdf0e10cSrcweir virtual sal_Bool NotifyMoving( SvLBoxEntry* pTarget, 132cdf0e10cSrcweir SvLBoxEntry* pEntry, 133cdf0e10cSrcweir SvLBoxEntry*& rpNewParent, 134cdf0e10cSrcweir sal_uLong& rNewChildPos 135cdf0e10cSrcweir ); 136cdf0e10cSrcweir virtual sal_Bool NotifyCopying( SvLBoxEntry* pTarget, 137cdf0e10cSrcweir SvLBoxEntry* pEntry, 138cdf0e10cSrcweir SvLBoxEntry*& rpNewParent, 139cdf0e10cSrcweir sal_uLong& rNewChildPos 140cdf0e10cSrcweir ); 141cdf0e10cSrcweir virtual void MouseButtonDown( const MouseEvent& rMEvt ); 142cdf0e10cSrcweir 143cdf0e10cSrcweir void EditEntry( SvLBoxEntry* pEntry, sal_uInt8 nMode ); 144cdf0e10cSrcweir 145cdf0e10cSrcweir void GotoContent(SwContent* pCnt); 146cdf0e10cSrcweir static void SetInDrag(sal_Bool bSet) {bIsInDrag = bSet;} 147cdf0e10cSrcweir 148cdf0e10cSrcweir virtual PopupMenu* CreateContextMenu( void ); 149cdf0e10cSrcweir virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ); 150cdf0e10cSrcweir 151cdf0e10cSrcweir public: 152cdf0e10cSrcweir SwContentTree(Window* pParent, const ResId& rResId); 153cdf0e10cSrcweir ~SwContentTree(); 154*ca62e2c2SSteve Yin //IAccessibility2 Implementation 2009----- 155*ca62e2c2SSteve Yin String GetEntryAltText( SvLBoxEntry* pEntry ) const; 156*ca62e2c2SSteve Yin String GetEntryLongDescription( SvLBoxEntry* pEntry ) const; 157*ca62e2c2SSteve Yin SdrObject* GetDrawingObjectsByContent(const SwContent *pCnt); 158*ca62e2c2SSteve Yin //-----IAccessibility2 Implementation 2009 159cdf0e10cSrcweir 160cdf0e10cSrcweir sal_Bool ToggleToRoot(); 161cdf0e10cSrcweir sal_Bool IsRoot() const {return bIsRoot;} 162cdf0e10cSrcweir sal_uInt16 GetRootType() const {return nRootType;} 163cdf0e10cSrcweir void SetRootType(sal_uInt16 nType); 164cdf0e10cSrcweir void Display( sal_Bool bActiveView ); 165cdf0e10cSrcweir void Clear(); 166cdf0e10cSrcweir void SetHiddenShell(SwWrtShell* pSh); 167cdf0e10cSrcweir void ShowHiddenShell(); 168cdf0e10cSrcweir void ShowActualView(); 169cdf0e10cSrcweir void SetActiveShell(SwWrtShell* pSh); 170cdf0e10cSrcweir void SetConstantShell(SwWrtShell* pSh); 171cdf0e10cSrcweir 172cdf0e10cSrcweir SwWrtShell* GetWrtShell() 173cdf0e10cSrcweir {return bIsActive||bIsConstant ? 174cdf0e10cSrcweir pActiveShell : 175cdf0e10cSrcweir pHiddenShell;} 176cdf0e10cSrcweir 177cdf0e10cSrcweir static sal_Bool IsInDrag() {return bIsInDrag;} 178cdf0e10cSrcweir sal_Bool IsInternalDrag() const {return bIsInternalDrag != 0;} 179cdf0e10cSrcweir 180cdf0e10cSrcweir sal_Int32 GetActiveBlock() const {return nActiveBlock;} 181cdf0e10cSrcweir 182cdf0e10cSrcweir sal_uInt8 GetOutlineLevel()const {return nOutlineLevel;} 183cdf0e10cSrcweir void SetOutlineLevel(sal_uInt8 nSet); 184cdf0e10cSrcweir 185cdf0e10cSrcweir sal_Bool Expand( SvLBoxEntry* pParent ); 186cdf0e10cSrcweir 187cdf0e10cSrcweir sal_Bool Collapse( SvLBoxEntry* pParent ); 188cdf0e10cSrcweir 189cdf0e10cSrcweir void ExecCommand(sal_uInt16 nCmd, sal_Bool bModifier); 190cdf0e10cSrcweir 191cdf0e10cSrcweir void ShowTree(); 192cdf0e10cSrcweir void HideTree(); 193cdf0e10cSrcweir 194cdf0e10cSrcweir sal_Bool IsConstantView() {return bIsConstant;} 195cdf0e10cSrcweir sal_Bool IsActiveView() {return bIsActive;} 196cdf0e10cSrcweir sal_Bool IsHiddenView() {return bIsHidden;} 197cdf0e10cSrcweir 198cdf0e10cSrcweir const SwWrtShell* GetActiveWrtShell() {return pActiveShell;} 199cdf0e10cSrcweir SwWrtShell* GetHiddenWrtShell() {return pHiddenShell;} 200cdf0e10cSrcweir 201cdf0e10cSrcweir DECL_LINK( ContentDoubleClickHdl, SwContentTree * ); 202cdf0e10cSrcweir // DECL_LINK( PopupHdl, Menu* ); 203cdf0e10cSrcweir DECL_LINK( TimerUpdate, Timer * ); 204cdf0e10cSrcweir 205cdf0e10cSrcweir virtual long GetTabPos( SvLBoxEntry*, SvLBoxTab* ); 206cdf0e10cSrcweir virtual void RequestingChilds( SvLBoxEntry* pParent ); 207cdf0e10cSrcweir virtual void GetFocus(); 208cdf0e10cSrcweir virtual void KeyInput(const KeyEvent& rKEvt); 209cdf0e10cSrcweir 210cdf0e10cSrcweir virtual sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True ); 211*ca62e2c2SSteve Yin //IAccessibility2 Implementation 2009----- 212*ca62e2c2SSteve Yin virtual sal_Int32 GetEntryRealChildsNum( SvLBoxEntry* pEntry ) const; 213*ca62e2c2SSteve Yin //-----IAccessibility2 Implementation 2009 214cdf0e10cSrcweir }; 215cdf0e10cSrcweir 216cdf0e10cSrcweir 217cdf0e10cSrcweir //---------------------------------------------------------------------------- 218cdf0e10cSrcweir // TreeListBox fuer Globaldokumente 219cdf0e10cSrcweir //---------------------------------------------------------------------------- 220cdf0e10cSrcweir 221cdf0e10cSrcweir class SwLBoxString : public SvLBoxString 222cdf0e10cSrcweir { 223cdf0e10cSrcweir public: 224cdf0e10cSrcweir 225cdf0e10cSrcweir SwLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, 226cdf0e10cSrcweir const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr) 227cdf0e10cSrcweir { 228cdf0e10cSrcweir } 229cdf0e10cSrcweir 230cdf0e10cSrcweir virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, 231cdf0e10cSrcweir SvLBoxEntry* pEntry); 232cdf0e10cSrcweir }; 233cdf0e10cSrcweir 234cdf0e10cSrcweir namespace sfx2 { class DocumentInserter; } 235cdf0e10cSrcweir namespace sfx2 { class FileDialogHelper; } 236cdf0e10cSrcweir 237cdf0e10cSrcweir class SwGlobalTree : public SvTreeListBox 238cdf0e10cSrcweir { 239cdf0e10cSrcweir private: 240cdf0e10cSrcweir AutoTimer aUpdateTimer; 241cdf0e10cSrcweir String aContextStrings[GLOBAL_CONTEXT_COUNT]; 242cdf0e10cSrcweir 243cdf0e10cSrcweir ImageList aEntryImages; 244cdf0e10cSrcweir 245cdf0e10cSrcweir SwWrtShell* pActiveShell; // 246cdf0e10cSrcweir SvLBoxEntry* pEmphasisEntry; // Drag'n Drop-Emphasis 247cdf0e10cSrcweir SvLBoxEntry* pDDSource; // Quelle beim DnD 248cdf0e10cSrcweir SwGlblDocContents* pSwGlblDocContents; // Array mit sortierten Inhalten 249cdf0e10cSrcweir 250cdf0e10cSrcweir Window* pDefParentWin; 251cdf0e10cSrcweir SwGlblDocContent* pDocContent; 252cdf0e10cSrcweir sfx2::DocumentInserter* pDocInserter; 253cdf0e10cSrcweir 254cdf0e10cSrcweir sal_Bool bIsInternalDrag :1; 255cdf0e10cSrcweir sal_Bool bLastEntryEmphasis :1; // Drag'n Drop 256cdf0e10cSrcweir sal_Bool bIsImageListInitialized : 1; 257cdf0e10cSrcweir 258cdf0e10cSrcweir static const SfxObjectShell* pShowShell; 259cdf0e10cSrcweir 260cdf0e10cSrcweir void InsertRegion( const SwGlblDocContent* _pContent, 261cdf0e10cSrcweir const com::sun::star::uno::Sequence< ::rtl::OUString >& _rFiles ); 262cdf0e10cSrcweir 263cdf0e10cSrcweir DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* ); 264cdf0e10cSrcweir 265cdf0e10cSrcweir using SvLBox::DoubleClickHdl; 266cdf0e10cSrcweir using SvLBox::ExecuteDrop; 267cdf0e10cSrcweir using Window::Update; 268cdf0e10cSrcweir 269cdf0e10cSrcweir protected: 270cdf0e10cSrcweir 271cdf0e10cSrcweir virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); 272cdf0e10cSrcweir 273cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); 274cdf0e10cSrcweir 275cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 276cdf0e10cSrcweir 277cdf0e10cSrcweir virtual void RequestHelp( const HelpEvent& rHEvt ); 278cdf0e10cSrcweir 279cdf0e10cSrcweir virtual long GetTabPos( SvLBoxEntry*, SvLBoxTab* ); 280cdf0e10cSrcweir virtual sal_Bool NotifyMoving( SvLBoxEntry* pTarget, 281cdf0e10cSrcweir SvLBoxEntry* pEntry, 282cdf0e10cSrcweir SvLBoxEntry*& rpNewParent, 283cdf0e10cSrcweir sal_uLong& rNewChildPos 284cdf0e10cSrcweir ); 285cdf0e10cSrcweir virtual sal_Bool NotifyCopying( SvLBoxEntry* pTarget, 286cdf0e10cSrcweir SvLBoxEntry* pEntry, 287cdf0e10cSrcweir SvLBoxEntry*& rpNewParent, 288cdf0e10cSrcweir sal_uLong& rNewChildPos 289cdf0e10cSrcweir ); 290cdf0e10cSrcweir 291cdf0e10cSrcweir virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); 292cdf0e10cSrcweir virtual void DragFinished( sal_Int8 ); 293cdf0e10cSrcweir virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData, 294cdf0e10cSrcweir SvLBoxEntry* ); 295cdf0e10cSrcweir virtual sal_Bool NotifyAcceptDrop( SvLBoxEntry* ); 296cdf0e10cSrcweir 297cdf0e10cSrcweir virtual void MouseButtonDown( const MouseEvent& rMEvt ); 298cdf0e10cSrcweir virtual void KeyInput(const KeyEvent& rKEvt); 299cdf0e10cSrcweir virtual void GetFocus(); 300cdf0e10cSrcweir virtual void SelectHdl(); 301cdf0e10cSrcweir virtual void DeselectHdl(); 302cdf0e10cSrcweir virtual void InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&,SvLBoxButtonKind); 303cdf0e10cSrcweir 304cdf0e10cSrcweir void Clear(); 305cdf0e10cSrcweir 306cdf0e10cSrcweir DECL_LINK( PopupHdl, Menu* ); 307cdf0e10cSrcweir DECL_LINK( Timeout, Timer* ); 308cdf0e10cSrcweir DECL_LINK( DoubleClickHdl, SwGlobalTree * ); 309cdf0e10cSrcweir 310cdf0e10cSrcweir sal_Bool IsInternalDrag() const {return bIsInternalDrag != 0;} 311cdf0e10cSrcweir SwNavigationPI* GetParentWindow() 312cdf0e10cSrcweir { return (SwNavigationPI*)Window::GetParent(); } 313cdf0e10cSrcweir 314cdf0e10cSrcweir void OpenDoc(const SwGlblDocContent*); 315cdf0e10cSrcweir void GotoContent(const SwGlblDocContent*); 316cdf0e10cSrcweir sal_uInt16 GetEnableFlags() const; 317cdf0e10cSrcweir 318cdf0e10cSrcweir static const SfxObjectShell* GetShowShell() {return pShowShell;} 319cdf0e10cSrcweir static void SetShowShell(const SfxObjectShell*pSet) {pShowShell = pSet;} 320cdf0e10cSrcweir DECL_STATIC_LINK(SwGlobalTree, ShowFrameHdl, SwGlobalTree*); 321cdf0e10cSrcweir 322cdf0e10cSrcweir virtual PopupMenu* CreateContextMenu( void ); 323cdf0e10cSrcweir virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ); 324cdf0e10cSrcweir 325cdf0e10cSrcweir public: 326cdf0e10cSrcweir SwGlobalTree(Window* pParent, const ResId& rResId); 327cdf0e10cSrcweir virtual ~SwGlobalTree(); 328cdf0e10cSrcweir 329cdf0e10cSrcweir void TbxMenuHdl(sal_uInt16 nTbxId, ToolBox* pBox); 330cdf0e10cSrcweir void InsertRegion( const SwGlblDocContent* pCont, 331cdf0e10cSrcweir const String* pFileName = 0 ); 332cdf0e10cSrcweir void EditContent(const SwGlblDocContent* pCont ); 333cdf0e10cSrcweir 334cdf0e10cSrcweir void ShowTree(); 335cdf0e10cSrcweir void HideTree(); 336cdf0e10cSrcweir 337cdf0e10cSrcweir void ExecCommand(sal_uInt16 nCmd); 338cdf0e10cSrcweir 339cdf0e10cSrcweir void Display(sal_Bool bOnlyUpdateUserData = sal_False); 340cdf0e10cSrcweir 341cdf0e10cSrcweir sal_Bool Update(sal_Bool bHard); 342cdf0e10cSrcweir }; 343cdf0e10cSrcweir 344cdf0e10cSrcweir #endif 345cdf0e10cSrcweir 346