xref: /aoo41x/main/sc/source/ui/view/gridwin5.cxx (revision 3ea0c3d5)
1b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3b3f79822SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4b3f79822SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5b3f79822SAndrew Rist  * distributed with this work for additional information
6b3f79822SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7b3f79822SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8b3f79822SAndrew Rist  * "License"); you may not use this file except in compliance
9b3f79822SAndrew Rist  * with the License.  You may obtain a copy of the License at
10b3f79822SAndrew Rist  *
11b3f79822SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12b3f79822SAndrew Rist  *
13b3f79822SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14b3f79822SAndrew Rist  * software distributed under the License is distributed on an
15b3f79822SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b3f79822SAndrew Rist  * KIND, either express or implied.  See the License for the
17b3f79822SAndrew Rist  * specific language governing permissions and limitations
18b3f79822SAndrew Rist  * under the License.
19b3f79822SAndrew Rist  *
20b3f79822SAndrew Rist  *************************************************************/
21b3f79822SAndrew Rist 
22b3f79822SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // INCLUDE ---------------------------------------------------------------
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <editeng/eeitem.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <editeng/flditem.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <editeng/editview.hxx>
34cdf0e10cSrcweir #include <svx/svdobj.hxx>
35cdf0e10cSrcweir #include <svx/svdpagv.hxx>
36cdf0e10cSrcweir #include <svtools/imapobj.hxx>
37cdf0e10cSrcweir #include <vcl/cursor.hxx>
38cdf0e10cSrcweir #include <vcl/help.hxx>
39cdf0e10cSrcweir #include <tools/urlobj.hxx>
40cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <unotools/localedatawrapper.hxx>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #include "viewuno.hxx"
45cdf0e10cSrcweir #include "AccessibleDocument.hxx"
46cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #include "gridwin.hxx"
49cdf0e10cSrcweir #include "viewdata.hxx"
50cdf0e10cSrcweir #include "drawview.hxx"
51cdf0e10cSrcweir #include "drwlayer.hxx"
52cdf0e10cSrcweir #include "drawpage.hxx"
53cdf0e10cSrcweir #include "document.hxx"
54cdf0e10cSrcweir #include "notemark.hxx"
55cdf0e10cSrcweir #include "chgtrack.hxx"
56cdf0e10cSrcweir #include "chgviset.hxx"
57cdf0e10cSrcweir #include "dbfunc.hxx"
58cdf0e10cSrcweir #include "tabvwsh.hxx"
59cdf0e10cSrcweir #include "userdat.hxx"
60cdf0e10cSrcweir #include "postit.hxx"
61*0deba7fbSSteve Yin #include <vcl/svapp.hxx>
62cdf0e10cSrcweir 
63cdf0e10cSrcweir // -----------------------------------------------------------------------
64cdf0e10cSrcweir 
65cdf0e10cSrcweir ScHideTextCursor::ScHideTextCursor( ScViewData* pData, ScSplitPos eW ) :
66cdf0e10cSrcweir 	pViewData(pData),
67cdf0e10cSrcweir 	eWhich(eW)
68cdf0e10cSrcweir {
69cdf0e10cSrcweir 	Window* pWin = pViewData->GetView()->GetWindowByPos( eWhich );
70cdf0e10cSrcweir 	if (pWin)
71cdf0e10cSrcweir 	{
72cdf0e10cSrcweir 		Cursor* pCur = pWin->GetCursor();
73cdf0e10cSrcweir 		if ( pCur && pCur->IsVisible() )
74cdf0e10cSrcweir 			pCur->Hide();
75cdf0e10cSrcweir 	}
76cdf0e10cSrcweir }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir ScHideTextCursor::~ScHideTextCursor()
79cdf0e10cSrcweir {
80cdf0e10cSrcweir 	Window* pWin = pViewData->GetView()->GetWindowByPos( eWhich );
81cdf0e10cSrcweir 	if (pWin)
82cdf0e10cSrcweir 	{
83cdf0e10cSrcweir 		//	restore text cursor
84cdf0e10cSrcweir 		if ( pViewData->HasEditView(eWhich) && pWin->HasFocus() )
85cdf0e10cSrcweir 			pViewData->GetEditView(eWhich)->ShowCursor( sal_False, sal_True );
86cdf0e10cSrcweir 	}
87cdf0e10cSrcweir }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir // -----------------------------------------------------------------------
90cdf0e10cSrcweir 
91cdf0e10cSrcweir sal_Bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, sal_Bool bKeyboard )
92cdf0e10cSrcweir {
93cdf0e10cSrcweir 	sal_Bool bDone = sal_False;
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	ScDocument* pDoc = pViewData->GetDocument();
96cdf0e10cSrcweir 	SCTAB		nTab = pViewData->GetTabNo();
97cdf0e10cSrcweir 	ScAddress	aCellPos( nPosX, nPosY, nTab );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	String aTrackText;
100cdf0e10cSrcweir 	sal_Bool bLeftEdge = sal_False;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	//	Change-Tracking
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	ScChangeTrack* pTrack = pDoc->GetChangeTrack();
105cdf0e10cSrcweir 	ScChangeViewSettings* pSettings = pDoc->GetChangeViewSettings();
106cdf0e10cSrcweir 	if ( pTrack && pTrack->GetFirst() && pSettings && pSettings->ShowChanges())
107cdf0e10cSrcweir 	{
108cdf0e10cSrcweir 		const ScChangeAction* pFound = NULL;
109cdf0e10cSrcweir 		const ScChangeAction* pFoundContent = NULL;
110cdf0e10cSrcweir 		const ScChangeAction* pFoundMove = NULL;
111cdf0e10cSrcweir 		long nModified = 0;
112cdf0e10cSrcweir 		const ScChangeAction* pAction = pTrack->GetFirst();
113cdf0e10cSrcweir 		while (pAction)
114cdf0e10cSrcweir 		{
115cdf0e10cSrcweir 			if ( pAction->IsVisible() &&
116cdf0e10cSrcweir 				 ScViewUtil::IsActionShown( *pAction, *pSettings, *pDoc ) )
117cdf0e10cSrcweir 			{
118cdf0e10cSrcweir 				ScChangeActionType eType = pAction->GetType();
119cdf0e10cSrcweir 				const ScBigRange& rBig = pAction->GetBigRange();
120cdf0e10cSrcweir 				if ( rBig.aStart.Tab() == nTab )
121cdf0e10cSrcweir 				{
122cdf0e10cSrcweir 					ScRange aRange = rBig.MakeRange();
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 					if ( eType == SC_CAT_DELETE_ROWS )
125cdf0e10cSrcweir 						aRange.aEnd.SetRow( aRange.aStart.Row() );
126cdf0e10cSrcweir 					else if ( eType == SC_CAT_DELETE_COLS )
127cdf0e10cSrcweir 						aRange.aEnd.SetCol( aRange.aStart.Col() );
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 					if ( aRange.In( aCellPos ) )
130cdf0e10cSrcweir 					{
131cdf0e10cSrcweir 						pFound = pAction;		// der letzte gewinnt
132cdf0e10cSrcweir 						switch ( eType )
133cdf0e10cSrcweir 						{
134cdf0e10cSrcweir 							case SC_CAT_CONTENT :
135cdf0e10cSrcweir 								pFoundContent = pAction;
136cdf0e10cSrcweir 							break;
137cdf0e10cSrcweir 							case SC_CAT_MOVE :
138cdf0e10cSrcweir 								pFoundMove = pAction;
139cdf0e10cSrcweir 							break;
140cdf0e10cSrcweir                             default:
141cdf0e10cSrcweir                             {
142cdf0e10cSrcweir                                 // added to avoid warnings
143cdf0e10cSrcweir                             }
144cdf0e10cSrcweir 						}
145cdf0e10cSrcweir 						++nModified;
146cdf0e10cSrcweir 					}
147cdf0e10cSrcweir 				}
148cdf0e10cSrcweir 				if ( eType == SC_CAT_MOVE )
149cdf0e10cSrcweir 				{
150cdf0e10cSrcweir 					ScRange aRange =
151cdf0e10cSrcweir 						((const ScChangeActionMove*)pAction)->
152cdf0e10cSrcweir 						GetFromRange().MakeRange();
153cdf0e10cSrcweir 					if ( aRange.In( aCellPos ) )
154cdf0e10cSrcweir 					{
155cdf0e10cSrcweir 						pFound = pAction;
156cdf0e10cSrcweir 						++nModified;
157cdf0e10cSrcweir 					}
158cdf0e10cSrcweir 				}
159cdf0e10cSrcweir 			}
160cdf0e10cSrcweir 			pAction = pAction->GetNext();
161cdf0e10cSrcweir 		}
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 		if ( pFound )
164cdf0e10cSrcweir 		{
165cdf0e10cSrcweir 			if ( pFoundContent && pFound->GetType() != SC_CAT_CONTENT )
166cdf0e10cSrcweir 				pFound = pFoundContent;		// Content gewinnt
167cdf0e10cSrcweir 			if ( pFoundMove && pFound->GetType() != SC_CAT_MOVE &&
168cdf0e10cSrcweir 					pFoundMove->GetActionNumber() >
169cdf0e10cSrcweir 					pFound->GetActionNumber() )
170cdf0e10cSrcweir 				pFound = pFoundMove;		// Move gewinnt
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 			//	bei geloeschten Spalten: Pfeil auf die linke Seite der Zelle
173cdf0e10cSrcweir 			if ( pFound->GetType() == SC_CAT_DELETE_COLS )
174cdf0e10cSrcweir 				bLeftEdge = sal_True;
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 			DateTime aDT = pFound->GetDateTime();
177cdf0e10cSrcweir 			aTrackText  = pFound->GetUser();
178cdf0e10cSrcweir 			aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ", " ));
179cdf0e10cSrcweir             aTrackText += ScGlobal::pLocaleData->getDate(aDT);
180cdf0e10cSrcweir 			aTrackText += ' ';
181cdf0e10cSrcweir             aTrackText += ScGlobal::pLocaleData->getTime(aDT);
182cdf0e10cSrcweir 			aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ":\n" ));
183cdf0e10cSrcweir 			String aComStr=pFound->GetComment();
184cdf0e10cSrcweir 			if(aComStr.Len()>0)
185cdf0e10cSrcweir 			{
186cdf0e10cSrcweir 				aTrackText += aComStr;
187cdf0e10cSrcweir 				aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "\n( " ));
188cdf0e10cSrcweir 			}
189cdf0e10cSrcweir 			pFound->GetDescription( aTrackText, pDoc );
190cdf0e10cSrcweir 			if(aComStr.Len()>0)
191cdf0e10cSrcweir 			{
192cdf0e10cSrcweir 				aTrackText +=')';
193cdf0e10cSrcweir 			}
194cdf0e10cSrcweir 		}
195cdf0e10cSrcweir 	}
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	//	Notiz nur, wenn sie nicht schon auf dem Drawing-Layer angezeigt wird:
198cdf0e10cSrcweir 	const ScPostIt* pNote = pDoc->GetNote( aCellPos );
199cdf0e10cSrcweir 	if ( (aTrackText.Len() > 0) || (pNote && !pNote->IsCaptionShown()) )
200cdf0e10cSrcweir 	{
201cdf0e10cSrcweir 		sal_Bool bNew = sal_True;
202cdf0e10cSrcweir 		sal_Bool bFast = sal_False;
203cdf0e10cSrcweir 		if ( pNoteMarker )			// schon eine Notiz angezeigt
204cdf0e10cSrcweir 		{
205cdf0e10cSrcweir 			if ( pNoteMarker->GetDocPos() == aCellPos )	// dieselbe
206cdf0e10cSrcweir 				bNew = sal_False;							// dann stehenlassen
207cdf0e10cSrcweir 			else
208cdf0e10cSrcweir 				bFast = sal_True;							// sonst sofort
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 			//	marker which was shown for ctrl-F1 isn't removed by mouse events
211cdf0e10cSrcweir 			if ( pNoteMarker->IsByKeyboard() && !bKeyboard )
212cdf0e10cSrcweir 				bNew = sal_False;
213cdf0e10cSrcweir 		}
214cdf0e10cSrcweir 		if ( bNew )
215cdf0e10cSrcweir 		{
216cdf0e10cSrcweir 			if ( bKeyboard )
217cdf0e10cSrcweir 				bFast = sal_True;			// keyboard also shows the marker immediately
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 			delete pNoteMarker;
220cdf0e10cSrcweir 
221cdf0e10cSrcweir             bool bHSplit = pViewData->GetHSplitMode() != SC_SPLIT_NONE;
222cdf0e10cSrcweir             bool bVSplit = pViewData->GetVSplitMode() != SC_SPLIT_NONE;
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 			Window* pLeft = pViewData->GetView()->GetWindowByPos( bVSplit ? SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT );
225cdf0e10cSrcweir 			Window* pRight = bHSplit ? pViewData->GetView()->GetWindowByPos( bVSplit ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT ) : 0;
226cdf0e10cSrcweir 			Window* pBottom = bVSplit ? pViewData->GetView()->GetWindowByPos( SC_SPLIT_BOTTOMLEFT ) : 0;
227cdf0e10cSrcweir 			Window* pDiagonal = (bHSplit && bVSplit) ? pViewData->GetView()->GetWindowByPos( SC_SPLIT_BOTTOMRIGHT ) : 0;
228cdf0e10cSrcweir             DBG_ASSERT( pLeft, "ScGridWindow::ShowNoteMarker - missing top-left grid window" );
229cdf0e10cSrcweir 
230cdf0e10cSrcweir             /*  If caption is shown from right or bottom windows, adjust
231cdf0e10cSrcweir                 mapmode to include size of top-left window. */
232cdf0e10cSrcweir             MapMode aMapMode = GetDrawMapMode( sal_True );
233cdf0e10cSrcweir             Size aLeftSize = pLeft->PixelToLogic( pLeft->GetOutputSizePixel(), aMapMode );
234cdf0e10cSrcweir             Point aOrigin = aMapMode.GetOrigin();
235cdf0e10cSrcweir             if( (this == pRight) || (this == pDiagonal) )
236cdf0e10cSrcweir                 aOrigin.X() += aLeftSize.Width();
237cdf0e10cSrcweir             if( (this == pBottom) || (this == pDiagonal) )
238cdf0e10cSrcweir                 aOrigin.Y() += aLeftSize.Height();
239cdf0e10cSrcweir             aMapMode.SetOrigin( aOrigin );
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 			pNoteMarker = new ScNoteMarker( pLeft, pRight, pBottom, pDiagonal,
242cdf0e10cSrcweir 											pDoc, aCellPos, aTrackText,
243cdf0e10cSrcweir 											aMapMode, bLeftEdge, bFast, bKeyboard );
244cdf0e10cSrcweir 		}
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 		bDone = sal_True;		// something is shown (old or new)
247cdf0e10cSrcweir 	}
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 	return bDone;
250cdf0e10cSrcweir }
251cdf0e10cSrcweir 
252cdf0e10cSrcweir // -----------------------------------------------------------------------
253cdf0e10cSrcweir 
254cdf0e10cSrcweir void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
255cdf0e10cSrcweir {
256cdf0e10cSrcweir 	sal_Bool bDone = sal_False;
257cdf0e10cSrcweir 	sal_Bool bHelpEnabled = ( rHEvt.GetMode() & ( HELPMODE_BALLOON | HELPMODE_QUICK ) ) != 0;
258cdf0e10cSrcweir 	SdrView* pDrView = pViewData->GetScDrawView();
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 	sal_Bool bDrawTextEdit = sal_False;
261cdf0e10cSrcweir 	if (pDrView)
262cdf0e10cSrcweir 		bDrawTextEdit = pDrView->IsTextEdit();
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 	//	notes or change tracking
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 	if ( bHelpEnabled && !bDrawTextEdit )
267cdf0e10cSrcweir 	{
268cdf0e10cSrcweir 		Point		aPosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
269cdf0e10cSrcweir         SCsCOL nPosX;
270cdf0e10cSrcweir         SCsROW nPosY;
271cdf0e10cSrcweir         pViewData->GetPosFromPixel( aPosPixel.X(), aPosPixel.Y(), eWhich, nPosX, nPosY );
272cdf0e10cSrcweir 
273cdf0e10cSrcweir 		if ( ShowNoteMarker( nPosX, nPosY, sal_False ) )
274cdf0e10cSrcweir 		{
275cdf0e10cSrcweir 			Window::RequestHelp( rHEvt );	// alte Tip/Balloon ausschalten
276cdf0e10cSrcweir 			bDone = sal_True;
277cdf0e10cSrcweir 		}
278cdf0e10cSrcweir 	}
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 	if ( !bDone && pNoteMarker )
281cdf0e10cSrcweir 	{
282cdf0e10cSrcweir 		if ( pNoteMarker->IsByKeyboard() )
283cdf0e10cSrcweir 		{
284cdf0e10cSrcweir 			//	marker which was shown for ctrl-F1 isn't removed by mouse events
285cdf0e10cSrcweir 		}
286cdf0e10cSrcweir 		else
287cdf0e10cSrcweir 			DELETEZ(pNoteMarker);
288cdf0e10cSrcweir 	}
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 	//	Image-Map / Text-URL
291cdf0e10cSrcweir 
292cdf0e10cSrcweir 	if ( bHelpEnabled && !bDone && !nButtonDown )		// nur ohne gedrueckten Button
293cdf0e10cSrcweir 	{
294cdf0e10cSrcweir 		String aHelpText;
295cdf0e10cSrcweir 		Rectangle aPixRect;
296cdf0e10cSrcweir 		Point aPosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
297cdf0e10cSrcweir 
298cdf0e10cSrcweir 		if ( pDrView )										// URL / Image-Map
299cdf0e10cSrcweir 		{
300cdf0e10cSrcweir 			SdrViewEvent aVEvt;
301cdf0e10cSrcweir 			MouseEvent aMEvt( aPosPixel, 1, 0, MOUSE_LEFT );
302cdf0e10cSrcweir 			SdrHitKind eHit = pDrView->PickAnything( aMEvt, SDRMOUSEBUTTONDOWN, aVEvt );
303cdf0e10cSrcweir 
304cdf0e10cSrcweir 			if ( eHit != SDRHIT_NONE && aVEvt.pObj != NULL )
305cdf0e10cSrcweir 			{
306cdf0e10cSrcweir 				// URL fuer IMapObject unter Pointer ist Hilfetext
307cdf0e10cSrcweir 				if ( ScDrawLayer::GetIMapInfo( aVEvt.pObj ) )
308cdf0e10cSrcweir 				{
309cdf0e10cSrcweir 					Point aLogicPos = PixelToLogic( aPosPixel );
310cdf0e10cSrcweir 					IMapObject* pIMapObj = ScDrawLayer::GetHitIMapObject(
311cdf0e10cSrcweir 													aVEvt.pObj, aLogicPos, *this );
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 					if ( pIMapObj )
314cdf0e10cSrcweir 					{
315cdf0e10cSrcweir 						//	#44990# Bei ImageMaps die Description anzeigen, wenn vorhanden
316cdf0e10cSrcweir 						aHelpText = pIMapObj->GetAltText();
317cdf0e10cSrcweir 						if (!aHelpText.Len())
318cdf0e10cSrcweir 							aHelpText = pIMapObj->GetURL();
319cdf0e10cSrcweir 						aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
320cdf0e10cSrcweir 					}
321cdf0e10cSrcweir 				}
322cdf0e10cSrcweir                 // URL in shape text or at shape itself (URL in text overrides object URL)
323cdf0e10cSrcweir                 if ( aHelpText.Len() == 0 )
324cdf0e10cSrcweir                 {
325cdf0e10cSrcweir                     if( aVEvt.eEvent == SDREVENT_EXECUTEURL )
326cdf0e10cSrcweir                     {
327cdf0e10cSrcweir                         aHelpText = aVEvt.pURLField->GetURL();
328cdf0e10cSrcweir                         aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
329cdf0e10cSrcweir                     }
330cdf0e10cSrcweir                     else
331cdf0e10cSrcweir                     {
332cdf0e10cSrcweir                         SdrObject* pObj = 0;
333cdf0e10cSrcweir                         SdrPageView* pPV = 0;
334cdf0e10cSrcweir                         Point aMDPos = PixelToLogic( aPosPixel );
335cdf0e10cSrcweir                         if ( pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER) )
336cdf0e10cSrcweir                         {
337cdf0e10cSrcweir                             if ( pObj->IsGroupObject() )
338cdf0e10cSrcweir                             {
339cdf0e10cSrcweir                                     SdrObject* pHit = 0;
340cdf0e10cSrcweir                                     if ( pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
341cdf0e10cSrcweir                                         pObj = pHit;
342cdf0e10cSrcweir                             }
343cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
344cdf0e10cSrcweir                             ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
345cdf0e10cSrcweir                             if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
346cdf0e10cSrcweir                             {
347cdf0e10cSrcweir                                 aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
348cdf0e10cSrcweir                                 aHelpText = pInfo->GetHlink();
349cdf0e10cSrcweir                             }
350cdf0e10cSrcweir #endif
351cdf0e10cSrcweir                         }
352cdf0e10cSrcweir                     }
353cdf0e10cSrcweir                 }
354cdf0e10cSrcweir 			}
355cdf0e10cSrcweir 		}
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 		if ( !aHelpText.Len() )									// Text-URL
358cdf0e10cSrcweir 		{
359cdf0e10cSrcweir 			String aUrl;
360cdf0e10cSrcweir 			if ( GetEditUrl( aPosPixel, NULL, &aUrl, NULL ) )
361cdf0e10cSrcweir 			{
362cdf0e10cSrcweir 				aHelpText = INetURLObject::decode( aUrl, INET_HEX_ESCAPE,
363cdf0e10cSrcweir 					INetURLObject::DECODE_UNAMBIGUOUS );
364cdf0e10cSrcweir 
365cdf0e10cSrcweir 				ScDocument* pDoc = pViewData->GetDocument();
366cdf0e10cSrcweir                 SCsCOL nPosX;
367cdf0e10cSrcweir                 SCsROW nPosY;
368cdf0e10cSrcweir                 SCTAB		nTab = pViewData->GetTabNo();
369cdf0e10cSrcweir 				pViewData->GetPosFromPixel( aPosPixel.X(), aPosPixel.Y(), eWhich, nPosX, nPosY );
370cdf0e10cSrcweir 				const ScPatternAttr* pPattern = pDoc->GetPattern( nPosX, nPosY, nTab );
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 				ScHideTextCursor aHideCursor( pViewData, eWhich );		// MapMode is changed in GetEditArea
373cdf0e10cSrcweir 
374cdf0e10cSrcweir 				// bForceToTop = sal_False, use the cell's real position
375cdf0e10cSrcweir 				aPixRect = pViewData->GetEditArea( eWhich, nPosX, nPosY, this, pPattern, sal_False );
376cdf0e10cSrcweir 			}
377cdf0e10cSrcweir 		}
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 		if ( aHelpText.Len() )
380cdf0e10cSrcweir 		{
381cdf0e10cSrcweir 			Rectangle aScreenRect(OutputToScreenPixel(aPixRect.TopLeft()),
382cdf0e10cSrcweir 									OutputToScreenPixel(aPixRect.BottomRight()));
383cdf0e10cSrcweir 
384cdf0e10cSrcweir 			if ( rHEvt.GetMode() & HELPMODE_BALLOON )
385cdf0e10cSrcweir 				Help::ShowBalloon(this,rHEvt.GetMousePosPixel(), aScreenRect, aHelpText);
386cdf0e10cSrcweir 			else if ( rHEvt.GetMode() & HELPMODE_QUICK )
387cdf0e10cSrcweir 				Help::ShowQuickHelp(this,aScreenRect, aHelpText);
388cdf0e10cSrcweir 
389cdf0e10cSrcweir 			bDone = sal_True;
390cdf0e10cSrcweir 		}
391cdf0e10cSrcweir 	}
392cdf0e10cSrcweir 
393cdf0e10cSrcweir 	//	Basic-Controls
394cdf0e10cSrcweir 
395cdf0e10cSrcweir 	if ( pDrView && bHelpEnabled && !bDone )
396cdf0e10cSrcweir 	{
397cdf0e10cSrcweir 		SdrPageView* pPV = pDrView->GetSdrPageView();
398cdf0e10cSrcweir 		DBG_ASSERT( pPV, "SdrPageView* ist NULL" );
399cdf0e10cSrcweir 		if (pPV)
400cdf0e10cSrcweir 			bDone = ((ScDrawPage*)pPV->GetPage())->RequestHelp( this, pDrView, rHEvt );
401cdf0e10cSrcweir 	}
402cdf0e10cSrcweir 
403cdf0e10cSrcweir 	//	Wenn QuickHelp fuer AutoFill angezeigt wird, nicht wieder wegnehmen lassen
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 	if ( nMouseStatus == SC_GM_TABDOWN && pViewData->GetRefType() == SC_REFTYPE_FILL &&
406cdf0e10cSrcweir 			Help::IsQuickHelpEnabled() )
407cdf0e10cSrcweir 		bDone = sal_True;
408cdf0e10cSrcweir 
409cdf0e10cSrcweir 	if (!bDone)
410cdf0e10cSrcweir 		Window::RequestHelp( rHEvt );
411cdf0e10cSrcweir }
412cdf0e10cSrcweir 
413cdf0e10cSrcweir sal_Bool ScGridWindow::IsMyModel(SdrEditView* pSdrView)
414cdf0e10cSrcweir {
415cdf0e10cSrcweir 	return pSdrView &&
416cdf0e10cSrcweir 			pSdrView->GetModel() == pViewData->GetDocument()->GetDrawLayer();
417cdf0e10cSrcweir }
418cdf0e10cSrcweir 
419cdf0e10cSrcweir void ScGridWindow::HideNoteMarker()
420cdf0e10cSrcweir {
421cdf0e10cSrcweir 	DELETEZ(pNoteMarker);
422cdf0e10cSrcweir }
423cdf0e10cSrcweir 
424cdf0e10cSrcweir com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
425cdf0e10cSrcweir 	ScGridWindow::CreateAccessible()
426cdf0e10cSrcweir {
427*0deba7fbSSteve Yin 	com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc= GetAccessible(sal_False);
428*0deba7fbSSteve Yin 	if (xAcc.is())
429*0deba7fbSSteve Yin 	{
430*0deba7fbSSteve Yin 		return xAcc;
431*0deba7fbSSteve Yin 	}
432cdf0e10cSrcweir 	ScAccessibleDocument* pAccessibleDocument =
433cdf0e10cSrcweir 		new ScAccessibleDocument(GetAccessibleParentWindow()->GetAccessible(),
434cdf0e10cSrcweir 			pViewData->GetViewShell(), eWhich);
435*0deba7fbSSteve Yin 	xAcc = pAccessibleDocument;
436*0deba7fbSSteve Yin 	SetAccessible(xAcc);
437cdf0e10cSrcweir 
438cdf0e10cSrcweir 	pAccessibleDocument->Init();
439*0deba7fbSSteve Yin 	return xAcc;
440*0deba7fbSSteve Yin }
441*0deba7fbSSteve Yin // MT: Removed Windows::SwitchView() introduced with IA2 CWS.
442*0deba7fbSSteve Yin // There are other notifications for this when the active view has chnaged, so please update the code to use that event mechanism
443*0deba7fbSSteve Yin void ScGridWindow::SwitchView()
444*0deba7fbSSteve Yin {
445*0deba7fbSSteve Yin 	if (!Application::IsAccessibilityEnabled())
446*0deba7fbSSteve Yin 	{
447*0deba7fbSSteve Yin 		return ;
448*0deba7fbSSteve Yin 	}
449*0deba7fbSSteve Yin 	ScAccessibleDocumentBase* pAccDoc = static_cast<ScAccessibleDocumentBase*>(GetAccessible(sal_False).get());
450*0deba7fbSSteve Yin 	if (pAccDoc)
451*0deba7fbSSteve Yin 	{
452*0deba7fbSSteve Yin 		pAccDoc->SwitchViewFireFocus();
453*0deba7fbSSteve Yin 	}
454cdf0e10cSrcweir }
455*0deba7fbSSteve Yin 
456