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 INCLUDED_SC_SOURCE_UI_INC_CONTENT_HXX
21 : #define INCLUDED_SC_SOURCE_UI_INC_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 : class SdrPage;
33 :
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
44 :
45 : const sal_uLong SC_CONTENT_NOCHILD = ~0UL;
46 :
47 : class ScContentTree : public SvTreeListBox
48 : {
49 : 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;
59 : OUString sKeyString;
60 :
61 : sal_uInt16 pPosList[SC_CONTENT_COUNT]; // for the sequence
62 :
63 : static bool bIsInDrag; // static, if the Navigator is deleted in ExecuteDrag
64 :
65 : ScDocShell* GetManualOrCurrent();
66 :
67 : void InitRoot(sal_uInt16 nType);
68 : void ClearType(sal_uInt16 nType);
69 : void ClearAll();
70 : void InsertContent( sal_uInt16 nType, const OUString& rValue );
71 : void GetDrawNames( sal_uInt16 nType );
72 :
73 : void GetTableNames();
74 : void GetAreaNames();
75 : void GetDbNames();
76 : void GetLinkNames();
77 : void GetGraphicNames();
78 : void GetOleNames();
79 : void GetDrawingNames();
80 : void GetNoteStrings();
81 :
82 : static bool IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier );
83 :
84 : bool DrawNamesChanged( sal_uInt16 nType );
85 : bool NoteStringsChanged();
86 :
87 : ScAddress GetNotePos( sal_uLong nIndex );
88 : const ScAreaLink* GetLink( sal_uLong nIndex );
89 :
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;
95 :
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;
100 :
101 : void DoDrag();
102 :
103 : ScDocument* GetSourceDocument();
104 :
105 : DECL_LINK( ContentDoubleClickHdl, void* );
106 : DECL_STATIC_LINK( ScContentTree, ExecDragHdl, void* );
107 : public:
108 : SvTreeListEntry* pTmpEntry;
109 : bool m_bFirstPaint;
110 :
111 : protected:
112 :
113 : using SvTreeListBox::ExecuteDrop;
114 :
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;
119 :
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;
123 :
124 : public:
125 : ScContentTree( vcl::Window* pParent, const ResId& rResId );
126 : virtual ~ScContentTree();
127 :
128 : OUString getAltLongDescText(SvTreeListEntry* pEntry, bool isAltText) const;
129 : OUString GetEntryAltText( SvTreeListEntry* pEntry ) const SAL_OVERRIDE;
130 : OUString GetEntryLongDescription( SvTreeListEntry* pEntry ) const SAL_OVERRIDE;
131 :
132 : void ObjectFresh( sal_uInt16 nType, SvTreeListEntry* pEntry = NULL);
133 0 : bool SetNavigatorDlgFlag(bool isInNavigatoeDlg){ return bisInNavigatoeDlg=isInNavigatoeDlg;};
134 : virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
135 : virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
136 :
137 : void InitWindowBits( bool bButtons );
138 :
139 : void Refresh( sal_uInt16 nType = 0 );
140 :
141 : void ToggleRoot();
142 : void SetRootType( sal_uInt16 nNew );
143 0 : sal_uInt16 GetRootType() const { return nRootType; }
144 :
145 : void ActiveDocChanged();
146 : void ResetManualDoc();
147 : void SetManualDoc(const OUString& rName);
148 : bool LoadFile(const OUString& rUrl);
149 : void SelectDoc(const OUString& rName);
150 :
151 0 : const OUString& GetHiddenTitle() const { return aHiddenTitle; }
152 :
153 : /** Applies the navigator settings to the listbox. */
154 : void ApplySettings();
155 : /** Stores the current listbox state in the navigator settings. */
156 : void StoreSettings() const;
157 :
158 : static bool IsInDrag() { return bIsInDrag; }
159 : };
160 :
161 : #endif // INCLUDED_SC_SOURCE_UI_INC_CONTENT_HXX
162 :
163 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|