xref: /aoo4110/main/sc/source/ui/inc/content.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_CONTENT_HXX
25 #define SC_CONTENT_HXX
26 
27 #include <svtools/svtreebx.hxx>
28 #include "global.hxx"
29 #include "address.hxx"
30 #include <tools/solar.h>
31 
32 class ScNavigatorDlg;
33 class ScNavigatorSettings;
34 class ScDocument;
35 class ScDocShell;
36 class ScAreaLink;
37 class SdrPage;
38 
39 #define SC_CONTENT_ROOT			0
40 #define SC_CONTENT_TABLE		1
41 #define SC_CONTENT_RANGENAME	2
42 #define SC_CONTENT_DBAREA		3
43 #define SC_CONTENT_GRAPHIC		4
44 #define SC_CONTENT_OLEOBJECT	5
45 #define SC_CONTENT_NOTE			6
46 #define SC_CONTENT_AREALINK		7
47 #define SC_CONTENT_DRAWING		8
48 #define SC_CONTENT_COUNT		9
49 
50 const sal_uLong SC_CONTENT_NOCHILD  = ~0UL;
51 
52 //
53 //	TreeListBox fuer Inhalte
54 //
55 
56 class ScContentTree : public SvTreeListBox
57 {
58 	ScNavigatorDlg*		pParentWindow;
59 	ImageList			aEntryImages;
60 	ImageList			aHCEntryImages;
61 	SvLBoxEntry*		pRootNodes[SC_CONTENT_COUNT];
62 	sal_uInt16				nRootType;			// als Root eingestellt
63 	String				aManualDoc;			// im Navigator umgeschaltet (Title)
64 	sal_Bool				bHiddenDoc;			// verstecktes aktiv?
65 	String				aHiddenName;		// URL zum Laden
66 	String				aHiddenTitle;		// fuer Anzeige
67 	ScDocument*			pHiddenDocument;	// temporaer
68     sal_Bool                           bisInNavigatoeDlg;
69 	String 				sKeyString;
70 
71 	sal_uInt16				pPosList[SC_CONTENT_COUNT];		// fuer die Reihenfolge
72 
73 	static sal_Bool	bIsInDrag;		// static, falls der Navigator im ExecuteDrag geloescht wird
74 
75 	ScDocShell* GetManualOrCurrent();
76 
77 	void	InitRoot(sal_uInt16 nType);
78 	void	ClearType(sal_uInt16 nType);
79 	void	ClearAll();
80 	void	InsertContent( sal_uInt16 nType, const String& rValue );
81     void    GetDrawNames( sal_uInt16 nType );
82 
83 	void	GetTableNames();
84 	void	GetAreaNames();
85 	void	GetDbNames();
86 	void	GetLinkNames();
87 	void	GetGraphicNames();
88 	void	GetOleNames();
89 	void	GetDrawingNames();
90 	void	GetNoteStrings();
91 
92     static bool IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier );
93 
94 	sal_Bool	DrawNamesChanged( sal_uInt16 nType );
95 	sal_Bool	NoteStringsChanged();
96 
97 	ScAddress GetNotePos( sal_uLong nIndex );
98 	const ScAreaLink* GetLink( sal_uLong nIndex );
99 
100     /** Returns the indexes of the specified listbox entry.
101         @param rnRootIndex  Root index of specified entry is returned.
102         @param rnChildIndex  Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root).
103         @param pEntry  The entry to examine. */
104     void    GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvLBoxEntry* pEntry ) const;
105 
106     /** Returns the child index of the specified listbox entry.
107         @param pEntry  The entry to examine or NULL for the selected entry.
108         @return  Index of the entry inside its root or SC_CONTENT_NOCHILD if entry is root. */
109     sal_uLong   GetChildIndex( SvLBoxEntry* pEntry ) const;
110 
111 	void	DoDrag();
112 //UNUSED2008-05  void	AdjustTitle();
113 
114 	ScDocument* GetSourceDocument();
115 
116     DECL_LINK( ContentDoubleClickHdl, ScContentTree* );
117 	DECL_STATIC_LINK( ScContentTree, ExecDragHdl, void* );
118 public:
119 	SvLBoxEntry* pTmpEntry;
120 
121 	bool m_bFirstPaint;
122 protected:
123 //	virtual sal_Bool	Drop( const DropEvent& rEvt );
124 //	virtual sal_Bool	QueryDrop( DropEvent& rEvt );
125 
126     using SvTreeListBox::ExecuteDrop;
127 
128 	virtual sal_Int8	AcceptDrop( const AcceptDropEvent& rEvt );
129 	virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
130 	virtual void		StartDrag( sal_Int8 nAction, const Point& rPosPixel );
131 	virtual void		DragFinished( sal_Int8 nAction );
132 
133 	virtual void	Command( const CommandEvent& rCEvt );
134 	virtual void	RequestHelp( const HelpEvent& rHEvt );
135 	virtual void 	InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&, SvLBoxButtonKind);
136 public:
137 			ScContentTree( Window* pParent, const ResId& rResId );
138 			~ScContentTree();
139 
140     String			getAltLongDescText( SvLBoxEntry* pEntry , sal_Bool isAltText) const;
141     String  		GetEntryAltText( SvLBoxEntry* pEntry ) const;
142     String  		GetEntryLongDescription( SvLBoxEntry* pEntry ) const;
143 
144 	void     ObjectFresh( sal_uInt16 nType,SvLBoxEntry* pEntry = NULL);
SetNavigatorDlgFlag(sal_Bool isInNavigatoeDlg)145 	sal_Bool     SetNavigatorDlgFlag(sal_Bool isInNavigatoeDlg){ return bisInNavigatoeDlg=isInNavigatoeDlg;};
146     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
147     virtual void    KeyInput( const KeyEvent& rKEvt );
148 
149 	void	InitWindowBits( sal_Bool bButtons );
150 
151     void    Refresh( sal_uInt16 nType = 0 );
152 
153 	void	ToggleRoot();
154 	void	SetRootType( sal_uInt16 nNew );
GetRootType() const155 	sal_uInt16	GetRootType() const				{ return nRootType; }
156 
157 	void	ActiveDocChanged();
158 	void	ResetManualDoc();
159 	void	SetManualDoc(const String& rName);
160 	sal_Bool	LoadFile(const String& rUrl);
161 	void	SelectDoc(const String& rName);
162 
GetHiddenTitle() const163 	const String& GetHiddenTitle() const	{ return aHiddenTitle; }
164 
165     /** Applies the navigator settings to the listbox. */
166     void                        ApplySettings();
167     /** Stores the current listbox state in the navigator settings. */
168     void                        StoreSettings() const;
169 
IsInDrag()170 	static sal_Bool	IsInDrag()	{ return bIsInDrag; }
171 };
172 
173 
174 
175 
176 #endif // SC_NAVIPI_HXX
177 
178