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