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 // System - Includes -----------------------------------------------------
28cdf0e10cSrcweir
29cdf0e10cSrcweir
30cdf0e10cSrcweir
31cdf0e10cSrcweir // INCLUDE ---------------------------------------------------------------
32cdf0e10cSrcweir #include <rangelst.hxx>
33cdf0e10cSrcweir #include "scitems.hxx"
34cdf0e10cSrcweir #include <editeng/eeitem.hxx>
35cdf0e10cSrcweir
36cdf0e10cSrcweir
37cdf0e10cSrcweir #include <editeng/brshitem.hxx>
38cdf0e10cSrcweir #include <editeng/editview.hxx>
39cdf0e10cSrcweir #include <svx/fmshell.hxx>
40cdf0e10cSrcweir #include <svx/svdoole2.hxx>
41cdf0e10cSrcweir #include <sfx2/bindings.hxx>
42cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
43cdf0e10cSrcweir #include <vcl/cursor.hxx>
44cdf0e10cSrcweir
45cdf0e10cSrcweir #include "tabview.hxx"
46cdf0e10cSrcweir #include "tabvwsh.hxx"
47cdf0e10cSrcweir #include "docsh.hxx"
48cdf0e10cSrcweir #include "gridwin.hxx"
49cdf0e10cSrcweir #include "olinewin.hxx"
50cdf0e10cSrcweir #include "colrowba.hxx"
51cdf0e10cSrcweir #include "tabcont.hxx"
52cdf0e10cSrcweir #include "scmod.hxx"
53cdf0e10cSrcweir #include "uiitems.hxx"
54cdf0e10cSrcweir #include "sc.hrc"
55cdf0e10cSrcweir #include "viewutil.hxx"
56cdf0e10cSrcweir #include "editutil.hxx"
57cdf0e10cSrcweir #include "inputhdl.hxx"
58cdf0e10cSrcweir #include "inputwin.hxx"
59cdf0e10cSrcweir #include "validat.hxx"
60cdf0e10cSrcweir #include "hintwin.hxx"
61cdf0e10cSrcweir #include "inputopt.hxx"
62cdf0e10cSrcweir #include "rfindlst.hxx"
63cdf0e10cSrcweir #include "hiranges.hxx"
64cdf0e10cSrcweir #include "viewuno.hxx"
65cdf0e10cSrcweir #include "chartarr.hxx"
66cdf0e10cSrcweir #include "anyrefdg.hxx"
67cdf0e10cSrcweir #include "dpobject.hxx"
68cdf0e10cSrcweir #include "patattr.hxx"
69cdf0e10cSrcweir #include "dociter.hxx"
70cdf0e10cSrcweir #include "seltrans.hxx"
71cdf0e10cSrcweir #include "fillinfo.hxx"
72cdf0e10cSrcweir #include "AccessibilityHints.hxx"
73cdf0e10cSrcweir #include "rangeutl.hxx"
74cdf0e10cSrcweir #include "client.hxx"
75cdf0e10cSrcweir #include "tabprotection.hxx"
76cdf0e10cSrcweir
77cdf0e10cSrcweir #include <com/sun/star/chart2/data/HighlightedRange.hpp>
78cdf0e10cSrcweir
79cdf0e10cSrcweir namespace
80cdf0e10cSrcweir {
81cdf0e10cSrcweir
lcl_getSubRangeByIndex(const ScRange & rRange,sal_Int32 nIndex)82cdf0e10cSrcweir ScRange lcl_getSubRangeByIndex( const ScRange& rRange, sal_Int32 nIndex )
83cdf0e10cSrcweir {
84cdf0e10cSrcweir ScAddress aResult( rRange.aStart );
85cdf0e10cSrcweir
86cdf0e10cSrcweir SCCOL nWidth = rRange.aEnd.Col() - rRange.aStart.Col() + 1;
87cdf0e10cSrcweir SCROW nHeight = rRange.aEnd.Row() - rRange.aStart.Row() + 1;
88cdf0e10cSrcweir SCTAB nDepth = rRange.aEnd.Tab() - rRange.aStart.Tab() + 1;
89cdf0e10cSrcweir if( (nWidth > 0) && (nHeight > 0) && (nDepth > 0) )
90cdf0e10cSrcweir {
91cdf0e10cSrcweir // row by row from first to last sheet
92cdf0e10cSrcweir sal_Int32 nArea = nWidth * nHeight;
93cdf0e10cSrcweir aResult.IncCol( static_cast< SCsCOL >( nIndex % nWidth ) );
94cdf0e10cSrcweir aResult.IncRow( static_cast< SCsROW >( (nIndex % nArea) / nWidth ) );
95cdf0e10cSrcweir aResult.IncTab( static_cast< SCsTAB >( nIndex / nArea ) );
96cdf0e10cSrcweir if( !rRange.In( aResult ) )
97cdf0e10cSrcweir aResult = rRange.aStart;
98cdf0e10cSrcweir }
99cdf0e10cSrcweir
100cdf0e10cSrcweir return ScRange( aResult );
101cdf0e10cSrcweir }
102cdf0e10cSrcweir
103cdf0e10cSrcweir } // anonymous namespace
104cdf0e10cSrcweir
105cdf0e10cSrcweir using namespace com::sun::star;
106cdf0e10cSrcweir
107cdf0e10cSrcweir // -----------------------------------------------------------------------
108cdf0e10cSrcweir
109cdf0e10cSrcweir //
110cdf0e10cSrcweir // --- Public-Funktionen
111cdf0e10cSrcweir //
112cdf0e10cSrcweir
ClickCursor(SCCOL nPosX,SCROW nPosY,sal_Bool bControl)113cdf0e10cSrcweir void ScTabView::ClickCursor( SCCOL nPosX, SCROW nPosY, sal_Bool bControl )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
116cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
117cdf0e10cSrcweir while (pDoc->IsHorOverlapped( nPosX, nPosY, nTab )) //! ViewData !!!
118cdf0e10cSrcweir --nPosX;
119cdf0e10cSrcweir while (pDoc->IsVerOverlapped( nPosX, nPosY, nTab ))
120cdf0e10cSrcweir --nPosY;
121cdf0e10cSrcweir
122cdf0e10cSrcweir sal_Bool bRefMode = SC_MOD()->IsFormulaMode();
123cdf0e10cSrcweir
124cdf0e10cSrcweir if ( bRefMode )
125cdf0e10cSrcweir {
126cdf0e10cSrcweir DoneRefMode( sal_False );
127cdf0e10cSrcweir
128cdf0e10cSrcweir if (bControl)
129cdf0e10cSrcweir SC_MOD()->AddRefEntry();
130cdf0e10cSrcweir
131cdf0e10cSrcweir InitRefMode( nPosX, nPosY, nTab, SC_REFTYPE_REF );
132cdf0e10cSrcweir }
133cdf0e10cSrcweir else
134cdf0e10cSrcweir {
135cdf0e10cSrcweir DoneBlockMode( bControl );
136cdf0e10cSrcweir aViewData.ResetOldCursor();
137cdf0e10cSrcweir SetCursor( (SCCOL) nPosX, (SCROW) nPosY );
138cdf0e10cSrcweir }
139cdf0e10cSrcweir }
140cdf0e10cSrcweir
UpdateAutoFillMark()141cdf0e10cSrcweir void ScTabView::UpdateAutoFillMark()
142cdf0e10cSrcweir {
143cdf0e10cSrcweir // single selection or cursor
144cdf0e10cSrcweir ScRange aMarkRange;
145cdf0e10cSrcweir sal_Bool bMarked = (aViewData.GetSimpleArea( aMarkRange ) == SC_MARK_SIMPLE);
146cdf0e10cSrcweir
147cdf0e10cSrcweir sal_uInt16 i;
148cdf0e10cSrcweir for (i=0; i<4; i++)
149cdf0e10cSrcweir if (pGridWin[i] && pGridWin[i]->IsVisible())
150cdf0e10cSrcweir pGridWin[i]->UpdateAutoFillMark( bMarked, aMarkRange );
151cdf0e10cSrcweir
152cdf0e10cSrcweir for (i=0; i<2; i++)
153cdf0e10cSrcweir {
154cdf0e10cSrcweir if (pColBar[i] && pColBar[i]->IsVisible())
155cdf0e10cSrcweir pColBar[i]->SetMark( bMarked, aMarkRange.aStart.Col(), aMarkRange.aEnd.Col() );
156cdf0e10cSrcweir if (pRowBar[i] && pRowBar[i]->IsVisible())
157cdf0e10cSrcweir pRowBar[i]->SetMark( bMarked, aMarkRange.aStart.Row(), aMarkRange.aEnd.Row() );
158cdf0e10cSrcweir }
159cdf0e10cSrcweir
160cdf0e10cSrcweir // selection transfer object is checked together with AutoFill marks,
161cdf0e10cSrcweir // because it has the same requirement of a single continuous block.
162cdf0e10cSrcweir CheckSelectionTransfer(); // update selection transfer object
163cdf0e10cSrcweir }
164cdf0e10cSrcweir
FakeButtonUp(ScSplitPos eWhich)165cdf0e10cSrcweir void ScTabView::FakeButtonUp( ScSplitPos eWhich )
166cdf0e10cSrcweir {
167cdf0e10cSrcweir if (pGridWin[eWhich])
168cdf0e10cSrcweir pGridWin[eWhich]->FakeButtonUp();
169cdf0e10cSrcweir }
170cdf0e10cSrcweir
HideAllCursors()171cdf0e10cSrcweir void ScTabView::HideAllCursors()
172cdf0e10cSrcweir {
173cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++)
174cdf0e10cSrcweir if (pGridWin[i])
175cdf0e10cSrcweir if (pGridWin[i]->IsVisible())
176cdf0e10cSrcweir {
177cdf0e10cSrcweir Cursor* pCur = pGridWin[i]->GetCursor();
178cdf0e10cSrcweir if (pCur)
179cdf0e10cSrcweir if (pCur->IsVisible())
180cdf0e10cSrcweir pCur->Hide();
181cdf0e10cSrcweir pGridWin[i]->HideCursor();
182cdf0e10cSrcweir }
183cdf0e10cSrcweir }
184cdf0e10cSrcweir
ShowAllCursors()185cdf0e10cSrcweir void ScTabView::ShowAllCursors()
186cdf0e10cSrcweir {
187cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++)
188cdf0e10cSrcweir if (pGridWin[i])
189cdf0e10cSrcweir if (pGridWin[i]->IsVisible())
190cdf0e10cSrcweir {
191cdf0e10cSrcweir pGridWin[i]->ShowCursor();
192cdf0e10cSrcweir
193cdf0e10cSrcweir // #114409#
194cdf0e10cSrcweir pGridWin[i]->CursorChanged();
195cdf0e10cSrcweir }
196cdf0e10cSrcweir }
197cdf0e10cSrcweir
HideCursor()198cdf0e10cSrcweir void ScTabView::HideCursor()
199cdf0e10cSrcweir {
200cdf0e10cSrcweir pGridWin[aViewData.GetActivePart()]->HideCursor();
201cdf0e10cSrcweir }
202cdf0e10cSrcweir
ShowCursor()203cdf0e10cSrcweir void ScTabView::ShowCursor()
204cdf0e10cSrcweir {
205cdf0e10cSrcweir pGridWin[aViewData.GetActivePart()]->ShowCursor();
206cdf0e10cSrcweir
207cdf0e10cSrcweir // #114409#
208cdf0e10cSrcweir pGridWin[aViewData.GetActivePart()]->CursorChanged();
209cdf0e10cSrcweir }
210cdf0e10cSrcweir
InvalidateAttribs()211cdf0e10cSrcweir void ScTabView::InvalidateAttribs()
212cdf0e10cSrcweir {
213cdf0e10cSrcweir SfxBindings& rBindings = aViewData.GetBindings();
214cdf0e10cSrcweir
215cdf0e10cSrcweir rBindings.Invalidate( SID_STYLE_APPLY );
216cdf0e10cSrcweir rBindings.Invalidate( SID_STYLE_FAMILY2 );
217cdf0e10cSrcweir // StarCalc kennt nur Absatz- bzw. Zellformat-Vorlagen
218cdf0e10cSrcweir
219cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_FONT );
220cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
221cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
222cdf0e10cSrcweir
223cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT );
224cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_POSTURE );
225cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE );
226cdf0e10cSrcweir rBindings.Invalidate( SID_ULINE_VAL_NONE );
227cdf0e10cSrcweir rBindings.Invalidate( SID_ULINE_VAL_SINGLE );
228cdf0e10cSrcweir rBindings.Invalidate( SID_ULINE_VAL_DOUBLE );
229cdf0e10cSrcweir rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
230cdf0e10cSrcweir
231cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE );
232cdf0e10cSrcweir
233512ec161SZheng Fan rBindings.Invalidate( SID_ATTR_CHAR_KERNING );
234512ec161SZheng Fan rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
235512ec161SZheng Fan rBindings.Invalidate( SID_SET_SUB_SCRIPT );
236512ec161SZheng Fan rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
237512ec161SZheng Fan rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED );
238512ec161SZheng Fan
239512ec161SZheng Fan rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT );
240512ec161SZheng Fan rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
241512ec161SZheng Fan rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
242512ec161SZheng Fan rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
243512ec161SZheng Fan rBindings.Invalidate( SID_NUMBER_TYPE_FORMAT);
244512ec161SZheng Fan
245cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNLEFT );
246cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNRIGHT );
247cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNBLOCK );
248cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNCENTERHOR );
249cdf0e10cSrcweir
250cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNTOP );
251cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNBOTTOM );
252cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNCENTERVER );
253cdf0e10cSrcweir
254facb16e7SArmin Le Grand // stuff for sidebar panels
255facb16e7SArmin Le Grand {
256facb16e7SArmin Le Grand rBindings.Invalidate( SID_H_ALIGNCELL );
257facb16e7SArmin Le Grand rBindings.Invalidate( SID_V_ALIGNCELL );
258facb16e7SArmin Le Grand rBindings.Invalidate( SID_ATTR_ALIGN_INDENT );
259facb16e7SArmin Le Grand rBindings.Invalidate( SID_FRAME_LINECOLOR );
260facb16e7SArmin Le Grand rBindings.Invalidate( SID_FRAME_LINESTYLE );
261facb16e7SArmin Le Grand rBindings.Invalidate( SID_ATTR_BORDER_OUTER );
262facb16e7SArmin Le Grand rBindings.Invalidate( SID_ATTR_BORDER_INNER );
263facb16e7SArmin Le Grand rBindings.Invalidate( SID_SCGRIDSHOW );
264facb16e7SArmin Le Grand rBindings.Invalidate( SID_ATTR_BORDER_DIAG_TLBR );
265facb16e7SArmin Le Grand rBindings.Invalidate( SID_ATTR_BORDER_DIAG_BLTR );
2664e8031e0SArmin Le Grand rBindings.Invalidate( SID_NUMBER_TYPE_FORMAT );
267facb16e7SArmin Le Grand }
268facb16e7SArmin Le Grand
269facb16e7SArmin Le Grand rBindings.Invalidate( SID_BACKGROUND_COLOR );
270cdf0e10cSrcweir
271cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_ALIGN_LINEBREAK );
272cdf0e10cSrcweir rBindings.Invalidate( SID_NUMBER_FORMAT );
273cdf0e10cSrcweir
274cdf0e10cSrcweir rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
275cdf0e10cSrcweir rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
276cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
277cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
278cdf0e10cSrcweir
279cdf0e10cSrcweir // pseudo slots for Format menu
280cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_HDEFAULT );
281cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_LEFT );
282cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_HCENTER );
283cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_RIGHT );
284cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED );
285cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_VDEFAULT );
286cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_TOP );
287cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_VCENTER );
288cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_BOTTOM );
289cdf0e10cSrcweir
290cdf0e10cSrcweir // rBindings.Invalidate( SID_RANGE_VALUE );
291cdf0e10cSrcweir // rBindings.Invalidate( SID_RANGE_FORMULA );
292cdf0e10cSrcweir }
293cdf0e10cSrcweir
294cdf0e10cSrcweir // SetCursor - Cursor setzen, zeichnen, InputWin updaten
295cdf0e10cSrcweir // oder Referenz verschicken
296cdf0e10cSrcweir // ohne Optimierung wegen BugId 29307
297cdf0e10cSrcweir
298cdf0e10cSrcweir #ifdef _MSC_VER
299cdf0e10cSrcweir #pragma optimize ( "", off )
300cdf0e10cSrcweir #endif
301cdf0e10cSrcweir
SetCursor(SCCOL nPosX,SCROW nPosY,sal_Bool bNew)302cdf0e10cSrcweir void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, sal_Bool bNew )
303cdf0e10cSrcweir {
304cdf0e10cSrcweir SCCOL nOldX = aViewData.GetCurX();
305cdf0e10cSrcweir SCROW nOldY = aViewData.GetCurY();
306cdf0e10cSrcweir
307cdf0e10cSrcweir // DeactivateIP nur noch bei MarkListHasChanged
308cdf0e10cSrcweir
309cdf0e10cSrcweir if ( nPosX != nOldX || nPosY != nOldY || bNew )
310cdf0e10cSrcweir {
311cdf0e10cSrcweir ScTabViewShell* pViewShell = aViewData.GetViewShell();
312cdf0e10cSrcweir bool bRefMode = ( pViewShell ? pViewShell->IsRefInputMode() : false );
313cdf0e10cSrcweir if ( aViewData.HasEditView( aViewData.GetActivePart() ) && !bRefMode ) // 23259 oder so
314cdf0e10cSrcweir {
315cdf0e10cSrcweir UpdateInputLine();
316cdf0e10cSrcweir }
317cdf0e10cSrcweir
318cdf0e10cSrcweir HideAllCursors();
319cdf0e10cSrcweir
320cdf0e10cSrcweir aViewData.SetCurX( nPosX );
321cdf0e10cSrcweir aViewData.SetCurY( nPosY );
322cdf0e10cSrcweir
323cdf0e10cSrcweir ShowAllCursors();
324cdf0e10cSrcweir
325cdf0e10cSrcweir CursorPosChanged();
326cdf0e10cSrcweir }
327cdf0e10cSrcweir }
328cdf0e10cSrcweir
329cdf0e10cSrcweir #ifdef _MSC_VER
330cdf0e10cSrcweir #pragma optimize ( "", on )
331cdf0e10cSrcweir #endif
332cdf0e10cSrcweir
CheckSelectionTransfer()333cdf0e10cSrcweir void ScTabView::CheckSelectionTransfer()
334cdf0e10cSrcweir {
335cdf0e10cSrcweir if ( aViewData.IsActive() ) // only for active view
336cdf0e10cSrcweir {
337cdf0e10cSrcweir ScModule* pScMod = SC_MOD();
338cdf0e10cSrcweir ScSelectionTransferObj* pOld = pScMod->GetSelectionTransfer();
339cdf0e10cSrcweir if ( pOld && pOld->GetView() == this && pOld->StillValid() )
340cdf0e10cSrcweir {
341cdf0e10cSrcweir // selection not changed - nothing to do
342cdf0e10cSrcweir }
343cdf0e10cSrcweir else
344cdf0e10cSrcweir {
345cdf0e10cSrcweir ScSelectionTransferObj* pNew = ScSelectionTransferObj::CreateFromView( this );
346cdf0e10cSrcweir if ( pNew )
347cdf0e10cSrcweir {
348cdf0e10cSrcweir // create new selection
349cdf0e10cSrcweir
350cdf0e10cSrcweir if (pOld)
351cdf0e10cSrcweir pOld->ForgetView();
352cdf0e10cSrcweir
353cdf0e10cSrcweir uno::Reference<datatransfer::XTransferable> xRef( pNew );
354cdf0e10cSrcweir pScMod->SetSelectionTransfer( pNew );
355cdf0e10cSrcweir pNew->CopyToSelection( GetActiveWin() ); // may delete pOld
356cdf0e10cSrcweir }
357cdf0e10cSrcweir else if ( pOld && pOld->GetView() == this )
358cdf0e10cSrcweir {
359cdf0e10cSrcweir // remove own selection
360cdf0e10cSrcweir
361cdf0e10cSrcweir pOld->ForgetView();
362cdf0e10cSrcweir pScMod->SetSelectionTransfer( NULL );
363cdf0e10cSrcweir TransferableHelper::ClearSelection( GetActiveWin() ); // may delete pOld
364cdf0e10cSrcweir }
365cdf0e10cSrcweir // else: selection from outside: leave unchanged
366cdf0e10cSrcweir }
367cdf0e10cSrcweir }
368cdf0e10cSrcweir }
369cdf0e10cSrcweir
370cdf0e10cSrcweir // Eingabezeile / Menues updaten
371cdf0e10cSrcweir // CursorPosChanged ruft SelectionChanged
372cdf0e10cSrcweir // SelectionChanged ruft CellContentChanged
373cdf0e10cSrcweir
CellContentChanged()374cdf0e10cSrcweir void ScTabView::CellContentChanged()
375cdf0e10cSrcweir {
376cdf0e10cSrcweir SfxBindings& rBindings = aViewData.GetBindings();
377cdf0e10cSrcweir
378cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_SIZE ); // -> Fehlermeldungen anzeigen
379cdf0e10cSrcweir rBindings.Invalidate( SID_THESAURUS );
380cdf0e10cSrcweir rBindings.Invalidate( SID_HYPERLINK_GETLINK );
381cdf0e10cSrcweir
382cdf0e10cSrcweir InvalidateAttribs(); // Attribut-Updates
383cdf0e10cSrcweir TestHintWindow(); // Eingabemeldung (Gueltigkeit)
384cdf0e10cSrcweir
385cdf0e10cSrcweir aViewData.GetViewShell()->UpdateInputHandler();
386cdf0e10cSrcweir }
387cdf0e10cSrcweir
SelectionChanged()388cdf0e10cSrcweir void ScTabView::SelectionChanged()
389cdf0e10cSrcweir {
390cdf0e10cSrcweir SfxViewFrame* pViewFrame = aViewData.GetViewShell()->GetViewFrame();
391cdf0e10cSrcweir if (pViewFrame)
392cdf0e10cSrcweir {
393cdf0e10cSrcweir uno::Reference<frame::XController> xController = pViewFrame->GetFrame().GetController();
394cdf0e10cSrcweir if (xController.is())
395cdf0e10cSrcweir {
396cdf0e10cSrcweir ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController );
397cdf0e10cSrcweir if (pImp)
398cdf0e10cSrcweir pImp->SelectionChanged();
399cdf0e10cSrcweir }
400cdf0e10cSrcweir }
401cdf0e10cSrcweir
402cdf0e10cSrcweir UpdateAutoFillMark(); // also calls CheckSelectionTransfer
403cdf0e10cSrcweir
404cdf0e10cSrcweir SfxBindings& rBindings = aViewData.GetBindings();
405cdf0e10cSrcweir
406cdf0e10cSrcweir rBindings.Invalidate( SID_CURRENTCELL ); // -> Navigator
407cdf0e10cSrcweir rBindings.Invalidate( SID_AUTO_FILTER ); // -> Menue
408cdf0e10cSrcweir rBindings.Invalidate( FID_NOTE_VISIBLE );
409cdf0e10cSrcweir rBindings.Invalidate( SID_DELETE_NOTE );
410cdf0e10cSrcweir
411cdf0e10cSrcweir // Funktionen, die evtl disabled werden muessen
412cdf0e10cSrcweir
413cdf0e10cSrcweir rBindings.Invalidate( FID_INS_ROWBRK );
414cdf0e10cSrcweir rBindings.Invalidate( FID_INS_COLBRK );
415cdf0e10cSrcweir rBindings.Invalidate( FID_DEL_ROWBRK );
416cdf0e10cSrcweir rBindings.Invalidate( FID_DEL_COLBRK );
417cdf0e10cSrcweir rBindings.Invalidate( FID_MERGE_ON );
418cdf0e10cSrcweir rBindings.Invalidate( FID_MERGE_OFF );
419cdf0e10cSrcweir rBindings.Invalidate( FID_MERGE_TOGGLE );
420cdf0e10cSrcweir rBindings.Invalidate( SID_AUTOFILTER_HIDE );
421cdf0e10cSrcweir rBindings.Invalidate( SID_UNFILTER );
422cdf0e10cSrcweir // rBindings.Invalidate( SID_IMPORT_DATA ); // jetzt wieder immer moeglich
423cdf0e10cSrcweir rBindings.Invalidate( SID_REIMPORT_DATA );
424cdf0e10cSrcweir rBindings.Invalidate( SID_REFRESH_DBAREA );
425cdf0e10cSrcweir rBindings.Invalidate( SID_OUTLINE_SHOW );
426cdf0e10cSrcweir rBindings.Invalidate( SID_OUTLINE_HIDE );
427cdf0e10cSrcweir rBindings.Invalidate( SID_OUTLINE_REMOVE );
428cdf0e10cSrcweir rBindings.Invalidate( FID_FILL_TO_BOTTOM );
429cdf0e10cSrcweir rBindings.Invalidate( FID_FILL_TO_RIGHT );
430cdf0e10cSrcweir rBindings.Invalidate( FID_FILL_TO_TOP );
431cdf0e10cSrcweir rBindings.Invalidate( FID_FILL_TO_LEFT );
432cdf0e10cSrcweir rBindings.Invalidate( FID_FILL_SERIES );
433cdf0e10cSrcweir rBindings.Invalidate( SID_SCENARIOS );
434cdf0e10cSrcweir rBindings.Invalidate( SID_AUTOFORMAT );
435cdf0e10cSrcweir rBindings.Invalidate( SID_OPENDLG_TABOP );
436cdf0e10cSrcweir rBindings.Invalidate( SID_DATA_SELECT );
437cdf0e10cSrcweir
438cdf0e10cSrcweir rBindings.Invalidate( SID_CUT );
439cdf0e10cSrcweir rBindings.Invalidate( SID_COPY );
440cdf0e10cSrcweir rBindings.Invalidate( SID_PASTE );
441cdf0e10cSrcweir rBindings.Invalidate( SID_PASTE_SPECIAL );
442cdf0e10cSrcweir
443cdf0e10cSrcweir rBindings.Invalidate( FID_INS_ROW );
444cdf0e10cSrcweir rBindings.Invalidate( FID_INS_COLUMN );
445cdf0e10cSrcweir rBindings.Invalidate( FID_INS_CELL );
446cdf0e10cSrcweir rBindings.Invalidate( FID_INS_CELLSDOWN );
447cdf0e10cSrcweir rBindings.Invalidate( FID_INS_CELLSRIGHT );
448cdf0e10cSrcweir
449cdf0e10cSrcweir rBindings.Invalidate( FID_CHG_COMMENT );
450cdf0e10cSrcweir
451cdf0e10cSrcweir // nur wegen Zellschutz:
452cdf0e10cSrcweir
453cdf0e10cSrcweir rBindings.Invalidate( SID_CELL_FORMAT_RESET );
454cdf0e10cSrcweir rBindings.Invalidate( SID_DELETE );
455cdf0e10cSrcweir rBindings.Invalidate( SID_DELETE_CONTENTS );
456cdf0e10cSrcweir rBindings.Invalidate( FID_DELETE_CELL );
457cdf0e10cSrcweir rBindings.Invalidate( FID_CELL_FORMAT );
458cdf0e10cSrcweir rBindings.Invalidate( SID_ENABLE_HYPHENATION );
459cdf0e10cSrcweir rBindings.Invalidate( SID_INSERT_POSTIT );
460cdf0e10cSrcweir rBindings.Invalidate( SID_CHARMAP );
461cdf0e10cSrcweir rBindings.Invalidate( SID_OPENDLG_FUNCTION );
462cdf0e10cSrcweir // rBindings.Invalidate( FID_CONDITIONAL_FORMAT );
463cdf0e10cSrcweir rBindings.Invalidate( SID_OPENDLG_CONDFRMT );
464cdf0e10cSrcweir rBindings.Invalidate( FID_VALIDATION );
465cdf0e10cSrcweir rBindings.Invalidate( SID_EXTERNAL_SOURCE );
466cdf0e10cSrcweir rBindings.Invalidate( SID_TEXT_TO_COLUMNS );
467cdf0e10cSrcweir rBindings.Invalidate( SID_SORT_ASCENDING );
468cdf0e10cSrcweir rBindings.Invalidate( SID_SORT_DESCENDING );
469cdf0e10cSrcweir
470cdf0e10cSrcweir if (aViewData.GetViewShell()->HasAccessibilityObjects())
471cdf0e10cSrcweir aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_CURSORCHANGED));
472cdf0e10cSrcweir
473cdf0e10cSrcweir CellContentChanged();
474cdf0e10cSrcweir }
475cdf0e10cSrcweir
CursorPosChanged()476cdf0e10cSrcweir void ScTabView::CursorPosChanged()
477cdf0e10cSrcweir {
478cdf0e10cSrcweir sal_Bool bRefMode = SC_MOD()->IsFormulaMode();
479cdf0e10cSrcweir if ( !bRefMode ) // Abfrage, damit RefMode bei Tabellenwechsel funktioniert
480cdf0e10cSrcweir aViewData.GetDocShell()->Broadcast( SfxSimpleHint( FID_KILLEDITVIEW ) );
481cdf0e10cSrcweir
482cdf0e10cSrcweir // Broadcast, damit andere Views des Dokuments auch umschalten
483cdf0e10cSrcweir
484cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
485cdf0e10cSrcweir bool bDP = NULL != pDoc->GetDPAtCursor(
486cdf0e10cSrcweir aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() );
487cdf0e10cSrcweir aViewData.GetViewShell()->SetPivotShell(bDP);
488cdf0e10cSrcweir
489cdf0e10cSrcweir // UpdateInputHandler jetzt in CellContentChanged
490cdf0e10cSrcweir
491cdf0e10cSrcweir SelectionChanged();
492cdf0e10cSrcweir
493cdf0e10cSrcweir aViewData.SetTabStartCol( SC_TABSTART_NONE );
494cdf0e10cSrcweir }
495cdf0e10cSrcweir
TestHintWindow()496cdf0e10cSrcweir void ScTabView::TestHintWindow()
497cdf0e10cSrcweir {
498cdf0e10cSrcweir // show input help window and list drop-down button for validity
499cdf0e10cSrcweir
500cdf0e10cSrcweir sal_Bool bListValButton = sal_False;
501cdf0e10cSrcweir ScAddress aListValPos;
502cdf0e10cSrcweir
503cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
504cdf0e10cSrcweir const SfxUInt32Item* pItem = (const SfxUInt32Item*)
505cdf0e10cSrcweir pDoc->GetAttr( aViewData.GetCurX(),
506cdf0e10cSrcweir aViewData.GetCurY(),
507cdf0e10cSrcweir aViewData.GetTabNo(),
508cdf0e10cSrcweir ATTR_VALIDDATA );
509cdf0e10cSrcweir if ( pItem->GetValue() )
510cdf0e10cSrcweir {
511cdf0e10cSrcweir const ScValidationData* pData = pDoc->GetValidationEntry( pItem->GetValue() );
512cdf0e10cSrcweir DBG_ASSERT(pData,"ValidationData nicht gefunden");
513cdf0e10cSrcweir String aTitle, aMessage;
514cdf0e10cSrcweir if ( pData && pData->GetInput( aTitle, aMessage ) && aMessage.Len() > 0 )
515cdf0e10cSrcweir {
516cdf0e10cSrcweir //! Abfrage, ob an gleicher Stelle !!!!
517cdf0e10cSrcweir
518cdf0e10cSrcweir DELETEZ(pInputHintWindow);
519cdf0e10cSrcweir
520cdf0e10cSrcweir ScSplitPos eWhich = aViewData.GetActivePart();
521cdf0e10cSrcweir Window* pWin = pGridWin[eWhich];
522cdf0e10cSrcweir SCCOL nCol = aViewData.GetCurX();
523cdf0e10cSrcweir SCROW nRow = aViewData.GetCurY();
524cdf0e10cSrcweir Point aPos = aViewData.GetScrPos( nCol, nRow, eWhich );
525cdf0e10cSrcweir Size aWinSize = pWin->GetOutputSizePixel();
526cdf0e10cSrcweir // Cursor sichtbar?
527cdf0e10cSrcweir if ( nCol >= aViewData.GetPosX(WhichH(eWhich)) &&
528cdf0e10cSrcweir nRow >= aViewData.GetPosY(WhichV(eWhich)) &&
529cdf0e10cSrcweir aPos.X() < aWinSize.Width() && aPos.Y() < aWinSize.Height() )
530cdf0e10cSrcweir {
531cdf0e10cSrcweir aPos += pWin->GetPosPixel(); // Position auf Frame
532cdf0e10cSrcweir long nSizeXPix;
533cdf0e10cSrcweir long nSizeYPix;
534cdf0e10cSrcweir aViewData.GetMergeSizePixel( nCol, nRow, nSizeXPix, nSizeYPix );
535cdf0e10cSrcweir
536cdf0e10cSrcweir // HintWindow anlegen, bestimmt seine Groesse selbst
537cdf0e10cSrcweir pInputHintWindow = new ScHintWindow( pFrameWin, aTitle, aMessage );
538cdf0e10cSrcweir Size aHintSize = pInputHintWindow->GetSizePixel();
539cdf0e10cSrcweir Size aFrameWinSize = pFrameWin->GetOutputSizePixel();
540cdf0e10cSrcweir
541cdf0e10cSrcweir // passende Position finden
542cdf0e10cSrcweir // erster Versuch: unter dem Cursor
543cdf0e10cSrcweir Point aHintPos( aPos.X() + nSizeXPix / 2, aPos.Y() + nSizeYPix + 3 );
544cdf0e10cSrcweir if ( aHintPos.Y() + aHintSize.Height() > aFrameWinSize.Height() )
545cdf0e10cSrcweir {
546cdf0e10cSrcweir // zweiter Versuch: rechts vom Cursor
547cdf0e10cSrcweir aHintPos = Point( aPos.X() + nSizeXPix + 3, aPos.Y() + nSizeYPix / 2 );
548cdf0e10cSrcweir if ( aHintPos.X() + aHintSize.Width() > aFrameWinSize.Width() )
549cdf0e10cSrcweir {
550cdf0e10cSrcweir // dritter Versuch: ueber dem Cursor
551cdf0e10cSrcweir aHintPos = Point( aPos.X() + nSizeXPix / 2,
552cdf0e10cSrcweir aPos.Y() - aHintSize.Height() - 3 );
553cdf0e10cSrcweir if ( aHintPos.Y() < 0 )
554cdf0e10cSrcweir {
555cdf0e10cSrcweir // oben und unten kein Platz - dann Default und abschneiden
556cdf0e10cSrcweir aHintPos = Point( aPos.X() + nSizeXPix / 2, aPos.Y() + nSizeYPix + 3 );
557cdf0e10cSrcweir aHintSize.Height() = aFrameWinSize.Height() - aHintPos.Y();
558cdf0e10cSrcweir pInputHintWindow->SetSizePixel( aHintSize );
559cdf0e10cSrcweir }
560cdf0e10cSrcweir }
561cdf0e10cSrcweir }
562cdf0e10cSrcweir
563cdf0e10cSrcweir // X anpassen
564cdf0e10cSrcweir if ( aHintPos.X() + aHintSize.Width() > aFrameWinSize.Width() )
565cdf0e10cSrcweir aHintPos.X() = aFrameWinSize.Width() - aHintSize.Width();
566cdf0e10cSrcweir // Y anpassen
567cdf0e10cSrcweir if ( aHintPos.Y() + aHintSize.Height() > aFrameWinSize.Height() )
568cdf0e10cSrcweir aHintPos.Y() = aFrameWinSize.Height() - aHintSize.Height();
569cdf0e10cSrcweir
570cdf0e10cSrcweir pInputHintWindow->SetPosPixel( aHintPos );
571cdf0e10cSrcweir pInputHintWindow->ToTop();
572cdf0e10cSrcweir pInputHintWindow->Show();
573cdf0e10cSrcweir }
574cdf0e10cSrcweir }
575cdf0e10cSrcweir else
576cdf0e10cSrcweir DELETEZ(pInputHintWindow);
577cdf0e10cSrcweir
578cdf0e10cSrcweir // list drop-down button
579cdf0e10cSrcweir if ( pData && pData->HasSelectionList() )
580cdf0e10cSrcweir {
581cdf0e10cSrcweir aListValPos.Set( aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() );
582cdf0e10cSrcweir bListValButton = sal_True;
583cdf0e10cSrcweir }
584cdf0e10cSrcweir }
585cdf0e10cSrcweir else
586cdf0e10cSrcweir DELETEZ(pInputHintWindow);
587cdf0e10cSrcweir
588cdf0e10cSrcweir for ( sal_uInt16 i=0; i<4; i++ )
589cdf0e10cSrcweir if ( pGridWin[i] && pGridWin[i]->IsVisible() )
590cdf0e10cSrcweir pGridWin[i]->UpdateListValPos( bListValButton, aListValPos );
591cdf0e10cSrcweir }
592cdf0e10cSrcweir
RemoveHintWindow()593cdf0e10cSrcweir void ScTabView::RemoveHintWindow()
594cdf0e10cSrcweir {
595cdf0e10cSrcweir DELETEZ(pInputHintWindow);
596cdf0e10cSrcweir }
597cdf0e10cSrcweir
598cdf0e10cSrcweir
599cdf0e10cSrcweir // find window that should not be over the cursor
lcl_GetCareWin(SfxViewFrame * pViewFrm)600cdf0e10cSrcweir Window* lcl_GetCareWin(SfxViewFrame* pViewFrm)
601cdf0e10cSrcweir {
602cdf0e10cSrcweir //! auch Spelling ??? (dann beim Aufruf Membervariable setzen)
603cdf0e10cSrcweir
604cdf0e10cSrcweir // Suchen & Ersetzen
605cdf0e10cSrcweir if ( pViewFrm->HasChildWindow(SID_SEARCH_DLG) )
606cdf0e10cSrcweir {
607cdf0e10cSrcweir SfxChildWindow* pChild = pViewFrm->GetChildWindow(SID_SEARCH_DLG);
608cdf0e10cSrcweir if (pChild)
609cdf0e10cSrcweir {
610cdf0e10cSrcweir Window* pWin = pChild->GetWindow();
611cdf0e10cSrcweir if (pWin && pWin->IsVisible())
612cdf0e10cSrcweir return pWin;
613cdf0e10cSrcweir }
614cdf0e10cSrcweir }
615cdf0e10cSrcweir
616cdf0e10cSrcweir // Aenderungen uebernehmen
617cdf0e10cSrcweir if ( pViewFrm->HasChildWindow(FID_CHG_ACCEPT) )
618cdf0e10cSrcweir {
619cdf0e10cSrcweir SfxChildWindow* pChild = pViewFrm->GetChildWindow(FID_CHG_ACCEPT);
620cdf0e10cSrcweir if (pChild)
621cdf0e10cSrcweir {
622cdf0e10cSrcweir Window* pWin = pChild->GetWindow();
623cdf0e10cSrcweir if (pWin && pWin->IsVisible())
624cdf0e10cSrcweir return pWin;
625cdf0e10cSrcweir }
626cdf0e10cSrcweir }
627cdf0e10cSrcweir
628cdf0e10cSrcweir return NULL;
629cdf0e10cSrcweir }
630cdf0e10cSrcweir
631cdf0e10cSrcweir //
632cdf0e10cSrcweir // Bildschirm an Cursorposition anpassen
633cdf0e10cSrcweir //
634cdf0e10cSrcweir
AlignToCursor(SCsCOL nCurX,SCsROW nCurY,ScFollowMode eMode,const ScSplitPos * pWhich)635cdf0e10cSrcweir void ScTabView::AlignToCursor( SCsCOL nCurX, SCsROW nCurY, ScFollowMode eMode,
636cdf0e10cSrcweir const ScSplitPos* pWhich )
637cdf0e10cSrcweir {
638cdf0e10cSrcweir //
639cdf0e10cSrcweir // aktiven Teil umschalten jetzt hier
640cdf0e10cSrcweir //
641cdf0e10cSrcweir
642cdf0e10cSrcweir ScSplitPos eActive = aViewData.GetActivePart();
643cdf0e10cSrcweir ScHSplitPos eActiveX = WhichH(eActive);
644cdf0e10cSrcweir ScVSplitPos eActiveY = WhichV(eActive);
645cdf0e10cSrcweir sal_Bool bHFix = (aViewData.GetHSplitMode() == SC_SPLIT_FIX);
646cdf0e10cSrcweir sal_Bool bVFix = (aViewData.GetVSplitMode() == SC_SPLIT_FIX);
647cdf0e10cSrcweir if (bHFix)
648cdf0e10cSrcweir if (eActiveX == SC_SPLIT_LEFT && nCurX >= (SCsCOL)aViewData.GetFixPosX())
649cdf0e10cSrcweir {
650cdf0e10cSrcweir ActivatePart( (eActiveY==SC_SPLIT_TOP) ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT );
651cdf0e10cSrcweir eActiveX = SC_SPLIT_RIGHT;
652cdf0e10cSrcweir }
653cdf0e10cSrcweir if (bVFix)
654cdf0e10cSrcweir if (eActiveY == SC_SPLIT_TOP && nCurY >= (SCsROW)aViewData.GetFixPosY())
655cdf0e10cSrcweir {
656cdf0e10cSrcweir ActivatePart( (eActiveX==SC_SPLIT_LEFT) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT );
657cdf0e10cSrcweir eActiveY = SC_SPLIT_BOTTOM;
658cdf0e10cSrcweir }
659cdf0e10cSrcweir
660cdf0e10cSrcweir //
661cdf0e10cSrcweir // eigentliches Align
662cdf0e10cSrcweir //
663cdf0e10cSrcweir
664cdf0e10cSrcweir if ( eMode != SC_FOLLOW_NONE )
665cdf0e10cSrcweir {
666cdf0e10cSrcweir ScSplitPos eAlign;
667cdf0e10cSrcweir if (pWhich)
668cdf0e10cSrcweir eAlign = *pWhich;
669cdf0e10cSrcweir else
670cdf0e10cSrcweir eAlign = aViewData.GetActivePart();
671cdf0e10cSrcweir ScHSplitPos eAlignX = WhichH(eAlign);
672cdf0e10cSrcweir ScVSplitPos eAlignY = WhichV(eAlign);
673cdf0e10cSrcweir
674cdf0e10cSrcweir SCsCOL nDeltaX = (SCsCOL) aViewData.GetPosX(eAlignX);
675cdf0e10cSrcweir SCsROW nDeltaY = (SCsROW) aViewData.GetPosY(eAlignY);
676cdf0e10cSrcweir SCsCOL nSizeX = (SCsCOL) aViewData.VisibleCellsX(eAlignX);
677cdf0e10cSrcweir SCsROW nSizeY = (SCsROW) aViewData.VisibleCellsY(eAlignY);
678cdf0e10cSrcweir
679cdf0e10cSrcweir long nCellSizeX;
680cdf0e10cSrcweir long nCellSizeY;
681cdf0e10cSrcweir if ( nCurX >= 0 && nCurY >= 0 )
682cdf0e10cSrcweir aViewData.GetMergeSizePixel( (SCCOL)nCurX, (SCROW)nCurY, nCellSizeX, nCellSizeY );
683cdf0e10cSrcweir else
684cdf0e10cSrcweir nCellSizeX = nCellSizeY = 0;
685cdf0e10cSrcweir Size aScrSize = aViewData.GetScrSize();
686cdf0e10cSrcweir long nSpaceX = ( aScrSize.Width() - nCellSizeX ) / 2;
687cdf0e10cSrcweir long nSpaceY = ( aScrSize.Height() - nCellSizeY ) / 2;
688cdf0e10cSrcweir // nSpaceY: desired start position of cell for FOLLOW_JUMP, modified if dialog interferes
689cdf0e10cSrcweir
690cdf0e10cSrcweir sal_Bool bForceNew = sal_False; // force new calculation of JUMP position (vertical only)
691cdf0e10cSrcweir
692cdf0e10cSrcweir // VisibleCellsY == CellsAtY( GetPosY( eWhichY ), 1, eWhichY )
693cdf0e10cSrcweir
694cdf0e10cSrcweir //-------------------------------------------------------------------------------
695cdf0e10cSrcweir // falls z.B. Suchen-Dialog offen ist, Cursor nicht hinter den Dialog stellen
696cdf0e10cSrcweir // wenn moeglich, die Zeile mit dem Cursor oberhalb oder unterhalb des Dialogs
697cdf0e10cSrcweir
698cdf0e10cSrcweir //! nicht, wenn schon komplett sichtbar
699cdf0e10cSrcweir
700cdf0e10cSrcweir if ( eMode == SC_FOLLOW_JUMP )
701cdf0e10cSrcweir {
702cdf0e10cSrcweir Window* pCare = lcl_GetCareWin( aViewData.GetViewShell()->GetViewFrame() );
703cdf0e10cSrcweir if (pCare)
704cdf0e10cSrcweir {
705cdf0e10cSrcweir sal_Bool bLimit = sal_False;
706cdf0e10cSrcweir Rectangle aDlgPixel;
707cdf0e10cSrcweir Size aWinSize;
708cdf0e10cSrcweir Window* pWin = GetActiveWin();
709cdf0e10cSrcweir if (pWin)
710cdf0e10cSrcweir {
711cdf0e10cSrcweir aDlgPixel = pCare->GetWindowExtentsRelative( pWin );
712cdf0e10cSrcweir aWinSize = pWin->GetOutputSizePixel();
713cdf0e10cSrcweir // ueberdeckt der Dialog das GridWin?
714cdf0e10cSrcweir if ( aDlgPixel.Right() >= 0 && aDlgPixel.Left() < aWinSize.Width() )
715cdf0e10cSrcweir {
716cdf0e10cSrcweir if ( nCurX < nDeltaX || nCurX >= nDeltaX+nSizeX ||
717cdf0e10cSrcweir nCurY < nDeltaY || nCurY >= nDeltaY+nSizeY )
718cdf0e10cSrcweir bLimit = sal_True; // es wird sowieso gescrollt
719cdf0e10cSrcweir else
720cdf0e10cSrcweir {
721cdf0e10cSrcweir // Cursor ist auf dem Bildschirm
722cdf0e10cSrcweir Point aStart = aViewData.GetScrPos( nCurX, nCurY, eAlign );
723cdf0e10cSrcweir long nCSX, nCSY;
724cdf0e10cSrcweir aViewData.GetMergeSizePixel( nCurX, nCurY, nCSX, nCSY );
725cdf0e10cSrcweir Rectangle aCursor( aStart, Size( nCSX, nCSY ) );
726cdf0e10cSrcweir if ( aCursor.IsOver( aDlgPixel ) )
727cdf0e10cSrcweir bLimit = sal_True; // Zelle vom Dialog ueberdeckt
728cdf0e10cSrcweir }
729cdf0e10cSrcweir }
730cdf0e10cSrcweir }
731cdf0e10cSrcweir
732cdf0e10cSrcweir if (bLimit)
733cdf0e10cSrcweir {
734cdf0e10cSrcweir sal_Bool bBottom = sal_False;
735cdf0e10cSrcweir long nTopSpace = aDlgPixel.Top();
736cdf0e10cSrcweir long nBotSpace = aWinSize.Height() - aDlgPixel.Bottom();
737cdf0e10cSrcweir if ( nBotSpace > 0 && nBotSpace > nTopSpace )
738cdf0e10cSrcweir {
739cdf0e10cSrcweir long nDlgBot = aDlgPixel.Bottom();
740cdf0e10cSrcweir SCsCOL nWPosX;
741cdf0e10cSrcweir SCsROW nWPosY;
742cdf0e10cSrcweir aViewData.GetPosFromPixel( 0,nDlgBot, eAlign, nWPosX, nWPosY );
743cdf0e10cSrcweir ++nWPosY; // unter der letzten betroffenen Zelle
744cdf0e10cSrcweir
745cdf0e10cSrcweir SCsROW nDiff = nWPosY - nDeltaY;
746cdf0e10cSrcweir if ( nCurY >= nDiff ) // Pos. kann nicht negativ werden
747cdf0e10cSrcweir {
748cdf0e10cSrcweir nSpaceY = nDlgBot + ( nBotSpace - nCellSizeY ) / 2;
749cdf0e10cSrcweir bBottom = sal_True;
750cdf0e10cSrcweir bForceNew = sal_True;
751cdf0e10cSrcweir }
752cdf0e10cSrcweir }
753cdf0e10cSrcweir if ( !bBottom && nTopSpace > 0 )
754cdf0e10cSrcweir {
755cdf0e10cSrcweir nSpaceY = ( nTopSpace - nCellSizeY ) / 2;
756cdf0e10cSrcweir bForceNew = sal_True;
757cdf0e10cSrcweir }
758cdf0e10cSrcweir }
759cdf0e10cSrcweir }
760cdf0e10cSrcweir }
761cdf0e10cSrcweir //-------------------------------------------------------------------------------
762cdf0e10cSrcweir
763cdf0e10cSrcweir SCsCOL nNewDeltaX = nDeltaX;
764cdf0e10cSrcweir SCsROW nNewDeltaY = nDeltaY;
765cdf0e10cSrcweir sal_Bool bDoLine = sal_False;
766cdf0e10cSrcweir
767cdf0e10cSrcweir switch (eMode)
768cdf0e10cSrcweir {
769cdf0e10cSrcweir case SC_FOLLOW_JUMP:
770cdf0e10cSrcweir if ( nCurX < nDeltaX || nCurX >= nDeltaX+nSizeX )
771cdf0e10cSrcweir {
772cdf0e10cSrcweir nNewDeltaX = nCurX - static_cast<SCsCOL>(aViewData.CellsAtX( nCurX, -1, eAlignX, static_cast<sal_uInt16>(nSpaceX) ));
773cdf0e10cSrcweir if (nNewDeltaX < 0) nNewDeltaX = 0;
774cdf0e10cSrcweir nSizeX = (SCsCOL) aViewData.CellsAtX( nNewDeltaX, 1, eAlignX );
775cdf0e10cSrcweir }
776cdf0e10cSrcweir if ( nCurY < nDeltaY || nCurY >= nDeltaY+nSizeY || bForceNew )
777cdf0e10cSrcweir {
778cdf0e10cSrcweir nNewDeltaY = nCurY - static_cast<SCsROW>(aViewData.CellsAtY( nCurY, -1, eAlignY, static_cast<sal_uInt16>(nSpaceY) ));
779cdf0e10cSrcweir if (nNewDeltaY < 0) nNewDeltaY = 0;
780cdf0e10cSrcweir nSizeY = (SCsROW) aViewData.CellsAtY( nNewDeltaY, 1, eAlignY );
781cdf0e10cSrcweir }
782cdf0e10cSrcweir bDoLine = sal_True;
783cdf0e10cSrcweir break;
784cdf0e10cSrcweir
785cdf0e10cSrcweir case SC_FOLLOW_LINE:
786cdf0e10cSrcweir bDoLine = sal_True;
787cdf0e10cSrcweir break;
788cdf0e10cSrcweir
789cdf0e10cSrcweir case SC_FOLLOW_FIX:
790cdf0e10cSrcweir if ( nCurX < nDeltaX || nCurX >= nDeltaX+nSizeX )
791cdf0e10cSrcweir {
792cdf0e10cSrcweir nNewDeltaX = nDeltaX + nCurX - aViewData.GetCurX();
793cdf0e10cSrcweir if (nNewDeltaX < 0) nNewDeltaX = 0;
794cdf0e10cSrcweir nSizeX = (SCsCOL) aViewData.CellsAtX( nNewDeltaX, 1, eAlignX );
795cdf0e10cSrcweir }
796cdf0e10cSrcweir if ( nCurY < nDeltaY || nCurY >= nDeltaY+nSizeY )
797cdf0e10cSrcweir {
798cdf0e10cSrcweir nNewDeltaY = nDeltaY + nCurY - aViewData.GetCurY();
799cdf0e10cSrcweir if (nNewDeltaY < 0) nNewDeltaY = 0;
800cdf0e10cSrcweir nSizeY = (SCsROW) aViewData.CellsAtY( nNewDeltaY, 1, eAlignY );
801cdf0e10cSrcweir }
802cdf0e10cSrcweir
803cdf0e10cSrcweir // like old version of SC_FOLLOW_JUMP:
804cdf0e10cSrcweir
805cdf0e10cSrcweir if ( nCurX < nNewDeltaX || nCurX >= nNewDeltaX+nSizeX )
806cdf0e10cSrcweir {
807cdf0e10cSrcweir nNewDeltaX = nCurX - (nSizeX / 2);
808cdf0e10cSrcweir if (nNewDeltaX < 0) nNewDeltaX = 0;
809cdf0e10cSrcweir nSizeX = (SCsCOL) aViewData.CellsAtX( nNewDeltaX, 1, eAlignX );
810cdf0e10cSrcweir }
811cdf0e10cSrcweir if ( nCurY < nNewDeltaY || nCurY >= nNewDeltaY+nSizeY )
812cdf0e10cSrcweir {
813cdf0e10cSrcweir nNewDeltaY = nCurY - (nSizeY / 2);
814cdf0e10cSrcweir if (nNewDeltaY < 0) nNewDeltaY = 0;
815cdf0e10cSrcweir nSizeY = (SCsROW) aViewData.CellsAtY( nNewDeltaY, 1, eAlignY );
816cdf0e10cSrcweir }
817cdf0e10cSrcweir
818cdf0e10cSrcweir bDoLine = sal_True;
819cdf0e10cSrcweir break;
820cdf0e10cSrcweir
821cdf0e10cSrcweir case SC_FOLLOW_NONE:
822cdf0e10cSrcweir break;
823cdf0e10cSrcweir default:
824cdf0e10cSrcweir DBG_ERROR("Falscher Cursormodus");
825cdf0e10cSrcweir break;
826cdf0e10cSrcweir }
827cdf0e10cSrcweir
828cdf0e10cSrcweir if (bDoLine)
829cdf0e10cSrcweir {
830cdf0e10cSrcweir while ( nCurX >= nNewDeltaX+nSizeX )
831cdf0e10cSrcweir {
832cdf0e10cSrcweir nNewDeltaX = nCurX-nSizeX+1;
833cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
834cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
835cdf0e10cSrcweir while ( nNewDeltaX < MAXCOL && !pDoc->GetColWidth( nNewDeltaX, nTab ) )
836cdf0e10cSrcweir ++nNewDeltaX;
837cdf0e10cSrcweir nSizeX = (SCsCOL) aViewData.CellsAtX( nNewDeltaX, 1, eAlignX );
838cdf0e10cSrcweir }
839cdf0e10cSrcweir while ( nCurY >= nNewDeltaY+nSizeY )
840cdf0e10cSrcweir {
841cdf0e10cSrcweir nNewDeltaY = nCurY-nSizeY+1;
842cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
843cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
844cdf0e10cSrcweir while ( nNewDeltaY < MAXROW && !pDoc->GetRowHeight( nNewDeltaY, nTab ) )
845cdf0e10cSrcweir ++nNewDeltaY;
846cdf0e10cSrcweir nSizeY = (SCsROW) aViewData.CellsAtY( nNewDeltaY, 1, eAlignY );
847cdf0e10cSrcweir }
848cdf0e10cSrcweir if ( nCurX < nNewDeltaX ) nNewDeltaX = nCurX;
849cdf0e10cSrcweir if ( nCurY < nNewDeltaY ) nNewDeltaY = nCurY;
850cdf0e10cSrcweir }
851cdf0e10cSrcweir
852cdf0e10cSrcweir if ( nNewDeltaX != nDeltaX )
853cdf0e10cSrcweir nSizeX = (SCsCOL) aViewData.CellsAtX( nNewDeltaX, 1, eAlignX );
854cdf0e10cSrcweir if (nNewDeltaX+nSizeX-1 > MAXCOL) nNewDeltaX = MAXCOL-nSizeX+1;
855cdf0e10cSrcweir if (nNewDeltaX < 0) nNewDeltaX = 0;
856cdf0e10cSrcweir
857cdf0e10cSrcweir if ( nNewDeltaY != nDeltaY )
858cdf0e10cSrcweir nSizeY = (SCsROW) aViewData.CellsAtY( nNewDeltaY, 1, eAlignY );
859cdf0e10cSrcweir if (nNewDeltaY+nSizeY-1 > MAXROW) nNewDeltaY = MAXROW-nSizeY+1;
860cdf0e10cSrcweir if (nNewDeltaY < 0) nNewDeltaY = 0;
861cdf0e10cSrcweir
862cdf0e10cSrcweir if ( nNewDeltaX != nDeltaX ) ScrollX( nNewDeltaX - nDeltaX, eAlignX );
863cdf0e10cSrcweir if ( nNewDeltaY != nDeltaY ) ScrollY( nNewDeltaY - nDeltaY, eAlignY );
864cdf0e10cSrcweir }
865cdf0e10cSrcweir
866cdf0e10cSrcweir //
867cdf0e10cSrcweir // nochmal aktiven Teil umschalten
868cdf0e10cSrcweir //
869cdf0e10cSrcweir
870cdf0e10cSrcweir if (bHFix)
871cdf0e10cSrcweir if (eActiveX == SC_SPLIT_RIGHT && nCurX < (SCsCOL)aViewData.GetFixPosX())
872cdf0e10cSrcweir {
873cdf0e10cSrcweir ActivatePart( (eActiveY==SC_SPLIT_TOP) ? SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT );
874cdf0e10cSrcweir eActiveX = SC_SPLIT_LEFT;
875cdf0e10cSrcweir }
876cdf0e10cSrcweir if (bVFix)
877cdf0e10cSrcweir if (eActiveY == SC_SPLIT_BOTTOM && nCurY < (SCsROW)aViewData.GetFixPosY())
878cdf0e10cSrcweir {
879cdf0e10cSrcweir ActivatePart( (eActiveX==SC_SPLIT_LEFT) ? SC_SPLIT_TOPLEFT : SC_SPLIT_TOPRIGHT );
880cdf0e10cSrcweir eActiveY = SC_SPLIT_TOP;
881cdf0e10cSrcweir }
882cdf0e10cSrcweir }
883cdf0e10cSrcweir
SelMouseButtonDown(const MouseEvent & rMEvt)884cdf0e10cSrcweir sal_Bool ScTabView::SelMouseButtonDown( const MouseEvent& rMEvt )
885cdf0e10cSrcweir {
886cdf0e10cSrcweir sal_Bool bRet = sal_False;
887cdf0e10cSrcweir
888cdf0e10cSrcweir // #i3875# *Hack*
889cdf0e10cSrcweir sal_Bool bMod1Locked = aViewData.GetViewShell()->GetLockedModifiers() & KEY_MOD1 ? sal_True : sal_False;
890cdf0e10cSrcweir aViewData.SetSelCtrlMouseClick( rMEvt.IsMod1() || bMod1Locked );
891cdf0e10cSrcweir
892cdf0e10cSrcweir if ( pSelEngine )
893cdf0e10cSrcweir {
894cdf0e10cSrcweir bMoveIsShift = rMEvt.IsShift();
895cdf0e10cSrcweir bRet = pSelEngine->SelMouseButtonDown( rMEvt );
896cdf0e10cSrcweir bMoveIsShift = sal_False;
897cdf0e10cSrcweir }
898cdf0e10cSrcweir
899cdf0e10cSrcweir aViewData.SetSelCtrlMouseClick( sal_False ); // #i3875# *Hack*
900cdf0e10cSrcweir
901cdf0e10cSrcweir return bRet;
902cdf0e10cSrcweir }
903cdf0e10cSrcweir
904cdf0e10cSrcweir //
905cdf0e10cSrcweir // MoveCursor - mit Anpassung des Bildausschnitts
906cdf0e10cSrcweir //
907cdf0e10cSrcweir
MoveCursorAbs(SCsCOL nCurX,SCsROW nCurY,ScFollowMode eMode,sal_Bool bShift,sal_Bool bControl,sal_Bool bKeepOld,sal_Bool bKeepSel)908cdf0e10cSrcweir void ScTabView::MoveCursorAbs( SCsCOL nCurX, SCsROW nCurY, ScFollowMode eMode,
909cdf0e10cSrcweir sal_Bool bShift, sal_Bool bControl, sal_Bool bKeepOld, sal_Bool bKeepSel )
910cdf0e10cSrcweir {
911cdf0e10cSrcweir if (!bKeepOld)
912cdf0e10cSrcweir aViewData.ResetOldCursor();
913cdf0e10cSrcweir
914*4b4244d8SSteve Yin // i123629
915*4b4244d8SSteve Yin if( aViewData.GetViewShell()->GetForceFocusOnCurCell() )
916*4b4244d8SSteve Yin aViewData.GetViewShell()->SetForceFocusOnCurCell( !ValidColRow(nCurX, nCurY) );
917*4b4244d8SSteve Yin
918cdf0e10cSrcweir if (nCurX < 0) nCurX = 0;
919cdf0e10cSrcweir if (nCurY < 0) nCurY = 0;
920cdf0e10cSrcweir if (nCurX > MAXCOL) nCurX = MAXCOL;
921cdf0e10cSrcweir if (nCurY > MAXROW) nCurY = MAXROW;
922cdf0e10cSrcweir
923cdf0e10cSrcweir HideAllCursors();
924cdf0e10cSrcweir
925cdf0e10cSrcweir if ( bShift && bNewStartIfMarking && IsBlockMode() )
926cdf0e10cSrcweir {
927cdf0e10cSrcweir // used for ADD selection mode: start a new block from the cursor position
928cdf0e10cSrcweir DoneBlockMode( sal_True );
929cdf0e10cSrcweir InitBlockMode( aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo(), sal_True );
930cdf0e10cSrcweir }
931cdf0e10cSrcweir
932cdf0e10cSrcweir // aktiven Teil umschalten jetzt in AlignToCursor
933cdf0e10cSrcweir
934cdf0e10cSrcweir AlignToCursor( nCurX, nCurY, eMode );
935cdf0e10cSrcweir //! auf OS/2: SC_FOLLOW_JUMP statt SC_FOLLOW_LINE, um Nachlaufen zu verhindern ???
936cdf0e10cSrcweir
937cdf0e10cSrcweir if (bKeepSel)
938cdf0e10cSrcweir SetCursor( nCurX, nCurY ); // Markierung stehenlassen
939cdf0e10cSrcweir else
940cdf0e10cSrcweir {
941cdf0e10cSrcweir sal_Bool bSame = ( nCurX == aViewData.GetCurX() && nCurY == aViewData.GetCurY() );
942cdf0e10cSrcweir bMoveIsShift = bShift;
943cdf0e10cSrcweir pSelEngine->CursorPosChanging( bShift, bControl );
944cdf0e10cSrcweir bMoveIsShift = sal_False;
945cdf0e10cSrcweir aFunctionSet.SetCursorAtCell( nCurX, nCurY, sal_False );
946cdf0e10cSrcweir
947cdf0e10cSrcweir // Wenn der Cursor nicht bewegt wurde, muss das SelectionChanged fuer das
948cdf0e10cSrcweir // Aufheben der Selektion hier einzeln passieren:
949cdf0e10cSrcweir if (bSame)
950cdf0e10cSrcweir SelectionChanged();
951cdf0e10cSrcweir }
952cdf0e10cSrcweir
953cdf0e10cSrcweir ShowAllCursors();
954cdf0e10cSrcweir }
955cdf0e10cSrcweir
MoveCursorRel(SCsCOL nMovX,SCsROW nMovY,ScFollowMode eMode,sal_Bool bShift,sal_Bool bKeepSel)956cdf0e10cSrcweir void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
957cdf0e10cSrcweir sal_Bool bShift, sal_Bool bKeepSel )
958cdf0e10cSrcweir {
959cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
960cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
961cdf0e10cSrcweir
962cdf0e10cSrcweir bool bSkipProtected = false, bSkipUnprotected = false;
963cdf0e10cSrcweir ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
964cdf0e10cSrcweir if ( pProtect && pProtect->isProtected() )
965cdf0e10cSrcweir {
966cdf0e10cSrcweir bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
967cdf0e10cSrcweir bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
968cdf0e10cSrcweir }
969cdf0e10cSrcweir
970cdf0e10cSrcweir if ( bSkipProtected && bSkipUnprotected )
971cdf0e10cSrcweir return;
972cdf0e10cSrcweir
973cdf0e10cSrcweir SCsCOL nOldX;
974cdf0e10cSrcweir SCsROW nOldY;
975cdf0e10cSrcweir SCsCOL nCurX;
976cdf0e10cSrcweir SCsROW nCurY;
977cdf0e10cSrcweir if ( aViewData.IsRefMode() )
978cdf0e10cSrcweir {
979cdf0e10cSrcweir nOldX = (SCsCOL) aViewData.GetRefEndX();
980cdf0e10cSrcweir nOldY = (SCsROW) aViewData.GetRefEndY();
981cdf0e10cSrcweir nCurX = nOldX + nMovX;
982cdf0e10cSrcweir nCurY = nOldY + nMovY;
983cdf0e10cSrcweir }
984cdf0e10cSrcweir else
985cdf0e10cSrcweir {
986cdf0e10cSrcweir nOldX = (SCsCOL) aViewData.GetCurX();
987cdf0e10cSrcweir nOldY = (SCsROW) aViewData.GetCurY();
988cdf0e10cSrcweir nCurX = (nMovX != 0) ? nOldX+nMovX : (SCsCOL) aViewData.GetOldCurX();
989cdf0e10cSrcweir nCurY = (nMovY != 0) ? nOldY+nMovY : (SCsROW) aViewData.GetOldCurY();
990cdf0e10cSrcweir }
991cdf0e10cSrcweir
992cdf0e10cSrcweir sal_Bool bSkipCell = sal_False;
993cdf0e10cSrcweir aViewData.ResetOldCursor();
994cdf0e10cSrcweir
995cdf0e10cSrcweir if (nMovX != 0 && VALIDCOLROW(nCurX,nCurY))
996cdf0e10cSrcweir {
997cdf0e10cSrcweir sal_Bool bHFlip = sal_False;
998cdf0e10cSrcweir do
999cdf0e10cSrcweir {
1000cdf0e10cSrcweir SCCOL nLastCol = -1;
1001cdf0e10cSrcweir bSkipCell = pDoc->ColHidden(nCurX, nTab, nLastCol) || pDoc->IsHorOverlapped( nCurX, nCurY, nTab );
1002cdf0e10cSrcweir if (bSkipProtected && !bSkipCell)
1003cdf0e10cSrcweir bSkipCell = pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
1004cdf0e10cSrcweir if (bSkipUnprotected && !bSkipCell)
1005cdf0e10cSrcweir bSkipCell = !pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
1006cdf0e10cSrcweir
1007cdf0e10cSrcweir if (bSkipCell)
1008cdf0e10cSrcweir {
1009cdf0e10cSrcweir if ( nCurX<=0 || nCurX>=MAXCOL )
1010cdf0e10cSrcweir {
1011cdf0e10cSrcweir if (bHFlip)
1012cdf0e10cSrcweir {
1013cdf0e10cSrcweir nCurX = nOldX;
1014cdf0e10cSrcweir bSkipCell = sal_False;
1015cdf0e10cSrcweir }
1016cdf0e10cSrcweir else
1017cdf0e10cSrcweir {
1018cdf0e10cSrcweir nMovX = -nMovX;
1019cdf0e10cSrcweir if (nMovX > 0) ++nCurX; else --nCurX; // zuruecknehmen
1020cdf0e10cSrcweir bHFlip = sal_True;
1021cdf0e10cSrcweir }
1022cdf0e10cSrcweir }
1023cdf0e10cSrcweir else
1024cdf0e10cSrcweir if (nMovX > 0) ++nCurX; else --nCurX;
1025cdf0e10cSrcweir }
1026cdf0e10cSrcweir }
1027cdf0e10cSrcweir while (bSkipCell);
1028cdf0e10cSrcweir
1029cdf0e10cSrcweir if (pDoc->IsVerOverlapped( nCurX, nCurY, nTab ))
1030cdf0e10cSrcweir {
1031cdf0e10cSrcweir aViewData.SetOldCursor( nCurX,nCurY );
1032cdf0e10cSrcweir while (pDoc->IsVerOverlapped( nCurX, nCurY, nTab ))
1033cdf0e10cSrcweir --nCurY;
1034cdf0e10cSrcweir }
1035cdf0e10cSrcweir }
1036cdf0e10cSrcweir
1037cdf0e10cSrcweir if (nMovY != 0 && VALIDCOLROW(nCurX,nCurY))
1038cdf0e10cSrcweir {
1039cdf0e10cSrcweir sal_Bool bVFlip = sal_False;
1040cdf0e10cSrcweir do
1041cdf0e10cSrcweir {
1042cdf0e10cSrcweir SCROW nLastRow = -1;
1043cdf0e10cSrcweir bSkipCell = pDoc->RowHidden(nCurY, nTab, nLastRow) || pDoc->IsVerOverlapped( nCurX, nCurY, nTab );
1044cdf0e10cSrcweir if (bSkipProtected && !bSkipCell)
1045cdf0e10cSrcweir bSkipCell = pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
1046cdf0e10cSrcweir if (bSkipUnprotected && !bSkipCell)
1047cdf0e10cSrcweir bSkipCell = !pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
1048cdf0e10cSrcweir
1049cdf0e10cSrcweir if (bSkipCell)
1050cdf0e10cSrcweir {
1051cdf0e10cSrcweir if ( nCurY<=0 || nCurY>=MAXROW )
1052cdf0e10cSrcweir {
1053cdf0e10cSrcweir if (bVFlip)
1054cdf0e10cSrcweir {
1055cdf0e10cSrcweir nCurY = nOldY;
1056cdf0e10cSrcweir bSkipCell = sal_False;
1057cdf0e10cSrcweir }
1058cdf0e10cSrcweir else
1059cdf0e10cSrcweir {
1060cdf0e10cSrcweir nMovY = -nMovY;
1061cdf0e10cSrcweir if (nMovY > 0) ++nCurY; else --nCurY; // zuruecknehmen
1062cdf0e10cSrcweir bVFlip = sal_True;
1063cdf0e10cSrcweir }
1064cdf0e10cSrcweir }
1065cdf0e10cSrcweir else
1066cdf0e10cSrcweir if (nMovY > 0) ++nCurY; else --nCurY;
1067cdf0e10cSrcweir }
1068cdf0e10cSrcweir }
1069cdf0e10cSrcweir while (bSkipCell);
1070cdf0e10cSrcweir
1071cdf0e10cSrcweir if (pDoc->IsHorOverlapped( nCurX, nCurY, nTab ))
1072cdf0e10cSrcweir {
1073cdf0e10cSrcweir aViewData.SetOldCursor( nCurX,nCurY );
1074cdf0e10cSrcweir while (pDoc->IsHorOverlapped( nCurX, nCurY, nTab ))
1075cdf0e10cSrcweir --nCurX;
1076cdf0e10cSrcweir }
1077cdf0e10cSrcweir }
1078cdf0e10cSrcweir
1079cdf0e10cSrcweir MoveCursorAbs( nCurX, nCurY, eMode, bShift, sal_False, sal_True, bKeepSel );
1080cdf0e10cSrcweir }
1081cdf0e10cSrcweir
MoveCursorPage(SCsCOL nMovX,SCsROW nMovY,ScFollowMode eMode,sal_Bool bShift,sal_Bool bKeepSel)1082cdf0e10cSrcweir void ScTabView::MoveCursorPage( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode, sal_Bool bShift, sal_Bool bKeepSel )
1083cdf0e10cSrcweir {
1084cdf0e10cSrcweir SCCOL nCurX;
1085cdf0e10cSrcweir SCROW nCurY;
1086cdf0e10cSrcweir aViewData.GetMoveCursor( nCurX,nCurY );
1087cdf0e10cSrcweir
1088cdf0e10cSrcweir ScSplitPos eWhich = aViewData.GetActivePart();
1089cdf0e10cSrcweir ScHSplitPos eWhichX = WhichH( eWhich );
1090cdf0e10cSrcweir ScVSplitPos eWhichY = WhichV( eWhich );
1091cdf0e10cSrcweir
1092cdf0e10cSrcweir SCsCOL nPageX;
1093cdf0e10cSrcweir SCsROW nPageY;
1094cdf0e10cSrcweir if (nMovX >= 0)
1095cdf0e10cSrcweir nPageX = ((SCsCOL) aViewData.CellsAtX( nCurX, 1, eWhichX )) * nMovX;
1096cdf0e10cSrcweir else
1097cdf0e10cSrcweir nPageX = ((SCsCOL) aViewData.CellsAtX( nCurX, -1, eWhichX )) * nMovX;
1098cdf0e10cSrcweir
1099cdf0e10cSrcweir if (nMovY >= 0)
1100cdf0e10cSrcweir nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, 1, eWhichY )) * nMovY;
1101cdf0e10cSrcweir else
1102cdf0e10cSrcweir nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, -1, eWhichY )) * nMovY;
1103cdf0e10cSrcweir
1104cdf0e10cSrcweir if (nMovX != 0 && nPageX == 0) nPageX = (nMovX>0) ? 1 : -1;
1105cdf0e10cSrcweir if (nMovY != 0 && nPageY == 0) nPageY = (nMovY>0) ? 1 : -1;
1106cdf0e10cSrcweir
1107cdf0e10cSrcweir MoveCursorRel( nPageX, nPageY, eMode, bShift, bKeepSel );
1108cdf0e10cSrcweir }
1109cdf0e10cSrcweir
MoveCursorArea(SCsCOL nMovX,SCsROW nMovY,ScFollowMode eMode,sal_Bool bShift,sal_Bool bKeepSel)1110cdf0e10cSrcweir void ScTabView::MoveCursorArea( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode, sal_Bool bShift, sal_Bool bKeepSel )
1111cdf0e10cSrcweir {
1112cdf0e10cSrcweir SCCOL nCurX;
1113cdf0e10cSrcweir SCROW nCurY;
1114cdf0e10cSrcweir aViewData.GetMoveCursor( nCurX,nCurY );
1115cdf0e10cSrcweir SCCOL nNewX = nCurX;
1116cdf0e10cSrcweir SCROW nNewY = nCurY;
1117cdf0e10cSrcweir
1118cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1119cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1120cdf0e10cSrcweir
1121cdf0e10cSrcweir // FindAreaPos kennt nur -1 oder 1 als Richtung
1122cdf0e10cSrcweir
1123cdf0e10cSrcweir SCsCOLROW i;
1124cdf0e10cSrcweir if ( nMovX > 0 )
1125cdf0e10cSrcweir for ( i=0; i<nMovX; i++ )
1126cdf0e10cSrcweir pDoc->FindAreaPos( nNewX, nNewY, nTab, 1, 0 );
1127cdf0e10cSrcweir if ( nMovX < 0 )
1128cdf0e10cSrcweir for ( i=0; i<-nMovX; i++ )
1129cdf0e10cSrcweir pDoc->FindAreaPos( nNewX, nNewY, nTab, -1, 0 );
1130cdf0e10cSrcweir if ( nMovY > 0 )
1131cdf0e10cSrcweir for ( i=0; i<nMovY; i++ )
1132cdf0e10cSrcweir pDoc->FindAreaPos( nNewX, nNewY, nTab, 0, 1 );
1133cdf0e10cSrcweir if ( nMovY < 0 )
1134cdf0e10cSrcweir for ( i=0; i<-nMovY; i++ )
1135cdf0e10cSrcweir pDoc->FindAreaPos( nNewX, nNewY, nTab, 0, -1 );
1136cdf0e10cSrcweir
1137cdf0e10cSrcweir if (eMode==SC_FOLLOW_JUMP) // unten/rechts nicht zuviel grau anzeigen
1138cdf0e10cSrcweir {
1139cdf0e10cSrcweir if (nMovX != 0 && nNewX == MAXCOL)
1140cdf0e10cSrcweir eMode = SC_FOLLOW_LINE;
1141cdf0e10cSrcweir if (nMovY != 0 && nNewY == MAXROW)
1142cdf0e10cSrcweir eMode = SC_FOLLOW_LINE;
1143cdf0e10cSrcweir }
1144cdf0e10cSrcweir
1145cdf0e10cSrcweir MoveCursorRel( ((SCsCOL)nNewX)-(SCsCOL)nCurX, ((SCsROW)nNewY)-(SCsROW)nCurY, eMode, bShift, bKeepSel );
1146cdf0e10cSrcweir }
1147cdf0e10cSrcweir
MoveCursorEnd(SCsCOL nMovX,SCsROW nMovY,ScFollowMode eMode,sal_Bool bShift,sal_Bool bKeepSel)1148cdf0e10cSrcweir void ScTabView::MoveCursorEnd( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode, sal_Bool bShift, sal_Bool bKeepSel )
1149cdf0e10cSrcweir {
1150cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1151cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1152cdf0e10cSrcweir
1153cdf0e10cSrcweir SCCOL nCurX;
1154cdf0e10cSrcweir SCROW nCurY;
1155cdf0e10cSrcweir aViewData.GetMoveCursor( nCurX,nCurY );
1156cdf0e10cSrcweir SCCOL nNewX = nCurX;
1157cdf0e10cSrcweir SCROW nNewY = nCurY;
1158cdf0e10cSrcweir
1159cdf0e10cSrcweir SCCOL nUsedX = 0;
1160cdf0e10cSrcweir SCROW nUsedY = 0;
1161cdf0e10cSrcweir if ( nMovX > 0 || nMovY > 0 )
1162cdf0e10cSrcweir pDoc->GetPrintArea( nTab, nUsedX, nUsedY ); // Ende holen
1163cdf0e10cSrcweir
1164cdf0e10cSrcweir if (nMovX<0)
1165cdf0e10cSrcweir nNewX=0;
1166cdf0e10cSrcweir else if (nMovX>0)
1167cdf0e10cSrcweir nNewX=nUsedX; // letzter benutzter Bereich
1168cdf0e10cSrcweir
1169cdf0e10cSrcweir if (nMovY<0)
1170cdf0e10cSrcweir nNewY=0;
1171cdf0e10cSrcweir else if (nMovY>0)
1172cdf0e10cSrcweir nNewY=nUsedY;
1173cdf0e10cSrcweir
1174cdf0e10cSrcweir aViewData.ResetOldCursor();
1175cdf0e10cSrcweir MoveCursorRel( ((SCsCOL)nNewX)-(SCsCOL)nCurX, ((SCsROW)nNewY)-(SCsROW)nCurY, eMode, bShift, bKeepSel );
1176cdf0e10cSrcweir }
1177cdf0e10cSrcweir
MoveCursorScreen(SCsCOL nMovX,SCsROW nMovY,ScFollowMode eMode,sal_Bool bShift)1178cdf0e10cSrcweir void ScTabView::MoveCursorScreen( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode, sal_Bool bShift )
1179cdf0e10cSrcweir {
1180cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1181cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1182cdf0e10cSrcweir
1183cdf0e10cSrcweir SCCOL nCurX;
1184cdf0e10cSrcweir SCROW nCurY;
1185cdf0e10cSrcweir aViewData.GetMoveCursor( nCurX,nCurY );
1186cdf0e10cSrcweir SCCOL nNewX = nCurX;
1187cdf0e10cSrcweir SCROW nNewY = nCurY;
1188cdf0e10cSrcweir
1189cdf0e10cSrcweir ScSplitPos eWhich = aViewData.GetActivePart();
1190cdf0e10cSrcweir SCCOL nPosX = aViewData.GetPosX( WhichH(eWhich) );
1191cdf0e10cSrcweir SCROW nPosY = aViewData.GetPosY( WhichV(eWhich) );
1192cdf0e10cSrcweir
1193cdf0e10cSrcweir SCCOL nAddX = aViewData.VisibleCellsX( WhichH(eWhich) );
1194cdf0e10cSrcweir if (nAddX != 0)
1195cdf0e10cSrcweir --nAddX;
1196cdf0e10cSrcweir SCROW nAddY = aViewData.VisibleCellsY( WhichV(eWhich) );
1197cdf0e10cSrcweir if (nAddY != 0)
1198cdf0e10cSrcweir --nAddY;
1199cdf0e10cSrcweir
1200cdf0e10cSrcweir if (nMovX<0)
1201cdf0e10cSrcweir nNewX=nPosX;
1202cdf0e10cSrcweir else if (nMovX>0)
1203cdf0e10cSrcweir nNewX=nPosX+nAddX;
1204cdf0e10cSrcweir
1205cdf0e10cSrcweir if (nMovY<0)
1206cdf0e10cSrcweir nNewY=nPosY;
1207cdf0e10cSrcweir else if (nMovY>0)
1208cdf0e10cSrcweir nNewY=nPosY+nAddY;
1209cdf0e10cSrcweir
1210cdf0e10cSrcweir // aViewData.ResetOldCursor();
1211cdf0e10cSrcweir aViewData.SetOldCursor( nNewX,nNewY );
1212cdf0e10cSrcweir
1213cdf0e10cSrcweir while (pDoc->IsHorOverlapped( nNewX, nNewY, nTab ))
1214cdf0e10cSrcweir --nNewX;
1215cdf0e10cSrcweir while (pDoc->IsVerOverlapped( nNewX, nNewY, nTab ))
1216cdf0e10cSrcweir --nNewY;
1217cdf0e10cSrcweir
1218cdf0e10cSrcweir MoveCursorAbs( nNewX, nNewY, eMode, bShift, sal_False, sal_True );
1219cdf0e10cSrcweir }
1220cdf0e10cSrcweir
MoveCursorEnter(sal_Bool bShift)1221cdf0e10cSrcweir void ScTabView::MoveCursorEnter( sal_Bool bShift ) // bShift -> hoch/runter
1222cdf0e10cSrcweir {
1223cdf0e10cSrcweir const ScInputOptions& rOpt = SC_MOD()->GetInputOptions();
1224cdf0e10cSrcweir if (!rOpt.GetMoveSelection())
1225cdf0e10cSrcweir {
1226cdf0e10cSrcweir aViewData.UpdateInputHandler(sal_True);
1227cdf0e10cSrcweir return;
1228cdf0e10cSrcweir }
1229cdf0e10cSrcweir
1230cdf0e10cSrcweir SCsCOL nMoveX = 0;
1231cdf0e10cSrcweir SCsROW nMoveY = 0;
1232cdf0e10cSrcweir switch ((ScDirection)rOpt.GetMoveDir())
1233cdf0e10cSrcweir {
1234cdf0e10cSrcweir case DIR_BOTTOM:
1235cdf0e10cSrcweir nMoveY = bShift ? -1 : 1;
1236cdf0e10cSrcweir break;
1237cdf0e10cSrcweir case DIR_RIGHT:
1238cdf0e10cSrcweir nMoveX = bShift ? -1 : 1;
1239cdf0e10cSrcweir break;
1240cdf0e10cSrcweir case DIR_TOP:
1241cdf0e10cSrcweir nMoveY = bShift ? 1 : -1;
1242cdf0e10cSrcweir break;
1243cdf0e10cSrcweir case DIR_LEFT:
1244cdf0e10cSrcweir nMoveX = bShift ? 1 : -1;
1245cdf0e10cSrcweir break;
1246cdf0e10cSrcweir }
1247cdf0e10cSrcweir
1248cdf0e10cSrcweir ScMarkData& rMark = aViewData.GetMarkData();
1249cdf0e10cSrcweir if (rMark.IsMarked() || rMark.IsMultiMarked())
1250cdf0e10cSrcweir {
1251cdf0e10cSrcweir SCCOL nCurX;
1252cdf0e10cSrcweir SCROW nCurY;
1253cdf0e10cSrcweir aViewData.GetMoveCursor( nCurX,nCurY );
1254cdf0e10cSrcweir SCCOL nNewX = nCurX;
1255cdf0e10cSrcweir SCROW nNewY = nCurY;
1256cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1257cdf0e10cSrcweir
1258cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1259cdf0e10cSrcweir pDoc->GetNextPos( nNewX,nNewY, nTab, nMoveX,nMoveY, sal_True,sal_False, rMark );
1260cdf0e10cSrcweir
1261cdf0e10cSrcweir MoveCursorRel( ((SCsCOL)nNewX)-(SCsCOL)nCurX, ((SCsROW)nNewY)-(SCsROW)nCurY,
1262cdf0e10cSrcweir SC_FOLLOW_LINE, sal_False, sal_True );
1263cdf0e10cSrcweir
1264cdf0e10cSrcweir // update input line even if cursor was not moved
1265cdf0e10cSrcweir if ( nNewX == nCurX && nNewY == nCurY )
1266cdf0e10cSrcweir aViewData.UpdateInputHandler(sal_True);
1267cdf0e10cSrcweir }
1268cdf0e10cSrcweir else
1269cdf0e10cSrcweir {
1270cdf0e10cSrcweir if ( nMoveY != 0 && !nMoveX )
1271cdf0e10cSrcweir {
1272cdf0e10cSrcweir // nach Tab und Enter wieder zur Ausgangsspalte
1273cdf0e10cSrcweir SCCOL nTabCol = aViewData.GetTabStartCol();
1274cdf0e10cSrcweir if (nTabCol != SC_TABSTART_NONE)
1275cdf0e10cSrcweir {
1276cdf0e10cSrcweir SCCOL nCurX;
1277cdf0e10cSrcweir SCROW nCurY;
1278cdf0e10cSrcweir aViewData.GetMoveCursor( nCurX,nCurY );
1279cdf0e10cSrcweir nMoveX = ((SCsCOL)nTabCol)-(SCsCOL)nCurX;
1280cdf0e10cSrcweir }
1281cdf0e10cSrcweir }
1282cdf0e10cSrcweir
1283cdf0e10cSrcweir MoveCursorRel( nMoveX,nMoveY, SC_FOLLOW_LINE, sal_False );
1284cdf0e10cSrcweir }
1285cdf0e10cSrcweir }
1286cdf0e10cSrcweir
1287cdf0e10cSrcweir
MoveCursorKeyInput(const KeyEvent & rKeyEvent)1288cdf0e10cSrcweir sal_Bool ScTabView::MoveCursorKeyInput( const KeyEvent& rKeyEvent )
1289cdf0e10cSrcweir {
1290cdf0e10cSrcweir const KeyCode& rKCode = rKeyEvent.GetKeyCode();
1291cdf0e10cSrcweir
1292cdf0e10cSrcweir enum { MOD_NONE, MOD_CTRL, MOD_ALT, MOD_BOTH } eModifier =
1293cdf0e10cSrcweir rKCode.IsMod1() ?
1294cdf0e10cSrcweir (rKCode.IsMod2() ? MOD_BOTH : MOD_CTRL) :
1295cdf0e10cSrcweir (rKCode.IsMod2() ? MOD_ALT : MOD_NONE);
1296cdf0e10cSrcweir
1297cdf0e10cSrcweir sal_Bool bSel = rKCode.IsShift();
1298cdf0e10cSrcweir sal_uInt16 nCode = rKCode.GetCode();
1299cdf0e10cSrcweir
1300cdf0e10cSrcweir // CURSOR keys
1301cdf0e10cSrcweir SCsCOL nDX = 0;
1302cdf0e10cSrcweir SCsROW nDY = 0;
1303cdf0e10cSrcweir switch( nCode )
1304cdf0e10cSrcweir {
1305cdf0e10cSrcweir case KEY_LEFT: nDX = -1; break;
1306cdf0e10cSrcweir case KEY_RIGHT: nDX = 1; break;
1307cdf0e10cSrcweir case KEY_UP: nDY = -1; break;
1308cdf0e10cSrcweir case KEY_DOWN: nDY = 1; break;
1309cdf0e10cSrcweir }
1310cdf0e10cSrcweir if( nDX != 0 || nDY != 0 )
1311cdf0e10cSrcweir {
1312cdf0e10cSrcweir switch( eModifier )
1313cdf0e10cSrcweir {
1314cdf0e10cSrcweir case MOD_NONE: MoveCursorRel( nDX, nDY, SC_FOLLOW_LINE, bSel ); break;
1315cdf0e10cSrcweir case MOD_CTRL: MoveCursorArea( nDX, nDY, SC_FOLLOW_JUMP, bSel ); break;
1316cdf0e10cSrcweir default:
1317cdf0e10cSrcweir {
1318cdf0e10cSrcweir // added to avoid warnings
1319cdf0e10cSrcweir }
1320cdf0e10cSrcweir }
1321cdf0e10cSrcweir // always sal_True to suppress changes of col/row size (ALT+CURSOR)
1322cdf0e10cSrcweir return sal_True;
1323cdf0e10cSrcweir }
1324cdf0e10cSrcweir
1325cdf0e10cSrcweir // PAGEUP/PAGEDOWN
1326cdf0e10cSrcweir if( (nCode == KEY_PAGEUP) || (nCode == KEY_PAGEDOWN) )
1327cdf0e10cSrcweir {
1328cdf0e10cSrcweir nDX = (nCode == KEY_PAGEUP) ? -1 : 1;
1329cdf0e10cSrcweir switch( eModifier )
1330cdf0e10cSrcweir {
1331cdf0e10cSrcweir case MOD_NONE: MoveCursorPage( 0, static_cast<SCsCOLROW>(nDX), SC_FOLLOW_FIX, bSel ); break;
1332cdf0e10cSrcweir case MOD_ALT: MoveCursorPage( nDX, 0, SC_FOLLOW_FIX, bSel ); break;
1333cdf0e10cSrcweir case MOD_CTRL: SelectNextTab( nDX ); break;
1334cdf0e10cSrcweir default:
1335cdf0e10cSrcweir {
1336cdf0e10cSrcweir // added to avoid warnings
1337cdf0e10cSrcweir }
1338cdf0e10cSrcweir }
1339cdf0e10cSrcweir return sal_True;
1340cdf0e10cSrcweir }
1341cdf0e10cSrcweir
1342cdf0e10cSrcweir // HOME/END
1343cdf0e10cSrcweir if( (nCode == KEY_HOME) || (nCode == KEY_END) )
1344cdf0e10cSrcweir {
1345cdf0e10cSrcweir nDX = (nCode == KEY_HOME) ? -1 : 1;
1346cdf0e10cSrcweir ScFollowMode eMode = (nCode == KEY_HOME) ? SC_FOLLOW_LINE : SC_FOLLOW_JUMP;
1347cdf0e10cSrcweir switch( eModifier )
1348cdf0e10cSrcweir {
1349cdf0e10cSrcweir case MOD_NONE: MoveCursorEnd( nDX, 0, eMode, bSel ); break;
1350cdf0e10cSrcweir case MOD_CTRL: MoveCursorEnd( nDX, static_cast<SCsCOLROW>(nDX), eMode, bSel ); break;
1351cdf0e10cSrcweir default:
1352cdf0e10cSrcweir {
1353cdf0e10cSrcweir // added to avoid warnings
1354cdf0e10cSrcweir }
1355cdf0e10cSrcweir }
1356cdf0e10cSrcweir return sal_True;
1357cdf0e10cSrcweir }
1358cdf0e10cSrcweir
1359cdf0e10cSrcweir return sal_False;
1360cdf0e10cSrcweir }
1361cdf0e10cSrcweir
1362cdf0e10cSrcweir
1363cdf0e10cSrcweir // naechste/vorherige nicht geschuetzte Zelle
FindNextUnprot(sal_Bool bShift,sal_Bool bInSelection)1364cdf0e10cSrcweir void ScTabView::FindNextUnprot( sal_Bool bShift, sal_Bool bInSelection )
1365cdf0e10cSrcweir {
1366cdf0e10cSrcweir short nMove = bShift ? -1 : 1;
1367cdf0e10cSrcweir
1368cdf0e10cSrcweir ScMarkData& rMark = aViewData.GetMarkData();
1369cdf0e10cSrcweir sal_Bool bMarked = bInSelection && (rMark.IsMarked() || rMark.IsMultiMarked());
1370cdf0e10cSrcweir
1371cdf0e10cSrcweir SCCOL nCurX;
1372cdf0e10cSrcweir SCROW nCurY;
1373cdf0e10cSrcweir aViewData.GetMoveCursor( nCurX,nCurY );
1374cdf0e10cSrcweir SCCOL nNewX = nCurX;
1375cdf0e10cSrcweir SCROW nNewY = nCurY;
1376cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1377cdf0e10cSrcweir
1378cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1379cdf0e10cSrcweir pDoc->GetNextPos( nNewX,nNewY, nTab, nMove,0, bMarked,sal_True, rMark );
1380cdf0e10cSrcweir
1381cdf0e10cSrcweir SCCOL nTabCol = aViewData.GetTabStartCol();
1382cdf0e10cSrcweir if ( nTabCol == SC_TABSTART_NONE )
1383cdf0e10cSrcweir nTabCol = nCurX; // auf diese Spalte zurueck bei Enter
1384cdf0e10cSrcweir
1385cdf0e10cSrcweir MoveCursorRel( ((SCsCOL)nNewX)-(SCsCOL)nCurX, ((SCsROW)nNewY)-(SCsROW)nCurY,
1386cdf0e10cSrcweir SC_FOLLOW_LINE, sal_False, sal_True );
1387cdf0e10cSrcweir
1388cdf0e10cSrcweir // in MoveCursorRel wird die TabCol zurueckgesetzt...
1389cdf0e10cSrcweir aViewData.SetTabStartCol( nTabCol );
1390cdf0e10cSrcweir }
1391cdf0e10cSrcweir
MarkColumns()1392cdf0e10cSrcweir void ScTabView::MarkColumns()
1393cdf0e10cSrcweir {
1394cdf0e10cSrcweir SCCOL nStartCol;
1395cdf0e10cSrcweir SCCOL nEndCol;
1396cdf0e10cSrcweir
1397cdf0e10cSrcweir ScMarkData& rMark = aViewData.GetMarkData();
1398cdf0e10cSrcweir if (rMark.IsMarked())
1399cdf0e10cSrcweir {
1400cdf0e10cSrcweir ScRange aMarkRange;
1401cdf0e10cSrcweir rMark.GetMarkArea( aMarkRange );
1402cdf0e10cSrcweir nStartCol = aMarkRange.aStart.Col();
1403cdf0e10cSrcweir nEndCol = aMarkRange.aEnd.Col();
1404cdf0e10cSrcweir }
1405cdf0e10cSrcweir else
1406cdf0e10cSrcweir {
1407cdf0e10cSrcweir SCROW nDummy;
1408cdf0e10cSrcweir aViewData.GetMoveCursor( nStartCol, nDummy );
1409cdf0e10cSrcweir nEndCol=nStartCol;
1410cdf0e10cSrcweir }
1411cdf0e10cSrcweir
1412cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1413cdf0e10cSrcweir DoneBlockMode();
1414cdf0e10cSrcweir InitBlockMode( nStartCol,0, nTab );
1415cdf0e10cSrcweir MarkCursor( nEndCol,MAXROW, nTab );
1416cdf0e10cSrcweir SelectionChanged();
1417cdf0e10cSrcweir }
1418cdf0e10cSrcweir
MarkRows()1419cdf0e10cSrcweir void ScTabView::MarkRows()
1420cdf0e10cSrcweir {
1421cdf0e10cSrcweir SCROW nStartRow;
1422cdf0e10cSrcweir SCROW nEndRow;
1423cdf0e10cSrcweir
1424cdf0e10cSrcweir ScMarkData& rMark = aViewData.GetMarkData();
1425cdf0e10cSrcweir if (rMark.IsMarked())
1426cdf0e10cSrcweir {
1427cdf0e10cSrcweir ScRange aMarkRange;
1428cdf0e10cSrcweir rMark.GetMarkArea( aMarkRange );
1429cdf0e10cSrcweir nStartRow = aMarkRange.aStart.Row();
1430cdf0e10cSrcweir nEndRow = aMarkRange.aEnd.Row();
1431cdf0e10cSrcweir }
1432cdf0e10cSrcweir else
1433cdf0e10cSrcweir {
1434cdf0e10cSrcweir SCCOL nDummy;
1435cdf0e10cSrcweir aViewData.GetMoveCursor( nDummy, nStartRow );
1436cdf0e10cSrcweir nEndRow=nStartRow;
1437cdf0e10cSrcweir }
1438cdf0e10cSrcweir
1439cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1440cdf0e10cSrcweir DoneBlockMode();
1441cdf0e10cSrcweir InitBlockMode( 0,nStartRow, nTab );
1442cdf0e10cSrcweir MarkCursor( MAXCOL,nEndRow, nTab );
1443cdf0e10cSrcweir SelectionChanged();
1444cdf0e10cSrcweir }
1445cdf0e10cSrcweir
MarkDataArea(sal_Bool bIncludeCursor)1446cdf0e10cSrcweir void ScTabView::MarkDataArea( sal_Bool bIncludeCursor )
1447cdf0e10cSrcweir {
1448cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1449cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1450cdf0e10cSrcweir SCCOL nStartCol = aViewData.GetCurX();
1451cdf0e10cSrcweir SCROW nStartRow = aViewData.GetCurY();
1452cdf0e10cSrcweir SCCOL nEndCol = nStartCol;
1453cdf0e10cSrcweir SCROW nEndRow = nStartRow;
1454cdf0e10cSrcweir
1455cdf0e10cSrcweir pDoc->GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, bIncludeCursor, false );
1456cdf0e10cSrcweir
1457cdf0e10cSrcweir HideAllCursors();
1458cdf0e10cSrcweir DoneBlockMode();
1459cdf0e10cSrcweir InitBlockMode( nStartCol, nStartRow, nTab );
1460cdf0e10cSrcweir MarkCursor( nEndCol, nEndRow, nTab );
1461cdf0e10cSrcweir ShowAllCursors();
1462cdf0e10cSrcweir
1463cdf0e10cSrcweir SelectionChanged();
1464cdf0e10cSrcweir }
1465cdf0e10cSrcweir
MarkMatrixFormula()1466cdf0e10cSrcweir void ScTabView::MarkMatrixFormula()
1467cdf0e10cSrcweir {
1468cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1469cdf0e10cSrcweir ScAddress aCursor( aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() );
1470cdf0e10cSrcweir ScRange aMatrix;
1471cdf0e10cSrcweir if ( pDoc->GetMatrixFormulaRange( aCursor, aMatrix ) )
1472cdf0e10cSrcweir {
1473cdf0e10cSrcweir MarkRange( aMatrix, sal_False ); // cursor is already within the range
1474cdf0e10cSrcweir }
1475cdf0e10cSrcweir }
1476cdf0e10cSrcweir
MarkRange(const ScRange & rRange,sal_Bool bSetCursor,sal_Bool bContinue)1477cdf0e10cSrcweir void ScTabView::MarkRange( const ScRange& rRange, sal_Bool bSetCursor, sal_Bool bContinue )
1478cdf0e10cSrcweir {
1479cdf0e10cSrcweir SCTAB nTab = rRange.aStart.Tab();
1480cdf0e10cSrcweir SetTabNo( nTab );
1481cdf0e10cSrcweir
1482cdf0e10cSrcweir HideAllCursors();
1483cdf0e10cSrcweir DoneBlockMode( bContinue ); // bContinue==sal_True -> clear old mark
1484cdf0e10cSrcweir if (bSetCursor) // Wenn Cursor gesetzt wird, immer auch alignen
1485cdf0e10cSrcweir {
1486cdf0e10cSrcweir SCCOL nAlignX = rRange.aStart.Col();
1487cdf0e10cSrcweir SCROW nAlignY = rRange.aStart.Row();
1488cdf0e10cSrcweir if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL )
1489cdf0e10cSrcweir nAlignX = aViewData.GetPosX(WhichH(aViewData.GetActivePart()));
1490cdf0e10cSrcweir if ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW )
1491cdf0e10cSrcweir nAlignY = aViewData.GetPosY(WhichV(aViewData.GetActivePart()));
1492cdf0e10cSrcweir AlignToCursor( nAlignX, nAlignY, SC_FOLLOW_JUMP );
1493cdf0e10cSrcweir }
1494cdf0e10cSrcweir InitBlockMode( rRange.aStart.Col(), rRange.aStart.Row(), nTab );
1495cdf0e10cSrcweir MarkCursor( rRange.aEnd.Col(), rRange.aEnd.Row(), nTab );
1496cdf0e10cSrcweir if (bSetCursor)
1497cdf0e10cSrcweir {
1498cdf0e10cSrcweir SCCOL nPosX = rRange.aStart.Col();
1499cdf0e10cSrcweir SCROW nPosY = rRange.aStart.Row();
1500cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1501cdf0e10cSrcweir
1502cdf0e10cSrcweir while (pDoc->IsHorOverlapped( nPosX, nPosY, nTab )) //! ViewData !!!
1503cdf0e10cSrcweir --nPosX;
1504cdf0e10cSrcweir while (pDoc->IsVerOverlapped( nPosX, nPosY, nTab ))
1505cdf0e10cSrcweir --nPosY;
1506cdf0e10cSrcweir
1507cdf0e10cSrcweir aViewData.ResetOldCursor();
1508cdf0e10cSrcweir SetCursor( nPosX, nPosY );
1509cdf0e10cSrcweir }
1510cdf0e10cSrcweir ShowAllCursors();
1511cdf0e10cSrcweir
1512cdf0e10cSrcweir SelectionChanged();
1513cdf0e10cSrcweir }
1514cdf0e10cSrcweir
Unmark()1515cdf0e10cSrcweir void ScTabView::Unmark()
1516cdf0e10cSrcweir {
1517cdf0e10cSrcweir ScMarkData& rMark = aViewData.GetMarkData();
1518cdf0e10cSrcweir if ( rMark.IsMarked() || rMark.IsMultiMarked() )
1519cdf0e10cSrcweir {
1520cdf0e10cSrcweir SCCOL nCurX;
1521cdf0e10cSrcweir SCROW nCurY;
1522cdf0e10cSrcweir aViewData.GetMoveCursor( nCurX,nCurY );
1523cdf0e10cSrcweir MoveCursorAbs( nCurX, nCurY, SC_FOLLOW_NONE, sal_False, sal_False );
1524cdf0e10cSrcweir
1525cdf0e10cSrcweir SelectionChanged();
1526cdf0e10cSrcweir }
1527cdf0e10cSrcweir }
1528cdf0e10cSrcweir
SetMarkData(const ScMarkData & rNew)1529cdf0e10cSrcweir void ScTabView::SetMarkData( const ScMarkData& rNew )
1530cdf0e10cSrcweir {
1531cdf0e10cSrcweir DoneBlockMode();
1532cdf0e10cSrcweir InitOwnBlockMode();
1533cdf0e10cSrcweir aViewData.GetMarkData() = rNew;
1534cdf0e10cSrcweir
1535cdf0e10cSrcweir MarkDataChanged();
1536cdf0e10cSrcweir }
1537cdf0e10cSrcweir
MarkDataChanged()1538cdf0e10cSrcweir void ScTabView::MarkDataChanged()
1539cdf0e10cSrcweir {
1540cdf0e10cSrcweir // has to be called after making direct changes to mark data (not via MarkCursor etc)
1541cdf0e10cSrcweir
1542cdf0e10cSrcweir UpdateSelectionOverlay();
1543cdf0e10cSrcweir }
1544cdf0e10cSrcweir
SelectNextTab(short nDir,sal_Bool bExtendSelection)1545cdf0e10cSrcweir void ScTabView::SelectNextTab( short nDir, sal_Bool bExtendSelection )
1546cdf0e10cSrcweir {
1547cdf0e10cSrcweir if (!nDir) return;
1548cdf0e10cSrcweir DBG_ASSERT( nDir==-1 || nDir==1, "SelectNextTab: falscher Wert");
1549cdf0e10cSrcweir
1550cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1551cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1552cdf0e10cSrcweir if (nDir<0)
1553cdf0e10cSrcweir {
1554cdf0e10cSrcweir if (!nTab) return;
1555cdf0e10cSrcweir --nTab;
1556cdf0e10cSrcweir while (!pDoc->IsVisible(nTab))
1557cdf0e10cSrcweir {
1558cdf0e10cSrcweir if (!nTab) return;
1559cdf0e10cSrcweir --nTab;
1560cdf0e10cSrcweir }
1561cdf0e10cSrcweir }
1562cdf0e10cSrcweir else
1563cdf0e10cSrcweir {
1564cdf0e10cSrcweir SCTAB nCount = pDoc->GetTableCount();
1565cdf0e10cSrcweir ++nTab;
1566cdf0e10cSrcweir if (nTab >= nCount) return;
1567cdf0e10cSrcweir while (!pDoc->IsVisible(nTab))
1568cdf0e10cSrcweir {
1569cdf0e10cSrcweir ++nTab;
1570cdf0e10cSrcweir if (nTab >= nCount) return;
1571cdf0e10cSrcweir }
1572cdf0e10cSrcweir }
1573cdf0e10cSrcweir
1574cdf0e10cSrcweir SetTabNo( nTab, sal_False, bExtendSelection );
1575cdf0e10cSrcweir PaintExtras();
1576cdf0e10cSrcweir }
1577cdf0e10cSrcweir
UpdateVisibleRange()1578cdf0e10cSrcweir void ScTabView::UpdateVisibleRange()
1579cdf0e10cSrcweir {
1580cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++)
1581cdf0e10cSrcweir if (pGridWin[i] && pGridWin[i]->IsVisible())
1582cdf0e10cSrcweir pGridWin[i]->UpdateVisibleRange();
1583cdf0e10cSrcweir }
1584cdf0e10cSrcweir
1585cdf0e10cSrcweir // SetTabNo - angezeigte Tabelle
1586cdf0e10cSrcweir
SetTabNo(SCTAB nTab,sal_Bool bNew,sal_Bool bExtendSelection,bool bSameTabButMoved)1587cdf0e10cSrcweir void ScTabView::SetTabNo( SCTAB nTab, sal_Bool bNew, sal_Bool bExtendSelection, bool bSameTabButMoved )
1588cdf0e10cSrcweir {
1589cdf0e10cSrcweir if ( !ValidTab(nTab) )
1590cdf0e10cSrcweir {
1591cdf0e10cSrcweir DBG_ERROR("SetTabNo: falsche Tabelle");
1592cdf0e10cSrcweir return;
1593cdf0e10cSrcweir }
1594cdf0e10cSrcweir
1595cdf0e10cSrcweir if ( nTab != aViewData.GetTabNo() || bNew )
1596cdf0e10cSrcweir {
1597cdf0e10cSrcweir // #57724# Die FormShell moechte vor dem Umschalten benachrichtigt werden
1598cdf0e10cSrcweir FmFormShell* pFormSh = aViewData.GetViewShell()->GetFormShell();
1599cdf0e10cSrcweir if (pFormSh)
1600cdf0e10cSrcweir {
1601cdf0e10cSrcweir sal_Bool bAllowed = sal::static_int_cast<sal_Bool>( pFormSh->PrepareClose( sal_True ) );
1602cdf0e10cSrcweir if (!bAllowed)
1603cdf0e10cSrcweir {
1604cdf0e10cSrcweir //! Fehlermeldung? oder macht das die FormShell selber?
1605cdf0e10cSrcweir //! Fehler-Flag zurueckgeben und Aktionen abbrechen
1606cdf0e10cSrcweir
1607cdf0e10cSrcweir return; // Die FormShell sagt, es kann nicht umgeschaltet werden
1608cdf0e10cSrcweir }
1609cdf0e10cSrcweir }
1610cdf0e10cSrcweir
1611cdf0e10cSrcweir // nicht InputEnterHandler wegen Referenzeingabe !
1612cdf0e10cSrcweir
1613cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1614cdf0e10cSrcweir pDoc->MakeTable( nTab );
1615cdf0e10cSrcweir
1616cdf0e10cSrcweir // Update pending row heights before switching the sheet, so Reschedule from the progress bar
1617cdf0e10cSrcweir // doesn't paint the new sheet with old heights
1618cdf0e10cSrcweir aViewData.GetDocShell()->UpdatePendingRowHeights( nTab );
1619cdf0e10cSrcweir
1620cdf0e10cSrcweir SCTAB nTabCount = pDoc->GetTableCount();
1621cdf0e10cSrcweir SCTAB nOldPos = nTab;
1622cdf0e10cSrcweir while (!pDoc->IsVisible(nTab)) // naechste sichtbare suchen
1623cdf0e10cSrcweir {
1624cdf0e10cSrcweir sal_Bool bUp = (nTab>=nOldPos);
1625cdf0e10cSrcweir if (bUp)
1626cdf0e10cSrcweir {
1627cdf0e10cSrcweir ++nTab;
1628cdf0e10cSrcweir if (nTab>=nTabCount)
1629cdf0e10cSrcweir {
1630cdf0e10cSrcweir nTab = nOldPos;
1631cdf0e10cSrcweir bUp = sal_False;
1632cdf0e10cSrcweir }
1633cdf0e10cSrcweir }
1634cdf0e10cSrcweir
1635cdf0e10cSrcweir if (!bUp)
1636cdf0e10cSrcweir {
1637cdf0e10cSrcweir if (nTab != 0)
1638cdf0e10cSrcweir --nTab;
1639cdf0e10cSrcweir else
1640cdf0e10cSrcweir {
1641cdf0e10cSrcweir DBG_ERROR("keine sichtbare Tabelle");
1642cdf0e10cSrcweir pDoc->SetVisible( 0, sal_True );
1643cdf0e10cSrcweir }
1644cdf0e10cSrcweir }
1645cdf0e10cSrcweir }
1646cdf0e10cSrcweir
1647cdf0e10cSrcweir // #i71490# Deselect drawing objects before changing the sheet number in view data,
1648cdf0e10cSrcweir // so the handling of notes still has the sheet selected on which the notes are.
1649cdf0e10cSrcweir DrawDeselectAll();
1650cdf0e10cSrcweir
1651cdf0e10cSrcweir ScModule* pScMod = SC_MOD();
1652cdf0e10cSrcweir sal_Bool bRefMode = pScMod->IsFormulaMode();
1653cdf0e10cSrcweir if ( !bRefMode ) // Abfrage, damit RefMode bei Tabellenwechsel funktioniert
1654cdf0e10cSrcweir {
1655cdf0e10cSrcweir DoneBlockMode();
1656cdf0e10cSrcweir pSelEngine->Reset(); // reset all flags, including locked modifiers
1657cdf0e10cSrcweir aViewData.SetRefTabNo( nTab );
1658cdf0e10cSrcweir }
1659cdf0e10cSrcweir
1660cdf0e10cSrcweir ScSplitPos eOldActive = aViewData.GetActivePart(); // before switching
1661cdf0e10cSrcweir sal_Bool bFocus = pGridWin[eOldActive]->HasFocus();
1662cdf0e10cSrcweir
1663cdf0e10cSrcweir aViewData.SetTabNo( nTab );
1664cdf0e10cSrcweir // UpdateShow noch vor SetCursor, damit UpdateAutoFillMark die richtigen
1665cdf0e10cSrcweir // Fenster findet (wird aus SetCursor gerufen)
1666cdf0e10cSrcweir UpdateShow();
1667cdf0e10cSrcweir aViewData.ResetOldCursor();
1668cdf0e10cSrcweir SetCursor( aViewData.GetCurX(), aViewData.GetCurY(), sal_True );
1669cdf0e10cSrcweir
1670cdf0e10cSrcweir SfxBindings& rBindings = aViewData.GetBindings();
1671cdf0e10cSrcweir ScMarkData& rMark = aViewData.GetMarkData();
1672cdf0e10cSrcweir
1673cdf0e10cSrcweir bool bAllSelected = true;
1674cdf0e10cSrcweir for (SCTAB nSelTab = 0; nSelTab < nTabCount; ++nSelTab)
1675cdf0e10cSrcweir {
1676cdf0e10cSrcweir if (!pDoc->IsVisible(nSelTab) || rMark.GetTableSelect(nSelTab))
1677cdf0e10cSrcweir {
1678cdf0e10cSrcweir if (nTab == nSelTab)
1679cdf0e10cSrcweir // This tab is already in selection. Keep the current
1680cdf0e10cSrcweir // selection.
1681cdf0e10cSrcweir bExtendSelection = true;
1682cdf0e10cSrcweir }
1683cdf0e10cSrcweir else
1684cdf0e10cSrcweir {
1685cdf0e10cSrcweir bAllSelected = false;
1686cdf0e10cSrcweir if (bExtendSelection)
1687cdf0e10cSrcweir // We got what we need. No need to stay in the loop.
1688cdf0e10cSrcweir break;
1689cdf0e10cSrcweir }
1690cdf0e10cSrcweir }
1691cdf0e10cSrcweir if (bAllSelected && !bNew)
1692cdf0e10cSrcweir // #i6327# if all tables are selected, a selection event (#i6330#) will deselect all
1693cdf0e10cSrcweir // (not if called with bNew to update settings)
1694cdf0e10cSrcweir bExtendSelection = false;
1695cdf0e10cSrcweir
1696cdf0e10cSrcweir if (bExtendSelection)
1697cdf0e10cSrcweir rMark.SelectTable( nTab, sal_True );
1698cdf0e10cSrcweir else
1699cdf0e10cSrcweir {
1700cdf0e10cSrcweir rMark.SelectOneTable( nTab );
1701cdf0e10cSrcweir rBindings.Invalidate( FID_FILL_TAB );
1702cdf0e10cSrcweir rBindings.Invalidate( FID_TAB_DESELECTALL );
1703cdf0e10cSrcweir }
1704cdf0e10cSrcweir
1705cdf0e10cSrcweir bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF;
1706cdf0e10cSrcweir
1707cdf0e10cSrcweir // recalc zoom-dependent values (before TabChanged, before UpdateEditViewPos)
1708cdf0e10cSrcweir RefreshZoom();
1709cdf0e10cSrcweir UpdateVarZoom();
1710cdf0e10cSrcweir
1711cdf0e10cSrcweir if ( bRefMode ) // hide EditView if necessary (after aViewData.SetTabNo !)
1712cdf0e10cSrcweir {
1713cdf0e10cSrcweir for ( sal_uInt16 i=0; i<4; i++ )
1714cdf0e10cSrcweir if ( pGridWin[i] )
1715cdf0e10cSrcweir if ( pGridWin[i]->IsVisible() )
1716cdf0e10cSrcweir pGridWin[i]->UpdateEditViewPos();
1717cdf0e10cSrcweir }
1718cdf0e10cSrcweir
1719cdf0e10cSrcweir TabChanged( bSameTabButMoved ); // DrawView
1720cdf0e10cSrcweir
1721cdf0e10cSrcweir aViewData.GetViewShell()->WindowChanged(); // falls das aktive Fenster anders ist
1722cdf0e10cSrcweir if ( !bUnoRefDialog )
1723cdf0e10cSrcweir aViewData.GetViewShell()->DisconnectAllClients(); // important for floating frames
1724cdf0e10cSrcweir else
1725cdf0e10cSrcweir {
1726cdf0e10cSrcweir // hide / show inplace client
1727cdf0e10cSrcweir
1728cdf0e10cSrcweir ScClient* pClient = static_cast<ScClient*>(aViewData.GetViewShell()->GetIPClient());
1729cdf0e10cSrcweir if ( pClient && pClient->IsObjectInPlaceActive() )
1730cdf0e10cSrcweir {
1731cdf0e10cSrcweir Rectangle aObjArea = pClient->GetObjArea();
1732cdf0e10cSrcweir if ( nTab == aViewData.GetRefTabNo() )
1733cdf0e10cSrcweir {
1734cdf0e10cSrcweir // move to its original position
1735cdf0e10cSrcweir
1736cdf0e10cSrcweir SdrOle2Obj* pDrawObj = pClient->GetDrawObj();
1737cdf0e10cSrcweir if ( pDrawObj )
1738cdf0e10cSrcweir {
1739cdf0e10cSrcweir Rectangle aRect = pDrawObj->GetLogicRect();
1740cdf0e10cSrcweir MapMode aMapMode( MAP_100TH_MM );
1741cdf0e10cSrcweir Size aOleSize = pDrawObj->GetOrigObjSize( &aMapMode );
1742cdf0e10cSrcweir aRect.SetSize( aOleSize );
1743cdf0e10cSrcweir aObjArea = aRect;
1744cdf0e10cSrcweir }
1745cdf0e10cSrcweir }
1746cdf0e10cSrcweir else
1747cdf0e10cSrcweir {
1748cdf0e10cSrcweir // move to an invisible position
1749cdf0e10cSrcweir
1750cdf0e10cSrcweir aObjArea.SetPos( Point( 0, -2*aObjArea.GetHeight() ) );
1751cdf0e10cSrcweir }
1752cdf0e10cSrcweir pClient->SetObjArea( aObjArea );
1753cdf0e10cSrcweir }
1754cdf0e10cSrcweir }
1755cdf0e10cSrcweir
1756cdf0e10cSrcweir if ( bFocus && aViewData.GetActivePart() != eOldActive && !bRefMode )
1757cdf0e10cSrcweir ActiveGrabFocus(); // grab focus to the pane that's active now
1758cdf0e10cSrcweir
1759cdf0e10cSrcweir // Fixierungen
1760cdf0e10cSrcweir
1761cdf0e10cSrcweir sal_Bool bResize = sal_False;
1762cdf0e10cSrcweir if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
1763cdf0e10cSrcweir if (aViewData.UpdateFixX())
1764cdf0e10cSrcweir bResize = sal_True;
1765cdf0e10cSrcweir if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
1766cdf0e10cSrcweir if (aViewData.UpdateFixY())
1767cdf0e10cSrcweir bResize = sal_True;
1768cdf0e10cSrcweir if (bResize)
1769cdf0e10cSrcweir RepeatResize();
1770cdf0e10cSrcweir InvalidateSplit();
1771cdf0e10cSrcweir
1772cdf0e10cSrcweir // #163911# Update the visible range in each GridWin directly, don't wait for the repaint event.
1773cdf0e10cSrcweir UpdateVisibleRange();
1774cdf0e10cSrcweir
1775cdf0e10cSrcweir if ( aViewData.IsPagebreakMode() )
1776cdf0e10cSrcweir UpdatePageBreakData(); //! asynchron ??
1777cdf0e10cSrcweir
1778cdf0e10cSrcweir // #53551# Form-Layer muss den sichtbaren Ausschnitt der neuen Tabelle kennen
1779cdf0e10cSrcweir // dafuer muss hier schon der MapMode stimmen
1780cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++)
1781cdf0e10cSrcweir if (pGridWin[i])
1782cdf0e10cSrcweir pGridWin[i]->SetMapMode( pGridWin[i]->GetDrawMapMode() );
1783cdf0e10cSrcweir SetNewVisArea();
1784cdf0e10cSrcweir
1785cdf0e10cSrcweir PaintGrid();
1786cdf0e10cSrcweir PaintTop();
1787cdf0e10cSrcweir PaintLeft();
1788cdf0e10cSrcweir PaintExtras();
1789cdf0e10cSrcweir
1790cdf0e10cSrcweir DoResize( aBorderPos, aFrameSize );
1791cdf0e10cSrcweir rBindings.Invalidate( SID_DELETE_PRINTAREA ); // Menue
1792cdf0e10cSrcweir rBindings.Invalidate( FID_DEL_MANUALBREAKS );
1793cdf0e10cSrcweir rBindings.Invalidate( FID_RESET_PRINTZOOM );
1794cdf0e10cSrcweir rBindings.Invalidate( SID_STATUS_DOCPOS ); // Statusbar
1795cdf0e10cSrcweir rBindings.Invalidate( SID_STATUS_PAGESTYLE ); // Statusbar
1796cdf0e10cSrcweir rBindings.Invalidate( SID_CURRENTTAB ); // Navigator
1797cdf0e10cSrcweir rBindings.Invalidate( SID_STYLE_FAMILY2 ); // Gestalter
1798cdf0e10cSrcweir rBindings.Invalidate( SID_STYLE_FAMILY4 ); // Gestalter
1799cdf0e10cSrcweir rBindings.Invalidate( SID_TABLES_COUNT );
1800cdf0e10cSrcweir
1801cdf0e10cSrcweir if(pScMod->IsRefDialogOpen())
1802cdf0e10cSrcweir {
1803cdf0e10cSrcweir sal_uInt16 nCurRefDlgId=pScMod->GetCurRefDlgId();
1804cdf0e10cSrcweir SfxViewFrame* pViewFrm = aViewData.GetViewShell()->GetViewFrame();
1805cdf0e10cSrcweir SfxChildWindow* pChildWnd = pViewFrm->GetChildWindow( nCurRefDlgId );
1806cdf0e10cSrcweir if ( pChildWnd )
1807cdf0e10cSrcweir {
1808cdf0e10cSrcweir IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
1809cdf0e10cSrcweir pRefDlg->ViewShellChanged(NULL);
1810cdf0e10cSrcweir }
1811cdf0e10cSrcweir }
1812cdf0e10cSrcweir }
1813cdf0e10cSrcweir }
1814cdf0e10cSrcweir
1815cdf0e10cSrcweir //
1816cdf0e10cSrcweir // Paint-Funktionen - nur fuer diese View
1817cdf0e10cSrcweir //
1818cdf0e10cSrcweir
MakeEditView(ScEditEngineDefaulter * pEngine,SCCOL nCol,SCROW nRow)1819cdf0e10cSrcweir void ScTabView::MakeEditView( ScEditEngineDefaulter* pEngine, SCCOL nCol, SCROW nRow )
1820cdf0e10cSrcweir {
1821cdf0e10cSrcweir DrawDeselectAll();
1822cdf0e10cSrcweir
1823cdf0e10cSrcweir if (pDrawView)
1824cdf0e10cSrcweir DrawEnableAnim( sal_False );
1825cdf0e10cSrcweir
1826cdf0e10cSrcweir EditView* pSpellingView = aViewData.GetSpellingView();
1827cdf0e10cSrcweir
1828cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++)
1829cdf0e10cSrcweir if (pGridWin[i])
1830cdf0e10cSrcweir if ( pGridWin[i]->IsVisible() && !aViewData.HasEditView((ScSplitPos)i) )
1831cdf0e10cSrcweir {
1832cdf0e10cSrcweir ScHSplitPos eHWhich = WhichH( (ScSplitPos) i );
1833cdf0e10cSrcweir ScVSplitPos eVWhich = WhichV( (ScSplitPos) i );
1834cdf0e10cSrcweir SCCOL nScrX = aViewData.GetPosX( eHWhich );
1835cdf0e10cSrcweir SCROW nScrY = aViewData.GetPosY( eVWhich );
1836cdf0e10cSrcweir
1837cdf0e10cSrcweir sal_Bool bPosVisible =
1838cdf0e10cSrcweir ( nCol >= nScrX && nCol <= nScrX + aViewData.VisibleCellsX(eHWhich) + 1 &&
1839cdf0e10cSrcweir nRow >= nScrY && nRow <= nScrY + aViewData.VisibleCellsY(eVWhich) + 1 );
1840cdf0e10cSrcweir
1841cdf0e10cSrcweir // #102421# for the active part, create edit view even if outside the visible area,
1842cdf0e10cSrcweir // so input isn't lost (and the edit view may be scrolled into the visible area)
1843cdf0e10cSrcweir
1844cdf0e10cSrcweir // #i26433# during spelling, the spelling view must be active
1845cdf0e10cSrcweir if ( bPosVisible || aViewData.GetActivePart() == (ScSplitPos) i ||
1846cdf0e10cSrcweir ( pSpellingView && aViewData.GetEditView((ScSplitPos) i) == pSpellingView ) )
1847cdf0e10cSrcweir {
1848cdf0e10cSrcweir pGridWin[i]->HideCursor();
1849cdf0e10cSrcweir
1850cdf0e10cSrcweir pGridWin[i]->DeleteCursorOverlay();
1851cdf0e10cSrcweir pGridWin[i]->DeleteAutoFillOverlay();
1852cdf0e10cSrcweir
1853cdf0e10cSrcweir // flush OverlayManager before changing MapMode to text edit
1854cdf0e10cSrcweir pGridWin[i]->flushOverlayManager();
1855cdf0e10cSrcweir
1856cdf0e10cSrcweir // MapMode must be set after HideCursor
1857cdf0e10cSrcweir pGridWin[i]->SetMapMode(aViewData.GetLogicMode());
1858cdf0e10cSrcweir
1859cdf0e10cSrcweir aViewData.SetEditEngine( (ScSplitPos) i, pEngine, pGridWin[i], nCol, nRow );
1860cdf0e10cSrcweir
1861cdf0e10cSrcweir if ( !bPosVisible )
1862cdf0e10cSrcweir {
1863cdf0e10cSrcweir // move the edit view area to the real (possibly negative) position,
1864cdf0e10cSrcweir // or hide if completely above or left of the window
1865cdf0e10cSrcweir pGridWin[i]->UpdateEditViewPos();
1866cdf0e10cSrcweir }
1867cdf0e10cSrcweir }
1868cdf0e10cSrcweir }
1869cdf0e10cSrcweir
1870cdf0e10cSrcweir if (aViewData.GetViewShell()->HasAccessibilityObjects())
1871cdf0e10cSrcweir aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_ENTEREDITMODE));
1872cdf0e10cSrcweir }
1873cdf0e10cSrcweir
UpdateEditView()1874cdf0e10cSrcweir void ScTabView::UpdateEditView()
1875cdf0e10cSrcweir {
1876cdf0e10cSrcweir ScSplitPos eActive = aViewData.GetActivePart();
1877cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++)
1878cdf0e10cSrcweir if (aViewData.HasEditView( (ScSplitPos) i ))
1879cdf0e10cSrcweir {
1880cdf0e10cSrcweir EditView* pEditView = aViewData.GetEditView( (ScSplitPos) i );
1881cdf0e10cSrcweir aViewData.SetEditEngine( (ScSplitPos) i,
1882cdf0e10cSrcweir static_cast<ScEditEngineDefaulter*>(pEditView->GetEditEngine()),
1883cdf0e10cSrcweir pGridWin[i], GetViewData()->GetCurX(), GetViewData()->GetCurY() );
1884cdf0e10cSrcweir if ( (ScSplitPos)i == eActive )
1885cdf0e10cSrcweir pEditView->ShowCursor( sal_False );
1886cdf0e10cSrcweir }
1887cdf0e10cSrcweir }
1888cdf0e10cSrcweir
KillEditView(sal_Bool bNoPaint)1889cdf0e10cSrcweir void ScTabView::KillEditView( sal_Bool bNoPaint )
1890cdf0e10cSrcweir {
1891cdf0e10cSrcweir sal_uInt16 i;
1892cdf0e10cSrcweir SCCOL nCol1 = aViewData.GetEditStartCol();
1893cdf0e10cSrcweir SCROW nRow1 = aViewData.GetEditStartRow();
1894cdf0e10cSrcweir SCCOL nCol2 = aViewData.GetEditEndCol();
1895cdf0e10cSrcweir SCROW nRow2 = aViewData.GetEditEndRow();
1896cdf0e10cSrcweir sal_Bool bPaint[4];
1897cdf0e10cSrcweir sal_Bool bNotifyAcc(false);
1898cdf0e10cSrcweir
1899cdf0e10cSrcweir sal_Bool bExtended = nRow1 != nRow2; // Col wird sowieso bis zum Ende gezeichnet
1900cdf0e10cSrcweir sal_Bool bAtCursor = nCol1 <= aViewData.GetCurX() &&
1901cdf0e10cSrcweir nCol2 >= aViewData.GetCurX() &&
1902cdf0e10cSrcweir nRow1 == aViewData.GetCurY();
1903cdf0e10cSrcweir for (i=0; i<4; i++)
1904cdf0e10cSrcweir {
1905cdf0e10cSrcweir bPaint[i] = aViewData.HasEditView( (ScSplitPos) i );
1906cdf0e10cSrcweir if (bPaint[i])
1907cdf0e10cSrcweir bNotifyAcc = true;
1908cdf0e10cSrcweir }
1909cdf0e10cSrcweir
1910cdf0e10cSrcweir // #108931#; notify accessibility before all things happen
1911cdf0e10cSrcweir if ((bNotifyAcc) && (aViewData.GetViewShell()->HasAccessibilityObjects()))
1912cdf0e10cSrcweir aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_LEAVEEDITMODE));
1913cdf0e10cSrcweir
1914cdf0e10cSrcweir aViewData.ResetEditView();
1915cdf0e10cSrcweir for (i=0; i<4; i++)
1916cdf0e10cSrcweir if (pGridWin[i] && bPaint[i])
1917cdf0e10cSrcweir if (pGridWin[i]->IsVisible())
1918cdf0e10cSrcweir {
1919cdf0e10cSrcweir pGridWin[i]->ShowCursor();
1920cdf0e10cSrcweir
1921cdf0e10cSrcweir pGridWin[i]->SetMapMode(pGridWin[i]->GetDrawMapMode());
1922cdf0e10cSrcweir
1923cdf0e10cSrcweir // #i73567# the cell still has to be repainted
1924cdf0e10cSrcweir if (bExtended || ( bAtCursor && !bNoPaint ))
1925cdf0e10cSrcweir {
1926cdf0e10cSrcweir pGridWin[i]->Draw( nCol1, nRow1, nCol2, nRow2 );
1927cdf0e10cSrcweir pGridWin[i]->UpdateSelectionOverlay();
1928cdf0e10cSrcweir }
1929cdf0e10cSrcweir }
1930cdf0e10cSrcweir
1931cdf0e10cSrcweir if (pDrawView)
1932cdf0e10cSrcweir DrawEnableAnim( sal_True );
1933cdf0e10cSrcweir
1934cdf0e10cSrcweir // GrabFocus immer dann, wenn diese View aktiv ist und
1935cdf0e10cSrcweir // die Eingabezeile den Focus hat
1936cdf0e10cSrcweir
1937cdf0e10cSrcweir sal_Bool bGrabFocus = sal_False;
1938cdf0e10cSrcweir if (aViewData.IsActive())
1939cdf0e10cSrcweir {
1940cdf0e10cSrcweir ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
1941cdf0e10cSrcweir if ( pInputHdl )
1942cdf0e10cSrcweir {
1943cdf0e10cSrcweir ScInputWindow* pInputWin = pInputHdl->GetInputWindow();
1944cdf0e10cSrcweir if (pInputWin && pInputWin->IsInputActive())
1945cdf0e10cSrcweir bGrabFocus = sal_True;
1946cdf0e10cSrcweir }
1947cdf0e10cSrcweir }
1948cdf0e10cSrcweir
1949cdf0e10cSrcweir if (bGrabFocus)
1950cdf0e10cSrcweir {
1951cdf0e10cSrcweir // So soll es gemacht werden, damit der Sfx es mitbekommt, klappt aber nicht:
1952cdf0e10cSrcweir //! aViewData.GetViewShell()->GetViewFrame()->GetWindow().GrabFocus();
1953cdf0e10cSrcweir // deshalb erstmal so:
1954cdf0e10cSrcweir GetActiveWin()->GrabFocus();
1955cdf0e10cSrcweir }
1956cdf0e10cSrcweir
1957cdf0e10cSrcweir // Cursor-Abfrage erst nach GrabFocus
1958cdf0e10cSrcweir
1959cdf0e10cSrcweir for (i=0; i<4; i++)
1960cdf0e10cSrcweir if (pGridWin[i] && pGridWin[i]->IsVisible())
1961cdf0e10cSrcweir {
1962cdf0e10cSrcweir Cursor* pCur = pGridWin[i]->GetCursor();
1963cdf0e10cSrcweir if (pCur && pCur->IsVisible())
1964cdf0e10cSrcweir pCur->Hide();
1965cdf0e10cSrcweir
1966cdf0e10cSrcweir if(bPaint[i])
1967cdf0e10cSrcweir {
1968cdf0e10cSrcweir pGridWin[i]->UpdateCursorOverlay();
1969cdf0e10cSrcweir pGridWin[i]->UpdateAutoFillOverlay();
1970cdf0e10cSrcweir // pGridWin[i]->UpdateAllOverlays();
1971cdf0e10cSrcweir }
1972cdf0e10cSrcweir }
1973cdf0e10cSrcweir }
1974cdf0e10cSrcweir
UpdateFormulas()1975cdf0e10cSrcweir void ScTabView::UpdateFormulas()
1976cdf0e10cSrcweir {
1977cdf0e10cSrcweir if ( aViewData.GetDocument()->IsAutoCalcShellDisabled() )
1978cdf0e10cSrcweir return ;
1979cdf0e10cSrcweir
1980cdf0e10cSrcweir sal_uInt16 i;
1981cdf0e10cSrcweir for (i=0; i<4; i++)
1982cdf0e10cSrcweir if (pGridWin[i])
1983cdf0e10cSrcweir if (pGridWin[i]->IsVisible())
1984cdf0e10cSrcweir pGridWin[i]->UpdateFormulas();
1985cdf0e10cSrcweir
1986cdf0e10cSrcweir if ( aViewData.IsPagebreakMode() )
1987cdf0e10cSrcweir UpdatePageBreakData(); //! asynchron
1988cdf0e10cSrcweir
1989cdf0e10cSrcweir UpdateHeaderWidth();
1990cdf0e10cSrcweir
1991cdf0e10cSrcweir // if in edit mode, adjust edit view area because widths/heights may have changed
1992cdf0e10cSrcweir if ( aViewData.HasEditView( aViewData.GetActivePart() ) )
1993cdf0e10cSrcweir UpdateEditView();
1994cdf0e10cSrcweir }
1995cdf0e10cSrcweir
1996cdf0e10cSrcweir // PaintArea -Block neu zeichnen
1997cdf0e10cSrcweir
PaintArea(SCCOL nStartCol,SCROW nStartRow,SCCOL nEndCol,SCROW nEndRow,ScUpdateMode eMode)1998cdf0e10cSrcweir void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1999cdf0e10cSrcweir ScUpdateMode eMode )
2000cdf0e10cSrcweir {
2001cdf0e10cSrcweir sal_uInt16 i;
2002cdf0e10cSrcweir SCCOL nCol1;
2003cdf0e10cSrcweir SCROW nRow1;
2004cdf0e10cSrcweir SCCOL nCol2;
2005cdf0e10cSrcweir SCROW nRow2;
2006cdf0e10cSrcweir
2007cdf0e10cSrcweir PutInOrder( nStartCol, nEndCol );
2008cdf0e10cSrcweir PutInOrder( nStartRow, nEndRow );
2009cdf0e10cSrcweir
2010cdf0e10cSrcweir for (i=0; i<4; i++)
2011cdf0e10cSrcweir if (pGridWin[i])
2012cdf0e10cSrcweir if (pGridWin[i]->IsVisible())
2013cdf0e10cSrcweir {
2014cdf0e10cSrcweir ScHSplitPos eHWhich = WhichH( (ScSplitPos) i );
2015cdf0e10cSrcweir ScVSplitPos eVWhich = WhichV( (ScSplitPos) i );
2016cdf0e10cSrcweir sal_Bool bOut = sal_False;
2017cdf0e10cSrcweir
2018cdf0e10cSrcweir nCol1 = nStartCol;
2019cdf0e10cSrcweir nRow1 = nStartRow;
2020cdf0e10cSrcweir nCol2 = nEndCol;
2021cdf0e10cSrcweir nRow2 = nEndRow;
2022cdf0e10cSrcweir
2023cdf0e10cSrcweir SCCOL nScrX = aViewData.GetPosX( eHWhich );
2024cdf0e10cSrcweir SCROW nScrY = aViewData.GetPosY( eVWhich );
2025cdf0e10cSrcweir if (nCol1 < nScrX) nCol1 = nScrX;
2026cdf0e10cSrcweir if (nCol2 < nScrX)
2027cdf0e10cSrcweir {
2028cdf0e10cSrcweir if ( eMode == SC_UPDATE_ALL ) // #91240# for UPDATE_ALL, paint anyway
2029cdf0e10cSrcweir nCol2 = nScrX; // (because of extending strings to the right)
2030cdf0e10cSrcweir else
2031cdf0e10cSrcweir bOut = sal_True; // completely outside the window
2032cdf0e10cSrcweir }
2033cdf0e10cSrcweir if (nRow1 < nScrY) nRow1 = nScrY;
2034cdf0e10cSrcweir if (nRow2 < nScrY) bOut = sal_True;
2035cdf0e10cSrcweir
2036cdf0e10cSrcweir SCCOL nLastX = nScrX + aViewData.VisibleCellsX( eHWhich ) + 1;
2037cdf0e10cSrcweir SCROW nLastY = nScrY + aViewData.VisibleCellsY( eVWhich ) + 1;
2038cdf0e10cSrcweir if (nCol1 > nLastX) bOut = sal_True;
2039cdf0e10cSrcweir if (nCol2 > nLastX) nCol2 = nLastX;
2040cdf0e10cSrcweir if (nRow1 > nLastY) bOut = sal_True;
2041cdf0e10cSrcweir if (nRow2 > nLastY) nRow2 = nLastY;
2042cdf0e10cSrcweir
2043cdf0e10cSrcweir if (!bOut)
2044cdf0e10cSrcweir {
2045cdf0e10cSrcweir if ( eMode == SC_UPDATE_CHANGED )
2046cdf0e10cSrcweir pGridWin[i]->Draw( nCol1, nRow1, nCol2, nRow2, eMode );
2047cdf0e10cSrcweir else // ALL oder MARKS
2048cdf0e10cSrcweir {
2049cdf0e10cSrcweir sal_Bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
2050cdf0e10cSrcweir long nLayoutSign = bLayoutRTL ? -1 : 1;
2051cdf0e10cSrcweir
2052cdf0e10cSrcweir Point aStart = aViewData.GetScrPos( nCol1, nRow1, (ScSplitPos) i );
2053cdf0e10cSrcweir Point aEnd = aViewData.GetScrPos( nCol2+1, nRow2+1, (ScSplitPos) i );
2054cdf0e10cSrcweir if ( eMode == SC_UPDATE_ALL )
2055cdf0e10cSrcweir aEnd.X() = bLayoutRTL ? 0 : (pGridWin[i]->GetOutputSizePixel().Width());
2056cdf0e10cSrcweir aEnd.X() -= nLayoutSign;
2057cdf0e10cSrcweir aEnd.Y() -= 1;
2058cdf0e10cSrcweir
2059cdf0e10cSrcweir // #i85232# include area below cells (could be done in GetScrPos?)
2060cdf0e10cSrcweir if ( eMode == SC_UPDATE_ALL && nRow2 >= MAXROW )
2061cdf0e10cSrcweir aEnd.Y() = pGridWin[i]->GetOutputSizePixel().Height();
2062cdf0e10cSrcweir
2063cdf0e10cSrcweir sal_Bool bShowChanges = sal_True; //! ...
2064cdf0e10cSrcweir if (bShowChanges)
2065cdf0e10cSrcweir {
2066cdf0e10cSrcweir aStart.X() -= nLayoutSign; // include change marks
2067cdf0e10cSrcweir aStart.Y() -= 1;
2068cdf0e10cSrcweir }
2069cdf0e10cSrcweir
2070cdf0e10cSrcweir sal_Bool bMarkClipped = aViewData.GetOptions().GetOption( VOPT_CLIPMARKS );
2071cdf0e10cSrcweir if (bMarkClipped)
2072cdf0e10cSrcweir {
2073cdf0e10cSrcweir // dazu muesste ScColumn::IsEmptyBlock optimiert werden
2074cdf0e10cSrcweir // (auf Search() umstellen)
2075cdf0e10cSrcweir //!if ( nCol1 > 0 && !aViewData.GetDocument()->IsBlockEmpty(
2076cdf0e10cSrcweir //! aViewData.GetTabNo(),
2077cdf0e10cSrcweir //! 0, nRow1, nCol1-1, nRow2 ) )
2078cdf0e10cSrcweir {
2079cdf0e10cSrcweir long nMarkPixel = (long)( SC_CLIPMARK_SIZE * aViewData.GetPPTX() );
2080cdf0e10cSrcweir aStart.X() -= nMarkPixel * nLayoutSign;
2081cdf0e10cSrcweir if (!bShowChanges)
2082cdf0e10cSrcweir aStart.X() -= nLayoutSign; // cell grid
2083cdf0e10cSrcweir }
2084cdf0e10cSrcweir }
2085cdf0e10cSrcweir
2086cdf0e10cSrcweir pGridWin[i]->Invalidate( pGridWin[i]->PixelToLogic( Rectangle( aStart,aEnd ) ) );
2087cdf0e10cSrcweir }
2088cdf0e10cSrcweir }
2089cdf0e10cSrcweir }
2090cdf0e10cSrcweir
2091cdf0e10cSrcweir // #i79909# Calling UpdateAllOverlays here isn't necessary and would lead to overlay calls from a timer,
2092cdf0e10cSrcweir // with a wrong MapMode if editing in a cell (reference input).
2093cdf0e10cSrcweir // #i80499# Overlays need updates in a lot of cases, e.g. changing row/column size,
2094cdf0e10cSrcweir // or showing/hiding outlines. TODO: selections in inactive windows are vanishing.
2095cdf0e10cSrcweir // #i84689# With relative conditional formats, PaintArea may be called often (for each changed cell),
2096cdf0e10cSrcweir // so UpdateAllOverlays was moved to ScTabViewShell::Notify and is called only if PAINT_LEFT/PAINT_TOP
2097cdf0e10cSrcweir // is set (width or height changed).
2098cdf0e10cSrcweir }
2099cdf0e10cSrcweir
PaintRangeFinder(long nNumber)2100cdf0e10cSrcweir void ScTabView::PaintRangeFinder( long nNumber )
2101cdf0e10cSrcweir {
2102cdf0e10cSrcweir ScInputHandler* pHdl = SC_MOD()->GetInputHdl( aViewData.GetViewShell() );
2103cdf0e10cSrcweir if (pHdl)
2104cdf0e10cSrcweir {
2105cdf0e10cSrcweir ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList();
2106cdf0e10cSrcweir if ( pRangeFinder && pRangeFinder->GetDocName() == aViewData.GetDocShell()->GetTitle() )
2107cdf0e10cSrcweir {
2108cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
2109cdf0e10cSrcweir sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count();
2110cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCount; i++)
2111cdf0e10cSrcweir if ( nNumber < 0 || nNumber == i )
2112cdf0e10cSrcweir {
2113cdf0e10cSrcweir ScRangeFindData* pData = pRangeFinder->GetObject(i);
2114cdf0e10cSrcweir if (pData)
2115cdf0e10cSrcweir {
2116cdf0e10cSrcweir ScRange aRef = pData->aRef;
2117cdf0e10cSrcweir aRef.Justify(); // Justify fuer die Abfragen unten
2118cdf0e10cSrcweir
2119cdf0e10cSrcweir if ( aRef.aStart == aRef.aEnd ) //! Tab ignorieren?
2120cdf0e10cSrcweir aViewData.GetDocument()->ExtendMerge(aRef);
2121cdf0e10cSrcweir
2122cdf0e10cSrcweir if ( aRef.aStart.Tab() >= nTab && aRef.aEnd.Tab() <= nTab )
2123cdf0e10cSrcweir {
2124cdf0e10cSrcweir SCCOL nCol1 = aRef.aStart.Col();
2125cdf0e10cSrcweir SCROW nRow1 = aRef.aStart.Row();
2126cdf0e10cSrcweir SCCOL nCol2 = aRef.aEnd.Col();
2127cdf0e10cSrcweir SCROW nRow2 = aRef.aEnd.Row();
2128cdf0e10cSrcweir
2129cdf0e10cSrcweir // wegnehmen -> Repaint
2130cdf0e10cSrcweir // SC_UPDATE_MARKS: Invalidate, nicht bis zum Zeilenende
2131cdf0e10cSrcweir
2132cdf0e10cSrcweir sal_Bool bHiddenEdge = sal_False;
2133cdf0e10cSrcweir SCROW nTmp;
2134cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
2135cdf0e10cSrcweir SCCOL nLastCol = -1;
2136cdf0e10cSrcweir while ( nCol1 > 0 && pDoc->ColHidden(nCol1, nTab, nLastCol) )
2137cdf0e10cSrcweir {
2138cdf0e10cSrcweir --nCol1;
2139cdf0e10cSrcweir bHiddenEdge = sal_True;
2140cdf0e10cSrcweir }
2141cdf0e10cSrcweir while ( nCol2 < MAXCOL && pDoc->ColHidden(nCol2, nTab, nLastCol) )
2142cdf0e10cSrcweir {
2143cdf0e10cSrcweir ++nCol2;
2144cdf0e10cSrcweir bHiddenEdge = sal_True;
2145cdf0e10cSrcweir }
2146cdf0e10cSrcweir nTmp = pDoc->LastVisibleRow(0, nRow1, nTab);
2147cdf0e10cSrcweir if (!ValidRow(nTmp))
2148cdf0e10cSrcweir nTmp = 0;
2149cdf0e10cSrcweir if (nTmp < nRow1)
2150cdf0e10cSrcweir {
2151cdf0e10cSrcweir nRow1 = nTmp;
2152cdf0e10cSrcweir bHiddenEdge = sal_True;
2153cdf0e10cSrcweir }
2154cdf0e10cSrcweir nTmp = pDoc->FirstVisibleRow(nRow2, MAXROW, nTab);
2155cdf0e10cSrcweir if (!ValidRow(nTmp))
2156cdf0e10cSrcweir nTmp = MAXROW;
2157cdf0e10cSrcweir if (nTmp > nRow2)
2158cdf0e10cSrcweir {
2159cdf0e10cSrcweir nRow2 = nTmp;
2160cdf0e10cSrcweir bHiddenEdge = sal_True;
2161cdf0e10cSrcweir }
2162cdf0e10cSrcweir
2163cdf0e10cSrcweir if ( nCol2 - nCol1 > 1 && nRow2 - nRow1 > 1 && !bHiddenEdge )
2164cdf0e10cSrcweir {
2165cdf0e10cSrcweir // nur an den Raendern entlang
2166cdf0e10cSrcweir PaintArea( nCol1, nRow1, nCol2, nRow1, SC_UPDATE_MARKS );
2167cdf0e10cSrcweir PaintArea( nCol1, nRow1+1, nCol1, nRow2-1, SC_UPDATE_MARKS );
2168cdf0e10cSrcweir PaintArea( nCol2, nRow1+1, nCol2, nRow2-1, SC_UPDATE_MARKS );
2169cdf0e10cSrcweir PaintArea( nCol1, nRow2, nCol2, nRow2, SC_UPDATE_MARKS );
2170cdf0e10cSrcweir }
2171cdf0e10cSrcweir else // alles am Stueck
2172cdf0e10cSrcweir PaintArea( nCol1, nRow1, nCol2, nRow2, SC_UPDATE_MARKS );
2173cdf0e10cSrcweir }
2174cdf0e10cSrcweir }
2175cdf0e10cSrcweir }
2176cdf0e10cSrcweir }
2177cdf0e10cSrcweir }
2178cdf0e10cSrcweir }
2179cdf0e10cSrcweir
2180cdf0e10cSrcweir // fuer Chart-Daten-Markierung
2181cdf0e10cSrcweir
AddHighlightRange(const ScRange & rRange,const Color & rColor)2182cdf0e10cSrcweir void ScTabView::AddHighlightRange( const ScRange& rRange, const Color& rColor )
2183cdf0e10cSrcweir {
2184cdf0e10cSrcweir if (!pHighlightRanges)
2185cdf0e10cSrcweir pHighlightRanges = new ScHighlightRanges;
2186cdf0e10cSrcweir pHighlightRanges->Insert( new ScHighlightEntry( rRange, rColor ) );
2187cdf0e10cSrcweir
2188cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
2189cdf0e10cSrcweir if ( nTab >= rRange.aStart.Tab() && nTab <= rRange.aEnd.Tab() )
2190cdf0e10cSrcweir PaintArea( rRange.aStart.Col(), rRange.aStart.Row(),
2191cdf0e10cSrcweir rRange.aEnd.Col(), rRange.aEnd.Row(), SC_UPDATE_MARKS );
2192cdf0e10cSrcweir }
2193cdf0e10cSrcweir
ClearHighlightRanges()2194cdf0e10cSrcweir void ScTabView::ClearHighlightRanges()
2195cdf0e10cSrcweir {
2196cdf0e10cSrcweir if (pHighlightRanges)
2197cdf0e10cSrcweir {
2198cdf0e10cSrcweir ScHighlightRanges* pTemp = pHighlightRanges;
2199cdf0e10cSrcweir pHighlightRanges = NULL; // Repaint ohne Highlight
2200cdf0e10cSrcweir
2201cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
2202cdf0e10cSrcweir sal_uLong nCount = pTemp->Count();
2203cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
2204cdf0e10cSrcweir {
2205cdf0e10cSrcweir ScHighlightEntry* pEntry = pTemp->GetObject( i );
2206cdf0e10cSrcweir if (pEntry)
2207cdf0e10cSrcweir {
2208cdf0e10cSrcweir ScRange aRange = pEntry->aRef;
2209cdf0e10cSrcweir if ( nTab >= aRange.aStart.Tab() && nTab <= aRange.aEnd.Tab() )
2210cdf0e10cSrcweir PaintArea( aRange.aStart.Col(), aRange.aStart.Row(),
2211cdf0e10cSrcweir aRange.aEnd.Col(), aRange.aEnd.Row(), SC_UPDATE_MARKS );
2212cdf0e10cSrcweir }
2213cdf0e10cSrcweir }
2214cdf0e10cSrcweir delete pTemp;
2215cdf0e10cSrcweir }
2216cdf0e10cSrcweir }
2217cdf0e10cSrcweir
DoChartSelection(const uno::Sequence<chart2::data::HighlightedRange> & rHilightRanges)2218cdf0e10cSrcweir void ScTabView::DoChartSelection(
2219cdf0e10cSrcweir const uno::Sequence< chart2::data::HighlightedRange > & rHilightRanges )
2220cdf0e10cSrcweir {
2221cdf0e10cSrcweir ClearHighlightRanges();
2222cdf0e10cSrcweir
2223cdf0e10cSrcweir for( sal_Int32 i=0; i<rHilightRanges.getLength(); ++i )
2224cdf0e10cSrcweir {
2225cdf0e10cSrcweir Color aSelColor( rHilightRanges[i].PreferredColor );
2226cdf0e10cSrcweir ScRangeList aRangeList;
2227cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocShell()->GetDocument();
2228cdf0e10cSrcweir if( ScRangeStringConverter::GetRangeListFromString(
2229cdf0e10cSrcweir aRangeList, rHilightRanges[i].RangeRepresentation, pDoc, pDoc->GetAddressConvention(), ';' ))
2230cdf0e10cSrcweir {
2231cdf0e10cSrcweir for ( ScRangePtr p = aRangeList.First(); p; p = aRangeList.Next())
2232cdf0e10cSrcweir {
2233cdf0e10cSrcweir if( rHilightRanges[i].Index == - 1 )
2234cdf0e10cSrcweir AddHighlightRange( *p, aSelColor );
2235cdf0e10cSrcweir else
2236cdf0e10cSrcweir AddHighlightRange( lcl_getSubRangeByIndex( *p, rHilightRanges[i].Index ), aSelColor );
2237cdf0e10cSrcweir }
2238cdf0e10cSrcweir }
2239cdf0e10cSrcweir }
2240cdf0e10cSrcweir }
2241cdf0e10cSrcweir
2242cdf0e10cSrcweir // DrawDragRect - Drag&Drop-Rechteck zeichnen (XOR)
2243cdf0e10cSrcweir
2244cdf0e10cSrcweir //UNUSED2008-05 void ScTabView::DrawDragRect( SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY,
2245cdf0e10cSrcweir //UNUSED2008-05 ScSplitPos ePos )
2246cdf0e10cSrcweir //UNUSED2008-05 {
2247cdf0e10cSrcweir //UNUSED2008-05 if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX || aViewData.GetVSplitMode() == SC_SPLIT_FIX )
2248cdf0e10cSrcweir //UNUSED2008-05 {
2249cdf0e10cSrcweir //UNUSED2008-05 for (sal_uInt16 i=0; i<4; i++)
2250cdf0e10cSrcweir //UNUSED2008-05 if (pGridWin[i])
2251cdf0e10cSrcweir //UNUSED2008-05 if (pGridWin[i]->IsVisible())
2252cdf0e10cSrcweir //UNUSED2008-05 pGridWin[i]->DrawDragRect( nStartX, nStartY, nEndX, nEndY );
2253cdf0e10cSrcweir //UNUSED2008-05 }
2254cdf0e10cSrcweir //UNUSED2008-05 else
2255cdf0e10cSrcweir //UNUSED2008-05 pGridWin[ePos]->DrawDragRect( nStartX, nStartY, nEndX, nEndY );
2256cdf0e10cSrcweir //UNUSED2008-05 }
2257cdf0e10cSrcweir //UNUSED2008-05
2258cdf0e10cSrcweir //UNUSED2008-05 // PaintCell - einzelne Zelle neu zeichnen
2259cdf0e10cSrcweir //UNUSED2008-05
2260cdf0e10cSrcweir //UNUSED2008-05 void ScTabView::PaintCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
2261cdf0e10cSrcweir //UNUSED2008-05 {
2262cdf0e10cSrcweir //UNUSED2008-05 if ( aViewData.GetTabNo() == nTab )
2263cdf0e10cSrcweir //UNUSED2008-05 {
2264cdf0e10cSrcweir //UNUSED2008-05 sal_uInt16 i;
2265cdf0e10cSrcweir //UNUSED2008-05 for (i=0; i<4; i++)
2266cdf0e10cSrcweir //UNUSED2008-05 if (pGridWin[i])
2267cdf0e10cSrcweir //UNUSED2008-05 if (pGridWin[i]->IsVisible())
2268cdf0e10cSrcweir //UNUSED2008-05 pGridWin[i]->Draw( nCol, nRow, nCol, nRow );
2269cdf0e10cSrcweir //UNUSED2008-05 }
2270cdf0e10cSrcweir //UNUSED2008-05 }
2271cdf0e10cSrcweir //UNUSED2008-05
2272cdf0e10cSrcweir //UNUSED2008-05 void ScTabView::PaintLeftRow( SCROW nRow )
2273cdf0e10cSrcweir //UNUSED2008-05 {
2274cdf0e10cSrcweir //UNUSED2008-05 PaintLeftArea( nRow, nRow );
2275cdf0e10cSrcweir //UNUSED2008-05 }
2276cdf0e10cSrcweir //UNUSED2008-05
2277cdf0e10cSrcweir //UNUSED2008-05 void ScTabView::PaintTopCol( SCCOL nCol )
2278cdf0e10cSrcweir //UNUSED2008-05 {
2279cdf0e10cSrcweir //UNUSED2008-05 PaintTopArea( nCol, nCol );
2280cdf0e10cSrcweir //UNUSED2008-05 }
2281cdf0e10cSrcweir
2282cdf0e10cSrcweir // PaintGrid - Datenbereiche neu zeichnen
2283cdf0e10cSrcweir
PaintGrid()2284cdf0e10cSrcweir void ScTabView::PaintGrid()
2285cdf0e10cSrcweir {
2286cdf0e10cSrcweir sal_uInt16 i;
2287cdf0e10cSrcweir for (i=0; i<4; i++)
2288cdf0e10cSrcweir if (pGridWin[i])
2289cdf0e10cSrcweir if (pGridWin[i]->IsVisible())
2290cdf0e10cSrcweir pGridWin[i]->Invalidate();
2291cdf0e10cSrcweir }
2292cdf0e10cSrcweir
2293cdf0e10cSrcweir // PaintTop - obere Kontrollelemente neu zeichnen
2294cdf0e10cSrcweir
PaintTop()2295cdf0e10cSrcweir void ScTabView::PaintTop()
2296cdf0e10cSrcweir {
2297cdf0e10cSrcweir sal_uInt16 i;
2298cdf0e10cSrcweir for (i=0; i<2; i++)
2299cdf0e10cSrcweir {
2300cdf0e10cSrcweir if (pColBar[i])
2301cdf0e10cSrcweir pColBar[i]->Invalidate();
2302cdf0e10cSrcweir if (pColOutline[i])
2303cdf0e10cSrcweir pColOutline[i]->Invalidate();
2304cdf0e10cSrcweir }
2305cdf0e10cSrcweir }
2306cdf0e10cSrcweir
CreateAnchorHandles(SdrHdlList & rHdl,const ScAddress & rAddress)2307cdf0e10cSrcweir void ScTabView::CreateAnchorHandles(SdrHdlList& rHdl, const ScAddress& rAddress)
2308cdf0e10cSrcweir {
2309cdf0e10cSrcweir sal_uInt16 i;
2310cdf0e10cSrcweir
2311cdf0e10cSrcweir for(i=0; i<4; i++)
2312cdf0e10cSrcweir {
2313cdf0e10cSrcweir if(pGridWin[i])
2314cdf0e10cSrcweir {
2315cdf0e10cSrcweir if(pGridWin[i]->IsVisible())
2316cdf0e10cSrcweir {
2317cdf0e10cSrcweir pGridWin[i]->CreateAnchorHandle(rHdl, rAddress);
2318cdf0e10cSrcweir }
2319cdf0e10cSrcweir }
2320cdf0e10cSrcweir }
2321cdf0e10cSrcweir }
2322cdf0e10cSrcweir
PaintTopArea(SCCOL nStartCol,SCCOL nEndCol)2323cdf0e10cSrcweir void ScTabView::PaintTopArea( SCCOL nStartCol, SCCOL nEndCol )
2324cdf0e10cSrcweir {
2325cdf0e10cSrcweir // Pixel-Position der linken Kante
2326cdf0e10cSrcweir
2327cdf0e10cSrcweir if ( nStartCol < aViewData.GetPosX(SC_SPLIT_LEFT) ||
2328cdf0e10cSrcweir nStartCol < aViewData.GetPosX(SC_SPLIT_RIGHT) )
2329cdf0e10cSrcweir aViewData.RecalcPixPos();
2330cdf0e10cSrcweir
2331cdf0e10cSrcweir // Fixierung anpassen (UpdateFixX setzt HSplitPos neu)
2332cdf0e10cSrcweir
2333cdf0e10cSrcweir if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX && nStartCol < aViewData.GetFixPosX() )
2334cdf0e10cSrcweir if (aViewData.UpdateFixX())
2335cdf0e10cSrcweir RepeatResize();
2336cdf0e10cSrcweir
2337cdf0e10cSrcweir // zeichnen
2338cdf0e10cSrcweir
2339cdf0e10cSrcweir if (nStartCol>0)
2340cdf0e10cSrcweir --nStartCol; //! allgemeiner ?
2341cdf0e10cSrcweir
2342cdf0e10cSrcweir sal_Bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
2343cdf0e10cSrcweir long nLayoutSign = bLayoutRTL ? -1 : 1;
2344cdf0e10cSrcweir
2345cdf0e10cSrcweir for (sal_uInt16 i=0; i<2; i++)
2346cdf0e10cSrcweir {
2347cdf0e10cSrcweir ScHSplitPos eWhich = (ScHSplitPos) i;
2348cdf0e10cSrcweir if (pColBar[eWhich])
2349cdf0e10cSrcweir {
2350cdf0e10cSrcweir Size aWinSize = pColBar[eWhich]->GetSizePixel();
2351cdf0e10cSrcweir long nStartX = aViewData.GetScrPos( nStartCol, 0, eWhich ).X();
2352cdf0e10cSrcweir long nEndX;
2353cdf0e10cSrcweir if (nEndCol >= MAXCOL)
2354cdf0e10cSrcweir nEndX = bLayoutRTL ? 0 : ( aWinSize.Width()-1 );
2355cdf0e10cSrcweir else
2356cdf0e10cSrcweir nEndX = aViewData.GetScrPos( nEndCol+1, 0, eWhich ).X() - nLayoutSign;
2357cdf0e10cSrcweir pColBar[eWhich]->Invalidate(
2358cdf0e10cSrcweir Rectangle( nStartX, 0, nEndX, aWinSize.Height()-1 ) );
2359cdf0e10cSrcweir }
2360cdf0e10cSrcweir if (pColOutline[eWhich])
2361cdf0e10cSrcweir pColOutline[eWhich]->Invalidate();
2362cdf0e10cSrcweir }
2363cdf0e10cSrcweir }
2364cdf0e10cSrcweir
2365cdf0e10cSrcweir
2366cdf0e10cSrcweir // PaintLeft - linke Kontrollelemente neu zeichnen
2367cdf0e10cSrcweir
PaintLeft()2368cdf0e10cSrcweir void ScTabView::PaintLeft()
2369cdf0e10cSrcweir {
2370cdf0e10cSrcweir sal_uInt16 i;
2371cdf0e10cSrcweir for (i=0; i<2; i++)
2372cdf0e10cSrcweir {
2373cdf0e10cSrcweir if (pRowBar[i])
2374cdf0e10cSrcweir pRowBar[i]->Invalidate();
2375cdf0e10cSrcweir if (pRowOutline[i])
2376cdf0e10cSrcweir pRowOutline[i]->Invalidate();
2377cdf0e10cSrcweir }
2378cdf0e10cSrcweir }
2379cdf0e10cSrcweir
PaintLeftArea(SCROW nStartRow,SCROW nEndRow)2380cdf0e10cSrcweir void ScTabView::PaintLeftArea( SCROW nStartRow, SCROW nEndRow )
2381cdf0e10cSrcweir {
2382cdf0e10cSrcweir // Pixel-Position der oberen Kante
2383cdf0e10cSrcweir
2384cdf0e10cSrcweir if ( nStartRow < aViewData.GetPosY(SC_SPLIT_TOP) ||
2385cdf0e10cSrcweir nStartRow < aViewData.GetPosY(SC_SPLIT_BOTTOM) )
2386cdf0e10cSrcweir aViewData.RecalcPixPos();
2387cdf0e10cSrcweir
2388cdf0e10cSrcweir // Fixierung anpassen (UpdateFixY setzt VSplitPos neu)
2389cdf0e10cSrcweir
2390cdf0e10cSrcweir if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX && nStartRow < aViewData.GetFixPosY() )
2391cdf0e10cSrcweir if (aViewData.UpdateFixY())
2392cdf0e10cSrcweir RepeatResize();
2393cdf0e10cSrcweir
2394cdf0e10cSrcweir // zeichnen
2395cdf0e10cSrcweir
2396cdf0e10cSrcweir if (nStartRow>0)
2397cdf0e10cSrcweir --nStartRow;
2398cdf0e10cSrcweir
2399cdf0e10cSrcweir for (sal_uInt16 i=0; i<2; i++)
2400cdf0e10cSrcweir {
2401cdf0e10cSrcweir ScVSplitPos eWhich = (ScVSplitPos) i;
2402cdf0e10cSrcweir if (pRowBar[eWhich])
2403cdf0e10cSrcweir {
2404cdf0e10cSrcweir Size aWinSize = pRowBar[eWhich]->GetSizePixel();
2405cdf0e10cSrcweir long nStartY = aViewData.GetScrPos( 0, nStartRow, eWhich ).Y();
2406cdf0e10cSrcweir long nEndY;
2407cdf0e10cSrcweir if (nEndRow >= MAXROW)
2408cdf0e10cSrcweir nEndY = aWinSize.Height()-1;
2409cdf0e10cSrcweir else
2410cdf0e10cSrcweir nEndY = aViewData.GetScrPos( 0, nEndRow+1, eWhich ).Y() - 1;
2411cdf0e10cSrcweir pRowBar[eWhich]->Invalidate(
2412cdf0e10cSrcweir Rectangle( 0, nStartY, aWinSize.Width()-1, nEndY ) );
2413cdf0e10cSrcweir }
2414cdf0e10cSrcweir if (pRowOutline[eWhich])
2415cdf0e10cSrcweir pRowOutline[eWhich]->Invalidate();
2416cdf0e10cSrcweir }
2417cdf0e10cSrcweir }
2418cdf0e10cSrcweir
2419cdf0e10cSrcweir // InvertBlockMark - Block invertieren
2420cdf0e10cSrcweir
InvertBlockMark(SCCOL nStartX,SCROW nStartY,SCCOL nEndX,SCROW nEndY)2421cdf0e10cSrcweir void ScTabView::InvertBlockMark(SCCOL nStartX, SCROW nStartY,
2422cdf0e10cSrcweir SCCOL nEndX, SCROW nEndY)
2423cdf0e10cSrcweir {
2424cdf0e10cSrcweir if ( !aViewData.IsActive() )
2425cdf0e10cSrcweir return; // invertiert wird nur auf aktiver View
2426cdf0e10cSrcweir
2427cdf0e10cSrcweir PutInOrder( nStartX, nEndX );
2428cdf0e10cSrcweir PutInOrder( nStartY, nEndY );
2429cdf0e10cSrcweir
2430cdf0e10cSrcweir ScMarkData& rMark = aViewData.GetMarkData();
2431cdf0e10cSrcweir ScDocShell* pDocSh = aViewData.GetDocShell();
2432cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
2433cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
2434cdf0e10cSrcweir
2435cdf0e10cSrcweir if ( pDocSh->GetLockCount() )
2436cdf0e10cSrcweir {
2437cdf0e10cSrcweir // if paint is locked, avoid repeated inverting
2438cdf0e10cSrcweir // add repaint areas to paint lock data instead
2439cdf0e10cSrcweir pDocSh->PostPaint( nStartX,nStartY,nTab, nEndX,nEndY,nTab, PAINT_GRID );
2440cdf0e10cSrcweir return;
2441cdf0e10cSrcweir }
2442cdf0e10cSrcweir
2443cdf0e10cSrcweir sal_Bool bSingle = rMark.IsMultiMarked();
2444cdf0e10cSrcweir sal_Bool bMerge = pDoc->HasAttrib( nStartX, nStartY, nTab, nEndX, nEndY, nTab,
2445cdf0e10cSrcweir HASATTR_MERGED | HASATTR_OVERLAPPED );
2446cdf0e10cSrcweir
2447cdf0e10cSrcweir sal_uInt16 i;
2448cdf0e10cSrcweir if ( bMerge || bSingle )
2449cdf0e10cSrcweir {
2450cdf0e10cSrcweir for (i=0; i<4; i++)
2451cdf0e10cSrcweir if (pGridWin[i])
2452cdf0e10cSrcweir if (pGridWin[i]->IsVisible())
2453cdf0e10cSrcweir pGridWin[i]->InvertSimple( nStartX, nStartY, nEndX, nEndY,
2454cdf0e10cSrcweir bMerge, bBlockNeg );
2455cdf0e10cSrcweir }
2456cdf0e10cSrcweir else
2457cdf0e10cSrcweir {
2458cdf0e10cSrcweir for (i=0; i<4; i++)
2459cdf0e10cSrcweir if (pGridWin[i])
2460cdf0e10cSrcweir if (pGridWin[i]->IsVisible())
2461cdf0e10cSrcweir {
2462cdf0e10cSrcweir ScSplitPos ePos = (ScSplitPos) i;
2463cdf0e10cSrcweir Point aStartPoint = aViewData.GetScrPos( nStartX, nStartY, ePos );
2464cdf0e10cSrcweir Point aEndPoint = aViewData.GetScrPos( nEndX+1, nEndY+1, ePos );
2465cdf0e10cSrcweir if ( pDoc->IsLayoutRTL( nTab ) )
2466cdf0e10cSrcweir {
2467cdf0e10cSrcweir long nTemp = aStartPoint.X();
2468cdf0e10cSrcweir aStartPoint.X() = aEndPoint.X() + 1; // +1 - excluding start of nEndX+1
2469cdf0e10cSrcweir aEndPoint.X() = nTemp;
2470cdf0e10cSrcweir }
2471cdf0e10cSrcweir else
2472cdf0e10cSrcweir aEndPoint.X() -= 1;
2473cdf0e10cSrcweir aEndPoint.Y() -= 1;
2474cdf0e10cSrcweir if ( aEndPoint.X() >= aStartPoint.X() && aEndPoint.Y() >= aStartPoint.Y() )
2475cdf0e10cSrcweir {
2476cdf0e10cSrcweir MapMode aOld = pGridWin[ePos]->GetMapMode();
2477cdf0e10cSrcweir pGridWin[ePos]->SetMapMode(MAP_PIXEL);
2478cdf0e10cSrcweir pGridWin[ePos]->Invert( Rectangle(aStartPoint,aEndPoint), INVERT_HIGHLIGHT );
2479cdf0e10cSrcweir pGridWin[ePos]->SetMapMode(aOld);
2480cdf0e10cSrcweir pGridWin[ePos]->CheckInverted();
2481cdf0e10cSrcweir }
2482cdf0e10cSrcweir }
2483cdf0e10cSrcweir }
2484cdf0e10cSrcweir
2485cdf0e10cSrcweir //
2486cdf0e10cSrcweir // wenn Controls betroffen, neu malen
2487cdf0e10cSrcweir //
2488cdf0e10cSrcweir
2489cdf0e10cSrcweir sal_Bool bHide = sal_True; // wird Teil der Markierung aufgehoben ?
2490cdf0e10cSrcweir if (rMark.IsMarked())
2491cdf0e10cSrcweir {
2492cdf0e10cSrcweir ScRange aMarkRange;
2493cdf0e10cSrcweir rMark.GetMarkArea( aMarkRange );
2494cdf0e10cSrcweir if ( aMarkRange.aStart.Col() <= nStartX && aMarkRange.aEnd.Col() >= nEndX &&
2495cdf0e10cSrcweir aMarkRange.aStart.Row() <= nStartY && aMarkRange.aEnd.Row() >= nEndY )
2496cdf0e10cSrcweir {
2497cdf0e10cSrcweir bHide = sal_False; // der ganze Bereich ist markiert
2498cdf0e10cSrcweir }
2499cdf0e10cSrcweir }
2500cdf0e10cSrcweir }
2501cdf0e10cSrcweir
PaintExtras()2502cdf0e10cSrcweir sal_Bool ScTabView::PaintExtras()
2503cdf0e10cSrcweir {
2504cdf0e10cSrcweir sal_Bool bRet = sal_False;
2505cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
2506cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
2507cdf0e10cSrcweir if (!pDoc->HasTable(nTab)) // Tabelle geloescht ?
2508cdf0e10cSrcweir {
2509cdf0e10cSrcweir SCTAB nCount = pDoc->GetTableCount();
2510cdf0e10cSrcweir aViewData.SetTabNo(nCount-1);
2511cdf0e10cSrcweir bRet = sal_True;
2512cdf0e10cSrcweir }
2513cdf0e10cSrcweir pTabControl->UpdateStatus(); // sal_True = active
2514cdf0e10cSrcweir return bRet;
2515cdf0e10cSrcweir }
2516cdf0e10cSrcweir
RecalcPPT()2517cdf0e10cSrcweir void ScTabView::RecalcPPT()
2518cdf0e10cSrcweir {
2519cdf0e10cSrcweir // called after changes that require the PPT values to be recalculated
2520cdf0e10cSrcweir // (currently from detective operations)
2521cdf0e10cSrcweir
2522cdf0e10cSrcweir double nOldX = aViewData.GetPPTX();
2523cdf0e10cSrcweir double nOldY = aViewData.GetPPTY();
2524cdf0e10cSrcweir
2525cdf0e10cSrcweir aViewData.RefreshZoom(); // pre-calculate new PPT values
2526cdf0e10cSrcweir
2527cdf0e10cSrcweir sal_Bool bChangedX = ( aViewData.GetPPTX() != nOldX );
2528cdf0e10cSrcweir sal_Bool bChangedY = ( aViewData.GetPPTY() != nOldY );
2529cdf0e10cSrcweir if ( bChangedX || bChangedY )
2530cdf0e10cSrcweir {
2531cdf0e10cSrcweir // call view SetZoom (including draw scale, split update etc)
2532cdf0e10cSrcweir // and paint only if values changed
2533cdf0e10cSrcweir
2534cdf0e10cSrcweir Fraction aZoomX = aViewData.GetZoomX();
2535cdf0e10cSrcweir Fraction aZoomY = aViewData.GetZoomY();
2536cdf0e10cSrcweir SetZoom( aZoomX, aZoomY, sal_False );
2537cdf0e10cSrcweir
2538cdf0e10cSrcweir PaintGrid();
2539cdf0e10cSrcweir if (bChangedX)
2540cdf0e10cSrcweir PaintTop();
2541cdf0e10cSrcweir if (bChangedY)
2542cdf0e10cSrcweir PaintLeft();
2543cdf0e10cSrcweir }
2544cdf0e10cSrcweir }
2545cdf0e10cSrcweir
ActivateView(sal_Bool bActivate,sal_Bool bFirst)2546cdf0e10cSrcweir void ScTabView::ActivateView( sal_Bool bActivate, sal_Bool bFirst )
2547cdf0e10cSrcweir {
2548cdf0e10cSrcweir if ( bActivate == aViewData.IsActive() && !bFirst )
2549cdf0e10cSrcweir {
2550cdf0e10cSrcweir // keine Assertion mehr - kommt vor, wenn vorher im Drag&Drop
2551cdf0e10cSrcweir // auf ein anderes Dokument umgeschaltet wurde
2552cdf0e10cSrcweir return;
2553cdf0e10cSrcweir }
2554cdf0e10cSrcweir
2555cdf0e10cSrcweir // wird nur bei MDI-(De)Activate gerufen
2556cdf0e10cSrcweir // aViewData.Activate hinten wegen Cursor-Show bei KillEditView
2557cdf0e10cSrcweir // Markierung nicht mehr loeschen - wenn an der ViewData Activate(sal_False) gesetzt ist,
2558cdf0e10cSrcweir // wird die Markierung nicht ausgegeben
2559cdf0e10cSrcweir
2560cdf0e10cSrcweir if (!bActivate)
2561cdf0e10cSrcweir {
2562cdf0e10cSrcweir ScModule* pScMod = SC_MOD();
2563cdf0e10cSrcweir sal_Bool bRefMode = pScMod->IsFormulaMode();
2564cdf0e10cSrcweir
2565cdf0e10cSrcweir // Referenzeingabe nicht abbrechen, um Referenzen auf
2566cdf0e10cSrcweir // andere Dokumente zuzulassen
2567cdf0e10cSrcweir
2568cdf0e10cSrcweir if (!bRefMode)
2569cdf0e10cSrcweir {
2570cdf0e10cSrcweir //pScMod->InputEnterHandler();
2571cdf0e10cSrcweir
2572cdf0e10cSrcweir // #80843# pass view to GetInputHdl, this view may not be current anymore
2573cdf0e10cSrcweir ScInputHandler* pHdl = SC_MOD()->GetInputHdl(aViewData.GetViewShell());
2574cdf0e10cSrcweir if (pHdl)
2575cdf0e10cSrcweir pHdl->EnterHandler();
2576cdf0e10cSrcweir }
2577cdf0e10cSrcweir }
2578cdf0e10cSrcweir pTabControl->ActivateView(bActivate);
2579cdf0e10cSrcweir PaintExtras();
2580cdf0e10cSrcweir
2581cdf0e10cSrcweir aViewData.Activate(bActivate);
2582cdf0e10cSrcweir
2583cdf0e10cSrcweir PaintBlock(sal_False); // Repaint, Markierung je nach Active-Status
2584cdf0e10cSrcweir
2585cdf0e10cSrcweir if (!bActivate)
2586cdf0e10cSrcweir HideAllCursors(); // Cursor
2587cdf0e10cSrcweir else if (!bFirst)
2588cdf0e10cSrcweir ShowAllCursors();
2589cdf0e10cSrcweir
2590cdf0e10cSrcweir //HMHif (pDrawView)
2591cdf0e10cSrcweir //HMH DrawShowMarkHdl(bActivate); // Drawing-Markierung
2592cdf0e10cSrcweir
2593cdf0e10cSrcweir if (bActivate)
2594cdf0e10cSrcweir {
2595cdf0e10cSrcweir if ( bFirst )
2596cdf0e10cSrcweir {
2597cdf0e10cSrcweir ScSplitPos eWin = aViewData.GetActivePart();
2598cdf0e10cSrcweir DBG_ASSERT( pGridWin[eWin], "rottes Dokument, nicht alle SplitPos in GridWin" );
2599cdf0e10cSrcweir if ( !pGridWin[eWin] )
2600cdf0e10cSrcweir {
2601cdf0e10cSrcweir eWin = SC_SPLIT_BOTTOMLEFT;
2602cdf0e10cSrcweir if ( !pGridWin[eWin] )
2603cdf0e10cSrcweir {
2604cdf0e10cSrcweir short i;
2605cdf0e10cSrcweir for ( i=0; i<4; i++ )
2606cdf0e10cSrcweir {
2607cdf0e10cSrcweir if ( pGridWin[i] )
2608cdf0e10cSrcweir {
2609cdf0e10cSrcweir eWin = (ScSplitPos) i;
2610cdf0e10cSrcweir break; // for
2611cdf0e10cSrcweir }
2612cdf0e10cSrcweir }
2613cdf0e10cSrcweir DBG_ASSERT( i<4, "und BUMM" );
2614cdf0e10cSrcweir }
2615cdf0e10cSrcweir aViewData.SetActivePart( eWin );
2616cdf0e10cSrcweir }
2617cdf0e10cSrcweir }
2618cdf0e10cSrcweir // hier nicht mehr selber GrabFocus rufen!
2619cdf0e10cSrcweir // Wenn das Doc bearbeitet wird, ruft der Sfx selber GrabFocus am Fenster der Shell.
2620cdf0e10cSrcweir // Wenn es z.B. ein Mailbody ist, darf es den Focus nicht bekommen (Bug #43638#)
2621cdf0e10cSrcweir
2622cdf0e10cSrcweir UpdateInputContext();
2623cdf0e10cSrcweir }
2624cdf0e10cSrcweir else
2625cdf0e10cSrcweir pGridWin[aViewData.GetActivePart()]->ClickExtern();
2626cdf0e10cSrcweir }
2627cdf0e10cSrcweir
ActivatePart(ScSplitPos eWhich)2628cdf0e10cSrcweir void ScTabView::ActivatePart( ScSplitPos eWhich )
2629cdf0e10cSrcweir {
2630cdf0e10cSrcweir ScSplitPos eOld = aViewData.GetActivePart();
2631cdf0e10cSrcweir if ( eOld != eWhich )
2632cdf0e10cSrcweir {
2633cdf0e10cSrcweir bInActivatePart = sal_True;
2634cdf0e10cSrcweir
2635cdf0e10cSrcweir sal_Bool bRefMode = SC_MOD()->IsFormulaMode();
2636cdf0e10cSrcweir
2637cdf0e10cSrcweir // #40565# the HasEditView call during SetCursor would fail otherwise
2638cdf0e10cSrcweir if ( aViewData.HasEditView(eOld) && !bRefMode )
2639cdf0e10cSrcweir UpdateInputLine();
2640cdf0e10cSrcweir
2641cdf0e10cSrcweir ScHSplitPos eOldH = WhichH(eOld);
2642cdf0e10cSrcweir ScVSplitPos eOldV = WhichV(eOld);
2643cdf0e10cSrcweir ScHSplitPos eNewH = WhichH(eWhich);
2644cdf0e10cSrcweir ScVSplitPos eNewV = WhichV(eWhich);
2645cdf0e10cSrcweir sal_Bool bTopCap = pColBar[eOldH] && pColBar[eOldH]->IsMouseCaptured();
2646cdf0e10cSrcweir sal_Bool bLeftCap = pRowBar[eOldV] && pRowBar[eOldV]->IsMouseCaptured();
2647cdf0e10cSrcweir
2648cdf0e10cSrcweir sal_Bool bFocus = pGridWin[eOld]->HasFocus();
2649cdf0e10cSrcweir sal_Bool bCapture = pGridWin[eOld]->IsMouseCaptured();
2650cdf0e10cSrcweir if (bCapture)
2651cdf0e10cSrcweir pGridWin[eOld]->ReleaseMouse();
2652cdf0e10cSrcweir pGridWin[eOld]->ClickExtern();
2653cdf0e10cSrcweir pGridWin[eOld]->HideCursor();
2654cdf0e10cSrcweir pGridWin[eWhich]->HideCursor();
2655cdf0e10cSrcweir aViewData.SetActivePart( eWhich );
2656cdf0e10cSrcweir
2657cdf0e10cSrcweir ScTabViewShell* pShell = aViewData.GetViewShell();
2658cdf0e10cSrcweir pShell->WindowChanged();
2659cdf0e10cSrcweir
2660cdf0e10cSrcweir pSelEngine->SetWindow(pGridWin[eWhich]);
2661cdf0e10cSrcweir pSelEngine->SetWhich(eWhich);
2662cdf0e10cSrcweir pSelEngine->SetVisibleArea( Rectangle(Point(), pGridWin[eWhich]->GetOutputSizePixel()) );
2663cdf0e10cSrcweir
2664cdf0e10cSrcweir pGridWin[eOld]->MoveMouseStatus(*pGridWin[eWhich]);
2665cdf0e10cSrcweir
2666cdf0e10cSrcweir if ( bCapture || pGridWin[eWhich]->IsMouseCaptured() )
2667cdf0e10cSrcweir {
2668cdf0e10cSrcweir // Tracking statt CaptureMouse, damit sauber abgebrochen werden kann
2669cdf0e10cSrcweir // (SelectionEngine ruft CaptureMouse beim SetWindow)
2670cdf0e10cSrcweir //! Irgendwann sollte die SelectionEngine selber StartTracking rufen!?!
2671cdf0e10cSrcweir pGridWin[eWhich]->ReleaseMouse();
2672cdf0e10cSrcweir pGridWin[eWhich]->StartTracking();
2673cdf0e10cSrcweir }
2674cdf0e10cSrcweir
2675cdf0e10cSrcweir if ( bTopCap && pColBar[eNewH] )
2676cdf0e10cSrcweir {
2677cdf0e10cSrcweir pColBar[eOldH]->SetIgnoreMove(sal_True);
2678cdf0e10cSrcweir pColBar[eNewH]->SetIgnoreMove(sal_False);
2679cdf0e10cSrcweir pHdrSelEng->SetWindow( pColBar[eNewH] );
2680cdf0e10cSrcweir long nWidth = pColBar[eNewH]->GetOutputSizePixel().Width();
2681cdf0e10cSrcweir pHdrSelEng->SetVisibleArea( Rectangle( 0, LONG_MIN, nWidth-1, LONG_MAX ) );
2682cdf0e10cSrcweir pColBar[eNewH]->CaptureMouse();
2683cdf0e10cSrcweir }
2684cdf0e10cSrcweir if ( bLeftCap && pRowBar[eNewV] )
2685cdf0e10cSrcweir {
2686cdf0e10cSrcweir pRowBar[eOldV]->SetIgnoreMove(sal_True);
2687cdf0e10cSrcweir pRowBar[eNewV]->SetIgnoreMove(sal_False);
2688cdf0e10cSrcweir pHdrSelEng->SetWindow( pRowBar[eNewV] );
2689cdf0e10cSrcweir long nHeight = pRowBar[eNewV]->GetOutputSizePixel().Height();
2690cdf0e10cSrcweir pHdrSelEng->SetVisibleArea( Rectangle( LONG_MIN, 0, LONG_MAX, nHeight-1 ) );
2691cdf0e10cSrcweir pRowBar[eNewV]->CaptureMouse();
2692cdf0e10cSrcweir }
2693cdf0e10cSrcweir aHdrFunc.SetWhich(eWhich);
2694cdf0e10cSrcweir
2695cdf0e10cSrcweir pGridWin[eOld]->ShowCursor();
2696cdf0e10cSrcweir pGridWin[eWhich]->ShowCursor();
2697cdf0e10cSrcweir
2698cdf0e10cSrcweir SfxInPlaceClient* pClient = aViewData.GetViewShell()->GetIPClient();
2699cdf0e10cSrcweir sal_Bool bOleActive = ( pClient && pClient->IsObjectInPlaceActive() );
2700cdf0e10cSrcweir
2701cdf0e10cSrcweir // #103823# don't switch ViewShell's active window during RefInput, because the focus
2702cdf0e10cSrcweir // might change, and subsequent SetReference calls wouldn't find the right EditView
2703cdf0e10cSrcweir if ( !bRefMode && !bOleActive )
2704cdf0e10cSrcweir aViewData.GetViewShell()->SetWindow( pGridWin[eWhich] );
2705cdf0e10cSrcweir
2706cdf0e10cSrcweir if ( bFocus && !aViewData.IsAnyFillMode() && !bRefMode )
2707cdf0e10cSrcweir {
2708cdf0e10cSrcweir // GrabFocus nur, wenn vorher das andere GridWindow den Focus hatte
2709cdf0e10cSrcweir // (z.B. wegen Suchen & Ersetzen)
2710cdf0e10cSrcweir //! aViewData.GetViewShell()->GetViewFrame()->GetWindow().GrabFocus();
2711cdf0e10cSrcweir pGridWin[eWhich]->GrabFocus();
2712cdf0e10cSrcweir }
2713cdf0e10cSrcweir
2714cdf0e10cSrcweir bInActivatePart = sal_False;
2715cdf0e10cSrcweir }
2716cdf0e10cSrcweir }
2717cdf0e10cSrcweir
HideListBox()2718cdf0e10cSrcweir void ScTabView::HideListBox()
2719cdf0e10cSrcweir {
2720cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++)
2721cdf0e10cSrcweir if (pGridWin[i])
2722cdf0e10cSrcweir pGridWin[i]->ClickExtern();
2723cdf0e10cSrcweir }
2724cdf0e10cSrcweir
UpdateInputContext()2725cdf0e10cSrcweir void ScTabView::UpdateInputContext()
2726cdf0e10cSrcweir {
2727cdf0e10cSrcweir ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()];
2728cdf0e10cSrcweir if (pWin)
2729cdf0e10cSrcweir pWin->UpdateInputContext();
2730cdf0e10cSrcweir }
2731cdf0e10cSrcweir
2732cdf0e10cSrcweir // GetGridWidth - Breite eines Ausgabebereichs (fuer ViewData)
2733cdf0e10cSrcweir
GetGridWidth(ScHSplitPos eWhich)2734cdf0e10cSrcweir long ScTabView::GetGridWidth( ScHSplitPos eWhich )
2735cdf0e10cSrcweir {
2736cdf0e10cSrcweir ScSplitPos eGridWhich = ( eWhich == SC_SPLIT_LEFT ) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
2737cdf0e10cSrcweir if (pGridWin[eGridWhich])
2738cdf0e10cSrcweir return pGridWin[eGridWhich]->GetSizePixel().Width();
2739cdf0e10cSrcweir else
2740cdf0e10cSrcweir return 0;
2741cdf0e10cSrcweir }
2742cdf0e10cSrcweir
2743cdf0e10cSrcweir // GetGridHeight - Hoehe eines Ausgabebereichs (fuer ViewData)
2744cdf0e10cSrcweir
GetGridHeight(ScVSplitPos eWhich)2745cdf0e10cSrcweir long ScTabView::GetGridHeight( ScVSplitPos eWhich )
2746cdf0e10cSrcweir {
2747cdf0e10cSrcweir ScSplitPos eGridWhich = ( eWhich == SC_SPLIT_TOP ) ? SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT;
2748cdf0e10cSrcweir if (pGridWin[eGridWhich])
2749cdf0e10cSrcweir return pGridWin[eGridWhich]->GetSizePixel().Height();
2750cdf0e10cSrcweir else
2751cdf0e10cSrcweir return 0;
2752cdf0e10cSrcweir }
2753cdf0e10cSrcweir
UpdateInputLine()2754cdf0e10cSrcweir void ScTabView::UpdateInputLine()
2755cdf0e10cSrcweir {
2756cdf0e10cSrcweir SC_MOD()->InputEnterHandler();
2757cdf0e10cSrcweir }
2758cdf0e10cSrcweir
ZoomChanged()2759cdf0e10cSrcweir void ScTabView::ZoomChanged()
2760cdf0e10cSrcweir {
2761cdf0e10cSrcweir ScInputHandler* pHdl = SC_MOD()->GetInputHdl(aViewData.GetViewShell());
2762cdf0e10cSrcweir if (pHdl)
2763cdf0e10cSrcweir pHdl->SetRefScale( aViewData.GetZoomX(), aViewData.GetZoomY() );
2764cdf0e10cSrcweir
2765cdf0e10cSrcweir UpdateFixPos();
2766cdf0e10cSrcweir
2767cdf0e10cSrcweir UpdateScrollBars();
2768cdf0e10cSrcweir
2769cdf0e10cSrcweir // VisArea...
2770cdf0e10cSrcweir // AW: Discussed with NN if there is a reason that new map mode was only set for one window,
2771cdf0e10cSrcweir // but is not. Setting only on one window causes the first repaint to have the old mapMode
2772cdf0e10cSrcweir // in three of four views, so the overlay will save the wrong content e.g. when zooming out.
2773cdf0e10cSrcweir // Changing to setting map mode at all windows.
2774cdf0e10cSrcweir sal_uInt32 a;
2775cdf0e10cSrcweir
2776cdf0e10cSrcweir for(a = 0L; a < 4L; a++)
2777cdf0e10cSrcweir {
2778cdf0e10cSrcweir if(pGridWin[a])
2779cdf0e10cSrcweir {
2780cdf0e10cSrcweir pGridWin[a]->SetMapMode(pGridWin[a]->GetDrawMapMode());
2781cdf0e10cSrcweir }
2782cdf0e10cSrcweir }
2783cdf0e10cSrcweir
2784cdf0e10cSrcweir SetNewVisArea();
2785cdf0e10cSrcweir
2786cdf0e10cSrcweir /* the old code
2787cdf0e10cSrcweir ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()];
2788cdf0e10cSrcweir if (pWin)
2789cdf0e10cSrcweir {
2790cdf0e10cSrcweir pWin->SetMapMode( pWin->GetDrawMapMode() ); // mit neuem Zoom
2791cdf0e10cSrcweir SetNewVisArea(); // benutzt den gesetzten MapMode
2792cdf0e10cSrcweir } */
2793cdf0e10cSrcweir
2794cdf0e10cSrcweir InterpretVisible(); // #69343# have everything calculated before painting
2795cdf0e10cSrcweir
2796cdf0e10cSrcweir SfxBindings& rBindings = aViewData.GetBindings();
2797cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_ZOOM );
2798cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
2799cdf0e10cSrcweir
2800cdf0e10cSrcweir HideNoteMarker();
2801cdf0e10cSrcweir
2802cdf0e10cSrcweir // AW: To not change too much, use pWin here
2803cdf0e10cSrcweir ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()];
2804cdf0e10cSrcweir
2805cdf0e10cSrcweir if ( pWin && aViewData.HasEditView( aViewData.GetActivePart() ) )
2806cdf0e10cSrcweir {
2807cdf0e10cSrcweir // flush OverlayManager before changing the MapMode
2808cdf0e10cSrcweir pWin->flushOverlayManager();
2809cdf0e10cSrcweir
2810cdf0e10cSrcweir // #93650# make sure the EditView's position and size are updated
2811cdf0e10cSrcweir // with the right (logic, not drawing) MapMode
2812cdf0e10cSrcweir pWin->SetMapMode( aViewData.GetLogicMode() );
2813cdf0e10cSrcweir UpdateEditView();
2814cdf0e10cSrcweir }
2815cdf0e10cSrcweir }
2816cdf0e10cSrcweir
CheckNeedsRepaint()2817cdf0e10cSrcweir void ScTabView::CheckNeedsRepaint()
2818cdf0e10cSrcweir {
2819cdf0e10cSrcweir sal_uInt16 i;
2820cdf0e10cSrcweir for (i=0; i<4; i++)
2821cdf0e10cSrcweir if ( pGridWin[i] && pGridWin[i]->IsVisible() )
2822cdf0e10cSrcweir pGridWin[i]->CheckNeedsRepaint();
2823cdf0e10cSrcweir }
2824cdf0e10cSrcweir
2825cdf0e10cSrcweir
2826cdf0e10cSrcweir
2827cdf0e10cSrcweir
2828cdf0e10cSrcweir
2829