xref: /aoo41x/main/sc/source/ui/view/gridwin3.cxx (revision 4d7c9de0)
1b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3b3f79822SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4b3f79822SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5b3f79822SAndrew Rist  * distributed with this work for additional information
6b3f79822SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7b3f79822SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8b3f79822SAndrew Rist  * "License"); you may not use this file except in compliance
9b3f79822SAndrew Rist  * with the License.  You may obtain a copy of the License at
10b3f79822SAndrew Rist  *
11b3f79822SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12b3f79822SAndrew Rist  *
13b3f79822SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14b3f79822SAndrew Rist  * software distributed under the License is distributed on an
15b3f79822SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b3f79822SAndrew Rist  * KIND, either express or implied.  See the License for the
17b3f79822SAndrew Rist  * specific language governing permissions and limitations
18b3f79822SAndrew Rist  * under the License.
19b3f79822SAndrew Rist  *
20b3f79822SAndrew Rist  *************************************************************/
21b3f79822SAndrew Rist 
22b3f79822SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "scitems.hxx"
28cdf0e10cSrcweir #include <editeng/eeitem.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <svx/svdoutl.hxx>
31cdf0e10cSrcweir #include <svx/svdotext.hxx>
32cdf0e10cSrcweir #include <svx/svdpagv.hxx>
33cdf0e10cSrcweir #include <editeng/sizeitem.hxx>
34cdf0e10cSrcweir #include <sfx2/bindings.hxx>
35cdf0e10cSrcweir #include <svl/ptitem.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include "tabvwsh.hxx"
38cdf0e10cSrcweir #include "gridwin.hxx"
39cdf0e10cSrcweir #include "dbfunc.hxx"
40cdf0e10cSrcweir #include "viewdata.hxx"
41cdf0e10cSrcweir #include "output.hxx"
42cdf0e10cSrcweir #include "drawview.hxx"
43cdf0e10cSrcweir #include "fupoor.hxx"
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #include "drawutil.hxx"
46cdf0e10cSrcweir #include "document.hxx"
47cdf0e10cSrcweir #include "drwlayer.hxx"
48cdf0e10cSrcweir #include <vcl/svapp.hxx>
49cdf0e10cSrcweir 
50cdf0e10cSrcweir // -----------------------------------------------------------------------
51cdf0e10cSrcweir 
DrawMouseButtonDown(const MouseEvent & rMEvt)52cdf0e10cSrcweir sal_Bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt)
53cdf0e10cSrcweir {
54cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
55cdf0e10cSrcweir 	FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr();
56cdf0e10cSrcweir 	if (pDraw && !pViewData->IsRefMode())
57cdf0e10cSrcweir 	{
58cdf0e10cSrcweir 		pDraw->SetWindow( this );
59cdf0e10cSrcweir 		Point aLogicPos = PixelToLogic(rMEvt.GetPosPixel());
60cdf0e10cSrcweir 		if ( pDraw->IsDetectiveHit( aLogicPos ) )
61cdf0e10cSrcweir 		{
62cdf0e10cSrcweir 			//	auf Detektiv-Pfeilen gar nichts (Doppelklick wird bei ButtonUp ausgewertet)
63cdf0e10cSrcweir 			bRet = sal_True;
64cdf0e10cSrcweir 		}
65cdf0e10cSrcweir 		else
66cdf0e10cSrcweir 		{
67cdf0e10cSrcweir 			bRet = pDraw->MouseButtonDown( rMEvt );
68cdf0e10cSrcweir 			if ( bRet )
69cdf0e10cSrcweir 				UpdateStatusPosSize();
70cdf0e10cSrcweir 		}
71cdf0e10cSrcweir 	}
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	//	bei rechter Taste Draw-Aktion abbrechen
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	ScDrawView* pDrView = pViewData->GetScDrawView();
76cdf0e10cSrcweir 	if ( pDrView && !rMEvt.IsLeft() && !bRet )
77cdf0e10cSrcweir 	{
78cdf0e10cSrcweir 		pDrView->BrkAction();
79cdf0e10cSrcweir 		bRet = sal_True;
80cdf0e10cSrcweir 	}
81cdf0e10cSrcweir 	return bRet;
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
DrawMouseButtonUp(const MouseEvent & rMEvt)84cdf0e10cSrcweir sal_Bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt)
85cdf0e10cSrcweir {
86cdf0e10cSrcweir     ScViewFunc* pView = pViewData->GetView();
87cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
88cdf0e10cSrcweir 	FuPoor* pDraw = pView->GetDrawFuncPtr();
89cdf0e10cSrcweir 	if (pDraw && !pViewData->IsRefMode())
90cdf0e10cSrcweir 	{
91cdf0e10cSrcweir 		pDraw->SetWindow( this );
92cdf0e10cSrcweir 		bRet = pDraw->MouseButtonUp( rMEvt );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir         // execute "format paint brush" for drawing objects
95cdf0e10cSrcweir         SfxItemSet* pDrawBrush = pView->GetDrawBrushSet();
96cdf0e10cSrcweir         if ( pDrawBrush )
97cdf0e10cSrcweir         {
98cdf0e10cSrcweir             ScDrawView* pDrView = pViewData->GetScDrawView();
99cdf0e10cSrcweir             if ( pDrView )
100cdf0e10cSrcweir             {
101cdf0e10cSrcweir                 sal_Bool bReplaceAll = sal_True;
102cdf0e10cSrcweir 	            pDrView->SetAttrToMarked(*pDrawBrush, bReplaceAll);
103cdf0e10cSrcweir             }
104cdf0e10cSrcweir 
105cdf0e10cSrcweir             if ( !pView->IsPaintBrushLocked() )
106cdf0e10cSrcweir                 pView->ResetBrushDocument();        // end paint brush mode if not locked
107cdf0e10cSrcweir         }
108cdf0e10cSrcweir 	}
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	return bRet;
111cdf0e10cSrcweir }
112cdf0e10cSrcweir 
DrawMouseMove(const MouseEvent & rMEvt)113cdf0e10cSrcweir sal_Bool ScGridWindow::DrawMouseMove(const MouseEvent& rMEvt)
114cdf0e10cSrcweir {
115cdf0e10cSrcweir 	FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr();
116cdf0e10cSrcweir 	if (pDraw && !pViewData->IsRefMode())
117cdf0e10cSrcweir 	{
118cdf0e10cSrcweir 		pDraw->SetWindow( this );
119cdf0e10cSrcweir 		sal_Bool bRet = pDraw->MouseMove( rMEvt );
120cdf0e10cSrcweir 		if ( bRet )
121cdf0e10cSrcweir 			UpdateStatusPosSize();
122cdf0e10cSrcweir 		return bRet;
123cdf0e10cSrcweir 	}
124cdf0e10cSrcweir 	else
125cdf0e10cSrcweir 	{
126cdf0e10cSrcweir 		SetPointer( Pointer( POINTER_ARROW ) );
127cdf0e10cSrcweir 		return sal_False;
128cdf0e10cSrcweir 	}
129cdf0e10cSrcweir }
130cdf0e10cSrcweir 
DrawEndAction()131cdf0e10cSrcweir void ScGridWindow::DrawEndAction()
132cdf0e10cSrcweir {
133cdf0e10cSrcweir 	ScDrawView* pDrView = pViewData->GetScDrawView();
134cdf0e10cSrcweir 	if ( pDrView && pDrView->IsAction() )
135cdf0e10cSrcweir 		pDrView->BrkAction();
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr();
138cdf0e10cSrcweir 	if (pDraw)
139cdf0e10cSrcweir 		pDraw->StopDragTimer();
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 	//	ReleaseMouse beim Aufruf
142cdf0e10cSrcweir }
143cdf0e10cSrcweir 
DrawCommand(const CommandEvent & rCEvt)144cdf0e10cSrcweir sal_Bool ScGridWindow::DrawCommand(const CommandEvent& rCEvt)
145cdf0e10cSrcweir {
146cdf0e10cSrcweir 	ScDrawView* pDrView = pViewData->GetScDrawView();
147cdf0e10cSrcweir 	FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr();
148cdf0e10cSrcweir 	if (pDrView && pDraw && !pViewData->IsRefMode())
149cdf0e10cSrcweir 	{
150cdf0e10cSrcweir 		pDraw->SetWindow( this );
151cdf0e10cSrcweir 		sal_uInt8 nUsed = pDraw->Command( rCEvt );
152cdf0e10cSrcweir 		if( nUsed == SC_CMD_USED )
153cdf0e10cSrcweir 			nButtonDown = 0;					// MouseButtonUp wird verschluckt...
154cdf0e10cSrcweir 		if( nUsed || pDrView->IsAction() )
155cdf0e10cSrcweir 			return sal_True;
156cdf0e10cSrcweir 	}
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 	return sal_False;
159cdf0e10cSrcweir }
160cdf0e10cSrcweir 
DrawKeyInput(const KeyEvent & rKEvt)161cdf0e10cSrcweir sal_Bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt)
162cdf0e10cSrcweir {
163cdf0e10cSrcweir 	ScDrawView* pDrView = pViewData->GetScDrawView();
164cdf0e10cSrcweir 	FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr();
165cdf0e10cSrcweir 	if (pDrView && pDraw && !pViewData->IsRefMode())
166cdf0e10cSrcweir 	{
167cdf0e10cSrcweir 		pDraw->SetWindow( this );
168cdf0e10cSrcweir 		sal_Bool bOldMarked = pDrView->AreObjectsMarked();
169cdf0e10cSrcweir 		if (pDraw->KeyInput( rKEvt ))
170cdf0e10cSrcweir 		{
171cdf0e10cSrcweir 			sal_Bool bLeaveDraw = sal_False;
172cdf0e10cSrcweir 			sal_Bool bUsed = sal_True;
173cdf0e10cSrcweir 			sal_Bool bNewMarked = pDrView->AreObjectsMarked();
174cdf0e10cSrcweir 			if ( !pViewData->GetView()->IsDrawSelMode() )
175cdf0e10cSrcweir 				if ( !bNewMarked )
176cdf0e10cSrcweir 				{
177cdf0e10cSrcweir 					pViewData->GetViewShell()->SetDrawShell( sal_False );
178cdf0e10cSrcweir 					bLeaveDraw = sal_True;
179cdf0e10cSrcweir 					if ( !bOldMarked &&
180cdf0e10cSrcweir 						rKEvt.GetKeyCode().GetCode() == KEY_DELETE )
181cdf0e10cSrcweir 						bUsed = sal_False;					// nichts geloescht
182*0deba7fbSSteve Yin 					if(bOldMarked)
183*0deba7fbSSteve Yin 						GetFocus();
184cdf0e10cSrcweir 				}
185cdf0e10cSrcweir 			if (!bLeaveDraw)
186cdf0e10cSrcweir 				UpdateStatusPosSize();		// #108137# for moving/resizing etc. by keyboard
187cdf0e10cSrcweir 			return bUsed;
188cdf0e10cSrcweir 		}
189cdf0e10cSrcweir 	}
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 	return sal_False;
192cdf0e10cSrcweir }
193cdf0e10cSrcweir 
DrawRedraw(ScOutputData & rOutputData,ScUpdateMode eMode,sal_uLong nLayer)194cdf0e10cSrcweir void ScGridWindow::DrawRedraw( ScOutputData& rOutputData, ScUpdateMode eMode, sal_uLong nLayer )
195cdf0e10cSrcweir {
196cdf0e10cSrcweir 	// #109985#
197cdf0e10cSrcweir 	const ScViewOptions& rOpts = pViewData->GetOptions();
198cdf0e10cSrcweir 
199cdf0e10cSrcweir     // use new flags at SdrPaintView for hiding objects
200cdf0e10cSrcweir     const bool bDrawOle(VOBJ_MODE_SHOW == rOpts.GetObjMode(VOBJ_TYPE_OLE));
201cdf0e10cSrcweir     const bool bDrawChart(VOBJ_MODE_SHOW == rOpts.GetObjMode(VOBJ_TYPE_CHART));
202cdf0e10cSrcweir     const bool bDrawDraw(VOBJ_MODE_SHOW == rOpts.GetObjMode(VOBJ_TYPE_DRAW));
203cdf0e10cSrcweir 
204cdf0e10cSrcweir     if(bDrawOle || bDrawChart || bDrawDraw)
205cdf0e10cSrcweir     {
206cdf0e10cSrcweir         ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
207cdf0e10cSrcweir 
208cdf0e10cSrcweir         if(pDrView)
209cdf0e10cSrcweir         {
210cdf0e10cSrcweir             pDrView->setHideOle(!bDrawOle);
211cdf0e10cSrcweir             pDrView->setHideChart(!bDrawChart);
212cdf0e10cSrcweir             pDrView->setHideDraw(!bDrawDraw);
213cdf0e10cSrcweir             pDrView->setHideFormControl(!bDrawDraw);
214cdf0e10cSrcweir         }
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 		if(SC_UPDATE_CHANGED == eMode)
217cdf0e10cSrcweir 		{
218cdf0e10cSrcweir 			rOutputData.DrawingSingle((sal_uInt16)nLayer);
219cdf0e10cSrcweir 		}
220cdf0e10cSrcweir 		else
221cdf0e10cSrcweir 		{
222cdf0e10cSrcweir 			rOutputData.DrawSelectiveObjects((sal_uInt16)nLayer);
223cdf0e10cSrcweir 		}
224cdf0e10cSrcweir     }
225cdf0e10cSrcweir }
226cdf0e10cSrcweir 
DrawSdrGrid(const Rectangle & rDrawingRect,OutputDevice * pContentDev)227cdf0e10cSrcweir void ScGridWindow::DrawSdrGrid( const Rectangle& rDrawingRect, OutputDevice* pContentDev )
228cdf0e10cSrcweir {
229cdf0e10cSrcweir 	//	Draw-Gitterlinien
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 	ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
232cdf0e10cSrcweir 	if ( pDrView && pDrView->IsGridVisible() )
233cdf0e10cSrcweir 	{
234cdf0e10cSrcweir 		SdrPageView* pPV = pDrView->GetSdrPageView();
235cdf0e10cSrcweir 		DBG_ASSERT(pPV, "keine PageView");
236cdf0e10cSrcweir 		if (pPV)
237cdf0e10cSrcweir 		{
238cdf0e10cSrcweir             pContentDev->SetLineColor(COL_GRAY);
239cdf0e10cSrcweir 
240cdf0e10cSrcweir             pPV->DrawPageViewGrid( *pContentDev, rDrawingRect );
241cdf0e10cSrcweir 		}
242cdf0e10cSrcweir 	}
243cdf0e10cSrcweir }
244cdf0e10cSrcweir 
GetDrawMapMode(sal_Bool bForce)245cdf0e10cSrcweir MapMode ScGridWindow::GetDrawMapMode( sal_Bool bForce )
246cdf0e10cSrcweir {
247cdf0e10cSrcweir 	ScDocument* pDoc = pViewData->GetDocument();
248cdf0e10cSrcweir     SCTAB nTab = pViewData->GetTabNo();
249cdf0e10cSrcweir 	sal_Bool bNegativePage = pDoc->IsNegativePage( nTab );
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 	MapMode aDrawMode = pViewData->GetLogicMode();
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 	ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
254cdf0e10cSrcweir 	if ( pDrView || bForce )
255cdf0e10cSrcweir 	{
256cdf0e10cSrcweir 		Fraction aScaleX;
257cdf0e10cSrcweir 		Fraction aScaleY;
258cdf0e10cSrcweir 		if (pDrView)
259cdf0e10cSrcweir 			pDrView->GetScale( aScaleX, aScaleY );
260cdf0e10cSrcweir 		else
261cdf0e10cSrcweir 		{
262cdf0e10cSrcweir 			SCCOL nEndCol = 0;
263cdf0e10cSrcweir 			SCROW nEndRow = 0;
264cdf0e10cSrcweir 			pDoc->GetTableArea( nTab, nEndCol, nEndRow );
265cdf0e10cSrcweir 			if (nEndCol<20) nEndCol = 20;
266cdf0e10cSrcweir             if (nEndRow<20) nEndRow = 20;
267cdf0e10cSrcweir 			ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, this,
268cdf0e10cSrcweir 									pViewData->GetZoomX(),pViewData->GetZoomY(),
269cdf0e10cSrcweir 									pViewData->GetPPTX(),pViewData->GetPPTY(),
270cdf0e10cSrcweir 									aScaleX,aScaleY );
271cdf0e10cSrcweir 		}
272cdf0e10cSrcweir 		aDrawMode.SetScaleX(aScaleX);
273cdf0e10cSrcweir 		aDrawMode.SetScaleY(aScaleY);
274cdf0e10cSrcweir 	}
275cdf0e10cSrcweir 	aDrawMode.SetOrigin(Point());
276cdf0e10cSrcweir 	Point aStartPos = pViewData->GetPixPos(eWhich);
277cdf0e10cSrcweir 	if ( bNegativePage )
278cdf0e10cSrcweir 	{
279cdf0e10cSrcweir 		//	RTL uses negative positions for drawing objects
280cdf0e10cSrcweir 		aStartPos.X() = -aStartPos.X() + GetOutputSizePixel().Width() - 1;
281cdf0e10cSrcweir 	}
282cdf0e10cSrcweir 	aDrawMode.SetOrigin( PixelToLogic( aStartPos, aDrawMode ) );
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 	return aDrawMode;
285cdf0e10cSrcweir }
286cdf0e10cSrcweir 
287cdf0e10cSrcweir //sal_Bool ScGridWindow::DrawBeforeScroll()
288cdf0e10cSrcweir //{
289cdf0e10cSrcweir //	ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
290cdf0e10cSrcweir //
291cdf0e10cSrcweir //	sal_Bool bXor = sal_False;
292cdf0e10cSrcweir //	if (pDrView)
293cdf0e10cSrcweir //	{
294cdf0e10cSrcweir //	    bXor=pDrView->IsShownXorVisible(this);
295cdf0e10cSrcweir //	    if (bXor) pDrView->HideShownXor(this);
296cdf0e10cSrcweir //	}
297cdf0e10cSrcweir //	return bXor;
298cdf0e10cSrcweir //}
299cdf0e10cSrcweir 
DrawAfterScroll()300cdf0e10cSrcweir void ScGridWindow::DrawAfterScroll(/*sal_Bool bVal*/)
301cdf0e10cSrcweir {
302cdf0e10cSrcweir 	Update();		// immer, damit das Verhalten mit/ohne DrawingLayer gleich ist
303cdf0e10cSrcweir 
304cdf0e10cSrcweir 	ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
305cdf0e10cSrcweir 	if (pDrView)
306cdf0e10cSrcweir 	{
307cdf0e10cSrcweir 	    //if (bVal)
308cdf0e10cSrcweir     	//	pDrView->ShowShownXor(this);
309cdf0e10cSrcweir 
310cdf0e10cSrcweir 		OutlinerView* pOlView = pDrView->GetTextEditOutlinerView();
311cdf0e10cSrcweir 		if (pOlView && pOlView->GetWindow() == this)
312cdf0e10cSrcweir 			pOlView->ShowCursor(sal_False);					// ist beim Scrollen weggekommen
313cdf0e10cSrcweir     }
314cdf0e10cSrcweir }
315cdf0e10cSrcweir 
316cdf0e10cSrcweir //void ScGridWindow::DrawMarks()
317cdf0e10cSrcweir //{
318cdf0e10cSrcweir //	ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
319cdf0e10cSrcweir //	if (pDrView)
320cdf0e10cSrcweir //		pDrView->DrawMarks(this);
321cdf0e10cSrcweir //}
322cdf0e10cSrcweir 
323cdf0e10cSrcweir //sal_Bool ScGridWindow::NeedDrawMarks()
324cdf0e10cSrcweir //{
325cdf0e10cSrcweir //	ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
326cdf0e10cSrcweir //	return pDrView && pDrView->IsMarkHdlShown() && pDrView->AreObjectsMarked();
327cdf0e10cSrcweir //}
328cdf0e10cSrcweir 
CreateAnchorHandle(SdrHdlList & rHdl,const ScAddress & rAddress)329cdf0e10cSrcweir void ScGridWindow::CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress)
330cdf0e10cSrcweir {
331cdf0e10cSrcweir 	ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
332cdf0e10cSrcweir 	if (pDrView)
333cdf0e10cSrcweir 	{
334cdf0e10cSrcweir 		const ScViewOptions& rOpts = pViewData->GetOptions();
335cdf0e10cSrcweir 		if(rOpts.GetOption( VOPT_ANCHOR ))
336cdf0e10cSrcweir 		{
337cdf0e10cSrcweir 			sal_Bool bNegativePage = pViewData->GetDocument()->IsNegativePage( pViewData->GetTabNo() );
338cdf0e10cSrcweir 			Point aPos = pViewData->GetScrPos( rAddress.Col(), rAddress.Row(), eWhich, sal_True );
339cdf0e10cSrcweir 			aPos = PixelToLogic(aPos);
340cdf0e10cSrcweir 			rHdl.AddHdl(new SdrHdl(aPos, bNegativePage ? HDL_ANCHOR_TR : HDL_ANCHOR));
341cdf0e10cSrcweir 		}
342cdf0e10cSrcweir 	}
343cdf0e10cSrcweir }
344cdf0e10cSrcweir 
GetEditObject()345cdf0e10cSrcweir SdrObject* ScGridWindow::GetEditObject()
346cdf0e10cSrcweir {
347cdf0e10cSrcweir 	ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
348cdf0e10cSrcweir 	if (pDrView)
349cdf0e10cSrcweir 	{
350cdf0e10cSrcweir 		OutlinerView* pOlView = pDrView->GetTextEditOutlinerView();
351cdf0e10cSrcweir 		if (pOlView && pOlView->GetWindow() == this)
352cdf0e10cSrcweir 			return pDrView->GetTextEditObject();
353cdf0e10cSrcweir 	}
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 	return NULL;
356cdf0e10cSrcweir }
357cdf0e10cSrcweir 
UpdateStatusPosSize()358cdf0e10cSrcweir void ScGridWindow::UpdateStatusPosSize()
359cdf0e10cSrcweir {
360cdf0e10cSrcweir 	ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
361cdf0e10cSrcweir 	if (!pDrView)
362cdf0e10cSrcweir 		return;			// shouldn't be called in that case
363cdf0e10cSrcweir 
364cdf0e10cSrcweir     SdrPageView* pPV = pDrView->GetSdrPageView();
365cdf0e10cSrcweir     if (!pPV)
366cdf0e10cSrcweir         return;         // shouldn't be called in that case either
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 	SfxItemSet aSet(pViewData->GetViewShell()->GetPool(), SID_ATTR_POSITION, SID_ATTR_SIZE);
369cdf0e10cSrcweir 
370cdf0e10cSrcweir 	//	Fill items for position and size:
371cdf0e10cSrcweir 	//	#108137# show action rectangle during action,
372cdf0e10cSrcweir 	//	position and size of selected object(s) if something is selected,
373cdf0e10cSrcweir 	//	mouse position otherwise
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 	sal_Bool bActionItem = sal_False;
376cdf0e10cSrcweir 	if ( pDrView->IsAction() )				// action rectangle
377cdf0e10cSrcweir 	{
378cdf0e10cSrcweir 		Rectangle aRect;
379cdf0e10cSrcweir 		pDrView->TakeActionRect( aRect );
380cdf0e10cSrcweir 		if ( !aRect.IsEmpty() )
381cdf0e10cSrcweir 		{
382cdf0e10cSrcweir 			pPV->LogicToPagePos(aRect);
383cdf0e10cSrcweir 			aSet.Put( SfxPointItem( SID_ATTR_POSITION, aRect.TopLeft() ) );
384cdf0e10cSrcweir 			aSet.Put( SvxSizeItem( SID_ATTR_SIZE,
385cdf0e10cSrcweir 					Size( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ) ) );
386cdf0e10cSrcweir 			bActionItem = sal_True;
387cdf0e10cSrcweir 		}
388cdf0e10cSrcweir 	}
389cdf0e10cSrcweir 	if ( !bActionItem )
390cdf0e10cSrcweir 	{
391cdf0e10cSrcweir 		if ( pDrView->AreObjectsMarked() )		// selected objects
392cdf0e10cSrcweir 		{
393cdf0e10cSrcweir 			Rectangle aRect = pDrView->GetAllMarkedRect();
394cdf0e10cSrcweir 			pPV->LogicToPagePos(aRect);
395cdf0e10cSrcweir 			aSet.Put( SfxPointItem( SID_ATTR_POSITION, aRect.TopLeft() ) );
396cdf0e10cSrcweir 			aSet.Put( SvxSizeItem( SID_ATTR_SIZE,
397cdf0e10cSrcweir 					Size( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ) ) );
398cdf0e10cSrcweir 		}
399cdf0e10cSrcweir 		else								// mouse position
400cdf0e10cSrcweir 		{
401cdf0e10cSrcweir 			Point aPos = PixelToLogic(aCurMousePos);
402cdf0e10cSrcweir 			pPV->LogicToPagePos(aPos);
403cdf0e10cSrcweir 			aSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos ) );
404cdf0e10cSrcweir 			aSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) );
405cdf0e10cSrcweir 		}
406cdf0e10cSrcweir 	}
407cdf0e10cSrcweir 
408cdf0e10cSrcweir 	pViewData->GetBindings().SetState(aSet);
409cdf0e10cSrcweir }
410cdf0e10cSrcweir 
DrawHasMarkedObj()411cdf0e10cSrcweir sal_Bool ScGridWindow::DrawHasMarkedObj()
412cdf0e10cSrcweir {
413cdf0e10cSrcweir 	ScDrawView* p = pViewData->GetScDrawView();
414cdf0e10cSrcweir 	return p ? p->AreObjectsMarked() : sal_False;
415cdf0e10cSrcweir }
416cdf0e10cSrcweir 
417cdf0e10cSrcweir //void ScGridWindow::DrawStartTimer()
418cdf0e10cSrcweir //{
419cdf0e10cSrcweir 	//ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
420cdf0e10cSrcweir 	//if (pDrView)
421cdf0e10cSrcweir 	//{
422cdf0e10cSrcweir 		/* jetzt in DrawMarks
423cdf0e10cSrcweir 		sal_uInt16 nWinNum = pDrView->FindWin(this);
424cdf0e10cSrcweir 	    if (nWinNum!=SDRVIEWWIN_NOTFOUND)
425cdf0e10cSrcweir 	        pDrView->AfterInitRedraw(nWinNum);
426cdf0e10cSrcweir         */
427cdf0e10cSrcweir 
428cdf0e10cSrcweir 		// pDrView->PostPaint();
429cdf0e10cSrcweir 		// pDrView->RestartAfterPaintTimer();
430cdf0e10cSrcweir 	//}
431cdf0e10cSrcweir //}
432cdf0e10cSrcweir 
DrawMarkDropObj(SdrObject * pObj)433cdf0e10cSrcweir void ScGridWindow::DrawMarkDropObj( SdrObject* pObj )
434cdf0e10cSrcweir {
435cdf0e10cSrcweir 	ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
436cdf0e10cSrcweir 	if (pDrView)
437cdf0e10cSrcweir 		pDrView->MarkDropObj(pObj);
438cdf0e10cSrcweir }
439cdf0e10cSrcweir 
440cdf0e10cSrcweir 
441cdf0e10cSrcweir 
442