1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SC_CONTENT_HXX 29 #define SC_CONTENT_HXX 30 31 #include <svtools/svtreebx.hxx> 32 #include "global.hxx" 33 #include "address.hxx" 34 #include <tools/solar.h> 35 36 class ScNavigatorDlg; 37 class ScNavigatorSettings; 38 class ScDocument; 39 class ScDocShell; 40 class ScAreaLink; 41 42 #define SC_CONTENT_ROOT 0 43 #define SC_CONTENT_TABLE 1 44 #define SC_CONTENT_RANGENAME 2 45 #define SC_CONTENT_DBAREA 3 46 #define SC_CONTENT_GRAPHIC 4 47 #define SC_CONTENT_OLEOBJECT 5 48 #define SC_CONTENT_NOTE 6 49 #define SC_CONTENT_AREALINK 7 50 #define SC_CONTENT_DRAWING 8 51 #define SC_CONTENT_COUNT 9 52 53 const sal_uLong SC_CONTENT_NOCHILD = ~0UL; 54 55 // 56 // TreeListBox fuer Inhalte 57 // 58 59 class ScContentTree : public SvTreeListBox 60 { 61 ScNavigatorDlg* pParentWindow; 62 ImageList aEntryImages; 63 ImageList aHCEntryImages; 64 SvLBoxEntry* pRootNodes[SC_CONTENT_COUNT]; 65 sal_uInt16 nRootType; // als Root eingestellt 66 String aManualDoc; // im Navigator umgeschaltet (Title) 67 sal_Bool bHiddenDoc; // verstecktes aktiv? 68 String aHiddenName; // URL zum Laden 69 String aHiddenTitle; // fuer Anzeige 70 ScDocument* pHiddenDocument; // temporaer 71 72 sal_uInt16 pPosList[SC_CONTENT_COUNT]; // fuer die Reihenfolge 73 74 static sal_Bool bIsInDrag; // static, falls der Navigator im ExecuteDrag geloescht wird 75 76 ScDocShell* GetManualOrCurrent(); 77 78 void InitRoot(sal_uInt16 nType); 79 void ClearType(sal_uInt16 nType); 80 void ClearAll(); 81 void InsertContent( sal_uInt16 nType, const String& rValue ); 82 void GetDrawNames( sal_uInt16 nType ); 83 84 void GetTableNames(); 85 void GetAreaNames(); 86 void GetDbNames(); 87 void GetLinkNames(); 88 void GetGraphicNames(); 89 void GetOleNames(); 90 void GetDrawingNames(); 91 void GetNoteStrings(); 92 93 static bool IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier ); 94 95 sal_Bool DrawNamesChanged( sal_uInt16 nType ); 96 sal_Bool NoteStringsChanged(); 97 98 ScAddress GetNotePos( sal_uLong nIndex ); 99 const ScAreaLink* GetLink( sal_uLong nIndex ); 100 101 /** Returns the indexes of the specified listbox entry. 102 @param rnRootIndex Root index of specified entry is returned. 103 @param rnChildIndex Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root). 104 @param pEntry The entry to examine. */ 105 void GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvLBoxEntry* pEntry ) const; 106 107 /** Returns the child index of the specified listbox entry. 108 @param pEntry The entry to examine or NULL for the selected entry. 109 @return Index of the entry inside its root or SC_CONTENT_NOCHILD if entry is root. */ 110 sal_uLong GetChildIndex( SvLBoxEntry* pEntry ) const; 111 112 void DoDrag(); 113 //UNUSED2008-05 void AdjustTitle(); 114 115 ScDocument* GetSourceDocument(); 116 117 DECL_LINK( ContentDoubleClickHdl, ScContentTree* ); 118 DECL_STATIC_LINK( ScContentTree, ExecDragHdl, void* ); 119 120 protected: 121 // virtual sal_Bool Drop( const DropEvent& rEvt ); 122 // virtual sal_Bool QueryDrop( DropEvent& rEvt ); 123 124 using SvTreeListBox::ExecuteDrop; 125 126 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); 127 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); 128 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); 129 virtual void DragFinished( sal_Int8 nAction ); 130 131 virtual void Command( const CommandEvent& rCEvt ); 132 virtual void RequestHelp( const HelpEvent& rHEvt ); 133 134 public: 135 ScContentTree( Window* pParent, const ResId& rResId ); 136 ~ScContentTree(); 137 138 virtual void MouseButtonDown( const MouseEvent& rMEvt ); 139 virtual void KeyInput( const KeyEvent& rKEvt ); 140 141 void InitWindowBits( sal_Bool bButtons ); 142 143 void Refresh( sal_uInt16 nType = 0 ); 144 145 void ToggleRoot(); 146 void SetRootType( sal_uInt16 nNew ); 147 sal_uInt16 GetRootType() const { return nRootType; } 148 149 void ActiveDocChanged(); 150 void ResetManualDoc(); 151 void SetManualDoc(const String& rName); 152 sal_Bool LoadFile(const String& rUrl); 153 void SelectDoc(const String& rName); 154 155 const String& GetHiddenTitle() const { return aHiddenTitle; } 156 157 /** Applies the navigator settings to the listbox. */ 158 void ApplySettings(); 159 /** Stores the current listbox state in the navigator settings. */ 160 void StoreSettings() const; 161 162 static sal_Bool IsInDrag() { return bIsInDrag; } 163 }; 164 165 166 167 168 #endif // SC_NAVIPI_HXX 169 170