1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #include "precompiled_rptui.hxx"
24 #include <vcl/scrbar.hxx>
25 #include <vcl/svapp.hxx>
26 #include <vcl/seleng.hxx>
27 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
28 #include <com/sun/star/embed/EmbedStates.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 
31 #include <svx/svdview.hxx>
32 #include <svx/svdpagv.hxx>
33 #include <editeng/outlobj.hxx>
34 #include <editeng/unolingu.hxx>
35 #include <svx/svdetc.hxx>
36 #include <editeng/editstat.hxx>
37 #include <svx/svdoutl.hxx>
38 #include <svx/svddrgmt.hxx>
39 #include <svx/svdoashp.hxx>
40 #include <svx/svxids.hrc>
41 #include <svx/svditer.hxx>
42 
43 #include <toolkit/helper/vclunohelper.hxx>
44 
45 #include "dlgedfunc.hxx"
46 #include "ReportSection.hxx"
47 #include "DesignView.hxx"
48 #include "ReportController.hxx"
49 #include "SectionView.hxx"
50 #include "ViewsWindow.hxx"
51 #include "ReportWindow.hxx"
52 #include "RptObject.hxx"
53 #include "ScrollHelper.hxx"
54 
55 #include "ReportRuler.hxx"
56 #include "UITools.hxx"
57 
58 #include <uistrings.hrc>
59 #include "UndoEnv.hxx"
60 #include <RptModel.hxx>
61 #include <tools/diagnose_ex.h>
62 
63 #define DEFAUL_MOVE_SIZE    100
64 namespace rptui
65 {
66 using namespace ::com::sun::star;
67 //----------------------------------------------------------------------------
68 
69 //----------------------------------------------------------------------------
70 
71 IMPL_LINK( DlgEdFunc, ScrollTimeout, Timer *,  )
72 {
73 	ForceScroll( m_pParent->PixelToLogic( m_pParent->GetPointerPosPixel() ) );
74 	return 0;
75 }
76 
77 //----------------------------------------------------------------------------
78 
ForceScroll(const Point & rPos)79 void DlgEdFunc::ForceScroll( const Point& rPos )
80 {
81 	aScrollTimer.Stop();
82 
83 	OReportWindow* pReportWindow = m_pParent->getSectionWindow()->getViewsWindow()->getView();
84 	OScrollWindowHelper* pScrollWindow = pReportWindow->getScrollWindow();
85 
86 	Size aOut = pReportWindow->GetOutputSizePixel();
87     Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
88     aStartWidth *= m_pParent->GetMapMode().GetScaleX();
89 
90 	aOut.Width() -= (long)aStartWidth;
91     aOut.Height() = m_pParent->GetOutputSizePixel().Height();
92 
93     Point aPos = pScrollWindow->getThumbPos();
94     aPos.X() *= 0.5;
95     aPos.Y() *= 0.5;
96 	Rectangle aOutRect( aPos, aOut );
97 	aOutRect = m_pParent->PixelToLogic( aOutRect );
98 	//Rectangle aWorkArea = m_pParent->getView()->GetWorkArea();
99     Point aGcc3WorkaroundTemporary;
100     Rectangle aWorkArea(aGcc3WorkaroundTemporary,pScrollWindow->getTotalSize());
101     aWorkArea.Right() -= (long)aStartWidth;
102 	aWorkArea = pScrollWindow->PixelToLogic( aWorkArea );
103 	if( !aOutRect.IsInside( rPos ) && aWorkArea.IsInside( rPos ) )
104 	{
105 		ScrollBar* pHScroll = pScrollWindow->GetHScroll();
106 		ScrollBar* pVScroll = pScrollWindow->GetVScroll();
107 		ScrollType eH = SCROLL_LINEDOWN,eV = SCROLL_LINEDOWN;
108 		if( rPos.X() < aOutRect.Left() )
109             eH = SCROLL_LINEUP;
110 		else if( rPos.X() <= aOutRect.Right() )
111 			eH = SCROLL_DONTKNOW;
112 
113 		if( rPos.Y() < aOutRect.Top() )
114 			eV = SCROLL_LINEUP;
115 		else if( rPos.Y() <= aOutRect.Bottom() )
116 			eV = SCROLL_DONTKNOW;
117 
118         pHScroll->DoScrollAction(eH);
119         pVScroll->DoScrollAction(eV);
120 	}
121 
122 	aScrollTimer.Start();
123 }
124 
125 //----------------------------------------------------------------------------
126 
DlgEdFunc(OReportSection * _pParent)127 DlgEdFunc::DlgEdFunc( OReportSection* _pParent )
128 :m_pParent(_pParent),
129  m_rView(_pParent->getSectionView()),
130  m_xOverlappingObj(NULL),
131  m_pOverlappingObj(NULL),
132  m_bSelectionMode(false),
133  m_bUiActive(false),
134  m_bShowPropertyBrowser(false)
135 {
136 	// m_pParent = _pParent;
137 	aScrollTimer.SetTimeoutHdl( LINK( this, DlgEdFunc, ScrollTimeout ) );
138     m_rView.SetActualWin( m_pParent);
139 	aScrollTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL );
140 }
141 
142 //----------------------------------------------------------------------------
setOverlappedControlColor(sal_Int32 _nColor)143 void DlgEdFunc::setOverlappedControlColor(sal_Int32 _nColor)
144 {
145     m_nOverlappedControlColor = _nColor;
146 }
147 // -----------------------------------------------------------------------------
lcl_setColorOfObject(uno::Reference<uno::XInterface> _xObj,long _nColorTRGB)148 sal_Int32 lcl_setColorOfObject(uno::Reference< uno::XInterface > _xObj, long _nColorTRGB)
149 {
150     sal_Int32 nBackColor = 0;
151     try
152     {
153         uno::Reference<report::XReportComponent> xComponent(_xObj, uno::UNO_QUERY_THROW);
154         // NOT NEED if UNO_QUERY_THROW:
155 		// if (xComponent.is())
156         // {
157         uno::Reference< beans::XPropertySet > xProp(xComponent, uno::UNO_QUERY_THROW);
158         // if (xProp.is())
159         // {
160 		// ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlBackground"))
161 		// is PROPERTY_CONTROLBACKGROUND
162 		uno::Any aAny = xProp->getPropertyValue(PROPERTY_CONTROLBACKGROUND);
163         if (aAny.hasValue())
164         {
165             aAny >>= nBackColor;
166             // try to set background color at the ReportComponent
167             uno::Any aBlackColorAny = uno::makeAny(_nColorTRGB);
168             xProp->setPropertyValue(PROPERTY_CONTROLBACKGROUND, aBlackColorAny);
169         }
170         // aCopies.push_back(xComponent->createClone());
171     }
172     catch(uno::Exception&)
173     {
174         // bit my shiny metal as!
175         // OSL_ENSURE(0,"Can't copy report elements!");
176     }
177     return nBackColor;
178 }
179 // -----------------------------------------------------------------------------
~DlgEdFunc()180 DlgEdFunc::~DlgEdFunc()
181 {
182 	unColorizeOverlappedObj();
183 	aScrollTimer.Stop();
184 }
185 
186 //----------------------------------------------------------------------------
187 
MouseButtonDown(const MouseEvent & rMEvt)188 sal_Bool DlgEdFunc::MouseButtonDown( const MouseEvent& rMEvt )
189 {
190     m_aMDPos = m_pParent->PixelToLogic( rMEvt.GetPosPixel() );
191 	m_pParent->GrabFocus();
192     sal_Bool bHandled = sal_False;
193     if ( rMEvt.IsLeft() )
194     {
195         if ( rMEvt.GetClicks() > 1 )
196         {
197             // show property browser
198 		    if ( m_pParent->GetMode() != RPTUI_READONLY )
199             {
200                 uno::Sequence<beans::PropertyValue> aArgs(1);
201                 aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowProperties"));
202                 aArgs[0].Value <<= sal_True;
203                 m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController().executeUnChecked(SID_SHOW_PROPERTYBROWSER,aArgs);
204                 m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
205                 // TODO character in shapes
206                 //    SdrViewEvent aVEvt;
207                 // m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
208                 //    if ( aVEvt.pRootObj && aVEvt.pRootObj->ISA(SdrTextObj) )
209                 //        SetInEditMode(static_cast<SdrTextObj *>(aVEvt.pRootObj),rMEvt, sal_False);
210                 bHandled = sal_True;
211             }
212         }
213         else
214         {
215             SdrHdl* pHdl = m_rView.PickHandle(m_aMDPos);
216             //m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(m_pView);
217 
218 	        // if selected object was hit, drag object
219 	        if ( pHdl!=NULL || m_rView.IsMarkedHit(m_aMDPos) )
220             {
221                 bHandled = sal_True;
222                 m_pParent->CaptureMouse();
223 		        m_pParent->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos, pHdl,&m_rView);
224             }
225         }
226     }
227     else if ( rMEvt.IsRight() && !rMEvt.IsLeft() && rMEvt.GetClicks() == 1 ) // mark object when context menu was selected
228     {
229         SdrPageView* pPV = m_rView.GetSdrPageView();
230 		SdrViewEvent aVEvt;
231 		if ( m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt) != SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() )
232             m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
233         if ( aVEvt.pRootObj )
234 		    m_rView.MarkObj(aVEvt.pRootObj, pPV);
235         else
236             m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
237 
238         bHandled = sal_True;
239     }
240     else if( !rMEvt.IsLeft() )
241 		bHandled = sal_True;
242     if ( !bHandled )
243         m_pParent->CaptureMouse();
244     return bHandled;
245 }
246 
247 //----------------------------------------------------------------------------
248 
MouseButtonUp(const MouseEvent &)249 sal_Bool DlgEdFunc::MouseButtonUp( const MouseEvent& /*rMEvt*/ )
250 {
251     sal_Bool bHandled = sal_False;
252 	m_pParent->getSectionWindow()->getViewsWindow()->stopScrollTimer();
253 	return bHandled;
254 }
255 // -----------------------------------------------------------------------------
checkTwoCklicks(const MouseEvent & rMEvt)256 void DlgEdFunc::checkTwoCklicks(const MouseEvent& rMEvt)
257 {
258     deactivateOle();
259 
260     const sal_uInt16 nClicks = rMEvt.GetClicks();
261 	if ( nClicks == 2 && rMEvt.IsLeft() )
262 	{
263 		if ( m_rView.AreObjectsMarked() )
264 		{
265 			const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
266 			if (rMarkList.GetMarkCount() == 1)
267 			{
268 				const SdrMark* pMark = rMarkList.GetMark(0);
269 				SdrObject* pObj = pMark->GetMarkedSdrObj();
270 				activateOle(pObj);
271             } // if (rMarkList.GetMarkCount() == 1)
272         } // if ( pView->AreObjectsMarked() )
273     }
274 }
275 // -----------------------------------------------------------------------------
stopScrollTimer()276 void DlgEdFunc::stopScrollTimer()
277 {
278     unColorizeOverlappedObj();
279     aScrollTimer.Stop();
280     if ( m_pParent->IsMouseCaptured() )
281         m_pParent->ReleaseMouse();
282 }
283 //----------------------------------------------------------------------------
284 
MouseMove(const MouseEvent &)285 sal_Bool DlgEdFunc::MouseMove( const MouseEvent& /*rMEvt*/ )
286 {
287 	return sal_False;
288 }
289 //------------------------------------------------------------------------------
handleKeyEvent(const KeyEvent & _rEvent)290 sal_Bool DlgEdFunc::handleKeyEvent(const KeyEvent& _rEvent)
291 {
292 	sal_Bool bReturn = sal_False;
293 
294     if ( !m_bUiActive )
295     {
296         const KeyCode& rCode = _rEvent.GetKeyCode();
297 	    sal_uInt16 nCode = rCode.GetCode();
298 
299 		switch ( nCode )
300 		{
301 			case KEY_ESCAPE:
302 			{
303 				if ( m_pParent->getSectionWindow()->getViewsWindow()->IsAction() )
304 				{
305 					m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
306 					bReturn = sal_True;
307 				}
308     	        else if ( m_rView.IsTextEdit() )
309 	    	    {
310 		    		m_rView.SdrEndTextEdit();
311 		        	bReturn = sal_True;
312 	            }
313 				else if ( m_rView.AreObjectsMarked() )
314 				{
315 					const SdrHdlList& rHdlList = m_rView.GetHdlList();
316 					SdrHdl* pHdl = rHdlList.GetFocusHdl();
317 					if ( pHdl )
318 						((SdrHdlList&)rHdlList).ResetFocusHdl();
319 					else
320             	        m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
321 						//m_rView.UnmarkAll();
322 
323 				    deactivateOle(true);
324 					bReturn = sal_False;
325 				}
326                 else
327                 {
328                     deactivateOle(true);
329                 }
330 			}
331 			break;
332 			case KEY_TAB:
333 			{
334 				if ( !rCode.IsMod1() && !rCode.IsMod2() )
335 				{
336 					// mark next object
337 					if ( !m_rView.MarkNextObj( !rCode.IsShift() ) )
338 					{
339 						// if no next object, mark first/last
340 						m_rView.UnmarkAllObj();
341 						m_rView.MarkNextObj( !rCode.IsShift() );
342 					}
343 
344 					if ( m_rView.AreObjectsMarked() )
345 						m_rView.MakeVisible( m_rView.GetAllMarkedRect(), *m_pParent);
346 
347 					bReturn = sal_True;
348 				}
349 				else if ( rCode.IsMod1() && rCode.IsMod2())
350 				{
351 					// selected handle
352 					const SdrHdlList& rHdlList = m_rView.GetHdlList();
353 					((SdrHdlList&)rHdlList).TravelFocusHdl( !rCode.IsShift() );
354 
355 					// guarantee visibility of focused handle
356 					SdrHdl* pHdl = rHdlList.GetFocusHdl();
357 					if ( pHdl )
358 					{
359 						Point aHdlPosition( pHdl->GetPos() );
360 						Rectangle aVisRect( aHdlPosition - Point( DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE ), Size( 200, 200 ) );
361 						m_rView.MakeVisible( aVisRect, *m_pParent);
362 					}
363 
364 					bReturn = sal_True;
365 				}
366 			}
367 			break;
368 			case KEY_UP:
369 			case KEY_DOWN:
370 			case KEY_LEFT:
371 			case KEY_RIGHT:
372 			{
373     	        m_pParent->getSectionWindow()->getViewsWindow()->handleKey(rCode);
374 				bReturn = sal_True;
375 			}
376 			break;
377         	case KEY_RETURN:
378             	if ( !rCode.IsMod1() )
379                 {
380                     const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
381                     if ( rMarkList.GetMarkCount() == 1 )
382                     {
383                         SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
384                         activateOle(pObj);
385                     }
386                 }
387                 break;
388             case KEY_DELETE:
389                 if ( !rCode.IsMod1() && !rCode.IsMod2() )
390                 {
391                     bReturn = sal_True;
392                     break;
393                 } // if ( !rCode.IsMod1() && !rCode.IsMod2() )
394                 // run through
395 			default:
396 			{
397         	    bReturn = m_rView.KeyInput(_rEvent, m_pParent);
398 			}
399 			break;
400 		}
401 	}
402 
403 	if ( bReturn && m_pParent->IsMouseCaptured() )
404 		m_pParent->ReleaseMouse();
405 
406 	return bReturn;
407 }
408 // -----------------------------------------------------------------------------
activateOle(SdrObject * _pObj)409 void DlgEdFunc::activateOle(SdrObject* _pObj)
410 {
411     if ( _pObj )
412     {
413         const sal_uInt16 nSdrObjKind = _pObj->GetObjIdentifier();
414         //
415 	    //	OLE: activate
416 	    //
417 	    if (nSdrObjKind == OBJ_OLE2)
418 	    {
419             bool bIsInplaceOle = false;
420 		    if (!bIsInplaceOle)
421 		    {
422                 SdrOle2Obj* pOleObj = dynamic_cast<SdrOle2Obj*>(_pObj);
423                 if ( pOleObj->GetObjRef().is() )
424 			    {
425                     if (m_rView.IsTextEdit())
426 		            {
427 			            m_rView.SdrEndTextEdit();
428 		            }
429 
430                     pOleObj->AddOwnLightClient();
431                     pOleObj->SetWindow(VCLUnoHelper::GetInterface(m_pParent));
432                     try
433                     {
434                         pOleObj->GetObjRef()->changeState( embed::EmbedStates::UI_ACTIVE );
435                         m_bUiActive = true;
436                         OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
437                         m_bShowPropertyBrowser = rController.isCommandChecked(SID_SHOW_PROPERTYBROWSER);
438                         if ( m_bShowPropertyBrowser )
439                             rController.executeChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue >());
440                     }
441                     catch( uno::Exception& )
442                     {
443                         DBG_UNHANDLED_EXCEPTION();
444                     }
445 			    }
446 		    }
447 	    } // if (nSdrObjKind == OBJ_OLE2)
448     } // if ( _pObj )
449 }
450 // -----------------------------------------------------------------------------
deactivateOle(bool _bSelect)451 void DlgEdFunc::deactivateOle(bool _bSelect)
452 {
453     OLEObjCache& rObjCache = GetSdrGlobalData().GetOLEObjCache();
454     OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
455     const sal_uLong nCount = rObjCache.Count();
456     for(sal_uLong i = 0 ; i< nCount;++i)
457     {
458         SdrOle2Obj* pObj = reinterpret_cast<SdrOle2Obj*>(rObjCache.GetObject(i));
459         if ( m_pParent->getPage() == pObj->GetPage() )
460         {
461             uno::Reference< embed::XEmbeddedObject > xObj = pObj->GetObjRef();
462             if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::UI_ACTIVE )
463             {
464                 xObj->changeState( embed::EmbedStates::RUNNING );
465                 m_bUiActive = false;
466                 if ( m_bShowPropertyBrowser )
467                 {
468                     rController.executeChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue >());
469                 }
470 
471                 if ( _bSelect )
472                 {
473                     SdrPageView* pPV = m_rView.GetSdrPageView();
474 		            m_rView.MarkObj(pObj, pPV);
475                 }
476             } // if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::UI_ACTIVE )
477         }
478     } // for(sal_uLong i = 0 ; i< nCount;++i)
479 }
480 // -----------------------------------------------------------------------------
colorizeOverlappedObject(SdrObject * _pOverlappedObj)481 void DlgEdFunc::colorizeOverlappedObject(SdrObject* _pOverlappedObj)
482 {
483 	OObjectBase* pObj = dynamic_cast<OObjectBase*>(_pOverlappedObj);
484 	if ( pObj )
485 	{
486         uno::Reference<report::XReportComponent> xComponent = pObj->getReportComponent();
487         if (xComponent.is() && xComponent != m_xOverlappingObj)
488         {
489 	        OReportModel* pRptModel = static_cast<OReportModel*>(_pOverlappedObj->GetModel());
490 		    if ( pRptModel )
491 			{
492 				OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
493 
494 				// uncolorize an old object, if there is one
495 				unColorizeOverlappedObj();
496 
497 			    m_nOldColor = lcl_setColorOfObject(xComponent, m_nOverlappedControlColor);
498 				m_xOverlappingObj = xComponent;
499 				m_pOverlappingObj = _pOverlappedObj;
500 			}
501         }
502     }
503 }
504 // -----------------------------------------------------------------------------
unColorizeOverlappedObj()505 void DlgEdFunc::unColorizeOverlappedObj()
506 {
507 	// uncolorize an old object, if there is one
508     if (m_xOverlappingObj.is())
509     {
510 		OReportModel* pRptModel = static_cast<OReportModel*>(m_pOverlappingObj->GetModel());
511 	    if ( pRptModel )
512 		{
513 			OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
514 
515 			lcl_setColorOfObject(m_xOverlappingObj, m_nOldColor);
516 		    m_xOverlappingObj = NULL;
517 			m_pOverlappingObj = NULL;
518 		}
519     }
520 }
521 // -----------------------------------------------------------------------------
isOverlapping(const MouseEvent & rMEvt)522 bool DlgEdFunc::isOverlapping(const MouseEvent& rMEvt)
523 {
524     bool bOverlapping = false;
525     SdrViewEvent aVEvt;
526 	bOverlapping = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONUP, aVEvt) != SDRHIT_NONE;
527 	if (bOverlapping && aVEvt.pObj)
528 	{
529 		colorizeOverlappedObject(aVEvt.pObj);
530 	}
531     else
532     {
533 		unColorizeOverlappedObj();
534     }
535 
536     return bOverlapping;
537 }
538 // -----------------------------------------------------------------------------
checkMovementAllowed(const MouseEvent & rMEvt)539 void DlgEdFunc::checkMovementAllowed(const MouseEvent& rMEvt)
540 {
541     if ( m_pParent->getSectionWindow()->getViewsWindow()->IsDragObj() )
542 	{
543         if ( isRectangleHit(rMEvt) )
544         {
545             // there is an other component under use, break action
546             m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
547         }
548 		// object was dragged
549         Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
550 		if (m_bSelectionMode)
551 		{
552 			m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
553 		}
554 		else
555 		{
556 			bool bControlKeyPressed = rMEvt.IsMod1();
557 			// Don't allow points smaller 0
558 			if (bControlKeyPressed && (aPnt.Y() < 0))
559 			{
560 				aPnt.Y() = 0;
561 			}
562             if (m_rView.IsDragResize())
563             {
564                 // we resize the object don't resize to above sections
565                 if ( aPnt.Y() < 0 )
566                 {
567                     aPnt.Y() = 0;
568                 }
569             }
570             m_pParent->getSectionWindow()->getViewsWindow()->EndDragObj( bControlKeyPressed, &m_rView, aPnt );
571 		}
572 		m_pParent->getSectionWindow()->getViewsWindow()->ForceMarkedToAnotherPage();
573         m_pParent->Invalidate(INVALIDATE_CHILDREN);
574 	}
575     else
576 		m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
577 }
578 // -----------------------------------------------------------------------------
isOnlyCustomShapeMarked()579 bool DlgEdFunc::isOnlyCustomShapeMarked()
580 {
581 	bool bReturn = true;
582 	const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
583     for (sal_uInt32 i =  0; i < rMarkList.GetMarkCount();++i )
584     {
585         SdrMark* pMark = rMarkList.GetMark(i);
586         // bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
587         SdrObject* pObj = pMark->GetMarkedSdrObj();
588 		if (pObj->GetObjIdentifier() != OBJ_CUSTOMSHAPE)
589 		{
590 			// we found an object in the marked objects, which is not a custom shape.
591 			bReturn = false;
592 			break;
593 		}
594 	}
595 	return bReturn;
596 }
597 // -----------------------------------------------------------------------------
isRectangleHit(const MouseEvent & rMEvt)598 bool DlgEdFunc::isRectangleHit(const MouseEvent& rMEvt)
599 {
600 	if (isOnlyCustomShapeMarked())
601 	{
602 		return false;
603 	}
604 
605 	SdrViewEvent aVEvt;
606 	const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEMOVE, aVEvt);
607     bool bIsSetPoint = (eHit == SDRHIT_UNMARKEDOBJECT);
608     if ( !bIsSetPoint )
609     {
610         // no drag rect, we have to check every single select rect
611         //const Rectangle& rRect = m_rView.GetDragStat().GetActionRect();
612         const SdrDragStat& rDragStat = m_rView.GetDragStat();
613 		if (rDragStat.GetDragMethod() != NULL)
614 		{
615             SdrObjListIter aIter(*m_pParent->getPage(),IM_DEEPNOGROUPS);
616             SdrObject* pObjIter = NULL;
617             // loop through all marked objects and check if there new rect overlapps an old one.
618             while( (pObjIter = aIter.Next()) != NULL && !bIsSetPoint)
619             {
620                 if ( m_rView.IsObjMarked(pObjIter)
621                      && (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL) )
622                 {
623                     Rectangle aNewRect = pObjIter->GetLastBoundRect();
624                     long nDx = rDragStat.IsHorFixed() ? 0 : rDragStat.GetDX();
625                     long nDy = rDragStat.IsVerFixed() ? 0 : rDragStat.GetDY();
626                     if ( (nDx + aNewRect.Left()) < 0 )
627                         nDx = -aNewRect.Left();
628                     if ( (nDy + aNewRect.Top()) < 0 )
629                         nDy = -aNewRect.Top();
630 
631 					if ( rDragStat.GetDragMethod()->getMoveOnly() )
632                         aNewRect.Move(nDx,nDy);
633                     else
634                         ::ResizeRect(aNewRect,rDragStat.GetRef1(),rDragStat.GetXFact(),rDragStat.GetYFact());
635 
636 
637 					SdrObject* pObjOverlapped = isOver(aNewRect,*m_pParent->getPage(),m_rView,false,pObjIter, ISOVER_IGNORE_CUSTOMSHAPES);
638 					bIsSetPoint = pObjOverlapped ? true : false;
639 					if (pObjOverlapped && !m_bSelectionMode)
640 					{
641 						colorizeOverlappedObject(pObjOverlapped);
642                     }
643                 }
644             }
645         }
646     }
647 	else if ( aVEvt.pObj && (aVEvt.pObj->GetObjIdentifier() != OBJ_CUSTOMSHAPE) && !m_bSelectionMode)
648 	{
649 		colorizeOverlappedObject(aVEvt.pObj);
650 	}
651     else
652         bIsSetPoint = false;
653     return bIsSetPoint;
654 }
655 // -----------------------------------------------------------------------------
setMovementPointer(const MouseEvent & rMEvt)656 bool DlgEdFunc::setMovementPointer(const MouseEvent& rMEvt)
657 {
658     bool bIsSetPoint = isRectangleHit(rMEvt);
659     if ( bIsSetPoint )
660         m_pParent->SetPointer( Pointer(POINTER_NOTALLOWED));
661 	else
662 	{
663 		bool bCtrlKey = rMEvt.IsMod1();
664 		(void)bCtrlKey;
665 		if (bCtrlKey)
666 		{
667 	        m_pParent->SetPointer( Pointer(POINTER_MOVEDATALINK ));
668 			bIsSetPoint = true;
669 		}
670 	}
671     return bIsSetPoint;
672 }
673 //----------------------------------------------------------------------------
674 
DlgEdFuncInsert(OReportSection * _pParent)675 DlgEdFuncInsert::DlgEdFuncInsert( OReportSection* _pParent ) :
676 	DlgEdFunc( _pParent )
677 {
678 	m_rView.SetCreateMode( sal_True );
679 }
680 
681 //----------------------------------------------------------------------------
682 
~DlgEdFuncInsert()683 DlgEdFuncInsert::~DlgEdFuncInsert()
684 {
685 	m_rView.SetEditMode( sal_True );
686 }
687 
688 //----------------------------------------------------------------------------
689 
MouseButtonDown(const MouseEvent & rMEvt)690 sal_Bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt )
691 {
692     if ( DlgEdFunc::MouseButtonDown(rMEvt) )
693         return sal_True;
694 
695     SdrViewEvent aVEvt;
696     sal_Int16 nId = m_rView.GetCurrentObjIdentifier();
697 
698 	const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
699 
700 // eHit == SDRHIT_UNMARKEDOBJECT under the mouse cursor is a unmarked object
701 
702     if (eHit == SDRHIT_UNMARKEDOBJECT &&
703         nId != OBJ_CUSTOMSHAPE)
704     {
705         // there is an object under the mouse cursor, but not a customshape
706         // rtl::OUString suWasN = m_rView.getInsertObjString();
707         // rtl::OUString suWasN2 = m_pParent->getSectionWindow()->getViewsWindow()->GetInsertObjString();
708 
709         m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
710         return sal_False;
711     }
712 
713     if( eHit != SDRHIT_UNMARKEDOBJECT || nId == OBJ_CUSTOMSHAPE)
714     {
715 	    // if no action, create object
716 	    if ( !m_pParent->getSectionWindow()->getViewsWindow()->IsAction() )
717         {
718             deactivateOle(true);
719             if ( m_pParent->getSectionWindow()->getViewsWindow()->HasSelection() )
720                 m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(&m_rView);
721 		    m_rView.BegCreateObj(m_aMDPos);
722             m_pParent->getSectionWindow()->getViewsWindow()->createDefault();
723         }
724     }
725     else
726     {
727         if( !rMEvt.IsShift() )
728         {
729             // shift key pressed?
730 			m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
731         }
732 		m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos,&m_rView );
733     }
734 
735 	return sal_True;
736 }
737 
738 //----------------------------------------------------------------------------
MouseButtonUp(const MouseEvent & rMEvt)739 sal_Bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent& rMEvt )
740 {
741 	if ( DlgEdFunc::MouseButtonUp( rMEvt ) )
742         return sal_True;
743 
744 	const Point	aPos( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
745 	const sal_uInt16 nHitLog = sal_uInt16 ( m_pParent->PixelToLogic(Size(3,0)).Width() );
746 
747     sal_Bool bReturn = sal_True;
748 	// object creation active?
749 	if ( m_rView.IsCreateObj() )
750 	{
751         if ( isOver(m_rView.GetCreateObj(),*m_pParent->getPage(),m_rView) )
752         {
753             m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
754             // BrkAction disables the create mode
755             m_rView.SetCreateMode( sal_True );
756             return sal_True;
757         }
758 
759 		m_rView.EndCreateObj(SDRCREATE_FORCEEND);
760 
761 		if ( !m_rView.AreObjectsMarked() )
762 		{
763 			m_rView.MarkObj(aPos, nHitLog);
764 		}
765 
766 		bReturn = m_rView.AreObjectsMarked();
767         if ( bReturn )
768         {
769             OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
770             const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
771             for (sal_uInt32 i =  0; i < rMarkList.GetMarkCount();++i )
772             {
773                 SdrMark* pMark = rMarkList.GetMark(i);
774                 // bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
775                 OOle2Obj* pObj = dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj());
776 		        if ( pObj && !pObj->IsEmpty() )
777                 {
778                     pObj->initializeChart(rController.getModel());
779                 }
780             }
781         }
782 	}
783 	else
784         checkMovementAllowed(rMEvt);
785 
786 	if ( !m_rView.AreObjectsMarked() &&
787 		 Abs(m_aMDPos.X() - aPos.X()) < nHitLog &&
788 		 Abs(m_aMDPos.Y() - aPos.Y()) < nHitLog &&
789 		 !rMEvt.IsShift() && !rMEvt.IsMod2() )
790 	{
791 		SdrPageView* pPV = m_rView.GetSdrPageView();
792 		SdrViewEvent aVEvt;
793 		m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
794 		m_rView.MarkObj(aVEvt.pRootObj, pPV);
795 	} // ift() && !rMEvt.IsMod2() )
796     checkTwoCklicks(rMEvt);
797     m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
798     return bReturn;
799 }
800 
801 //----------------------------------------------------------------------------
802 
MouseMove(const MouseEvent & rMEvt)803 sal_Bool DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt )
804 {
805     if ( DlgEdFunc::MouseMove(rMEvt ) )
806         return sal_True;
807 	Point	aPos( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
808 
809     if ( m_rView.IsCreateObj() )
810 	{
811         m_rView.SetOrtho(SdrObjCustomShape::doConstructOrthogonal(m_rView.getReportSection()->getSectionWindow()->getViewsWindow()->getShapeType()) ? !rMEvt.IsShift() : rMEvt.IsShift());
812 		m_rView.SetAngleSnapEnabled(rMEvt.IsShift());
813     }
814 
815     bool bIsSetPoint = false;
816 	if ( m_rView.IsAction() )
817 	{
818 		if ( m_rView.IsDragResize() )
819 		{
820 		    // we resize the object don't resize to above sections
821 		    if ( aPos.Y() < 0 )
822 		    {
823         		aPos.Y() = 0;
824 		    }
825 		}
826         bIsSetPoint = setMovementPointer(rMEvt);
827 		ForceScroll(aPos);
828         m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPos,&m_rView, m_rView.GetDragMethod() == NULL, false);
829 	}
830 
831     //if ( isOver(m_rView.GetCreateObj(),*m_pParent->getPage(),*m_pView) )
832     //    m_pParent->SetPointer( Pointer(POINTER_NOTALLOWED));
833     //else
834     if ( !bIsSetPoint )
835 	    m_pParent->SetPointer( m_rView.GetPreferedPointer( aPos, m_pParent) );
836 
837 	return sal_True;
838 }
839 
840 //----------------------------------------------------------------------------
841 
DlgEdFuncSelect(OReportSection * _pParent)842 DlgEdFuncSelect::DlgEdFuncSelect( OReportSection* _pParent ) :
843 	DlgEdFunc( _pParent )
844 {
845 }
846 
847 //----------------------------------------------------------------------------
848 
~DlgEdFuncSelect()849 DlgEdFuncSelect::~DlgEdFuncSelect()
850 {
851 }
852 
853 //----------------------------------------------------------------------------
854 
MouseButtonDown(const MouseEvent & rMEvt)855 sal_Bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt )
856 {
857 	m_bSelectionMode = false;
858     if ( DlgEdFunc::MouseButtonDown(rMEvt) )
859         return sal_True;
860 
861     SdrViewEvent aVEvt;
862 	const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
863     if( eHit == SDRHIT_UNMARKEDOBJECT )
864 	{
865 		// if not multi selection, unmark all
866 		if ( !rMEvt.IsShift() )
867 			m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
868 
869 		if ( m_rView.MarkObj(m_aMDPos) && rMEvt.IsLeft() )
870 		{
871 			// drag object
872 			m_pParent->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos, m_rView.PickHandle(m_aMDPos), &m_rView);
873 		}
874 		else
875 		{
876 			// select object
877 			m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj(m_aMDPos,&m_rView);
878 		}
879 	}
880     else
881     {
882         if( !rMEvt.IsShift() )
883             m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
884 			//m_rView.UnmarkAll();
885 
886         if ( rMEvt.GetClicks() == 1 )
887 		{
888 			m_bSelectionMode = true;
889 		    m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos ,&m_rView);
890 		}
891         else
892         {
893             m_rView.SdrBeginTextEdit( aVEvt.pRootObj,m_rView.GetSdrPageView(),m_pParent,sal_False );
894         }
895     }
896 
897 	return sal_True;
898 }
899 
900 //----------------------------------------------------------------------------
901 
MouseButtonUp(const MouseEvent & rMEvt)902 sal_Bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent& rMEvt )
903 {
904 	if ( DlgEdFunc::MouseButtonUp( rMEvt ) )
905         return sal_True;
906 
907 	// get view from parent
908 	const Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
909 
910 	if ( rMEvt.IsLeft() )                     // left mousebutton pressed
911         checkMovementAllowed(rMEvt);
912 
913     m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
914     checkTwoCklicks(rMEvt);
915 
916 	m_pParent->SetPointer( m_rView.GetPreferedPointer( aPnt, m_pParent) );
917 
918     if ( !m_bUiActive )
919     	m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
920 	m_bSelectionMode = false;
921 	return sal_True;
922 }
923 
924 //----------------------------------------------------------------------------
925 
MouseMove(const MouseEvent & rMEvt)926 sal_Bool DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt )
927 {
928     if ( DlgEdFunc::MouseMove(rMEvt ) )
929         return sal_True;
930 
931 	Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
932     bool bIsSetPoint = false;
933 
934 	if ( m_rView.IsAction() ) // Drag Mode
935 	{
936         bIsSetPoint = setMovementPointer(rMEvt);
937 		ForceScroll(aPnt);
938 		if (m_rView.GetDragMethod()==NULL)
939 		{
940             // create a selection
941 			m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPnt, &m_rView, true, false);
942 		}
943 		else
944 		{
945             if ( m_rView.IsDragResize() )
946             {
947                 // we resize the object don't resize to above sections
948                 if ( aPnt.Y() < 0 )
949                 {
950                     aPnt.Y() = 0;
951                 }
952                 // grow section if it is under the current section
953 //                else
954 //                {
955 //                    const Size& aSectionSize = m_rView->GetSizePixel();
956 //                    if ( aPnt.Y() > aSectionSize.Height() )
957 //                    {
958 //                        aPnt.Y() = aSectionSize.Height();
959 //                    }
960 //                }
961             }
962             // drag or resize an object
963             bool bControlKey = rMEvt.IsMod1();
964 			m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPnt, &m_rView, false, bControlKey);
965 		}
966 	}
967 
968     if ( !bIsSetPoint )
969     {
970         m_pParent->SetPointer( m_rView.GetPreferedPointer( aPnt, m_pParent) );
971 
972 		// restore color
973 		unColorizeOverlappedObj();
974     }
975 
976 	return sal_True;
977 }
978 // -----------------------------------------------------------------------------
979 //void DlgEdFuncSelect::SetInEditMode(SdrTextObj* _pTextObj,const MouseEvent& rMEvt, sal_Bool bQuickDrag)
980 //{
981 //
982 //	SdrPageView* pPV = m_rView.GetSdrPageView();
983 //	if( _pTextObj && _pTextObj->GetPage() == pPV->GetPage() )
984 //	{
985 //		m_rView.SetCurrentObj(OBJ_TEXT);
986 //    	m_rView.SetEditMode(SDREDITMODE_EDIT);
987 //
988 //		sal_Bool bEmptyOutliner = sal_False;
989 //
990 //		if (!_pTextObj->GetOutlinerParaObject() && m_rView.GetTextEditOutliner())
991 //		{
992 //			::SdrOutliner* pOutl = m_rView.GetTextEditOutliner();
993 //			sal_uLong nParaAnz = pOutl->GetParagraphCount();
994 //			Paragraph* p1stPara = pOutl->GetParagraph( 0 );
995 //
996 //			if (nParaAnz==1 && p1stPara)
997 //			{
998 //				// Bei nur einem Pararaph
999 //				if (pOutl->GetText(p1stPara).Len() == 0)
1000 //				{
1001 //					bEmptyOutliner = sal_True;
1002 //				}
1003 //			}
1004 //		}
1005 //
1006 //		if (_pTextObj != m_rView.GetTextEditObject() || bEmptyOutliner)
1007 //		{
1008 //			sal_uInt32 nInv = _pTextObj->GetObjInventor();
1009 //			sal_uInt16 nSdrObjKind = _pTextObj->GetObjIdentifier();
1010 //
1011 //			if (nInv == SdrInventor && _pTextObj->HasTextEdit() &&
1012 //				(nSdrObjKind == OBJ_TEXT ||
1013 //			 	nSdrObjKind == OBJ_TITLETEXT ||
1014 //			 	nSdrObjKind == OBJ_OUTLINETEXT ||
1015 //			 	(_pTextObj->ISA(SdrTextObj) && !_pTextObj->IsEmptyPresObj())))
1016 //			{
1017 //				// Neuen Outliner machen (gehoert der SdrObjEditView)
1018 //                SdrModel* pModel = _pTextObj->GetModel();
1019 //                SdrOutliner* pOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, pModel );
1020 //				pOutl->SetMinDepth(0);
1021 //				pOutl->SetStyleSheetPool((SfxStyleSheetPool*) pModel->GetStyleSheetPool());
1022 //				//pOutl->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl));
1023 //				sal_uLong nCntrl = pOutl->GetControlWord();
1024 //				nCntrl |= EE_CNTRL_ALLOWBIGOBJS;
1025 //				nCntrl |= EE_CNTRL_URLSFXEXECUTE;
1026 //				nCntrl |= EE_CNTRL_MARKFIELDS;
1027 //				nCntrl |= EE_CNTRL_AUTOCORRECT;
1028 //
1029 //				nCntrl &= ~EE_CNTRL_ULSPACESUMMATION;
1030 //				//if ( pModel->IsSummationOfParagraphs() )
1031 //				//    nCntrl |= EE_CNTRL_ULSPACESUMMATION;
1032 //
1033 //				//SetSpellOptions( nCntrl );
1034 //
1035 //				pOutl->SetControlWord(nCntrl);
1036 //
1037 //                uno::Reference< linguistic2::XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
1038 //	            if ( xSpellChecker.is() )
1039 //		            pOutl->SetSpeller( xSpellChecker );
1040 //
1041 //                uno::Reference< linguistic2::XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
1042 //	            if( xHyphenator.is() )
1043 //		            pOutl->SetHyphenator( xHyphenator );
1044 //
1045 //				pOutl->SetDefaultLanguage( Application::GetSettings().GetLanguage() );
1046 //
1047 //				// in einem Gliederungstext darf nicht auf die 0-te
1048 //				// Ebene ausgerueckt werden
1049 //				if (_pTextObj->GetObjInventor() == SdrInventor &&
1050 //					_pTextObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
1051 //				{
1052 //					pOutl->SetMinDepth(1);
1053 //				}
1054 //
1055 //				if (bEmptyOutliner)
1056 //				{
1057 //					m_rView.SdrEndTextEdit(sal_True);
1058 //				}
1059 //
1060 //				if( _pTextObj )
1061 //				{
1062 //					OutlinerParaObject* pOPO = _pTextObj->GetOutlinerParaObject();
1063 //					if( ( pOPO && pOPO->IsVertical() ) /*||
1064 //						nSlotId == SID_ATTR_CHAR_VERTICAL ||
1065 //						nSlotId == SID_TEXT_FITTOSIZE_VERTICAL */)
1066 //						pOutl->SetVertical( sal_True );
1067 //
1068 //
1069 //					if (m_rView.SdrBeginTextEdit(_pTextObj, pPV, pParent, sal_True, pOutl) && _pTextObj->GetObjInventor() == SdrInventor)
1070 //					{
1071 //						//bFirstObjCreated = sal_True;
1072 //						//DeleteDefaultText();
1073 //
1074 //						OutlinerView* pOLV = m_rView.GetTextEditOutlinerView();
1075 //
1076 //						nSdrObjKind = _pTextObj->GetObjIdentifier();
1077 //
1078 //						SdrViewEvent aVEvt;
1079 //						SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
1080 //
1081 //						if (eHit == SDRHIT_TEXTEDIT)
1082 //						{
1083 //							// Text getroffen
1084 //							if (nSdrObjKind == OBJ_TEXT ||
1085 //								nSdrObjKind == OBJ_TITLETEXT ||
1086 //								nSdrObjKind == OBJ_OUTLINETEXT ||
1087 //								//nSlotId == SID_TEXTEDIT ||
1088 //								!bQuickDrag)
1089 //							{
1090 //								pOLV->MouseButtonDown(rMEvt);
1091 //								pOLV->MouseMove(rMEvt);
1092 //								pOLV->MouseButtonUp(rMEvt);
1093 //							}
1094 //
1095 //							if ( bQuickDrag && _pTextObj->GetOutlinerParaObject())
1096 //							{
1097 //								pOLV->MouseButtonDown(rMEvt);
1098 //							}
1099 //						}
1100 //						else
1101 //						{
1102 //							// #98198# Move cursor to end of text
1103 //							ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
1104 //							pOLV->SetSelection(aNewSelection);
1105 //						}
1106 //					}
1107 //					else
1108 //					{
1109 //						//RestoreDefaultText();
1110 //					}
1111 //				}
1112 //			}
1113 //		}
1114 //	}
1115 //	else
1116 //		_pTextObj = NULL;
1117 //}
1118 
1119 
1120 //----------------------------------------------------------------------------
1121 }
1122