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.Contains( rPos ) && aWorkArea.Contains( 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  , aScrollTimer("reportdesign DlgEdFunc aScrollTimer")
113  , m_pOverlappingObj(nullptr)
114  , m_nOverlappedControlColor(0)
115  , m_nOldColor(0)
116  , m_bSelectionMode(false)
117  , m_bUiActive(false)
118  , m_bShowPropertyBrowser(false)
119 {
120  aScrollTimer.SetInvokeHandler( LINK( this, DlgEdFunc, ScrollTimeout ) );
121  m_rView.SetActualWin( m_pParent->GetOutDev() );
123 }
124 
126 {
127  m_nOverlappedControlColor = _nColor;
128 }
129 
130 static Color lcl_setColorOfObject(const uno::Reference< uno::XInterface >& _xObj, Color _nColorTRGB)
131 {
132  Color nBackColor;
133  try
134  {
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);
138  if (aAny.hasValue())
139  {
140  aAny >>= nBackColor;
141  // try to set background color at the ReportComponent
142  uno::Any aBlackColorAny = uno::makeAny(_nColorTRGB);
143  xProp->setPropertyValue(PROPERTY_CONTROLBACKGROUND, aBlackColorAny);
144  }
145  }
146  catch(uno::Exception&)
147  {
148  }
149  return nBackColor;
150 }
151 
153 {
155  aScrollTimer.Stop();
156 }
157 
158 
160 {
161  m_aMDPos = m_pParent->PixelToLogic( rMEvt.GetPosPixel() );
162  m_pParent->GrabFocus();
163  bool bHandled = false;
164  if ( rMEvt.IsLeft() )
165  {
166  if ( rMEvt.GetClicks() > 1 )
167  {
168  // show property browser
169  uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
170  { "ShowProperties", uno::Any(true) }
171  }));
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);
179  bHandled = true;
180  }
181  else
182  {
184 
185  // if selected object was hit, drag object
186  if ( pHdl!=nullptr || m_rView.IsMarkedHit(m_aMDPos) )
187  {
188  bHandled = true;
189  m_pParent->CaptureMouse();
190  m_pParent->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos, pHdl,&m_rView);
191  }
192  }
193  }
194  else if ( rMEvt.IsRight() && !rMEvt.IsLeft() && rMEvt.GetClicks() == 1 ) // mark object when context menu was selected
195  {
197  SdrViewEvent aVEvt;
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);
202  else
203  m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
204 
205  bHandled = true;
206  }
207  else if( !rMEvt.IsLeft() )
208  bHandled = true;
209  if ( !bHandled )
210  m_pParent->CaptureMouse();
211  return bHandled;
212 }
213 
214 
215 bool DlgEdFunc::MouseButtonUp( const MouseEvent& /*rMEvt*/ )
216 {
217  m_pParent->getSectionWindow()->getViewsWindow()->stopScrollTimer();
218  return false;
219 }
220 
222 {
223  deactivateOle();
224 
225  const sal_uInt16 nClicks = rMEvt.GetClicks();
226  if ( !(nClicks == 2 && rMEvt.IsLeft()) )
227  return;
228 
229  if ( m_rView.AreObjectsMarked() )
230  {
231  const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
232  if (rMarkList.GetMarkCount() == 1)
233  {
234  const SdrMark* pMark = rMarkList.GetMark(0);
235  SdrObject* pObj = pMark->GetMarkedSdrObj();
236  activateOle(pObj);
237  }
238  }
239 }
240 
242 {
244  aScrollTimer.Stop();
245  if ( m_pParent->IsMouseCaptured() )
246  m_pParent->ReleaseMouse();
247 }
248 
249 
250 bool DlgEdFunc::MouseMove( const MouseEvent& /*rMEvt*/ )
251 {
252  return false;
253 }
254 
256 {
257  bool bReturn = false;
258 
259  if ( !m_bUiActive )
260  {
261  const vcl::KeyCode& rCode = _rEvent.GetKeyCode();
262  sal_uInt16 nCode = rCode.GetCode();
263 
264  switch ( nCode )
265  {
266  case KEY_ESCAPE:
267  {
268  if ( m_pParent->getSectionWindow()->getViewsWindow()->IsAction() )
269  {
270  m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
271  bReturn = true;
272  }
273  else if ( m_rView.IsTextEdit() )
274  {
276  bReturn = true;
277  }
278  else if ( m_rView.AreObjectsMarked() )
279  {
280  const SdrHdlList& rHdlList = m_rView.GetHdlList();
281  SdrHdl* pHdl = rHdlList.GetFocusHdl();
282  if ( pHdl )
283  const_cast<SdrHdlList&>(rHdlList).ResetFocusHdl();
284  else
285  m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
286 
287  deactivateOle(true);
288  bReturn = false;
289  }
290  else
291  {
292  deactivateOle(true);
293  }
294  }
295  break;
296  case KEY_TAB:
297  {
298  if ( !rCode.IsMod1() && !rCode.IsMod2() )
299  {
300  // mark next object
301  if ( !m_rView.MarkNextObj( !rCode.IsShift() ) )
302  {
303  // if no next object, mark first/last
305  m_rView.MarkNextObj( !rCode.IsShift() );
306  }
307 
308  if ( m_rView.AreObjectsMarked() )
310 
311  bReturn = true;
312  }
313  else if ( rCode.IsMod1() && rCode.IsMod2())
314  {
315  // selected handle
316  const SdrHdlList& rHdlList = m_rView.GetHdlList();
317  const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl( !rCode.IsShift() );
318 
319  // guarantee visibility of focused handle
320  SdrHdl* pHdl = rHdlList.GetFocusHdl();
321  if ( pHdl )
322  {
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);
326  }
327 
328  bReturn = true;
329  }
330  }
331  break;
332  case KEY_UP:
333  case KEY_DOWN:
334  case KEY_LEFT:
335  case KEY_RIGHT:
336  {
337  m_pParent->getSectionWindow()->getViewsWindow()->handleKey(rCode);
338  bReturn = true;
339  }
340  break;
341  case KEY_RETURN:
342  if ( !rCode.IsMod1() )
343  {
344  const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
345  if ( rMarkList.GetMarkCount() == 1 )
346  {
347  SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
348  activateOle(pObj);
349  }
350  }
351  break;
352  case KEY_DELETE:
353  if ( !rCode.IsMod1() && !rCode.IsMod2() )
354  {
355  bReturn = true;
356  break;
357  }
358  [[fallthrough]];
359  default:
360  {
361  bReturn = m_rView.KeyInput(_rEvent, m_pParent);
362  }
363  break;
364  }
365  }
366 
367  if ( bReturn && m_pParent->IsMouseCaptured() )
368  m_pParent->ReleaseMouse();
369 
370  return bReturn;
371 }
372 
374 {
375  if ( !_pObj )
376  return;
377 
378  const sal_uInt16 nSdrObjKind = _pObj->GetObjIdentifier();
379 
380  // OLE: activate
381 
382  if (nSdrObjKind != OBJ_OLE2)
383  return;
384 
385  SdrOle2Obj* pOleObj = dynamic_cast<SdrOle2Obj*>(_pObj);
386  if (!(pOleObj && pOleObj->GetObjRef().is()))
387  return;
388 
389  if (m_rView.IsTextEdit())
390  {
392  }
393 
394  pOleObj->AddOwnLightClient();
396  try
397  {
398  pOleObj->GetObjRef()->changeState( embed::EmbedStates::UI_ACTIVE );
399  m_bUiActive = true;
400  OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
401  m_bShowPropertyBrowser = rController.isCommandChecked(SID_SHOW_PROPERTYBROWSER);
403  rController.executeChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue >());
404  }
405  catch( uno::Exception& )
406  {
407  DBG_UNHANDLED_EXCEPTION("reportdesign");
408  }
409 }
410 
411 void DlgEdFunc::deactivateOle(bool _bSelect)
412 {
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)
417  {
418  SdrOle2Obj* pObj = rObjCache[i];
419  if ( m_pParent->getPage() == pObj->getSdrPageFromSdrObject() )
420  {
421  uno::Reference< embed::XEmbeddedObject > xObj = pObj->GetObjRef();
422  if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::UI_ACTIVE )
423  {
424  xObj->changeState( embed::EmbedStates::RUNNING );
425  m_bUiActive = false;
427  {
428  rController.executeChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue >());
429  }
430 
431  if ( _bSelect )
432  {
434  m_rView.MarkObj(pObj, pPV);
435  }
436  }
437  }
438  }
439 }
440 
442 {
443  OObjectBase* pObj = dynamic_cast<OObjectBase*>(_pOverlappedObj);
444  if ( !pObj )
445  return;
446 
447  const uno::Reference<report::XReportComponent>& xComponent = pObj->getReportComponent();
448  if (xComponent.is() && xComponent != m_xOverlappingObj)
449  {
450  OReportModel& rRptModel(static_cast< OReportModel& >(_pOverlappedObj->getSdrModelFromSdrObject()));
452 
453  // uncolorize an old object, if there is one
455 
457  m_xOverlappingObj = xComponent;
458  m_pOverlappingObj = _pOverlappedObj;
459  }
460 }
461 
463 {
464  // uncolorize an old object, if there is one
465  if (m_xOverlappingObj.is())
466  {
467  OReportModel& rRptModel(static_cast< OReportModel& >(m_pOverlappingObj->getSdrModelFromSdrObject()));
469 
471  m_xOverlappingObj = nullptr;
472  m_pOverlappingObj = nullptr;
473  }
474 }
475 
477 {
478  SdrViewEvent aVEvt;
479  bool bOverlapping = m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONUP, aVEvt) != SdrHitKind::NONE;
480  if (bOverlapping && aVEvt.mpObj)
481  {
483  }
484  else
485  {
487  }
488 
489  return bOverlapping;
490 }
491 
493 {
494  if ( m_pParent->getSectionWindow()->getViewsWindow()->IsDragObj() )
495  {
496  if ( isRectangleHit(rMEvt) )
497  {
498  // there is another component under use, break action
499  m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
500  }
501  // object was dragged
502  Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
503  if (m_bSelectionMode)
504  {
505  m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
506  }
507  else
508  {
509  bool bControlKeyPressed = rMEvt.IsMod1();
510  // Don't allow points smaller 0
511  if (bControlKeyPressed && (aPnt.Y() < 0))
512  {
513  aPnt.setY( 0 );
514  }
515  if (m_rView.IsDragResize())
516  {
517  // we resize the object don't resize to above sections
518  if ( aPnt.Y() < 0 )
519  {
520  aPnt.setY( 0 );
521  }
522  }
523  m_pParent->getSectionWindow()->getViewsWindow()->EndDragObj( bControlKeyPressed, &m_rView, aPnt );
524  }
525  m_pParent->getSectionWindow()->getViewsWindow()->ForceMarkedToAnotherPage();
526  m_pParent->Invalidate(InvalidateFlags::Children);
527  }
528  else
529  m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
530 }
531 
533 {
534  bool bReturn = true;
535  const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
536  for (size_t i = 0; i < rMarkList.GetMarkCount(); ++i )
537  {
538  SdrMark* pMark = rMarkList.GetMark(i);
539  SdrObject* pObj = pMark->GetMarkedSdrObj();
540  if (pObj->GetObjIdentifier() != OBJ_CUSTOMSHAPE)
541  {
542  // we found an object in the marked objects, which is not a custom shape.
543  bReturn = false;
544  break;
545  }
546  }
547  return bReturn;
548 }
549 
551 {
553  {
554  return false;
555  }
556 
557  SdrViewEvent aVEvt;
558  const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SdrMouseEventKind::MOVE, aVEvt);
559  bool bIsSetPoint = (eHit == SdrHitKind::UnmarkedObject);
560  if ( !bIsSetPoint )
561  {
562  // no drag rect, we have to check every single select rect
563  const SdrDragStat& rDragStat = m_rView.GetDragStat();
564  if (rDragStat.GetDragMethod() != nullptr)
565  {
566  SdrObjListIter aIter(m_pParent->getPage(),SdrIterMode::DeepNoGroups);
567  // loop through all marked objects and check if there new rect overlapps an old one.
568  for (;;)
569  {
570  SdrObject* pObjIter = aIter.Next();
571  if( !pObjIter || bIsSetPoint)
572  break;
573  if ( m_rView.IsObjMarked(pObjIter)
574  && (dynamic_cast<OUnoObject*>(pObjIter) != nullptr || dynamic_cast<OOle2Obj*>(pObjIter) != nullptr) )
575  {
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();
583 
584  if ( rDragStat.GetDragMethod()->getMoveOnly() )
585  aNewRect.Move(nDx,nDy);
586  else
587  ::ResizeRect(aNewRect,rDragStat.GetRef1(),rDragStat.GetXFact(),rDragStat.GetYFact());
588 
589 
590  SdrObject* pObjOverlapped = isOver(aNewRect,*m_pParent->getPage(),m_rView,false,pObjIter, ISOVER_IGNORE_CUSTOMSHAPES);
591  bIsSetPoint = pObjOverlapped != nullptr;
592  if (pObjOverlapped && !m_bSelectionMode)
593  {
594  colorizeOverlappedObject(pObjOverlapped);
595  }
596  }
597  }
598  }
599  }
600  else if (aVEvt.mpObj && (aVEvt.mpObj->GetObjIdentifier() != OBJ_CUSTOMSHAPE) && !m_bSelectionMode)
601  {
603  }
604  else
605  bIsSetPoint = false;
606  return bIsSetPoint;
607 }
608 
610 {
611  bool bIsSetPoint = isRectangleHit(rMEvt);
612  if ( bIsSetPoint )
613  m_pParent->SetPointer( PointerStyle::NotAllowed );
614  else
615  {
616  bool bCtrlKey = rMEvt.IsMod1();
617  if (bCtrlKey)
618  {
619  m_pParent->SetPointer( PointerStyle::MoveDataLink );
620  bIsSetPoint = true;
621  }
622  }
623  return bIsSetPoint;
624 }
625 
626 
628  DlgEdFunc( _pParent )
629 {
631 }
632 
633 
635 {
637 }
638 
639 
641 {
642  if ( DlgEdFunc::MouseButtonDown(rMEvt) )
643  return true;
644 
645  SdrViewEvent aVEvt;
646  sal_Int16 nId = m_rView.GetCurrentObjIdentifier();
647 
648  const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
649 
650  if (eHit == SdrHitKind::UnmarkedObject && nId != OBJ_CUSTOMSHAPE)
651  {
652  // there is an object under the mouse cursor, but not a customshape
653  m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
654  return false;
655  }
656 
657  // if no action, create object
658  if (!m_pParent->getSectionWindow()->getViewsWindow()->IsAction())
659  {
660  deactivateOle(true);
661  if ( m_pParent->getSectionWindow()->getViewsWindow()->HasSelection() )
662  m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(&m_rView);
664  m_pParent->getSectionWindow()->getViewsWindow()->createDefault();
665  }
666 
667  return true;
668 }
669 
670 
672 {
673  if ( DlgEdFunc::MouseButtonUp( rMEvt ) )
674  return true;
675 
676  const Point aPos( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
677  const sal_uInt16 nHitLog = sal_uInt16 ( m_pParent->PixelToLogic(Size(3,0)).Width() );
678 
679  bool bReturn = true;
680  // object creation active?
681  if ( m_rView.IsCreateObj() )
682  {
683  if ( isOver(m_rView.GetCreateObj(),*m_pParent->getPage(),m_rView) )
684  {
685  m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
686  // BrkAction disables the create mode
688  return true;
689  }
690 
691  m_rView.EndCreateObj(SdrCreateCmd::ForceEnd);
692 
693  if ( !m_rView.AreObjectsMarked() )
694  {
695  m_rView.MarkObj(aPos, nHitLog);
696  }
697 
698  bReturn = m_rView.AreObjectsMarked();
699  if ( bReturn )
700  {
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 )
704  {
705  SdrMark* pMark = rMarkList.GetMark(i);
706  OOle2Obj* pObj = dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj());
707  if ( pObj && !pObj->IsEmpty() )
708  {
709  pObj->initializeChart(rController.getModel());
710  }
711  }
712  }
713  }
714  else
715  checkMovementAllowed(rMEvt);
716 
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() )
721  {
723  SdrViewEvent aVEvt;
724  m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
725  m_rView.MarkObj(aVEvt.mpRootObj, pPV);
726  }
727  checkTwoClicks(rMEvt);
728  m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
729  return bReturn;
730 }
731 
732 
734 {
735  if ( DlgEdFunc::MouseMove(rMEvt ) )
736  return true;
737  Point aPos( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
738 
739  if ( m_rView.IsCreateObj() )
740  {
743  }
744 
745  bool bIsSetPoint = false;
746  if ( m_rView.IsAction() )
747  {
748  if ( m_rView.IsDragResize() )
749  {
750  // we resize the object don't resize to above sections
751  if ( aPos.Y() < 0 )
752  {
753  aPos.setY( 0 );
754  }
755  }
756  bIsSetPoint = setMovementPointer(rMEvt);
757  ForceScroll(aPos);
758  m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPos,&m_rView, false);
759  }
760 
761  if ( !bIsSetPoint )
762  m_pParent->SetPointer( m_rView.GetPreferredPointer( aPos, m_pParent->GetOutDev()) );
763 
764  return true;
765 }
766 
767 
769  DlgEdFunc( _pParent )
770 {
771 }
772 
773 
775 {
776 }
777 
778 
780 {
781  m_bSelectionMode = false;
782  if ( DlgEdFunc::MouseButtonDown(rMEvt) )
783  return true;
784 
785  SdrViewEvent aVEvt;
786  const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
787  if( eHit == SdrHitKind::UnmarkedObject )
788  {
789  // if not multi selection, unmark all
790  if ( !rMEvt.IsShift() )
791  m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
792 
793  if ( m_rView.MarkObj(m_aMDPos) && rMEvt.IsLeft() )
794  {
795  // drag object
796  m_pParent->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos, m_rView.PickHandle(m_aMDPos), &m_rView);
797  }
798  else
799  {
800  // select object
801  m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj(m_aMDPos,&m_rView);
802  }
803  }
804  else
805  {
806  if( !rMEvt.IsShift() )
807  m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
808 
809  if ( rMEvt.GetClicks() == 1 )
810  {
811  m_bSelectionMode = true;
812  m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos ,&m_rView);
813  }
814  else
815  {
817  }
818  }
819 
820  return true;
821 }
822 
823 
825 {
826  if ( DlgEdFunc::MouseButtonUp( rMEvt ) )
827  return true;
828 
829  // get view from parent
830  const Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
831 
832  if ( rMEvt.IsLeft() ) // left mousebutton pressed
833  checkMovementAllowed(rMEvt);
834 
835  m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
836  checkTwoClicks(rMEvt);
837 
838  m_pParent->SetPointer( m_rView.GetPreferredPointer( aPnt, m_pParent->GetOutDev() ) );
839 
840  if ( !m_bUiActive )
841  m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
842  m_bSelectionMode = false;
843  return true;
844 }
845 
846 
848 {
849  if ( DlgEdFunc::MouseMove(rMEvt ) )
850  return true;
851 
852  Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
853  bool bIsSetPoint = false;
854 
855  if ( m_rView.IsAction() ) // Drag Mode
856  {
857  bIsSetPoint = setMovementPointer(rMEvt);
858  ForceScroll(aPnt);
859  if (m_rView.GetDragMethod()==nullptr)
860  {
861  // create a selection
862  m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPnt, &m_rView, false);
863  }
864  else
865  {
866  if ( m_rView.IsDragResize() )
867  {
868  // we resize the object don't resize to above sections
869  if ( aPnt.Y() < 0 )
870  {
871  aPnt.setY( 0 );
872  }
873  }
874  // drag or resize an object
875  bool bControlKey = rMEvt.IsMod1();
876  m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPnt, &m_rView, bControlKey);
877  }
878  }
879 
880  if ( !bIsSetPoint )
881  {
882  m_pParent->SetPointer( m_rView.GetPreferredPointer( aPnt, m_pParent->GetOutDev() ) );
883 
884  // restore color
886  }
887 
888  return true;
889 }
890 
891 
892 }
893 
894 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~DlgEdFuncInsert() override
Definition: dlgedfunc.cxx:634
virtual ~DlgEdFunc()
Definition: dlgedfunc.cxx:152
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
virtual bool MouseButtonUp(const MouseEvent &rMEvt)
Definition: dlgedfunc.cxx:215
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:867
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dlgedfunc.cxx:779
void activateOle(SdrObject *_pObj)
activate object if it is of type OBJ_OLE2
Definition: dlgedfunc.cxx:373
bool BegCreateObj(const Point &rPnt, OutputDevice *pOut=nullptr, short nMinMov=-3)
tools::Long GetDY() const
DlgEdFunc(const DlgEdFunc &)=delete
constexpr tools::Long Left() const
bool Contains(const Point &rPOINT) const
bool AreObjectsMarked() const
const SdrDragStat & GetDragStat() const
long Long
void colorizeOverlappedObject(SdrObject *_pOverlappedObj)
Definition: dlgedfunc.cxx:441
sal_Int16 nId
bool IsShift() const
virtual bool MouseButtonDown(const MouseEvent &rMEvt)
Definition: dlgedfunc.cxx:159
sal_uInt16 GetCode() const
void checkTwoClicks(const MouseEvent &rMEvt)
Definition: dlgedfunc.cxx:221
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: dlgedfunc.cxx:671
SdrMark * GetMark(size_t nNum) const
bool m_bShowPropertyBrowser
Definition: dlgedfunc.hxx:57
virtual bool MouseMove(const MouseEvent &rMEvt)
Definition: dlgedfunc.cxx:250
const Point & GetPos() const
SdrHitKind PickAnything(const MouseEvent &rMEvt, SdrMouseEventKind nMouseDownOrMoveOrUp, SdrViewEvent &rVEvt) const
virtual SdrObjKind GetObjIdentifier() const
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:550
sal_uInt16 GetClicks() 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:532
#define SELENG_AUTOREPEAT_INTERVAL
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: dlgedfunc.cxx:733
int nCount
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dlgedfunc.cxx:640
DlgEdFuncSelect(OReportSection *pParent)
Definition: dlgedfunc.cxx:768
#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:609
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:824
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:476
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)
constexpr tools::Long Right() const
SdrObject * mpRootObj
virtual void Start(bool bStartTimer=true) override
SdrHdl * PickHandle(const Point &rPnt) const
bool IsDragResize() const
SdrModel & getSdrModelFromSdrObject() const
constexpr tools::Long Top() const
OScrollWindowHelper * getScrollWindow() const
OViewsWindow * getViewsWindow()
Point PixelToLogic(const Point &rDevicePt) const
virtual ~DlgEdFuncSelect() override
Definition: dlgedfunc.cxx:774
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:492
bool MarkNextObj(bool bPrev=false)
void setOverlappedControlColor(Color _nColor)
Definition: dlgedfunc.cxx:125
const tools::Rectangle & GetAllMarkedRect() const
static Color lcl_setColorOfObject(const uno::Reference< uno::XInterface > &_xObj, Color _nColorTRGB)
Definition: dlgedfunc.cxx:130
constexpr sal_uInt16 KEY_RETURN
Color m_nOverlappedControlColor
Definition: dlgedfunc.hxx:53
const Point & GetRef1() const
constexpr sal_uInt16 KEY_RIGHT
SdrDragMethod * GetDragMethod() const
constexpr tools::Long Bottom() const
bool IsCreateObj() 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:627
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()
SdrObject * mpObj
constexpr sal_uInt16 KEY_ESCAPE
void stopScrollTimer()
Definition: dlgedfunc.cxx:241
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:847
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
bool handleKeyEvent(const KeyEvent &_rEvent)
checks if the keycode is known by the child windows
Definition: dlgedfunc.cxx:255
SdrPageView * GetSdrPageView() const
Size GetOutputSizePixel() 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:65
bool IsVerFixed() const
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
void unColorizeOverlappedObj()
Definition: dlgedfunc.cxx:462
OBJ_OLE2
SVXCORE_DLLPUBLIC size_t size() 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:411
bool IsMod1() const
bool IsMod2() const
css::uno::Reference< css::uno::XInterface > m_xOverlappingObj
Definition: dlgedfunc.hxx:51
bool IsObjMarked(SdrObject const *pObj) const