xref: /aoo41x/main/sc/source/ui/inc/content.hxx (revision 0deba7fb)
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 //IAccessibility2 Implementation 2009-----
38 class SdrPage;
39 //-----IAccessibility2 Implementation 2009
40 
41 #define SC_CONTENT_ROOT			0
42 #define SC_CONTENT_TABLE		1
43 #define SC_CONTENT_RANGENAME	2
44 #define SC_CONTENT_DBAREA		3
45 #define SC_CONTENT_GRAPHIC		4
46 #define SC_CONTENT_OLEOBJECT	5
47 #define SC_CONTENT_NOTE			6
48 #define SC_CONTENT_AREALINK		7
49 #define SC_CONTENT_DRAWING		8
50 #define SC_CONTENT_COUNT		9
51 
52 const sal_uLong SC_CONTENT_NOCHILD  = ~0UL;
53 
54 //
55 //	TreeListBox fuer Inhalte
56 //
57 
58 class ScContentTree : public SvTreeListBox
59 {
60 	ScNavigatorDlg*		pParentWindow;
61 	ImageList			aEntryImages;
62 	ImageList			aHCEntryImages;
63 	SvLBoxEntry*		pRootNodes[SC_CONTENT_COUNT];
64 	sal_uInt16				nRootType;			// als Root eingestellt
65 	String				aManualDoc;			// im Navigator umgeschaltet (Title)
66 	sal_Bool				bHiddenDoc;			// verstecktes aktiv?
67 	String				aHiddenName;		// URL zum Laden
68 	String				aHiddenTitle;		// fuer Anzeige
69 	ScDocument*			pHiddenDocument;	// temporaer
70 //IAccessibility2 Implementation 2009-----
71     sal_Bool                           bisInNavigatoeDlg;
72 	String 				sKeyString;
73 //-----IAccessibility2 Implementation 2009
74 
75 	sal_uInt16				pPosList[SC_CONTENT_COUNT];		// fuer die Reihenfolge
76 
77 	static sal_Bool	bIsInDrag;		// static, falls der Navigator im ExecuteDrag geloescht wird
78 
79 	ScDocShell* GetManualOrCurrent();
80 
81 	void	InitRoot(sal_uInt16 nType);
82 	void	ClearType(sal_uInt16 nType);
83 	void	ClearAll();
84 	void	InsertContent( sal_uInt16 nType, const String& rValue );
85     void    GetDrawNames( sal_uInt16 nType );
86 
87 	void	GetTableNames();
88 	void	GetAreaNames();
89 	void	GetDbNames();
90 	void	GetLinkNames();
91 	void	GetGraphicNames();
92 	void	GetOleNames();
93 	void	GetDrawingNames();
94 	void	GetNoteStrings();
95 
96     static bool IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier );
97 
98 	sal_Bool	DrawNamesChanged( sal_uInt16 nType );
99 	sal_Bool	NoteStringsChanged();
100 
101 	ScAddress GetNotePos( sal_uLong nIndex );
102 	const ScAreaLink* GetLink( sal_uLong nIndex );
103 
104     /** Returns the indexes of the specified listbox entry.
105         @param rnRootIndex  Root index of specified entry is returned.
106         @param rnChildIndex  Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root).
107         @param pEntry  The entry to examine. */
108     void    GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvLBoxEntry* pEntry ) const;
109 
110     /** Returns the child index of the specified listbox entry.
111         @param pEntry  The entry to examine or NULL for the selected entry.
112         @return  Index of the entry inside its root or SC_CONTENT_NOCHILD if entry is root. */
113     sal_uLong   GetChildIndex( SvLBoxEntry* pEntry ) const;
114 
115 	void	DoDrag();
116 //UNUSED2008-05  void	AdjustTitle();
117 
118 	ScDocument* GetSourceDocument();
119 
120     DECL_LINK( ContentDoubleClickHdl, ScContentTree* );
121 	DECL_STATIC_LINK( ScContentTree, ExecDragHdl, void* );
122 //IAccessibility2 Implementation 2009-----
123 public:
124 	SvLBoxEntry* pTmpEntry;
125 
126 	bool m_bFirstPaint;
127 //-----IAccessibility2 Implementation 2009
128 protected:
129 //	virtual sal_Bool	Drop( const DropEvent& rEvt );
130 //	virtual sal_Bool	QueryDrop( DropEvent& rEvt );
131 
132     using SvTreeListBox::ExecuteDrop;
133 
134 	virtual sal_Int8	AcceptDrop( const AcceptDropEvent& rEvt );
135 	virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
136 	virtual void		StartDrag( sal_Int8 nAction, const Point& rPosPixel );
137 	virtual void		DragFinished( sal_Int8 nAction );
138 
139 	virtual void	Command( const CommandEvent& rCEvt );
140 	virtual void	RequestHelp( const HelpEvent& rHEvt );
141 //IAccessibility2 Implementation 2009-----
142 	virtual void 	InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&, SvLBoxButtonKind);
143 //-----IAccessibility2 Implementation 2009
144 public:
145 			ScContentTree( Window* pParent, const ResId& rResId );
146 			~ScContentTree();
147 
148 //IAccessibility2 Implementation 2009-----
149     String			getAltLongDescText( SvLBoxEntry* pEntry , sal_Bool isAltText) const;
150     String  		GetEntryAltText( SvLBoxEntry* pEntry ) const;
151     String  		GetEntryLongDescription( SvLBoxEntry* pEntry ) const;
152 
153 	void     ObjectFresh( sal_uInt16 nType,SvLBoxEntry* pEntry = NULL);
154 	sal_Bool     SetNavigatorDlgFlag(sal_Bool isInNavigatoeDlg){ return bisInNavigatoeDlg=isInNavigatoeDlg;};
155 //-----IAccessibility2 Implementation 2009
156     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
157     virtual void    KeyInput( const KeyEvent& rKEvt );
158 
159 	void	InitWindowBits( sal_Bool bButtons );
160 
161     void    Refresh( sal_uInt16 nType = 0 );
162 
163 	void	ToggleRoot();
164 	void	SetRootType( sal_uInt16 nNew );
165 	sal_uInt16	GetRootType() const				{ return nRootType; }
166 
167 	void	ActiveDocChanged();
168 	void	ResetManualDoc();
169 	void	SetManualDoc(const String& rName);
170 	sal_Bool	LoadFile(const String& rUrl);
171 	void	SelectDoc(const String& rName);
172 
173 	const String& GetHiddenTitle() const	{ return aHiddenTitle; }
174 
175     /** Applies the navigator settings to the listbox. */
176     void                        ApplySettings();
177     /** Stores the current listbox state in the navigator settings. */
178     void                        StoreSettings() const;
179 
180 	static sal_Bool	IsInDrag()	{ return bIsInDrag; }
181 };
182 
183 
184 
185 
186 #endif // SC_NAVIPI_HXX
187 
188