Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <tools/urlobj.hxx>
30 : : #include <vcl/svapp.hxx>
31 : : #include <sfx2/docfile.hxx>
32 : :
33 : : #include "select.hxx"
34 : : #include "sc.hrc"
35 : : #include "tabvwsh.hxx"
36 : : #include "scmod.hxx"
37 : : #include "document.hxx"
38 : : #include "transobj.hxx"
39 : : #include "docsh.hxx"
40 : : #include "tabprotection.hxx"
41 : : #include "markdata.hxx"
42 : :
43 : : #define SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN 65
44 : :
45 : : extern sal_uInt16 nScFillModeMouseModifier; // global.cxx
46 : :
47 : : using namespace com::sun::star;
48 : :
49 : : // STATIC DATA -----------------------------------------------------------
50 : :
51 : 51 : static Point aSwitchPos; //! Member
52 : : static sal_Bool bDidSwitch = false;
53 : :
54 : : // -----------------------------------------------------------------------
55 : :
56 : : //
57 : : // View (Gridwin / Tastatur)
58 : : //
59 : :
60 : 229 : ScViewFunctionSet::ScViewFunctionSet( ScViewData* pNewViewData ) :
61 : : pViewData( pNewViewData ),
62 : : pEngine( NULL ),
63 : : bAnchor( false ),
64 : 229 : bStarted( false )
65 : : {
66 : : OSL_ENSURE(pViewData, "ViewData==0 bei FunctionSet");
67 : 229 : }
68 : :
69 : 0 : ScSplitPos ScViewFunctionSet::GetWhich()
70 : : {
71 [ # # ]: 0 : if (pEngine)
72 : 0 : return pEngine->GetWhich();
73 : : else
74 : 0 : return pViewData->GetActivePart();
75 : : }
76 : :
77 : 0 : sal_uLong ScViewFunctionSet::CalcUpdateInterval( const Size& rWinSize, const Point& rEffPos,
78 : : bool bLeftScroll, bool bTopScroll, bool bRightScroll, bool bBottomScroll )
79 : : {
80 : 0 : sal_uLong nUpdateInterval = SELENG_AUTOREPEAT_INTERVAL_MAX;
81 : 0 : Window* pWin = pEngine->GetWindow();
82 [ # # ]: 0 : Rectangle aScrRect = pWin->GetDesktopRectPixel();
83 [ # # ]: 0 : Point aRootPos = pWin->OutputToAbsoluteScreenPixel(Point(0,0));
84 [ # # ]: 0 : if (bRightScroll)
85 : : {
86 : 0 : double nWinRight = rWinSize.getWidth() + aRootPos.getX();
87 [ # # ]: 0 : double nMarginRight = aScrRect.GetWidth() - nWinRight;
88 : 0 : double nHOffset = rEffPos.X() - rWinSize.Width();
89 : 0 : double nHAccelRate = nHOffset / nMarginRight;
90 : :
91 [ # # ]: 0 : if (nHAccelRate > 1.0)
92 : 0 : nHAccelRate = 1.0;
93 : :
94 : 0 : nUpdateInterval = static_cast<sal_uLong>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nHAccelRate));
95 : : }
96 : :
97 [ # # ]: 0 : if (bLeftScroll)
98 : : {
99 : 0 : double nMarginLeft = aRootPos.getX();
100 : 0 : double nHOffset = -rEffPos.X();
101 : 0 : double nHAccelRate = nHOffset / nMarginLeft;
102 : :
103 [ # # ]: 0 : if (nHAccelRate > 1.0)
104 : 0 : nHAccelRate = 1.0;
105 : :
106 : 0 : sal_uLong nTmp = static_cast<sal_uLong>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nHAccelRate));
107 [ # # ]: 0 : if (nUpdateInterval > nTmp)
108 : 0 : nUpdateInterval = nTmp;
109 : : }
110 : :
111 [ # # ]: 0 : if (bBottomScroll)
112 : : {
113 : 0 : double nWinBottom = rWinSize.getHeight() + aRootPos.getY();
114 [ # # ]: 0 : double nMarginBottom = aScrRect.GetHeight() - nWinBottom;
115 : 0 : double nVOffset = rEffPos.Y() - rWinSize.Height();
116 : 0 : double nVAccelRate = nVOffset / nMarginBottom;
117 : :
118 [ # # ]: 0 : if (nVAccelRate > 1.0)
119 : 0 : nVAccelRate = 1.0;
120 : :
121 : 0 : sal_uLong nTmp = static_cast<sal_uLong>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nVAccelRate));
122 [ # # ]: 0 : if (nUpdateInterval > nTmp)
123 : 0 : nUpdateInterval = nTmp;
124 : : }
125 : :
126 [ # # ]: 0 : if (bTopScroll)
127 : : {
128 : 0 : double nMarginTop = aRootPos.getY();
129 : 0 : double nVOffset = -rEffPos.Y();
130 : 0 : double nVAccelRate = nVOffset / nMarginTop;
131 : :
132 [ # # ]: 0 : if (nVAccelRate > 1.0)
133 : 0 : nVAccelRate = 1.0;
134 : :
135 : 0 : sal_uLong nTmp = static_cast<sal_uLong>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nVAccelRate));
136 [ # # ]: 0 : if (nUpdateInterval > nTmp)
137 : 0 : nUpdateInterval = nTmp;
138 : : }
139 : :
140 : : #ifdef WNT
141 : : ScTabViewShell* pViewShell = pViewData->GetViewShell();
142 : : bool bRefMode = pViewShell && pViewShell->IsRefInputMode();
143 : : if (bRefMode && nUpdateInterval < SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN)
144 : : // Lower the update interval during ref mode, because re-draw can be
145 : : // expensive on Windows. Making this interval too small would queue up
146 : : // the scroll/paint requests which would cause semi-infinite
147 : : // scrolls even after the mouse cursor is released. We don't have
148 : : // this problem on Linux.
149 : : nUpdateInterval = SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN;
150 : : #endif
151 : 0 : return nUpdateInterval;
152 : : }
153 : :
154 : 229 : void ScViewFunctionSet::SetSelectionEngine( ScViewSelectionEngine* pSelEngine )
155 : : {
156 : 229 : pEngine = pSelEngine;
157 : 229 : }
158 : :
159 : : // Drag & Drop
160 : :
161 : 0 : void ScViewFunctionSet::BeginDrag()
162 : : {
163 : 0 : SCTAB nTab = pViewData->GetTabNo();
164 : :
165 : : SCsCOL nPosX;
166 : : SCsROW nPosY;
167 [ # # ]: 0 : if (pEngine)
168 : : {
169 : 0 : Point aMPos = pEngine->GetMousePosPixel();
170 [ # # ]: 0 : pViewData->GetPosFromPixel( aMPos.X(), aMPos.Y(), GetWhich(), nPosX, nPosY );
171 : : }
172 : : else
173 : : {
174 : 0 : nPosX = pViewData->GetCurX();
175 : 0 : nPosY = pViewData->GetCurY();
176 : : }
177 : :
178 [ # # ]: 0 : ScModule* pScMod = SC_MOD();
179 [ # # ]: 0 : sal_Bool bRefMode = pScMod->IsFormulaMode();
180 [ # # ]: 0 : if (!bRefMode)
181 : : {
182 [ # # ]: 0 : pViewData->GetView()->FakeButtonUp( GetWhich() ); // ButtonUp is swallowed
183 : :
184 [ # # ]: 0 : ScMarkData& rMark = pViewData->GetMarkData();
185 [ # # ]: 0 : rMark.MarkToSimple();
186 [ # # ][ # # ]: 0 : if ( rMark.IsMarked() && !rMark.IsMultiMarked() )
[ # # ]
187 : : {
188 [ # # ][ # # ]: 0 : ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
189 : : // bApi = TRUE -> no error messages
190 [ # # ]: 0 : sal_Bool bCopied = pViewData->GetView()->CopyToClip( pClipDoc, false, true );
191 [ # # ]: 0 : if ( bCopied )
192 : : {
193 [ # # ]: 0 : sal_Int8 nDragActions = pViewData->GetView()->SelectionEditable() ?
194 : : ( DND_ACTION_COPYMOVE | DND_ACTION_LINK ) :
195 [ # # ]: 0 : ( DND_ACTION_COPY | DND_ACTION_LINK );
196 : :
197 : 0 : ScDocShell* pDocSh = pViewData->GetDocShell();
198 [ # # ]: 0 : TransferableObjectDescriptor aObjDesc;
199 [ # # ]: 0 : pDocSh->FillTransferableObjectDescriptor( aObjDesc );
200 [ # # ][ # # ]: 0 : aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
[ # # ]
201 : : // maSize is set in ScTransferObj ctor
202 : :
203 [ # # ]: 0 : ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
204 [ # # ][ # # ]: 0 : uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
205 : :
206 : : // set position of dragged cell within range
207 : 0 : ScRange aMarkRange = pTransferObj->GetRange();
208 : 0 : SCCOL nStartX = aMarkRange.aStart.Col();
209 : 0 : SCROW nStartY = aMarkRange.aStart.Row();
210 [ # # ]: 0 : SCCOL nHandleX = (nPosX >= (SCsCOL) nStartX) ? nPosX - nStartX : 0;
211 [ # # ]: 0 : SCROW nHandleY = (nPosY >= (SCsROW) nStartY) ? nPosY - nStartY : 0;
212 [ # # ]: 0 : pTransferObj->SetDragHandlePos( nHandleX, nHandleY );
213 [ # # ]: 0 : pTransferObj->SetVisibleTab( nTab );
214 : :
215 [ # # ]: 0 : pTransferObj->SetDragSource( pDocSh, rMark );
216 : :
217 [ # # ]: 0 : Window* pWindow = pViewData->GetActiveWin();
218 [ # # ][ # # ]: 0 : if ( pWindow->IsTracking() )
219 [ # # ]: 0 : pWindow->EndTracking( ENDTRACK_CANCEL ); // abort selecting
220 : :
221 [ # # ][ # # ]: 0 : SC_MOD()->SetDragObject( pTransferObj, NULL ); // for internal D&D
222 [ # # ]: 0 : pTransferObj->StartDrag( pWindow, nDragActions );
223 : :
224 [ # # ]: 0 : return; // dragging started
225 : : }
226 : : else
227 [ # # ][ # # ]: 0 : delete pClipDoc;
228 : : }
229 : : }
230 : :
231 : : }
232 : :
233 : : // Selection
234 : :
235 : 0 : void ScViewFunctionSet::CreateAnchor()
236 : : {
237 [ # # ]: 0 : if (bAnchor) return;
238 : :
239 : 0 : sal_Bool bRefMode = SC_MOD()->IsFormulaMode();
240 [ # # ]: 0 : if (bRefMode)
241 : 0 : SetAnchor( pViewData->GetRefStartX(), pViewData->GetRefStartY() );
242 : : else
243 : 0 : SetAnchor( pViewData->GetCurX(), pViewData->GetCurY() );
244 : : }
245 : :
246 : 0 : void ScViewFunctionSet::SetAnchor( SCCOL nPosX, SCROW nPosY )
247 : : {
248 : 0 : sal_Bool bRefMode = SC_MOD()->IsFormulaMode();
249 [ # # ]: 0 : ScTabView* pView = pViewData->GetView();
250 : 0 : SCTAB nTab = pViewData->GetTabNo();
251 : :
252 [ # # ]: 0 : if (bRefMode)
253 : : {
254 : 0 : pView->DoneRefMode( false );
255 : 0 : aAnchorPos.Set( nPosX, nPosY, nTab );
256 : 0 : pView->InitRefMode( aAnchorPos.Col(), aAnchorPos.Row(), aAnchorPos.Tab(),
257 : 0 : SC_REFTYPE_REF );
258 : 0 : bStarted = sal_True;
259 : : }
260 [ # # ]: 0 : else if (pViewData->IsAnyFillMode())
261 : : {
262 : 0 : aAnchorPos.Set( nPosX, nPosY, nTab );
263 : 0 : bStarted = sal_True;
264 : : }
265 : : else
266 : : {
267 : : // nicht weg und gleich wieder hin
268 [ # # ][ # # ]: 0 : if ( bStarted && pView->IsMarking( nPosX, nPosY, nTab ) )
[ # # ]
269 : : {
270 : : // nix
271 : : }
272 : : else
273 : : {
274 : 0 : pView->DoneBlockMode( sal_True );
275 : 0 : aAnchorPos.Set( nPosX, nPosY, nTab );
276 : 0 : ScMarkData& rMark = pViewData->GetMarkData();
277 [ # # ][ # # ]: 0 : if ( rMark.IsMarked() || rMark.IsMultiMarked() )
[ # # ]
278 : : {
279 : 0 : pView->InitBlockMode( aAnchorPos.Col(), aAnchorPos.Row(),
280 : 0 : aAnchorPos.Tab(), sal_True );
281 : 0 : bStarted = sal_True;
282 : : }
283 : : else
284 : 0 : bStarted = false;
285 : : }
286 : : }
287 : 0 : bAnchor = sal_True;
288 : 0 : }
289 : :
290 : 0 : void ScViewFunctionSet::DestroyAnchor()
291 : : {
292 : 0 : sal_Bool bRefMode = SC_MOD()->IsFormulaMode();
293 [ # # ]: 0 : if (bRefMode)
294 : 0 : pViewData->GetView()->DoneRefMode( sal_True );
295 : : else
296 : 0 : pViewData->GetView()->DoneBlockMode( sal_True );
297 : :
298 : 0 : bAnchor = false;
299 : 0 : }
300 : :
301 : 0 : void ScViewFunctionSet::SetAnchorFlag( sal_Bool bSet )
302 : : {
303 : 0 : bAnchor = bSet;
304 : 0 : }
305 : :
306 : 0 : sal_Bool ScViewFunctionSet::SetCursorAtPoint( const Point& rPointPixel, sal_Bool /* bDontSelectAtCursor */ )
307 : : {
308 [ # # ]: 0 : if ( bDidSwitch )
309 : : {
310 [ # # ]: 0 : if ( rPointPixel == aSwitchPos )
311 : 0 : return false; // nicht auf falschem Fenster scrollen
312 : : else
313 : 0 : bDidSwitch = false;
314 : : }
315 : 0 : aSwitchPos = rPointPixel; // nur wichtig, wenn bDidSwitch
316 : :
317 : : // treat position 0 as -1, so scrolling is always possible
318 : : // (with full screen and hidden headers, the top left border may be at 0)
319 : : // (moved from ScViewData::GetPosFromPixel)
320 : :
321 : 0 : Point aEffPos = rPointPixel;
322 [ # # ]: 0 : if ( aEffPos.X() == 0 )
323 : 0 : aEffPos.X() = -1;
324 [ # # ]: 0 : if ( aEffPos.Y() == 0 )
325 : 0 : aEffPos.Y() = -1;
326 : :
327 : : // Scrolling
328 : :
329 : 0 : Size aWinSize = pEngine->GetWindow()->GetOutputSizePixel();
330 : 0 : bool bRightScroll = ( aEffPos.X() >= aWinSize.Width() );
331 : 0 : bool bLeftScroll = ( aEffPos.X() < 0 );
332 : 0 : bool bBottomScroll = ( aEffPos.Y() >= aWinSize.Height() );
333 : 0 : bool bTopScroll = ( aEffPos.Y() < 0 );
334 [ # # ][ # # ]: 0 : bool bScroll = bRightScroll || bBottomScroll || bLeftScroll || bTopScroll;
[ # # ][ # # ]
335 : :
336 : : SCsCOL nPosX;
337 : : SCsROW nPosY;
338 : 0 : pViewData->GetPosFromPixel( aEffPos.X(), aEffPos.Y(), GetWhich(),
339 [ # # ]: 0 : nPosX, nPosY, sal_True, sal_True ); // mit Repair
340 : :
341 : : // fuer AutoFill in der Mitte der Zelle umschalten
342 : : // dabei aber nicht das Scrolling nach rechts/unten verhindern
343 [ # # ][ # # ]: 0 : if ( pViewData->IsFillMode() || pViewData->GetFillMode() == SC_FILL_MATRIX )
[ # # ]
344 : : {
345 : : sal_Bool bLeft, bTop;
346 [ # # ]: 0 : pViewData->GetMouseQuadrant( aEffPos, GetWhich(), nPosX, nPosY, bLeft, bTop );
347 [ # # ]: 0 : ScDocument* pDoc = pViewData->GetDocument();
348 : 0 : SCTAB nTab = pViewData->GetTabNo();
349 [ # # ][ # # ]: 0 : if ( bLeft && !bRightScroll )
350 [ # # ][ # # ]: 0 : do --nPosX; while ( nPosX>=0 && pDoc->ColHidden( nPosX, nTab ) );
[ # # ][ # # ]
351 [ # # ][ # # ]: 0 : if ( bTop && !bBottomScroll )
352 : : {
353 [ # # ]: 0 : if (--nPosY >= 0)
354 : : {
355 [ # # ]: 0 : nPosY = pDoc->LastVisibleRow(0, nPosY, nTab);
356 [ # # ]: 0 : if (!ValidRow(nPosY))
357 : 0 : nPosY = -1;
358 : : }
359 : : }
360 : : // negativ ist erlaubt
361 : : }
362 : :
363 : : // ueber Fixier-Grenze bewegt?
364 : :
365 : 0 : ScSplitPos eWhich = GetWhich();
366 [ # # ]: 0 : if ( eWhich == pViewData->GetActivePart() )
367 : : {
368 [ # # ]: 0 : if ( pViewData->GetHSplitMode() == SC_SPLIT_FIX )
369 [ # # ]: 0 : if ( aEffPos.X() >= aWinSize.Width() )
370 : : {
371 [ # # ]: 0 : if ( eWhich == SC_SPLIT_TOPLEFT )
372 [ # # ]: 0 : pViewData->GetView()->ActivatePart( SC_SPLIT_TOPRIGHT ), bScroll = false, bDidSwitch = sal_True;
373 [ # # ]: 0 : else if ( eWhich == SC_SPLIT_BOTTOMLEFT )
374 [ # # ]: 0 : pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT ), bScroll = false, bDidSwitch = sal_True;
375 : : }
376 : :
377 [ # # ]: 0 : if ( pViewData->GetVSplitMode() == SC_SPLIT_FIX )
378 [ # # ]: 0 : if ( aEffPos.Y() >= aWinSize.Height() )
379 : : {
380 [ # # ]: 0 : if ( eWhich == SC_SPLIT_TOPLEFT )
381 [ # # ]: 0 : pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMLEFT ), bScroll = false, bDidSwitch = sal_True;
382 [ # # ]: 0 : else if ( eWhich == SC_SPLIT_TOPRIGHT )
383 [ # # ]: 0 : pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT ), bScroll = false, bDidSwitch = sal_True;
384 : : }
385 : : }
386 : :
387 [ # # ]: 0 : if (bScroll)
388 : : {
389 : : // Adjust update interval based on how far the mouse pointer is from the edge.
390 : : sal_uLong nUpdateInterval = CalcUpdateInterval(
391 [ # # ]: 0 : aWinSize, aEffPos, bLeftScroll, bTopScroll, bRightScroll, bBottomScroll);
392 [ # # ]: 0 : pEngine->SetUpdateInterval(nUpdateInterval);
393 : : }
394 : : else
395 : : {
396 : : // Don't forget to reset the interval when not scrolling!
397 [ # # ]: 0 : pEngine->SetUpdateInterval(SELENG_AUTOREPEAT_INTERVAL);
398 : : }
399 : :
400 [ # # ]: 0 : pViewData->ResetOldCursor();
401 [ # # ]: 0 : return SetCursorAtCell( nPosX, nPosY, bScroll );
402 : : }
403 : :
404 : 2 : sal_Bool ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, sal_Bool bScroll )
405 : : {
406 [ + - ]: 2 : ScTabView* pView = pViewData->GetView();
407 : 2 : SCTAB nTab = pViewData->GetTabNo();
408 : 2 : ScDocument* pDoc = pViewData->GetDocument();
409 : :
410 [ - + ]: 2 : if ( pDoc->IsTabProtected(nTab) )
411 : : {
412 [ # # ][ # # ]: 0 : if (nPosX < 0 || nPosY < 0)
413 : 0 : return false;
414 : :
415 : 0 : ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
416 : 0 : bool bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
417 : 0 : bool bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
418 : :
419 [ # # ][ # # ]: 0 : if ( bSkipProtected && bSkipUnprotected )
420 : 0 : return false;
421 : :
422 : 0 : bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HASATTR_PROTECTED);
423 [ # # ][ # # ]: 0 : if ( (bCellProtected && bSkipProtected) || (!bCellProtected && bSkipUnprotected) )
[ # # ][ # # ]
424 : : // Don't select this cell!
425 : 0 : return false;
426 : : }
427 : :
428 : 2 : ScModule* pScMod = SC_MOD();
429 : 2 : ScTabViewShell* pViewShell = pViewData->GetViewShell();
430 [ + - ]: 2 : bool bRefMode = ( pViewShell ? pViewShell->IsRefInputMode() : false );
431 : :
432 : 2 : sal_Bool bHide = !bRefMode && !pViewData->IsAnyFillMode() &&
433 [ + - + - ]: 4 : ( nPosX != (SCsCOL) pViewData->GetCurX() || nPosY != (SCsROW) pViewData->GetCurY() );
[ + - ][ - + ]
434 : :
435 [ - + ]: 2 : if (bHide)
436 : 0 : pView->HideAllCursors();
437 : :
438 [ - + ]: 2 : if (bScroll)
439 : : {
440 [ # # ]: 0 : if (bRefMode)
441 : : {
442 : 0 : ScSplitPos eWhich = GetWhich();
443 [ # # ]: 0 : pView->AlignToCursor( nPosX, nPosY, SC_FOLLOW_LINE, &eWhich );
444 : : }
445 : : else
446 : 0 : pView->AlignToCursor( nPosX, nPosY, SC_FOLLOW_LINE );
447 : : }
448 : :
449 [ - + ]: 2 : if (bRefMode)
450 : : {
451 : : // if no input is possible from this doc, don't move the reference cursor around
452 [ # # ]: 0 : if ( !pScMod->IsModalMode(pViewData->GetSfxDocShell()) )
453 : : {
454 [ # # ]: 0 : if (!bAnchor)
455 : : {
456 : 0 : pView->DoneRefMode( sal_True );
457 : 0 : pView->InitRefMode( nPosX, nPosY, pViewData->GetTabNo(), SC_REFTYPE_REF );
458 : : }
459 : :
460 : 0 : pView->UpdateRef( nPosX, nPosY, pViewData->GetTabNo() );
461 : : }
462 : : }
463 [ + - - + ]: 4 : else if (pViewData->IsFillMode() ||
[ # # ][ - + ]
464 : 2 : (pViewData->GetFillMode() == SC_FILL_MATRIX && (nScFillModeMouseModifier & KEY_MOD1) ))
465 : : {
466 : : // Wenn eine Matrix angefasst wurde, kann mit Ctrl auf AutoFill zurueckgeschaltet werden
467 : :
468 : : SCCOL nStartX, nEndX;
469 : : SCROW nStartY, nEndY; // Block
470 : : SCTAB nDummy;
471 [ # # ]: 0 : pViewData->GetSimpleArea( nStartX, nStartY, nDummy, nEndX, nEndY, nDummy );
472 : :
473 [ # # ]: 0 : if (pViewData->GetRefType() != SC_REFTYPE_FILL)
474 : : {
475 [ # # ]: 0 : pView->InitRefMode( nStartX, nStartY, nTab, SC_REFTYPE_FILL );
476 [ # # ]: 0 : CreateAnchor();
477 : : }
478 : :
479 : 0 : ScRange aDelRange;
480 : 0 : sal_Bool bOldDelMark = pViewData->GetDelMark( aDelRange );
481 : :
482 [ # # ][ # # ]: 0 : if ( nPosX+1 >= (SCsCOL) nStartX && nPosX <= (SCsCOL) nEndX &&
[ # # ][ # # ]
[ # # ][ # # ]
483 : : nPosY+1 >= (SCsROW) nStartY && nPosY <= (SCsROW) nEndY &&
484 : : ( nPosX != nEndX || nPosY != nEndY ) ) // verkleinern ?
485 : : {
486 : : // Richtung (links oder oben)
487 : :
488 : 0 : long nSizeX = 0;
489 [ # # ]: 0 : for (SCCOL i=nPosX+1; i<=nEndX; i++)
490 [ # # ]: 0 : nSizeX += pDoc->GetColWidth( i, nTab );
491 [ # # ]: 0 : long nSizeY = (long) pDoc->GetRowHeight( nPosY+1, nEndY, nTab );
492 : :
493 : 0 : SCCOL nDelStartX = nStartX;
494 : 0 : SCROW nDelStartY = nStartY;
495 [ # # ]: 0 : if ( nSizeX > nSizeY )
496 : 0 : nDelStartX = nPosX + 1;
497 : : else
498 : 0 : nDelStartY = nPosY + 1;
499 : : // 0 braucht nicht mehr getrennt abgefragt zu werden, weil nPosX/Y auch negativ wird
500 : :
501 [ # # ]: 0 : if ( nDelStartX < nStartX )
502 : 0 : nDelStartX = nStartX;
503 [ # # ]: 0 : if ( nDelStartY < nStartY )
504 : 0 : nDelStartY = nStartY;
505 : :
506 : : // Bereich setzen
507 : :
508 : : pViewData->SetDelMark( ScRange( nDelStartX,nDelStartY,nTab,
509 : 0 : nEndX,nEndY,nTab ) );
510 [ # # ]: 0 : pViewData->GetView()->UpdateShrinkOverlay();
511 : :
512 : 0 : pViewData->GetView()->
513 [ # # ]: 0 : PaintArea( nStartX,nDelStartY, nEndX,nEndY, SC_UPDATE_MARKS );
514 : :
515 : 0 : nPosX = nEndX; // roten Rahmen um ganzen Bereich lassen
516 : 0 : nPosY = nEndY;
517 : :
518 : : // Referenz wieder richtigherum, falls unten umgedreht
519 [ # # ][ # # ]: 0 : if ( nStartX != pViewData->GetRefStartX() || nStartY != pViewData->GetRefStartY() )
[ # # ]
520 : : {
521 [ # # ]: 0 : pViewData->GetView()->DoneRefMode();
522 [ # # ]: 0 : pViewData->GetView()->InitRefMode( nStartX, nStartY, nTab, SC_REFTYPE_FILL );
523 : 0 : }
524 : : }
525 : : else
526 : : {
527 [ # # ]: 0 : if ( bOldDelMark )
528 : : {
529 : 0 : pViewData->ResetDelMark();
530 [ # # ]: 0 : pViewData->GetView()->UpdateShrinkOverlay();
531 : : }
532 : :
533 : 0 : sal_Bool bNegX = ( nPosX < (SCsCOL) nStartX );
534 : 0 : sal_Bool bNegY = ( nPosY < (SCsROW) nStartY );
535 : :
536 : 0 : long nSizeX = 0;
537 [ # # ]: 0 : if ( bNegX )
538 : : {
539 : : // in SetCursorAtPoint hidden columns are skipped.
540 : : // They must be skipped here too, or the result will always be the first hidden column.
541 [ # # ][ # # ]: 0 : do ++nPosX; while ( nPosX<nStartX && pDoc->ColHidden(nPosX, nTab) );
[ # # ][ # # ]
542 [ # # ]: 0 : for (SCCOL i=nPosX; i<nStartX; i++)
543 [ # # ]: 0 : nSizeX += pDoc->GetColWidth( i, nTab );
544 : : }
545 : : else
546 [ # # ]: 0 : for (SCCOL i=nEndX+1; i<=nPosX; i++)
547 [ # # ]: 0 : nSizeX += pDoc->GetColWidth( i, nTab );
548 : :
549 : 0 : long nSizeY = 0;
550 [ # # ]: 0 : if ( bNegY )
551 : : {
552 : : // in SetCursorAtPoint hidden rows are skipped.
553 : : // They must be skipped here too, or the result will always be the first hidden row.
554 [ # # ]: 0 : if (++nPosY < nStartY)
555 : : {
556 [ # # ]: 0 : nPosY = pDoc->FirstVisibleRow(nPosY, nStartY-1, nTab);
557 [ # # ]: 0 : if (!ValidRow(nPosY))
558 : 0 : nPosY = nStartY;
559 : : }
560 [ # # ]: 0 : nSizeY += pDoc->GetRowHeight( nPosY, nStartY-1, nTab );
561 : : }
562 : : else
563 [ # # ]: 0 : nSizeY += pDoc->GetRowHeight( nEndY+1, nPosY, nTab );
564 : :
565 [ # # ]: 0 : if ( nSizeX > nSizeY ) // Fill immer nur in einer Richtung
566 : : {
567 : 0 : nPosY = nEndY;
568 : 0 : bNegY = false;
569 : : }
570 : : else
571 : : {
572 : 0 : nPosX = nEndX;
573 : 0 : bNegX = false;
574 : : }
575 : :
576 [ # # ]: 0 : SCCOL nRefStX = bNegX ? nEndX : nStartX;
577 [ # # ]: 0 : SCROW nRefStY = bNegY ? nEndY : nStartY;
578 [ # # ][ # # ]: 0 : if ( nRefStX != pViewData->GetRefStartX() || nRefStY != pViewData->GetRefStartY() )
[ # # ]
579 : : {
580 [ # # ]: 0 : pViewData->GetView()->DoneRefMode();
581 [ # # ]: 0 : pViewData->GetView()->InitRefMode( nRefStX, nRefStY, nTab, SC_REFTYPE_FILL );
582 : : }
583 : : }
584 : :
585 [ # # ]: 0 : pView->UpdateRef( nPosX, nPosY, nTab );
586 : : }
587 [ - + ]: 2 : else if (pViewData->IsAnyFillMode())
588 : : {
589 : 0 : sal_uInt8 nMode = pViewData->GetFillMode();
590 [ # # ][ # # ]: 0 : if ( nMode == SC_FILL_EMBED_LT || nMode == SC_FILL_EMBED_RB )
591 : : {
592 : : OSL_ENSURE( pDoc->IsEmbedded(), "!pDoc->IsEmbedded()" );
593 : 0 : ScRange aRange;
594 [ # # ]: 0 : pDoc->GetEmbedded( aRange);
595 [ # # ]: 0 : ScRefType eRefMode = (nMode == SC_FILL_EMBED_LT) ? SC_REFTYPE_EMBED_LT : SC_REFTYPE_EMBED_RB;
596 [ # # ]: 0 : if (pViewData->GetRefType() != eRefMode)
597 : : {
598 [ # # ]: 0 : if ( nMode == SC_FILL_EMBED_LT )
599 [ # # ]: 0 : pView->InitRefMode( aRange.aEnd.Col(), aRange.aEnd.Row(), nTab, eRefMode );
600 : : else
601 [ # # ]: 0 : pView->InitRefMode( aRange.aStart.Col(), aRange.aStart.Row(), nTab, eRefMode );
602 [ # # ]: 0 : CreateAnchor();
603 : : }
604 : :
605 [ # # ]: 0 : pView->UpdateRef( nPosX, nPosY, nTab );
606 : : }
607 [ # # ]: 0 : else if ( nMode == SC_FILL_MATRIX )
608 : : {
609 : : SCCOL nStartX, nEndX;
610 : : SCROW nStartY, nEndY; // Block
611 : : SCTAB nDummy;
612 [ # # ]: 0 : pViewData->GetSimpleArea( nStartX, nStartY, nDummy, nEndX, nEndY, nDummy );
613 : :
614 [ # # ]: 0 : if (pViewData->GetRefType() != SC_REFTYPE_FILL)
615 : : {
616 [ # # ]: 0 : pView->InitRefMode( nStartX, nStartY, nTab, SC_REFTYPE_FILL );
617 [ # # ]: 0 : CreateAnchor();
618 : : }
619 : :
620 [ # # ]: 0 : if ( nPosX < nStartX ) nPosX = nStartX;
621 [ # # ]: 0 : if ( nPosY < nStartY ) nPosY = nStartY;
622 : :
623 [ # # ]: 0 : pView->UpdateRef( nPosX, nPosY, nTab );
624 : : }
625 : : // else neue Modi
626 : : }
627 : : else // normales Markieren
628 : : {
629 : 0 : sal_Bool bHideCur = bAnchor && ( (SCCOL)nPosX != pViewData->GetCurX() ||
630 [ - + # # ]: 2 : (SCROW)nPosY != pViewData->GetCurY() );
[ # # ]
631 [ - + ]: 2 : if (bHideCur)
632 : 0 : pView->HideAllCursors(); // sonst zweimal: Block und SetCursor
633 : :
634 [ - + ]: 2 : if (bAnchor)
635 : : {
636 [ # # ]: 0 : if (!bStarted)
637 : : {
638 : 0 : sal_Bool bMove = ( nPosX != (SCsCOL) aAnchorPos.Col() ||
639 [ # # ][ # # ]: 0 : nPosY != (SCsROW) aAnchorPos.Row() );
640 [ # # ][ # # ]: 0 : if ( bMove || ( pEngine && pEngine->GetMouseEvent().IsShift() ) )
[ # # ][ # # ]
641 : : {
642 : 0 : pView->InitBlockMode( aAnchorPos.Col(), aAnchorPos.Row(),
643 : 0 : aAnchorPos.Tab(), sal_True );
644 : 0 : bStarted = sal_True;
645 : : }
646 : : }
647 [ # # ]: 0 : if (bStarted)
648 : : // If the selection is already started, don't set the cursor.
649 : 0 : pView->MarkCursor( (SCCOL) nPosX, (SCROW) nPosY, nTab, false, false, true );
650 : : else
651 : 0 : pView->SetCursor( (SCCOL) nPosX, (SCROW) nPosY );
652 : : }
653 : : else
654 : : {
655 : 2 : ScMarkData& rMark = pViewData->GetMarkData();
656 [ - + ][ - + ]: 2 : if (rMark.IsMarked() || rMark.IsMultiMarked())
[ + - ]
657 : : {
658 : 0 : pView->DoneBlockMode(sal_True);
659 : 0 : pView->InitBlockMode( nPosX, nPosY, nTab, sal_True );
660 : 0 : pView->MarkCursor( (SCCOL) nPosX, (SCROW) nPosY, nTab );
661 : :
662 : 0 : aAnchorPos.Set( nPosX, nPosY, nTab );
663 : 0 : bStarted = sal_True;
664 : : }
665 : : // #i3875# *Hack* When a new cell is Ctrl-clicked with no pre-selected cells,
666 : : // it highlights that new cell as well as the old cell where the cursor is
667 : : // positioned prior to the click. A selection mode via Shift-F8 should also
668 : : // follow the same behavior.
669 [ - + ]: 2 : else if ( pViewData->IsSelCtrlMouseClick() )
670 : : {
671 : 0 : SCCOL nOldX = pViewData->GetCurX();
672 : 0 : SCROW nOldY = pViewData->GetCurY();
673 : :
674 : 0 : pView->InitBlockMode( nOldX, nOldY, nTab, sal_True );
675 : 0 : pView->MarkCursor( (SCCOL) nOldX, (SCROW) nOldY, nTab );
676 : :
677 [ # # ][ # # ]: 0 : if ( nOldX != nPosX || nOldY != nPosY )
678 : : {
679 : 0 : pView->DoneBlockMode( sal_True );
680 : 0 : pView->InitBlockMode( nPosX, nPosY, nTab, sal_True );
681 : 0 : pView->MarkCursor( (SCCOL) nPosX, (SCROW) nPosY, nTab );
682 : 0 : aAnchorPos.Set( nPosX, nPosY, nTab );
683 : : }
684 : :
685 : 0 : bStarted = sal_True;
686 : : }
687 : 2 : pView->SetCursor( (SCCOL) nPosX, (SCROW) nPosY );
688 : : }
689 : :
690 : 2 : pViewData->SetRefStart( nPosX, nPosY, nTab );
691 [ - + ]: 2 : if (bHideCur)
692 : 0 : pView->ShowAllCursors();
693 : : }
694 : :
695 [ - + ]: 2 : if (bHide)
696 : 0 : pView->ShowAllCursors();
697 : :
698 : 2 : return sal_True;
699 : : }
700 : :
701 : 0 : sal_Bool ScViewFunctionSet::IsSelectionAtPoint( const Point& rPointPixel )
702 : : {
703 : 0 : sal_Bool bRefMode = SC_MOD()->IsFormulaMode();
704 [ # # ]: 0 : if (bRefMode)
705 : 0 : return false;
706 : :
707 [ # # ]: 0 : if (pViewData->IsAnyFillMode())
708 : 0 : return false;
709 : :
710 : 0 : ScMarkData& rMark = pViewData->GetMarkData();
711 [ # # ][ # # ]: 0 : if (bAnchor || !rMark.IsMultiMarked())
[ # # ]
712 : : {
713 : : SCsCOL nPosX;
714 : : SCsROW nPosY;
715 [ # # ]: 0 : pViewData->GetPosFromPixel( rPointPixel.X(), rPointPixel.Y(), GetWhich(), nPosX, nPosY );
716 [ # # ][ # # ]: 0 : return pViewData->GetMarkData().IsCellMarked( (SCCOL) nPosX, (SCROW) nPosY );
717 : : }
718 : :
719 : 0 : return false;
720 : : }
721 : :
722 : 0 : void ScViewFunctionSet::DeselectAtPoint( const Point& /* rPointPixel */ )
723 : : {
724 : : // gibt's nicht
725 : 0 : }
726 : :
727 : 20 : void ScViewFunctionSet::DeselectAll()
728 : : {
729 [ - + ]: 20 : if (pViewData->IsAnyFillMode())
730 : 20 : return;
731 : :
732 : 20 : sal_Bool bRefMode = SC_MOD()->IsFormulaMode();
733 [ - + ]: 20 : if (bRefMode)
734 : : {
735 : 0 : pViewData->GetView()->DoneRefMode( false );
736 : : }
737 : : else
738 : : {
739 : 20 : pViewData->GetView()->DoneBlockMode( false );
740 : 20 : pViewData->GetViewShell()->UpdateInputHandler();
741 : : }
742 : :
743 : 20 : bAnchor = false;
744 : : }
745 : :
746 : : //------------------------------------------------------------------------
747 : :
748 : 229 : ScViewSelectionEngine::ScViewSelectionEngine( Window* pWindow, ScTabView* pView,
749 : : ScSplitPos eSplitPos ) :
750 : 229 : SelectionEngine( pWindow, pView->GetFunctionSet() ),
751 : 229 : eWhich( eSplitPos )
752 : : {
753 : : // Parameter einstellen
754 [ + - ]: 229 : SetSelectionMode( MULTIPLE_SELECTION );
755 [ + - ]: 229 : EnableDrag( sal_True );
756 : 229 : }
757 : :
758 : :
759 : : //------------------------------------------------------------------------
760 : :
761 : : //
762 : : // Spalten- / Zeilenheader
763 : : //
764 : :
765 : 229 : ScHeaderFunctionSet::ScHeaderFunctionSet( ScViewData* pNewViewData ) :
766 : : pViewData( pNewViewData ),
767 : : bColumn( false ),
768 : : eWhich( SC_SPLIT_TOPLEFT ),
769 : : bAnchor( false ),
770 : 229 : nCursorPos( 0 )
771 : : {
772 : : OSL_ENSURE(pViewData, "ViewData==0 bei FunctionSet");
773 : 229 : }
774 : :
775 : 0 : void ScHeaderFunctionSet::SetColumn( sal_Bool bSet )
776 : : {
777 : 0 : bColumn = bSet;
778 : 0 : }
779 : :
780 : 0 : void ScHeaderFunctionSet::SetWhich( ScSplitPos eNew )
781 : : {
782 : 0 : eWhich = eNew;
783 : 0 : }
784 : :
785 : 0 : void ScHeaderFunctionSet::BeginDrag()
786 : : {
787 : : // gippsnich
788 : 0 : }
789 : :
790 : 0 : void ScHeaderFunctionSet::CreateAnchor()
791 : : {
792 [ # # ]: 0 : if (bAnchor)
793 : 0 : return;
794 : :
795 [ # # ]: 0 : ScTabView* pView = pViewData->GetView();
796 : 0 : pView->DoneBlockMode( sal_True );
797 [ # # ]: 0 : if (bColumn)
798 : : {
799 : 0 : pView->InitBlockMode( static_cast<SCCOL>(nCursorPos), 0, pViewData->GetTabNo(), sal_True, sal_True, false );
800 : 0 : pView->MarkCursor( static_cast<SCCOL>(nCursorPos), MAXROW, pViewData->GetTabNo() );
801 : : }
802 : : else
803 : : {
804 : 0 : pView->InitBlockMode( 0, nCursorPos, pViewData->GetTabNo(), sal_True, false, sal_True );
805 : 0 : pView->MarkCursor( MAXCOL, nCursorPos, pViewData->GetTabNo() );
806 : : }
807 : 0 : bAnchor = sal_True;
808 : : }
809 : :
810 : 0 : void ScHeaderFunctionSet::DestroyAnchor()
811 : : {
812 : 0 : pViewData->GetView()->DoneBlockMode( sal_True );
813 : 0 : bAnchor = false;
814 : 0 : }
815 : :
816 : 0 : sal_Bool ScHeaderFunctionSet::SetCursorAtPoint( const Point& rPointPixel, sal_Bool /* bDontSelectAtCursor */ )
817 : : {
818 [ # # ]: 0 : if ( bDidSwitch )
819 : : {
820 : : // die naechste gueltige Position muss vom anderen Fenster kommen
821 [ # # ]: 0 : if ( rPointPixel == aSwitchPos )
822 : 0 : return false; // nicht auf falschem Fenster scrollen
823 : : else
824 : 0 : bDidSwitch = false;
825 : : }
826 : :
827 : : // Scrolling
828 : :
829 [ # # ]: 0 : Size aWinSize = pViewData->GetActiveWin()->GetOutputSizePixel();
830 : : sal_Bool bScroll;
831 [ # # ]: 0 : if (bColumn)
832 [ # # ][ # # ]: 0 : bScroll = ( rPointPixel.X() < 0 || rPointPixel.X() >= aWinSize.Width() );
833 : : else
834 [ # # ][ # # ]: 0 : bScroll = ( rPointPixel.Y() < 0 || rPointPixel.Y() >= aWinSize.Height() );
835 : :
836 : : // ueber Fixier-Grenze bewegt?
837 : :
838 : 0 : sal_Bool bSwitched = false;
839 [ # # ]: 0 : if ( bColumn )
840 : : {
841 [ # # ]: 0 : if ( pViewData->GetHSplitMode() == SC_SPLIT_FIX )
842 : : {
843 [ # # ]: 0 : if ( rPointPixel.X() > aWinSize.Width() )
844 : : {
845 [ # # ]: 0 : if ( eWhich == SC_SPLIT_TOPLEFT )
846 [ # # ]: 0 : pViewData->GetView()->ActivatePart( SC_SPLIT_TOPRIGHT ), bSwitched = sal_True;
847 [ # # ]: 0 : else if ( eWhich == SC_SPLIT_BOTTOMLEFT )
848 [ # # ]: 0 : pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT ), bSwitched = sal_True;
849 : : }
850 : : }
851 : : }
852 : : else // Zeilenkoepfe
853 : : {
854 [ # # ]: 0 : if ( pViewData->GetVSplitMode() == SC_SPLIT_FIX )
855 : : {
856 [ # # ]: 0 : if ( rPointPixel.Y() > aWinSize.Height() )
857 : : {
858 [ # # ]: 0 : if ( eWhich == SC_SPLIT_TOPLEFT )
859 [ # # ]: 0 : pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMLEFT ), bSwitched = sal_True;
860 [ # # ]: 0 : else if ( eWhich == SC_SPLIT_TOPRIGHT )
861 [ # # ]: 0 : pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT ), bSwitched = sal_True;
862 : : }
863 : : }
864 : : }
865 [ # # ]: 0 : if (bSwitched)
866 : : {
867 : 0 : aSwitchPos = rPointPixel;
868 : 0 : bDidSwitch = sal_True;
869 : 0 : return false; // nicht mit falschen Positionen rechnen
870 : : }
871 : :
872 : : //
873 : :
874 : : SCsCOL nPosX;
875 : : SCsROW nPosY;
876 : : pViewData->GetPosFromPixel( rPointPixel.X(), rPointPixel.Y(), pViewData->GetActivePart(),
877 [ # # ]: 0 : nPosX, nPosY, false );
878 [ # # ]: 0 : if (bColumn)
879 : : {
880 : 0 : nCursorPos = static_cast<SCCOLROW>(nPosX);
881 : 0 : nPosY = pViewData->GetPosY(WhichV(pViewData->GetActivePart()));
882 : : }
883 : : else
884 : : {
885 : 0 : nCursorPos = static_cast<SCCOLROW>(nPosY);
886 : 0 : nPosX = pViewData->GetPosX(WhichH(pViewData->GetActivePart()));
887 : : }
888 : :
889 [ # # ]: 0 : ScTabView* pView = pViewData->GetView();
890 : 0 : sal_Bool bHide = pViewData->GetCurX() != nPosX ||
891 [ # # ][ # # ]: 0 : pViewData->GetCurY() != nPosY;
892 [ # # ]: 0 : if (bHide)
893 [ # # ]: 0 : pView->HideAllCursors();
894 : :
895 [ # # ]: 0 : if (bScroll)
896 [ # # ]: 0 : pView->AlignToCursor( nPosX, nPosY, SC_FOLLOW_LINE );
897 [ # # ]: 0 : pView->SetCursor( nPosX, nPosY );
898 : :
899 [ # # ][ # # ]: 0 : if ( !bAnchor || !pView->IsBlockMode() )
[ # # ][ # # ]
900 : : {
901 [ # # ]: 0 : pView->DoneBlockMode( sal_True );
902 [ # # ][ # # ]: 0 : pViewData->GetMarkData().MarkToMulti(); //! wer verstellt das ???
903 [ # # ]: 0 : pView->InitBlockMode( nPosX, nPosY, pViewData->GetTabNo(), sal_True, bColumn, !bColumn );
904 : :
905 : 0 : bAnchor = sal_True;
906 : : }
907 : :
908 [ # # ]: 0 : pView->MarkCursor( nPosX, nPosY, pViewData->GetTabNo(), bColumn, !bColumn );
909 : :
910 : : // SelectionChanged innerhalb von HideCursor wegen UpdateAutoFillMark
911 [ # # ]: 0 : pView->SelectionChanged();
912 : :
913 [ # # ]: 0 : if (bHide)
914 [ # # ]: 0 : pView->ShowAllCursors();
915 : :
916 : 0 : return sal_True;
917 : : }
918 : :
919 : 0 : sal_Bool ScHeaderFunctionSet::IsSelectionAtPoint( const Point& rPointPixel )
920 : : {
921 : : SCsCOL nPosX;
922 : : SCsROW nPosY;
923 : : pViewData->GetPosFromPixel( rPointPixel.X(), rPointPixel.Y(), pViewData->GetActivePart(),
924 [ # # ]: 0 : nPosX, nPosY, false );
925 : :
926 [ # # ]: 0 : ScMarkData& rMark = pViewData->GetMarkData();
927 [ # # ]: 0 : if (bColumn)
928 [ # # ]: 0 : return rMark.IsColumnMarked( nPosX );
929 : : else
930 [ # # ]: 0 : return rMark.IsRowMarked( nPosY );
931 : : }
932 : :
933 : 0 : void ScHeaderFunctionSet::DeselectAtPoint( const Point& /* rPointPixel */ )
934 : : {
935 : 0 : }
936 : :
937 : 0 : void ScHeaderFunctionSet::DeselectAll()
938 : : {
939 : 0 : pViewData->GetView()->DoneBlockMode( false );
940 : 0 : bAnchor = false;
941 : 0 : }
942 : :
943 : : //------------------------------------------------------------------------
944 : :
945 : 229 : ScHeaderSelectionEngine::ScHeaderSelectionEngine( Window* pWindow, ScHeaderFunctionSet* pFuncSet ) :
946 : 229 : SelectionEngine( pWindow, pFuncSet )
947 : : {
948 : : // Parameter einstellen
949 [ + - ]: 229 : SetSelectionMode( MULTIPLE_SELECTION );
950 [ + - ]: 229 : EnableDrag( false );
951 [ + - ][ + - ]: 382 : }
952 : :
953 : :
954 : :
955 : :
956 : :
957 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|