1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_CONTENT_HXX
21 #define SC_CONTENT_HXX
23 #include <svtools/treelistbox.hxx>
25 #include "address.hxx"
26 #include <tools/solar.h>
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
44 const sal_uLong SC_CONTENT_NOCHILD
= ~0UL;
46 class ScContentTree
: public SvTreeListBox
48 ScNavigatorDlg
* pParentWindow
;
49 ImageList aEntryImages
;
50 SvTreeListEntry
* pRootNodes
[SC_CONTENT_COUNT
];
51 sal_uInt16 nRootType
; // set as Root
52 OUString aManualDoc
; // Switched in Navigator (Title)
53 sal_Bool bHiddenDoc
; // Hidden active?
54 OUString aHiddenName
; // URL to load
55 OUString aHiddenTitle
; // for display
56 ScDocument
* pHiddenDocument
; // temporary
58 sal_uInt16 pPosList
[SC_CONTENT_COUNT
]; // for the sequence
60 static sal_Bool bIsInDrag
; // static, if the Navigator is deleted in ExecuteDrag
62 ScDocShell
* GetManualOrCurrent();
64 void InitRoot(sal_uInt16 nType
);
65 void ClearType(sal_uInt16 nType
);
67 void InsertContent( sal_uInt16 nType
, const OUString
& rValue
);
68 void GetDrawNames( sal_uInt16 nType
);
74 void GetGraphicNames();
76 void GetDrawingNames();
77 void GetNoteStrings();
79 static bool IsPartOfType( sal_uInt16 nContentType
, sal_uInt16 nObjIdentifier
);
81 sal_Bool
DrawNamesChanged( sal_uInt16 nType
);
82 sal_Bool
NoteStringsChanged();
84 ScAddress
GetNotePos( sal_uLong nIndex
);
85 const ScAreaLink
* GetLink( sal_uLong nIndex
);
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;
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;
100 ScDocument
* GetSourceDocument();
102 DECL_LINK( ContentDoubleClickHdl
, void* );
103 DECL_STATIC_LINK( ScContentTree
, ExecDragHdl
, void* );
106 // virtual sal_Bool Drop( const DropEvent& rEvt );
107 // virtual sal_Bool QueryDrop( DropEvent& rEvt );
109 using SvTreeListBox::ExecuteDrop
;
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
);
116 virtual void Command( const CommandEvent
& rCEvt
);
117 virtual void RequestHelp( const HelpEvent
& rHEvt
);
120 ScContentTree( Window
* pParent
, const ResId
& rResId
);
123 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
124 virtual void KeyInput( const KeyEvent
& rKEvt
);
126 void InitWindowBits( sal_Bool bButtons
);
128 void Refresh( sal_uInt16 nType
= 0 );
131 void SetRootType( sal_uInt16 nNew
);
132 sal_uInt16
GetRootType() const { return nRootType
; }
134 void ActiveDocChanged();
135 void ResetManualDoc();
136 void SetManualDoc(const OUString
& rName
);
137 sal_Bool
LoadFile(const OUString
& rUrl
);
138 void SelectDoc(const OUString
& rName
);
140 const OUString
& GetHiddenTitle() const { return aHiddenTitle
; }
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;
147 static sal_Bool
IsInDrag() { return bIsInDrag
; }
153 #endif // SC_NAVIPI_HXX
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */