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/seleng.hxx>
20 #include <vcl/ptrstyle.hxx>
21 #include <com/sun/star/embed/EmbedStates.hpp>
22 #include <com/sun/star/embed/XEmbeddedObject.hpp>
23 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <svx/svdview.hxx>
26 #include <svx/svdpagv.hxx>
27 #include <svx/svdetc.hxx>
28 #include <svx/svddrgmt.hxx>
29 #include <svx/svdoashp.hxx>
30 #include <svx/svxids.hrc>
31 #include <svx/svditer.hxx>
33 #include <toolkit/helper/vclunohelper.hxx>
35 #include <dlgedfunc.hxx>
36 #include <ReportSection.hxx>
37 #include <DesignView.hxx>
38 #include <ReportController.hxx>
39 #include <SectionView.hxx>
40 #include <ViewsWindow.hxx>
41 #include <ReportWindow.hxx>
42 #include <RptObject.hxx>
43 #include <ScrollHelper.hxx>
44 #include <UITools.hxx>
46 #include <strings.hxx>
47 #include <UndoEnv.hxx>
48 #include <RptModel.hxx>
49 #include <comphelper/propertysequence.hxx>
50 #include <comphelper/diagnose_ex.hxx>
52 #define DEFAUL_MOVE_SIZE 100
55 using namespace ::com::sun::star
;
58 IMPL_LINK_NOARG( DlgEdFunc
, ScrollTimeout
, Timer
*, void )
60 ForceScroll( m_pParent
->PixelToLogic( m_pParent
->GetPointerPosPixel() ) );
64 void DlgEdFunc::ForceScroll( const Point
& rPos
)
68 OReportWindow
* pReportWindow
= m_pParent
->getSectionWindow()->getViewsWindow()->getView();
69 OScrollWindowHelper
* pScrollWindow
= pReportWindow
->getScrollWindow();
71 Size aOut
= pReportWindow
->GetOutputSizePixel();
72 Fraction
aStartWidth(tools::Long(REPORT_STARTMARKER_WIDTH
));
73 aStartWidth
*= m_pParent
->GetMapMode().GetScaleX();
75 aOut
.AdjustWidth( -static_cast<tools::Long
>(aStartWidth
) );
76 aOut
.setHeight( m_pParent
->GetOutputSizePixel().Height() );
78 Point aPos
= pScrollWindow
->getThumbPos();
79 aPos
.setX( aPos
.X() * 0.5 );
80 aPos
.setY( aPos
.Y() * 0.5 );
81 tools::Rectangle
aOutRect( aPos
, aOut
);
82 aOutRect
= m_pParent
->PixelToLogic( aOutRect
);
83 tools::Rectangle
aWorkArea(Point(), pScrollWindow
->getTotalSize());
84 aWorkArea
.AdjustRight( -static_cast<tools::Long
>(aStartWidth
) );
85 aWorkArea
= pScrollWindow
->PixelToLogic( aWorkArea
);
86 if( !aOutRect
.Contains( rPos
) && aWorkArea
.Contains( rPos
) )
88 ScrollAdaptor
& rHScroll
= pScrollWindow
->GetHScroll();
89 ScrollAdaptor
& rVScroll
= pScrollWindow
->GetVScroll();
90 ScrollType eH
= ScrollType::LineDown
,eV
= ScrollType::LineDown
;
91 if( rPos
.X() < aOutRect
.Left() )
92 eH
= ScrollType::LineUp
;
93 else if( rPos
.X() <= aOutRect
.Right() )
94 eH
= ScrollType::DontKnow
;
96 if( rPos
.Y() < aOutRect
.Top() )
97 eV
= ScrollType::LineUp
;
98 else if( rPos
.Y() <= aOutRect
.Bottom() )
99 eV
= ScrollType::DontKnow
;
101 if (eH
!= ScrollType::DontKnow
)
103 auto nCurrentPos
= rHScroll
.GetThumbPos();
104 auto nLineSize
= rHScroll
.GetLineSize();
105 assert(eH
== ScrollType::LineUp
|| eH
== ScrollType::LineDown
);
106 rHScroll
.DoScroll(eH
== ScrollType::LineUp
? (nCurrentPos
- nLineSize
) : (nCurrentPos
+ nLineSize
));
109 if (eV
!= ScrollType::DontKnow
)
111 auto nCurrentPos
= rVScroll
.GetThumbPos();
112 auto nLineSize
= rVScroll
.GetLineSize();
113 assert(eV
== ScrollType::LineUp
|| eV
== ScrollType::LineDown
);
114 rVScroll
.DoScroll(eV
== ScrollType::LineUp
? (nCurrentPos
- nLineSize
) : (nCurrentPos
+ nLineSize
));
118 aScrollTimer
.Start();
121 DlgEdFunc::DlgEdFunc( OReportSection
* _pParent
)
122 : m_pParent(_pParent
)
123 , m_rView(_pParent
->getSectionView())
124 , aScrollTimer("reportdesign DlgEdFunc aScrollTimer")
125 , m_pOverlappingObj(nullptr)
126 , m_nOverlappedControlColor(0)
128 , m_bSelectionMode(false)
130 , m_bShowPropertyBrowser(false)
132 aScrollTimer
.SetInvokeHandler( LINK( this, DlgEdFunc
, ScrollTimeout
) );
133 m_rView
.SetActualWin( m_pParent
->GetOutDev() );
134 aScrollTimer
.SetTimeout( SELENG_AUTOREPEAT_INTERVAL
);
137 void DlgEdFunc::setOverlappedControlColor(Color _nColor
)
139 m_nOverlappedControlColor
= _nColor
;
142 static Color
lcl_setColorOfObject(const uno::Reference
< uno::XInterface
>& _xObj
, Color _nColorTRGB
)
147 uno::Reference
<report::XReportComponent
> xComponent(_xObj
, uno::UNO_QUERY_THROW
);
148 uno::Reference
< beans::XPropertySet
> xProp(xComponent
, uno::UNO_QUERY_THROW
);
149 uno::Any aAny
= xProp
->getPropertyValue(PROPERTY_CONTROLBACKGROUND
);
153 // try to set background color at the ReportComponent
154 uno::Any
aBlackColorAny(_nColorTRGB
);
155 xProp
->setPropertyValue(PROPERTY_CONTROLBACKGROUND
, aBlackColorAny
);
158 catch(uno::Exception
&)
164 DlgEdFunc::~DlgEdFunc()
166 unColorizeOverlappedObj();
171 bool DlgEdFunc::MouseButtonDown( const MouseEvent
& rMEvt
)
173 m_aMDPos
= m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() );
174 m_pParent
->GrabFocus();
175 bool bHandled
= false;
176 if ( rMEvt
.IsLeft() )
178 if ( rMEvt
.GetClicks() > 1 )
180 // show property browser
181 uno::Sequence
<beans::PropertyValue
> aArgs( comphelper::InitPropertySequence({
182 { "ShowProperties", uno::Any(true) }
184 m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController().executeUnChecked(SID_SHOW_PROPERTYBROWSER
,aArgs
);
185 m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView
);
186 // TODO character in shapes
187 // SdrViewEvent aVEvt;
188 // m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
189 // if ( aVEvt.mpRootObj && aVEvt.pRootObj->ISA(SdrTextObj) )
190 // SetInEditMode(static_cast<SdrTextObj *>(aVEvt.mpRootObj),rMEvt, sal_False);
195 SdrHdl
* pHdl
= m_rView
.PickHandle(m_aMDPos
);
197 // if selected object was hit, drag object
198 if ( pHdl
!=nullptr || m_rView
.IsMarkedHit(m_aMDPos
) )
201 m_pParent
->CaptureMouse();
202 m_pParent
->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos
, pHdl
,&m_rView
);
206 else if ( rMEvt
.IsRight() && !rMEvt
.IsLeft() && rMEvt
.GetClicks() == 1 ) // mark object when context menu was selected
208 SdrPageView
* pPV
= m_rView
.GetSdrPageView();
210 if ( m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
) != SdrHitKind::MarkedObject
&& !rMEvt
.IsShift() )
211 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
212 if ( aVEvt
.mpRootObj
)
213 m_rView
.MarkObj(aVEvt
.mpRootObj
, pPV
);
215 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
219 else if( !rMEvt
.IsLeft() )
222 m_pParent
->CaptureMouse();
227 bool DlgEdFunc::MouseButtonUp( const MouseEvent
& /*rMEvt*/ )
229 m_pParent
->getSectionWindow()->getViewsWindow()->stopScrollTimer();
233 void DlgEdFunc::checkTwoClicks(const MouseEvent
& rMEvt
)
237 const sal_uInt16 nClicks
= rMEvt
.GetClicks();
238 if ( !(nClicks
== 2 && rMEvt
.IsLeft()) )
241 if ( m_rView
.GetMarkedObjectList().GetMarkCount() != 0 )
243 const SdrMarkList
& rMarkList
= m_rView
.GetMarkedObjectList();
244 if (rMarkList
.GetMarkCount() == 1)
246 const SdrMark
* pMark
= rMarkList
.GetMark(0);
247 SdrObject
* pObj
= pMark
->GetMarkedSdrObj();
253 void DlgEdFunc::stopScrollTimer()
255 unColorizeOverlappedObj();
257 if ( m_pParent
->IsMouseCaptured() )
258 m_pParent
->ReleaseMouse();
262 bool DlgEdFunc::MouseMove( const MouseEvent
& /*rMEvt*/ )
267 bool DlgEdFunc::handleKeyEvent(const KeyEvent
& _rEvent
)
269 bool bReturn
= false;
273 const vcl::KeyCode
& rCode
= _rEvent
.GetKeyCode();
274 sal_uInt16 nCode
= rCode
.GetCode();
280 if ( m_pParent
->getSectionWindow()->getViewsWindow()->IsAction() )
282 m_pParent
->getSectionWindow()->getViewsWindow()->BrkAction();
285 else if ( m_rView
.IsTextEdit() )
287 m_rView
.SdrEndTextEdit();
290 else if ( m_rView
.GetMarkedObjectList().GetMarkCount() != 0 )
292 const SdrHdlList
& rHdlList
= m_rView
.GetHdlList();
293 SdrHdl
* pHdl
= rHdlList
.GetFocusHdl();
295 const_cast<SdrHdlList
&>(rHdlList
).ResetFocusHdl();
297 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
310 if ( !rCode
.IsMod1() && !rCode
.IsMod2() )
313 if ( !m_rView
.MarkNextObj( !rCode
.IsShift() ) )
315 // if no next object, mark first/last
316 m_rView
.UnmarkAllObj();
317 m_rView
.MarkNextObj( !rCode
.IsShift() );
320 if ( m_rView
.GetMarkedObjectList().GetMarkCount() != 0 )
321 m_rView
.MakeVisible( m_rView
.GetAllMarkedRect(), *m_pParent
);
325 else if ( rCode
.IsMod1() && rCode
.IsMod2())
328 const SdrHdlList
& rHdlList
= m_rView
.GetHdlList();
329 const_cast<SdrHdlList
&>(rHdlList
).TravelFocusHdl( !rCode
.IsShift() );
331 // guarantee visibility of focused handle
332 SdrHdl
* pHdl
= rHdlList
.GetFocusHdl();
335 Point
aHdlPosition( pHdl
->GetPos() );
336 tools::Rectangle
aVisRect( aHdlPosition
- Point( DEFAUL_MOVE_SIZE
, DEFAUL_MOVE_SIZE
), Size( 200, 200 ) );
337 m_rView
.MakeVisible( aVisRect
, *m_pParent
);
349 m_pParent
->getSectionWindow()->getViewsWindow()->handleKey(rCode
);
354 if ( !rCode
.IsMod1() )
356 const SdrMarkList
& rMarkList
= m_rView
.GetMarkedObjectList();
357 if ( rMarkList
.GetMarkCount() == 1 )
359 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
365 if ( !rCode
.IsMod1() && !rCode
.IsMod2() )
373 bReturn
= m_rView
.KeyInput(_rEvent
, m_pParent
);
379 if ( bReturn
&& m_pParent
->IsMouseCaptured() )
380 m_pParent
->ReleaseMouse();
385 void DlgEdFunc::activateOle(SdrObject
* _pObj
)
390 const SdrObjKind nSdrObjKind
= _pObj
->GetObjIdentifier();
394 if (nSdrObjKind
!= SdrObjKind::OLE2
)
397 SdrOle2Obj
* pOleObj
= dynamic_cast<SdrOle2Obj
*>(_pObj
);
398 if (!(pOleObj
&& pOleObj
->GetObjRef().is()))
401 if (m_rView
.IsTextEdit())
403 m_rView
.SdrEndTextEdit();
406 pOleObj
->AddOwnLightClient();
407 pOleObj
->SetWindow(VCLUnoHelper::GetInterface(m_pParent
));
410 pOleObj
->GetObjRef()->changeState( embed::EmbedStates::UI_ACTIVE
);
412 OReportController
& rController
= m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
413 m_bShowPropertyBrowser
= rController
.isCommandChecked(SID_SHOW_PROPERTYBROWSER
);
414 if ( m_bShowPropertyBrowser
)
415 rController
.executeChecked(SID_SHOW_PROPERTYBROWSER
,uno::Sequence
< beans::PropertyValue
>());
417 catch( uno::Exception
& )
419 DBG_UNHANDLED_EXCEPTION("reportdesign");
423 void DlgEdFunc::deactivateOle(bool _bSelect
)
425 OLEObjCache
& rObjCache
= GetSdrGlobalData().GetOLEObjCache();
426 OReportController
& rController
= m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
427 const size_t nCount
= rObjCache
.size();
428 for(size_t i
= 0 ; i
< nCount
;++i
)
430 SdrOle2Obj
* pObj
= rObjCache
[i
];
431 if ( m_pParent
->getPage() == pObj
->getSdrPageFromSdrObject() )
433 uno::Reference
< embed::XEmbeddedObject
> xObj
= pObj
->GetObjRef();
434 if ( xObj
.is() && xObj
->getCurrentState() == embed::EmbedStates::UI_ACTIVE
)
436 xObj
->changeState( embed::EmbedStates::RUNNING
);
438 if ( m_bShowPropertyBrowser
)
440 rController
.executeChecked(SID_SHOW_PROPERTYBROWSER
,uno::Sequence
< beans::PropertyValue
>());
445 SdrPageView
* pPV
= m_rView
.GetSdrPageView();
446 m_rView
.MarkObj(pObj
, pPV
);
453 void DlgEdFunc::colorizeOverlappedObject(SdrObject
* _pOverlappedObj
)
455 OObjectBase
* pObj
= dynamic_cast<OObjectBase
*>(_pOverlappedObj
);
459 const uno::Reference
<report::XReportComponent
>& xComponent
= pObj
->getReportComponent();
460 if (xComponent
.is() && xComponent
!= m_xOverlappingObj
)
462 OReportModel
& rRptModel(static_cast< OReportModel
& >(_pOverlappedObj
->getSdrModelFromSdrObject()));
463 OXUndoEnvironment::OUndoEnvLock
aLock(rRptModel
.GetUndoEnv());
465 // uncolorize an old object, if there is one
466 unColorizeOverlappedObj();
468 m_nOldColor
= lcl_setColorOfObject(xComponent
, m_nOverlappedControlColor
);
469 m_xOverlappingObj
= xComponent
;
470 m_pOverlappingObj
= _pOverlappedObj
;
474 void DlgEdFunc::unColorizeOverlappedObj()
476 // uncolorize an old object, if there is one
477 if (m_xOverlappingObj
.is())
479 OReportModel
& rRptModel(static_cast< OReportModel
& >(m_pOverlappingObj
->getSdrModelFromSdrObject()));
480 OXUndoEnvironment::OUndoEnvLock
aLock(rRptModel
.GetUndoEnv());
482 lcl_setColorOfObject(m_xOverlappingObj
, m_nOldColor
);
483 m_xOverlappingObj
= nullptr;
484 m_pOverlappingObj
= nullptr;
488 bool DlgEdFunc::isOverlapping(const MouseEvent
& rMEvt
)
491 bool bOverlapping
= m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONUP
, aVEvt
) != SdrHitKind::NONE
;
492 if (bOverlapping
&& aVEvt
.mpObj
)
494 colorizeOverlappedObject(aVEvt
.mpObj
);
498 unColorizeOverlappedObj();
504 void DlgEdFunc::checkMovementAllowed(const MouseEvent
& rMEvt
)
506 if ( m_pParent
->getSectionWindow()->getViewsWindow()->IsDragObj() )
508 if ( isRectangleHit(rMEvt
) )
510 // there is another component under use, break action
511 m_pParent
->getSectionWindow()->getViewsWindow()->BrkAction();
513 // object was dragged
514 Point
aPnt( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
515 if (m_bSelectionMode
)
517 m_pParent
->getSectionWindow()->getViewsWindow()->EndAction();
521 bool bControlKeyPressed
= rMEvt
.IsMod1();
522 // Don't allow points smaller 0
523 if (bControlKeyPressed
&& (aPnt
.Y() < 0))
527 if (m_rView
.IsDragResize())
529 // we resize the object don't resize to above sections
535 m_pParent
->getSectionWindow()->getViewsWindow()->EndDragObj( bControlKeyPressed
, &m_rView
, aPnt
);
537 m_pParent
->getSectionWindow()->getViewsWindow()->ForceMarkedToAnotherPage();
538 m_pParent
->Invalidate(InvalidateFlags::Children
);
541 m_pParent
->getSectionWindow()->getViewsWindow()->EndAction();
544 bool DlgEdFunc::isOnlyCustomShapeMarked() const
547 const SdrMarkList
& rMarkList
= m_rView
.GetMarkedObjectList();
548 for (size_t i
= 0; i
< rMarkList
.GetMarkCount(); ++i
)
550 SdrMark
* pMark
= rMarkList
.GetMark(i
);
551 SdrObject
* pObj
= pMark
->GetMarkedSdrObj();
552 if (pObj
->GetObjIdentifier() != SdrObjKind::CustomShape
)
554 // we found an object in the marked objects, which is not a custom shape.
562 bool DlgEdFunc::isRectangleHit(const MouseEvent
& rMEvt
)
564 if (isOnlyCustomShapeMarked())
570 const SdrHitKind eHit
= m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::MOVE
, aVEvt
);
571 bool bIsSetPoint
= (eHit
== SdrHitKind::UnmarkedObject
);
574 // no drag rect, we have to check every single select rect
575 const SdrDragStat
& rDragStat
= m_rView
.GetDragStat();
576 if (rDragStat
.GetDragMethod() != nullptr)
578 SdrObjListIter
aIter(m_pParent
->getPage(),SdrIterMode::DeepNoGroups
);
579 // loop through all marked objects and check if there new rect overlapps an old one.
582 SdrObject
* pObjIter
= aIter
.Next();
583 if( !pObjIter
|| bIsSetPoint
)
585 if ( m_rView
.IsObjMarked(pObjIter
)
586 && (dynamic_cast<OUnoObject
*>(pObjIter
) != nullptr || dynamic_cast<OOle2Obj
*>(pObjIter
) != nullptr) )
588 tools::Rectangle aNewRect
= pObjIter
->GetLastBoundRect();
589 tools::Long nDx
= rDragStat
.IsHorFixed() ? 0 : rDragStat
.GetDX();
590 tools::Long nDy
= rDragStat
.IsVerFixed() ? 0 : rDragStat
.GetDY();
591 if ( (nDx
+ aNewRect
.Left()) < 0 )
592 nDx
= -aNewRect
.Left();
593 if ( (nDy
+ aNewRect
.Top()) < 0 )
594 nDy
= -aNewRect
.Top();
596 if ( rDragStat
.GetDragMethod()->getMoveOnly() )
597 aNewRect
.Move(nDx
,nDy
);
599 ::ResizeRect(aNewRect
,rDragStat
.GetRef1(),rDragStat
.GetXFact(),rDragStat
.GetYFact());
602 SdrObject
* pObjOverlapped
= isOver(aNewRect
,*m_pParent
->getPage(),m_rView
,false,pObjIter
, ISOVER_IGNORE_CUSTOMSHAPES
);
603 bIsSetPoint
= pObjOverlapped
!= nullptr;
604 if (pObjOverlapped
&& !m_bSelectionMode
)
606 colorizeOverlappedObject(pObjOverlapped
);
612 else if (aVEvt
.mpObj
&& (aVEvt
.mpObj
->GetObjIdentifier() != SdrObjKind::CustomShape
) && !m_bSelectionMode
)
614 colorizeOverlappedObject(aVEvt
.mpObj
);
621 bool DlgEdFunc::setMovementPointer(const MouseEvent
& rMEvt
)
623 bool bIsSetPoint
= isRectangleHit(rMEvt
);
625 m_pParent
->SetPointer( PointerStyle::NotAllowed
);
628 bool bCtrlKey
= rMEvt
.IsMod1();
631 m_pParent
->SetPointer( PointerStyle::MoveDataLink
);
639 DlgEdFuncInsert::DlgEdFuncInsert( OReportSection
* _pParent
) :
640 DlgEdFunc( _pParent
)
642 m_rView
.SetCreateMode();
646 DlgEdFuncInsert::~DlgEdFuncInsert()
648 m_rView
.SetEditMode();
652 bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent
& rMEvt
)
654 if ( DlgEdFunc::MouseButtonDown(rMEvt
) )
658 SdrObjKind nId
= m_rView
.GetCurrentObjIdentifier();
660 const SdrHitKind eHit
= m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
662 if (eHit
== SdrHitKind::UnmarkedObject
&& nId
!= SdrObjKind::CustomShape
)
664 // there is an object under the mouse cursor, but not a customshape
665 m_pParent
->getSectionWindow()->getViewsWindow()->BrkAction();
669 // if no action, create object
670 if (!m_pParent
->getSectionWindow()->getViewsWindow()->IsAction())
673 if ( m_pParent
->getSectionWindow()->getViewsWindow()->HasSelection() )
674 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(&m_rView
);
675 m_rView
.BegCreateObj(m_aMDPos
);
676 m_pParent
->getSectionWindow()->getViewsWindow()->createDefault();
683 bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent
& rMEvt
)
685 if ( DlgEdFunc::MouseButtonUp( rMEvt
) )
688 const Point
aPos( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
689 const sal_uInt16 nHitLog
= sal_uInt16 ( m_pParent
->PixelToLogic(Size(3,0)).Width() );
692 // object creation active?
693 if ( m_rView
.IsCreateObj() )
695 if ( isOver(m_rView
.GetCreateObj(),*m_pParent
->getPage(),m_rView
) )
697 m_pParent
->getSectionWindow()->getViewsWindow()->BrkAction();
698 // BrkAction disables the create mode
699 m_rView
.SetCreateMode();
703 m_rView
.EndCreateObj(SdrCreateCmd::ForceEnd
);
705 if ( m_rView
.GetMarkedObjectList().GetMarkCount() == 0 )
707 m_rView
.MarkObj(aPos
, nHitLog
);
710 bReturn
= m_rView
.GetMarkedObjectList().GetMarkCount() != 0;
713 OReportController
& rController
= m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
714 const SdrMarkList
& rMarkList
= m_rView
.GetMarkedObjectList();
715 for (size_t i
= 0; i
< rMarkList
.GetMarkCount(); ++i
)
717 SdrMark
* pMark
= rMarkList
.GetMark(i
);
718 OOle2Obj
* pObj
= dynamic_cast<OOle2Obj
*>(pMark
->GetMarkedSdrObj());
719 if ( pObj
&& !pObj
->IsEmpty() )
721 pObj
->initializeChart(rController
.getModel());
727 checkMovementAllowed(rMEvt
);
729 if ( m_rView
.GetMarkedObjectList().GetMarkCount() == 0 &&
730 std::abs(m_aMDPos
.X() - aPos
.X()) < nHitLog
&&
731 std::abs(m_aMDPos
.Y() - aPos
.Y()) < nHitLog
&&
732 !rMEvt
.IsShift() && !rMEvt
.IsMod2() )
734 SdrPageView
* pPV
= m_rView
.GetSdrPageView();
736 m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
737 m_rView
.MarkObj(aVEvt
.mpRootObj
, pPV
);
739 checkTwoClicks(rMEvt
);
740 m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView
);
745 bool DlgEdFuncInsert::MouseMove( const MouseEvent
& rMEvt
)
747 if ( DlgEdFunc::MouseMove(rMEvt
) )
749 Point
aPos( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
751 if ( m_rView
.IsCreateObj() )
753 m_rView
.SetOrtho(SdrObjCustomShape::doConstructOrthogonal(m_rView
.getReportSection()->getSectionWindow()->getViewsWindow()->getShapeType()) ? !rMEvt
.IsShift() : rMEvt
.IsShift());
754 m_rView
.SetAngleSnapEnabled(rMEvt
.IsShift());
757 bool bIsSetPoint
= false;
758 if ( m_rView
.IsAction() )
760 if ( m_rView
.IsDragResize() )
762 // we resize the object don't resize to above sections
768 bIsSetPoint
= setMovementPointer(rMEvt
);
770 m_pParent
->getSectionWindow()->getViewsWindow()->MovAction(aPos
,&m_rView
, false);
774 m_pParent
->SetPointer( m_rView
.GetPreferredPointer( aPos
, m_pParent
->GetOutDev()) );
780 DlgEdFuncSelect::DlgEdFuncSelect( OReportSection
* _pParent
) :
781 DlgEdFunc( _pParent
)
786 DlgEdFuncSelect::~DlgEdFuncSelect()
791 bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent
& rMEvt
)
793 m_bSelectionMode
= false;
794 if ( DlgEdFunc::MouseButtonDown(rMEvt
) )
798 const SdrHitKind eHit
= m_rView
.PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
799 if( eHit
== SdrHitKind::UnmarkedObject
)
801 // if not multi selection, unmark all
802 if ( !rMEvt
.IsShift() )
803 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
805 if ( m_rView
.MarkObj(m_aMDPos
) && rMEvt
.IsLeft() )
808 m_pParent
->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos
, m_rView
.PickHandle(m_aMDPos
), &m_rView
);
813 m_pParent
->getSectionWindow()->getViewsWindow()->BegMarkObj(m_aMDPos
,&m_rView
);
818 if( !rMEvt
.IsShift() )
819 m_pParent
->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
821 if ( rMEvt
.GetClicks() == 1 )
823 m_bSelectionMode
= true;
824 m_pParent
->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos
,&m_rView
);
828 m_rView
.SdrBeginTextEdit( aVEvt
.mpRootObj
,m_rView
.GetSdrPageView(),m_pParent
);
836 bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent
& rMEvt
)
838 if ( DlgEdFunc::MouseButtonUp( rMEvt
) )
841 // get view from parent
842 const Point
aPnt( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
844 if ( rMEvt
.IsLeft() ) // left mousebutton pressed
845 checkMovementAllowed(rMEvt
);
847 m_pParent
->getSectionWindow()->getViewsWindow()->EndAction();
848 checkTwoClicks(rMEvt
);
850 m_pParent
->SetPointer( m_rView
.GetPreferredPointer( aPnt
, m_pParent
->GetOutDev() ) );
853 m_pParent
->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView
);
854 m_bSelectionMode
= false;
859 bool DlgEdFuncSelect::MouseMove( const MouseEvent
& rMEvt
)
861 if ( DlgEdFunc::MouseMove(rMEvt
) )
864 Point
aPnt( m_pParent
->PixelToLogic( rMEvt
.GetPosPixel() ) );
865 bool bIsSetPoint
= false;
867 if ( m_rView
.IsAction() ) // Drag Mode
869 bIsSetPoint
= setMovementPointer(rMEvt
);
871 if (m_rView
.GetDragMethod()==nullptr)
873 // create a selection
874 m_pParent
->getSectionWindow()->getViewsWindow()->MovAction(aPnt
, &m_rView
, false);
878 if ( m_rView
.IsDragResize() )
880 // we resize the object don't resize to above sections
886 // drag or resize an object
887 bool bControlKey
= rMEvt
.IsMod1();
888 m_pParent
->getSectionWindow()->getViewsWindow()->MovAction(aPnt
, &m_rView
, bControlKey
);
894 m_pParent
->SetPointer( m_rView
.GetPreferredPointer( aPnt
, m_pParent
->GetOutDev() ) );
897 unColorizeOverlappedObj();
906 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */