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 : :
29 : : #ifndef SC_CONTENT_HXX
30 : : #define SC_CONTENT_HXX
31 : :
32 : : #include <svtools/svtreebx.hxx>
33 : : #include "global.hxx"
34 : : #include "address.hxx"
35 : : #include <tools/solar.h>
36 : :
37 : : class ScNavigatorDlg;
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 : : class ScContentTree : public SvTreeListBox
56 : : {
57 : : ScNavigatorDlg* pParentWindow;
58 : : ImageList aEntryImages;
59 : : SvLBoxEntry* pRootNodes[SC_CONTENT_COUNT];
60 : : sal_uInt16 nRootType; // set as Root
61 : : String aManualDoc; // Switched in Navigator (Title)
62 : : sal_Bool bHiddenDoc; // Hidden active?
63 : : String aHiddenName; // URL to load
64 : : String aHiddenTitle; // for display
65 : : ScDocument* pHiddenDocument; // temporary
66 : :
67 : : sal_uInt16 pPosList[SC_CONTENT_COUNT]; // for the sequence
68 : :
69 : : static sal_Bool bIsInDrag; // static, if the Navigator is deleted in ExecuteDrag
70 : :
71 : : ScDocShell* GetManualOrCurrent();
72 : :
73 : : void InitRoot(sal_uInt16 nType);
74 : : void ClearType(sal_uInt16 nType);
75 : : void ClearAll();
76 : : void InsertContent( sal_uInt16 nType, const String& rValue );
77 : : void GetDrawNames( sal_uInt16 nType );
78 : :
79 : : void GetTableNames();
80 : : void GetAreaNames();
81 : : void GetDbNames();
82 : : void GetLinkNames();
83 : : void GetGraphicNames();
84 : : void GetOleNames();
85 : : void GetDrawingNames();
86 : : void GetNoteStrings();
87 : :
88 : : static bool IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier );
89 : :
90 : : sal_Bool DrawNamesChanged( sal_uInt16 nType );
91 : : sal_Bool NoteStringsChanged();
92 : :
93 : : ScAddress GetNotePos( sal_uLong nIndex );
94 : : const ScAreaLink* GetLink( sal_uLong nIndex );
95 : :
96 : : /** Returns the indexes of the specified listbox entry.
97 : : @param rnRootIndex Root index of specified entry is returned.
98 : : @param rnChildIndex Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root).
99 : : @param pEntry The entry to examine. */
100 : : void GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvLBoxEntry* pEntry ) const;
101 : :
102 : : /** Returns the child index of the specified listbox entry.
103 : : @param pEntry The entry to examine or NULL for the selected entry.
104 : : @return Index of the entry inside its root or SC_CONTENT_NOCHILD if entry is root. */
105 : : sal_uLong GetChildIndex( SvLBoxEntry* pEntry ) const;
106 : :
107 : : void DoDrag();
108 : :
109 : : ScDocument* GetSourceDocument();
110 : :
111 : : DECL_LINK( ContentDoubleClickHdl, void* );
112 : : DECL_STATIC_LINK( ScContentTree, ExecDragHdl, void* );
113 : :
114 : : protected:
115 : : // virtual sal_Bool Drop( const DropEvent& rEvt );
116 : : // virtual sal_Bool QueryDrop( DropEvent& rEvt );
117 : :
118 : : using SvTreeListBox::ExecuteDrop;
119 : :
120 : : virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
121 : : virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
122 : : virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
123 : : virtual void DragFinished( sal_Int8 nAction );
124 : :
125 : : virtual void Command( const CommandEvent& rCEvt );
126 : : virtual void RequestHelp( const HelpEvent& rHEvt );
127 : :
128 : : public:
129 : : ScContentTree( Window* pParent, const ResId& rResId );
130 : : ~ScContentTree();
131 : :
132 : : virtual void MouseButtonDown( const MouseEvent& rMEvt );
133 : : virtual void KeyInput( const KeyEvent& rKEvt );
134 : :
135 : : void InitWindowBits( sal_Bool bButtons );
136 : :
137 : : void Refresh( sal_uInt16 nType = 0 );
138 : :
139 : : void ToggleRoot();
140 : : void SetRootType( sal_uInt16 nNew );
141 : 0 : sal_uInt16 GetRootType() const { return nRootType; }
142 : :
143 : : void ActiveDocChanged();
144 : : void ResetManualDoc();
145 : : void SetManualDoc(const String& rName);
146 : : sal_Bool LoadFile(const String& rUrl);
147 : : void SelectDoc(const String& rName);
148 : :
149 : 0 : const String& GetHiddenTitle() const { return aHiddenTitle; }
150 : :
151 : : /** Applies the navigator settings to the listbox. */
152 : : void ApplySettings();
153 : : /** Stores the current listbox state in the navigator settings. */
154 : : void StoreSettings() const;
155 : :
156 : : static sal_Bool IsInDrag() { return bIsInDrag; }
157 : : };
158 : :
159 : :
160 : :
161 : :
162 : : #endif // SC_NAVIPI_HXX
163 : :
164 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|