Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef SC_CONTENT_HXX
21 : #define SC_CONTENT_HXX
22 :
23 : #include <svtools/treelistbox.hxx>
24 : #include "global.hxx"
25 : #include "address.hxx"
26 : #include <tools/solar.h>
27 :
28 : class ScNavigatorDlg;
29 : class ScDocument;
30 : class ScDocShell;
31 : class ScAreaLink;
32 :
33 : #define SC_CONTENT_ROOT 0
34 : #define SC_CONTENT_TABLE 1
35 : #define SC_CONTENT_RANGENAME 2
36 : #define SC_CONTENT_DBAREA 3
37 : #define SC_CONTENT_GRAPHIC 4
38 : #define SC_CONTENT_OLEOBJECT 5
39 : #define SC_CONTENT_NOTE 6
40 : #define SC_CONTENT_AREALINK 7
41 : #define SC_CONTENT_DRAWING 8
42 : #define SC_CONTENT_COUNT 9
43 :
44 : const sal_uLong SC_CONTENT_NOCHILD = ~0UL;
45 :
46 : class ScContentTree : public SvTreeListBox
47 : {
48 : ScNavigatorDlg* pParentWindow;
49 : ImageList aEntryImages;
50 : SvTreeListEntry* pRootNodes[SC_CONTENT_COUNT];
51 : sal_uInt16 nRootType; // set as Root
52 : String aManualDoc; // Switched in Navigator (Title)
53 : sal_Bool bHiddenDoc; // Hidden active?
54 : String aHiddenName; // URL to load
55 : String aHiddenTitle; // for display
56 : ScDocument* pHiddenDocument; // temporary
57 :
58 : sal_uInt16 pPosList[SC_CONTENT_COUNT]; // for the sequence
59 :
60 : static sal_Bool bIsInDrag; // static, if the Navigator is deleted in ExecuteDrag
61 :
62 : ScDocShell* GetManualOrCurrent();
63 :
64 : void InitRoot(sal_uInt16 nType);
65 : void ClearType(sal_uInt16 nType);
66 : void ClearAll();
67 : void InsertContent( sal_uInt16 nType, const String& rValue );
68 : void GetDrawNames( sal_uInt16 nType );
69 :
70 : void GetTableNames();
71 : void GetAreaNames();
72 : void GetDbNames();
73 : void GetLinkNames();
74 : void GetGraphicNames();
75 : void GetOleNames();
76 : void GetDrawingNames();
77 : void GetNoteStrings();
78 :
79 : static bool IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier );
80 :
81 : sal_Bool DrawNamesChanged( sal_uInt16 nType );
82 : sal_Bool NoteStringsChanged();
83 :
84 : ScAddress GetNotePos( sal_uLong nIndex );
85 : const ScAreaLink* GetLink( sal_uLong nIndex );
86 :
87 : /** Returns the indexes of the specified listbox entry.
88 : @param rnRootIndex Root index of specified entry is returned.
89 : @param rnChildIndex Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root).
90 : @param pEntry The entry to examine. */
91 : void GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvTreeListEntry* pEntry ) const;
92 :
93 : /** Returns the child index of the specified listbox entry.
94 : @param pEntry The entry to examine or NULL for the selected entry.
95 : @return Index of the entry inside its root or SC_CONTENT_NOCHILD if entry is root. */
96 : sal_uLong GetChildIndex( SvTreeListEntry* pEntry ) const;
97 :
98 : void DoDrag();
99 :
100 : ScDocument* GetSourceDocument();
101 :
102 : DECL_LINK( ContentDoubleClickHdl, void* );
103 : DECL_STATIC_LINK( ScContentTree, ExecDragHdl, void* );
104 :
105 : protected:
106 : // virtual sal_Bool Drop( const DropEvent& rEvt );
107 : // virtual sal_Bool QueryDrop( DropEvent& rEvt );
108 :
109 : using SvTreeListBox::ExecuteDrop;
110 :
111 : virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
112 : virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
113 : virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
114 : virtual void DragFinished( sal_Int8 nAction );
115 :
116 : virtual void Command( const CommandEvent& rCEvt );
117 : virtual void RequestHelp( const HelpEvent& rHEvt );
118 :
119 : public:
120 : ScContentTree( Window* pParent, const ResId& rResId );
121 : ~ScContentTree();
122 :
123 : virtual void MouseButtonDown( const MouseEvent& rMEvt );
124 : virtual void KeyInput( const KeyEvent& rKEvt );
125 :
126 : void InitWindowBits( sal_Bool bButtons );
127 :
128 : void Refresh( sal_uInt16 nType = 0 );
129 :
130 : void ToggleRoot();
131 : void SetRootType( sal_uInt16 nNew );
132 0 : sal_uInt16 GetRootType() const { return nRootType; }
133 :
134 : void ActiveDocChanged();
135 : void ResetManualDoc();
136 : void SetManualDoc(const String& rName);
137 : sal_Bool LoadFile(const String& rUrl);
138 : void SelectDoc(const String& rName);
139 :
140 0 : const String& GetHiddenTitle() const { return aHiddenTitle; }
141 :
142 : /** Applies the navigator settings to the listbox. */
143 : void ApplySettings();
144 : /** Stores the current listbox state in the navigator settings. */
145 : void StoreSettings() const;
146 :
147 : static sal_Bool IsInDrag() { return bIsInDrag; }
148 : };
149 :
150 :
151 :
152 :
153 : #endif // SC_NAVIPI_HXX
154 :
155 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|