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 INCLUDED_SC_SOURCE_UI_INC_CONTENT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_CONTENT_HXX
23 #include <svtools/treelistbox.hxx>
25 #include "address.hxx"
26 #include <tools/solar.h>
34 #define SC_CONTENT_ROOT 0
35 #define SC_CONTENT_TABLE 1
36 #define SC_CONTENT_RANGENAME 2
37 #define SC_CONTENT_DBAREA 3
38 #define SC_CONTENT_GRAPHIC 4
39 #define SC_CONTENT_OLEOBJECT 5
40 #define SC_CONTENT_NOTE 6
41 #define SC_CONTENT_AREALINK 7
42 #define SC_CONTENT_DRAWING 8
43 #define SC_CONTENT_COUNT 9
45 const sal_uLong SC_CONTENT_NOCHILD
= ~0UL;
47 class ScContentTree
: public SvTreeListBox
49 VclPtr
<ScNavigatorDlg
> pParentWindow
;
50 ImageList aEntryImages
;
51 SvTreeListEntry
* pRootNodes
[SC_CONTENT_COUNT
];
52 sal_uInt16 nRootType
; // set as Root
53 OUString aManualDoc
; // Switched in Navigator (Title)
54 bool bHiddenDoc
; // Hidden active?
55 OUString aHiddenName
; // URL to load
56 OUString aHiddenTitle
; // for display
57 ScDocument
* pHiddenDocument
; // temporary
58 bool bisInNavigatoeDlg
;
61 sal_uInt16 pPosList
[SC_CONTENT_COUNT
]; // for the sequence
63 static bool bIsInDrag
; // static, if the Navigator is deleted in ExecuteDrag
65 ScDocShell
* GetManualOrCurrent();
67 void InitRoot(sal_uInt16 nType
);
68 void ClearType(sal_uInt16 nType
);
70 void InsertContent( sal_uInt16 nType
, const OUString
& rValue
);
71 void GetDrawNames( sal_uInt16 nType
);
77 void GetGraphicNames();
79 void GetDrawingNames();
80 void GetNoteStrings();
82 static bool IsPartOfType( sal_uInt16 nContentType
, sal_uInt16 nObjIdentifier
);
84 bool DrawNamesChanged( sal_uInt16 nType
);
85 bool NoteStringsChanged();
87 ScAddress
GetNotePos( sal_uLong nIndex
);
88 const ScAreaLink
* GetLink( sal_uLong nIndex
);
90 /** Returns the indexes of the specified listbox entry.
91 @param rnRootIndex Root index of specified entry is returned.
92 @param rnChildIndex Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root).
93 @param pEntry The entry to examine. */
94 void GetEntryIndexes( sal_uInt16
& rnRootIndex
, sal_uLong
& rnChildIndex
, SvTreeListEntry
* pEntry
) const;
96 /** Returns the child index of the specified listbox entry.
97 @param pEntry The entry to examine or NULL for the selected entry.
98 @return Index of the entry inside its root or SC_CONTENT_NOCHILD if entry is root. */
99 sal_uLong
GetChildIndex( SvTreeListEntry
* pEntry
) const;
103 ScDocument
* GetSourceDocument();
105 DECL_LINK( ContentDoubleClickHdl
, void* );
106 DECL_LINK( ExecDragHdl
, void* );
108 SvTreeListEntry
* pTmpEntry
;
113 using SvTreeListBox::ExecuteDrop
;
115 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
) SAL_OVERRIDE
;
116 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
) SAL_OVERRIDE
;
117 virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
) SAL_OVERRIDE
;
118 virtual void DragFinished( sal_Int8 nAction
) SAL_OVERRIDE
;
120 virtual void Command( const CommandEvent
& rCEvt
) SAL_OVERRIDE
;
121 virtual void RequestHelp( const HelpEvent
& rHEvt
) SAL_OVERRIDE
;
122 virtual void InitEntry(SvTreeListEntry
*,const OUString
&,const Image
&,const Image
&, SvLBoxButtonKind
) SAL_OVERRIDE
;
125 ScContentTree( vcl::Window
* pParent
, const ResId
& rResId
);
126 virtual ~ScContentTree();
127 virtual void dispose() SAL_OVERRIDE
;
129 OUString
getAltLongDescText(SvTreeListEntry
* pEntry
, bool isAltText
) const;
130 OUString
GetEntryAltText( SvTreeListEntry
* pEntry
) const SAL_OVERRIDE
;
131 OUString
GetEntryLongDescription( SvTreeListEntry
* pEntry
) const SAL_OVERRIDE
;
133 void ObjectFresh( sal_uInt16 nType
, SvTreeListEntry
* pEntry
= NULL
);
134 bool SetNavigatorDlgFlag(bool isInNavigatoeDlg
){ return bisInNavigatoeDlg
=isInNavigatoeDlg
;};
135 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
136 virtual void KeyInput( const KeyEvent
& rKEvt
) SAL_OVERRIDE
;
138 void InitWindowBits( bool bButtons
);
140 void Refresh( sal_uInt16 nType
= 0 );
143 void SetRootType( sal_uInt16 nNew
);
144 sal_uInt16
GetRootType() const { return nRootType
; }
146 void ActiveDocChanged();
147 void ResetManualDoc();
148 void SetManualDoc(const OUString
& rName
);
149 bool LoadFile(const OUString
& rUrl
);
150 void SelectDoc(const OUString
& rName
);
152 const OUString
& GetHiddenTitle() const { return aHiddenTitle
; }
154 /** Applies the navigator settings to the listbox. */
155 void ApplyNavigatorSettings();
156 /** Stores the current listbox state in the navigator settings. */
157 void StoreNavigatorSettings() const;
159 static bool IsInDrag() { return bIsInDrag
; }
162 #endif // INCLUDED_SC_SOURCE_UI_INC_CONTENT_HXX
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */