1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #include <vcl/scrbar.hxx>
20 #include <vcl/svapp.hxx>
21 #include <vcl/seleng.hxx>
22 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
23 #include <com/sun/star/embed/EmbedStates.hpp>
24 #include <com/sun/star/embed/XEmbeddedObject.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <svx/svdview.hxx>
28 #include <svx/svdpagv.hxx>
29 #include <editeng/outlobj.hxx>
30 #include <editeng/unolingu.hxx>
31 #include <svx/svdetc.hxx>
32 #include <editeng/editstat.hxx>
33 #include <svx/svdoutl.hxx>
34 #include <svx/svddrgmt.hxx>
35 #include <svx/svdoashp.hxx>
36 #include <svx/svxids.hrc>
37 #include <svx/svditer.hxx>
39 #include <toolkit/helper/vclunohelper.hxx>
41 #include "dlgedfunc.hxx"
42 #include "ReportSection.hxx"
43 #include "DesignView.hxx"
44 #include "ReportController.hxx"
45 #include "SectionView.hxx"
46 #include "ViewsWindow.hxx"
47 #include "ReportWindow.hxx"
48 #include "RptObject.hxx"
49 #include "ScrollHelper.hxx"
50 #include "UITools.hxx"
52 #include <uistrings.hrc>
53 #include "UndoEnv.hxx"
54 #include <RptModel.hxx>
55 #include <tools/diagnose_ex.h>
57 #define DEFAUL_MOVE_SIZE 100
60 using namespace ::com::sun::star
;
65 IMPL_LINK_NOARG_TYPED( DlgEdFunc
, ScrollTimeout
, Timer
*, void )
67 ForceScroll( m_pParent
->PixelToLogic( m_pParent
->GetPointerPosPixel() ) );
72 void DlgEdFunc::ForceScroll( const Point
& rPos
)
76 OReportWindow
* pReportWindow
= m_pParent
->getSectionWindow()->getViewsWindow()->getView();
77 OScrollWindowHelper
* pScrollWindow
= pReportWindow
->getScrollWindow();
79 Size aOut
= pReportWindow
->GetOutputSizePixel();
80 Fraction
aStartWidth(long(REPORT_STARTMARKER_WIDTH
));
81 aStartWidth
*= m_pParent
->GetMapMode().GetScaleX();
83 aOut
.Width() -= (long)aStartWidth
;
84 aOut
.Height() = m_pParent
->GetOutputSizePixel().Height();
86 Point aPos
= pScrollWindow
->getThumbPos();
89 Rectangle
aOutRect( aPos
, aOut
);
90 aOutRect
= m_pParent
->PixelToLogic( aOutRect
);
91 Rectangle
aWorkArea(Point(), pScrollWindow
->getTotalSize());
92 aWorkArea
.Right() -= (long)aStartWidth
;
93 aWorkArea
= pScrollWindow
->PixelToLogic( aWorkArea
);
94 if( !aOutRect
.IsInside( rPos
) && aWorkArea
.IsInside( rPos
) )
96 ScrollBar
& rHScroll
= pScrollWindow
->GetHScroll();
97 ScrollBar
& rVScroll
= pScrollWindow
->GetVScroll();
98 ScrollType eH
= SCROLL_LINEDOWN
,eV
= SCROLL_LINEDOWN
;
99 if( rPos
.X() < aOutRect
.Left() )
101 else if( rPos
.X() <= aOutRect
.Right() )
102 eH
= SCROLL_DONTKNOW
;
104 if( rPos
.Y() < aOutRect
.Top() )
106 else if( rPos
.Y() <= aOutRect
.Bottom() )
107 eV
= SCROLL_DONTKNOW
;
109 rHScroll
.DoScrollAction(eH
);
110 rVScroll
.DoScrollAction(eV
);
113 aScrollTimer
.Start();
116 DlgEdFunc::DlgEdFunc( OReportSection
* _pParent
)
117 : m_pParent(_pParent
)
118 , m_rView(_pParent
->getSectionView())
119 , m_xOverlappingObj(NULL
)
120 , m_pOverlappingObj(NULL
)
121 , m_nOverlappedControlColor(0)
123 , m_bSelectionMode(false)
125 , m_bShowPropertyBrowser(false)
127 aScrollTimer
.SetTimeoutHdl( LINK( this, DlgEdFunc
, ScrollTimeout
) );
128 m_rView
.SetActualWin( m_pParent
);
129 aScrollTimer
.SetTimeout( SELENG_AUTOREPEAT_INTERVAL
);
132 void DlgEdFunc::setOverlappedControlColor(sal_Int32 _nColor
)
134 m_nOverlappedControlColor
= _nColor
;
137 sal_Int32
lcl_setColorOfObject(uno::Reference
< uno::XInterface
> _xObj
, long _nColorTRGB
)
139 sal_Int32 nBackColor
= 0;
142 uno::Reference
<report::XReportComponent
> xComponent(_xObj
, uno::UNO_QUERY_THROW
);
143 uno::Reference
< beans::XPropertySet
> xProp(xComponent
, uno::UNO_QUERY_THROW
);
144 uno::Any aAny
= xProp
->getPropertyValue(PROPERTY_CONTROLBACKGROUND
);
148 // try to set background color at the ReportComponent
149 uno::Any aBlackColorAny
= uno::makeAny(_nColorTRGB
);
150 xProp
->setPropertyValue(PROPERTY_CONTROLBACKGROUND
, aBlackColorAny
);
153 catch(uno::Exception
&)
159 DlgEdFunc::~DlgEdFunc()
161 unColorizeOverlappedObj();
167 bool DlgEdFunc::MouseButtonDown( const MouseEvent
& rMEvt
)
169 m_aMDPos
= m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() );
170 m_pParent
->GrabFocus();
171 bool bHandled
= false;
172 if ( rMEvt
.IsLeft() )
174 if ( rMEvt
.GetClicks() > 1 )
176 // show property browser
177 if ( m_pParent
->GetMode() != RPTUI_READONLY
)
179 uno::Sequence
<beans::PropertyValue
> aArgs(1);
180 aArgs
[0].Name
= "ShowProperties";
181 aArgs
[0].Value
<<= sal_True
;
182 m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController().executeUnChecked(SID_SHOW_PROPERTYBROWSER
,aArgs
);
183 m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView
);
184 // TODO character in shapes
185 // SdrViewEvent aVEvt;
186 // m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
187 // if ( aVEvt.pRootObj && aVEvt.pRootObj->ISA(SdrTextObj) )
188 // SetInEditMode(static_cast<SdrTextObj *>(aVEvt.pRootObj),rMEvt, sal_False);
194 SdrHdl
* pHdl
= m_rView
.PickHandle(m_aMDPos
);
196 // if selected object was hit, drag object
197 if ( pHdl
!=NULL
|| m_rView
.IsMarkedHit(m_aMDPos
) )
200 m_pParent
->CaptureMouse();
201 m_pParent
->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos
, pHdl
,&m_rView
);
205 else if ( rMEvt
.IsRight() && !rMEvt
.IsLeft() && rMEvt
.GetClicks() == 1 ) // mark object when context menu was selected
207 SdrPageView
* pPV
= m_rView
.GetSdrPageView();
209 if ( m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
) != SDRHIT_MARKEDOBJECT
&& !rMEvt
.IsShift() )
210 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL
);
211 if ( aVEvt
.pRootObj
)
212 m_rView
.MarkObj(aVEvt
.pRootObj
, pPV
);
214 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL
);
218 else if( !rMEvt
.IsLeft() )
221 m_pParent
->CaptureMouse();
227 bool DlgEdFunc::MouseButtonUp( const MouseEvent
& /*rMEvt*/ )
229 bool bHandled
= false;
230 m_pParent
->getSectionWindow()->getViewsWindow()->stopScrollTimer();
234 void DlgEdFunc::checkTwoCklicks(const MouseEvent
& rMEvt
)
238 const sal_uInt16 nClicks
= rMEvt
.GetClicks();
239 if ( nClicks
== 2 && rMEvt
.IsLeft() )
241 if ( m_rView
.AreObjectsMarked() )
243 const SdrMarkList
& rMarkList
= m_rView
.GetMarkedObjectList();
244 if (rMarkList
.GetMarkCount() == 1)
246 const SdrMark
* pMark
= rMarkList
.GetMark(0);
247 SdrObject
* pObj
= pMark
->GetMarkedSdrObj();
254 void DlgEdFunc::stopScrollTimer()
256 unColorizeOverlappedObj();
258 if ( m_pParent
->IsMouseCaptured() )
259 m_pParent
->ReleaseMouse();
263 bool DlgEdFunc::MouseMove( const MouseEvent
& /*rMEvt*/ )
268 bool DlgEdFunc::handleKeyEvent(const KeyEvent
& _rEvent
)
270 bool bReturn
= false;
274 const vcl::KeyCode
& rCode
= _rEvent
.GetKeyCode();
275 sal_uInt16 nCode
= rCode
.GetCode();
281 if ( m_pParent
->getSectionWindow()->getViewsWindow()->IsAction() )
283 m_pParent
->getSectionWindow()->getViewsWindow()->BrkAction();
286 else if ( m_rView
.IsTextEdit() )
288 m_rView
.SdrEndTextEdit();
291 else if ( m_rView
.AreObjectsMarked() )
293 const SdrHdlList
& rHdlList
= m_rView
.GetHdlList();
294 SdrHdl
* pHdl
= rHdlList
.GetFocusHdl();
296 ((SdrHdlList
&)rHdlList
).ResetFocusHdl();
298 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL
);
311 if ( !rCode
.IsMod1() && !rCode
.IsMod2() )
314 if ( !m_rView
.MarkNextObj( !rCode
.IsShift() ) )
316 // if no next object, mark first/last
317 m_rView
.UnmarkAllObj();
318 m_rView
.MarkNextObj( !rCode
.IsShift() );
321 if ( m_rView
.AreObjectsMarked() )
322 m_rView
.MakeVisible( m_rView
.GetAllMarkedRect(), *m_pParent
);
326 else if ( rCode
.IsMod1() && rCode
.IsMod2())
329 const SdrHdlList
& rHdlList
= m_rView
.GetHdlList();
330 ((SdrHdlList
&)rHdlList
).TravelFocusHdl( !rCode
.IsShift() );
332 // guarantee visibility of focused handle
333 SdrHdl
* pHdl
= rHdlList
.GetFocusHdl();
336 Point
aHdlPosition( pHdl
->GetPos() );
337 Rectangle
aVisRect( aHdlPosition
- Point( DEFAUL_MOVE_SIZE
, DEFAUL_MOVE_SIZE
), Size( 200, 200 ) );
338 m_rView
.MakeVisible( aVisRect
, *m_pParent
);
350 m_pParent
->getSectionWindow()->getViewsWindow()->handleKey(rCode
);
355 if ( !rCode
.IsMod1() )
357 const SdrMarkList
& rMarkList
= m_rView
.GetMarkedObjectList();
358 if ( rMarkList
.GetMarkCount() == 1 )
360 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
366 if ( !rCode
.IsMod1() && !rCode
.IsMod2() )
374 bReturn
= m_rView
.KeyInput(_rEvent
, m_pParent
);
380 if ( bReturn
&& m_pParent
->IsMouseCaptured() )
381 m_pParent
->ReleaseMouse();
386 void DlgEdFunc::activateOle(SdrObject
* _pObj
)
390 const sal_uInt16 nSdrObjKind
= _pObj
->GetObjIdentifier();
394 if (nSdrObjKind
== OBJ_OLE2
)
396 bool bIsInplaceOle
= false;
399 SdrOle2Obj
* pOleObj
= dynamic_cast<SdrOle2Obj
*>(_pObj
);
400 if (pOleObj
&& pOleObj
->GetObjRef().is())
402 if (m_rView
.IsTextEdit())
404 m_rView
.SdrEndTextEdit();
407 pOleObj
->AddOwnLightClient();
408 pOleObj
->SetWindow(VCLUnoHelper::GetInterface(m_pParent
));
411 pOleObj
->GetObjRef()->changeState( embed::EmbedStates::UI_ACTIVE
);
413 OReportController
& rController
= m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
414 m_bShowPropertyBrowser
= rController
.isCommandChecked(SID_SHOW_PROPERTYBROWSER
);
415 if ( m_bShowPropertyBrowser
)
416 rController
.executeChecked(SID_SHOW_PROPERTYBROWSER
,uno::Sequence
< beans::PropertyValue
>());
418 catch( uno::Exception
& )
420 DBG_UNHANDLED_EXCEPTION();
428 void DlgEdFunc::deactivateOle(bool _bSelect
)
430 OLEObjCache
& rObjCache
= GetSdrGlobalData().GetOLEObjCache();
431 OReportController
& rController
= m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
432 const sal_uLong nCount
= rObjCache
.size();
433 for(sal_uLong i
= 0 ; i
< nCount
;++i
)
435 SdrOle2Obj
* pObj
= rObjCache
[i
];
436 if ( m_pParent
->getPage() == pObj
->GetPage() )
438 uno::Reference
< embed::XEmbeddedObject
> xObj
= pObj
->GetObjRef();
439 if ( xObj
.is() && xObj
->getCurrentState() == embed::EmbedStates::UI_ACTIVE
)
441 xObj
->changeState( embed::EmbedStates::RUNNING
);
443 if ( m_bShowPropertyBrowser
)
445 rController
.executeChecked(SID_SHOW_PROPERTYBROWSER
,uno::Sequence
< beans::PropertyValue
>());
450 SdrPageView
* pPV
= m_rView
.GetSdrPageView();
451 m_rView
.MarkObj(pObj
, pPV
);
458 void DlgEdFunc::colorizeOverlappedObject(SdrObject
* _pOverlappedObj
)
460 OObjectBase
* pObj
= dynamic_cast<OObjectBase
*>(_pOverlappedObj
);
463 uno::Reference
<report::XReportComponent
> xComponent
= pObj
->getReportComponent();
464 if (xComponent
.is() && xComponent
!= m_xOverlappingObj
)
466 OReportModel
* pRptModel
= static_cast<OReportModel
*>(_pOverlappedObj
->GetModel());
469 OXUndoEnvironment::OUndoEnvLock
aLock(pRptModel
->GetUndoEnv());
471 // uncolorize an old object, if there is one
472 unColorizeOverlappedObj();
474 m_nOldColor
= lcl_setColorOfObject(xComponent
, m_nOverlappedControlColor
);
475 m_xOverlappingObj
= xComponent
;
476 m_pOverlappingObj
= _pOverlappedObj
;
482 void DlgEdFunc::unColorizeOverlappedObj()
484 // uncolorize an old object, if there is one
485 if (m_xOverlappingObj
.is())
487 OReportModel
* pRptModel
= static_cast<OReportModel
*>(m_pOverlappingObj
->GetModel());
490 OXUndoEnvironment::OUndoEnvLock
aLock(pRptModel
->GetUndoEnv());
492 lcl_setColorOfObject(m_xOverlappingObj
, m_nOldColor
);
493 m_xOverlappingObj
= NULL
;
494 m_pOverlappingObj
= NULL
;
499 bool DlgEdFunc::isOverlapping(const MouseEvent
& rMEvt
)
502 bool bOverlapping
= m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONUP
, aVEvt
) != SDRHIT_NONE
;
503 if (bOverlapping
&& aVEvt
.pObj
)
505 colorizeOverlappedObject(aVEvt
.pObj
);
509 unColorizeOverlappedObj();
515 void DlgEdFunc::checkMovementAllowed(const MouseEvent
& rMEvt
)
517 if ( m_pParent
->getSectionWindow()->getViewsWindow()->IsDragObj() )
519 if ( isRectangleHit(rMEvt
) )
521 // there is an other component under use, break action
522 m_pParent
->getSectionWindow()->getViewsWindow()->BrkAction();
524 // object was dragged
525 Point
aPnt( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
526 if (m_bSelectionMode
)
528 m_pParent
->getSectionWindow()->getViewsWindow()->EndAction();
532 bool bControlKeyPressed
= rMEvt
.IsMod1();
533 // Don't allow points smaller 0
534 if (bControlKeyPressed
&& (aPnt
.Y() < 0))
538 if (m_rView
.IsDragResize())
540 // we resize the object don't resize to above sections
546 m_pParent
->getSectionWindow()->getViewsWindow()->EndDragObj( bControlKeyPressed
, &m_rView
, aPnt
);
548 m_pParent
->getSectionWindow()->getViewsWindow()->ForceMarkedToAnotherPage();
549 m_pParent
->Invalidate(INVALIDATE_CHILDREN
);
552 m_pParent
->getSectionWindow()->getViewsWindow()->EndAction();
555 bool DlgEdFunc::isOnlyCustomShapeMarked()
558 const SdrMarkList
& rMarkList
= m_rView
.GetMarkedObjectList();
559 for (size_t i
= 0; i
< rMarkList
.GetMarkCount(); ++i
)
561 SdrMark
* pMark
= rMarkList
.GetMark(i
);
562 SdrObject
* pObj
= pMark
->GetMarkedSdrObj();
563 if (pObj
->GetObjIdentifier() != OBJ_CUSTOMSHAPE
)
565 // we found an object in the marked objects, which is not a custom shape.
573 bool DlgEdFunc::isRectangleHit(const MouseEvent
& rMEvt
)
575 if (isOnlyCustomShapeMarked())
581 const SdrHitKind eHit
= m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::MOVE
, aVEvt
);
582 bool bIsSetPoint
= (eHit
== SDRHIT_UNMARKEDOBJECT
);
585 // no drag rect, we have to check every single select rect
586 const SdrDragStat
& rDragStat
= m_rView
.GetDragStat();
587 if (rDragStat
.GetDragMethod() != NULL
)
589 SdrObjListIter
aIter(*m_pParent
->getPage(),IM_DEEPNOGROUPS
);
590 SdrObject
* pObjIter
= NULL
;
591 // loop through all marked objects and check if there new rect overlapps an old one.
592 while( (pObjIter
= aIter
.Next()) != NULL
&& !bIsSetPoint
)
594 if ( m_rView
.IsObjMarked(pObjIter
)
595 && (dynamic_cast<OUnoObject
*>(pObjIter
) != NULL
|| dynamic_cast<OOle2Obj
*>(pObjIter
) != NULL
) )
597 Rectangle aNewRect
= pObjIter
->GetLastBoundRect();
598 long nDx
= rDragStat
.IsHorFixed() ? 0 : rDragStat
.GetDX();
599 long nDy
= rDragStat
.IsVerFixed() ? 0 : rDragStat
.GetDY();
600 if ( (nDx
+ aNewRect
.Left()) < 0 )
601 nDx
= -aNewRect
.Left();
602 if ( (nDy
+ aNewRect
.Top()) < 0 )
603 nDy
= -aNewRect
.Top();
605 if ( rDragStat
.GetDragMethod()->getMoveOnly() )
606 aNewRect
.Move(nDx
,nDy
);
608 ::ResizeRect(aNewRect
,rDragStat
.GetRef1(),rDragStat
.GetXFact(),rDragStat
.GetYFact());
611 SdrObject
* pObjOverlapped
= isOver(aNewRect
,*m_pParent
->getPage(),m_rView
,false,pObjIter
, ISOVER_IGNORE_CUSTOMSHAPES
);
612 bIsSetPoint
= pObjOverlapped
!= nullptr;
613 if (pObjOverlapped
&& !m_bSelectionMode
)
615 colorizeOverlappedObject(pObjOverlapped
);
621 else if ( aVEvt
.pObj
&& (aVEvt
.pObj
->GetObjIdentifier() != OBJ_CUSTOMSHAPE
) && !m_bSelectionMode
)
623 colorizeOverlappedObject(aVEvt
.pObj
);
630 bool DlgEdFunc::setMovementPointer(const MouseEvent
& rMEvt
)
632 bool bIsSetPoint
= isRectangleHit(rMEvt
);
634 m_pParent
->SetPointer( Pointer(PointerStyle::NotAllowed
));
637 bool bCtrlKey
= rMEvt
.IsMod1();
641 m_pParent
->SetPointer( Pointer(PointerStyle::MoveDataLink
));
649 DlgEdFuncInsert::DlgEdFuncInsert( OReportSection
* _pParent
) :
650 DlgEdFunc( _pParent
)
652 m_rView
.SetCreateMode( true );
657 DlgEdFuncInsert::~DlgEdFuncInsert()
659 m_rView
.SetEditMode( true );
664 bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent
& rMEvt
)
666 if ( DlgEdFunc::MouseButtonDown(rMEvt
) )
670 sal_Int16 nId
= m_rView
.GetCurrentObjIdentifier();
672 const SdrHitKind eHit
= m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
674 if (eHit
== SDRHIT_UNMARKEDOBJECT
&& nId
!= OBJ_CUSTOMSHAPE
)
676 // there is an object under the mouse cursor, but not a customshape
677 m_pParent
->getSectionWindow()->getViewsWindow()->BrkAction();
681 // if no action, create object
682 if (!m_pParent
->getSectionWindow()->getViewsWindow()->IsAction())
685 if ( m_pParent
->getSectionWindow()->getViewsWindow()->HasSelection() )
686 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(&m_rView
);
687 m_rView
.BegCreateObj(m_aMDPos
);
688 m_pParent
->getSectionWindow()->getViewsWindow()->createDefault();
695 bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent
& rMEvt
)
697 if ( DlgEdFunc::MouseButtonUp( rMEvt
) )
700 const Point
aPos( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
701 const sal_uInt16 nHitLog
= sal_uInt16 ( m_pParent
->PixelToLogic(Size(3,0)).Width() );
704 // object creation active?
705 if ( m_rView
.IsCreateObj() )
707 if ( isOver(m_rView
.GetCreateObj(),*m_pParent
->getPage(),m_rView
) )
709 m_pParent
->getSectionWindow()->getViewsWindow()->BrkAction();
710 // BrkAction disables the create mode
711 m_rView
.SetCreateMode( true );
715 m_rView
.EndCreateObj(SDRCREATE_FORCEEND
);
717 if ( !m_rView
.AreObjectsMarked() )
719 m_rView
.MarkObj(aPos
, nHitLog
);
722 bReturn
= m_rView
.AreObjectsMarked();
725 OReportController
& rController
= m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
726 const SdrMarkList
& rMarkList
= m_rView
.GetMarkedObjectList();
727 for (size_t i
= 0; i
< rMarkList
.GetMarkCount(); ++i
)
729 SdrMark
* pMark
= rMarkList
.GetMark(i
);
730 OOle2Obj
* pObj
= dynamic_cast<OOle2Obj
*>(pMark
->GetMarkedSdrObj());
731 if ( pObj
&& !pObj
->IsEmpty() )
733 pObj
->initializeChart(rController
.getModel());
739 checkMovementAllowed(rMEvt
);
741 if ( !m_rView
.AreObjectsMarked() &&
742 std::abs(m_aMDPos
.X() - aPos
.X()) < nHitLog
&&
743 std::abs(m_aMDPos
.Y() - aPos
.Y()) < nHitLog
&&
744 !rMEvt
.IsShift() && !rMEvt
.IsMod2() )
746 SdrPageView
* pPV
= m_rView
.GetSdrPageView();
748 m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
749 m_rView
.MarkObj(aVEvt
.pRootObj
, pPV
);
751 checkTwoCklicks(rMEvt
);
752 m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView
);
758 bool DlgEdFuncInsert::MouseMove( const MouseEvent
& rMEvt
)
760 if ( DlgEdFunc::MouseMove(rMEvt
) )
762 Point
aPos( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
764 if ( m_rView
.IsCreateObj() )
766 m_rView
.SetOrtho(SdrObjCustomShape::doConstructOrthogonal(m_rView
.getReportSection()->getSectionWindow()->getViewsWindow()->getShapeType()) ? !rMEvt
.IsShift() : rMEvt
.IsShift());
767 m_rView
.SetAngleSnapEnabled(rMEvt
.IsShift());
770 bool bIsSetPoint
= false;
771 if ( m_rView
.IsAction() )
773 if ( m_rView
.IsDragResize() )
775 // we resize the object don't resize to above sections
781 bIsSetPoint
= setMovementPointer(rMEvt
);
783 m_pParent
->getSectionWindow()->getViewsWindow()->MovAction(aPos
,&m_rView
, m_rView
.GetDragMethod() == NULL
, false);
787 m_pParent
->SetPointer( m_rView
.GetPreferredPointer( aPos
, m_pParent
) );
794 DlgEdFuncSelect::DlgEdFuncSelect( OReportSection
* _pParent
) :
795 DlgEdFunc( _pParent
)
801 DlgEdFuncSelect::~DlgEdFuncSelect()
807 bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent
& rMEvt
)
809 m_bSelectionMode
= false;
810 if ( DlgEdFunc::MouseButtonDown(rMEvt
) )
814 const SdrHitKind eHit
= m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
815 if( eHit
== SDRHIT_UNMARKEDOBJECT
)
817 // if not multi selection, unmark all
818 if ( !rMEvt
.IsShift() )
819 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL
);
821 if ( m_rView
.MarkObj(m_aMDPos
) && rMEvt
.IsLeft() )
824 m_pParent
->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos
, m_rView
.PickHandle(m_aMDPos
), &m_rView
);
829 m_pParent
->getSectionWindow()->getViewsWindow()->BegMarkObj(m_aMDPos
,&m_rView
);
834 if( !rMEvt
.IsShift() )
835 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL
);
837 if ( rMEvt
.GetClicks() == 1 )
839 m_bSelectionMode
= true;
840 m_pParent
->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos
,&m_rView
);
844 m_rView
.SdrBeginTextEdit( aVEvt
.pRootObj
,m_rView
.GetSdrPageView(),m_pParent
, false );
853 bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent
& rMEvt
)
855 if ( DlgEdFunc::MouseButtonUp( rMEvt
) )
858 // get view from parent
859 const Point
aPnt( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
861 if ( rMEvt
.IsLeft() ) // left mousebutton pressed
862 checkMovementAllowed(rMEvt
);
864 m_pParent
->getSectionWindow()->getViewsWindow()->EndAction();
865 checkTwoCklicks(rMEvt
);
867 m_pParent
->SetPointer( m_rView
.GetPreferredPointer( aPnt
, m_pParent
) );
870 m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView
);
871 m_bSelectionMode
= false;
877 bool DlgEdFuncSelect::MouseMove( const MouseEvent
& rMEvt
)
879 if ( DlgEdFunc::MouseMove(rMEvt
) )
882 Point
aPnt( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
883 bool bIsSetPoint
= false;
885 if ( m_rView
.IsAction() ) // Drag Mode
887 bIsSetPoint
= setMovementPointer(rMEvt
);
889 if (m_rView
.GetDragMethod()==NULL
)
891 // create a selection
892 m_pParent
->getSectionWindow()->getViewsWindow()->MovAction(aPnt
, &m_rView
, true, false);
896 if ( m_rView
.IsDragResize() )
898 // we resize the object don't resize to above sections
904 // drag or resize an object
905 bool bControlKey
= rMEvt
.IsMod1();
906 m_pParent
->getSectionWindow()->getViewsWindow()->MovAction(aPnt
, &m_rView
, false, bControlKey
);
912 m_pParent
->SetPointer( m_rView
.GetPreferredPointer( aPnt
, m_pParent
) );
915 unColorizeOverlappedObj();
924 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */