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