1*b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*b3f79822SAndrew Rist * distributed with this work for additional information
6*b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*b3f79822SAndrew Rist * "License"); you may not use this file except in compliance
9*b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at
10*b3f79822SAndrew Rist *
11*b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*b3f79822SAndrew Rist *
13*b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*b3f79822SAndrew Rist * software distributed under the License is distributed on an
15*b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b3f79822SAndrew Rist * KIND, either express or implied. See the License for the
17*b3f79822SAndrew Rist * specific language governing permissions and limitations
18*b3f79822SAndrew Rist * under the License.
19*b3f79822SAndrew Rist *
20*b3f79822SAndrew Rist *************************************************************/
21*b3f79822SAndrew Rist
22*b3f79822SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir //------------------------------------------------------------------
29cdf0e10cSrcweir
30cdf0e10cSrcweir #if 0
31cdf0e10cSrcweir #define _MACRODLG_HXX
32cdf0e10cSrcweir #define _BIGINT_HXX
33cdf0e10cSrcweir #define _SVCONTNR_HXX
34cdf0e10cSrcweir #define BASIC_NODIALOGS
35cdf0e10cSrcweir #define _SFXMNUITEM_HXX
36cdf0e10cSrcweir #define _SVDXOUT_HXX
37cdf0e10cSrcweir #define _SVDATTR_HXX
38cdf0e10cSrcweir #define _SFXMNUITEM_HXX
39cdf0e10cSrcweir #define _DLGCFG_HXX
40cdf0e10cSrcweir #define _SFXMNUMGR_HXX
41cdf0e10cSrcweir #define _SFXBASIC_HXX
42cdf0e10cSrcweir #define _MODALDLG_HXX
43cdf0e10cSrcweir #define _SFX_TEMPLDLG_HXX
44cdf0e10cSrcweir #define _SFXSTBMGR_HXX
45cdf0e10cSrcweir #define _SFXTBXMGR_HXX
46cdf0e10cSrcweir #define _BASE_DLGS_HXX
47cdf0e10cSrcweir #define _SFXIMGMGR_HXX
48cdf0e10cSrcweir #define _SFXMNUMGR_HXX
49cdf0e10cSrcweir #define _SFXSTBITEM_HXX
50cdf0e10cSrcweir #define _SFXTBXCTRL_HXX
51cdf0e10cSrcweir #define _PASSWD_HXX
52cdf0e10cSrcweir //#define _SFXFILEDLG_HXX
53cdf0e10cSrcweir //#define _SFXREQUEST_HXX
54cdf0e10cSrcweir #define _SFXOBJFACE_HXX
55cdf0e10cSrcweir
56cdf0e10cSrcweir #define _SDR_NOTRANSFORM
57cdf0e10cSrcweir #define _SVDXOUT_HXX
58cdf0e10cSrcweir #endif
59cdf0e10cSrcweir #include <vcl/svapp.hxx>
60cdf0e10cSrcweir
61cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
62cdf0e10cSrcweir // NODRAW.HXX
63cdf0e10cSrcweir // Erweiterte Konstanten, um CLOKs mit SVDRAW.HXX zu vermeiden
64cdf0e10cSrcweir // Die u.a. Aenderungen nehmen vorgeschlagene Konstante vorweg
65cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
66cdf0e10cSrcweir
67cdf0e10cSrcweir #if 0
68cdf0e10cSrcweir #define _SDR_NOTRANSFORM // Transformationen, selten verwendet
69cdf0e10cSrcweir #define _SDR_NOTOUCH // Hit-Tests, selten verwendet
70cdf0e10cSrcweir
71cdf0e10cSrcweir #define _SDR_NOUNDO // Undo-Objekte
72cdf0e10cSrcweir #define _SDR_NOPAGEOBJ // SdrPageObj
73cdf0e10cSrcweir #define _SDR_NOVIRTOBJ // SdrVirtObj
74cdf0e10cSrcweir #define _SDR_NOGROUPOBJ // SdrGroupObj
75cdf0e10cSrcweir #define _SDR_NOTEXTOBJ // SdrTextObj
76cdf0e10cSrcweir #define _SDR_NOPATHOBJ // SdrPathObj
77cdf0e10cSrcweir #define _SDR_NOEDGEOBJ // SdrEdgeObj
78cdf0e10cSrcweir #define _SDR_NORECTOBJ // SdrRectObj
79cdf0e10cSrcweir #define _SDR_NOCAPTIONOBJ // SdrCaptionObj
80cdf0e10cSrcweir #define _SDR_NOCIRCLEOBJ // SdrCircleObj
81cdf0e10cSrcweir #define _SDR_NOGRAFOBJ // SdrGrafObj
82cdf0e10cSrcweir #define _SDR_NOOLE2OBJ // SdrOle2Obj
83cdf0e10cSrcweir #endif
84cdf0e10cSrcweir
85cdf0e10cSrcweir // Dieses define entfernt die VCControls aus SI.HXX
86cdf0e10cSrcweir
87cdf0e10cSrcweir #define _SI_HXX // VCControls
88cdf0e10cSrcweir
89cdf0e10cSrcweir ////////////////////// Umsetzen der Standard-Defines //////////////////////
90cdf0e10cSrcweir
91cdf0e10cSrcweir //#define _SVDDRAG_HXX // SdrDragStat
92cdf0e10cSrcweir #define _SVDPAGE_HXX // SdrPage
93cdf0e10cSrcweir
94cdf0e10cSrcweir #ifdef _SDR_NOSURROGATEOBJ
95cdf0e10cSrcweir #undef _SDR_NOSURROGATEOBJ
96cdf0e10cSrcweir #define _SVDSURO_HXX
97cdf0e10cSrcweir #endif
98cdf0e10cSrcweir
99cdf0e10cSrcweir #ifdef _SDR_NOPAGEOBJ
100cdf0e10cSrcweir #undef _SDR_NOPAGEOBJ
101cdf0e10cSrcweir #define _SVDOPAGE_HXX
102cdf0e10cSrcweir #endif
103cdf0e10cSrcweir
104cdf0e10cSrcweir #ifdef _SDR_NOVIRTOBJ
105cdf0e10cSrcweir #undef _SDR_NOVIRTOBJ
106cdf0e10cSrcweir #define _SVDOVIRT_HXX
107cdf0e10cSrcweir #endif
108cdf0e10cSrcweir
109cdf0e10cSrcweir #ifdef _SDR_NOGROUPOBJ
110cdf0e10cSrcweir #undef _SDR_NOGROUPOBJ
111cdf0e10cSrcweir #define _SVDOGRP_HXX
112cdf0e10cSrcweir #endif
113cdf0e10cSrcweir
114cdf0e10cSrcweir #ifdef _SDR_NOTEXTOBJ
115cdf0e10cSrcweir #undef _SDR_NOTEXTOBJ
116cdf0e10cSrcweir #define _SVDOTEXT_HXX
117cdf0e10cSrcweir #endif
118cdf0e10cSrcweir
119cdf0e10cSrcweir #ifdef _SDR_NOPATHOBJ
120cdf0e10cSrcweir #undef _SDR_NOPATHOBJ
121cdf0e10cSrcweir #define _SVDOPATH_HXX
122cdf0e10cSrcweir #endif
123cdf0e10cSrcweir
124cdf0e10cSrcweir #ifdef _SDR_NOEDGEOBJ
125cdf0e10cSrcweir #undef _SDR_NOEDGEOBJ
126cdf0e10cSrcweir #define _SVDOEDGE_HXX
127cdf0e10cSrcweir #endif
128cdf0e10cSrcweir
129cdf0e10cSrcweir #ifdef _SDR_NORECTOBJ
130cdf0e10cSrcweir #undef _SDR_NORECTOBJ
131cdf0e10cSrcweir #define _SVDORECT_HXX
132cdf0e10cSrcweir #else
133cdf0e10cSrcweir #undef _SDVOTEXT_OBJ
134cdf0e10cSrcweir #endif
135cdf0e10cSrcweir
136cdf0e10cSrcweir #ifdef _SDR_NOCAPTIONOBJ
137cdf0e10cSrcweir #undef _SDR_NOCAPTIONOBJ
138cdf0e10cSrcweir #define _SVDCAPT_HXX
139cdf0e10cSrcweir #endif
140cdf0e10cSrcweir
141cdf0e10cSrcweir #ifdef _SDR_NOCIRCLEOBJ
142cdf0e10cSrcweir #undef _SDR_NOCIRCLEOBJ
143cdf0e10cSrcweir #define _SVDOCIRC_HXX
144cdf0e10cSrcweir #endif
145cdf0e10cSrcweir
146cdf0e10cSrcweir #ifdef _SDR_NOGRAFOBJ
147cdf0e10cSrcweir #undef _SDR_NOGRAFOBJ
148cdf0e10cSrcweir #define _SVDOGRAF_HXX
149cdf0e10cSrcweir #else
150cdf0e10cSrcweir #undef _SVDOTEXT_HXX
151cdf0e10cSrcweir #undef _SVDORECT_HXX
152cdf0e10cSrcweir #endif
153cdf0e10cSrcweir
154cdf0e10cSrcweir #ifdef _SDR_NOOLE2OBJ
155cdf0e10cSrcweir #undef _SDR_NOOLE2OBJ
156cdf0e10cSrcweir #define _SVDOOLE2_HXX
157cdf0e10cSrcweir #else
158cdf0e10cSrcweir #undef _SVDOTEXT_HXX
159cdf0e10cSrcweir #undef _SVDORECT_HXX
160cdf0e10cSrcweir #endif
161cdf0e10cSrcweir
162cdf0e10cSrcweir //#ifdef _SDR_NOVIEWS
163cdf0e10cSrcweir // #define _SVDDRAG_HXX
164cdf0e10cSrcweir //#endif
165cdf0e10cSrcweir
166cdf0e10cSrcweir ////////////////////// Ende der SVDRAW-Modifikationen /////////////////////
167cdf0e10cSrcweir
168cdf0e10cSrcweir
169cdf0e10cSrcweir // INCLUDE ---------------------------------------------------------------
170cdf0e10cSrcweir
171cdf0e10cSrcweir #include "scitems.hxx"
172cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
173cdf0e10cSrcweir #include <sfx2/bindings.hxx>
174cdf0e10cSrcweir #include <vcl/help.hxx>
175cdf0e10cSrcweir #include <rtl/logfile.hxx>
176cdf0e10cSrcweir
177cdf0e10cSrcweir #include "tabview.hxx"
178cdf0e10cSrcweir #include "tabvwsh.hxx"
179cdf0e10cSrcweir #include "document.hxx"
180cdf0e10cSrcweir #include "gridwin.hxx"
181cdf0e10cSrcweir #include "olinewin.hxx"
182cdf0e10cSrcweir #include "olinetab.hxx"
183cdf0e10cSrcweir #include "tabsplit.hxx"
184cdf0e10cSrcweir #include "colrowba.hxx"
185cdf0e10cSrcweir #include "tabcont.hxx"
186cdf0e10cSrcweir #include "scmod.hxx"
187cdf0e10cSrcweir #include "sc.hrc"
188cdf0e10cSrcweir #include "viewutil.hxx"
189cdf0e10cSrcweir #include "globstr.hrc"
190cdf0e10cSrcweir #include "drawview.hxx"
191cdf0e10cSrcweir #include "docsh.hxx"
192cdf0e10cSrcweir #include "viewuno.hxx"
193cdf0e10cSrcweir #include "AccessibilityHints.hxx"
194cdf0e10cSrcweir #include "appoptio.hxx"
195cdf0e10cSrcweir
196cdf0e10cSrcweir #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
197cdf0e10cSrcweir
198cdf0e10cSrcweir #include <string>
199cdf0e10cSrcweir #include <algorithm>
200cdf0e10cSrcweir
201cdf0e10cSrcweir #define SPLIT_MARGIN 30
202cdf0e10cSrcweir #define SC_ICONSIZE 36
203cdf0e10cSrcweir
204cdf0e10cSrcweir #define SC_SCROLLBAR_MIN 30
205cdf0e10cSrcweir #define SC_TABBAR_MIN 6
206cdf0e10cSrcweir
207cdf0e10cSrcweir // fuer Rad-Maus
208cdf0e10cSrcweir #define SC_DELTA_ZOOM 10
209cdf0e10cSrcweir
210cdf0e10cSrcweir using namespace ::com::sun::star;
211cdf0e10cSrcweir
212cdf0e10cSrcweir // STATIC DATA -----------------------------------------------------------
213cdf0e10cSrcweir
214cdf0e10cSrcweir
215cdf0e10cSrcweir //==================================================================
216cdf0e10cSrcweir
217cdf0e10cSrcweir // Corner-Button
218cdf0e10cSrcweir
ScCornerButton(Window * pParent,ScViewData * pData,sal_Bool bAdditional)219cdf0e10cSrcweir ScCornerButton::ScCornerButton( Window* pParent, ScViewData* pData, sal_Bool bAdditional ) :
220cdf0e10cSrcweir Window( pParent, WinBits( 0 ) ),
221cdf0e10cSrcweir pViewData( pData ),
222cdf0e10cSrcweir bAdd( bAdditional )
223cdf0e10cSrcweir {
224cdf0e10cSrcweir const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
225cdf0e10cSrcweir SetBackground( rStyleSettings.GetFaceColor() );
226cdf0e10cSrcweir EnableRTL( sal_False );
227cdf0e10cSrcweir }
228cdf0e10cSrcweir
~ScCornerButton()229cdf0e10cSrcweir __EXPORT ScCornerButton::~ScCornerButton()
230cdf0e10cSrcweir {
231cdf0e10cSrcweir }
232cdf0e10cSrcweir
Paint(const Rectangle & rRect)233cdf0e10cSrcweir void __EXPORT ScCornerButton::Paint( const Rectangle& rRect )
234cdf0e10cSrcweir {
235cdf0e10cSrcweir Size aSize = GetOutputSizePixel();
236cdf0e10cSrcweir long nPosX = aSize.Width()-1;
237cdf0e10cSrcweir long nPosY = aSize.Height()-1;
238cdf0e10cSrcweir
239cdf0e10cSrcweir const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
240cdf0e10cSrcweir
241cdf0e10cSrcweir Window::Paint(rRect);
242cdf0e10cSrcweir
243cdf0e10cSrcweir sal_Bool bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() );
244cdf0e10cSrcweir long nDarkX = bLayoutRTL ? 0 : nPosX;
245cdf0e10cSrcweir
246cdf0e10cSrcweir if ( !bAdd && !rStyleSettings.GetHighContrastMode() )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir // match the shaded look of column/row headers
249cdf0e10cSrcweir
250cdf0e10cSrcweir Color aFace( rStyleSettings.GetFaceColor() );
251cdf0e10cSrcweir Color aWhite( COL_WHITE );
252cdf0e10cSrcweir Color aCenter( aFace );
253cdf0e10cSrcweir aCenter.Merge( aWhite, 0xd0 ); // lighten up a bit
254cdf0e10cSrcweir Color aOuter( aFace );
255cdf0e10cSrcweir aOuter.Merge( aWhite, 0xa0 ); // lighten up more
256cdf0e10cSrcweir
257cdf0e10cSrcweir long nCenterX = (aSize.Width() / 2) - 1;
258cdf0e10cSrcweir long nCenterY = (aSize.Height() / 2) - 1;
259cdf0e10cSrcweir
260cdf0e10cSrcweir SetLineColor();
261cdf0e10cSrcweir SetFillColor(aCenter);
262cdf0e10cSrcweir DrawRect( Rectangle( nCenterX, nCenterY, nCenterX, nPosY ) );
263cdf0e10cSrcweir DrawRect( Rectangle( nCenterX, nCenterY, nDarkX, nCenterY ) );
264cdf0e10cSrcweir SetFillColor(aOuter);
265cdf0e10cSrcweir DrawRect( Rectangle( 0, 0, nPosX, nCenterY-1 ) );
266cdf0e10cSrcweir if ( bLayoutRTL )
267cdf0e10cSrcweir DrawRect( Rectangle( nCenterX+1, nCenterY, nPosX, nPosY ) );
268cdf0e10cSrcweir else
269cdf0e10cSrcweir DrawRect( Rectangle( 0, nCenterY, nCenterX-1, nPosY ) );
270cdf0e10cSrcweir }
271cdf0e10cSrcweir
272cdf0e10cSrcweir // both buttons have the same look now - only dark right/bottom lines
273cdf0e10cSrcweir SetLineColor( rStyleSettings.GetDarkShadowColor() );
274cdf0e10cSrcweir DrawLine( Point(0,nPosY), Point(nPosX,nPosY) );
275cdf0e10cSrcweir DrawLine( Point(nDarkX,0), Point(nDarkX,nPosY) );
276cdf0e10cSrcweir }
277cdf0e10cSrcweir
StateChanged(StateChangedType nType)278cdf0e10cSrcweir void ScCornerButton::StateChanged( StateChangedType nType )
279cdf0e10cSrcweir {
280cdf0e10cSrcweir Window::StateChanged( nType );
281cdf0e10cSrcweir
282cdf0e10cSrcweir const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
283cdf0e10cSrcweir SetBackground( rStyleSettings.GetFaceColor() );
284cdf0e10cSrcweir Invalidate();
285cdf0e10cSrcweir }
286cdf0e10cSrcweir
287cdf0e10cSrcweir // -----------------------------------------------------------------------
288cdf0e10cSrcweir
DataChanged(const DataChangedEvent & rDCEvt)289cdf0e10cSrcweir void ScCornerButton::DataChanged( const DataChangedEvent& rDCEvt )
290cdf0e10cSrcweir {
291cdf0e10cSrcweir Window::DataChanged( rDCEvt );
292cdf0e10cSrcweir
293cdf0e10cSrcweir const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
294cdf0e10cSrcweir SetBackground( rStyleSettings.GetFaceColor() );
295cdf0e10cSrcweir Invalidate();
296cdf0e10cSrcweir }
297cdf0e10cSrcweir
298cdf0e10cSrcweir
Resize()299cdf0e10cSrcweir void __EXPORT ScCornerButton::Resize()
300cdf0e10cSrcweir {
301cdf0e10cSrcweir Invalidate();
302cdf0e10cSrcweir }
303cdf0e10cSrcweir
MouseButtonDown(const MouseEvent & rMEvt)304cdf0e10cSrcweir void __EXPORT ScCornerButton::MouseButtonDown( const MouseEvent& rMEvt )
305cdf0e10cSrcweir {
306cdf0e10cSrcweir ScModule* pScMod = SC_MOD();
307cdf0e10cSrcweir sal_Bool bDisable = pScMod->IsFormulaMode() || pScMod->IsModalMode();
308cdf0e10cSrcweir if (!bDisable)
309cdf0e10cSrcweir {
310cdf0e10cSrcweir ScTabViewShell* pViewSh = pViewData->GetViewShell();
311cdf0e10cSrcweir pViewSh->SetActive(); // Appear und SetViewFrame
312cdf0e10cSrcweir pViewSh->ActiveGrabFocus();
313cdf0e10cSrcweir
314cdf0e10cSrcweir sal_Bool bControl = rMEvt.IsMod1();
315cdf0e10cSrcweir pViewSh->SelectAll( bControl );
316cdf0e10cSrcweir }
317cdf0e10cSrcweir }
318cdf0e10cSrcweir
319cdf0e10cSrcweir //==================================================================
320cdf0e10cSrcweir
lcl_HasColOutline(const ScViewData & rViewData)321cdf0e10cSrcweir sal_Bool lcl_HasColOutline( const ScViewData& rViewData )
322cdf0e10cSrcweir {
323cdf0e10cSrcweir const ScOutlineTable* pTable = rViewData.GetDocument()->GetOutlineTable(rViewData.GetTabNo());
324cdf0e10cSrcweir if (pTable)
325cdf0e10cSrcweir {
326cdf0e10cSrcweir const ScOutlineArray* pArray = pTable->GetColArray();
327cdf0e10cSrcweir if ( pArray->GetDepth() > 0 )
328cdf0e10cSrcweir return sal_True;
329cdf0e10cSrcweir }
330cdf0e10cSrcweir return sal_False;
331cdf0e10cSrcweir }
332cdf0e10cSrcweir
lcl_HasRowOutline(const ScViewData & rViewData)333cdf0e10cSrcweir sal_Bool lcl_HasRowOutline( const ScViewData& rViewData )
334cdf0e10cSrcweir {
335cdf0e10cSrcweir const ScOutlineTable* pTable = rViewData.GetDocument()->GetOutlineTable(rViewData.GetTabNo());
336cdf0e10cSrcweir if (pTable)
337cdf0e10cSrcweir {
338cdf0e10cSrcweir const ScOutlineArray* pArray = pTable->GetRowArray();
339cdf0e10cSrcweir if ( pArray->GetDepth() > 0 )
340cdf0e10cSrcweir return sal_True;
341cdf0e10cSrcweir }
342cdf0e10cSrcweir return sal_False;
343cdf0e10cSrcweir }
344cdf0e10cSrcweir
345cdf0e10cSrcweir //==================================================================
346cdf0e10cSrcweir
347cdf0e10cSrcweir // Init und Konstruktoren
348cdf0e10cSrcweir // ScTabView::Init() in tabview5.cxx wegen out of keys
349cdf0e10cSrcweir
350cdf0e10cSrcweir
351cdf0e10cSrcweir #define TABVIEW_INIT \
352cdf0e10cSrcweir pSelEngine( NULL ), \
353cdf0e10cSrcweir aFunctionSet( &aViewData ), \
354cdf0e10cSrcweir pHdrSelEng( NULL ), \
355cdf0e10cSrcweir aHdrFunc( &aViewData ), \
356cdf0e10cSrcweir pDrawView( NULL ), \
357cdf0e10cSrcweir bDrawSelMode( sal_False ), \
358cdf0e10cSrcweir aVScrollTop( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ), \
359cdf0e10cSrcweir aVScrollBottom( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ), \
360cdf0e10cSrcweir aHScrollLeft( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ), \
361cdf0e10cSrcweir aHScrollRight( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ), \
362cdf0e10cSrcweir aCornerButton( pFrameWin, &aViewData, sal_False ), \
363cdf0e10cSrcweir aTopButton( pFrameWin, &aViewData, sal_True ), \
364cdf0e10cSrcweir aScrollBarBox( pFrameWin, WB_SIZEABLE ), \
365cdf0e10cSrcweir pInputHintWindow( NULL ), \
366cdf0e10cSrcweir pPageBreakData( NULL ), \
367cdf0e10cSrcweir pHighlightRanges( NULL ), \
368cdf0e10cSrcweir pBrushDocument( NULL ), \
369cdf0e10cSrcweir pDrawBrushSet( NULL ), \
370cdf0e10cSrcweir bLockPaintBrush( sal_False ), \
371cdf0e10cSrcweir pTimerWindow( NULL ), \
372cdf0e10cSrcweir nTipVisible( 0 ), \
373cdf0e10cSrcweir bDragging( sal_False ), \
374cdf0e10cSrcweir bIsBlockMode( sal_False ), \
375cdf0e10cSrcweir bBlockNeg( sal_False ), \
376cdf0e10cSrcweir bBlockCols( sal_False ), \
377cdf0e10cSrcweir bBlockRows( sal_False ), \
378cdf0e10cSrcweir mfPendingTabBarWidth( -1.0 ), \
379cdf0e10cSrcweir bMinimized( sal_False ), \
380cdf0e10cSrcweir bInUpdateHeader( sal_False ), \
381cdf0e10cSrcweir bInActivatePart( sal_False ), \
382cdf0e10cSrcweir bInZoomUpdate( sal_False ), \
383cdf0e10cSrcweir bMoveIsShift( sal_False ), \
384cdf0e10cSrcweir bNewStartIfMarking( sal_False )
385cdf0e10cSrcweir
386cdf0e10cSrcweir
ScTabView(Window * pParent,ScDocShell & rDocSh,ScTabViewShell * pViewShell)387cdf0e10cSrcweir ScTabView::ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) :
388cdf0e10cSrcweir pFrameWin( pParent ),
389cdf0e10cSrcweir aViewData( &rDocSh, pViewShell ),
390cdf0e10cSrcweir TABVIEW_INIT
391cdf0e10cSrcweir {
392cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScTabView::ScTabView" );
393cdf0e10cSrcweir
394cdf0e10cSrcweir Init();
395cdf0e10cSrcweir }
396cdf0e10cSrcweir
397cdf0e10cSrcweir //UNUSED2009-05 ScTabView::ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell ) :
398cdf0e10cSrcweir //UNUSED2009-05 pFrameWin( pParent ),
399cdf0e10cSrcweir //UNUSED2009-05 aViewData( rScTabView.aViewData ),
400cdf0e10cSrcweir //UNUSED2009-05 TABVIEW_INIT
401cdf0e10cSrcweir //UNUSED2009-05 {
402cdf0e10cSrcweir //UNUSED2009-05 RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScTabView::ScTabView" );
403cdf0e10cSrcweir //UNUSED2009-05
404cdf0e10cSrcweir //UNUSED2009-05 aViewData.SetViewShell( pViewShell );
405cdf0e10cSrcweir //UNUSED2009-05 Init();
406cdf0e10cSrcweir //UNUSED2009-05
407cdf0e10cSrcweir //UNUSED2009-05 UpdateShow();
408cdf0e10cSrcweir //UNUSED2009-05 if ( aViewData.GetActivePart() != SC_SPLIT_BOTTOMLEFT )
409cdf0e10cSrcweir //UNUSED2009-05 pGridWin[SC_SPLIT_BOTTOMLEFT]->Show();
410cdf0e10cSrcweir //UNUSED2009-05
411cdf0e10cSrcweir //UNUSED2009-05 InvalidateSplit();
412cdf0e10cSrcweir //UNUSED2009-05 }
413cdf0e10cSrcweir
414cdf0e10cSrcweir void ScTabView::InitScrollBar( ScrollBar& rScrollBar, long nMaxVal )
415cdf0e10cSrcweir {
416cdf0e10cSrcweir rScrollBar.SetRange( Range( 0, nMaxVal ) );
417cdf0e10cSrcweir rScrollBar.SetLineSize( 1 );
418cdf0e10cSrcweir rScrollBar.SetPageSize( 1 ); // wird getrennt abgefragt
419cdf0e10cSrcweir rScrollBar.SetVisibleSize( 10 ); // wird bei Resize neu gesetzt
420cdf0e10cSrcweir
421cdf0e10cSrcweir rScrollBar.SetScrollHdl( LINK(this, ScTabView, ScrollHdl) );
422cdf0e10cSrcweir rScrollBar.SetEndScrollHdl( LINK(this, ScTabView, EndScrollHdl) );
423cdf0e10cSrcweir }
424cdf0e10cSrcweir
425cdf0e10cSrcweir // Scroll-Timer
426cdf0e10cSrcweir
SetTimer(ScGridWindow * pWin,const MouseEvent & rMEvt)427cdf0e10cSrcweir void ScTabView::SetTimer( ScGridWindow* pWin, const MouseEvent& rMEvt )
428cdf0e10cSrcweir {
429cdf0e10cSrcweir pTimerWindow = pWin;
430cdf0e10cSrcweir aTimerMEvt = rMEvt;
431cdf0e10cSrcweir aScrollTimer.Start();
432cdf0e10cSrcweir }
433cdf0e10cSrcweir
ResetTimer()434cdf0e10cSrcweir void ScTabView::ResetTimer()
435cdf0e10cSrcweir {
436cdf0e10cSrcweir aScrollTimer.Stop();
437cdf0e10cSrcweir pTimerWindow = NULL;
438cdf0e10cSrcweir }
439cdf0e10cSrcweir
IMPL_LINK(ScTabView,TimerHdl,Timer *,EMPTYARG)440cdf0e10cSrcweir IMPL_LINK( ScTabView, TimerHdl, Timer*, EMPTYARG )
441cdf0e10cSrcweir {
442cdf0e10cSrcweir // aScrollTimer.Stop();
443cdf0e10cSrcweir if (pTimerWindow)
444cdf0e10cSrcweir pTimerWindow->MouseMove( aTimerMEvt );
445cdf0e10cSrcweir
446cdf0e10cSrcweir return 0;
447cdf0e10cSrcweir }
448cdf0e10cSrcweir
449cdf0e10cSrcweir // --- Resize ---------------------------------------------------------------------
450cdf0e10cSrcweir
lcl_SetPosSize(Window & rWindow,const Point & rPos,const Size & rSize,long nTotalWidth,sal_Bool bLayoutRTL)451cdf0e10cSrcweir void lcl_SetPosSize( Window& rWindow, const Point& rPos, const Size& rSize,
452cdf0e10cSrcweir long nTotalWidth, sal_Bool bLayoutRTL )
453cdf0e10cSrcweir {
454cdf0e10cSrcweir Point aNewPos = rPos;
455cdf0e10cSrcweir if ( bLayoutRTL )
456cdf0e10cSrcweir {
457cdf0e10cSrcweir aNewPos.X() = nTotalWidth - rPos.X() - rSize.Width();
458cdf0e10cSrcweir if ( aNewPos == rWindow.GetPosPixel() && rSize.Width() != rWindow.GetSizePixel().Width() )
459cdf0e10cSrcweir {
460cdf0e10cSrcweir // Document windows are manually painted right-to-left, so they need to
461cdf0e10cSrcweir // be repainted if the size changes.
462cdf0e10cSrcweir rWindow.Invalidate();
463cdf0e10cSrcweir }
464cdf0e10cSrcweir }
465cdf0e10cSrcweir rWindow.SetPosSizePixel( aNewPos, rSize );
466cdf0e10cSrcweir }
467cdf0e10cSrcweir
DoResize(const Point & rOffset,const Size & rSize,sal_Bool bInner)468cdf0e10cSrcweir void ScTabView::DoResize( const Point& rOffset, const Size& rSize, sal_Bool bInner )
469cdf0e10cSrcweir {
470cdf0e10cSrcweir HideListBox();
471cdf0e10cSrcweir
472cdf0e10cSrcweir sal_Bool bHasHint = ( pInputHintWindow != NULL );
473cdf0e10cSrcweir if (bHasHint)
474cdf0e10cSrcweir RemoveHintWindow();
475cdf0e10cSrcweir
476cdf0e10cSrcweir sal_Bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
477cdf0e10cSrcweir long nTotalWidth = rSize.Width();
478cdf0e10cSrcweir if ( bLayoutRTL )
479cdf0e10cSrcweir nTotalWidth += 2*rOffset.X();
480cdf0e10cSrcweir
481cdf0e10cSrcweir sal_Bool bVScroll = aViewData.IsVScrollMode();
482cdf0e10cSrcweir sal_Bool bHScroll = aViewData.IsHScrollMode();
483cdf0e10cSrcweir sal_Bool bTabControl = aViewData.IsTabMode();
484cdf0e10cSrcweir sal_Bool bHeaders = aViewData.IsHeaderMode();
485cdf0e10cSrcweir sal_Bool bOutlMode = aViewData.IsOutlineMode();
486cdf0e10cSrcweir sal_Bool bHOutline = bOutlMode && lcl_HasColOutline(aViewData);
487cdf0e10cSrcweir sal_Bool bVOutline = bOutlMode && lcl_HasRowOutline(aViewData);
488cdf0e10cSrcweir
489cdf0e10cSrcweir // Scrollbar-Einstellungen koennen vom Sfx ueberschrieben werden:
490cdf0e10cSrcweir SfxScrollingMode eMode = aViewData.GetViewShell()->GetScrollingMode();
491cdf0e10cSrcweir if ( eMode == SCROLLING_NO )
492cdf0e10cSrcweir bHScroll = bVScroll = sal_False;
493cdf0e10cSrcweir else if ( eMode == SCROLLING_YES || eMode == SCROLLING_AUTO ) //! Auto ???
494cdf0e10cSrcweir bHScroll = bVScroll = sal_True;
495cdf0e10cSrcweir
496cdf0e10cSrcweir if ( aViewData.GetDocShell()->IsPreview() )
497cdf0e10cSrcweir bHScroll = bVScroll = bTabControl = bHeaders = bOutlMode = bHOutline = bVOutline = sal_False;
498cdf0e10cSrcweir
499cdf0e10cSrcweir long nBarX = 0;
500cdf0e10cSrcweir long nBarY = 0;
501cdf0e10cSrcweir long nOutlineX = 0;
502cdf0e10cSrcweir long nOutlineY = 0;
503cdf0e10cSrcweir long nOutPosX;
504cdf0e10cSrcweir long nOutPosY;
505cdf0e10cSrcweir
506cdf0e10cSrcweir long nPosX = rOffset.X();
507cdf0e10cSrcweir long nPosY = rOffset.Y();
508cdf0e10cSrcweir long nSizeX = rSize.Width();
509cdf0e10cSrcweir long nSizeY = rSize.Height();
510cdf0e10cSrcweir long nSize1;
511cdf0e10cSrcweir
512cdf0e10cSrcweir bMinimized = ( nSizeX<=SC_ICONSIZE || nSizeY<=SC_ICONSIZE );
513cdf0e10cSrcweir if ( bMinimized )
514cdf0e10cSrcweir return;
515cdf0e10cSrcweir
516cdf0e10cSrcweir long nSplitSizeX = SPLIT_HANDLE_SIZE;
517cdf0e10cSrcweir if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
518cdf0e10cSrcweir nSplitSizeX = 1;
519cdf0e10cSrcweir long nSplitSizeY = SPLIT_HANDLE_SIZE;
520cdf0e10cSrcweir if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
521cdf0e10cSrcweir nSplitSizeY = 1;
522cdf0e10cSrcweir
523cdf0e10cSrcweir const long nOverlap = 0; // ScrollBar::GetWindowOverlapPixel();
524cdf0e10cSrcweir
525cdf0e10cSrcweir aBorderPos = rOffset;
526cdf0e10cSrcweir aFrameSize = rSize;
527cdf0e10cSrcweir
528cdf0e10cSrcweir if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE )
529cdf0e10cSrcweir if ( aViewData.GetHSplitPos() > nSizeX - SPLIT_MARGIN )
530cdf0e10cSrcweir {
531cdf0e10cSrcweir aViewData.SetHSplitMode( SC_SPLIT_NONE );
532cdf0e10cSrcweir if ( WhichH( aViewData.GetActivePart() ) == SC_SPLIT_RIGHT )
533cdf0e10cSrcweir ActivatePart( SC_SPLIT_BOTTOMLEFT );
534cdf0e10cSrcweir InvalidateSplit();
535cdf0e10cSrcweir // UpdateShow();
536cdf0e10cSrcweir }
537cdf0e10cSrcweir if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
538cdf0e10cSrcweir if ( aViewData.GetVSplitPos() > nSizeY - SPLIT_MARGIN )
539cdf0e10cSrcweir {
540cdf0e10cSrcweir aViewData.SetVSplitMode( SC_SPLIT_NONE );
541cdf0e10cSrcweir if ( WhichV( aViewData.GetActivePart() ) == SC_SPLIT_TOP )
542cdf0e10cSrcweir ActivatePart( SC_SPLIT_BOTTOMLEFT );
543cdf0e10cSrcweir InvalidateSplit();
544cdf0e10cSrcweir // UpdateShow();
545cdf0e10cSrcweir }
546cdf0e10cSrcweir
547cdf0e10cSrcweir UpdateShow();
548cdf0e10cSrcweir
549cdf0e10cSrcweir if (bHScroll || bVScroll) // Scrollbars horizontal oder vertikal
550cdf0e10cSrcweir {
551cdf0e10cSrcweir long nScrollBarSize = pFrameWin->GetSettings().GetStyleSettings().GetScrollBarSize();
552cdf0e10cSrcweir if (bVScroll)
553cdf0e10cSrcweir {
554cdf0e10cSrcweir // nBarX = aVScrollBottom.GetSizePixel().Width();
555cdf0e10cSrcweir nBarX = nScrollBarSize;
556cdf0e10cSrcweir nSizeX -= nBarX - nOverlap;
557cdf0e10cSrcweir }
558cdf0e10cSrcweir if (bHScroll)
559cdf0e10cSrcweir {
560cdf0e10cSrcweir // nBarY = aHScrollLeft.GetSizePixel().Height();
561cdf0e10cSrcweir nBarY = nScrollBarSize;
562cdf0e10cSrcweir nSizeY -= nBarY - nOverlap;
563cdf0e10cSrcweir }
564cdf0e10cSrcweir
565cdf0e10cSrcweir // window at the bottom right
566cdf0e10cSrcweir lcl_SetPosSize( aScrollBarBox, Point( nPosX+nSizeX, nPosY+nSizeY ), Size( nBarX, nBarY ),
567cdf0e10cSrcweir nTotalWidth, bLayoutRTL );
568cdf0e10cSrcweir
569cdf0e10cSrcweir if (bHScroll) // Scrollbars horizontal
570cdf0e10cSrcweir {
571cdf0e10cSrcweir long nSizeLt = 0; // left scroll bar
572cdf0e10cSrcweir long nSizeRt = 0; // right scroll bar
573cdf0e10cSrcweir long nSizeSp = 0; // splitter
574cdf0e10cSrcweir
575cdf0e10cSrcweir switch (aViewData.GetHSplitMode())
576cdf0e10cSrcweir {
577cdf0e10cSrcweir case SC_SPLIT_NONE:
578cdf0e10cSrcweir nSizeSp = nSplitSizeX;
579cdf0e10cSrcweir nSizeLt = nSizeX - nSizeSp + nOverlap; // Ecke ueberdecken
580cdf0e10cSrcweir break;
581cdf0e10cSrcweir case SC_SPLIT_NORMAL:
582cdf0e10cSrcweir nSizeSp = nSplitSizeX;
583cdf0e10cSrcweir nSizeLt = aViewData.GetHSplitPos();
584cdf0e10cSrcweir break;
585cdf0e10cSrcweir case SC_SPLIT_FIX:
586cdf0e10cSrcweir nSizeSp = 0;
587cdf0e10cSrcweir nSizeLt = 0;
588cdf0e10cSrcweir break;
589cdf0e10cSrcweir }
590cdf0e10cSrcweir nSizeRt = nSizeX - nSizeLt - nSizeSp;
591cdf0e10cSrcweir
592cdf0e10cSrcweir long nTabSize = 0;
593cdf0e10cSrcweir if (bTabControl)
594cdf0e10cSrcweir {
595cdf0e10cSrcweir // pending relative tab bar width from extended document options
596cdf0e10cSrcweir if( mfPendingTabBarWidth >= 0.0 )
597cdf0e10cSrcweir {
598cdf0e10cSrcweir SetRelTabBarWidth( mfPendingTabBarWidth );
599cdf0e10cSrcweir mfPendingTabBarWidth = -1.0;
600cdf0e10cSrcweir }
601cdf0e10cSrcweir
602cdf0e10cSrcweir nTabSize = pTabControl->GetSizePixel().Width()-nOverlap;
603cdf0e10cSrcweir
604cdf0e10cSrcweir if ( aViewData.GetHSplitMode() != SC_SPLIT_FIX ) // bei linkem Scrollbar
605cdf0e10cSrcweir {
606cdf0e10cSrcweir if (nTabSize > nSizeLt-SC_SCROLLBAR_MIN) nTabSize = nSizeLt-SC_SCROLLBAR_MIN;
607cdf0e10cSrcweir if (nTabSize < SC_TABBAR_MIN) nTabSize = SC_TABBAR_MIN;
608cdf0e10cSrcweir nSizeLt -= nTabSize;
609cdf0e10cSrcweir }
610cdf0e10cSrcweir else // bei rechtem Scrollbar
611cdf0e10cSrcweir {
612cdf0e10cSrcweir if (nTabSize > nSizeRt-SC_SCROLLBAR_MIN) nTabSize = nSizeRt-SC_SCROLLBAR_MIN;
613cdf0e10cSrcweir if (nTabSize < SC_TABBAR_MIN) nTabSize = SC_TABBAR_MIN;
614cdf0e10cSrcweir nSizeRt -= nTabSize;
615cdf0e10cSrcweir }
616cdf0e10cSrcweir }
617cdf0e10cSrcweir
618cdf0e10cSrcweir lcl_SetPosSize( *pTabControl, Point(nPosX-nOverlap, nPosY+nSizeY),
619cdf0e10cSrcweir Size(nTabSize+nOverlap, nBarY), nTotalWidth, bLayoutRTL );
620cdf0e10cSrcweir pTabControl->SetSheetLayoutRTL( bLayoutRTL );
621cdf0e10cSrcweir
622cdf0e10cSrcweir lcl_SetPosSize( aHScrollLeft, Point(nPosX+nTabSize-nOverlap, nPosY+nSizeY),
623cdf0e10cSrcweir Size(nSizeLt+2*nOverlap, nBarY), nTotalWidth, bLayoutRTL );
624cdf0e10cSrcweir lcl_SetPosSize( *pHSplitter, Point( nPosX+nTabSize+nSizeLt, nPosY+nSizeY ),
625cdf0e10cSrcweir Size( nSizeSp, nBarY ), nTotalWidth, bLayoutRTL );
626cdf0e10cSrcweir lcl_SetPosSize( aHScrollRight, Point(nPosX+nTabSize+nSizeLt+nSizeSp-nOverlap,
627cdf0e10cSrcweir nPosY+nSizeY),
628cdf0e10cSrcweir Size(nSizeRt+2*nOverlap, nBarY), nTotalWidth, bLayoutRTL );
629cdf0e10cSrcweir
630cdf0e10cSrcweir // SetDragRectPixel is done below
631cdf0e10cSrcweir }
632cdf0e10cSrcweir
633cdf0e10cSrcweir if (bVScroll) // Scrollbars vertikal
634cdf0e10cSrcweir {
635cdf0e10cSrcweir long nSizeUp = 0; // upper scroll bar
636cdf0e10cSrcweir long nSizeSp = 0; // splitter
637cdf0e10cSrcweir long nSizeDn; // unterer Scrollbar
638cdf0e10cSrcweir
639cdf0e10cSrcweir switch (aViewData.GetVSplitMode())
640cdf0e10cSrcweir {
641cdf0e10cSrcweir case SC_SPLIT_NONE:
642cdf0e10cSrcweir nSizeUp = 0;
643cdf0e10cSrcweir nSizeSp = nSplitSizeY;
644cdf0e10cSrcweir break;
645cdf0e10cSrcweir case SC_SPLIT_NORMAL:
646cdf0e10cSrcweir nSizeUp = aViewData.GetVSplitPos();
647cdf0e10cSrcweir nSizeSp = nSplitSizeY;
648cdf0e10cSrcweir break;
649cdf0e10cSrcweir case SC_SPLIT_FIX:
650cdf0e10cSrcweir nSizeUp = 0;
651cdf0e10cSrcweir nSizeSp = 0;
652cdf0e10cSrcweir break;
653cdf0e10cSrcweir }
654cdf0e10cSrcweir nSizeDn = nSizeY - nSizeUp - nSizeSp;
655cdf0e10cSrcweir
656cdf0e10cSrcweir lcl_SetPosSize( aVScrollTop, Point(nPosX+nSizeX, nPosY-nOverlap),
657cdf0e10cSrcweir Size(nBarX,nSizeUp+2*nOverlap), nTotalWidth, bLayoutRTL );
658cdf0e10cSrcweir lcl_SetPosSize( *pVSplitter, Point( nPosX+nSizeX, nPosY+nSizeUp ),
659cdf0e10cSrcweir Size( nBarX, nSizeSp ), nTotalWidth, bLayoutRTL );
660cdf0e10cSrcweir lcl_SetPosSize( aVScrollBottom, Point(nPosX+nSizeX,
661cdf0e10cSrcweir nPosY+nSizeUp+nSizeSp-nOverlap),
662cdf0e10cSrcweir Size(nBarX, nSizeDn+2*nOverlap), nTotalWidth, bLayoutRTL );
663cdf0e10cSrcweir
664cdf0e10cSrcweir // SetDragRectPixel is done below
665cdf0e10cSrcweir }
666cdf0e10cSrcweir }
667cdf0e10cSrcweir
668cdf0e10cSrcweir // SetDragRectPixel auch ohne Scrollbars etc., wenn schon gesplittet ist
669cdf0e10cSrcweir if ( bHScroll || aViewData.GetHSplitMode() != SC_SPLIT_NONE )
670cdf0e10cSrcweir pHSplitter->SetDragRectPixel(
671cdf0e10cSrcweir Rectangle( nPosX, nPosY, nPosX+nSizeX, nPosY+nSizeY ), pFrameWin );
672cdf0e10cSrcweir if ( bVScroll || aViewData.GetVSplitMode() != SC_SPLIT_NONE )
673cdf0e10cSrcweir pVSplitter->SetDragRectPixel(
674cdf0e10cSrcweir Rectangle( nPosX, nPosY, nPosX+nSizeX, nPosY+nSizeY ), pFrameWin );
675cdf0e10cSrcweir
676cdf0e10cSrcweir if (bTabControl && ! bHScroll )
677cdf0e10cSrcweir {
678cdf0e10cSrcweir nBarY = aHScrollLeft.GetSizePixel().Height();
679cdf0e10cSrcweir nBarX = aVScrollBottom.GetSizePixel().Width();
680cdf0e10cSrcweir
681cdf0e10cSrcweir nSize1 = nSizeX + nOverlap;
682cdf0e10cSrcweir
683cdf0e10cSrcweir long nTabSize = nSize1;
684cdf0e10cSrcweir if (nTabSize < 0) nTabSize = 0;
685cdf0e10cSrcweir
686cdf0e10cSrcweir lcl_SetPosSize( *pTabControl, Point(nPosX-nOverlap, nPosY+nSizeY-nBarY),
687cdf0e10cSrcweir Size(nTabSize+nOverlap, nBarY), nTotalWidth, bLayoutRTL );
688cdf0e10cSrcweir nSizeY -= nBarY - nOverlap;
689cdf0e10cSrcweir lcl_SetPosSize( aScrollBarBox, Point( nPosX+nSizeX, nPosY+nSizeY ), Size( nBarX, nBarY ),
690cdf0e10cSrcweir nTotalWidth, bLayoutRTL );
691cdf0e10cSrcweir
692cdf0e10cSrcweir if( bVScroll )
693cdf0e10cSrcweir {
694cdf0e10cSrcweir Size aVScrSize = aVScrollBottom.GetSizePixel();
695cdf0e10cSrcweir aVScrSize.Height() -= nBarY;
696cdf0e10cSrcweir aVScrollBottom.SetSizePixel( aVScrSize );
697cdf0e10cSrcweir }
698cdf0e10cSrcweir }
699cdf0e10cSrcweir
700cdf0e10cSrcweir nOutPosX = nPosX;
701cdf0e10cSrcweir nOutPosY = nPosY;
702cdf0e10cSrcweir
703cdf0e10cSrcweir // Outline-Controls
704cdf0e10cSrcweir if (bVOutline && pRowOutline[SC_SPLIT_BOTTOM])
705cdf0e10cSrcweir {
706cdf0e10cSrcweir nOutlineX = pRowOutline[SC_SPLIT_BOTTOM]->GetDepthSize();
707cdf0e10cSrcweir nSizeX -= nOutlineX;
708cdf0e10cSrcweir nPosX += nOutlineX;
709cdf0e10cSrcweir }
710cdf0e10cSrcweir if (bHOutline && pColOutline[SC_SPLIT_LEFT])
711cdf0e10cSrcweir {
712cdf0e10cSrcweir nOutlineY = pColOutline[SC_SPLIT_LEFT]->GetDepthSize();
713cdf0e10cSrcweir nSizeY -= nOutlineY;
714cdf0e10cSrcweir nPosY += nOutlineY;
715cdf0e10cSrcweir }
716cdf0e10cSrcweir
717cdf0e10cSrcweir if (bHeaders) // Spalten/Zeilen-Header
718cdf0e10cSrcweir {
719cdf0e10cSrcweir nBarX = pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width();
720cdf0e10cSrcweir nBarY = pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height();
721cdf0e10cSrcweir nSizeX -= nBarX;
722cdf0e10cSrcweir nSizeY -= nBarY;
723cdf0e10cSrcweir nPosX += nBarX;
724cdf0e10cSrcweir nPosY += nBarY;
725cdf0e10cSrcweir }
726cdf0e10cSrcweir else
727cdf0e10cSrcweir nBarX = nBarY = 0;
728cdf0e10cSrcweir
729cdf0e10cSrcweir //
730cdf0e10cSrcweir // Splitter auswerten
731cdf0e10cSrcweir //
732cdf0e10cSrcweir
733cdf0e10cSrcweir long nLeftSize = nSizeX;
734cdf0e10cSrcweir long nRightSize = 0;
735cdf0e10cSrcweir long nTopSize = 0;
736cdf0e10cSrcweir long nBottomSize = nSizeY;
737cdf0e10cSrcweir long nSplitPosX = nPosX;
738cdf0e10cSrcweir long nSplitPosY = nPosY;
739cdf0e10cSrcweir
740cdf0e10cSrcweir if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE )
741cdf0e10cSrcweir {
742cdf0e10cSrcweir long nSplitHeight = rSize.Height();
743cdf0e10cSrcweir if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
744cdf0e10cSrcweir {
745cdf0e10cSrcweir // Fixier-Splitter nicht mit Scrollbar/TabBar ueberlappen lassen
746cdf0e10cSrcweir if ( bHScroll )
747cdf0e10cSrcweir nSplitHeight -= aHScrollLeft.GetSizePixel().Height();
748cdf0e10cSrcweir else if ( bTabControl && pTabControl )
749cdf0e10cSrcweir nSplitHeight -= pTabControl->GetSizePixel().Height();
750cdf0e10cSrcweir }
751cdf0e10cSrcweir nSplitPosX = aViewData.GetHSplitPos();
752cdf0e10cSrcweir lcl_SetPosSize( *pHSplitter,
753cdf0e10cSrcweir Point( nSplitPosX, nOutPosY ), Size( nSplitSizeX, nSplitHeight ), nTotalWidth, bLayoutRTL );
754cdf0e10cSrcweir nLeftSize = nSplitPosX - nPosX;
755cdf0e10cSrcweir nSplitPosX += nSplitSizeX;
756cdf0e10cSrcweir nRightSize = nSizeX - nLeftSize - nSplitSizeX;
757cdf0e10cSrcweir }
758cdf0e10cSrcweir if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
759cdf0e10cSrcweir {
760cdf0e10cSrcweir long nSplitWidth = rSize.Width();
761cdf0e10cSrcweir if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX && bVScroll )
762cdf0e10cSrcweir nSplitWidth -= aVScrollBottom.GetSizePixel().Width();
763cdf0e10cSrcweir nSplitPosY = aViewData.GetVSplitPos();
764cdf0e10cSrcweir lcl_SetPosSize( *pVSplitter,
765cdf0e10cSrcweir Point( nOutPosX, nSplitPosY ), Size( nSplitWidth, nSplitSizeY ), nTotalWidth, bLayoutRTL );
766cdf0e10cSrcweir nTopSize = nSplitPosY - nPosY;
767cdf0e10cSrcweir nSplitPosY += nSplitSizeY;
768cdf0e10cSrcweir nBottomSize = nSizeY - nTopSize - nSplitSizeY;
769cdf0e10cSrcweir }
770cdf0e10cSrcweir
771cdf0e10cSrcweir // ShowHide fuer pColOutline / pRowOutline passiert in UpdateShow
772cdf0e10cSrcweir
773cdf0e10cSrcweir if (bHOutline) // Outline-Controls
774cdf0e10cSrcweir {
775cdf0e10cSrcweir if (pColOutline[SC_SPLIT_LEFT])
776cdf0e10cSrcweir {
777cdf0e10cSrcweir pColOutline[SC_SPLIT_LEFT]->SetHeaderSize( nBarX );
778cdf0e10cSrcweir lcl_SetPosSize( *pColOutline[SC_SPLIT_LEFT],
779cdf0e10cSrcweir Point(nPosX-nBarX,nOutPosY), Size(nLeftSize+nBarX,nOutlineY), nTotalWidth, bLayoutRTL );
780cdf0e10cSrcweir }
781cdf0e10cSrcweir if (pColOutline[SC_SPLIT_RIGHT])
782cdf0e10cSrcweir {
783cdf0e10cSrcweir pColOutline[SC_SPLIT_RIGHT]->SetHeaderSize( 0 ); // always call to update RTL flag
784cdf0e10cSrcweir lcl_SetPosSize( *pColOutline[SC_SPLIT_RIGHT],
785cdf0e10cSrcweir Point(nSplitPosX,nOutPosY), Size(nRightSize,nOutlineY), nTotalWidth, bLayoutRTL );
786cdf0e10cSrcweir }
787cdf0e10cSrcweir }
788cdf0e10cSrcweir if (bVOutline)
789cdf0e10cSrcweir {
790cdf0e10cSrcweir if (nTopSize)
791cdf0e10cSrcweir {
792cdf0e10cSrcweir if (pRowOutline[SC_SPLIT_TOP] && pRowOutline[SC_SPLIT_BOTTOM])
793cdf0e10cSrcweir {
794cdf0e10cSrcweir pRowOutline[SC_SPLIT_TOP]->SetHeaderSize( nBarY );
795cdf0e10cSrcweir lcl_SetPosSize( *pRowOutline[SC_SPLIT_TOP],
796cdf0e10cSrcweir Point(nOutPosX,nPosY-nBarY), Size(nOutlineX,nTopSize+nBarY), nTotalWidth, bLayoutRTL );
797cdf0e10cSrcweir pRowOutline[SC_SPLIT_BOTTOM]->SetHeaderSize( 0 );
798cdf0e10cSrcweir lcl_SetPosSize( *pRowOutline[SC_SPLIT_BOTTOM],
799cdf0e10cSrcweir Point(nOutPosX,nSplitPosY), Size(nOutlineX,nBottomSize), nTotalWidth, bLayoutRTL );
800cdf0e10cSrcweir }
801cdf0e10cSrcweir }
802cdf0e10cSrcweir else if (pRowOutline[SC_SPLIT_BOTTOM])
803cdf0e10cSrcweir {
804cdf0e10cSrcweir pRowOutline[SC_SPLIT_BOTTOM]->SetHeaderSize( nBarY );
805cdf0e10cSrcweir lcl_SetPosSize( *pRowOutline[SC_SPLIT_BOTTOM],
806cdf0e10cSrcweir Point(nOutPosX,nSplitPosY-nBarY), Size(nOutlineX,nBottomSize+nBarY), nTotalWidth, bLayoutRTL );
807cdf0e10cSrcweir }
808cdf0e10cSrcweir }
809cdf0e10cSrcweir if (bHOutline && bVOutline)
810cdf0e10cSrcweir {
811cdf0e10cSrcweir lcl_SetPosSize( aTopButton, Point(nOutPosX,nOutPosY), Size(nOutlineX,nOutlineY), nTotalWidth, bLayoutRTL );
812cdf0e10cSrcweir aTopButton.Show();
813cdf0e10cSrcweir }
814cdf0e10cSrcweir else
815cdf0e10cSrcweir aTopButton.Hide();
816cdf0e10cSrcweir
817cdf0e10cSrcweir if (bHeaders) // Spalten/Zeilen-Header
818cdf0e10cSrcweir {
819cdf0e10cSrcweir lcl_SetPosSize( *pColBar[SC_SPLIT_LEFT],
820cdf0e10cSrcweir Point(nPosX,nPosY-nBarY), Size(nLeftSize,nBarY), nTotalWidth, bLayoutRTL );
821cdf0e10cSrcweir if (pColBar[SC_SPLIT_RIGHT])
822cdf0e10cSrcweir lcl_SetPosSize( *pColBar[SC_SPLIT_RIGHT],
823cdf0e10cSrcweir Point(nSplitPosX,nPosY-nBarY), Size(nRightSize,nBarY), nTotalWidth, bLayoutRTL );
824cdf0e10cSrcweir
825cdf0e10cSrcweir if (pRowBar[SC_SPLIT_TOP])
826cdf0e10cSrcweir lcl_SetPosSize( *pRowBar[SC_SPLIT_TOP],
827cdf0e10cSrcweir Point(nPosX-nBarX,nPosY), Size(nBarX,nTopSize), nTotalWidth, bLayoutRTL );
828cdf0e10cSrcweir lcl_SetPosSize( *pRowBar[SC_SPLIT_BOTTOM],
829cdf0e10cSrcweir Point(nPosX-nBarX,nSplitPosY), Size(nBarX,nBottomSize), nTotalWidth, bLayoutRTL );
830cdf0e10cSrcweir
831cdf0e10cSrcweir lcl_SetPosSize( aCornerButton, Point(nPosX-nBarX,nPosY-nBarY), Size(nBarX,nBarY), nTotalWidth, bLayoutRTL );
832cdf0e10cSrcweir aCornerButton.Show();
833cdf0e10cSrcweir pColBar[SC_SPLIT_LEFT]->Show();
834cdf0e10cSrcweir pRowBar[SC_SPLIT_BOTTOM]->Show();
835cdf0e10cSrcweir }
836cdf0e10cSrcweir else
837cdf0e10cSrcweir {
838cdf0e10cSrcweir aCornerButton.Hide();
839cdf0e10cSrcweir pColBar[SC_SPLIT_LEFT]->Hide(); // immer da
840cdf0e10cSrcweir pRowBar[SC_SPLIT_BOTTOM]->Hide();
841cdf0e10cSrcweir }
842cdf0e10cSrcweir
843cdf0e10cSrcweir
844cdf0e10cSrcweir // Grid-Windows
845cdf0e10cSrcweir
846cdf0e10cSrcweir if (bInner)
847cdf0e10cSrcweir {
848cdf0e10cSrcweir long nInnerPosX = bLayoutRTL ? ( nTotalWidth - nPosX - nLeftSize ) : nPosX;
849cdf0e10cSrcweir pGridWin[SC_SPLIT_BOTTOMLEFT]->SetPosPixel( Point(nInnerPosX,nSplitPosY) );
850cdf0e10cSrcweir }
851cdf0e10cSrcweir else
852cdf0e10cSrcweir {
853cdf0e10cSrcweir lcl_SetPosSize( *pGridWin[SC_SPLIT_BOTTOMLEFT],
854cdf0e10cSrcweir Point(nPosX,nSplitPosY), Size(nLeftSize,nBottomSize), nTotalWidth, bLayoutRTL );
855cdf0e10cSrcweir if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE )
856cdf0e10cSrcweir lcl_SetPosSize( *pGridWin[SC_SPLIT_BOTTOMRIGHT],
857cdf0e10cSrcweir Point(nSplitPosX,nSplitPosY), Size(nRightSize,nBottomSize), nTotalWidth, bLayoutRTL );
858cdf0e10cSrcweir if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
859cdf0e10cSrcweir lcl_SetPosSize( *pGridWin[SC_SPLIT_TOPLEFT],
860cdf0e10cSrcweir Point(nPosX,nPosY), Size(nLeftSize,nTopSize), nTotalWidth, bLayoutRTL );
861cdf0e10cSrcweir if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE && aViewData.GetVSplitMode() != SC_SPLIT_NONE )
862cdf0e10cSrcweir lcl_SetPosSize( *pGridWin[SC_SPLIT_TOPRIGHT],
863cdf0e10cSrcweir Point(nSplitPosX,nPosY), Size(nRightSize,nTopSize), nTotalWidth, bLayoutRTL );
864cdf0e10cSrcweir }
865cdf0e10cSrcweir
866cdf0e10cSrcweir //
867cdf0e10cSrcweir // Scrollbars updaten
868cdf0e10cSrcweir //
869cdf0e10cSrcweir
870cdf0e10cSrcweir if (!bInUpdateHeader)
871cdf0e10cSrcweir {
872cdf0e10cSrcweir UpdateScrollBars(); // Scrollbars nicht beim Scrollen neu setzen
873cdf0e10cSrcweir UpdateHeaderWidth();
874cdf0e10cSrcweir
875cdf0e10cSrcweir InterpretVisible(); // #69343# have everything calculated before painting
876cdf0e10cSrcweir }
877cdf0e10cSrcweir
878cdf0e10cSrcweir if (bHasHint)
879cdf0e10cSrcweir TestHintWindow(); // neu positionieren
880cdf0e10cSrcweir
881cdf0e10cSrcweir UpdateVarZoom(); // update variable zoom types (after resizing GridWindows)
882cdf0e10cSrcweir
883cdf0e10cSrcweir if (aViewData.GetViewShell()->HasAccessibilityObjects())
884cdf0e10cSrcweir aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_WINDOWRESIZED));
885cdf0e10cSrcweir }
886cdf0e10cSrcweir
UpdateVarZoom()887cdf0e10cSrcweir void ScTabView::UpdateVarZoom()
888cdf0e10cSrcweir {
889cdf0e10cSrcweir // update variable zoom types
890cdf0e10cSrcweir
891cdf0e10cSrcweir SvxZoomType eZoomType = GetZoomType();
892cdf0e10cSrcweir if ( eZoomType != SVX_ZOOM_PERCENT && !bInZoomUpdate )
893cdf0e10cSrcweir {
894cdf0e10cSrcweir bInZoomUpdate = sal_True;
895cdf0e10cSrcweir const Fraction& rOldX = GetViewData()->GetZoomX();
896cdf0e10cSrcweir const Fraction& rOldY = GetViewData()->GetZoomY();
897cdf0e10cSrcweir long nOldPercent = ( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator();
898cdf0e10cSrcweir sal_uInt16 nNewZoom = CalcZoom( eZoomType, (sal_uInt16)nOldPercent );
899cdf0e10cSrcweir Fraction aNew( nNewZoom, 100 );
900cdf0e10cSrcweir
901cdf0e10cSrcweir if ( aNew != rOldX || aNew != rOldY )
902cdf0e10cSrcweir {
903cdf0e10cSrcweir SetZoom( aNew, aNew, sal_False ); // always separately per sheet
904cdf0e10cSrcweir PaintGrid();
905cdf0e10cSrcweir PaintTop();
906cdf0e10cSrcweir PaintLeft();
907cdf0e10cSrcweir aViewData.GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
908cdf0e10cSrcweir aViewData.GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
909cdf0e10cSrcweir }
910cdf0e10cSrcweir bInZoomUpdate = sal_False;
911cdf0e10cSrcweir }
912cdf0e10cSrcweir }
913cdf0e10cSrcweir
UpdateFixPos()914cdf0e10cSrcweir void ScTabView::UpdateFixPos()
915cdf0e10cSrcweir {
916cdf0e10cSrcweir sal_Bool bResize = sal_False;
917cdf0e10cSrcweir if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
918cdf0e10cSrcweir if (aViewData.UpdateFixX())
919cdf0e10cSrcweir bResize = sal_True;
920cdf0e10cSrcweir if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
921cdf0e10cSrcweir if (aViewData.UpdateFixY())
922cdf0e10cSrcweir bResize = sal_True;
923cdf0e10cSrcweir if (bResize)
924cdf0e10cSrcweir RepeatResize(sal_False);
925cdf0e10cSrcweir }
926cdf0e10cSrcweir
RepeatResize(sal_Bool bUpdateFix)927cdf0e10cSrcweir void ScTabView::RepeatResize( sal_Bool bUpdateFix )
928cdf0e10cSrcweir {
929cdf0e10cSrcweir if ( bUpdateFix )
930cdf0e10cSrcweir {
931cdf0e10cSrcweir ScSplitMode eHSplit = aViewData.GetHSplitMode();
932cdf0e10cSrcweir ScSplitMode eVSplit = aViewData.GetVSplitMode();
933cdf0e10cSrcweir
934cdf0e10cSrcweir // #i46796# UpdateFixX / UpdateFixY uses GetGridOffset, which requires the
935cdf0e10cSrcweir // outline windows to be available. So UpdateShow has to be called before
936cdf0e10cSrcweir // (also called from DoResize).
937cdf0e10cSrcweir if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX )
938cdf0e10cSrcweir UpdateShow();
939cdf0e10cSrcweir
940cdf0e10cSrcweir if ( eHSplit == SC_SPLIT_FIX )
941cdf0e10cSrcweir aViewData.UpdateFixX();
942cdf0e10cSrcweir if ( eVSplit == SC_SPLIT_FIX )
943cdf0e10cSrcweir aViewData.UpdateFixY();
944cdf0e10cSrcweir }
945cdf0e10cSrcweir
946cdf0e10cSrcweir DoResize( aBorderPos, aFrameSize );
947cdf0e10cSrcweir
948cdf0e10cSrcweir //! Border muss neu gesetzt werden ???
949cdf0e10cSrcweir }
950cdf0e10cSrcweir
GetBorderSize(SvBorder & rBorder,const Size &)951cdf0e10cSrcweir void ScTabView::GetBorderSize( SvBorder& rBorder, const Size& /* rSize */ )
952cdf0e10cSrcweir {
953cdf0e10cSrcweir sal_Bool bScrollBars = aViewData.IsVScrollMode();
954cdf0e10cSrcweir sal_Bool bHeaders = aViewData.IsHeaderMode();
955cdf0e10cSrcweir sal_Bool bOutlMode = aViewData.IsOutlineMode();
956cdf0e10cSrcweir sal_Bool bHOutline = bOutlMode && lcl_HasColOutline(aViewData);
957cdf0e10cSrcweir sal_Bool bVOutline = bOutlMode && lcl_HasRowOutline(aViewData);
958cdf0e10cSrcweir sal_Bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
959cdf0e10cSrcweir
960cdf0e10cSrcweir rBorder = SvBorder();
961cdf0e10cSrcweir
962cdf0e10cSrcweir if (bScrollBars) // Scrollbars horizontal oder vertikal
963cdf0e10cSrcweir {
964cdf0e10cSrcweir rBorder.Right() += aVScrollBottom.GetSizePixel().Width();
965cdf0e10cSrcweir rBorder.Bottom() += aHScrollLeft.GetSizePixel().Height();
966cdf0e10cSrcweir }
967cdf0e10cSrcweir
968cdf0e10cSrcweir // Outline-Controls
969cdf0e10cSrcweir if (bVOutline && pRowOutline[SC_SPLIT_BOTTOM])
970cdf0e10cSrcweir rBorder.Left() += pRowOutline[SC_SPLIT_BOTTOM]->GetDepthSize();
971cdf0e10cSrcweir if (bHOutline && pColOutline[SC_SPLIT_LEFT])
972cdf0e10cSrcweir rBorder.Top() += pColOutline[SC_SPLIT_LEFT]->GetDepthSize();
973cdf0e10cSrcweir
974cdf0e10cSrcweir if (bHeaders) // Spalten/Zeilen-Header
975cdf0e10cSrcweir {
976cdf0e10cSrcweir rBorder.Left() += pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width();
977cdf0e10cSrcweir rBorder.Top() += pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height();
978cdf0e10cSrcweir }
979cdf0e10cSrcweir
980cdf0e10cSrcweir if ( bLayoutRTL )
981cdf0e10cSrcweir ::std::swap( rBorder.Left(), rBorder.Right() );
982cdf0e10cSrcweir }
983cdf0e10cSrcweir
IMPL_LINK(ScTabView,TabBarResize,void *,EMPTYARG)984cdf0e10cSrcweir IMPL_LINK( ScTabView, TabBarResize, void*, EMPTYARG )
985cdf0e10cSrcweir {
986cdf0e10cSrcweir sal_Bool bHScrollMode = aViewData.IsHScrollMode();
987cdf0e10cSrcweir
988cdf0e10cSrcweir // Scrollbar-Einstellungen koennen vom Sfx ueberschrieben werden:
989cdf0e10cSrcweir SfxScrollingMode eMode = aViewData.GetViewShell()->GetScrollingMode();
990cdf0e10cSrcweir if ( eMode == SCROLLING_NO )
991cdf0e10cSrcweir bHScrollMode = sal_False;
992cdf0e10cSrcweir else if ( eMode == SCROLLING_YES || eMode == SCROLLING_AUTO ) //! Auto ???
993cdf0e10cSrcweir bHScrollMode = sal_True;
994cdf0e10cSrcweir
995cdf0e10cSrcweir if( bHScrollMode )
996cdf0e10cSrcweir {
997cdf0e10cSrcweir const long nOverlap = 0; // ScrollBar::GetWindowOverlapPixel();
998cdf0e10cSrcweir long nSize = pTabControl->GetSplitSize();
999cdf0e10cSrcweir
1000cdf0e10cSrcweir if (aViewData.GetHSplitMode() != SC_SPLIT_FIX)
1001cdf0e10cSrcweir {
1002cdf0e10cSrcweir long nMax = pHSplitter->GetPosPixel().X();
1003cdf0e10cSrcweir if( pTabControl->IsEffectiveRTL() )
1004cdf0e10cSrcweir nMax = pFrameWin->GetSizePixel().Width() - nMax;
1005cdf0e10cSrcweir --nMax;
1006cdf0e10cSrcweir if (nSize>nMax) nSize = nMax;
1007cdf0e10cSrcweir }
1008cdf0e10cSrcweir
1009cdf0e10cSrcweir if ( nSize != pTabControl->GetSizePixel().Width() )
1010cdf0e10cSrcweir {
1011cdf0e10cSrcweir pTabControl->SetSizePixel( Size( nSize+nOverlap,
1012cdf0e10cSrcweir pTabControl->GetSizePixel().Height() ) );
1013cdf0e10cSrcweir RepeatResize();
1014cdf0e10cSrcweir }
1015cdf0e10cSrcweir }
1016cdf0e10cSrcweir
1017cdf0e10cSrcweir return 0;
1018cdf0e10cSrcweir }
1019cdf0e10cSrcweir
SetTabBarWidth(long nNewWidth)1020cdf0e10cSrcweir void ScTabView::SetTabBarWidth( long nNewWidth )
1021cdf0e10cSrcweir {
1022cdf0e10cSrcweir Size aSize = pTabControl->GetSizePixel();
1023cdf0e10cSrcweir
1024cdf0e10cSrcweir if ( aSize.Width() != nNewWidth )
1025cdf0e10cSrcweir {
1026cdf0e10cSrcweir aSize.Width() = nNewWidth;
1027cdf0e10cSrcweir pTabControl->SetSizePixel( aSize );
1028cdf0e10cSrcweir }
1029cdf0e10cSrcweir }
1030cdf0e10cSrcweir
SetRelTabBarWidth(double fRelTabBarWidth)1031cdf0e10cSrcweir void ScTabView::SetRelTabBarWidth( double fRelTabBarWidth )
1032cdf0e10cSrcweir {
1033cdf0e10cSrcweir if( (0.0 <= fRelTabBarWidth) && (fRelTabBarWidth <= 1.0) )
1034cdf0e10cSrcweir if( long nFrameWidth = pFrameWin->GetSizePixel().Width() )
1035cdf0e10cSrcweir SetTabBarWidth( static_cast< long >( fRelTabBarWidth * nFrameWidth + 0.5 ) );
1036cdf0e10cSrcweir }
1037cdf0e10cSrcweir
SetPendingRelTabBarWidth(double fRelTabBarWidth)1038cdf0e10cSrcweir void ScTabView::SetPendingRelTabBarWidth( double fRelTabBarWidth )
1039cdf0e10cSrcweir {
1040cdf0e10cSrcweir mfPendingTabBarWidth = fRelTabBarWidth;
1041cdf0e10cSrcweir SetRelTabBarWidth( fRelTabBarWidth );
1042cdf0e10cSrcweir }
1043cdf0e10cSrcweir
GetTabBarWidth() const1044cdf0e10cSrcweir long ScTabView::GetTabBarWidth() const
1045cdf0e10cSrcweir {
1046cdf0e10cSrcweir return pTabControl->GetSizePixel().Width();
1047cdf0e10cSrcweir }
1048cdf0e10cSrcweir
GetRelTabBarWidth() const1049cdf0e10cSrcweir double ScTabView::GetRelTabBarWidth() const
1050cdf0e10cSrcweir {
1051cdf0e10cSrcweir if( long nFrameWidth = pFrameWin->GetSizePixel().Width() )
1052cdf0e10cSrcweir return static_cast< double >( GetTabBarWidth() ) / nFrameWidth;
1053cdf0e10cSrcweir return 0.0;
1054cdf0e10cSrcweir }
1055cdf0e10cSrcweir
GetPendingRelTabBarWidth() const1056cdf0e10cSrcweir double ScTabView::GetPendingRelTabBarWidth() const
1057cdf0e10cSrcweir {
1058cdf0e10cSrcweir return mfPendingTabBarWidth;
1059cdf0e10cSrcweir }
1060cdf0e10cSrcweir
GetActiveWin()1061cdf0e10cSrcweir Window* ScTabView::GetActiveWin()
1062cdf0e10cSrcweir {
1063cdf0e10cSrcweir ScSplitPos ePos = aViewData.GetActivePart();
1064cdf0e10cSrcweir DBG_ASSERT(pGridWin[ePos],"kein aktives Fenster");
1065cdf0e10cSrcweir return pGridWin[ePos];
1066cdf0e10cSrcweir }
1067cdf0e10cSrcweir
GetWindowByPos(ScSplitPos ePos)1068cdf0e10cSrcweir Window* ScTabView::GetWindowByPos( ScSplitPos ePos )
1069cdf0e10cSrcweir {
1070cdf0e10cSrcweir return pGridWin[ePos];
1071cdf0e10cSrcweir }
1072cdf0e10cSrcweir
SetActivePointer(const Pointer & rPointer)1073cdf0e10cSrcweir void ScTabView::SetActivePointer( const Pointer& rPointer )
1074cdf0e10cSrcweir {
1075cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++)
1076cdf0e10cSrcweir if (pGridWin[i])
1077cdf0e10cSrcweir pGridWin[i]->SetPointer( rPointer );
1078cdf0e10cSrcweir
1079cdf0e10cSrcweir /* ScSplitPos ePos = aViewData.GetActivePart();
1080cdf0e10cSrcweir if (pGridWin[ePos])
1081cdf0e10cSrcweir pGridWin[ePos]->SetPointer( rPointer );
1082cdf0e10cSrcweir */
1083cdf0e10cSrcweir }
1084cdf0e10cSrcweir
1085cdf0e10cSrcweir //UNUSED2008-05 void ScTabView::SetActivePointer( const ResId& )
1086cdf0e10cSrcweir //UNUSED2008-05 {
1087cdf0e10cSrcweir //UNUSED2008-05 DBG_ERRORFILE( "keine Pointer mit ResId!" );
1088cdf0e10cSrcweir //UNUSED2008-05 }
1089cdf0e10cSrcweir
ActiveGrabFocus()1090cdf0e10cSrcweir void ScTabView::ActiveGrabFocus()
1091cdf0e10cSrcweir {
1092cdf0e10cSrcweir ScSplitPos ePos = aViewData.GetActivePart();
1093cdf0e10cSrcweir if (pGridWin[ePos])
1094cdf0e10cSrcweir pGridWin[ePos]->GrabFocus();
1095cdf0e10cSrcweir }
1096cdf0e10cSrcweir
1097cdf0e10cSrcweir //UNUSED2008-05 void ScTabView::ActiveCaptureMouse()
1098cdf0e10cSrcweir //UNUSED2008-05 {
1099cdf0e10cSrcweir //UNUSED2008-05 ScSplitPos ePos = aViewData.GetActivePart();
1100cdf0e10cSrcweir //UNUSED2008-05 if (pGridWin[ePos])
1101cdf0e10cSrcweir //UNUSED2008-05 pGridWin[ePos]->CaptureMouse();
1102cdf0e10cSrcweir //UNUSED2008-05 }
1103cdf0e10cSrcweir //UNUSED2008-05
1104cdf0e10cSrcweir //UNUSED2008-05 void ScTabView::ActiveReleaseMouse()
1105cdf0e10cSrcweir //UNUSED2008-05 {
1106cdf0e10cSrcweir //UNUSED2008-05 ScSplitPos ePos = aViewData.GetActivePart();
1107cdf0e10cSrcweir //UNUSED2008-05 if (pGridWin[ePos])
1108cdf0e10cSrcweir //UNUSED2008-05 pGridWin[ePos]->ReleaseMouse();
1109cdf0e10cSrcweir //UNUSED2008-05 }
1110cdf0e10cSrcweir //UNUSED2008-05
1111cdf0e10cSrcweir //UNUSED2008-05 Point ScTabView::ActivePixelToLogic( const Point& rDevicePoint )
1112cdf0e10cSrcweir //UNUSED2008-05 {
1113cdf0e10cSrcweir //UNUSED2008-05 ScSplitPos ePos = aViewData.GetActivePart();
1114cdf0e10cSrcweir //UNUSED2008-05 if (pGridWin[ePos])
1115cdf0e10cSrcweir //UNUSED2008-05 return pGridWin[ePos]->PixelToLogic(rDevicePoint);
1116cdf0e10cSrcweir //UNUSED2008-05 else
1117cdf0e10cSrcweir //UNUSED2008-05 return Point();
1118cdf0e10cSrcweir //UNUSED2008-05 }
1119cdf0e10cSrcweir
FindWindow(Window * pWindow) const1120cdf0e10cSrcweir ScSplitPos ScTabView::FindWindow( Window* pWindow ) const
1121cdf0e10cSrcweir {
1122cdf0e10cSrcweir ScSplitPos eVal = SC_SPLIT_BOTTOMLEFT; // Default
1123cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++)
1124cdf0e10cSrcweir if ( pGridWin[i] == pWindow )
1125cdf0e10cSrcweir eVal = (ScSplitPos) i;
1126cdf0e10cSrcweir
1127cdf0e10cSrcweir return eVal;
1128cdf0e10cSrcweir }
1129cdf0e10cSrcweir
GetGridOffset() const1130cdf0e10cSrcweir Point ScTabView::GetGridOffset() const
1131cdf0e10cSrcweir {
1132cdf0e10cSrcweir Point aPos;
1133cdf0e10cSrcweir
1134cdf0e10cSrcweir // Groessen hier wie in DoResize
1135cdf0e10cSrcweir
1136cdf0e10cSrcweir sal_Bool bHeaders = aViewData.IsHeaderMode();
1137cdf0e10cSrcweir sal_Bool bOutlMode = aViewData.IsOutlineMode();
1138cdf0e10cSrcweir sal_Bool bHOutline = bOutlMode && lcl_HasColOutline(aViewData);
1139cdf0e10cSrcweir sal_Bool bVOutline = bOutlMode && lcl_HasRowOutline(aViewData);
1140cdf0e10cSrcweir
1141cdf0e10cSrcweir // Outline-Controls
1142cdf0e10cSrcweir if (bVOutline && pRowOutline[SC_SPLIT_BOTTOM])
1143cdf0e10cSrcweir aPos.X() += pRowOutline[SC_SPLIT_BOTTOM]->GetDepthSize();
1144cdf0e10cSrcweir if (bHOutline && pColOutline[SC_SPLIT_LEFT])
1145cdf0e10cSrcweir aPos.Y() += pColOutline[SC_SPLIT_LEFT]->GetDepthSize();
1146cdf0e10cSrcweir
1147cdf0e10cSrcweir if (bHeaders) // Spalten/Zeilen-Header
1148cdf0e10cSrcweir {
1149cdf0e10cSrcweir if (pRowBar[SC_SPLIT_BOTTOM])
1150cdf0e10cSrcweir aPos.X() += pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width();
1151cdf0e10cSrcweir if (pColBar[SC_SPLIT_LEFT])
1152cdf0e10cSrcweir aPos.Y() += pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height();
1153cdf0e10cSrcweir }
1154cdf0e10cSrcweir
1155cdf0e10cSrcweir return aPos;
1156cdf0e10cSrcweir }
1157cdf0e10cSrcweir
1158cdf0e10cSrcweir // --- Scroll-Bars --------------------------------------------------------
1159cdf0e10cSrcweir
ScrollCommand(const CommandEvent & rCEvt,ScSplitPos ePos)1160cdf0e10cSrcweir sal_Bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
1161cdf0e10cSrcweir {
1162cdf0e10cSrcweir HideNoteMarker();
1163cdf0e10cSrcweir
1164cdf0e10cSrcweir sal_Bool bDone = sal_False;
1165cdf0e10cSrcweir const CommandWheelData* pData = rCEvt.GetWheelData();
1166cdf0e10cSrcweir if ( pData && pData->GetMode() == COMMAND_WHEEL_ZOOM )
1167cdf0e10cSrcweir {
1168cdf0e10cSrcweir if ( !aViewData.GetViewShell()->GetViewFrame()->GetFrame().IsInPlace() )
1169cdf0e10cSrcweir {
1170cdf0e10cSrcweir // for ole inplace editing, the scale is defined by the visarea and client size
1171cdf0e10cSrcweir // and can't be changed directly
1172cdf0e10cSrcweir
1173cdf0e10cSrcweir const Fraction& rOldY = aViewData.GetZoomY();
1174cdf0e10cSrcweir long nOld = (long)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator());
1175cdf0e10cSrcweir long nNew = nOld;
1176cdf0e10cSrcweir if ( pData->GetDelta() < 0 )
1177cdf0e10cSrcweir nNew = Max( (long) MINZOOM, (long)( nOld - SC_DELTA_ZOOM ) );
1178cdf0e10cSrcweir else
1179cdf0e10cSrcweir nNew = Min( (long) MAXZOOM, (long)( nOld + SC_DELTA_ZOOM ) );
1180cdf0e10cSrcweir
1181cdf0e10cSrcweir if ( nNew != nOld )
1182cdf0e10cSrcweir {
1183cdf0e10cSrcweir // scroll wheel doesn't set the AppOptions default
1184cdf0e10cSrcweir
1185cdf0e10cSrcweir sal_Bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
1186cdf0e10cSrcweir SetZoomType( SVX_ZOOM_PERCENT, bSyncZoom );
1187cdf0e10cSrcweir Fraction aFract( nNew, 100 );
1188cdf0e10cSrcweir SetZoom( aFract, aFract, bSyncZoom );
1189cdf0e10cSrcweir PaintGrid();
1190cdf0e10cSrcweir PaintTop();
1191cdf0e10cSrcweir PaintLeft();
1192cdf0e10cSrcweir aViewData.GetBindings().Invalidate( SID_ATTR_ZOOM );
1193cdf0e10cSrcweir aViewData.GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
1194cdf0e10cSrcweir }
1195cdf0e10cSrcweir
1196cdf0e10cSrcweir bDone = sal_True;
1197cdf0e10cSrcweir }
1198cdf0e10cSrcweir }
1199cdf0e10cSrcweir else
1200cdf0e10cSrcweir {
1201cdf0e10cSrcweir ScHSplitPos eHPos = WhichH(ePos);
1202cdf0e10cSrcweir ScVSplitPos eVPos = WhichV(ePos);
1203cdf0e10cSrcweir ScrollBar* pHScroll = ( eHPos == SC_SPLIT_LEFT ) ? &aHScrollLeft : &aHScrollRight;
1204cdf0e10cSrcweir ScrollBar* pVScroll = ( eVPos == SC_SPLIT_TOP ) ? &aVScrollTop : &aVScrollBottom;
1205cdf0e10cSrcweir if ( pGridWin[ePos] )
1206cdf0e10cSrcweir bDone = pGridWin[ePos]->HandleScrollCommand( rCEvt, pHScroll, pVScroll );
1207cdf0e10cSrcweir }
1208cdf0e10cSrcweir return bDone;
1209cdf0e10cSrcweir }
1210cdf0e10cSrcweir
IMPL_LINK(ScTabView,EndScrollHdl,ScrollBar *,pScroll)1211cdf0e10cSrcweir IMPL_LINK( ScTabView, EndScrollHdl, ScrollBar*, pScroll )
1212cdf0e10cSrcweir {
1213cdf0e10cSrcweir sal_Bool bOnlineScroll = sal_True; //! Optionen
1214cdf0e10cSrcweir
1215cdf0e10cSrcweir if ( bDragging )
1216cdf0e10cSrcweir {
1217cdf0e10cSrcweir if ( bOnlineScroll ) // nur Ranges aktualisieren
1218cdf0e10cSrcweir UpdateScrollBars();
1219cdf0e10cSrcweir else
1220cdf0e10cSrcweir {
1221cdf0e10cSrcweir long nScrollMin = 0; // RangeMin simulieren
1222cdf0e10cSrcweir if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight )
1223cdf0e10cSrcweir nScrollMin = aViewData.GetFixPosX();
1224cdf0e10cSrcweir if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom )
1225cdf0e10cSrcweir nScrollMin = aViewData.GetFixPosY();
1226cdf0e10cSrcweir
1227cdf0e10cSrcweir if ( pScroll == &aHScrollLeft || pScroll == &aHScrollRight )
1228cdf0e10cSrcweir {
1229cdf0e10cSrcweir sal_Bool bMirror = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ) != Application::GetSettings().GetLayoutRTL();
1230cdf0e10cSrcweir ScHSplitPos eWhich = (pScroll == &aHScrollLeft) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
1231cdf0e10cSrcweir long nDelta = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin - aViewData.GetPosX(eWhich);
1232cdf0e10cSrcweir if (nDelta) ScrollX( nDelta, eWhich );
1233cdf0e10cSrcweir }
1234cdf0e10cSrcweir else // VScroll...
1235cdf0e10cSrcweir {
1236cdf0e10cSrcweir ScVSplitPos eWhich = (pScroll == &aVScrollTop) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
1237cdf0e10cSrcweir long nDelta = GetScrollBarPos( *pScroll, sal_False ) + nScrollMin - aViewData.GetPosY(eWhich);
1238cdf0e10cSrcweir if (nDelta) ScrollY( nDelta, eWhich );
1239cdf0e10cSrcweir }
1240cdf0e10cSrcweir }
1241cdf0e10cSrcweir bDragging = sal_False;
1242cdf0e10cSrcweir }
1243cdf0e10cSrcweir return 0;
1244cdf0e10cSrcweir }
1245cdf0e10cSrcweir
IMPL_LINK(ScTabView,ScrollHdl,ScrollBar *,pScroll)1246cdf0e10cSrcweir IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
1247cdf0e10cSrcweir {
1248cdf0e10cSrcweir sal_Bool bOnlineScroll = sal_True; //! Optionen
1249cdf0e10cSrcweir
1250cdf0e10cSrcweir sal_Bool bHoriz = ( pScroll == &aHScrollLeft || pScroll == &aHScrollRight );
1251cdf0e10cSrcweir long nViewPos;
1252cdf0e10cSrcweir if ( bHoriz )
1253cdf0e10cSrcweir nViewPos = aViewData.GetPosX( (pScroll == &aHScrollLeft) ?
1254cdf0e10cSrcweir SC_SPLIT_LEFT : SC_SPLIT_RIGHT );
1255cdf0e10cSrcweir else
1256cdf0e10cSrcweir nViewPos = aViewData.GetPosY( (pScroll == &aVScrollTop) ?
1257cdf0e10cSrcweir SC_SPLIT_TOP : SC_SPLIT_BOTTOM );
1258cdf0e10cSrcweir
1259cdf0e10cSrcweir sal_Bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
1260cdf0e10cSrcweir sal_Bool bMirror = bHoriz && (bLayoutRTL != Application::GetSettings().GetLayoutRTL());
1261cdf0e10cSrcweir
1262cdf0e10cSrcweir ScrollType eType = pScroll->GetType();
1263cdf0e10cSrcweir if ( eType == SCROLL_DRAG )
1264cdf0e10cSrcweir {
1265cdf0e10cSrcweir if (!bDragging)
1266cdf0e10cSrcweir {
1267cdf0e10cSrcweir bDragging = sal_True;
1268cdf0e10cSrcweir nPrevDragPos = nViewPos;
1269cdf0e10cSrcweir }
1270cdf0e10cSrcweir
1271cdf0e10cSrcweir // Scroll-Position anzeigen
1272cdf0e10cSrcweir // (nur QuickHelp, in der Statuszeile gibt es keinen Eintrag dafuer)
1273cdf0e10cSrcweir
1274cdf0e10cSrcweir if (Help::IsQuickHelpEnabled())
1275cdf0e10cSrcweir {
1276cdf0e10cSrcweir Size aSize = pScroll->GetSizePixel();
1277cdf0e10cSrcweir
1278cdf0e10cSrcweir /* Convert scrollbar mouse position to screen position. If RTL
1279cdf0e10cSrcweir mode of scrollbar differs from RTL mode of its parent, then the
1280cdf0e10cSrcweir direct call to Window::OutputToNormalizedScreenPixel() will
1281cdf0e10cSrcweir give unusable results, because calcualtion of screen position
1282cdf0e10cSrcweir is based on parent orientation and expects equal orientation of
1283cdf0e10cSrcweir the child position. Need to mirror mouse position before. */
1284cdf0e10cSrcweir Point aMousePos = pScroll->GetPointerPosPixel();
1285cdf0e10cSrcweir if( pScroll->IsRTLEnabled() != pScroll->GetParent()->IsRTLEnabled() )
1286cdf0e10cSrcweir aMousePos.X() = aSize.Width() - aMousePos.X() - 1;
1287cdf0e10cSrcweir aMousePos = pScroll->OutputToNormalizedScreenPixel( aMousePos );
1288cdf0e10cSrcweir
1289cdf0e10cSrcweir // convert top-left position of scrollbar to screen position
1290cdf0e10cSrcweir Point aPos = pScroll->OutputToNormalizedScreenPixel( Point() );
1291cdf0e10cSrcweir
1292cdf0e10cSrcweir // get scrollbar scroll position for help text (row number/column name)
1293cdf0e10cSrcweir long nScrollMin = 0; // RangeMin simulieren
1294cdf0e10cSrcweir if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight )
1295cdf0e10cSrcweir nScrollMin = aViewData.GetFixPosX();
1296cdf0e10cSrcweir if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom )
1297cdf0e10cSrcweir nScrollMin = aViewData.GetFixPosY();
1298cdf0e10cSrcweir long nScrollPos = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin;
1299cdf0e10cSrcweir
1300cdf0e10cSrcweir String aHelpStr;
1301cdf0e10cSrcweir Rectangle aRect;
1302cdf0e10cSrcweir sal_uInt16 nAlign;
1303cdf0e10cSrcweir if (bHoriz)
1304cdf0e10cSrcweir {
1305cdf0e10cSrcweir aHelpStr = ScGlobal::GetRscString(STR_COLUMN);
1306cdf0e10cSrcweir aHelpStr += ' ';
1307cdf0e10cSrcweir aHelpStr += ScColToAlpha((SCCOL) nScrollPos);
1308cdf0e10cSrcweir
1309cdf0e10cSrcweir aRect.Left() = aMousePos.X();
1310cdf0e10cSrcweir aRect.Top() = aPos.Y() - 4;
1311cdf0e10cSrcweir nAlign = QUICKHELP_BOTTOM|QUICKHELP_CENTER;
1312cdf0e10cSrcweir }
1313cdf0e10cSrcweir else
1314cdf0e10cSrcweir {
1315cdf0e10cSrcweir aHelpStr = ScGlobal::GetRscString(STR_ROW);
1316cdf0e10cSrcweir aHelpStr += ' ';
1317cdf0e10cSrcweir aHelpStr += String::CreateFromInt32(nScrollPos + 1);
1318cdf0e10cSrcweir
1319cdf0e10cSrcweir // show quicktext always inside sheet area
1320cdf0e10cSrcweir aRect.Left() = bLayoutRTL ? (aPos.X() + aSize.Width() + 8) : (aPos.X() - 8);
1321cdf0e10cSrcweir aRect.Top() = aMousePos.Y();
1322cdf0e10cSrcweir nAlign = (bLayoutRTL ? QUICKHELP_LEFT : QUICKHELP_RIGHT) | QUICKHELP_VCENTER;
1323cdf0e10cSrcweir }
1324cdf0e10cSrcweir aRect.Right() = aRect.Left();
1325cdf0e10cSrcweir aRect.Bottom() = aRect.Top();
1326cdf0e10cSrcweir
1327cdf0e10cSrcweir Help::ShowQuickHelp(pScroll->GetParent(), aRect, aHelpStr, nAlign);
1328cdf0e10cSrcweir }
1329cdf0e10cSrcweir }
1330cdf0e10cSrcweir
1331cdf0e10cSrcweir if ( bOnlineScroll || eType != SCROLL_DRAG )
1332cdf0e10cSrcweir {
1333cdf0e10cSrcweir if ( bMirror )
1334cdf0e10cSrcweir {
1335cdf0e10cSrcweir // change scroll type so visible/previous cells calculation below remains the same
1336cdf0e10cSrcweir switch ( eType )
1337cdf0e10cSrcweir {
1338cdf0e10cSrcweir case SCROLL_LINEUP: eType = SCROLL_LINEDOWN; break;
1339cdf0e10cSrcweir case SCROLL_LINEDOWN: eType = SCROLL_LINEUP; break;
1340cdf0e10cSrcweir case SCROLL_PAGEUP: eType = SCROLL_PAGEDOWN; break;
1341cdf0e10cSrcweir case SCROLL_PAGEDOWN: eType = SCROLL_PAGEUP; break;
1342cdf0e10cSrcweir default:
1343cdf0e10cSrcweir {
1344cdf0e10cSrcweir // added to avoid warnings
1345cdf0e10cSrcweir }
1346cdf0e10cSrcweir }
1347cdf0e10cSrcweir }
1348cdf0e10cSrcweir long nDelta = pScroll->GetDelta();
1349cdf0e10cSrcweir switch ( eType )
1350cdf0e10cSrcweir {
1351cdf0e10cSrcweir case SCROLL_LINEUP:
1352cdf0e10cSrcweir nDelta = -1;
1353cdf0e10cSrcweir break;
1354cdf0e10cSrcweir case SCROLL_LINEDOWN:
1355cdf0e10cSrcweir nDelta = 1;
1356cdf0e10cSrcweir break;
1357cdf0e10cSrcweir case SCROLL_PAGEUP:
1358cdf0e10cSrcweir if ( pScroll == &aHScrollLeft ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_LEFT );
1359cdf0e10cSrcweir if ( pScroll == &aHScrollRight ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_RIGHT );
1360cdf0e10cSrcweir if ( pScroll == &aVScrollTop ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_TOP );
1361cdf0e10cSrcweir if ( pScroll == &aVScrollBottom ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_BOTTOM );
1362cdf0e10cSrcweir if (nDelta==0) nDelta=-1;
1363cdf0e10cSrcweir break;
1364cdf0e10cSrcweir case SCROLL_PAGEDOWN:
1365cdf0e10cSrcweir if ( pScroll == &aHScrollLeft ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_LEFT );
1366cdf0e10cSrcweir if ( pScroll == &aHScrollRight ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_RIGHT );
1367cdf0e10cSrcweir if ( pScroll == &aVScrollTop ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_TOP );
1368cdf0e10cSrcweir if ( pScroll == &aVScrollBottom ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM );
1369cdf0e10cSrcweir if (nDelta==0) nDelta=1;
1370cdf0e10cSrcweir break;
1371cdf0e10cSrcweir case SCROLL_DRAG:
1372cdf0e10cSrcweir {
1373cdf0e10cSrcweir // nur in die richtige Richtung scrollen, nicht um ausgeblendete
1374cdf0e10cSrcweir // Bereiche herumzittern
1375cdf0e10cSrcweir
1376cdf0e10cSrcweir long nScrollMin = 0; // RangeMin simulieren
1377cdf0e10cSrcweir if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight )
1378cdf0e10cSrcweir nScrollMin = aViewData.GetFixPosX();
1379cdf0e10cSrcweir if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom )
1380cdf0e10cSrcweir nScrollMin = aViewData.GetFixPosY();
1381cdf0e10cSrcweir
1382cdf0e10cSrcweir long nScrollPos = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin;
1383cdf0e10cSrcweir nDelta = nScrollPos - nViewPos;
1384cdf0e10cSrcweir if ( nScrollPos > nPrevDragPos )
1385cdf0e10cSrcweir {
1386cdf0e10cSrcweir if (nDelta<0) nDelta=0;
1387cdf0e10cSrcweir }
1388cdf0e10cSrcweir else if ( nScrollPos < nPrevDragPos )
1389cdf0e10cSrcweir {
1390cdf0e10cSrcweir if (nDelta>0) nDelta=0;
1391cdf0e10cSrcweir }
1392cdf0e10cSrcweir else
1393cdf0e10cSrcweir nDelta = 0;
1394cdf0e10cSrcweir nPrevDragPos = nScrollPos;
1395cdf0e10cSrcweir }
1396cdf0e10cSrcweir break;
1397cdf0e10cSrcweir default:
1398cdf0e10cSrcweir {
1399cdf0e10cSrcweir // added to avoid warnings
1400cdf0e10cSrcweir }
1401cdf0e10cSrcweir }
1402cdf0e10cSrcweir
1403cdf0e10cSrcweir if (nDelta)
1404cdf0e10cSrcweir {
1405cdf0e10cSrcweir sal_Bool bUpdate = ( eType != SCROLL_DRAG ); // bei Drag die Ranges nicht aendern
1406cdf0e10cSrcweir if ( bHoriz )
1407cdf0e10cSrcweir ScrollX( nDelta, (pScroll == &aHScrollLeft) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT, bUpdate );
1408cdf0e10cSrcweir else
1409cdf0e10cSrcweir ScrollY( nDelta, (pScroll == &aVScrollTop) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM, bUpdate );
1410cdf0e10cSrcweir }
1411cdf0e10cSrcweir }
1412cdf0e10cSrcweir
1413cdf0e10cSrcweir return 0;
1414cdf0e10cSrcweir }
1415cdf0e10cSrcweir
ScrollX(long nDeltaX,ScHSplitPos eWhich,sal_Bool bUpdBars)1416cdf0e10cSrcweir void ScTabView::ScrollX( long nDeltaX, ScHSplitPos eWhich, sal_Bool bUpdBars )
1417cdf0e10cSrcweir {
1418cdf0e10cSrcweir sal_Bool bHasHint = ( pInputHintWindow != NULL );
1419cdf0e10cSrcweir if (bHasHint)
1420cdf0e10cSrcweir RemoveHintWindow();
1421cdf0e10cSrcweir
1422cdf0e10cSrcweir SCCOL nOldX = aViewData.GetPosX(eWhich);
1423cdf0e10cSrcweir SCsCOL nNewX = static_cast<SCsCOL>(nOldX) + static_cast<SCsCOL>(nDeltaX);
1424cdf0e10cSrcweir if ( nNewX < 0 )
1425cdf0e10cSrcweir {
1426cdf0e10cSrcweir nDeltaX -= nNewX;
1427cdf0e10cSrcweir nNewX = 0;
1428cdf0e10cSrcweir }
1429cdf0e10cSrcweir if ( nNewX > MAXCOL )
1430cdf0e10cSrcweir {
1431cdf0e10cSrcweir nDeltaX -= nNewX - MAXCOL;
1432cdf0e10cSrcweir nNewX = MAXCOL;
1433cdf0e10cSrcweir }
1434cdf0e10cSrcweir
1435cdf0e10cSrcweir SCsCOL nDir = ( nDeltaX > 0 ) ? 1 : -1;
1436cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1437cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1438cdf0e10cSrcweir while ( pDoc->ColHidden(nNewX, nTab) &&
1439cdf0e10cSrcweir nNewX+nDir >= 0 && nNewX+nDir <= MAXCOL )
1440cdf0e10cSrcweir nNewX = sal::static_int_cast<SCsCOL>( nNewX + nDir );
1441cdf0e10cSrcweir
1442cdf0e10cSrcweir // Fixierung
1443cdf0e10cSrcweir
1444cdf0e10cSrcweir if (aViewData.GetHSplitMode() == SC_SPLIT_FIX)
1445cdf0e10cSrcweir {
1446cdf0e10cSrcweir if (eWhich == SC_SPLIT_LEFT)
1447cdf0e10cSrcweir nNewX = static_cast<SCsCOL>(nOldX); // links immer stehenlassen
1448cdf0e10cSrcweir else
1449cdf0e10cSrcweir {
1450cdf0e10cSrcweir SCsCOL nFixX = static_cast<SCsCOL>(aViewData.GetFixPosX());
1451cdf0e10cSrcweir if (nNewX < nFixX)
1452cdf0e10cSrcweir nNewX = nFixX;
1453cdf0e10cSrcweir }
1454cdf0e10cSrcweir }
1455cdf0e10cSrcweir if (nNewX == static_cast<SCsCOL>(nOldX))
1456cdf0e10cSrcweir return;
1457cdf0e10cSrcweir
1458cdf0e10cSrcweir HideAllCursors();
1459cdf0e10cSrcweir
1460cdf0e10cSrcweir if ( nNewX >= 0 && nNewX <= MAXCOL && nDeltaX )
1461cdf0e10cSrcweir {
1462cdf0e10cSrcweir SCCOL nTrackX = std::max( nOldX, static_cast<SCCOL>(nNewX) );
1463cdf0e10cSrcweir
1464cdf0e10cSrcweir // Mit VCL wirkt Update() im Moment immer auf alle Fenster, beim Update
1465cdf0e10cSrcweir // nach dem Scrollen des GridWindow's wuerde darum der Col-/RowBar evtl.
1466cdf0e10cSrcweir // mit schon geaenderter Pos. gepainted werden -
1467cdf0e10cSrcweir // darum vorher einmal Update am Col-/RowBar
1468cdf0e10cSrcweir
1469cdf0e10cSrcweir if (pColBar[eWhich])
1470cdf0e10cSrcweir pColBar[eWhich]->Update();
1471cdf0e10cSrcweir
1472cdf0e10cSrcweir long nOldPos = aViewData.GetScrPos( nTrackX, 0, eWhich ).X();
1473cdf0e10cSrcweir aViewData.SetPosX( eWhich, static_cast<SCCOL>(nNewX) );
1474cdf0e10cSrcweir long nDiff = aViewData.GetScrPos( nTrackX, 0, eWhich ).X() - nOldPos;
1475cdf0e10cSrcweir
1476cdf0e10cSrcweir if ( eWhich==SC_SPLIT_LEFT )
1477cdf0e10cSrcweir {
1478cdf0e10cSrcweir pGridWin[SC_SPLIT_BOTTOMLEFT]->ScrollPixel( nDiff, 0 );
1479cdf0e10cSrcweir if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
1480cdf0e10cSrcweir pGridWin[SC_SPLIT_TOPLEFT]->ScrollPixel( nDiff, 0 );
1481cdf0e10cSrcweir }
1482cdf0e10cSrcweir else
1483cdf0e10cSrcweir {
1484cdf0e10cSrcweir pGridWin[SC_SPLIT_BOTTOMRIGHT]->ScrollPixel( nDiff, 0 );
1485cdf0e10cSrcweir if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
1486cdf0e10cSrcweir pGridWin[SC_SPLIT_TOPRIGHT]->ScrollPixel( nDiff, 0 );
1487cdf0e10cSrcweir }
1488cdf0e10cSrcweir if (pColBar[eWhich]) { pColBar[eWhich]->Scroll( nDiff,0 ); pColBar[eWhich]->Update(); }
1489cdf0e10cSrcweir if (pColOutline[eWhich]) pColOutline[eWhich]->ScrollPixel( nDiff );
1490cdf0e10cSrcweir if (bUpdBars)
1491cdf0e10cSrcweir UpdateScrollBars();
1492cdf0e10cSrcweir }
1493cdf0e10cSrcweir
1494cdf0e10cSrcweir if (nDeltaX==1 || nDeltaX==-1)
1495cdf0e10cSrcweir pGridWin[aViewData.GetActivePart()]->Update();
1496cdf0e10cSrcweir
1497cdf0e10cSrcweir ShowAllCursors();
1498cdf0e10cSrcweir
1499cdf0e10cSrcweir SetNewVisArea(); // MapMode muss schon gesetzt sein
1500cdf0e10cSrcweir
1501cdf0e10cSrcweir if (bHasHint)
1502cdf0e10cSrcweir TestHintWindow(); // neu positionieren
1503cdf0e10cSrcweir }
1504cdf0e10cSrcweir
ScrollY(long nDeltaY,ScVSplitPos eWhich,sal_Bool bUpdBars)1505cdf0e10cSrcweir void ScTabView::ScrollY( long nDeltaY, ScVSplitPos eWhich, sal_Bool bUpdBars )
1506cdf0e10cSrcweir {
1507cdf0e10cSrcweir sal_Bool bHasHint = ( pInputHintWindow != NULL );
1508cdf0e10cSrcweir if (bHasHint)
1509cdf0e10cSrcweir RemoveHintWindow();
1510cdf0e10cSrcweir
1511cdf0e10cSrcweir SCROW nOldY = aViewData.GetPosY(eWhich);
1512cdf0e10cSrcweir SCsROW nNewY = static_cast<SCsROW>(nOldY) + static_cast<SCsROW>(nDeltaY);
1513cdf0e10cSrcweir if ( nNewY < 0 )
1514cdf0e10cSrcweir {
1515cdf0e10cSrcweir nDeltaY -= nNewY;
1516cdf0e10cSrcweir nNewY = 0;
1517cdf0e10cSrcweir }
1518cdf0e10cSrcweir if ( nNewY > MAXROW )
1519cdf0e10cSrcweir {
1520cdf0e10cSrcweir nDeltaY -= nNewY - MAXROW;
1521cdf0e10cSrcweir nNewY = MAXROW;
1522cdf0e10cSrcweir }
1523cdf0e10cSrcweir
1524cdf0e10cSrcweir SCsROW nDir = ( nDeltaY > 0 ) ? 1 : -1;
1525cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1526cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1527cdf0e10cSrcweir while ( pDoc->RowHidden(nNewY, nTab) &&
1528cdf0e10cSrcweir nNewY+nDir >= 0 && nNewY+nDir <= MAXROW )
1529cdf0e10cSrcweir nNewY += nDir;
1530cdf0e10cSrcweir
1531cdf0e10cSrcweir // Fixierung
1532cdf0e10cSrcweir
1533cdf0e10cSrcweir if (aViewData.GetVSplitMode() == SC_SPLIT_FIX)
1534cdf0e10cSrcweir {
1535cdf0e10cSrcweir if (eWhich == SC_SPLIT_TOP)
1536cdf0e10cSrcweir nNewY = static_cast<SCsROW>(nOldY); // oben immer stehenlassen
1537cdf0e10cSrcweir else
1538cdf0e10cSrcweir {
1539cdf0e10cSrcweir SCsROW nFixY = static_cast<SCsROW>(aViewData.GetFixPosY());
1540cdf0e10cSrcweir if (nNewY < nFixY)
1541cdf0e10cSrcweir nNewY = nFixY;
1542cdf0e10cSrcweir }
1543cdf0e10cSrcweir }
1544cdf0e10cSrcweir if (nNewY == static_cast<SCsROW>(nOldY))
1545cdf0e10cSrcweir return;
1546cdf0e10cSrcweir
1547cdf0e10cSrcweir HideAllCursors();
1548cdf0e10cSrcweir
1549cdf0e10cSrcweir if ( nNewY >= 0 && nNewY <= MAXROW && nDeltaY )
1550cdf0e10cSrcweir {
1551cdf0e10cSrcweir SCROW nTrackY = std::max( nOldY, static_cast<SCROW>(nNewY) );
1552cdf0e10cSrcweir
1553cdf0e10cSrcweir // Zeilenkoepfe anpassen vor dem eigentlichen Scrolling, damit nicht
1554cdf0e10cSrcweir // doppelt gepainted werden muss
1555cdf0e10cSrcweir // PosY darf dann auch noch nicht umgesetzt sein, neuen Wert uebergeben
1556cdf0e10cSrcweir SCROW nUNew = static_cast<SCROW>(nNewY);
1557cdf0e10cSrcweir UpdateHeaderWidth( &eWhich, &nUNew ); // Zeilenkoepfe anpassen
1558cdf0e10cSrcweir
1559cdf0e10cSrcweir if (pRowBar[eWhich])
1560cdf0e10cSrcweir pRowBar[eWhich]->Update();
1561cdf0e10cSrcweir
1562cdf0e10cSrcweir long nOldPos = aViewData.GetScrPos( 0, nTrackY, eWhich ).Y();
1563cdf0e10cSrcweir aViewData.SetPosY( eWhich, static_cast<SCROW>(nNewY) );
1564cdf0e10cSrcweir long nDiff = aViewData.GetScrPos( 0, nTrackY, eWhich ).Y() - nOldPos;
1565cdf0e10cSrcweir
1566cdf0e10cSrcweir if ( eWhich==SC_SPLIT_TOP )
1567cdf0e10cSrcweir {
1568cdf0e10cSrcweir pGridWin[SC_SPLIT_TOPLEFT]->ScrollPixel( 0, nDiff );
1569cdf0e10cSrcweir if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE )
1570cdf0e10cSrcweir pGridWin[SC_SPLIT_TOPRIGHT]->ScrollPixel( 0, nDiff );
1571cdf0e10cSrcweir }
1572cdf0e10cSrcweir else
1573cdf0e10cSrcweir {
1574cdf0e10cSrcweir pGridWin[SC_SPLIT_BOTTOMLEFT]->ScrollPixel( 0, nDiff );
1575cdf0e10cSrcweir if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE )
1576cdf0e10cSrcweir pGridWin[SC_SPLIT_BOTTOMRIGHT]->ScrollPixel( 0, nDiff );
1577cdf0e10cSrcweir }
1578cdf0e10cSrcweir if (pRowBar[eWhich]) { pRowBar[eWhich]->Scroll( 0,nDiff ); pRowBar[eWhich]->Update(); }
1579cdf0e10cSrcweir if (pRowOutline[eWhich]) pRowOutline[eWhich]->ScrollPixel( nDiff );
1580cdf0e10cSrcweir if (bUpdBars)
1581cdf0e10cSrcweir UpdateScrollBars();
1582cdf0e10cSrcweir }
1583cdf0e10cSrcweir
1584cdf0e10cSrcweir if (nDeltaY==1 || nDeltaY==-1)
1585cdf0e10cSrcweir pGridWin[aViewData.GetActivePart()]->Update();
1586cdf0e10cSrcweir
1587cdf0e10cSrcweir ShowAllCursors();
1588cdf0e10cSrcweir
1589cdf0e10cSrcweir SetNewVisArea(); // MapMode muss schon gesetzt sein
1590cdf0e10cSrcweir
1591cdf0e10cSrcweir if (bHasHint)
1592cdf0e10cSrcweir TestHintWindow(); // neu positionieren
1593cdf0e10cSrcweir }
1594cdf0e10cSrcweir
ScrollLines(long nDeltaX,long nDeltaY)1595cdf0e10cSrcweir void ScTabView::ScrollLines( long nDeltaX, long nDeltaY )
1596cdf0e10cSrcweir {
1597cdf0e10cSrcweir ScSplitPos eWhich = aViewData.GetActivePart();
1598cdf0e10cSrcweir if (nDeltaX)
1599cdf0e10cSrcweir ScrollX(nDeltaX,WhichH(eWhich));
1600cdf0e10cSrcweir if (nDeltaY)
1601cdf0e10cSrcweir ScrollY(nDeltaY,WhichV(eWhich));
1602cdf0e10cSrcweir }
1603cdf0e10cSrcweir
lcl_LastVisible(ScViewData & rViewData)1604cdf0e10cSrcweir SCROW lcl_LastVisible( ScViewData& rViewData )
1605cdf0e10cSrcweir {
1606cdf0e10cSrcweir // wenn am Dokumentende viele Zeilen ausgeblendet sind (welcher Trottel macht sowas?),
1607cdf0e10cSrcweir // soll dadurch nicht auf breite Zeilenkoepfe geschaltet werden
1608cdf0e10cSrcweir //! als Member ans Dokument ???
1609cdf0e10cSrcweir
1610cdf0e10cSrcweir ScDocument* pDoc = rViewData.GetDocument();
1611cdf0e10cSrcweir SCTAB nTab = rViewData.GetTabNo();
1612cdf0e10cSrcweir
1613cdf0e10cSrcweir SCROW nVis = MAXROW;
1614cdf0e10cSrcweir while ( nVis > 0 && pDoc->GetRowHeight( nVis, nTab ) == 0 )
1615cdf0e10cSrcweir --nVis;
1616cdf0e10cSrcweir return nVis;
1617cdf0e10cSrcweir }
1618cdf0e10cSrcweir
UpdateHeaderWidth(const ScVSplitPos * pWhich,const SCROW * pPosY)1619cdf0e10cSrcweir void ScTabView::UpdateHeaderWidth( const ScVSplitPos* pWhich, const SCROW* pPosY )
1620cdf0e10cSrcweir {
1621cdf0e10cSrcweir if ( !pRowBar[SC_SPLIT_BOTTOM] || MAXROW < 10000 )
1622cdf0e10cSrcweir return;
1623cdf0e10cSrcweir
1624cdf0e10cSrcweir SCROW nEndPos = MAXROW;
1625cdf0e10cSrcweir if ( !aViewData.GetViewShell()->GetViewFrame()->GetFrame().IsInPlace() )
1626cdf0e10cSrcweir {
1627cdf0e10cSrcweir // fuer OLE Inplace immer MAXROW
1628cdf0e10cSrcweir
1629cdf0e10cSrcweir if ( pWhich && *pWhich == SC_SPLIT_BOTTOM && pPosY )
1630cdf0e10cSrcweir nEndPos = *pPosY;
1631cdf0e10cSrcweir else
1632cdf0e10cSrcweir nEndPos = aViewData.GetPosY( SC_SPLIT_BOTTOM );
1633cdf0e10cSrcweir nEndPos += aViewData.CellsAtY( nEndPos, 1, SC_SPLIT_BOTTOM, SC_SIZE_NONE ); // VisibleCellsY
1634cdf0e10cSrcweir if (nEndPos > MAXROW)
1635cdf0e10cSrcweir nEndPos = lcl_LastVisible( aViewData );
1636cdf0e10cSrcweir
1637cdf0e10cSrcweir if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
1638cdf0e10cSrcweir {
1639cdf0e10cSrcweir SCROW nTopEnd;
1640cdf0e10cSrcweir if ( pWhich && *pWhich == SC_SPLIT_TOP && pPosY )
1641cdf0e10cSrcweir nTopEnd = *pPosY;
1642cdf0e10cSrcweir else
1643cdf0e10cSrcweir nTopEnd = aViewData.GetPosY( SC_SPLIT_TOP );
1644cdf0e10cSrcweir nTopEnd += aViewData.CellsAtY( nTopEnd, 1, SC_SPLIT_TOP, SC_SIZE_NONE );// VisibleCellsY
1645cdf0e10cSrcweir if (nTopEnd > MAXROW)
1646cdf0e10cSrcweir nTopEnd = lcl_LastVisible( aViewData );
1647cdf0e10cSrcweir
1648cdf0e10cSrcweir if ( nTopEnd > nEndPos )
1649cdf0e10cSrcweir nEndPos = nTopEnd;
1650cdf0e10cSrcweir }
1651cdf0e10cSrcweir }
1652cdf0e10cSrcweir
1653cdf0e10cSrcweir long nSmall = pRowBar[SC_SPLIT_BOTTOM]->GetSmallWidth();
1654cdf0e10cSrcweir long nBig = pRowBar[SC_SPLIT_BOTTOM]->GetBigWidth();
1655cdf0e10cSrcweir long nDiff = nBig - nSmall;
1656cdf0e10cSrcweir
1657cdf0e10cSrcweir if (nEndPos>10000)
1658cdf0e10cSrcweir nEndPos = 10000;
1659cdf0e10cSrcweir else if (nEndPos<1) // avoid extra step at 0 (when only one row is visible)
1660cdf0e10cSrcweir nEndPos = 1;
1661cdf0e10cSrcweir long nWidth = nBig - ( 10000 - nEndPos ) * nDiff / 10000;
1662cdf0e10cSrcweir
1663cdf0e10cSrcweir if ( nWidth != pRowBar[SC_SPLIT_BOTTOM]->GetWidth() && !bInUpdateHeader )
1664cdf0e10cSrcweir {
1665cdf0e10cSrcweir bInUpdateHeader = sal_True;
1666cdf0e10cSrcweir
1667cdf0e10cSrcweir pRowBar[SC_SPLIT_BOTTOM]->SetWidth( nWidth );
1668cdf0e10cSrcweir if (pRowBar[SC_SPLIT_TOP])
1669cdf0e10cSrcweir pRowBar[SC_SPLIT_TOP]->SetWidth( nWidth );
1670cdf0e10cSrcweir
1671cdf0e10cSrcweir RepeatResize();
1672cdf0e10cSrcweir
1673cdf0e10cSrcweir // auf VCL gibt's Update ohne Ende (jedes Update gilt fuer alle Fenster)
1674cdf0e10cSrcweir //aCornerButton.Update(); // der bekommt sonst nie ein Update
1675cdf0e10cSrcweir
1676cdf0e10cSrcweir bInUpdateHeader = sal_False;
1677cdf0e10cSrcweir }
1678cdf0e10cSrcweir }
1679cdf0e10cSrcweir
ShowHide(Window * pWin,sal_Bool bShow)1680cdf0e10cSrcweir inline void ShowHide( Window* pWin, sal_Bool bShow )
1681cdf0e10cSrcweir {
1682cdf0e10cSrcweir DBG_ASSERT(pWin || !bShow, "Fenster ist nicht da");
1683cdf0e10cSrcweir if (pWin)
1684cdf0e10cSrcweir pWin->Show(bShow);
1685cdf0e10cSrcweir }
1686cdf0e10cSrcweir
UpdateShow()1687cdf0e10cSrcweir void ScTabView::UpdateShow()
1688cdf0e10cSrcweir {
1689cdf0e10cSrcweir sal_Bool bHScrollMode = aViewData.IsHScrollMode();
1690cdf0e10cSrcweir sal_Bool bVScrollMode = aViewData.IsVScrollMode();
1691cdf0e10cSrcweir sal_Bool bTabMode = aViewData.IsTabMode();
1692cdf0e10cSrcweir sal_Bool bOutlMode = aViewData.IsOutlineMode();
1693cdf0e10cSrcweir sal_Bool bHOutline = bOutlMode && lcl_HasColOutline(aViewData);
1694cdf0e10cSrcweir sal_Bool bVOutline = bOutlMode && lcl_HasRowOutline(aViewData);
1695cdf0e10cSrcweir sal_Bool bHeader = aViewData.IsHeaderMode();
1696cdf0e10cSrcweir
1697cdf0e10cSrcweir sal_Bool bShowH = ( aViewData.GetHSplitMode() != SC_SPLIT_NONE );
1698cdf0e10cSrcweir sal_Bool bShowV = ( aViewData.GetVSplitMode() != SC_SPLIT_NONE );
1699cdf0e10cSrcweir
1700cdf0e10cSrcweir // Scrollbar-Einstellungen koennen vom Sfx ueberschrieben werden:
1701cdf0e10cSrcweir SfxScrollingMode eMode = aViewData.GetViewShell()->GetScrollingMode();
1702cdf0e10cSrcweir if ( eMode == SCROLLING_NO )
1703cdf0e10cSrcweir bHScrollMode = bVScrollMode = sal_False;
1704cdf0e10cSrcweir else if ( eMode == SCROLLING_YES || eMode == SCROLLING_AUTO ) //! Auto ???
1705cdf0e10cSrcweir bHScrollMode = bVScrollMode = sal_True;
1706cdf0e10cSrcweir
1707cdf0e10cSrcweir if ( aViewData.GetDocShell()->IsPreview() )
1708cdf0e10cSrcweir bHScrollMode = bVScrollMode = bTabMode = bHeader = bOutlMode = bHOutline = bVOutline = sal_False;
1709cdf0e10cSrcweir
1710cdf0e10cSrcweir //
1711cdf0e10cSrcweir // Windows anlegen
1712cdf0e10cSrcweir //
1713cdf0e10cSrcweir
1714cdf0e10cSrcweir if (bShowH && !pGridWin[SC_SPLIT_BOTTOMRIGHT])
1715cdf0e10cSrcweir {
1716cdf0e10cSrcweir pGridWin[SC_SPLIT_BOTTOMRIGHT] = new ScGridWindow( pFrameWin, &aViewData, SC_SPLIT_BOTTOMRIGHT );
1717cdf0e10cSrcweir DoAddWin( pGridWin[SC_SPLIT_BOTTOMRIGHT] );
1718cdf0e10cSrcweir }
1719cdf0e10cSrcweir if (bShowV && !pGridWin[SC_SPLIT_TOPLEFT])
1720cdf0e10cSrcweir {
1721cdf0e10cSrcweir pGridWin[SC_SPLIT_TOPLEFT] = new ScGridWindow( pFrameWin, &aViewData, SC_SPLIT_TOPLEFT );
1722cdf0e10cSrcweir DoAddWin( pGridWin[SC_SPLIT_TOPLEFT] );
1723cdf0e10cSrcweir }
1724cdf0e10cSrcweir if (bShowH && bShowV && !pGridWin[SC_SPLIT_TOPRIGHT])
1725cdf0e10cSrcweir {
1726cdf0e10cSrcweir pGridWin[SC_SPLIT_TOPRIGHT] = new ScGridWindow( pFrameWin, &aViewData, SC_SPLIT_TOPRIGHT );
1727cdf0e10cSrcweir DoAddWin( pGridWin[SC_SPLIT_TOPRIGHT] );
1728cdf0e10cSrcweir }
1729cdf0e10cSrcweir
1730cdf0e10cSrcweir if (bHOutline && !pColOutline[SC_SPLIT_LEFT])
1731cdf0e10cSrcweir pColOutline[SC_SPLIT_LEFT] = new ScOutlineWindow( pFrameWin, SC_OUTLINE_HOR, &aViewData, SC_SPLIT_BOTTOMLEFT );
1732cdf0e10cSrcweir if (bShowH && bHOutline && !pColOutline[SC_SPLIT_RIGHT])
1733cdf0e10cSrcweir pColOutline[SC_SPLIT_RIGHT] = new ScOutlineWindow( pFrameWin, SC_OUTLINE_HOR, &aViewData, SC_SPLIT_BOTTOMRIGHT );
1734cdf0e10cSrcweir
1735cdf0e10cSrcweir if (bVOutline && !pRowOutline[SC_SPLIT_BOTTOM])
1736cdf0e10cSrcweir pRowOutline[SC_SPLIT_BOTTOM] = new ScOutlineWindow( pFrameWin, SC_OUTLINE_VER, &aViewData, SC_SPLIT_BOTTOMLEFT );
1737cdf0e10cSrcweir if (bShowV && bVOutline && !pRowOutline[SC_SPLIT_TOP])
1738cdf0e10cSrcweir pRowOutline[SC_SPLIT_TOP] = new ScOutlineWindow( pFrameWin, SC_OUTLINE_VER, &aViewData, SC_SPLIT_TOPLEFT );
1739cdf0e10cSrcweir
1740cdf0e10cSrcweir if (bShowH && bHeader && !pColBar[SC_SPLIT_RIGHT])
1741cdf0e10cSrcweir pColBar[SC_SPLIT_RIGHT] = new ScColBar( pFrameWin, &aViewData, SC_SPLIT_RIGHT,
1742cdf0e10cSrcweir &aHdrFunc, pHdrSelEng );
1743cdf0e10cSrcweir if (bShowV && bHeader && !pRowBar[SC_SPLIT_TOP])
1744cdf0e10cSrcweir pRowBar[SC_SPLIT_TOP] = new ScRowBar( pFrameWin, &aViewData, SC_SPLIT_TOP,
1745cdf0e10cSrcweir &aHdrFunc, pHdrSelEng );
1746cdf0e10cSrcweir
1747cdf0e10cSrcweir //
1748cdf0e10cSrcweir // Windows anzeigen
1749cdf0e10cSrcweir //
1750cdf0e10cSrcweir
1751cdf0e10cSrcweir ShowHide( &aHScrollLeft, bHScrollMode );
1752cdf0e10cSrcweir ShowHide( &aHScrollRight, bShowH && bHScrollMode );
1753cdf0e10cSrcweir ShowHide( &aVScrollBottom, bVScrollMode );
1754cdf0e10cSrcweir ShowHide( &aVScrollTop, bShowV && bVScrollMode );
1755cdf0e10cSrcweir ShowHide( &aScrollBarBox, bVScrollMode || bHScrollMode );
1756cdf0e10cSrcweir
1757cdf0e10cSrcweir ShowHide( pHSplitter, bHScrollMode || bShowH ); // immer angelegt
1758cdf0e10cSrcweir ShowHide( pVSplitter, bVScrollMode || bShowV );
1759cdf0e10cSrcweir ShowHide( pTabControl, bTabMode );
1760cdf0e10cSrcweir
1761cdf0e10cSrcweir // ab hier dynamisch angelegte
1762cdf0e10cSrcweir
1763cdf0e10cSrcweir ShowHide( pGridWin[SC_SPLIT_BOTTOMRIGHT], bShowH );
1764cdf0e10cSrcweir ShowHide( pGridWin[SC_SPLIT_TOPLEFT], bShowV );
1765cdf0e10cSrcweir ShowHide( pGridWin[SC_SPLIT_TOPRIGHT], bShowH && bShowV );
1766cdf0e10cSrcweir
1767cdf0e10cSrcweir ShowHide( pColOutline[SC_SPLIT_LEFT], bHOutline );
1768cdf0e10cSrcweir ShowHide( pColOutline[SC_SPLIT_RIGHT], bShowH && bHOutline );
1769cdf0e10cSrcweir
1770cdf0e10cSrcweir ShowHide( pRowOutline[SC_SPLIT_BOTTOM], bVOutline );
1771cdf0e10cSrcweir ShowHide( pRowOutline[SC_SPLIT_TOP], bShowV && bVOutline );
1772cdf0e10cSrcweir
1773cdf0e10cSrcweir ShowHide( pColBar[SC_SPLIT_RIGHT], bShowH && bHeader );
1774cdf0e10cSrcweir ShowHide( pRowBar[SC_SPLIT_TOP], bShowV && bHeader );
1775cdf0e10cSrcweir
1776cdf0e10cSrcweir
1777cdf0e10cSrcweir //! neue Gridwindows eintragen
1778cdf0e10cSrcweir }
1779cdf0e10cSrcweir
1780cdf0e10cSrcweir // --- Splitter --------------------------------------------------------
1781cdf0e10cSrcweir
IMPL_LINK(ScTabView,SplitHdl,Splitter *,pSplitter)1782cdf0e10cSrcweir IMPL_LINK( ScTabView, SplitHdl, Splitter*, pSplitter )
1783cdf0e10cSrcweir {
1784cdf0e10cSrcweir if ( pSplitter == pHSplitter )
1785cdf0e10cSrcweir DoHSplit( pHSplitter->GetSplitPosPixel() );
1786cdf0e10cSrcweir else
1787cdf0e10cSrcweir DoVSplit( pVSplitter->GetSplitPosPixel() );
1788cdf0e10cSrcweir
1789cdf0e10cSrcweir if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX || aViewData.GetVSplitMode() == SC_SPLIT_FIX )
1790cdf0e10cSrcweir FreezeSplitters( sal_True );
1791cdf0e10cSrcweir
1792cdf0e10cSrcweir DoResize( aBorderPos, aFrameSize );
1793cdf0e10cSrcweir
1794cdf0e10cSrcweir return 0;
1795cdf0e10cSrcweir }
1796cdf0e10cSrcweir
DoHSplit(long nSplitPos)1797cdf0e10cSrcweir void ScTabView::DoHSplit(long nSplitPos)
1798cdf0e10cSrcweir {
1799cdf0e10cSrcweir // nSplitPos is the real pixel position on the frame window,
1800cdf0e10cSrcweir // mirroring for RTL has to be done here.
1801cdf0e10cSrcweir
1802cdf0e10cSrcweir sal_Bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
1803cdf0e10cSrcweir if ( bLayoutRTL )
1804cdf0e10cSrcweir nSplitPos = pFrameWin->GetOutputSizePixel().Width() - nSplitPos - 1;
1805cdf0e10cSrcweir
1806cdf0e10cSrcweir long nMinPos;
1807cdf0e10cSrcweir long nMaxPos;
1808cdf0e10cSrcweir SCCOL nOldDelta;
1809cdf0e10cSrcweir SCCOL nNewDelta;
1810cdf0e10cSrcweir
1811cdf0e10cSrcweir nMinPos = SPLIT_MARGIN;
1812cdf0e10cSrcweir if ( pRowBar[SC_SPLIT_BOTTOM] && pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width() >= nMinPos )
1813cdf0e10cSrcweir nMinPos = pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width() + 1;
1814cdf0e10cSrcweir nMaxPos = aFrameSize.Width() - SPLIT_MARGIN;
1815cdf0e10cSrcweir
1816cdf0e10cSrcweir ScSplitMode aOldMode = aViewData.GetHSplitMode();
1817cdf0e10cSrcweir ScSplitMode aNewMode = SC_SPLIT_NORMAL;
1818cdf0e10cSrcweir
1819cdf0e10cSrcweir aViewData.SetHSplitPos( nSplitPos );
1820cdf0e10cSrcweir if ( nSplitPos < nMinPos || nSplitPos > nMaxPos )
1821cdf0e10cSrcweir aNewMode = SC_SPLIT_NONE;
1822cdf0e10cSrcweir
1823cdf0e10cSrcweir aViewData.SetHSplitMode( aNewMode );
1824cdf0e10cSrcweir
1825cdf0e10cSrcweir if ( aNewMode != aOldMode )
1826cdf0e10cSrcweir {
1827cdf0e10cSrcweir UpdateShow(); // vor ActivatePart !!
1828cdf0e10cSrcweir
1829cdf0e10cSrcweir if ( aNewMode == SC_SPLIT_NONE )
1830cdf0e10cSrcweir {
1831cdf0e10cSrcweir if (aViewData.GetActivePart() == SC_SPLIT_TOPRIGHT)
1832cdf0e10cSrcweir ActivatePart( SC_SPLIT_TOPLEFT );
1833cdf0e10cSrcweir if (aViewData.GetActivePart() == SC_SPLIT_BOTTOMRIGHT)
1834cdf0e10cSrcweir ActivatePart( SC_SPLIT_BOTTOMLEFT );
1835cdf0e10cSrcweir }
1836cdf0e10cSrcweir else
1837cdf0e10cSrcweir {
1838cdf0e10cSrcweir nOldDelta = aViewData.GetPosX( SC_SPLIT_LEFT );
1839cdf0e10cSrcweir // aViewData.SetPosX( SC_SPLIT_LEFT, nOldDelta );
1840cdf0e10cSrcweir long nLeftWidth = nSplitPos - pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width();
1841cdf0e10cSrcweir if ( nLeftWidth < 0 ) nLeftWidth = 0;
1842cdf0e10cSrcweir nNewDelta = nOldDelta + aViewData.CellsAtX( nOldDelta, 1, SC_SPLIT_LEFT,
1843cdf0e10cSrcweir (sal_uInt16) nLeftWidth );
1844cdf0e10cSrcweir if ( nNewDelta > MAXCOL )
1845cdf0e10cSrcweir nNewDelta = MAXCOL;
1846cdf0e10cSrcweir aViewData.SetPosX( SC_SPLIT_RIGHT, nNewDelta );
1847cdf0e10cSrcweir if ( nNewDelta > aViewData.GetCurX() )
1848cdf0e10cSrcweir ActivatePart( (WhichV(aViewData.GetActivePart()) == SC_SPLIT_BOTTOM) ?
1849cdf0e10cSrcweir SC_SPLIT_BOTTOMLEFT : SC_SPLIT_TOPLEFT );
1850cdf0e10cSrcweir else
1851cdf0e10cSrcweir ActivatePart( (WhichV(aViewData.GetActivePart()) == SC_SPLIT_BOTTOM) ?
1852cdf0e10cSrcweir SC_SPLIT_BOTTOMRIGHT : SC_SPLIT_TOPRIGHT );
1853cdf0e10cSrcweir }
1854cdf0e10cSrcweir
1855cdf0e10cSrcweir // #61410# Form-Layer muss den sichtbaren Ausschnitt aller Fenster kennen
1856cdf0e10cSrcweir // dafuer muss hier schon der MapMode stimmen
1857cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++)
1858cdf0e10cSrcweir if (pGridWin[i])
1859cdf0e10cSrcweir pGridWin[i]->SetMapMode( pGridWin[i]->GetDrawMapMode() );
1860cdf0e10cSrcweir SetNewVisArea();
1861cdf0e10cSrcweir
1862cdf0e10cSrcweir PaintGrid();
1863cdf0e10cSrcweir PaintTop();
1864cdf0e10cSrcweir
1865cdf0e10cSrcweir InvalidateSplit();
1866cdf0e10cSrcweir }
1867cdf0e10cSrcweir }
1868cdf0e10cSrcweir
DoVSplit(long nSplitPos)1869cdf0e10cSrcweir void ScTabView::DoVSplit(long nSplitPos)
1870cdf0e10cSrcweir {
1871cdf0e10cSrcweir long nMinPos;
1872cdf0e10cSrcweir long nMaxPos;
1873cdf0e10cSrcweir SCROW nOldDelta;
1874cdf0e10cSrcweir SCROW nNewDelta;
1875cdf0e10cSrcweir
1876cdf0e10cSrcweir nMinPos = SPLIT_MARGIN;
1877cdf0e10cSrcweir if ( pColBar[SC_SPLIT_LEFT] && pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height() >= nMinPos )
1878cdf0e10cSrcweir nMinPos = pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height() + 1;
1879cdf0e10cSrcweir nMaxPos = aFrameSize.Height() - SPLIT_MARGIN;
1880cdf0e10cSrcweir
1881cdf0e10cSrcweir ScSplitMode aOldMode = aViewData.GetVSplitMode();
1882cdf0e10cSrcweir ScSplitMode aNewMode = SC_SPLIT_NORMAL;
1883cdf0e10cSrcweir
1884cdf0e10cSrcweir aViewData.SetVSplitPos( nSplitPos );
1885cdf0e10cSrcweir if ( nSplitPos < nMinPos || nSplitPos > nMaxPos )
1886cdf0e10cSrcweir aNewMode = SC_SPLIT_NONE;
1887cdf0e10cSrcweir
1888cdf0e10cSrcweir aViewData.SetVSplitMode( aNewMode );
1889cdf0e10cSrcweir
1890cdf0e10cSrcweir if ( aNewMode != aOldMode )
1891cdf0e10cSrcweir {
1892cdf0e10cSrcweir UpdateShow(); // vor ActivatePart !!
1893cdf0e10cSrcweir
1894cdf0e10cSrcweir if ( aNewMode == SC_SPLIT_NONE )
1895cdf0e10cSrcweir {
1896cdf0e10cSrcweir nOldDelta = aViewData.GetPosY( SC_SPLIT_TOP );
1897cdf0e10cSrcweir aViewData.SetPosY( SC_SPLIT_BOTTOM, nOldDelta );
1898cdf0e10cSrcweir
1899cdf0e10cSrcweir if (aViewData.GetActivePart() == SC_SPLIT_TOPLEFT)
1900cdf0e10cSrcweir ActivatePart( SC_SPLIT_BOTTOMLEFT );
1901cdf0e10cSrcweir if (aViewData.GetActivePart() == SC_SPLIT_TOPRIGHT)
1902cdf0e10cSrcweir ActivatePart( SC_SPLIT_BOTTOMRIGHT );
1903cdf0e10cSrcweir }
1904cdf0e10cSrcweir else
1905cdf0e10cSrcweir {
1906cdf0e10cSrcweir if ( aOldMode == SC_SPLIT_NONE )
1907cdf0e10cSrcweir nOldDelta = aViewData.GetPosY( SC_SPLIT_BOTTOM );
1908cdf0e10cSrcweir else
1909cdf0e10cSrcweir nOldDelta = aViewData.GetPosY( SC_SPLIT_TOP );
1910cdf0e10cSrcweir
1911cdf0e10cSrcweir aViewData.SetPosY( SC_SPLIT_TOP, nOldDelta );
1912cdf0e10cSrcweir long nTopHeight = nSplitPos - pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height();
1913cdf0e10cSrcweir if ( nTopHeight < 0 ) nTopHeight = 0;
1914cdf0e10cSrcweir nNewDelta = nOldDelta + aViewData.CellsAtY( nOldDelta, 1, SC_SPLIT_TOP,
1915cdf0e10cSrcweir (sal_uInt16) nTopHeight );
1916cdf0e10cSrcweir if ( nNewDelta > MAXROW )
1917cdf0e10cSrcweir nNewDelta = MAXROW;
1918cdf0e10cSrcweir aViewData.SetPosY( SC_SPLIT_BOTTOM, nNewDelta );
1919cdf0e10cSrcweir if ( nNewDelta > aViewData.GetCurY() )
1920cdf0e10cSrcweir ActivatePart( (WhichH(aViewData.GetActivePart()) == SC_SPLIT_LEFT) ?
1921cdf0e10cSrcweir SC_SPLIT_TOPLEFT : SC_SPLIT_TOPRIGHT );
1922cdf0e10cSrcweir else
1923cdf0e10cSrcweir ActivatePart( (WhichH(aViewData.GetActivePart()) == SC_SPLIT_LEFT) ?
1924cdf0e10cSrcweir SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT );
1925cdf0e10cSrcweir }
1926cdf0e10cSrcweir
1927cdf0e10cSrcweir // #61410# Form-Layer muss den sichtbaren Ausschnitt aller Fenster kennen
1928cdf0e10cSrcweir // dafuer muss hier schon der MapMode stimmen
1929cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++)
1930cdf0e10cSrcweir if (pGridWin[i])
1931cdf0e10cSrcweir pGridWin[i]->SetMapMode( pGridWin[i]->GetDrawMapMode() );
1932cdf0e10cSrcweir SetNewVisArea();
1933cdf0e10cSrcweir
1934cdf0e10cSrcweir PaintGrid();
1935cdf0e10cSrcweir PaintLeft();
1936cdf0e10cSrcweir
1937cdf0e10cSrcweir InvalidateSplit();
1938cdf0e10cSrcweir }
1939cdf0e10cSrcweir }
1940cdf0e10cSrcweir
GetInsertPos()1941cdf0e10cSrcweir Point ScTabView::GetInsertPos()
1942cdf0e10cSrcweir {
1943cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1944cdf0e10cSrcweir SCCOL nCol = aViewData.GetCurX();
1945cdf0e10cSrcweir SCROW nRow = aViewData.GetCurY();
1946cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1947cdf0e10cSrcweir long nPosX = 0;
1948cdf0e10cSrcweir for (SCCOL i=0; i<nCol; i++)
1949cdf0e10cSrcweir nPosX += pDoc->GetColWidth(i,nTab);
1950cdf0e10cSrcweir nPosX = (long)(nPosX * HMM_PER_TWIPS);
1951cdf0e10cSrcweir if ( pDoc->IsNegativePage( nTab ) )
1952cdf0e10cSrcweir nPosX = -nPosX;
1953cdf0e10cSrcweir long nPosY = (long) pDoc->GetRowHeight( 0, nRow-1, nTab);
1954cdf0e10cSrcweir nPosY = (long)(nPosY * HMM_PER_TWIPS);
1955cdf0e10cSrcweir return Point(nPosX,nPosY);
1956cdf0e10cSrcweir }
1957cdf0e10cSrcweir
GetChartInsertPos(const Size & rSize,const ScRange & rCellRange)1958cdf0e10cSrcweir Point ScTabView::GetChartInsertPos( const Size& rSize, const ScRange& rCellRange )
1959cdf0e10cSrcweir {
1960cdf0e10cSrcweir Point aInsertPos;
1961cdf0e10cSrcweir const long nBorder = 100; // leave 1mm for border
1962cdf0e10cSrcweir long nNeededWidth = rSize.Width() + 2 * nBorder;
1963cdf0e10cSrcweir long nNeededHeight = rSize.Height() + 2 * nBorder;
1964cdf0e10cSrcweir
1965cdf0e10cSrcweir // use the active window, or lower/right if frozen (as in CalcZoom)
1966cdf0e10cSrcweir ScSplitPos eUsedPart = aViewData.GetActivePart();
1967cdf0e10cSrcweir if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
1968cdf0e10cSrcweir eUsedPart = (WhichV(eUsedPart)==SC_SPLIT_TOP) ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT;
1969cdf0e10cSrcweir if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
1970cdf0e10cSrcweir eUsedPart = (WhichH(eUsedPart)==SC_SPLIT_LEFT) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
1971cdf0e10cSrcweir
1972cdf0e10cSrcweir ScGridWindow* pWin = pGridWin[eUsedPart];
1973cdf0e10cSrcweir DBG_ASSERT( pWin, "Window not found" );
1974cdf0e10cSrcweir if (pWin)
1975cdf0e10cSrcweir {
1976cdf0e10cSrcweir ActivatePart( eUsedPart );
1977cdf0e10cSrcweir
1978cdf0e10cSrcweir // get the visible rectangle in logic units
1979cdf0e10cSrcweir
1980cdf0e10cSrcweir MapMode aDrawMode = pWin->GetDrawMapMode();
1981cdf0e10cSrcweir Rectangle aVisible( pWin->PixelToLogic( Rectangle( Point(0,0), pWin->GetOutputSizePixel() ), aDrawMode ) );
1982cdf0e10cSrcweir
1983cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
1984cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
1985cdf0e10cSrcweir sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
1986cdf0e10cSrcweir long nLayoutSign = bLayoutRTL ? -1 : 1;
1987cdf0e10cSrcweir
1988cdf0e10cSrcweir long nDocX = (long)( (double) pDoc->GetColOffset( MAXCOL + 1, nTab ) * HMM_PER_TWIPS ) * nLayoutSign;
1989cdf0e10cSrcweir long nDocY = (long)( (double) pDoc->GetRowOffset( MAXROW + 1, nTab ) * HMM_PER_TWIPS );
1990cdf0e10cSrcweir
1991cdf0e10cSrcweir if ( aVisible.Left() * nLayoutSign > nDocX * nLayoutSign )
1992cdf0e10cSrcweir aVisible.Left() = nDocX;
1993cdf0e10cSrcweir if ( aVisible.Right() * nLayoutSign > nDocX * nLayoutSign )
1994cdf0e10cSrcweir aVisible.Right() = nDocX;
1995cdf0e10cSrcweir if ( aVisible.Top() > nDocY )
1996cdf0e10cSrcweir aVisible.Top() = nDocY;
1997cdf0e10cSrcweir if ( aVisible.Bottom() > nDocY )
1998cdf0e10cSrcweir aVisible.Bottom() = nDocY;
1999cdf0e10cSrcweir
2000cdf0e10cSrcweir // get the logic position of the selection
2001cdf0e10cSrcweir
2002cdf0e10cSrcweir Rectangle aSelection = pDoc->GetMMRect( rCellRange.aStart.Col(), rCellRange.aStart.Row(),
2003cdf0e10cSrcweir rCellRange.aEnd.Col(), rCellRange.aEnd.Row(), nTab );
2004cdf0e10cSrcweir
2005cdf0e10cSrcweir long nLeftSpace = aSelection.Left() - aVisible.Left();
2006cdf0e10cSrcweir long nRightSpace = aVisible.Right() - aSelection.Right();
2007cdf0e10cSrcweir long nTopSpace = aSelection.Top() - aVisible.Top();
2008cdf0e10cSrcweir long nBottomSpace = aVisible.Bottom() - aSelection.Bottom();
2009cdf0e10cSrcweir
2010cdf0e10cSrcweir bool bFitLeft = ( nLeftSpace >= nNeededWidth );
2011cdf0e10cSrcweir bool bFitRight = ( nRightSpace >= nNeededWidth );
2012cdf0e10cSrcweir
2013cdf0e10cSrcweir if ( bFitLeft || bFitRight )
2014cdf0e10cSrcweir {
2015cdf0e10cSrcweir // first preference: completely left or right of the selection
2016cdf0e10cSrcweir
2017cdf0e10cSrcweir // if both fit, prefer left in RTL mode, right otherwise
2018cdf0e10cSrcweir bool bPutLeft = bFitLeft && ( bLayoutRTL || !bFitRight );
2019cdf0e10cSrcweir
2020cdf0e10cSrcweir if ( bPutLeft )
2021cdf0e10cSrcweir aInsertPos.X() = aSelection.Left() - nNeededWidth;
2022cdf0e10cSrcweir else
2023cdf0e10cSrcweir aInsertPos.X() = aSelection.Right() + 1;
2024cdf0e10cSrcweir
2025cdf0e10cSrcweir // align with top of selection (is moved again if it doesn't fit)
2026cdf0e10cSrcweir aInsertPos.Y() = std::max( aSelection.Top(), aVisible.Top() );
2027cdf0e10cSrcweir }
2028cdf0e10cSrcweir else if ( nTopSpace >= nNeededHeight || nBottomSpace >= nNeededHeight )
2029cdf0e10cSrcweir {
2030cdf0e10cSrcweir // second preference: completely above or below the selection
2031cdf0e10cSrcweir
2032cdf0e10cSrcweir if ( nBottomSpace > nNeededHeight ) // bottom is preferred
2033cdf0e10cSrcweir aInsertPos.Y() = aSelection.Bottom() + 1;
2034cdf0e10cSrcweir else
2035cdf0e10cSrcweir aInsertPos.Y() = aSelection.Top() - nNeededHeight;
2036cdf0e10cSrcweir
2037cdf0e10cSrcweir // align with (logic) left edge of selection (moved again if it doesn't fit)
2038cdf0e10cSrcweir if ( bLayoutRTL )
2039cdf0e10cSrcweir aInsertPos.X() = std::min( aSelection.Right(), aVisible.Right() ) - nNeededWidth + 1;
2040cdf0e10cSrcweir else
2041cdf0e10cSrcweir aInsertPos.X() = std::max( aSelection.Left(), aVisible.Left() );
2042cdf0e10cSrcweir }
2043cdf0e10cSrcweir else
2044cdf0e10cSrcweir {
2045cdf0e10cSrcweir // place to the (logic) right of the selection and move so it fits
2046cdf0e10cSrcweir
2047cdf0e10cSrcweir if ( bLayoutRTL )
2048cdf0e10cSrcweir aInsertPos.X() = aSelection.Left() - nNeededWidth;
2049cdf0e10cSrcweir else
2050cdf0e10cSrcweir aInsertPos.X() = aSelection.Right() + 1;
2051cdf0e10cSrcweir aInsertPos.Y() = std::max( aSelection.Top(), aVisible.Top() );
2052cdf0e10cSrcweir }
2053cdf0e10cSrcweir
2054cdf0e10cSrcweir // move the position if the object doesn't fit in the screen
2055cdf0e10cSrcweir
2056cdf0e10cSrcweir Rectangle aCompareRect( aInsertPos, Size( nNeededWidth, nNeededHeight ) );
2057cdf0e10cSrcweir if ( aCompareRect.Right() > aVisible.Right() )
2058cdf0e10cSrcweir aInsertPos.X() -= aCompareRect.Right() - aVisible.Right();
2059cdf0e10cSrcweir if ( aCompareRect.Bottom() > aVisible.Bottom() )
2060cdf0e10cSrcweir aInsertPos.Y() -= aCompareRect.Bottom() - aVisible.Bottom();
2061cdf0e10cSrcweir
2062cdf0e10cSrcweir if ( aInsertPos.X() < aVisible.Left() )
2063cdf0e10cSrcweir aInsertPos.X() = aVisible.Left();
2064cdf0e10cSrcweir if ( aInsertPos.Y() < aVisible.Top() )
2065cdf0e10cSrcweir aInsertPos.Y() = aVisible.Top();
2066cdf0e10cSrcweir
2067cdf0e10cSrcweir // nNeededWidth / nNeededHeight includes all borders - move aInsertPos to the
2068cdf0e10cSrcweir // object position, inside the border
2069cdf0e10cSrcweir
2070cdf0e10cSrcweir aInsertPos.X() += nBorder;
2071cdf0e10cSrcweir aInsertPos.Y() += nBorder;
2072cdf0e10cSrcweir }
2073cdf0e10cSrcweir return aInsertPos;
2074cdf0e10cSrcweir }
2075cdf0e10cSrcweir
GetChartDialogPos(const Size & rDialogSize,const Rectangle & rLogicChart)2076cdf0e10cSrcweir Point ScTabView::GetChartDialogPos( const Size& rDialogSize, const Rectangle& rLogicChart )
2077cdf0e10cSrcweir {
2078cdf0e10cSrcweir // rDialogSize must be in pixels, rLogicChart in 1/100 mm. Return value is in pixels.
2079cdf0e10cSrcweir
2080cdf0e10cSrcweir Point aRet;
2081cdf0e10cSrcweir
2082cdf0e10cSrcweir // use the active window, or lower/right if frozen (as in CalcZoom)
2083cdf0e10cSrcweir ScSplitPos eUsedPart = aViewData.GetActivePart();
2084cdf0e10cSrcweir if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
2085cdf0e10cSrcweir eUsedPart = (WhichV(eUsedPart)==SC_SPLIT_TOP) ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT;
2086cdf0e10cSrcweir if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
2087cdf0e10cSrcweir eUsedPart = (WhichH(eUsedPart)==SC_SPLIT_LEFT) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
2088cdf0e10cSrcweir
2089cdf0e10cSrcweir ScGridWindow* pWin = pGridWin[eUsedPart];
2090cdf0e10cSrcweir DBG_ASSERT( pWin, "Window not found" );
2091cdf0e10cSrcweir if (pWin)
2092cdf0e10cSrcweir {
2093cdf0e10cSrcweir MapMode aDrawMode = pWin->GetDrawMapMode();
2094cdf0e10cSrcweir Rectangle aObjPixel = pWin->LogicToPixel( rLogicChart, aDrawMode );
2095cdf0e10cSrcweir Rectangle aObjAbs( pWin->OutputToAbsoluteScreenPixel( aObjPixel.TopLeft() ),
2096cdf0e10cSrcweir pWin->OutputToAbsoluteScreenPixel( aObjPixel.BottomRight() ) );
2097cdf0e10cSrcweir
2098cdf0e10cSrcweir Rectangle aDesktop = pWin->GetDesktopRectPixel();
2099cdf0e10cSrcweir Size aSpace = pWin->LogicToPixel( Size( 8, 12 ), MAP_APPFONT );
2100cdf0e10cSrcweir
2101cdf0e10cSrcweir ScDocument* pDoc = aViewData.GetDocument();
2102cdf0e10cSrcweir SCTAB nTab = aViewData.GetTabNo();
2103cdf0e10cSrcweir sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
2104cdf0e10cSrcweir
2105cdf0e10cSrcweir bool bCenterHor = false;
2106cdf0e10cSrcweir
2107cdf0e10cSrcweir if ( aDesktop.Bottom() - aObjAbs.Bottom() >= rDialogSize.Height() + aSpace.Height() )
2108cdf0e10cSrcweir {
2109cdf0e10cSrcweir // first preference: below the chart
2110cdf0e10cSrcweir
2111cdf0e10cSrcweir aRet.Y() = aObjAbs.Bottom() + aSpace.Height();
2112cdf0e10cSrcweir bCenterHor = true;
2113cdf0e10cSrcweir }
2114cdf0e10cSrcweir else if ( aObjAbs.Top() - aDesktop.Top() >= rDialogSize.Height() + aSpace.Height() )
2115cdf0e10cSrcweir {
2116cdf0e10cSrcweir // second preference: above the chart
2117cdf0e10cSrcweir
2118cdf0e10cSrcweir aRet.Y() = aObjAbs.Top() - rDialogSize.Height() - aSpace.Height();
2119cdf0e10cSrcweir bCenterHor = true;
2120cdf0e10cSrcweir }
2121cdf0e10cSrcweir else
2122cdf0e10cSrcweir {
2123cdf0e10cSrcweir bool bFitLeft = ( aObjAbs.Left() - aDesktop.Left() >= rDialogSize.Width() + aSpace.Width() );
2124cdf0e10cSrcweir bool bFitRight = ( aDesktop.Right() - aObjAbs.Right() >= rDialogSize.Width() + aSpace.Width() );
2125cdf0e10cSrcweir
2126cdf0e10cSrcweir if ( bFitLeft || bFitRight )
2127cdf0e10cSrcweir {
2128cdf0e10cSrcweir // if both fit, prefer right in RTL mode, left otherwise
2129cdf0e10cSrcweir bool bPutRight = bFitRight && ( bLayoutRTL || !bFitLeft );
2130cdf0e10cSrcweir if ( bPutRight )
2131cdf0e10cSrcweir aRet.X() = aObjAbs.Right() + aSpace.Width();
2132cdf0e10cSrcweir else
2133cdf0e10cSrcweir aRet.X() = aObjAbs.Left() - rDialogSize.Width() - aSpace.Width();
2134cdf0e10cSrcweir
2135cdf0e10cSrcweir // center vertically
2136cdf0e10cSrcweir aRet.Y() = aObjAbs.Top() + ( aObjAbs.GetHeight() - rDialogSize.Height() ) / 2;
2137cdf0e10cSrcweir }
2138cdf0e10cSrcweir else
2139cdf0e10cSrcweir {
2140cdf0e10cSrcweir // doesn't fit on any edge - put at the bottom of the screen
2141cdf0e10cSrcweir aRet.Y() = aDesktop.Bottom() - rDialogSize.Height();
2142cdf0e10cSrcweir bCenterHor = true;
2143cdf0e10cSrcweir }
2144cdf0e10cSrcweir }
2145cdf0e10cSrcweir if ( bCenterHor )
2146cdf0e10cSrcweir aRet.X() = aObjAbs.Left() + ( aObjAbs.GetWidth() - rDialogSize.Width() ) / 2;
2147cdf0e10cSrcweir
2148cdf0e10cSrcweir // limit to screen (centering might lead to invalid positions)
2149cdf0e10cSrcweir if ( aRet.X() + rDialogSize.Width() - 1 > aDesktop.Right() )
2150cdf0e10cSrcweir aRet.X() = aDesktop.Right() - rDialogSize.Width() + 1;
2151cdf0e10cSrcweir if ( aRet.X() < aDesktop.Left() )
2152cdf0e10cSrcweir aRet.X() = aDesktop.Left();
2153cdf0e10cSrcweir if ( aRet.Y() + rDialogSize.Height() - 1 > aDesktop.Bottom() )
2154cdf0e10cSrcweir aRet.Y() = aDesktop.Bottom() - rDialogSize.Height() + 1;
2155cdf0e10cSrcweir if ( aRet.Y() < aDesktop.Top() )
2156cdf0e10cSrcweir aRet.Y() = aDesktop.Top();
2157cdf0e10cSrcweir }
2158cdf0e10cSrcweir
2159cdf0e10cSrcweir return aRet;
2160cdf0e10cSrcweir }
2161cdf0e10cSrcweir
LockModifiers(sal_uInt16 nModifiers)2162cdf0e10cSrcweir void ScTabView::LockModifiers( sal_uInt16 nModifiers )
2163cdf0e10cSrcweir {
2164cdf0e10cSrcweir pSelEngine->LockModifiers( nModifiers );
2165cdf0e10cSrcweir pHdrSelEng->LockModifiers( nModifiers );
2166cdf0e10cSrcweir }
2167cdf0e10cSrcweir
GetLockedModifiers() const2168cdf0e10cSrcweir sal_uInt16 ScTabView::GetLockedModifiers() const
2169cdf0e10cSrcweir {
2170cdf0e10cSrcweir return pSelEngine->GetLockedModifiers();
2171cdf0e10cSrcweir }
2172cdf0e10cSrcweir
GetMousePosPixel()2173cdf0e10cSrcweir Point ScTabView::GetMousePosPixel()
2174cdf0e10cSrcweir {
2175cdf0e10cSrcweir Point aPos;
2176cdf0e10cSrcweir ScGridWindow* pWin = (ScGridWindow*)GetActiveWin();
2177cdf0e10cSrcweir
2178cdf0e10cSrcweir if ( pWin )
2179cdf0e10cSrcweir aPos = pWin->GetMousePosPixel();
2180cdf0e10cSrcweir
2181cdf0e10cSrcweir return aPos;
2182cdf0e10cSrcweir }
2183cdf0e10cSrcweir
lcl_MouseIsOverWin(const Point & rScreenPosPixel,Window * pWin)2184cdf0e10cSrcweir sal_Bool lcl_MouseIsOverWin( const Point& rScreenPosPixel, Window* pWin )
2185cdf0e10cSrcweir {
2186cdf0e10cSrcweir if (pWin)
2187cdf0e10cSrcweir {
2188cdf0e10cSrcweir // SPLIT_HANDLE_SIZE draufaddieren, damit das Einrasten genau
2189cdf0e10cSrcweir // auf dem Splitter nicht aussetzt
2190cdf0e10cSrcweir
2191cdf0e10cSrcweir Point aRel = pWin->NormalizedScreenToOutputPixel( rScreenPosPixel );
2192cdf0e10cSrcweir Size aWinSize = pWin->GetOutputSizePixel();
2193cdf0e10cSrcweir if ( aRel.X() >= 0 && aRel.X() < aWinSize.Width() + SPLIT_HANDLE_SIZE &&
2194cdf0e10cSrcweir aRel.Y() >= 0 && aRel.Y() < aWinSize.Height() + SPLIT_HANDLE_SIZE )
2195cdf0e10cSrcweir return sal_True;
2196cdf0e10cSrcweir }
2197cdf0e10cSrcweir return sal_False;
2198cdf0e10cSrcweir }
2199cdf0e10cSrcweir
SnapSplitPos(Point & rScreenPosPixel)2200cdf0e10cSrcweir void ScTabView::SnapSplitPos( Point& rScreenPosPixel )
2201cdf0e10cSrcweir {
2202cdf0e10cSrcweir sal_Bool bOverWin = sal_False;
2203cdf0e10cSrcweir sal_uInt16 i;
2204cdf0e10cSrcweir for (i=0; i<4; i++)
2205cdf0e10cSrcweir if (lcl_MouseIsOverWin(rScreenPosPixel,pGridWin[i]))
2206cdf0e10cSrcweir bOverWin = sal_True;
2207cdf0e10cSrcweir
2208cdf0e10cSrcweir if (!bOverWin)
2209cdf0e10cSrcweir return;
2210cdf0e10cSrcweir
2211cdf0e10cSrcweir // #74761# don't snap to cells if the scale will be modified afterwards
2212cdf0e10cSrcweir if ( GetZoomType() != SVX_ZOOM_PERCENT )
2213cdf0e10cSrcweir return;
2214cdf0e10cSrcweir
2215cdf0e10cSrcweir ScSplitPos ePos = SC_SPLIT_BOTTOMLEFT;
2216cdf0e10cSrcweir if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
2217cdf0e10cSrcweir ePos = SC_SPLIT_TOPLEFT;
2218cdf0e10cSrcweir
2219cdf0e10cSrcweir Window* pWin = pGridWin[ePos];
2220cdf0e10cSrcweir if (!pWin)
2221cdf0e10cSrcweir {
2222cdf0e10cSrcweir DBG_ERROR("Window NULL");
2223cdf0e10cSrcweir return;
2224cdf0e10cSrcweir }
2225cdf0e10cSrcweir
2226cdf0e10cSrcweir Point aMouse = pWin->NormalizedScreenToOutputPixel( rScreenPosPixel );
2227cdf0e10cSrcweir SCsCOL nPosX;
2228cdf0e10cSrcweir SCsROW nPosY;
2229cdf0e10cSrcweir // #52949# bNextIfLarge=FALSE: nicht auf naechste Zelle, wenn ausserhalb des Fensters
2230cdf0e10cSrcweir aViewData.GetPosFromPixel( aMouse.X(), aMouse.Y(), ePos, nPosX, nPosY, sal_True, sal_False, sal_False );
2231cdf0e10cSrcweir sal_Bool bLeft;
2232cdf0e10cSrcweir sal_Bool bTop;
2233cdf0e10cSrcweir aViewData.GetMouseQuadrant( aMouse, ePos, nPosX, nPosY, bLeft, bTop );
2234cdf0e10cSrcweir if (!bLeft)
2235cdf0e10cSrcweir ++nPosX;
2236cdf0e10cSrcweir if (!bTop)
2237cdf0e10cSrcweir ++nPosY;
2238cdf0e10cSrcweir aMouse = aViewData.GetScrPos( static_cast<SCCOL>(nPosX), static_cast<SCROW>(nPosY), ePos, sal_True );
2239cdf0e10cSrcweir rScreenPosPixel = pWin->OutputToNormalizedScreenPixel( aMouse );
2240cdf0e10cSrcweir }
2241cdf0e10cSrcweir
FreezeSplitters(sal_Bool bFreeze)2242cdf0e10cSrcweir void ScTabView::FreezeSplitters( sal_Bool bFreeze )
2243cdf0e10cSrcweir {
2244cdf0e10cSrcweir ScSplitMode eOldH = aViewData.GetHSplitMode();
2245cdf0e10cSrcweir ScSplitMode eOldV = aViewData.GetVSplitMode();
2246cdf0e10cSrcweir
2247cdf0e10cSrcweir ScSplitPos ePos = SC_SPLIT_BOTTOMLEFT;
2248cdf0e10cSrcweir if ( eOldV != SC_SPLIT_NONE )
2249cdf0e10cSrcweir ePos = SC_SPLIT_TOPLEFT;
2250cdf0e10cSrcweir Window* pWin = pGridWin[ePos];
2251cdf0e10cSrcweir
2252cdf0e10cSrcweir sal_Bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
2253cdf0e10cSrcweir
2254cdf0e10cSrcweir if ( bFreeze )
2255cdf0e10cSrcweir {
2256cdf0e10cSrcweir Point aWinStart = pWin->GetPosPixel();
2257cdf0e10cSrcweir
2258cdf0e10cSrcweir Point aSplit;
2259cdf0e10cSrcweir SCsCOL nPosX;
2260cdf0e10cSrcweir SCsROW nPosY;
2261cdf0e10cSrcweir if (eOldH != SC_SPLIT_NONE || eOldV != SC_SPLIT_NONE)
2262cdf0e10cSrcweir {
2263cdf0e10cSrcweir if (eOldH != SC_SPLIT_NONE)
2264cdf0e10cSrcweir {
2265cdf0e10cSrcweir long nSplitPos = aViewData.GetHSplitPos();
2266cdf0e10cSrcweir if ( bLayoutRTL )
2267cdf0e10cSrcweir nSplitPos = pFrameWin->GetOutputSizePixel().Width() - nSplitPos - 1;
2268cdf0e10cSrcweir aSplit.X() = nSplitPos - aWinStart.X();
2269cdf0e10cSrcweir }
2270cdf0e10cSrcweir if (eOldV != SC_SPLIT_NONE)
2271cdf0e10cSrcweir aSplit.Y() = aViewData.GetVSplitPos() - aWinStart.Y();
2272cdf0e10cSrcweir
2273cdf0e10cSrcweir aViewData.GetPosFromPixel( aSplit.X(), aSplit.Y(), ePos, nPosX, nPosY );
2274cdf0e10cSrcweir sal_Bool bLeft;
2275cdf0e10cSrcweir sal_Bool bTop;
2276cdf0e10cSrcweir aViewData.GetMouseQuadrant( aSplit, ePos, nPosX, nPosY, bLeft, bTop );
2277cdf0e10cSrcweir if (!bLeft)
2278cdf0e10cSrcweir ++nPosX;
2279cdf0e10cSrcweir if (!bTop)
2280cdf0e10cSrcweir ++nPosY;
2281cdf0e10cSrcweir }
2282cdf0e10cSrcweir else
2283cdf0e10cSrcweir {
2284cdf0e10cSrcweir nPosX = static_cast<SCsCOL>( aViewData.GetCurX());
2285cdf0e10cSrcweir nPosY = static_cast<SCsROW>( aViewData.GetCurY());
2286cdf0e10cSrcweir }
2287cdf0e10cSrcweir
2288cdf0e10cSrcweir SCCOL nLeftPos = aViewData.GetPosX(SC_SPLIT_LEFT);
2289cdf0e10cSrcweir SCROW nTopPos = aViewData.GetPosY(SC_SPLIT_BOTTOM);
2290cdf0e10cSrcweir SCCOL nRightPos = static_cast<SCCOL>(nPosX);
2291cdf0e10cSrcweir SCROW nBottomPos = static_cast<SCROW>(nPosY);
2292cdf0e10cSrcweir if (eOldH != SC_SPLIT_NONE)
2293cdf0e10cSrcweir if (aViewData.GetPosX(SC_SPLIT_RIGHT) > nRightPos)
2294cdf0e10cSrcweir nRightPos = aViewData.GetPosX(SC_SPLIT_RIGHT);
2295cdf0e10cSrcweir if (eOldV != SC_SPLIT_NONE)
2296cdf0e10cSrcweir {
2297cdf0e10cSrcweir nTopPos = aViewData.GetPosY(SC_SPLIT_TOP);
2298cdf0e10cSrcweir if (aViewData.GetPosY(SC_SPLIT_BOTTOM) > nBottomPos)
2299cdf0e10cSrcweir nBottomPos = aViewData.GetPosY(SC_SPLIT_BOTTOM);
2300cdf0e10cSrcweir }
2301cdf0e10cSrcweir
2302cdf0e10cSrcweir aSplit = aViewData.GetScrPos( static_cast<SCCOL>(nPosX), static_cast<SCROW>(nPosY), ePos, sal_True );
2303cdf0e10cSrcweir if (nPosX > aViewData.GetPosX(SC_SPLIT_LEFT)) // (aSplit.X() > 0) doesn't work for RTL
2304cdf0e10cSrcweir {
2305cdf0e10cSrcweir long nSplitPos = aSplit.X() + aWinStart.X();
2306cdf0e10cSrcweir if ( bLayoutRTL )
2307cdf0e10cSrcweir nSplitPos = pFrameWin->GetOutputSizePixel().Width() - nSplitPos - 1;
2308cdf0e10cSrcweir
2309cdf0e10cSrcweir aViewData.SetHSplitMode( SC_SPLIT_FIX );
2310cdf0e10cSrcweir aViewData.SetHSplitPos( nSplitPos );
2311cdf0e10cSrcweir aViewData.SetFixPosX( nPosX );
2312cdf0e10cSrcweir
2313cdf0e10cSrcweir aViewData.SetPosX(SC_SPLIT_LEFT, nLeftPos);
2314cdf0e10cSrcweir aViewData.SetPosX(SC_SPLIT_RIGHT, nRightPos);
2315cdf0e10cSrcweir }
2316cdf0e10cSrcweir else
2317cdf0e10cSrcweir aViewData.SetHSplitMode( SC_SPLIT_NONE );
2318cdf0e10cSrcweir if (aSplit.Y() > 0)
2319cdf0e10cSrcweir {
2320cdf0e10cSrcweir aViewData.SetVSplitMode( SC_SPLIT_FIX );
2321cdf0e10cSrcweir aViewData.SetVSplitPos( aSplit.Y() + aWinStart.Y() );
2322cdf0e10cSrcweir aViewData.SetFixPosY( nPosY );
2323cdf0e10cSrcweir
2324cdf0e10cSrcweir aViewData.SetPosY(SC_SPLIT_TOP, nTopPos);
2325cdf0e10cSrcweir aViewData.SetPosY(SC_SPLIT_BOTTOM, nBottomPos);
2326cdf0e10cSrcweir }
2327cdf0e10cSrcweir else
2328cdf0e10cSrcweir aViewData.SetVSplitMode( SC_SPLIT_NONE );
2329cdf0e10cSrcweir }
2330cdf0e10cSrcweir else // Fixierung aufheben
2331cdf0e10cSrcweir {
2332cdf0e10cSrcweir if ( eOldH == SC_SPLIT_FIX )
2333cdf0e10cSrcweir aViewData.SetHSplitMode( SC_SPLIT_NORMAL );
2334cdf0e10cSrcweir if ( eOldV == SC_SPLIT_FIX )
2335cdf0e10cSrcweir aViewData.SetVSplitMode( SC_SPLIT_NORMAL );
2336cdf0e10cSrcweir }
2337cdf0e10cSrcweir
2338cdf0e10cSrcweir // #61410# Form-Layer muss den sichtbaren Ausschnitt aller Fenster kennen
2339cdf0e10cSrcweir // dafuer muss hier schon der MapMode stimmen
2340cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++)
2341cdf0e10cSrcweir if (pGridWin[i])
2342cdf0e10cSrcweir pGridWin[i]->SetMapMode( pGridWin[i]->GetDrawMapMode() );
2343cdf0e10cSrcweir SetNewVisArea();
2344cdf0e10cSrcweir
2345cdf0e10cSrcweir RepeatResize(sal_False);
2346cdf0e10cSrcweir
2347cdf0e10cSrcweir UpdateShow();
2348cdf0e10cSrcweir PaintLeft();
2349cdf0e10cSrcweir PaintTop();
2350cdf0e10cSrcweir PaintGrid();
2351cdf0e10cSrcweir
2352cdf0e10cSrcweir // SC_FOLLOW_NONE: only update active part
2353cdf0e10cSrcweir AlignToCursor( aViewData.GetCurX(), aViewData.GetCurY(), SC_FOLLOW_NONE );
2354cdf0e10cSrcweir UpdateAutoFillMark();
2355cdf0e10cSrcweir
2356cdf0e10cSrcweir InvalidateSplit();
2357cdf0e10cSrcweir }
2358cdf0e10cSrcweir
RemoveSplit()2359cdf0e10cSrcweir void ScTabView::RemoveSplit()
2360cdf0e10cSrcweir {
2361cdf0e10cSrcweir DoHSplit( 0 );
2362cdf0e10cSrcweir DoVSplit( 0 );
2363cdf0e10cSrcweir RepeatResize();
2364cdf0e10cSrcweir }
2365cdf0e10cSrcweir
SplitAtCursor()2366cdf0e10cSrcweir void ScTabView::SplitAtCursor()
2367cdf0e10cSrcweir {
2368cdf0e10cSrcweir ScSplitPos ePos = SC_SPLIT_BOTTOMLEFT;
2369cdf0e10cSrcweir if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
2370cdf0e10cSrcweir ePos = SC_SPLIT_TOPLEFT;
2371cdf0e10cSrcweir Window* pWin = pGridWin[ePos];
2372cdf0e10cSrcweir Point aWinStart = pWin->GetPosPixel();
2373cdf0e10cSrcweir
2374cdf0e10cSrcweir SCCOL nPosX = aViewData.GetCurX();
2375cdf0e10cSrcweir SCROW nPosY = aViewData.GetCurY();
2376cdf0e10cSrcweir Point aSplit = aViewData.GetScrPos( nPosX, nPosY, ePos, sal_True );
2377cdf0e10cSrcweir if ( nPosX > 0 )
2378cdf0e10cSrcweir DoHSplit( aSplit.X() + aWinStart.X() );
2379cdf0e10cSrcweir else
2380cdf0e10cSrcweir DoHSplit( 0 );
2381cdf0e10cSrcweir if ( nPosY > 0 )
2382cdf0e10cSrcweir DoVSplit( aSplit.Y() + aWinStart.Y() );
2383cdf0e10cSrcweir else
2384cdf0e10cSrcweir DoVSplit( 0 );
2385cdf0e10cSrcweir RepeatResize();
2386cdf0e10cSrcweir }
2387cdf0e10cSrcweir
SplitAtPixel(const Point & rPixel,sal_Bool bHor,sal_Bool bVer)2388cdf0e10cSrcweir void ScTabView::SplitAtPixel( const Point& rPixel, sal_Bool bHor, sal_Bool bVer ) // fuer API
2389cdf0e10cSrcweir {
2390cdf0e10cSrcweir // Pixel ist auf die ganze View bezogen, nicht auf das erste GridWin
2391cdf0e10cSrcweir
2392cdf0e10cSrcweir if (bHor)
2393cdf0e10cSrcweir {
2394cdf0e10cSrcweir if ( rPixel.X() > 0 )
2395cdf0e10cSrcweir DoHSplit( rPixel.X() );
2396cdf0e10cSrcweir else
2397cdf0e10cSrcweir DoHSplit( 0 );
2398cdf0e10cSrcweir }
2399cdf0e10cSrcweir if (bVer)
2400cdf0e10cSrcweir {
2401cdf0e10cSrcweir if ( rPixel.Y() > 0 )
2402cdf0e10cSrcweir DoVSplit( rPixel.Y() );
2403cdf0e10cSrcweir else
2404cdf0e10cSrcweir DoVSplit( 0 );
2405cdf0e10cSrcweir }
2406cdf0e10cSrcweir RepeatResize();
2407cdf0e10cSrcweir }
2408cdf0e10cSrcweir
InvalidateSplit()2409cdf0e10cSrcweir void ScTabView::InvalidateSplit()
2410cdf0e10cSrcweir {
2411cdf0e10cSrcweir SfxBindings& rBindings = aViewData.GetBindings();
2412cdf0e10cSrcweir rBindings.Invalidate( SID_WINDOW_SPLIT );
2413cdf0e10cSrcweir rBindings.Invalidate( SID_WINDOW_FIX );
2414cdf0e10cSrcweir
2415cdf0e10cSrcweir pHSplitter->SetFixed( aViewData.GetHSplitMode() == SC_SPLIT_FIX );
2416cdf0e10cSrcweir pVSplitter->SetFixed( aViewData.GetVSplitMode() == SC_SPLIT_FIX );
2417cdf0e10cSrcweir }
2418cdf0e10cSrcweir
SetNewVisArea()2419cdf0e10cSrcweir void ScTabView::SetNewVisArea()
2420cdf0e10cSrcweir {
2421cdf0e10cSrcweir // #63854# fuer die Controls muss bei VisAreaChanged der Draw-MapMode eingestellt sein
2422cdf0e10cSrcweir // (auch wenn ansonsten der Edit-MapMode gesetzt ist)
2423cdf0e10cSrcweir MapMode aOldMode[4];
2424cdf0e10cSrcweir MapMode aDrawMode[4];
2425cdf0e10cSrcweir sal_uInt16 i;
2426cdf0e10cSrcweir for (i=0; i<4; i++)
2427cdf0e10cSrcweir if (pGridWin[i])
2428cdf0e10cSrcweir {
2429cdf0e10cSrcweir aOldMode[i] = pGridWin[i]->GetMapMode();
2430cdf0e10cSrcweir aDrawMode[i] = pGridWin[i]->GetDrawMapMode();
2431cdf0e10cSrcweir if (aDrawMode[i] != aOldMode[i])
2432cdf0e10cSrcweir pGridWin[i]->SetMapMode(aDrawMode[i]);
2433cdf0e10cSrcweir }
2434cdf0e10cSrcweir
2435cdf0e10cSrcweir Window* pActive = pGridWin[aViewData.GetActivePart()];
2436cdf0e10cSrcweir if (pActive)
2437cdf0e10cSrcweir aViewData.GetViewShell()->VisAreaChanged(
2438cdf0e10cSrcweir pActive->PixelToLogic(Rectangle(Point(),pActive->GetOutputSizePixel())) );
2439cdf0e10cSrcweir if (pDrawView)
2440cdf0e10cSrcweir pDrawView->VisAreaChanged(); // kein Window uebergeben -> alle Fenster
2441cdf0e10cSrcweir
2442cdf0e10cSrcweir UpdateAllOverlays(); // #i79909# with drawing MapMode set
2443cdf0e10cSrcweir
2444cdf0e10cSrcweir for (i=0; i<4; i++)
2445cdf0e10cSrcweir if (pGridWin[i] && aDrawMode[i] != aOldMode[i])
2446cdf0e10cSrcweir {
2447cdf0e10cSrcweir pGridWin[i]->flushOverlayManager(); // #i79909# flush overlays before switching to edit MapMode
2448cdf0e10cSrcweir pGridWin[i]->SetMapMode(aOldMode[i]);
2449cdf0e10cSrcweir }
2450cdf0e10cSrcweir
2451cdf0e10cSrcweir SfxViewFrame* pViewFrame = aViewData.GetViewShell()->GetViewFrame();
2452cdf0e10cSrcweir if (pViewFrame)
2453cdf0e10cSrcweir {
2454cdf0e10cSrcweir SfxFrame& rFrame = pViewFrame->GetFrame();
2455cdf0e10cSrcweir com::sun::star::uno::Reference<com::sun::star::frame::XController> xController = rFrame.GetController();
2456cdf0e10cSrcweir if (xController.is())
2457cdf0e10cSrcweir {
2458cdf0e10cSrcweir ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController );
2459cdf0e10cSrcweir if (pImp)
2460cdf0e10cSrcweir pImp->VisAreaChanged();
2461cdf0e10cSrcweir }
2462cdf0e10cSrcweir }
2463cdf0e10cSrcweir if (aViewData.GetViewShell()->HasAccessibilityObjects())
2464cdf0e10cSrcweir aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_VISAREACHANGED));
2465cdf0e10cSrcweir }
2466cdf0e10cSrcweir
HasPageFieldDataAtCursor() const2467cdf0e10cSrcweir sal_Bool ScTabView::HasPageFieldDataAtCursor() const
2468cdf0e10cSrcweir {
2469cdf0e10cSrcweir ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()];
2470cdf0e10cSrcweir SCCOL nCol = aViewData.GetCurX();
2471cdf0e10cSrcweir SCROW nRow = aViewData.GetCurY();
2472cdf0e10cSrcweir if (pWin)
2473cdf0e10cSrcweir return pWin->GetDPFieldOrientation( nCol, nRow ) == sheet::DataPilotFieldOrientation_PAGE;
2474cdf0e10cSrcweir
2475cdf0e10cSrcweir return sal_False;
2476cdf0e10cSrcweir }
2477cdf0e10cSrcweir
StartDataSelect()2478cdf0e10cSrcweir void ScTabView::StartDataSelect()
2479cdf0e10cSrcweir {
2480cdf0e10cSrcweir ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()];
2481cdf0e10cSrcweir SCCOL nCol = aViewData.GetCurX();
2482cdf0e10cSrcweir SCROW nRow = aViewData.GetCurY();
2483cdf0e10cSrcweir
2484cdf0e10cSrcweir if (!pWin)
2485cdf0e10cSrcweir return;
2486cdf0e10cSrcweir
2487cdf0e10cSrcweir switch (pWin->GetDPFieldOrientation(nCol, nRow))
2488cdf0e10cSrcweir {
2489cdf0e10cSrcweir case sheet::DataPilotFieldOrientation_PAGE:
2490cdf0e10cSrcweir // #i36598# If the cursor is on a page field's data cell,
2491cdf0e10cSrcweir // no meaningful input is possible anyway, so this function
2492cdf0e10cSrcweir // can be used to select a page field entry.
2493cdf0e10cSrcweir pWin->LaunchPageFieldMenu( nCol, nRow );
2494cdf0e10cSrcweir break;
2495cdf0e10cSrcweir case sheet::DataPilotFieldOrientation_COLUMN:
2496cdf0e10cSrcweir case sheet::DataPilotFieldOrientation_ROW:
2497cdf0e10cSrcweir pWin->LaunchDPFieldMenu( nCol, nRow );
2498cdf0e10cSrcweir break;
2499cdf0e10cSrcweir default:
2500cdf0e10cSrcweir pWin->DoAutoFilterMenue( nCol, nRow, sal_True );
2501cdf0e10cSrcweir }
2502cdf0e10cSrcweir }
2503cdf0e10cSrcweir
EnableRefInput(sal_Bool bFlag)2504cdf0e10cSrcweir void ScTabView::EnableRefInput(sal_Bool bFlag)
2505cdf0e10cSrcweir {
2506cdf0e10cSrcweir aHScrollLeft.EnableInput(bFlag);
2507cdf0e10cSrcweir aHScrollRight.EnableInput(bFlag);
2508cdf0e10cSrcweir aVScrollBottom.EnableInput(bFlag);
2509cdf0e10cSrcweir aVScrollTop.EnableInput(bFlag);
2510cdf0e10cSrcweir aScrollBarBox.EnableInput(bFlag);
2511cdf0e10cSrcweir
2512cdf0e10cSrcweir // ab hier dynamisch angelegte
2513cdf0e10cSrcweir
2514cdf0e10cSrcweir if(pTabControl!=NULL) pTabControl->EnableInput(bFlag,sal_True);
2515cdf0e10cSrcweir
2516cdf0e10cSrcweir if(pGridWin[SC_SPLIT_BOTTOMLEFT]!=NULL)
2517cdf0e10cSrcweir pGridWin[SC_SPLIT_BOTTOMLEFT]->EnableInput(bFlag,sal_False);
2518cdf0e10cSrcweir if(pGridWin[SC_SPLIT_BOTTOMRIGHT]!=NULL)
2519cdf0e10cSrcweir pGridWin[SC_SPLIT_BOTTOMRIGHT]->EnableInput(bFlag,sal_False);
2520cdf0e10cSrcweir if(pGridWin[SC_SPLIT_TOPLEFT]!=NULL)
2521cdf0e10cSrcweir pGridWin[SC_SPLIT_TOPLEFT]->EnableInput(bFlag,sal_False);
2522cdf0e10cSrcweir if(pGridWin[SC_SPLIT_TOPRIGHT]!=NULL)
2523cdf0e10cSrcweir pGridWin[SC_SPLIT_TOPRIGHT]->EnableInput(bFlag,sal_False);
2524cdf0e10cSrcweir if(pColBar[SC_SPLIT_RIGHT]!=NULL)
2525cdf0e10cSrcweir pColBar[SC_SPLIT_RIGHT]->EnableInput(bFlag,sal_False);
2526cdf0e10cSrcweir if(pRowBar[SC_SPLIT_TOP]!=NULL)
2527cdf0e10cSrcweir pRowBar[SC_SPLIT_TOP]->EnableInput(bFlag,sal_False);
2528cdf0e10cSrcweir }
2529cdf0e10cSrcweir
2530cdf0e10cSrcweir
2531cdf0e10cSrcweir
2532