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/seleng.hxx>
21 #include <vcl/ptrstyle.hxx>
22 #include <com/sun/star/embed/EmbedStates.hpp>
23 #include <com/sun/star/embed/XEmbeddedObject.hpp>
24 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <svx/svdview.hxx>
27 #include <svx/svdpagv.hxx>
28 #include <svx/svdetc.hxx>
29 #include <svx/svddrgmt.hxx>
30 #include <svx/svdoashp.hxx>
31 #include <svx/svxids.hrc>
32 #include <svx/svditer.hxx>
34 #include <toolkit/helper/vclunohelper.hxx>
36 #include <dlgedfunc.hxx>
37 #include <ReportSection.hxx>
38 #include <DesignView.hxx>
39 #include <ReportController.hxx>
40 #include <SectionView.hxx>
41 #include <ViewsWindow.hxx>
42 #include <ReportWindow.hxx>
43 #include <RptObject.hxx>
44 #include <ScrollHelper.hxx>
45 #include <UITools.hxx>
47 #include <strings.hxx>
48 #include <UndoEnv.hxx>
49 #include <RptModel.hxx>
50 #include <comphelper/propertysequence.hxx>
51 #include <tools/diagnose_ex.h>
53 #define DEFAUL_MOVE_SIZE 100
56 using namespace ::com::sun::star
;
59 IMPL_LINK_NOARG( DlgEdFunc
, ScrollTimeout
, Timer
*, void )
61 ForceScroll( m_pParent
->PixelToLogic( m_pParent
->GetPointerPosPixel() ) );
65 void DlgEdFunc::ForceScroll( const Point
& rPos
)
69 OReportWindow
* pReportWindow
= m_pParent
->getSectionWindow()->getViewsWindow()->getView();
70 OScrollWindowHelper
* pScrollWindow
= pReportWindow
->getScrollWindow();
72 Size aOut
= pReportWindow
->GetOutputSizePixel();
73 Fraction
aStartWidth(tools::Long(REPORT_STARTMARKER_WIDTH
));
74 aStartWidth
*= m_pParent
->GetMapMode().GetScaleX();
76 aOut
.AdjustWidth( -static_cast<tools::Long
>(aStartWidth
) );
77 aOut
.setHeight( m_pParent
->GetOutputSizePixel().Height() );
79 Point aPos
= pScrollWindow
->getThumbPos();
80 aPos
.setX( aPos
.X() * 0.5 );
81 aPos
.setY( aPos
.Y() * 0.5 );
82 tools::Rectangle
aOutRect( aPos
, aOut
);
83 aOutRect
= m_pParent
->PixelToLogic( aOutRect
);
84 tools::Rectangle
aWorkArea(Point(), pScrollWindow
->getTotalSize());
85 aWorkArea
.AdjustRight( -static_cast<tools::Long
>(aStartWidth
) );
86 aWorkArea
= pScrollWindow
->PixelToLogic( aWorkArea
);
87 if( !aOutRect
.Contains( rPos
) && aWorkArea
.Contains( rPos
) )
89 ScrollBar
& rHScroll
= pScrollWindow
->GetHScroll();
90 ScrollBar
& rVScroll
= pScrollWindow
->GetVScroll();
91 ScrollType eH
= ScrollType::LineDown
,eV
= ScrollType::LineDown
;
92 if( rPos
.X() < aOutRect
.Left() )
93 eH
= ScrollType::LineUp
;
94 else if( rPos
.X() <= aOutRect
.Right() )
95 eH
= ScrollType::DontKnow
;
97 if( rPos
.Y() < aOutRect
.Top() )
98 eV
= ScrollType::LineUp
;
99 else if( rPos
.Y() <= aOutRect
.Bottom() )
100 eV
= ScrollType::DontKnow
;
102 rHScroll
.DoScrollAction(eH
);
103 rVScroll
.DoScrollAction(eV
);
106 aScrollTimer
.Start();
109 DlgEdFunc::DlgEdFunc( OReportSection
* _pParent
)
110 : m_pParent(_pParent
)
111 , m_rView(_pParent
->getSectionView())
112 , aScrollTimer("reportdesign DlgEdFunc aScrollTimer")
113 , m_pOverlappingObj(nullptr)
114 , m_nOverlappedControlColor(0)
116 , m_bSelectionMode(false)
118 , m_bShowPropertyBrowser(false)
120 aScrollTimer
.SetInvokeHandler( LINK( this, DlgEdFunc
, ScrollTimeout
) );
121 m_rView
.SetActualWin( m_pParent
->GetOutDev() );
122 aScrollTimer
.SetTimeout( SELENG_AUTOREPEAT_INTERVAL
);
125 void DlgEdFunc::setOverlappedControlColor(Color _nColor
)
127 m_nOverlappedControlColor
= _nColor
;
130 static Color
lcl_setColorOfObject(const uno::Reference
< uno::XInterface
>& _xObj
, Color _nColorTRGB
)
135 uno::Reference
<report::XReportComponent
> xComponent(_xObj
, uno::UNO_QUERY_THROW
);
136 uno::Reference
< beans::XPropertySet
> xProp(xComponent
, uno::UNO_QUERY_THROW
);
137 uno::Any aAny
= xProp
->getPropertyValue(PROPERTY_CONTROLBACKGROUND
);
141 // try to set background color at the ReportComponent
142 uno::Any aBlackColorAny
= uno::makeAny(_nColorTRGB
);
143 xProp
->setPropertyValue(PROPERTY_CONTROLBACKGROUND
, aBlackColorAny
);
146 catch(uno::Exception
&)
152 DlgEdFunc::~DlgEdFunc()
154 unColorizeOverlappedObj();
159 bool DlgEdFunc::MouseButtonDown( const MouseEvent
& rMEvt
)
161 m_aMDPos
= m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() );
162 m_pParent
->GrabFocus();
163 bool bHandled
= false;
164 if ( rMEvt
.IsLeft() )
166 if ( rMEvt
.GetClicks() > 1 )
168 // show property browser
169 uno::Sequence
<beans::PropertyValue
> aArgs( comphelper::InitPropertySequence({
170 { "ShowProperties", uno::Any(true) }
172 m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController().executeUnChecked(SID_SHOW_PROPERTYBROWSER
,aArgs
);
173 m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView
);
174 // TODO character in shapes
175 // SdrViewEvent aVEvt;
176 // m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
177 // if ( aVEvt.mpRootObj && aVEvt.pRootObj->ISA(SdrTextObj) )
178 // SetInEditMode(static_cast<SdrTextObj *>(aVEvt.mpRootObj),rMEvt, sal_False);
183 SdrHdl
* pHdl
= m_rView
.PickHandle(m_aMDPos
);
185 // if selected object was hit, drag object
186 if ( pHdl
!=nullptr || m_rView
.IsMarkedHit(m_aMDPos
) )
189 m_pParent
->CaptureMouse();
190 m_pParent
->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos
, pHdl
,&m_rView
);
194 else if ( rMEvt
.IsRight() && !rMEvt
.IsLeft() && rMEvt
.GetClicks() == 1 ) // mark object when context menu was selected
196 SdrPageView
* pPV
= m_rView
.GetSdrPageView();
198 if ( m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
) != SdrHitKind::MarkedObject
&& !rMEvt
.IsShift() )
199 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
200 if ( aVEvt
.mpRootObj
)
201 m_rView
.MarkObj(aVEvt
.mpRootObj
, pPV
);
203 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
207 else if( !rMEvt
.IsLeft() )
210 m_pParent
->CaptureMouse();
215 bool DlgEdFunc::MouseButtonUp( const MouseEvent
& /*rMEvt*/ )
217 m_pParent
->getSectionWindow()->getViewsWindow()->stopScrollTimer();
221 void DlgEdFunc::checkTwoClicks(const MouseEvent
& rMEvt
)
225 const sal_uInt16 nClicks
= rMEvt
.GetClicks();
226 if ( !(nClicks
== 2 && rMEvt
.IsLeft()) )
229 if ( m_rView
.AreObjectsMarked() )
231 const SdrMarkList
& rMarkList
= m_rView
.GetMarkedObjectList();
232 if (rMarkList
.GetMarkCount() == 1)
234 const SdrMark
* pMark
= rMarkList
.GetMark(0);
235 SdrObject
* pObj
= pMark
->GetMarkedSdrObj();
241 void DlgEdFunc::stopScrollTimer()
243 unColorizeOverlappedObj();
245 if ( m_pParent
->IsMouseCaptured() )
246 m_pParent
->ReleaseMouse();
250 bool DlgEdFunc::MouseMove( const MouseEvent
& /*rMEvt*/ )
255 bool DlgEdFunc::handleKeyEvent(const KeyEvent
& _rEvent
)
257 bool bReturn
= false;
261 const vcl::KeyCode
& rCode
= _rEvent
.GetKeyCode();
262 sal_uInt16 nCode
= rCode
.GetCode();
268 if ( m_pParent
->getSectionWindow()->getViewsWindow()->IsAction() )
270 m_pParent
->getSectionWindow()->getViewsWindow()->BrkAction();
273 else if ( m_rView
.IsTextEdit() )
275 m_rView
.SdrEndTextEdit();
278 else if ( m_rView
.AreObjectsMarked() )
280 const SdrHdlList
& rHdlList
= m_rView
.GetHdlList();
281 SdrHdl
* pHdl
= rHdlList
.GetFocusHdl();
283 const_cast<SdrHdlList
&>(rHdlList
).ResetFocusHdl();
285 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
298 if ( !rCode
.IsMod1() && !rCode
.IsMod2() )
301 if ( !m_rView
.MarkNextObj( !rCode
.IsShift() ) )
303 // if no next object, mark first/last
304 m_rView
.UnmarkAllObj();
305 m_rView
.MarkNextObj( !rCode
.IsShift() );
308 if ( m_rView
.AreObjectsMarked() )
309 m_rView
.MakeVisible( m_rView
.GetAllMarkedRect(), *m_pParent
);
313 else if ( rCode
.IsMod1() && rCode
.IsMod2())
316 const SdrHdlList
& rHdlList
= m_rView
.GetHdlList();
317 const_cast<SdrHdlList
&>(rHdlList
).TravelFocusHdl( !rCode
.IsShift() );
319 // guarantee visibility of focused handle
320 SdrHdl
* pHdl
= rHdlList
.GetFocusHdl();
323 Point
aHdlPosition( pHdl
->GetPos() );
324 tools::Rectangle
aVisRect( aHdlPosition
- Point( DEFAUL_MOVE_SIZE
, DEFAUL_MOVE_SIZE
), Size( 200, 200 ) );
325 m_rView
.MakeVisible( aVisRect
, *m_pParent
);
337 m_pParent
->getSectionWindow()->getViewsWindow()->handleKey(rCode
);
342 if ( !rCode
.IsMod1() )
344 const SdrMarkList
& rMarkList
= m_rView
.GetMarkedObjectList();
345 if ( rMarkList
.GetMarkCount() == 1 )
347 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
353 if ( !rCode
.IsMod1() && !rCode
.IsMod2() )
361 bReturn
= m_rView
.KeyInput(_rEvent
, m_pParent
);
367 if ( bReturn
&& m_pParent
->IsMouseCaptured() )
368 m_pParent
->ReleaseMouse();
373 void DlgEdFunc::activateOle(SdrObject
* _pObj
)
378 const sal_uInt16 nSdrObjKind
= _pObj
->GetObjIdentifier();
382 if (nSdrObjKind
!= OBJ_OLE2
)
385 SdrOle2Obj
* pOleObj
= dynamic_cast<SdrOle2Obj
*>(_pObj
);
386 if (!(pOleObj
&& pOleObj
->GetObjRef().is()))
389 if (m_rView
.IsTextEdit())
391 m_rView
.SdrEndTextEdit();
394 pOleObj
->AddOwnLightClient();
395 pOleObj
->SetWindow(VCLUnoHelper::GetInterface(m_pParent
));
398 pOleObj
->GetObjRef()->changeState( embed::EmbedStates::UI_ACTIVE
);
400 OReportController
& rController
= m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
401 m_bShowPropertyBrowser
= rController
.isCommandChecked(SID_SHOW_PROPERTYBROWSER
);
402 if ( m_bShowPropertyBrowser
)
403 rController
.executeChecked(SID_SHOW_PROPERTYBROWSER
,uno::Sequence
< beans::PropertyValue
>());
405 catch( uno::Exception
& )
407 DBG_UNHANDLED_EXCEPTION("reportdesign");
411 void DlgEdFunc::deactivateOle(bool _bSelect
)
413 OLEObjCache
& rObjCache
= GetSdrGlobalData().GetOLEObjCache();
414 OReportController
& rController
= m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
415 const size_t nCount
= rObjCache
.size();
416 for(size_t i
= 0 ; i
< nCount
;++i
)
418 SdrOle2Obj
* pObj
= rObjCache
[i
];
419 if ( m_pParent
->getPage() == pObj
->getSdrPageFromSdrObject() )
421 uno::Reference
< embed::XEmbeddedObject
> xObj
= pObj
->GetObjRef();
422 if ( xObj
.is() && xObj
->getCurrentState() == embed::EmbedStates::UI_ACTIVE
)
424 xObj
->changeState( embed::EmbedStates::RUNNING
);
426 if ( m_bShowPropertyBrowser
)
428 rController
.executeChecked(SID_SHOW_PROPERTYBROWSER
,uno::Sequence
< beans::PropertyValue
>());
433 SdrPageView
* pPV
= m_rView
.GetSdrPageView();
434 m_rView
.MarkObj(pObj
, pPV
);
441 void DlgEdFunc::colorizeOverlappedObject(SdrObject
* _pOverlappedObj
)
443 OObjectBase
* pObj
= dynamic_cast<OObjectBase
*>(_pOverlappedObj
);
447 const uno::Reference
<report::XReportComponent
>& xComponent
= pObj
->getReportComponent();
448 if (xComponent
.is() && xComponent
!= m_xOverlappingObj
)
450 OReportModel
& rRptModel(static_cast< OReportModel
& >(_pOverlappedObj
->getSdrModelFromSdrObject()));
451 OXUndoEnvironment::OUndoEnvLock
aLock(rRptModel
.GetUndoEnv());
453 // uncolorize an old object, if there is one
454 unColorizeOverlappedObj();
456 m_nOldColor
= lcl_setColorOfObject(xComponent
, m_nOverlappedControlColor
);
457 m_xOverlappingObj
= xComponent
;
458 m_pOverlappingObj
= _pOverlappedObj
;
462 void DlgEdFunc::unColorizeOverlappedObj()
464 // uncolorize an old object, if there is one
465 if (m_xOverlappingObj
.is())
467 OReportModel
& rRptModel(static_cast< OReportModel
& >(m_pOverlappingObj
->getSdrModelFromSdrObject()));
468 OXUndoEnvironment::OUndoEnvLock
aLock(rRptModel
.GetUndoEnv());
470 lcl_setColorOfObject(m_xOverlappingObj
, m_nOldColor
);
471 m_xOverlappingObj
= nullptr;
472 m_pOverlappingObj
= nullptr;
476 bool DlgEdFunc::isOverlapping(const MouseEvent
& rMEvt
)
479 bool bOverlapping
= m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONUP
, aVEvt
) != SdrHitKind::NONE
;
480 if (bOverlapping
&& aVEvt
.mpObj
)
482 colorizeOverlappedObject(aVEvt
.mpObj
);
486 unColorizeOverlappedObj();
492 void DlgEdFunc::checkMovementAllowed(const MouseEvent
& rMEvt
)
494 if ( m_pParent
->getSectionWindow()->getViewsWindow()->IsDragObj() )
496 if ( isRectangleHit(rMEvt
) )
498 // there is another component under use, break action
499 m_pParent
->getSectionWindow()->getViewsWindow()->BrkAction();
501 // object was dragged
502 Point
aPnt( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
503 if (m_bSelectionMode
)
505 m_pParent
->getSectionWindow()->getViewsWindow()->EndAction();
509 bool bControlKeyPressed
= rMEvt
.IsMod1();
510 // Don't allow points smaller 0
511 if (bControlKeyPressed
&& (aPnt
.Y() < 0))
515 if (m_rView
.IsDragResize())
517 // we resize the object don't resize to above sections
523 m_pParent
->getSectionWindow()->getViewsWindow()->EndDragObj( bControlKeyPressed
, &m_rView
, aPnt
);
525 m_pParent
->getSectionWindow()->getViewsWindow()->ForceMarkedToAnotherPage();
526 m_pParent
->Invalidate(InvalidateFlags::Children
);
529 m_pParent
->getSectionWindow()->getViewsWindow()->EndAction();
532 bool DlgEdFunc::isOnlyCustomShapeMarked() const
535 const SdrMarkList
& rMarkList
= m_rView
.GetMarkedObjectList();
536 for (size_t i
= 0; i
< rMarkList
.GetMarkCount(); ++i
)
538 SdrMark
* pMark
= rMarkList
.GetMark(i
);
539 SdrObject
* pObj
= pMark
->GetMarkedSdrObj();
540 if (pObj
->GetObjIdentifier() != OBJ_CUSTOMSHAPE
)
542 // we found an object in the marked objects, which is not a custom shape.
550 bool DlgEdFunc::isRectangleHit(const MouseEvent
& rMEvt
)
552 if (isOnlyCustomShapeMarked())
558 const SdrHitKind eHit
= m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::MOVE
, aVEvt
);
559 bool bIsSetPoint
= (eHit
== SdrHitKind::UnmarkedObject
);
562 // no drag rect, we have to check every single select rect
563 const SdrDragStat
& rDragStat
= m_rView
.GetDragStat();
564 if (rDragStat
.GetDragMethod() != nullptr)
566 SdrObjListIter
aIter(m_pParent
->getPage(),SdrIterMode::DeepNoGroups
);
567 // loop through all marked objects and check if there new rect overlapps an old one.
570 SdrObject
* pObjIter
= aIter
.Next();
571 if( !pObjIter
|| bIsSetPoint
)
573 if ( m_rView
.IsObjMarked(pObjIter
)
574 && (dynamic_cast<OUnoObject
*>(pObjIter
) != nullptr || dynamic_cast<OOle2Obj
*>(pObjIter
) != nullptr) )
576 tools::Rectangle aNewRect
= pObjIter
->GetLastBoundRect();
577 tools::Long nDx
= rDragStat
.IsHorFixed() ? 0 : rDragStat
.GetDX();
578 tools::Long nDy
= rDragStat
.IsVerFixed() ? 0 : rDragStat
.GetDY();
579 if ( (nDx
+ aNewRect
.Left()) < 0 )
580 nDx
= -aNewRect
.Left();
581 if ( (nDy
+ aNewRect
.Top()) < 0 )
582 nDy
= -aNewRect
.Top();
584 if ( rDragStat
.GetDragMethod()->getMoveOnly() )
585 aNewRect
.Move(nDx
,nDy
);
587 ::ResizeRect(aNewRect
,rDragStat
.GetRef1(),rDragStat
.GetXFact(),rDragStat
.GetYFact());
590 SdrObject
* pObjOverlapped
= isOver(aNewRect
,*m_pParent
->getPage(),m_rView
,false,pObjIter
, ISOVER_IGNORE_CUSTOMSHAPES
);
591 bIsSetPoint
= pObjOverlapped
!= nullptr;
592 if (pObjOverlapped
&& !m_bSelectionMode
)
594 colorizeOverlappedObject(pObjOverlapped
);
600 else if (aVEvt
.mpObj
&& (aVEvt
.mpObj
->GetObjIdentifier() != OBJ_CUSTOMSHAPE
) && !m_bSelectionMode
)
602 colorizeOverlappedObject(aVEvt
.mpObj
);
609 bool DlgEdFunc::setMovementPointer(const MouseEvent
& rMEvt
)
611 bool bIsSetPoint
= isRectangleHit(rMEvt
);
613 m_pParent
->SetPointer( PointerStyle::NotAllowed
);
616 bool bCtrlKey
= rMEvt
.IsMod1();
619 m_pParent
->SetPointer( PointerStyle::MoveDataLink
);
627 DlgEdFuncInsert::DlgEdFuncInsert( OReportSection
* _pParent
) :
628 DlgEdFunc( _pParent
)
630 m_rView
.SetCreateMode();
634 DlgEdFuncInsert::~DlgEdFuncInsert()
636 m_rView
.SetEditMode();
640 bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent
& rMEvt
)
642 if ( DlgEdFunc::MouseButtonDown(rMEvt
) )
646 sal_Int16 nId
= m_rView
.GetCurrentObjIdentifier();
648 const SdrHitKind eHit
= m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
650 if (eHit
== SdrHitKind::UnmarkedObject
&& nId
!= OBJ_CUSTOMSHAPE
)
652 // there is an object under the mouse cursor, but not a customshape
653 m_pParent
->getSectionWindow()->getViewsWindow()->BrkAction();
657 // if no action, create object
658 if (!m_pParent
->getSectionWindow()->getViewsWindow()->IsAction())
661 if ( m_pParent
->getSectionWindow()->getViewsWindow()->HasSelection() )
662 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(&m_rView
);
663 m_rView
.BegCreateObj(m_aMDPos
);
664 m_pParent
->getSectionWindow()->getViewsWindow()->createDefault();
671 bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent
& rMEvt
)
673 if ( DlgEdFunc::MouseButtonUp( rMEvt
) )
676 const Point
aPos( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
677 const sal_uInt16 nHitLog
= sal_uInt16 ( m_pParent
->PixelToLogic(Size(3,0)).Width() );
680 // object creation active?
681 if ( m_rView
.IsCreateObj() )
683 if ( isOver(m_rView
.GetCreateObj(),*m_pParent
->getPage(),m_rView
) )
685 m_pParent
->getSectionWindow()->getViewsWindow()->BrkAction();
686 // BrkAction disables the create mode
687 m_rView
.SetCreateMode();
691 m_rView
.EndCreateObj(SdrCreateCmd::ForceEnd
);
693 if ( !m_rView
.AreObjectsMarked() )
695 m_rView
.MarkObj(aPos
, nHitLog
);
698 bReturn
= m_rView
.AreObjectsMarked();
701 OReportController
& rController
= m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
702 const SdrMarkList
& rMarkList
= m_rView
.GetMarkedObjectList();
703 for (size_t i
= 0; i
< rMarkList
.GetMarkCount(); ++i
)
705 SdrMark
* pMark
= rMarkList
.GetMark(i
);
706 OOle2Obj
* pObj
= dynamic_cast<OOle2Obj
*>(pMark
->GetMarkedSdrObj());
707 if ( pObj
&& !pObj
->IsEmpty() )
709 pObj
->initializeChart(rController
.getModel());
715 checkMovementAllowed(rMEvt
);
717 if ( !m_rView
.AreObjectsMarked() &&
718 std::abs(m_aMDPos
.X() - aPos
.X()) < nHitLog
&&
719 std::abs(m_aMDPos
.Y() - aPos
.Y()) < nHitLog
&&
720 !rMEvt
.IsShift() && !rMEvt
.IsMod2() )
722 SdrPageView
* pPV
= m_rView
.GetSdrPageView();
724 m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
725 m_rView
.MarkObj(aVEvt
.mpRootObj
, pPV
);
727 checkTwoClicks(rMEvt
);
728 m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView
);
733 bool DlgEdFuncInsert::MouseMove( const MouseEvent
& rMEvt
)
735 if ( DlgEdFunc::MouseMove(rMEvt
) )
737 Point
aPos( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
739 if ( m_rView
.IsCreateObj() )
741 m_rView
.SetOrtho(SdrObjCustomShape::doConstructOrthogonal(m_rView
.getReportSection()->getSectionWindow()->getViewsWindow()->getShapeType()) ? !rMEvt
.IsShift() : rMEvt
.IsShift());
742 m_rView
.SetAngleSnapEnabled(rMEvt
.IsShift());
745 bool bIsSetPoint
= false;
746 if ( m_rView
.IsAction() )
748 if ( m_rView
.IsDragResize() )
750 // we resize the object don't resize to above sections
756 bIsSetPoint
= setMovementPointer(rMEvt
);
758 m_pParent
->getSectionWindow()->getViewsWindow()->MovAction(aPos
,&m_rView
, false);
762 m_pParent
->SetPointer( m_rView
.GetPreferredPointer( aPos
, m_pParent
->GetOutDev()) );
768 DlgEdFuncSelect::DlgEdFuncSelect( OReportSection
* _pParent
) :
769 DlgEdFunc( _pParent
)
774 DlgEdFuncSelect::~DlgEdFuncSelect()
779 bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent
& rMEvt
)
781 m_bSelectionMode
= false;
782 if ( DlgEdFunc::MouseButtonDown(rMEvt
) )
786 const SdrHitKind eHit
= m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
787 if( eHit
== SdrHitKind::UnmarkedObject
)
789 // if not multi selection, unmark all
790 if ( !rMEvt
.IsShift() )
791 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
793 if ( m_rView
.MarkObj(m_aMDPos
) && rMEvt
.IsLeft() )
796 m_pParent
->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos
, m_rView
.PickHandle(m_aMDPos
), &m_rView
);
801 m_pParent
->getSectionWindow()->getViewsWindow()->BegMarkObj(m_aMDPos
,&m_rView
);
806 if( !rMEvt
.IsShift() )
807 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
809 if ( rMEvt
.GetClicks() == 1 )
811 m_bSelectionMode
= true;
812 m_pParent
->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos
,&m_rView
);
816 m_rView
.SdrBeginTextEdit( aVEvt
.mpRootObj
,m_rView
.GetSdrPageView(),m_pParent
);
824 bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent
& rMEvt
)
826 if ( DlgEdFunc::MouseButtonUp( rMEvt
) )
829 // get view from parent
830 const Point
aPnt( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
832 if ( rMEvt
.IsLeft() ) // left mousebutton pressed
833 checkMovementAllowed(rMEvt
);
835 m_pParent
->getSectionWindow()->getViewsWindow()->EndAction();
836 checkTwoClicks(rMEvt
);
838 m_pParent
->SetPointer( m_rView
.GetPreferredPointer( aPnt
, m_pParent
->GetOutDev() ) );
841 m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView
);
842 m_bSelectionMode
= false;
847 bool DlgEdFuncSelect::MouseMove( const MouseEvent
& rMEvt
)
849 if ( DlgEdFunc::MouseMove(rMEvt
) )
852 Point
aPnt( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
853 bool bIsSetPoint
= false;
855 if ( m_rView
.IsAction() ) // Drag Mode
857 bIsSetPoint
= setMovementPointer(rMEvt
);
859 if (m_rView
.GetDragMethod()==nullptr)
861 // create a selection
862 m_pParent
->getSectionWindow()->getViewsWindow()->MovAction(aPnt
, &m_rView
, false);
866 if ( m_rView
.IsDragResize() )
868 // we resize the object don't resize to above sections
874 // drag or resize an object
875 bool bControlKey
= rMEvt
.IsMod1();
876 m_pParent
->getSectionWindow()->getViewsWindow()->MovAction(aPnt
, &m_rView
, bControlKey
);
882 m_pParent
->SetPointer( m_rView
.GetPreferredPointer( aPnt
, m_pParent
->GetOutDev() ) );
885 unColorizeOverlappedObj();
894 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */