xref: /aoo42x/main/sc/source/ui/inc/content.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef SC_CONTENT_HXX
29*cdf0e10cSrcweir #define SC_CONTENT_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <svtools/svtreebx.hxx>
32*cdf0e10cSrcweir #include "global.hxx"
33*cdf0e10cSrcweir #include "address.hxx"
34*cdf0e10cSrcweir #include <tools/solar.h>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir class ScNavigatorDlg;
37*cdf0e10cSrcweir class ScNavigatorSettings;
38*cdf0e10cSrcweir class ScDocument;
39*cdf0e10cSrcweir class ScDocShell;
40*cdf0e10cSrcweir class ScAreaLink;
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #define SC_CONTENT_ROOT			0
43*cdf0e10cSrcweir #define SC_CONTENT_TABLE		1
44*cdf0e10cSrcweir #define SC_CONTENT_RANGENAME	2
45*cdf0e10cSrcweir #define SC_CONTENT_DBAREA		3
46*cdf0e10cSrcweir #define SC_CONTENT_GRAPHIC		4
47*cdf0e10cSrcweir #define SC_CONTENT_OLEOBJECT	5
48*cdf0e10cSrcweir #define SC_CONTENT_NOTE			6
49*cdf0e10cSrcweir #define SC_CONTENT_AREALINK		7
50*cdf0e10cSrcweir #define SC_CONTENT_DRAWING		8
51*cdf0e10cSrcweir #define SC_CONTENT_COUNT		9
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir const sal_uLong SC_CONTENT_NOCHILD  = ~0UL;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir //
56*cdf0e10cSrcweir //	TreeListBox fuer Inhalte
57*cdf0e10cSrcweir //
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir class ScContentTree : public SvTreeListBox
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir 	ScNavigatorDlg*		pParentWindow;
62*cdf0e10cSrcweir 	ImageList			aEntryImages;
63*cdf0e10cSrcweir 	ImageList			aHCEntryImages;
64*cdf0e10cSrcweir 	SvLBoxEntry*		pRootNodes[SC_CONTENT_COUNT];
65*cdf0e10cSrcweir 	sal_uInt16				nRootType;			// als Root eingestellt
66*cdf0e10cSrcweir 	String				aManualDoc;			// im Navigator umgeschaltet (Title)
67*cdf0e10cSrcweir 	sal_Bool				bHiddenDoc;			// verstecktes aktiv?
68*cdf0e10cSrcweir 	String				aHiddenName;		// URL zum Laden
69*cdf0e10cSrcweir 	String				aHiddenTitle;		// fuer Anzeige
70*cdf0e10cSrcweir 	ScDocument*			pHiddenDocument;	// temporaer
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir 	sal_uInt16				pPosList[SC_CONTENT_COUNT];		// fuer die Reihenfolge
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir 	static sal_Bool	bIsInDrag;		// static, falls der Navigator im ExecuteDrag geloescht wird
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir 	ScDocShell* GetManualOrCurrent();
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 	void	InitRoot(sal_uInt16 nType);
79*cdf0e10cSrcweir 	void	ClearType(sal_uInt16 nType);
80*cdf0e10cSrcweir 	void	ClearAll();
81*cdf0e10cSrcweir 	void	InsertContent( sal_uInt16 nType, const String& rValue );
82*cdf0e10cSrcweir     void    GetDrawNames( sal_uInt16 nType );
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir 	void	GetTableNames();
85*cdf0e10cSrcweir 	void	GetAreaNames();
86*cdf0e10cSrcweir 	void	GetDbNames();
87*cdf0e10cSrcweir 	void	GetLinkNames();
88*cdf0e10cSrcweir 	void	GetGraphicNames();
89*cdf0e10cSrcweir 	void	GetOleNames();
90*cdf0e10cSrcweir 	void	GetDrawingNames();
91*cdf0e10cSrcweir 	void	GetNoteStrings();
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir     static bool IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier );
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir 	sal_Bool	DrawNamesChanged( sal_uInt16 nType );
96*cdf0e10cSrcweir 	sal_Bool	NoteStringsChanged();
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir 	ScAddress GetNotePos( sal_uLong nIndex );
99*cdf0e10cSrcweir 	const ScAreaLink* GetLink( sal_uLong nIndex );
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir     /** Returns the indexes of the specified listbox entry.
102*cdf0e10cSrcweir         @param rnRootIndex  Root index of specified entry is returned.
103*cdf0e10cSrcweir         @param rnChildIndex  Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root).
104*cdf0e10cSrcweir         @param pEntry  The entry to examine. */
105*cdf0e10cSrcweir     void    GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvLBoxEntry* pEntry ) const;
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     /** Returns the child index of the specified listbox entry.
108*cdf0e10cSrcweir         @param pEntry  The entry to examine or NULL for the selected entry.
109*cdf0e10cSrcweir         @return  Index of the entry inside its root or SC_CONTENT_NOCHILD if entry is root. */
110*cdf0e10cSrcweir     sal_uLong   GetChildIndex( SvLBoxEntry* pEntry ) const;
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	void	DoDrag();
113*cdf0e10cSrcweir //UNUSED2008-05  void	AdjustTitle();
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 	ScDocument* GetSourceDocument();
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir     DECL_LINK( ContentDoubleClickHdl, ScContentTree* );
118*cdf0e10cSrcweir 	DECL_STATIC_LINK( ScContentTree, ExecDragHdl, void* );
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir protected:
121*cdf0e10cSrcweir //	virtual sal_Bool	Drop( const DropEvent& rEvt );
122*cdf0e10cSrcweir //	virtual sal_Bool	QueryDrop( DropEvent& rEvt );
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     using SvTreeListBox::ExecuteDrop;
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 	virtual sal_Int8	AcceptDrop( const AcceptDropEvent& rEvt );
127*cdf0e10cSrcweir 	virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
128*cdf0e10cSrcweir 	virtual void		StartDrag( sal_Int8 nAction, const Point& rPosPixel );
129*cdf0e10cSrcweir 	virtual void		DragFinished( sal_Int8 nAction );
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir 	virtual void	Command( const CommandEvent& rCEvt );
132*cdf0e10cSrcweir 	virtual void	RequestHelp( const HelpEvent& rHEvt );
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir public:
135*cdf0e10cSrcweir 			ScContentTree( Window* pParent, const ResId& rResId );
136*cdf0e10cSrcweir 			~ScContentTree();
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
139*cdf0e10cSrcweir     virtual void    KeyInput( const KeyEvent& rKEvt );
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 	void	InitWindowBits( sal_Bool bButtons );
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir     void    Refresh( sal_uInt16 nType = 0 );
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 	void	ToggleRoot();
146*cdf0e10cSrcweir 	void	SetRootType( sal_uInt16 nNew );
147*cdf0e10cSrcweir 	sal_uInt16	GetRootType() const				{ return nRootType; }
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 	void	ActiveDocChanged();
150*cdf0e10cSrcweir 	void	ResetManualDoc();
151*cdf0e10cSrcweir 	void	SetManualDoc(const String& rName);
152*cdf0e10cSrcweir 	sal_Bool	LoadFile(const String& rUrl);
153*cdf0e10cSrcweir 	void	SelectDoc(const String& rName);
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 	const String& GetHiddenTitle() const	{ return aHiddenTitle; }
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir     /** Applies the navigator settings to the listbox. */
158*cdf0e10cSrcweir     void                        ApplySettings();
159*cdf0e10cSrcweir     /** Stores the current listbox state in the navigator settings. */
160*cdf0e10cSrcweir     void                        StoreSettings() const;
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 	static sal_Bool	IsInDrag()	{ return bIsInDrag; }
163*cdf0e10cSrcweir };
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir #endif // SC_NAVIPI_HXX
169*cdf0e10cSrcweir 
170