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