LibreOffice Module reportdesign (master)  1
dlgedfunc.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
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>
25 
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>
33 
35 
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>
46 
47 #include <strings.hxx>
48 #include <UndoEnv.hxx>
49 #include <RptModel.hxx>
51 #include <tools/diagnose_ex.h>
52 
53 #define DEFAUL_MOVE_SIZE 100
54 namespace rptui
55 {
56 using namespace ::com::sun::star;
57 
58 
59 IMPL_LINK_NOARG( DlgEdFunc, ScrollTimeout, Timer *, void )
60 {
61  ForceScroll( m_pParent->PixelToLogic( m_pParent->GetPointerPosPixel() ) );
62 }
63 
64 
65 void DlgEdFunc::ForceScroll( const Point& rPos )
66 {
68 
69  OReportWindow* pReportWindow = m_pParent->getSectionWindow()->getViewsWindow()->getView();
70  OScrollWindowHelper* pScrollWindow = pReportWindow->getScrollWindow();
71 
72  Size aOut = pReportWindow->GetOutputSizePixel();
74  aStartWidth *= m_pParent->GetMapMode().GetScaleX();
75 
76  aOut.AdjustWidth( -static_cast<tools::Long>(aStartWidth) );
77  aOut.setHeight( m_pParent->GetOutputSizePixel().Height() );
78 
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.IsInside( rPos ) && aWorkArea.IsInside( rPos ) )
88  {
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;
96 
97  if( rPos.Y() < aOutRect.Top() )
98  eV = ScrollType::LineUp;
99  else if( rPos.Y() <= aOutRect.Bottom() )
100  eV = ScrollType::DontKnow;
101 
102  rHScroll.DoScrollAction(eH);
103  rVScroll.DoScrollAction(eV);
104  }
105 
107 }
108 
110  : m_pParent(_pParent)
111  , m_rView(_pParent->getSectionView())
112  , m_pOverlappingObj(nullptr)
113  , m_nOverlappedControlColor(0)
114  , m_nOldColor(0)
115  , m_bSelectionMode(false)
116  , m_bUiActive(false)
117  , m_bShowPropertyBrowser(false)
118 {
119  aScrollTimer.SetInvokeHandler( LINK( this, DlgEdFunc, ScrollTimeout ) );
122 }
123 
125 {
126  m_nOverlappedControlColor = _nColor;
127 }
128 
129 static Color lcl_setColorOfObject(const uno::Reference< uno::XInterface >& _xObj, Color _nColorTRGB)
130 {
131  Color nBackColor;
132  try
133  {
134  uno::Reference<report::XReportComponent> xComponent(_xObj, uno::UNO_QUERY_THROW);
135  uno::Reference< beans::XPropertySet > xProp(xComponent, uno::UNO_QUERY_THROW);
136  uno::Any aAny = xProp->getPropertyValue(PROPERTY_CONTROLBACKGROUND);
137  if (aAny.hasValue())
138  {
139  aAny >>= nBackColor;
140  // try to set background color at the ReportComponent
141  uno::Any aBlackColorAny = uno::makeAny(_nColorTRGB);
142  xProp->setPropertyValue(PROPERTY_CONTROLBACKGROUND, aBlackColorAny);
143  }
144  }
145  catch(uno::Exception&)
146  {
147  }
148  return nBackColor;
149 }
150 
152 {
154  aScrollTimer.Stop();
155 }
156 
157 
159 {
160  m_aMDPos = m_pParent->PixelToLogic( rMEvt.GetPosPixel() );
161  m_pParent->GrabFocus();
162  bool bHandled = false;
163  if ( rMEvt.IsLeft() )
164  {
165  if ( rMEvt.GetClicks() > 1 )
166  {
167  // show property browser
168  uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
169  { "ShowProperties", uno::Any(true) }
170  }));
171  m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController().executeUnChecked(SID_SHOW_PROPERTYBROWSER,aArgs);
172  m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
173  // TODO character in shapes
174  // SdrViewEvent aVEvt;
175  // m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
176  // if ( aVEvt.pRootObj && aVEvt.pRootObj->ISA(SdrTextObj) )
177  // SetInEditMode(static_cast<SdrTextObj *>(aVEvt.pRootObj),rMEvt, sal_False);
178  bHandled = true;
179  }
180  else
181  {
183 
184  // if selected object was hit, drag object
185  if ( pHdl!=nullptr || m_rView.IsMarkedHit(m_aMDPos) )
186  {
187  bHandled = true;
188  m_pParent->CaptureMouse();
189  m_pParent->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos, pHdl,&m_rView);
190  }
191  }
192  }
193  else if ( rMEvt.IsRight() && !rMEvt.IsLeft() && rMEvt.GetClicks() == 1 ) // mark object when context menu was selected
194  {
196  SdrViewEvent aVEvt;
197  if ( m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt) != SdrHitKind::MarkedObject && !rMEvt.IsShift() )
198  m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
199  if ( aVEvt.pRootObj )
200  m_rView.MarkObj(aVEvt.pRootObj, pPV);
201  else
202  m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
203 
204  bHandled = true;
205  }
206  else if( !rMEvt.IsLeft() )
207  bHandled = true;
208  if ( !bHandled )
209  m_pParent->CaptureMouse();
210  return bHandled;
211 }
212 
213 
214 bool DlgEdFunc::MouseButtonUp( const MouseEvent& /*rMEvt*/ )
215 {
216  m_pParent->getSectionWindow()->getViewsWindow()->stopScrollTimer();
217  return false;
218 }
219 
221 {
222  deactivateOle();
223 
224  const sal_uInt16 nClicks = rMEvt.GetClicks();
225  if ( !(nClicks == 2 && rMEvt.IsLeft()) )
226  return;
227 
228  if ( m_rView.AreObjectsMarked() )
229  {
230  const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
231  if (rMarkList.GetMarkCount() == 1)
232  {
233  const SdrMark* pMark = rMarkList.GetMark(0);
234  SdrObject* pObj = pMark->GetMarkedSdrObj();
235  activateOle(pObj);
236  }
237  }
238 }
239 
241 {
243  aScrollTimer.Stop();
244  if ( m_pParent->IsMouseCaptured() )
245  m_pParent->ReleaseMouse();
246 }
247 
248 
249 bool DlgEdFunc::MouseMove( const MouseEvent& /*rMEvt*/ )
250 {
251  return false;
252 }
253 
255 {
256  bool bReturn = false;
257 
258  if ( !m_bUiActive )
259  {
260  const vcl::KeyCode& rCode = _rEvent.GetKeyCode();
261  sal_uInt16 nCode = rCode.GetCode();
262 
263  switch ( nCode )
264  {
265  case KEY_ESCAPE:
266  {
267  if ( m_pParent->getSectionWindow()->getViewsWindow()->IsAction() )
268  {
269  m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
270  bReturn = true;
271  }
272  else if ( m_rView.IsTextEdit() )
273  {
275  bReturn = true;
276  }
277  else if ( m_rView.AreObjectsMarked() )
278  {
279  const SdrHdlList& rHdlList = m_rView.GetHdlList();
280  SdrHdl* pHdl = rHdlList.GetFocusHdl();
281  if ( pHdl )
282  const_cast<SdrHdlList&>(rHdlList).ResetFocusHdl();
283  else
284  m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
285 
286  deactivateOle(true);
287  bReturn = false;
288  }
289  else
290  {
291  deactivateOle(true);
292  }
293  }
294  break;
295  case KEY_TAB:
296  {
297  if ( !rCode.IsMod1() && !rCode.IsMod2() )
298  {
299  // mark next object
300  if ( !m_rView.MarkNextObj( !rCode.IsShift() ) )
301  {
302  // if no next object, mark first/last
304  m_rView.MarkNextObj( !rCode.IsShift() );
305  }
306 
307  if ( m_rView.AreObjectsMarked() )
309 
310  bReturn = true;
311  }
312  else if ( rCode.IsMod1() && rCode.IsMod2())
313  {
314  // selected handle
315  const SdrHdlList& rHdlList = m_rView.GetHdlList();
316  const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl( !rCode.IsShift() );
317 
318  // guarantee visibility of focused handle
319  SdrHdl* pHdl = rHdlList.GetFocusHdl();
320  if ( pHdl )
321  {
322  Point aHdlPosition( pHdl->GetPos() );
323  tools::Rectangle aVisRect( aHdlPosition - Point( DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE ), Size( 200, 200 ) );
324  m_rView.MakeVisible( aVisRect, *m_pParent);
325  }
326 
327  bReturn = true;
328  }
329  }
330  break;
331  case KEY_UP:
332  case KEY_DOWN:
333  case KEY_LEFT:
334  case KEY_RIGHT:
335  {
336  m_pParent->getSectionWindow()->getViewsWindow()->handleKey(rCode);
337  bReturn = true;
338  }
339  break;
340  case KEY_RETURN:
341  if ( !rCode.IsMod1() )
342  {
343  const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
344  if ( rMarkList.GetMarkCount() == 1 )
345  {
346  SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
347  activateOle(pObj);
348  }
349  }
350  break;
351  case KEY_DELETE:
352  if ( !rCode.IsMod1() && !rCode.IsMod2() )
353  {
354  bReturn = true;
355  break;
356  }
357  [[fallthrough]];
358  default:
359  {
360  bReturn = m_rView.KeyInput(_rEvent, m_pParent);
361  }
362  break;
363  }
364  }
365 
366  if ( bReturn && m_pParent->IsMouseCaptured() )
367  m_pParent->ReleaseMouse();
368 
369  return bReturn;
370 }
371 
373 {
374  if ( !_pObj )
375  return;
376 
377  const sal_uInt16 nSdrObjKind = _pObj->GetObjIdentifier();
378 
379  // OLE: activate
380 
381  if (nSdrObjKind != OBJ_OLE2)
382  return;
383 
384  SdrOle2Obj* pOleObj = dynamic_cast<SdrOle2Obj*>(_pObj);
385  if (!(pOleObj && pOleObj->GetObjRef().is()))
386  return;
387 
388  if (m_rView.IsTextEdit())
389  {
391  }
392 
393  pOleObj->AddOwnLightClient();
395  try
396  {
397  pOleObj->GetObjRef()->changeState( embed::EmbedStates::UI_ACTIVE );
398  m_bUiActive = true;
399  OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
400  m_bShowPropertyBrowser = rController.isCommandChecked(SID_SHOW_PROPERTYBROWSER);
402  rController.executeChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue >());
403  }
404  catch( uno::Exception& )
405  {
406  DBG_UNHANDLED_EXCEPTION("reportdesign");
407  }
408 }
409 
410 void DlgEdFunc::deactivateOle(bool _bSelect)
411 {
413  OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
414  const size_t nCount = rObjCache.size();
415  for(size_t i = 0 ; i < nCount;++i)
416  {
417  SdrOle2Obj* pObj = rObjCache[i];
418  if ( m_pParent->getPage() == pObj->getSdrPageFromSdrObject() )
419  {
420  uno::Reference< embed::XEmbeddedObject > xObj = pObj->GetObjRef();
421  if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::UI_ACTIVE )
422  {
423  xObj->changeState( embed::EmbedStates::RUNNING );
424  m_bUiActive = false;
426  {
427  rController.executeChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue >());
428  }
429 
430  if ( _bSelect )
431  {
433  m_rView.MarkObj(pObj, pPV);
434  }
435  }
436  }
437  }
438 }
439 
441 {
442  OObjectBase* pObj = dynamic_cast<OObjectBase*>(_pOverlappedObj);
443  if ( !pObj )
444  return;
445 
446  const uno::Reference<report::XReportComponent>& xComponent = pObj->getReportComponent();
447  if (xComponent.is() && xComponent != m_xOverlappingObj)
448  {
449  OReportModel& rRptModel(static_cast< OReportModel& >(_pOverlappedObj->getSdrModelFromSdrObject()));
451 
452  // uncolorize an old object, if there is one
454 
456  m_xOverlappingObj = xComponent;
457  m_pOverlappingObj = _pOverlappedObj;
458  }
459 }
460 
462 {
463  // uncolorize an old object, if there is one
464  if (m_xOverlappingObj.is())
465  {
466  OReportModel& rRptModel(static_cast< OReportModel& >(m_pOverlappingObj->getSdrModelFromSdrObject()));
468 
470  m_xOverlappingObj = nullptr;
471  m_pOverlappingObj = nullptr;
472  }
473 }
474 
476 {
477  SdrViewEvent aVEvt;
478  bool bOverlapping = m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONUP, aVEvt) != SdrHitKind::NONE;
479  if (bOverlapping && aVEvt.pObj)
480  {
482  }
483  else
484  {
486  }
487 
488  return bOverlapping;
489 }
490 
492 {
493  if ( m_pParent->getSectionWindow()->getViewsWindow()->IsDragObj() )
494  {
495  if ( isRectangleHit(rMEvt) )
496  {
497  // there is another component under use, break action
498  m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
499  }
500  // object was dragged
501  Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
502  if (m_bSelectionMode)
503  {
504  m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
505  }
506  else
507  {
508  bool bControlKeyPressed = rMEvt.IsMod1();
509  // Don't allow points smaller 0
510  if (bControlKeyPressed && (aPnt.Y() < 0))
511  {
512  aPnt.setY( 0 );
513  }
514  if (m_rView.IsDragResize())
515  {
516  // we resize the object don't resize to above sections
517  if ( aPnt.Y() < 0 )
518  {
519  aPnt.setY( 0 );
520  }
521  }
522  m_pParent->getSectionWindow()->getViewsWindow()->EndDragObj( bControlKeyPressed, &m_rView, aPnt );
523  }
524  m_pParent->getSectionWindow()->getViewsWindow()->ForceMarkedToAnotherPage();
525  m_pParent->Invalidate(InvalidateFlags::Children);
526  }
527  else
528  m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
529 }
530 
532 {
533  bool bReturn = true;
534  const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
535  for (size_t i = 0; i < rMarkList.GetMarkCount(); ++i )
536  {
537  SdrMark* pMark = rMarkList.GetMark(i);
538  SdrObject* pObj = pMark->GetMarkedSdrObj();
539  if (pObj->GetObjIdentifier() != OBJ_CUSTOMSHAPE)
540  {
541  // we found an object in the marked objects, which is not a custom shape.
542  bReturn = false;
543  break;
544  }
545  }
546  return bReturn;
547 }
548 
550 {
552  {
553  return false;
554  }
555 
556  SdrViewEvent aVEvt;
557  const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SdrMouseEventKind::MOVE, aVEvt);
558  bool bIsSetPoint = (eHit == SdrHitKind::UnmarkedObject);
559  if ( !bIsSetPoint )
560  {
561  // no drag rect, we have to check every single select rect
562  const SdrDragStat& rDragStat = m_rView.GetDragStat();
563  if (rDragStat.GetDragMethod() != nullptr)
564  {
565  SdrObjListIter aIter(m_pParent->getPage(),SdrIterMode::DeepNoGroups);
566  // loop through all marked objects and check if there new rect overlapps an old one.
567  for (;;)
568  {
569  SdrObject* pObjIter = aIter.Next();
570  if( !pObjIter || bIsSetPoint)
571  break;
572  if ( m_rView.IsObjMarked(pObjIter)
573  && (dynamic_cast<OUnoObject*>(pObjIter) != nullptr || dynamic_cast<OOle2Obj*>(pObjIter) != nullptr) )
574  {
575  tools::Rectangle aNewRect = pObjIter->GetLastBoundRect();
576  tools::Long nDx = rDragStat.IsHorFixed() ? 0 : rDragStat.GetDX();
577  tools::Long nDy = rDragStat.IsVerFixed() ? 0 : rDragStat.GetDY();
578  if ( (nDx + aNewRect.Left()) < 0 )
579  nDx = -aNewRect.Left();
580  if ( (nDy + aNewRect.Top()) < 0 )
581  nDy = -aNewRect.Top();
582 
583  if ( rDragStat.GetDragMethod()->getMoveOnly() )
584  aNewRect.Move(nDx,nDy);
585  else
586  ::ResizeRect(aNewRect,rDragStat.GetRef1(),rDragStat.GetXFact(),rDragStat.GetYFact());
587 
588 
589  SdrObject* pObjOverlapped = isOver(aNewRect,*m_pParent->getPage(),m_rView,false,pObjIter, ISOVER_IGNORE_CUSTOMSHAPES);
590  bIsSetPoint = pObjOverlapped != nullptr;
591  if (pObjOverlapped && !m_bSelectionMode)
592  {
593  colorizeOverlappedObject(pObjOverlapped);
594  }
595  }
596  }
597  }
598  }
599  else if ( aVEvt.pObj && (aVEvt.pObj->GetObjIdentifier() != OBJ_CUSTOMSHAPE) && !m_bSelectionMode)
600  {
602  }
603  else
604  bIsSetPoint = false;
605  return bIsSetPoint;
606 }
607 
609 {
610  bool bIsSetPoint = isRectangleHit(rMEvt);
611  if ( bIsSetPoint )
612  m_pParent->SetPointer( PointerStyle::NotAllowed );
613  else
614  {
615  bool bCtrlKey = rMEvt.IsMod1();
616  if (bCtrlKey)
617  {
618  m_pParent->SetPointer( PointerStyle::MoveDataLink );
619  bIsSetPoint = true;
620  }
621  }
622  return bIsSetPoint;
623 }
624 
625 
627  DlgEdFunc( _pParent )
628 {
630 }
631 
632 
634 {
636 }
637 
638 
640 {
641  if ( DlgEdFunc::MouseButtonDown(rMEvt) )
642  return true;
643 
644  SdrViewEvent aVEvt;
645  sal_Int16 nId = m_rView.GetCurrentObjIdentifier();
646 
647  const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
648 
649  if (eHit == SdrHitKind::UnmarkedObject && nId != OBJ_CUSTOMSHAPE)
650  {
651  // there is an object under the mouse cursor, but not a customshape
652  m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
653  return false;
654  }
655 
656  // if no action, create object
657  if (!m_pParent->getSectionWindow()->getViewsWindow()->IsAction())
658  {
659  deactivateOle(true);
660  if ( m_pParent->getSectionWindow()->getViewsWindow()->HasSelection() )
661  m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(&m_rView);
663  m_pParent->getSectionWindow()->getViewsWindow()->createDefault();
664  }
665 
666  return true;
667 }
668 
669 
671 {
672  if ( DlgEdFunc::MouseButtonUp( rMEvt ) )
673  return true;
674 
675  const Point aPos( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
676  const sal_uInt16 nHitLog = sal_uInt16 ( m_pParent->PixelToLogic(Size(3,0)).Width() );
677 
678  bool bReturn = true;
679  // object creation active?
680  if ( m_rView.IsCreateObj() )
681  {
682  if ( isOver(m_rView.GetCreateObj(),*m_pParent->getPage(),m_rView) )
683  {
684  m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
685  // BrkAction disables the create mode
687  return true;
688  }
689 
690  m_rView.EndCreateObj(SdrCreateCmd::ForceEnd);
691 
692  if ( !m_rView.AreObjectsMarked() )
693  {
694  m_rView.MarkObj(aPos, nHitLog);
695  }
696 
697  bReturn = m_rView.AreObjectsMarked();
698  if ( bReturn )
699  {
700  OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
701  const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
702  for (size_t i = 0; i < rMarkList.GetMarkCount(); ++i )
703  {
704  SdrMark* pMark = rMarkList.GetMark(i);
705  OOle2Obj* pObj = dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj());
706  if ( pObj && !pObj->IsEmpty() )
707  {
708  pObj->initializeChart(rController.getModel());
709  }
710  }
711  }
712  }
713  else
714  checkMovementAllowed(rMEvt);
715 
716  if ( !m_rView.AreObjectsMarked() &&
717  std::abs(m_aMDPos.X() - aPos.X()) < nHitLog &&
718  std::abs(m_aMDPos.Y() - aPos.Y()) < nHitLog &&
719  !rMEvt.IsShift() && !rMEvt.IsMod2() )
720  {
722  SdrViewEvent aVEvt;
723  m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
724  m_rView.MarkObj(aVEvt.pRootObj, pPV);
725  }
726  checkTwoClicks(rMEvt);
727  m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
728  return bReturn;
729 }
730 
731 
733 {
734  if ( DlgEdFunc::MouseMove(rMEvt ) )
735  return true;
736  Point aPos( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
737 
738  if ( m_rView.IsCreateObj() )
739  {
742  }
743 
744  bool bIsSetPoint = false;
745  if ( m_rView.IsAction() )
746  {
747  if ( m_rView.IsDragResize() )
748  {
749  // we resize the object don't resize to above sections
750  if ( aPos.Y() < 0 )
751  {
752  aPos.setY( 0 );
753  }
754  }
755  bIsSetPoint = setMovementPointer(rMEvt);
756  ForceScroll(aPos);
757  m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPos,&m_rView, false);
758  }
759 
760  if ( !bIsSetPoint )
761  m_pParent->SetPointer( m_rView.GetPreferredPointer( aPos, m_pParent) );
762 
763  return true;
764 }
765 
766 
768  DlgEdFunc( _pParent )
769 {
770 }
771 
772 
774 {
775 }
776 
777 
779 {
780  m_bSelectionMode = false;
781  if ( DlgEdFunc::MouseButtonDown(rMEvt) )
782  return true;
783 
784  SdrViewEvent aVEvt;
785  const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
786  if( eHit == SdrHitKind::UnmarkedObject )
787  {
788  // if not multi selection, unmark all
789  if ( !rMEvt.IsShift() )
790  m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
791 
792  if ( m_rView.MarkObj(m_aMDPos) && rMEvt.IsLeft() )
793  {
794  // drag object
795  m_pParent->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos, m_rView.PickHandle(m_aMDPos), &m_rView);
796  }
797  else
798  {
799  // select object
800  m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj(m_aMDPos,&m_rView);
801  }
802  }
803  else
804  {
805  if( !rMEvt.IsShift() )
806  m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
807 
808  if ( rMEvt.GetClicks() == 1 )
809  {
810  m_bSelectionMode = true;
811  m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos ,&m_rView);
812  }
813  else
814  {
816  }
817  }
818 
819  return true;
820 }
821 
822 
824 {
825  if ( DlgEdFunc::MouseButtonUp( rMEvt ) )
826  return true;
827 
828  // get view from parent
829  const Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
830 
831  if ( rMEvt.IsLeft() ) // left mousebutton pressed
832  checkMovementAllowed(rMEvt);
833 
834  m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
835  checkTwoClicks(rMEvt);
836 
837  m_pParent->SetPointer( m_rView.GetPreferredPointer( aPnt, m_pParent) );
838 
839  if ( !m_bUiActive )
840  m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
841  m_bSelectionMode = false;
842  return true;
843 }
844 
845 
847 {
848  if ( DlgEdFunc::MouseMove(rMEvt ) )
849  return true;
850 
851  Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
852  bool bIsSetPoint = false;
853 
854  if ( m_rView.IsAction() ) // Drag Mode
855  {
856  bIsSetPoint = setMovementPointer(rMEvt);
857  ForceScroll(aPnt);
858  if (m_rView.GetDragMethod()==nullptr)
859  {
860  // create a selection
861  m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPnt, &m_rView, false);
862  }
863  else
864  {
865  if ( m_rView.IsDragResize() )
866  {
867  // we resize the object don't resize to above sections
868  if ( aPnt.Y() < 0 )
869  {
870  aPnt.setY( 0 );
871  }
872  }
873  // drag or resize an object
874  bool bControlKey = rMEvt.IsMod1();
875  m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPnt, &m_rView, bControlKey);
876  }
877  }
878 
879  if ( !bIsSetPoint )
880  {
881  m_pParent->SetPointer( m_rView.GetPreferredPointer( aPnt, m_pParent) );
882 
883  // restore color
885  }
886 
887  return true;
888 }
889 
890 
891 }
892 
893 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~DlgEdFuncInsert() override
Definition: dlgedfunc.cxx:633
virtual ~DlgEdFunc()
Definition: dlgedfunc.cxx:151
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
virtual bool MouseButtonUp(const MouseEvent &rMEvt)
Definition: dlgedfunc.cxx:214
void ForceScroll(const Point &rPos)
Definition: dlgedfunc.cxx:65
bool hasValue()
Create an object ob OUndoEnvLock locks the undo possibility As long as in the OUndoEnvLock scope...
Definition: UndoEnv.hxx:64
bool IsHorFixed() const
bool EndCreateObj(SdrCreateCmd eCmd)
size_t GetMarkCount() const
PointerStyle GetPreferredPointer(const Point &rMousePos, const OutputDevice *pOut, sal_uInt16 nModifier=0, bool bLeftDown=false) const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
tools::Long GetDX() const
css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef() const
#define DEFAUL_MOVE_SIZE
Definition: dlgedfunc.cxx:53
SdrObject * isOver(const tools::Rectangle &_rRect, SdrPage const &_rPage, SdrView const &_rView, bool _bAllObjects=false, SdrObject const *_pIgnore=nullptr, sal_Int16 _nIgnoreType=0)
checks whether the given rectangle overlapps another OUnoObject object in that view.
Definition: UITools.cxx:869
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dlgedfunc.cxx:778
void activateOle(SdrObject *_pObj)
activate object if it is of type OBJ_OLE2
Definition: dlgedfunc.cxx:372
bool BegCreateObj(const Point &rPnt, OutputDevice *pOut=nullptr, short nMinMov=-3)
tools::Long GetDY() const
DlgEdFunc(const DlgEdFunc &)=delete
bool AreObjectsMarked() const
const SdrDragStat & GetDragStat() const
long Long
void colorizeOverlappedObject(SdrObject *_pOverlappedObj)
Definition: dlgedfunc.cxx:440
sal_Int16 nId
bool IsShift() const
virtual bool MouseButtonDown(const MouseEvent &rMEvt)
Definition: dlgedfunc.cxx:158
sal_uInt16 GetCode() const
void checkTwoClicks(const MouseEvent &rMEvt)
Definition: dlgedfunc.cxx:220
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: dlgedfunc.cxx:670
SdrMark * GetMark(size_t nNum) const
bool m_bShowPropertyBrowser
Definition: dlgedfunc.hxx:57
virtual bool MouseMove(const MouseEvent &rMEvt)
Definition: dlgedfunc.cxx:249
const Point & GetPos() const
SdrHitKind PickAnything(const MouseEvent &rMEvt, SdrMouseEventKind nMouseDownOrMoveOrUp, SdrViewEvent &rVEvt) const
virtual SdrObjKind GetObjIdentifier() const
SdrObject * pRootObj
void initializeChart(const css::uno::Reference< css::frame::XModel > &_xModel)
Definition: RptObject.cxx:1164
const css::uno::Reference< css::report::XReportComponent > & getReportComponent() const
Definition: RptObject.hxx:105
constexpr sal_uInt16 KEY_UP
bool isRectangleHit(const MouseEvent &rMEvt)
Definition: dlgedfunc.cxx:549
sal_uInt16 GetClicks() const
tools::Long Left() const
SdrPage * getSdrPageFromSdrObject() const
bool getMoveOnly() const
bool isOnlyCustomShapeMarked() const
returns true, as long as only customshapes in the marked list, custom shapes can drop every where ...
Definition: dlgedfunc.cxx:531
#define SELENG_AUTOREPEAT_INTERVAL
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: dlgedfunc.cxx:732
int nCount
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dlgedfunc.cxx:639
tools::Long Bottom() const
DlgEdFuncSelect(OReportSection *pParent)
Definition: dlgedfunc.cxx:767
#define REPORT_STARTMARKER_WIDTH
void SetEditMode(SdrViewEditMode eMode)
OLEObjCache & GetOLEObjCache()
bool IsMarkedHit(const Point &rPnt, short nTol=-2) const
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin) override
Definition: SectionView.cxx:69
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
sal_uInt16 nCode
bool setMovementPointer(const MouseEvent &rMEvt)
sets the correct mouse pointer when moving an object
Definition: dlgedfunc.cxx:608
const Size & getTotalSize() const
constexpr sal_uInt16 KEY_DOWN
SdrObject * GetMarkedSdrObj() const
SdrHitKind
#define PROPERTY_CONTROLBACKGROUND
Definition: strings.hxx:40
#define DBG_UNHANDLED_EXCEPTION(...)
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: dlgedfunc.cxx:823
SdrDragMethod * GetDragMethod() const
void SetWindow(const css::uno::Reference< css::awt::XWindow > &_xWindow)
bool isOverlapping(const MouseEvent &rMEvt)
returns if the mouse event is over an existing object
Definition: dlgedfunc.cxx:475
int i
tools::Long DoScrollAction(ScrollType eScrollType)
SdrObject * GetCreateObj() const
OSectionView & m_rView
Definition: dlgedfunc.hxx:48
bool IsMod2() const
Mutex aLock
IMPL_LINK_NOARG(OAddFieldWindow, FocusChangeHdl, weld::Container &, void)
Definition: AddField.cxx:120
VclPtr< OReportSection > m_pParent
Definition: dlgedfunc.hxx:47
const SdrMarkList & GetMarkedObjectList() const
ScrollType
virtual bool SdrBeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, SdrOutliner *pGivenOutliner=nullptr, OutlinerView *pGivenOutlinerView=nullptr, bool bDontDeleteOutliner=false, bool bOnlyOneView=false, bool bGrabFocus=true)
SdrHdl * PickHandle(const Point &rPnt) const
bool IsDragResize() const
SdrModel & getSdrModelFromSdrObject() const
virtual void Start() override
OScrollWindowHelper * getScrollWindow() const
bool IsInside(const Point &rPOINT) const
OViewsWindow * getViewsWindow()
Size GetOutputSizePixel() const
virtual ~DlgEdFuncSelect() override
Definition: dlgedfunc.cxx:773
tools::Long Top() const
void SetActualWin(const OutputDevice *pWin)
void SetTimeout(sal_uInt64 nTimeoutMs)
void checkMovementAllowed(const MouseEvent &rMEvt)
checks that no other object is overlapped.
Definition: dlgedfunc.cxx:491
bool MarkNextObj(bool bPrev=false)
void setOverlappedControlColor(Color _nColor)
Definition: dlgedfunc.cxx:124
const tools::Rectangle & GetAllMarkedRect() const
static Color lcl_setColorOfObject(const uno::Reference< uno::XInterface > &_xObj, Color _nColorTRGB)
Definition: dlgedfunc.cxx:129
constexpr sal_uInt16 KEY_RETURN
Color m_nOverlappedControlColor
Definition: dlgedfunc.hxx:53
const Point & GetRef1() const
constexpr sal_uInt16 KEY_RIGHT
SdrDragMethod * GetDragMethod() const
bool IsCreateObj() const
Point PixelToLogic(const Point &rDevicePt) const
SdrHdl * GetFocusHdl() const
virtual bool IsAction() const override
void SetAngleSnapEnabled(bool bOn)
Fraction GetXFact() const
SdrGlobalData & GetSdrGlobalData()
virtual const tools::Rectangle & GetLastBoundRect() const
DlgEdFuncInsert(OReportSection *pParent)
Definition: dlgedfunc.cxx:626
const vcl::KeyCode & GetKeyCode() const
const sal_Int16 ISOVER_IGNORE_CUSTOMSHAPES
Definition: UITools.hxx:131
bool IsShift() const
SdrObject * m_pOverlappingObj
Definition: dlgedfunc.hxx:52
virtual bool IsTextEdit() const final override
OSectionWindow * getSectionWindow() const
void Stop()
constexpr sal_uInt16 KEY_ESCAPE
void stopScrollTimer()
Definition: dlgedfunc.cxx:240
const OUString & getShapeType() const
returns the currently set shape type.
void SetOrtho(bool bOn)
bool IsLeft() const
Fraction GetYFact() const
tools::Long AdjustWidth(tools::Long n)
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: dlgedfunc.cxx:846
bool IsMod1() const
bool KeyInput(const KeyEvent &rKEvt, vcl::Window *pWin) override
void SetCreateMode(bool bOn=true)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
bool IsEmpty() const
const Point & GetPosPixel() const
SdrObject * pObj
bool handleKeyEvent(const KeyEvent &_rEvent)
checks if the keycode is known by the child windows
Definition: dlgedfunc.cxx:254
SdrPageView * GetSdrPageView() const
OBJ_CUSTOMSHAPE
bool AddOwnLightClient()
void setHeight(tools::Long nHeight)
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
SdrObjKind GetCurrentObjIdentifier() const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
bool IsRight() const
constexpr sal_uInt16 KEY_DELETE
constexpr sal_uInt16 KEY_LEFT
const SdrHdlList & GetHdlList() const
static bool doConstructOrthogonal(const OUString &rName)
OReportSection * getReportSection() const
Definition: SectionView.hxx:56
OXUndoEnvironment & GetUndoEnv()
Definition: RptModel.hxx:66
bool IsVerFixed() const
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
void unColorizeOverlappedObj()
Definition: dlgedfunc.cxx:461
OBJ_OLE2
SVXCORE_DLLPUBLIC size_t size() const
tools::Long Right() const
virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel() override
constexpr sal_uInt16 KEY_TAB
void deactivateOle(bool _bSelect=false)
deactivate all ole object
Definition: dlgedfunc.cxx:410
bool IsMod1() const
bool IsMod2() const
css::uno::Reference< css::uno::XInterface > m_xOverlappingObj
Definition: dlgedfunc.hxx:51
bool IsObjMarked(SdrObject const *pObj) const