xref: /trunk/main/sc/source/ui/view/gridwin5.cxx (revision 375f5bafad26878da9deb0e418aea6df7e31d41e)
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
10cdf0e10cSrcweir  *
11b3f79822SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
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"
610deba7fbSSteve Yin #include <vcl/svapp.hxx>
62cdf0e10cSrcweir 
63cdf0e10cSrcweir // -----------------------------------------------------------------------
64cdf0e10cSrcweir 
ScHideTextCursor(ScViewData * pData,ScSplitPos eW)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 
~ScHideTextCursor()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 
ShowNoteMarker(SCsCOL nPosX,SCsROW nPosY,sal_Bool bKeyboard)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();
178*375f5bafSmseidel             aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " - " ));
179cdf0e10cSrcweir             aTrackText += ScGlobal::pLocaleData->getDate(aDT);
180cdf0e10cSrcweir             aTrackText += ' ';
181cdf0e10cSrcweir             aTrackText += ScGlobal::pLocaleData->getTime(aDT);
182*375f5bafSmseidel             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 
230*375f5bafSmseidel             /* If caption is shown from right or bottom windows, adjust mapmode to include size of top-left window. */
231cdf0e10cSrcweir             MapMode aMapMode = GetDrawMapMode( sal_True );
232cdf0e10cSrcweir             Size aLeftSize = pLeft->PixelToLogic( pLeft->GetOutputSizePixel(), aMapMode );
233cdf0e10cSrcweir             Point aOrigin = aMapMode.GetOrigin();
234cdf0e10cSrcweir             if( (this == pRight) || (this == pDiagonal) )
235cdf0e10cSrcweir                 aOrigin.X() += aLeftSize.Width();
236cdf0e10cSrcweir             if( (this == pBottom) || (this == pDiagonal) )
237cdf0e10cSrcweir                 aOrigin.Y() += aLeftSize.Height();
238cdf0e10cSrcweir             aMapMode.SetOrigin( aOrigin );
239cdf0e10cSrcweir 
240cdf0e10cSrcweir             pNoteMarker = new ScNoteMarker( pLeft, pRight, pBottom, pDiagonal,
241cdf0e10cSrcweir                                             pDoc, aCellPos, aTrackText,
242cdf0e10cSrcweir                                             aMapMode, bLeftEdge, bFast, bKeyboard );
243cdf0e10cSrcweir         }
244cdf0e10cSrcweir 
245cdf0e10cSrcweir         bDone = sal_True; // something is shown (old or new)
246cdf0e10cSrcweir     }
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     return bDone;
249cdf0e10cSrcweir }
250cdf0e10cSrcweir 
251cdf0e10cSrcweir // -----------------------------------------------------------------------
252cdf0e10cSrcweir 
RequestHelp(const HelpEvent & rHEvt)253cdf0e10cSrcweir void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
254cdf0e10cSrcweir {
255cdf0e10cSrcweir     sal_Bool bDone = sal_False;
256cdf0e10cSrcweir     sal_Bool bHelpEnabled = ( rHEvt.GetMode() & ( HELPMODE_BALLOON | HELPMODE_QUICK ) ) != 0;
257cdf0e10cSrcweir     SdrView* pDrView = pViewData->GetScDrawView();
258cdf0e10cSrcweir 
259cdf0e10cSrcweir     sal_Bool bDrawTextEdit = sal_False;
260cdf0e10cSrcweir     if (pDrView)
261cdf0e10cSrcweir         bDrawTextEdit = pDrView->IsTextEdit();
262cdf0e10cSrcweir 
263cdf0e10cSrcweir     // notes or change tracking
264cdf0e10cSrcweir 
265cdf0e10cSrcweir     if ( bHelpEnabled && !bDrawTextEdit )
266cdf0e10cSrcweir     {
267cdf0e10cSrcweir         Point       aPosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
268cdf0e10cSrcweir         SCsCOL nPosX;
269cdf0e10cSrcweir         SCsROW nPosY;
270cdf0e10cSrcweir         pViewData->GetPosFromPixel( aPosPixel.X(), aPosPixel.Y(), eWhich, nPosX, nPosY );
271cdf0e10cSrcweir 
272cdf0e10cSrcweir         if ( ShowNoteMarker( nPosX, nPosY, sal_False ) )
273cdf0e10cSrcweir         {
274cdf0e10cSrcweir             Window::RequestHelp( rHEvt ); // alte Tip/Balloon ausschalten
275cdf0e10cSrcweir             bDone = sal_True;
276cdf0e10cSrcweir         }
277cdf0e10cSrcweir     }
278cdf0e10cSrcweir 
279cdf0e10cSrcweir     if ( !bDone && pNoteMarker )
280cdf0e10cSrcweir     {
281cdf0e10cSrcweir         if ( pNoteMarker->IsByKeyboard() )
282cdf0e10cSrcweir         {
283cdf0e10cSrcweir             // marker which was shown for ctrl-F1 isn't removed by mouse events
284cdf0e10cSrcweir         }
285cdf0e10cSrcweir         else
286cdf0e10cSrcweir             DELETEZ(pNoteMarker);
287cdf0e10cSrcweir     }
288cdf0e10cSrcweir 
289cdf0e10cSrcweir     // Image-Map / Text-URL
290cdf0e10cSrcweir 
291cdf0e10cSrcweir     if ( bHelpEnabled && !bDone && !nButtonDown ) // nur ohne gedrueckten Button
292cdf0e10cSrcweir     {
293cdf0e10cSrcweir         String aHelpText;
294cdf0e10cSrcweir         Rectangle aPixRect;
295cdf0e10cSrcweir         Point aPosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
296cdf0e10cSrcweir 
297cdf0e10cSrcweir         if ( pDrView ) // URL / Image-Map
298cdf0e10cSrcweir         {
299cdf0e10cSrcweir             SdrViewEvent aVEvt;
300cdf0e10cSrcweir             MouseEvent aMEvt( aPosPixel, 1, 0, MOUSE_LEFT );
301cdf0e10cSrcweir             SdrHitKind eHit = pDrView->PickAnything( aMEvt, SDRMOUSEBUTTONDOWN, aVEvt );
302cdf0e10cSrcweir 
303cdf0e10cSrcweir             if ( eHit != SDRHIT_NONE && aVEvt.pObj != NULL )
304cdf0e10cSrcweir             {
305cdf0e10cSrcweir                 // URL fuer IMapObject unter Pointer ist Hilfetext
306cdf0e10cSrcweir                 if ( ScDrawLayer::GetIMapInfo( aVEvt.pObj ) )
307cdf0e10cSrcweir                 {
308cdf0e10cSrcweir                     Point aLogicPos = PixelToLogic( aPosPixel );
309cdf0e10cSrcweir                     IMapObject* pIMapObj = ScDrawLayer::GetHitIMapObject(
310cdf0e10cSrcweir                                                     aVEvt.pObj, aLogicPos, *this );
311cdf0e10cSrcweir 
312cdf0e10cSrcweir                     if ( pIMapObj )
313cdf0e10cSrcweir                     {
314cdf0e10cSrcweir                         // #44990# Bei ImageMaps die Description anzeigen, wenn vorhanden
315cdf0e10cSrcweir                         aHelpText = pIMapObj->GetAltText();
316cdf0e10cSrcweir                         if (!aHelpText.Len())
317cdf0e10cSrcweir                             aHelpText = pIMapObj->GetURL();
318cdf0e10cSrcweir                         aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
319cdf0e10cSrcweir                     }
320cdf0e10cSrcweir                 }
321cdf0e10cSrcweir                 // URL in shape text or at shape itself (URL in text overrides object URL)
322cdf0e10cSrcweir                 if ( aHelpText.Len() == 0 )
323cdf0e10cSrcweir                 {
324cdf0e10cSrcweir                     if( aVEvt.eEvent == SDREVENT_EXECUTEURL )
325cdf0e10cSrcweir                     {
326cdf0e10cSrcweir                         aHelpText = aVEvt.pURLField->GetURL();
327cdf0e10cSrcweir                         aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
328cdf0e10cSrcweir                     }
329cdf0e10cSrcweir                     else
330cdf0e10cSrcweir                     {
331cdf0e10cSrcweir                         SdrObject* pObj = 0;
332cdf0e10cSrcweir                         SdrPageView* pPV = 0;
333cdf0e10cSrcweir                         Point aMDPos = PixelToLogic( aPosPixel );
334cdf0e10cSrcweir                         if ( pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER) )
335cdf0e10cSrcweir                         {
336cdf0e10cSrcweir                             if ( pObj->IsGroupObject() )
337cdf0e10cSrcweir                             {
338cdf0e10cSrcweir                                 SdrObject* pHit = 0;
339cdf0e10cSrcweir                                 if ( pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
340cdf0e10cSrcweir                                     pObj = pHit;
341cdf0e10cSrcweir                             }
342cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
343cdf0e10cSrcweir                             ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
344cdf0e10cSrcweir                             if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
345cdf0e10cSrcweir                             {
346cdf0e10cSrcweir                                 aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
347cdf0e10cSrcweir                                 aHelpText = pInfo->GetHlink();
348cdf0e10cSrcweir                             }
349cdf0e10cSrcweir #endif
350cdf0e10cSrcweir                     }
351cdf0e10cSrcweir                     }
352cdf0e10cSrcweir                 }
353cdf0e10cSrcweir             }
354cdf0e10cSrcweir         }
355cdf0e10cSrcweir 
356cdf0e10cSrcweir         if ( !aHelpText.Len() ) // Text-URL
357cdf0e10cSrcweir         {
358cdf0e10cSrcweir             String aUrl;
359cdf0e10cSrcweir             if ( GetEditUrl( aPosPixel, NULL, &aUrl, NULL ) )
360cdf0e10cSrcweir             {
361cdf0e10cSrcweir                 aHelpText = INetURLObject::decode( aUrl, INET_HEX_ESCAPE,
362cdf0e10cSrcweir                     INetURLObject::DECODE_UNAMBIGUOUS );
363cdf0e10cSrcweir 
364cdf0e10cSrcweir                 ScDocument* pDoc = pViewData->GetDocument();
365cdf0e10cSrcweir                 SCsCOL nPosX;
366cdf0e10cSrcweir                 SCsROW nPosY;
367cdf0e10cSrcweir                 SCTAB  nTab = pViewData->GetTabNo();
368cdf0e10cSrcweir                 pViewData->GetPosFromPixel( aPosPixel.X(), aPosPixel.Y(), eWhich, nPosX, nPosY );
369cdf0e10cSrcweir                 const ScPatternAttr* pPattern = pDoc->GetPattern( nPosX, nPosY, nTab );
370cdf0e10cSrcweir 
371cdf0e10cSrcweir                 ScHideTextCursor aHideCursor( pViewData, eWhich ); // MapMode is changed in GetEditArea
372cdf0e10cSrcweir 
373cdf0e10cSrcweir                 // bForceToTop = sal_False, use the cell's real position
374cdf0e10cSrcweir                 aPixRect = pViewData->GetEditArea( eWhich, nPosX, nPosY, this, pPattern, sal_False );
375cdf0e10cSrcweir             }
376cdf0e10cSrcweir         }
377cdf0e10cSrcweir 
378cdf0e10cSrcweir         if ( aHelpText.Len() )
379cdf0e10cSrcweir         {
380cdf0e10cSrcweir             Rectangle aScreenRect(OutputToScreenPixel(aPixRect.TopLeft()),
381cdf0e10cSrcweir                                     OutputToScreenPixel(aPixRect.BottomRight()));
382cdf0e10cSrcweir 
383cdf0e10cSrcweir             if ( rHEvt.GetMode() & HELPMODE_BALLOON )
384cdf0e10cSrcweir                 Help::ShowBalloon(this,rHEvt.GetMousePosPixel(), aScreenRect, aHelpText);
385cdf0e10cSrcweir             else if ( rHEvt.GetMode() & HELPMODE_QUICK )
386cdf0e10cSrcweir                 Help::ShowQuickHelp(this,aScreenRect, aHelpText);
387cdf0e10cSrcweir 
388cdf0e10cSrcweir             bDone = sal_True;
389cdf0e10cSrcweir         }
390cdf0e10cSrcweir     }
391cdf0e10cSrcweir 
392cdf0e10cSrcweir     // Basic-Controls
393cdf0e10cSrcweir 
394cdf0e10cSrcweir     if ( pDrView && bHelpEnabled && !bDone )
395cdf0e10cSrcweir     {
396cdf0e10cSrcweir         SdrPageView* pPV = pDrView->GetSdrPageView();
397cdf0e10cSrcweir         DBG_ASSERT( pPV, "SdrPageView* ist NULL" );
398cdf0e10cSrcweir         if (pPV)
399cdf0e10cSrcweir             bDone = ((ScDrawPage*)pPV->GetPage())->RequestHelp( this, pDrView, rHEvt );
400cdf0e10cSrcweir     }
401cdf0e10cSrcweir 
402cdf0e10cSrcweir     // Wenn QuickHelp fuer AutoFill angezeigt wird, nicht wieder wegnehmen lassen
403cdf0e10cSrcweir 
404cdf0e10cSrcweir     if ( nMouseStatus == SC_GM_TABDOWN && pViewData->GetRefType() == SC_REFTYPE_FILL &&
405cdf0e10cSrcweir             Help::IsQuickHelpEnabled() )
406cdf0e10cSrcweir         bDone = sal_True;
407cdf0e10cSrcweir 
408cdf0e10cSrcweir     if (!bDone)
409cdf0e10cSrcweir         Window::RequestHelp( rHEvt );
410cdf0e10cSrcweir }
411cdf0e10cSrcweir 
IsMyModel(SdrEditView * pSdrView)412cdf0e10cSrcweir sal_Bool ScGridWindow::IsMyModel(SdrEditView* pSdrView)
413cdf0e10cSrcweir {
414cdf0e10cSrcweir     return pSdrView &&
415cdf0e10cSrcweir             pSdrView->GetModel() == pViewData->GetDocument()->GetDrawLayer();
416cdf0e10cSrcweir }
417cdf0e10cSrcweir 
HideNoteMarker()418cdf0e10cSrcweir void ScGridWindow::HideNoteMarker()
419cdf0e10cSrcweir {
420cdf0e10cSrcweir     DELETEZ(pNoteMarker);
421cdf0e10cSrcweir }
422cdf0e10cSrcweir 
423cdf0e10cSrcweir com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
CreateAccessible()424cdf0e10cSrcweir     ScGridWindow::CreateAccessible()
425cdf0e10cSrcweir {
4260deba7fbSSteve Yin     com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc= GetAccessible(sal_False);
4270deba7fbSSteve Yin     if (xAcc.is())
4280deba7fbSSteve Yin     {
4290deba7fbSSteve Yin         return xAcc;
4300deba7fbSSteve Yin     }
431cdf0e10cSrcweir     ScAccessibleDocument* pAccessibleDocument =
432cdf0e10cSrcweir         new ScAccessibleDocument(GetAccessibleParentWindow()->GetAccessible(),
433cdf0e10cSrcweir             pViewData->GetViewShell(), eWhich);
4340deba7fbSSteve Yin     xAcc = pAccessibleDocument;
4350deba7fbSSteve Yin     SetAccessible(xAcc);
436cdf0e10cSrcweir 
437cdf0e10cSrcweir     pAccessibleDocument->Init();
4380deba7fbSSteve Yin     return xAcc;
439cdf0e10cSrcweir }
4400deba7fbSSteve Yin // MT: Removed Windows::SwitchView() introduced with IA2 CWS.
441*375f5bafSmseidel // There are other notifications for this when the active view has changed, so please update the code to use that event mechanism
SwitchView()4420deba7fbSSteve Yin void ScGridWindow::SwitchView()
4430deba7fbSSteve Yin {
4440deba7fbSSteve Yin     if (!Application::IsAccessibilityEnabled())
4450deba7fbSSteve Yin     {
4460deba7fbSSteve Yin         return ;
4470deba7fbSSteve Yin     }
4480deba7fbSSteve Yin     ScAccessibleDocumentBase* pAccDoc = static_cast<ScAccessibleDocumentBase*>(GetAccessible(sal_False).get());
4490deba7fbSSteve Yin     if (pAccDoc)
4500deba7fbSSteve Yin     {
4510deba7fbSSteve Yin         pAccDoc->SwitchViewFireFocus();
4520deba7fbSSteve Yin     }
4530deba7fbSSteve Yin }
454