LibreOffice Module reportdesign (master)  1
ViewsWindow.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 
20 #include <ViewsWindow.hxx>
21 #include <ScrollHelper.hxx>
22 #include <UndoActions.hxx>
23 #include <ReportWindow.hxx>
24 #include <DesignView.hxx>
25 #include <svtools/colorcfg.hxx>
26 #include <ReportController.hxx>
27 #include <UITools.hxx>
28 #include <RptDef.hxx>
29 #include <strings.hrc>
30 #include <SectionView.hxx>
31 #include <ReportSection.hxx>
32 #include <strings.hxx>
33 #include <rptui_slotid.hrc>
34 #include <dlgedclip.hxx>
35 #include <RptObject.hxx>
36 #include <EndMarker.hxx>
37 #include <sal/log.hxx>
38 #include <vcl/svapp.hxx>
39 #include <vcl/settings.hxx>
40 #include <core_resource.hxx>
41 #include <svx/svdundo.hxx>
43 #include <algorithm>
44 #include <cstdlib>
45 #include <numeric>
46 
47 namespace rptui
48 {
49 #define DEFAUL_MOVE_SIZE 100
50 
51 using namespace ::com::sun::star;
52 using namespace ::comphelper;
53 
54 static bool lcl_getNewRectSize(const tools::Rectangle& _aObjRect,tools::Long& _nXMov, tools::Long& _nYMov,SdrObject const * _pObj,SdrView const * _pView, ControlModification _nControlModification)
55 {
56  bool bMoveAllowed = _nXMov != 0 || _nYMov != 0;
57  if ( bMoveAllowed )
58  {
59  tools::Rectangle aNewRect = _aObjRect;
60  SdrObject* pOverlappedObj = nullptr;
61  do
62  {
63  aNewRect = _aObjRect;
64  switch(_nControlModification)
65  {
68  aNewRect.setWidth(_nXMov);
69  aNewRect.setHeight(_nYMov);
70  break;
71  default:
72  aNewRect.Move(_nXMov,_nYMov);
73  break;
74  }
75  if (dynamic_cast<OUnoObject const *>(_pObj) != nullptr || dynamic_cast<OOle2Obj const *>(_pObj) != nullptr)
76  {
77  pOverlappedObj = isOver(aNewRect,*_pObj->getSdrPageFromSdrObject(),*_pView,true,_pObj);
78  if ( pOverlappedObj && _pObj != pOverlappedObj )
79  {
80  tools::Rectangle aOverlappingRect = pOverlappedObj->GetSnapRect();
81  sal_Int32 nXTemp = _nXMov;
82  sal_Int32 nYTemp = _nYMov;
83  switch(_nControlModification)
84  {
86  nXTemp += aOverlappingRect.Right() - aNewRect.Left();
87  bMoveAllowed = _nXMov != nXTemp;
88  break;
90  nXTemp += aOverlappingRect.Left() - aNewRect.Right();
91  bMoveAllowed = _nXMov != nXTemp;
92  break;
94  nYTemp += aOverlappingRect.Bottom() - aNewRect.Top();
95  bMoveAllowed = _nYMov != nYTemp;
96  break;
98  nYTemp += aOverlappingRect.Top() - aNewRect.Bottom();
99  bMoveAllowed = _nYMov != nYTemp;
100  break;
102  if ( _aObjRect.Left() < aOverlappingRect.Left() )
103  nXTemp += aOverlappingRect.Left() - aNewRect.Left() - aNewRect.getWidth();
104  else
105  nXTemp += aOverlappingRect.Right() - aNewRect.Left();
106  bMoveAllowed = _nXMov != nXTemp;
107  break;
109  if ( _aObjRect.Top() < aOverlappingRect.Top() )
110  nYTemp += aOverlappingRect.Top() - aNewRect.Top() - aNewRect.getHeight();
111  else
112  nYTemp += aOverlappingRect.Bottom() - aNewRect.Top();
113  bMoveAllowed = _nYMov != nYTemp;
114  break;
117  {
118  tools::Rectangle aIntersectionRect = aNewRect.GetIntersection(aOverlappingRect);
119  if ( !aIntersectionRect.IsEmpty() )
120  {
121  if ( _nControlModification == ControlModification::WIDTH_GREATEST )
122  {
123  if ( aNewRect.Left() < aIntersectionRect.Left() )
124  {
125  aNewRect.SetRight( aIntersectionRect.Left() );
126  }
127  else if ( aNewRect.Left() < aIntersectionRect.Right() )
128  {
129  aNewRect.SetLeft( aIntersectionRect.Right() );
130  }
131  }
132  else if ( _nControlModification == ControlModification::HEIGHT_GREATEST )
133  {
134  if ( aNewRect.Top() < aIntersectionRect.Top() )
135  {
136  aNewRect.SetBottom( aIntersectionRect.Top() );
137  }
138  else if ( aNewRect.Top() < aIntersectionRect.Bottom() )
139  {
140  aNewRect.SetTop( aIntersectionRect.Bottom() );
141  }
142  }
143  nYTemp = aNewRect.getHeight();
144  bMoveAllowed = _nYMov != nYTemp;
145  nXTemp = aNewRect.getWidth();
146  bMoveAllowed = bMoveAllowed && _nXMov != nXTemp;
147  }
148  }
149  break;
150  default:
151  break;
152  }
153 
154  _nXMov = nXTemp;
155  _nYMov = nYTemp;
156  }
157  else
158  pOverlappedObj = nullptr;
159  }
160  }
161  while ( pOverlappedObj && bMoveAllowed );
162  }
163  return bMoveAllowed;
164 }
165 
167  : Window( _pReportWindow,WB_DIALOGCONTROL)
168  , m_pParent(_pReportWindow)
169  , m_bInUnmark(false)
170 {
171  SetPaintTransparent(true);
172  SetMapMode(MapMode(MapUnit::Map100thMM));
173  m_aColorConfig.AddListener(this);
175 }
176 
178 {
179  disposeOnce();
180 }
181 
183 {
184  m_aColorConfig.RemoveListener(this);
185  for (auto& rxSection : m_aSections)
186  rxSection.disposeAndClear();
187  m_aSections.clear();
188  m_pParent.clear();
190 }
191 
192 void OViewsWindow::impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Point& _rStartPoint,bool _bSet)
193 {
194  const uno::Reference< report::XSection> xSection = _rSectionWindow.getReportSection().getSection();
195 
196  Size aSectionSize = _rSectionWindow.LogicToPixel( Size( 0,xSection->getHeight() ) );
197  aSectionSize.setWidth( getView()->GetTotalWidth() );
198 
199  const sal_Int32 nMinHeight = _rSectionWindow.getStartMarker().getMinHeight();
200  if ( _rSectionWindow.getStartMarker().isCollapsed() || nMinHeight > aSectionSize.Height() )
201  {
202  aSectionSize.setHeight( nMinHeight );
203  }
204  aSectionSize.AdjustHeight(static_cast<tools::Long>(StyleSettings::GetSplitSize() * static_cast<double>(_rSectionWindow.GetMapMode().GetScaleY())) );
205 
206  if ( _bSet )
207  _rSectionWindow.SetPosSizePixel(_rStartPoint,aSectionSize);
208 
209  _rStartPoint.AdjustY(aSectionSize.Height() );
210 }
211 
212 
213 void OViewsWindow::resize(const OSectionWindow& _rSectionWindow)
214 {
215  bool bSet = false;
216  Point aStartPoint;
217  for (VclPtr<OSectionWindow> const & pSectionWindow : m_aSections)
218  {
219  if ( pSectionWindow == &_rSectionWindow )
220  {
221  aStartPoint = pSectionWindow->GetPosPixel();
222  bSet = true;
223  }
224 
225  if ( bSet )
226  {
227  impl_resizeSectionWindow(*pSectionWindow,aStartPoint,bSet);
228  static const InvalidateFlags nIn = InvalidateFlags::Update | InvalidateFlags::Transparent;
229  pSectionWindow->getStartMarker().Invalidate( nIn ); // InvalidateFlags::NoErase |InvalidateFlags::NoChildren| InvalidateFlags::Transparent
230  pSectionWindow->getEndMarker().Invalidate( nIn );
231  }
232  }
233  m_pParent->notifySizeChanged();
234 }
235 
237 {
238  Window::Resize();
239  if ( !m_aSections.empty() )
240  {
241  const Point aOffset(m_pParent->getThumbPos());
242  Point aStartPoint(0,-aOffset.Y());
243  for (VclPtr<OSectionWindow> const & pSectionWindow : m_aSections)
244  {
245  impl_resizeSectionWindow(*pSectionWindow,aStartPoint,true);
246  }
247  }
248 }
249 
250 void OViewsWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
251 {
252  Window::Paint(rRenderContext, rRect);
253 
254  rRenderContext.SetBackground();
255  rRenderContext.SetFillColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
256  rRenderContext.SetTextFillColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
257 
258  Size aOut(GetOutputSizePixel());
259  tools::Long nStartWidth = tools::Long(REPORT_STARTMARKER_WIDTH * rRenderContext.GetMapMode().GetScaleX());
260 
261  aOut.AdjustWidth( -nStartWidth );
262  aOut = rRenderContext.PixelToLogic(aOut);
263 
264  tools::Rectangle aRect(rRenderContext.PixelToLogic(Point(nStartWidth,0)), aOut);
266  rRenderContext.DrawWallpaper(aRect, aWall);
267 }
268 
270 {
272 }
273 
275 {
276  Window::DataChanged( rDCEvt );
277 
278  if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
279  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
280  {
282  Invalidate();
283  }
284 }
285 
286 void OViewsWindow::addSection(const uno::Reference< report::XSection >& _xSection,const OUString& _sColorEntry,sal_uInt16 _nPosition)
287 {
288  VclPtrInstance<OSectionWindow> pSectionWindow(this,_xSection,_sColorEntry);
289  m_aSections.insert(getIteratorAtPos(_nPosition) , TSectionsMap::value_type(pSectionWindow));
290  m_pParent->setMarked(&pSectionWindow->getReportSection().getSectionView(),m_aSections.size() == 1);
291  Resize();
292 }
293 
294 void OViewsWindow::removeSection(sal_uInt16 _nPosition)
295 {
296  if ( _nPosition < m_aSections.size() )
297  {
298  TSectionsMap::iterator aPos = getIteratorAtPos(_nPosition);
299  TSectionsMap::const_iterator aNew = getIteratorAtPos(_nPosition == 0 ? _nPosition+1: _nPosition - 1);
300 
301  m_pParent->getReportView()->UpdatePropertyBrowserDelayed((*aNew)->getReportSection().getSectionView());
302 
303  aPos->disposeAndClear();
304  m_aSections.erase(aPos);
305  Resize();
306  }
307 }
308 
309 void OViewsWindow::toggleGrid(bool _bVisible)
310 {
311  ::std::for_each(m_aSections.begin(),m_aSections.end(),
312  [_bVisible] (const TSectionsMap::value_type& sectionPtr) {
313  sectionPtr->getReportSection().SetGridVisible(_bVisible);
314  });
315  ::std::for_each(m_aSections.begin(),m_aSections.end(),
316  [] (const TSectionsMap::value_type& sectionPtr) {
317  sectionPtr->getReportSection().Window::Invalidate(InvalidateFlags::NoErase);
318  });
319 }
320 
322 {
323  return std::accumulate(m_aSections.begin(), m_aSections.end(), sal_Int32(0),
324  [](const sal_Int32 nHeight, const VclPtr<OSectionWindow>& rxSection) { return nHeight + rxSection->GetSizePixel().Height(); });
325 }
326 
328 {
329  return static_cast<sal_uInt16>(m_aSections.size());
330 }
331 
332 void OViewsWindow::SetInsertObj( SdrObjKind eObj,const OUString& _sShapeType )
333 {
334  for (const auto& rxSection : m_aSections)
335  rxSection->getReportSection().getSectionView().SetCurrentObj( eObj, SdrInventor::ReportDesign );
336 
337  m_sShapeType = _sShapeType;
338 }
339 
340 
342 {
343  ::std::for_each(m_aSections.begin(),m_aSections.end(),
344  [&eNewMode] (const TSectionsMap::value_type& sectionPtr) {
345  sectionPtr->getReportSection().SetMode(eNewMode);
346  });
347 }
348 
350 {
351  return std::any_of(m_aSections.begin(), m_aSections.end(),
352  [](const VclPtr<OSectionWindow>& rxSection) { return rxSection->getReportSection().getSectionView().AreObjectsMarked(); });
353 }
354 
356 {
357  m_bInUnmark = true;
358  ::std::for_each(m_aSections.begin(),m_aSections.end(),
359  [] (const TSectionsMap::value_type& sectionPtr) {
360  sectionPtr->getReportSection().Delete();
361  });
362  m_bInUnmark = false;
363 }
364 
366 {
367  uno::Sequence< beans::NamedValue > aAllreadyCopiedObjects;
368  ::std::for_each(m_aSections.begin(),m_aSections.end(),
369  [&aAllreadyCopiedObjects] (const TSectionsMap::value_type& sectionPtr) {
370  sectionPtr->getReportSection().Copy(aAllreadyCopiedObjects);
371  });
372 
373  rtl::Reference<OReportExchange> pCopy = new OReportExchange(aAllreadyCopiedObjects);
374  pCopy->CopyToClipboard(this);
375 }
376 
378 {
381  if ( aCopies.getLength() > 1 )
382  ::std::for_each(m_aSections.begin(),m_aSections.end(),
383  [&aCopies] (const TSectionsMap::value_type& sectionPtr) {
384  sectionPtr->getReportSection().Paste(aCopies);
385  });
386  else
387  {
388  OSectionWindow* pMarkedSection = getMarkedSection();
389  if ( pMarkedSection )
390  pMarkedSection->getReportSection().Paste(aCopies,true);
391  }
392 }
393 
394 OSectionWindow* OViewsWindow::getSectionWindow(const uno::Reference< report::XSection>& _xSection) const
395 {
396  OSL_ENSURE(_xSection.is(),"Section is NULL!");
397 
398  OSectionWindow* pSectionWindow = nullptr;
399  for (VclPtr<OSectionWindow> const & p : m_aSections)
400  {
401  if (p->getReportSection().getSection() == _xSection)
402  {
403  pSectionWindow = p.get();
404  break;
405  }
406  }
407 
408  return pSectionWindow;
409 }
410 
411 
413 {
414  OSectionWindow* pRet = nullptr;
415  TSectionsMap::const_iterator aIter = m_aSections.begin();
416  TSectionsMap::const_iterator aEnd = m_aSections.end();
417  sal_uInt32 nCurrentPosition = 0;
418  for (; aIter != aEnd ; ++aIter)
419  {
420  if ( (*aIter)->getStartMarker().isMarked() )
421  {
422  if (nsa == CURRENT)
423  {
424  pRet = aIter->get();
425  break;
426  }
427  else if ( nsa == PREVIOUS )
428  {
429  if (nCurrentPosition > 0)
430  {
431  pRet = (--aIter)->get();
432  if (pRet == nullptr)
433  {
434  pRet = m_aSections.begin()->get();
435  }
436  }
437  else
438  {
439  // if we are out of bounds return the first one
440  pRet = m_aSections.begin()->get();
441  }
442  break;
443  }
444  else if ( nsa == POST )
445  {
446  sal_uInt32 nSize = m_aSections.size();
447  if ((nCurrentPosition + 1) < nSize)
448  {
449  pRet = (++aIter)->get();
450  if (pRet == nullptr)
451  {
452  pRet = (--aEnd)->get();
453  }
454  }
455  else
456  {
457  // if we are out of bounds return the last one
458  pRet = (--aEnd)->get();
459  }
460  break;
461  }
462  }
463  ++nCurrentPosition;
464  }
465 
466  return pRet;
467 }
468 
469 void OViewsWindow::markSection(const sal_uInt16 _nPos)
470 {
471  if ( _nPos < m_aSections.size() )
472  m_pParent->setMarked(m_aSections[_nPos]->getReportSection().getSection(),true);
473 }
474 
476 {
477  TransferableDataHelper aTransferData( TransferableDataHelper::CreateFromSystemClipboard( const_cast< OViewsWindow* >( this ) ) );
478  return aTransferData.HasFormat(OReportExchange::getDescriptorFormatId());
479 }
480 
481 void OViewsWindow::SelectAll(const SdrObjKind _nObjectType)
482 {
483  m_bInUnmark = true;
484  ::std::for_each(m_aSections.begin(),m_aSections.end(),
485  [&_nObjectType] (const TSectionsMap::value_type& sectionPtr) {
486  sectionPtr->getReportSection().SelectAll(_nObjectType);
487  });
488  m_bInUnmark = false;
489 }
490 
491 void OViewsWindow::unmarkAllObjects(OSectionView const * _pSectionView)
492 {
493  if ( m_bInUnmark )
494  return;
495 
496  m_bInUnmark = true;
497  for (const auto& rxSection : m_aSections)
498  {
499  if ( &rxSection->getReportSection().getSectionView() != _pSectionView )
500  {
501  rxSection->getReportSection().deactivateOle();
502  rxSection->getReportSection().getSectionView().UnmarkAllObj();
503  }
504  }
505  m_bInUnmark = false;
506 }
507 
509 {
511  Invalidate();
512 }
513 
515 {
516  if ( rMEvt.IsLeft() )
517  {
518  GrabFocus();
519  const uno::Sequence< beans::PropertyValue> aArgs;
520  getView()->getReportView()->getController().executeChecked(SID_SELECT_REPORT,aArgs);
521  }
522  Window::MouseButtonDown(rMEvt);
523 }
524 
525 void OViewsWindow::showRuler(bool _bShow)
526 {
527  ::std::for_each(m_aSections.begin(),m_aSections.end(),
528  [_bShow] (const TSectionsMap::value_type& sectionPtr) {
529  sectionPtr->getStartMarker().showRuler(_bShow);
530  });
531  ::std::for_each(m_aSections.begin(),m_aSections.end(),
532  [] (const TSectionsMap::value_type& sectionPtr) {
533  sectionPtr->getStartMarker().Window::Invalidate(InvalidateFlags::NoErase);
534  });
535 }
536 
538 {
539  if ( !rMEvt.IsLeft() )
540  return;
541 
542  auto aIter = std::find_if(m_aSections.begin(), m_aSections.end(),
543  [](const VclPtr<OSectionWindow>& rxSection) { return rxSection->getReportSection().getSectionView().AreObjectsMarked(); });
544  if (aIter != m_aSections.end())
545  {
546  (*aIter)->getReportSection().MouseButtonUp(rMEvt);
547  }
548 
549  // remove special insert mode
550  for (const auto& rxSection : m_aSections)
551  {
552  rxSection->getReportSection().getPage()->resetSpecialMode();
553  }
554 }
555 
557 {
558  bool bRet = false;
559  for (const auto& rxSection : m_aSections)
560  {
561  if ( rxSection->getStartMarker().isMarked() )
562  {
563  bRet = rxSection->getReportSection().handleKeyEvent(_rEvent);
564  }
565  }
566  return bRet;
567 }
568 
569 OViewsWindow::TSectionsMap::iterator OViewsWindow::getIteratorAtPos(sal_uInt16 _nPos)
570 {
571  TSectionsMap::iterator aRet = m_aSections.end();
572  if ( _nPos < m_aSections.size() )
573  aRet = m_aSections.begin() + _nPos;
574  return aRet;
575 }
576 
577 void OViewsWindow::setMarked(OSectionView const * _pSectionView, bool _bMark)
578 {
579  OSL_ENSURE(_pSectionView != nullptr,"SectionView is NULL!");
580  if ( _pSectionView )
581  setMarked(_pSectionView->getReportSection()->getSection(),_bMark);
582 }
583 
584 void OViewsWindow::setMarked(const uno::Reference< report::XSection>& _xSection, bool _bMark)
585 {
586  for (const auto& rxSection : m_aSections)
587  {
588  if ( rxSection->getReportSection().getSection() != _xSection )
589  {
590  rxSection->setMarked(false);
591  }
592  else if ( rxSection->getStartMarker().isMarked() != _bMark )
593  {
594  rxSection->setMarked(_bMark);
595  }
596  }
597 }
598 
599 void OViewsWindow::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _aShapes, bool _bMark)
600 {
601  bool bFirst = true;
602  for(const uno::Reference< report::XReportComponent>& rShape : _aShapes)
603  {
604  const uno::Reference< report::XSection> xSection = rShape->getSection();
605  if ( xSection.is() )
606  {
607  if ( bFirst )
608  {
609  bFirst = false;
610  m_pParent->setMarked(xSection,_bMark);
611  }
612  OSectionWindow* pSectionWindow = getSectionWindow(xSection);
613  if ( pSectionWindow )
614  {
616  OSL_ENSURE( pObject, "OViewsWindow::setMarked: no SdrObject for the shape!" );
617  if ( pObject )
618  pSectionWindow->getReportSection().getSectionView().MarkObj( pObject, pSectionWindow->getReportSection().getSectionView().GetSdrPageView(), !_bMark );
619  }
620  }
621  }
622 }
623 
625 {
626  for (const auto& rxSection : m_aSections)
627  {
628  OSectionView& rView = rxSection->getReportSection().getSectionView();
629  if ( rView.AreObjectsMarked() )
630  {
631  rView.SortMarkedObjects();
632  const size_t nCount = rView.GetMarkedObjectCount();
633  for (size_t i=0; i < nCount; ++i)
634  {
635  const SdrMark* pM = rView.GetSdrMarkByIndex(i);
636  SdrObject* pObj = pM->GetMarkedSdrObj();
637  tools::Rectangle aObjRect(pObj->GetSnapRect());
638  _rSortRectangles.emplace(aObjRect,TRectangleMap::mapped_type(pObj,&rView));
639  }
640  }
641  }
642 }
643 
644 void OViewsWindow::collectBoundResizeRect(const TRectangleMap& _rSortRectangles, ControlModification _nControlModification,bool _bAlignAtSection, tools::Rectangle& _rBound, tools::Rectangle& _rResize)
645 {
646  bool bOnlyOnce = false;
647  for (const auto& [aObjRect, rObjViewPair] : _rSortRectangles)
648  {
649  if ( _rResize.IsEmpty() )
650  _rResize = aObjRect;
651  switch(_nControlModification)
652  {
654  if ( _rResize.getWidth() > aObjRect.getWidth() )
655  _rResize = aObjRect;
656  break;
658  if ( _rResize.getHeight() > aObjRect.getHeight() )
659  _rResize = aObjRect;
660  break;
662  if ( _rResize.getWidth() < aObjRect.getWidth() )
663  _rResize = aObjRect;
664  break;
666  if ( _rResize.getHeight() < aObjRect.getHeight() )
667  _rResize = aObjRect;
668  break;
669  default: break;
670  }
671 
673  const SdrObject* pObj = rObjViewPair.first;
674  pObj->TakeObjInfo(aInfo);
675  bool bHasFixed = !aInfo.bMoveAllowed || pObj->IsMoveProtect();
676  if ( bHasFixed )
677  _rBound.Union(aObjRect);
678  else
679  {
680  if ( _bAlignAtSection || _rSortRectangles.size() == 1 )
681  { // align single object at the page
682  if ( ! bOnlyOnce )
683  {
684  bOnlyOnce = true;
685  OReportSection* pReportSection = rObjViewPair.second->getReportSection();
686  const uno::Reference< report::XSection>& xSection = pReportSection->getSection();
687  try
688  {
689  uno::Reference<report::XReportDefinition> xReportDefinition = xSection->getReportDefinition();
690  _rBound.Union(tools::Rectangle(getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN),0,
691  getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width - getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN),
692  xSection->getHeight()));
693  }
694  catch(const uno::Exception &){}
695  }
696  }
697  else
698  {
699  _rBound.Union(rObjViewPair.second->GetMarkedObjRect());
700  }
701  }
702  }
703 }
704 
705 void OViewsWindow::alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection)
706 {
707  if ( _nControlModification == ControlModification::NONE )
708  return;
709 
710  Point aRefPoint;
712  switch (_nControlModification)
713  {
714  case ControlModification::TOP : eCompareMode = RectangleLess::POS_UPPER; break;
715  case ControlModification::BOTTOM: eCompareMode = RectangleLess::POS_DOWN; break;
716  case ControlModification::LEFT : eCompareMode = RectangleLess::POS_LEFT; break;
717  case ControlModification::RIGHT : eCompareMode = RectangleLess::POS_RIGHT; break;
720  {
722  uno::Reference<report::XSection> xSection = (*m_aSections.begin())->getReportSection().getSection();
723  uno::Reference<report::XReportDefinition> xReportDefinition = xSection->getReportDefinition();
724  aRefPoint = tools::Rectangle(getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN),0,
725  getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width - getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN),
726  xSection->getHeight()).Center();
727  }
728  break;
729  default: break;
730  }
731  RectangleLess aCompare(eCompareMode,aRefPoint);
732  TRectangleMap aSortRectangles(aCompare);
733  collectRectangles(aSortRectangles);
734 
735  tools::Rectangle aBound;
736  tools::Rectangle aResize;
737  collectBoundResizeRect(aSortRectangles,_nControlModification,_bAlignAtSection,aBound,aResize);
738 
739  bool bMove = true;
740 
741  auto aGetFun = ::std::mem_fn(&tools::Rectangle::Bottom);
742  auto aSetFun = ::std::mem_fn(&tools::Rectangle::SetBottom);
743  auto aRefFun = ::std::mem_fn(&tools::Rectangle::Top);
744  TRectangleMap::const_iterator aRectIter = aSortRectangles.begin();
745  TRectangleMap::const_iterator aRectEnd = aSortRectangles.end();
746  for (;aRectIter != aRectEnd ; ++aRectIter)
747  {
748  tools::Rectangle aObjRect = aRectIter->first;
749  SdrObject* pObj = aRectIter->second.first;
750  SdrView* pView = aRectIter->second.second;
751  Point aCenter(aBound.Center());
753  pObj->TakeObjInfo(aInfo);
754  if (aInfo.bMoveAllowed && !pObj->IsMoveProtect())
755  {
756  tools::Long nXMov = 0;
757  tools::Long nYMov = 0;
758  tools::Long* pValue = &nXMov;
759  switch(_nControlModification)
760  {
762  aGetFun = ::std::mem_fn(&tools::Rectangle::Top);
763  aSetFun = ::std::mem_fn(&tools::Rectangle::SetTop);
764  aRefFun = ::std::mem_fn(&tools::Rectangle::Bottom);
765  pValue = &nYMov;
766  break;
768  // defaults are already set
769  pValue = &nYMov;
770  break;
772  nYMov = aCenter.Y() - aObjRect.Center().Y();
773  pValue = &nYMov;
774  bMove = false;
775  break;
777  aGetFun = ::std::mem_fn(&tools::Rectangle::Right);
778  aSetFun = ::std::mem_fn(&tools::Rectangle::SetRight);
779  aRefFun = ::std::mem_fn(&tools::Rectangle::Left);
780  break;
782  nXMov = aCenter.X() - aObjRect.Center().X();
783  bMove = false;
784  break;
786  aGetFun = ::std::mem_fn(&tools::Rectangle::Left);
787  aSetFun = ::std::mem_fn(&tools::Rectangle::SetLeft);
788  aRefFun = ::std::mem_fn(&tools::Rectangle::Right);
789  break;
790  default:
791  bMove = false;
792  break;
793  }
794  if ( bMove )
795  {
796  tools::Rectangle aTest = aObjRect;
797  aSetFun(&aTest, aGetFun(&aBound));
798  TRectangleMap::const_iterator aInterSectRectIter = aSortRectangles.begin();
799  for (; aInterSectRectIter != aRectIter; ++aInterSectRectIter)
800  {
801  if ( pView == aInterSectRectIter->second.second && (dynamic_cast<OUnoObject*>(aInterSectRectIter->second.first) || dynamic_cast<OOle2Obj*>(aInterSectRectIter->second.first)))
802  {
803  SdrObject* pPreviousObj = aInterSectRectIter->second.first;
804  tools::Rectangle aIntersectRect = aTest.GetIntersection( pPreviousObj->GetSnapRect());
805  if ( !aIntersectRect.IsEmpty() && (aIntersectRect.Left() != aIntersectRect.Right() && aIntersectRect.Top() != aIntersectRect.Bottom() ) )
806  {
807  *pValue = aRefFun(&aIntersectRect) - aGetFun(&aObjRect);
808  break;
809  }
810  }
811  }
812  if ( aInterSectRectIter == aRectIter )
813  *pValue = aGetFun(&aBound) - aGetFun(&aObjRect);
814  }
815 
816  if ( lcl_getNewRectSize(aObjRect,nXMov,nYMov,pObj,pView,_nControlModification) )
817  {
818  const Size aSize(nXMov,nYMov);
819  pView->AddUndo(pView->GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pObj,aSize));
820  pObj->Move(aSize);
821  aObjRect = pObj->GetSnapRect();
822  }
823 
824  // resizing control
825  if ( !aResize.IsEmpty() && aObjRect != aResize )
826  {
827  nXMov = aResize.getWidth();
828  nYMov = aResize.getHeight();
829  switch(_nControlModification)
830  {
833  if ( _nControlModification == ControlModification::HEIGHT_GREATEST )
834  nXMov = aObjRect.getWidth();
835  else if ( _nControlModification == ControlModification::WIDTH_GREATEST )
836  nYMov = aObjRect.getHeight();
837  lcl_getNewRectSize(aObjRect,nXMov,nYMov,pObj,pView,_nControlModification);
838  [[fallthrough]];
841  pView->AddUndo( pView->GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
842  {
843  OObjectBase* pObjBase = dynamic_cast<OObjectBase*>(pObj);
844  OSL_ENSURE(pObjBase,"Where comes this object from?");
845  if ( pObjBase )
846  {
847  if ( _nControlModification == ControlModification::WIDTH_SMALLEST || _nControlModification == ControlModification::WIDTH_GREATEST )
848  pObjBase->getReportComponent()->setSize(awt::Size(nXMov,aObjRect.getHeight()));
849  else if ( _nControlModification == ControlModification::HEIGHT_GREATEST || _nControlModification == ControlModification::HEIGHT_SMALLEST )
850  pObjBase->getReportComponent()->setSize(awt::Size(aObjRect.getWidth(),nYMov));
851  }
852  }
853  break;
854  default:
855  break;
856  }
857  }
858  }
859  pView->AdjustMarkHdl();
860  }
861 }
862 
864 {
865  OSectionWindow* pMarkedSection = getMarkedSection();
866  if ( pMarkedSection )
867  pMarkedSection->getReportSection().createDefault(m_sShapeType);
868 }
869 
871 {
872  for (const auto& rxSection : m_aSections)
873  {
874  rxSection->getReportSection().getSectionView().SetGridSnap(bOn);
875  rxSection->getReportSection().Invalidate();
876  }
877 }
878 
880 {
881  for (const auto& rxSection : m_aSections)
882  rxSection->getReportSection().getSectionView().SetDragStripes(bOn);
883 }
884 
885 sal_uInt16 OViewsWindow::getPosition(const OSectionWindow* _pSectionWindow) const
886 {
887  auto aIter = std::find_if(m_aSections.begin(), m_aSections.end(),
888  [&_pSectionWindow](const VclPtr<OSectionWindow>& rxSection) { return _pSectionWindow == rxSection.get(); });
889  return static_cast<sal_uInt16>(std::distance(m_aSections.begin(), aIter));
890 }
891 
892 OSectionWindow* OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const
893 {
894  OSectionWindow* aReturn = nullptr;
895 
896  if ( _nPos < m_aSections.size() )
897  aReturn = m_aSections[_nPos].get();
898 
899  return aReturn;
900 }
901 
902 namespace
903 {
904  enum SectionViewAction
905  {
906  eEndDragObj,
907  eEndAction,
908  eForceToAnotherPage,
909  eBreakAction
910  };
911  class ApplySectionViewAction
912  {
913  private:
914  SectionViewAction m_eAction;
915 
916  public:
917  explicit ApplySectionViewAction()
918  : m_eAction(eEndDragObj)
919  {
920  }
921 
922  explicit ApplySectionViewAction(SectionViewAction _eAction)
923  : m_eAction(_eAction)
924  {
925  }
926 
927  void operator() ( const OViewsWindow::TSectionsMap::value_type& _rhs )
928  {
929  OSectionView& rView( _rhs->getReportSection().getSectionView() );
930  switch ( m_eAction )
931  {
932  case eEndDragObj:
933  rView.EndDragObj();
934  break;
935  case eEndAction:
936  if ( rView.IsAction() )
937  rView.EndAction ( );
938  break;
939  case eForceToAnotherPage:
940  rView.ForceMarkedToAnotherPage();
941  break;
942  case eBreakAction:
943  if ( rView.IsAction() )
944  rView.BrkAction ( );
945  break;
946  // default:
947 
948  }
949  }
950  };
951 }
952 
954 {
956  ::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction(eBreakAction) );
957 }
958 
960 {
961  Point aNewPos(0,0);
962 
963  for (const auto& rxSection : m_aSections)
964  {
965  OReportSection& rReportSection = rxSection->getReportSection();
966  rReportSection.getPage()->setSpecialMode();
967  OSectionView& rView = rReportSection.getSectionView();
968 
969  if ( &rView != &_rSection )
970  {
971  SdrObject *pNewObj = new SdrUnoObj(
972  rView.getSdrModelFromSdrView(),
973  "com.sun.star.form.component.FixedText");
974 
975  pNewObj->SetLogicRect(_aRect);
976  pNewObj->Move(Size(0, aNewPos.Y()));
977  bool bChanged = rView.GetModel()->IsChanged();
978  rReportSection.getPage()->InsertObject(pNewObj);
979  rView.GetModel()->SetChanged(bChanged);
980  m_aBegDragTempList.push_back(pNewObj);
981 
982  rView.MarkObj( pNewObj, rView.GetSdrPageView() );
983  }
984  const tools::Long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
985  aNewPos.AdjustY( -nSectionHeight );
986  }
987 }
988 
989 void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionView* _pSection)
990 {
991  SAL_INFO(
992  "reportdesign", "Clickpoint X:" << _aPnt.X() << " Y:" << _aPnt.Y());
993 
994  m_aBegDragTempList.clear();
995 
996  // Calculate the absolute clickpoint in the views
997  Point aAbsolutePnt = _aPnt;
998  for (const auto& rxSection : m_aSections)
999  {
1000  OReportSection& rReportSection = rxSection->getReportSection();
1001  OSectionView* pView = &rReportSection.getSectionView();
1002  if (pView == _pSection)
1003  break;
1004  const tools::Long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
1005  aAbsolutePnt.AdjustY(nSectionHeight );
1006  }
1008  SAL_INFO(
1009  "reportdesign",
1010  "Absolute X:" << aAbsolutePnt.X() << " Y:" << aAbsolutePnt.Y());
1011 
1012  // Create drag lines over all viewable Views
1013  // Therefore we need to identify the marked objects
1014  // and create temporary objects on all other views at the same position
1015  // relative to its occurrence.
1016 
1017  int nViewCount = 0;
1018  Point aNewObjPos(0,0);
1019  Point aLeftTop(SAL_MAX_INT32, SAL_MAX_INT32);
1020  for (const auto& rxSection : m_aSections)
1021  {
1022  OReportSection& rReportSection = rxSection->getReportSection();
1023 
1024  OSectionView& rView = rReportSection.getSectionView();
1025 
1026  if ( rView.AreObjectsMarked() )
1027  {
1028  const size_t nCount = rView.GetMarkedObjectCount();
1029  for (size_t i=0; i < nCount; ++i)
1030  {
1031  const SdrMark* pM = rView.GetSdrMarkByIndex(i);
1032  SdrObject* pObj = pM->GetMarkedSdrObj();
1033  if (::std::find(m_aBegDragTempList.begin(),m_aBegDragTempList.end(),pObj) == m_aBegDragTempList.end())
1034  {
1035  tools::Rectangle aRect( pObj->GetCurrentBoundRect() );
1036  aRect.Move(0, aNewObjPos.Y());
1037 
1038  aLeftTop.setX( ::std::min( aRect.Left(), aLeftTop.X() ) );
1039  aLeftTop.setY( ::std::min( aRect.Top(), aLeftTop.Y() ) );
1040 
1041  SAL_INFO(
1042  "reportdesign",
1043  "createInvisible X:" << aRect.Left() << " Y:"
1044  << aRect.Top() << " on View #" << nViewCount);
1045 
1047  }
1048  }
1049  }
1050  ++nViewCount;
1051  tools::Rectangle aClipRect = rView.GetWorkArea();
1052  aClipRect.SetTop( -aNewObjPos.Y() );
1053  rView.SetWorkArea( aClipRect );
1054 
1055  const tools::Long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
1056  aNewObjPos.AdjustY(nSectionHeight );
1057  }
1058 
1059  const sal_Int32 nDeltaX = std::abs(aLeftTop.X() - aAbsolutePnt.X());
1060  const sal_Int32 nDeltaY = std::abs(aLeftTop.Y() - aAbsolutePnt.Y());
1061  m_aDragDelta.setX( nDeltaX );
1062  m_aDragDelta.setY( nDeltaY );
1063 
1064  Point aNewPos = aAbsolutePnt;
1065 
1066  const short nDrgLog = static_cast<short>(PixelToLogic(Size(3,0)).Width());
1067  nViewCount = 0;
1068  for (const auto& rxSection : m_aSections)
1069  {
1070  OReportSection& rReportSection = rxSection->getReportSection();
1071 
1072  SdrHdl* pHdl = _pHdl;
1073  if ( pHdl )
1074  {
1075  if ( &rReportSection.getSectionView() != _pSection )
1076  {
1077  const SdrHdlList& rHdlList = rReportSection.getSectionView().GetHdlList();
1078  pHdl = rHdlList.GetHdl(_pHdl->GetKind());
1079  }
1080  }
1081  SAL_INFO(
1082  "reportdesign",
1083  "X:" << aNewPos.X() << " Y:" << aNewPos.Y() << " on View#"
1084  << nViewCount++);
1085  rReportSection.getSectionView().BegDragObj(aNewPos, nullptr, pHdl, nDrgLog);
1086 
1087  const tools::Long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
1088  aNewPos.AdjustY( -nSectionHeight );
1089  }
1090 }
1091 
1092 
1094 {
1095  ::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction(eForceToAnotherPage ) );
1096 }
1097 
1098 void OViewsWindow::BegMarkObj(const Point& _aPnt,const OSectionView* _pSection)
1099 {
1100  bool bAdd = true;
1101  Point aNewPos = _aPnt;
1102 
1103  tools::Long nLastSectionHeight = 0;
1104  for (const auto& rxSection : m_aSections)
1105  {
1106  OReportSection& rReportSection = rxSection->getReportSection();
1107  if ( &rReportSection.getSectionView() == _pSection )
1108  {
1109  bAdd = false;
1110  aNewPos = _aPnt; // 2,2
1111  }
1112  else if ( bAdd )
1113  {
1114  const tools::Long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
1115  aNewPos.AdjustY(nSectionHeight );
1116  }
1117  else
1118  {
1119  aNewPos.AdjustY( -nLastSectionHeight );
1120  }
1121  rReportSection.getSectionView().BegMarkObj ( aNewPos );
1122  nLastSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
1123  }
1124 }
1125 
1127 {
1128  OSectionView* pSection = nullptr;
1129  TSectionsMap::const_iterator aIter = m_aSections.begin();
1130  const TSectionsMap::const_iterator aEnd = m_aSections.end();
1131  aIter = std::find_if(aIter, aEnd, [&_pSection](const VclPtr<OSectionWindow>& rxSection) {
1132  return &rxSection->getReportSection().getSectionView() == _pSection; });
1133  sal_Int32 nCount = static_cast<sal_Int32>(std::distance(m_aSections.cbegin(), aIter));
1134  OSL_ENSURE(aIter != aEnd,"This can never happen!");
1135  if ( _rPnt.Y() < 0 )
1136  {
1137  if ( nCount )
1138  --aIter;
1139  for (; nCount && (_rPnt.Y() < 0); --nCount)
1140  {
1141  OReportSection& rReportSection = (*aIter)->getReportSection();
1142  const sal_Int32 nHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
1143  _rPnt.AdjustY(nHeight );
1144  if ( (nCount -1) > 0 && (_rPnt.Y() < 0) )
1145  --aIter;
1146  }
1147  if ( nCount == 0 )
1148  pSection = &(*m_aSections.begin())->getReportSection().getSectionView();
1149  else
1150  pSection = &(*aIter)->getReportSection().getSectionView();
1151  }
1152  else
1153  {
1154  for (; aIter != aEnd; ++aIter)
1155  {
1156  OReportSection& rReportSection = (*aIter)->getReportSection();
1157  const tools::Long nHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
1158  if ( (_rPnt.Y() - nHeight) < 0 )
1159  break;
1160  _rPnt.AdjustY( -nHeight );
1161  }
1162  if ( aIter != aEnd )
1163  pSection = &(*aIter)->getReportSection().getSectionView();
1164  else
1165  pSection = &(*(aEnd-1))->getReportSection().getSectionView();
1166  }
1167 
1168  return pSection;
1169 }
1170 
1172 {
1173  for (const auto& rxSection : m_aSections)
1174  {
1175  OReportSection& rReportSection = rxSection->getReportSection();
1176  rReportSection.getPage()->resetSpecialMode();
1177  }
1178 }
1179 
1180 void OViewsWindow::EndDragObj(bool _bControlKeyPressed, const OSectionView* _pSection, const Point& _aPnt)
1181 {
1182  const OUString sUndoAction = RptResId(RID_STR_UNDO_CHANGEPOSITION);
1183  const UndoContext aUndoContext( getView()->getReportView()->getController().getUndoManager(), sUndoAction );
1184 
1185  Point aNewPos = _aPnt;
1186  OSectionView* pInSection = getSectionRelativeToPosition(_pSection, aNewPos);
1187  if (!_bControlKeyPressed &&
1188  _pSection && !_pSection->IsDragResize() && /* Not in resize mode */
1189  _pSection != pInSection)
1190  {
1192 
1193  // we need to manipulate the current clickpoint, we subtract the old delta from BeginDrag
1194  aNewPos -= m_aDragDelta;
1195 
1196  uno::Sequence< beans::NamedValue > aAllreadyCopiedObjects;
1197  for (const auto& rxSection : m_aSections)
1198  {
1199  OReportSection& rReportSection = rxSection->getReportSection();
1200  if ( pInSection != &rReportSection.getSectionView() )
1201  {
1202  rReportSection.getSectionView().BrkAction();
1203  rReportSection.Copy(aAllreadyCopiedObjects,true);
1204  }
1205  else
1206  pInSection->EndDragObj();
1207  }
1208 
1209  if ( aAllreadyCopiedObjects.hasElements() )
1210  {
1211  try
1212  {
1213  uno::Reference<report::XReportDefinition> xReportDefinition = getView()->getReportView()->getController().getReportDefinition();
1214  const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
1215  const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
1216  const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width;
1217 
1218  if ( aNewPos.X() < nLeftMargin )
1219  aNewPos.setX( nLeftMargin );
1220  if ( aNewPos.Y() < 0 )
1221  aNewPos.setY( 0 );
1222 
1223  Point aPrevious;
1224  for (beans::NamedValue const & namedVal : std::as_const(aAllreadyCopiedObjects))
1225  {
1226  uno::Sequence< uno::Reference<report::XReportComponent> > aClones;
1227  namedVal.Value >>= aClones;
1228  uno::Reference<report::XReportComponent>* pColIter = aClones.getArray();
1229  const uno::Reference<report::XReportComponent>* pColEnd = pColIter + aClones.getLength();
1230 
1231  // move the cloned Components to new positions
1232  for (; pColIter != pColEnd; ++pColIter)
1233  {
1234  uno::Reference< report::XReportComponent> xRC(*pColIter);
1235  aPrevious = VCLPoint(xRC->getPosition());
1236  awt::Size aSize = xRC->getSize();
1237 
1238  if ( aNewPos.X() < nLeftMargin )
1239  {
1240  aNewPos.setX( nLeftMargin );
1241  }
1242  else if ( (aNewPos.X() + aSize.Width) > (nPaperWidth - nRightMargin) )
1243  {
1244  aNewPos.setX( nPaperWidth - nRightMargin - aSize.Width );
1245  }
1246  if ( aNewPos.Y() < 0 )
1247  {
1248  aNewPos.setY( 0 );
1249  }
1250  if ( aNewPos.X() < 0 )
1251  {
1252  aSize.Width += aNewPos.X();
1253  aNewPos.setX( 0 );
1254  xRC->setSize(aSize);
1255  }
1256  xRC->setPosition(AWTPoint(aNewPos));
1257  if ( (pColIter+1) != pColEnd )
1258  {
1259  // bring aNewPos to the position of the next object
1260  uno::Reference< report::XReportComponent> xRCNext = *(pColIter + 1);
1261  Point aNextPosition = VCLPoint(xRCNext->getPosition());
1262  aNewPos += aNextPosition - aPrevious;
1263  }
1264  }
1265  }
1266  }
1267  catch(uno::Exception&)
1268  {
1269  }
1270  pInSection->getReportSection()->Paste(aAllreadyCopiedObjects,true);
1271  }
1272  }
1273  else
1274  {
1275  ::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction() );
1277  }
1279 }
1280 
1282 {
1283  ::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction(eEndAction) );
1284 }
1285 
1286 void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection, bool _bControlKeySet)
1287 {
1288  Point aRealMousePos = _aPnt;
1289  Point aCurrentSectionPos;
1290  SAL_INFO(
1291  "reportdesign",
1292  "X:" << aRealMousePos.X() << " Y:" << aRealMousePos.Y());
1293 
1294  Point aHdlPos;
1295  SdrHdl* pHdl = _pSection->GetDragHdl();
1296  if ( pHdl )
1297  {
1298  aHdlPos = pHdl->GetPos();
1299  }
1300 
1301  for (const auto& rxSection : m_aSections)
1302  {
1303  OReportSection& rReportSection = rxSection->getReportSection();
1304  if ( &rReportSection.getSectionView() == _pSection )
1305  break;
1306  const tools::Long nSectionHeight = rxSection->PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
1307  aCurrentSectionPos.AdjustY(nSectionHeight );
1308  }
1309  aRealMousePos += aCurrentSectionPos;
1310 
1311  // If control key is pressed the work area is limited to the section with the current selection.
1312  Point aPosForWorkArea(0,0);
1313  for (const auto& rxSection : m_aSections)
1314  {
1315  OReportSection& rReportSection = rxSection->getReportSection();
1316  OSectionView& rView = rReportSection.getSectionView();
1317  const tools::Long nSectionHeight = rxSection->PixelToLogic(rxSection->GetOutputSizePixel()).Height();
1318 
1319  if (_bControlKeySet)
1320  {
1321  tools::Rectangle aClipRect = rView.GetWorkArea();
1322  aClipRect.SetTop( aCurrentSectionPos.Y() - aPosForWorkArea.Y() );
1323  aClipRect.SetBottom( aClipRect.Top() + nSectionHeight );
1324  rView.SetWorkArea( aClipRect );
1325  }
1326  else
1327  {
1328  tools::Rectangle aClipRect = rView.GetWorkArea();
1329  aClipRect.SetTop( -aPosForWorkArea.Y() );
1330  rView.SetWorkArea( aClipRect );
1331  }
1332  aPosForWorkArea.AdjustY(nSectionHeight );
1333  }
1334 
1335 
1336  for (const auto& rxSection : m_aSections)
1337  {
1338  OReportSection& rReportSection = rxSection->getReportSection();
1339  SdrHdl* pCurrentHdl = rReportSection.getSectionView().GetDragHdl();
1340  if ( pCurrentHdl && aRealMousePos.Y() > 0 )
1341  aRealMousePos = _aPnt + pCurrentHdl->GetPos() - aHdlPos;
1342  rReportSection.getSectionView().MovAction ( aRealMousePos );
1343  const tools::Long nSectionHeight = rxSection->PixelToLogic(rxSection->GetOutputSizePixel()).Height();
1344  aRealMousePos.AdjustY( -nSectionHeight );
1345  }
1346 }
1347 
1349 {
1350  return std::any_of(m_aSections.begin(), m_aSections.end(),
1351  [](const VclPtr<OSectionWindow>& rxSection) { return rxSection->getReportSection().getSectionView().IsAction(); });
1352 }
1353 
1355 {
1356  return std::any_of(m_aSections.begin(), m_aSections.end(),
1357  [](const VclPtr<OSectionWindow>& rxSection) { return rxSection->getReportSection().getSectionView().IsAction(); });
1358 }
1359 
1361 {
1362  return std::accumulate(m_aSections.begin(), m_aSections.end(), sal_uInt32(0),
1363  [](const sal_uInt32 nCount, const VclPtr<OSectionWindow>& rxSection) {
1364  return nCount + static_cast<sal_uInt32>(rxSection->getReportSection().getSectionView().GetMarkedObjectCount()); });
1365 }
1366 
1368 {
1369  const sal_uInt16 nCode = _rCode.GetCode();
1370  if ( _rCode.IsMod1() )
1371  {
1372  // scroll page
1373  OScrollWindowHelper* pScrollWindow = getView()->getScrollWindow();
1374  ScrollBar& rScrollBar = ( nCode == KEY_LEFT || nCode == KEY_RIGHT ) ? pScrollWindow->GetHScroll() : pScrollWindow->GetVScroll();
1375  if ( rScrollBar.IsVisible() )
1376  rScrollBar.DoScrollAction(( nCode == KEY_RIGHT || nCode == KEY_UP ) ? ScrollType::LineUp : ScrollType::LineDown );
1377  return;
1378  }
1379 
1380  for (const auto& rxSection : m_aSections)
1381  {
1382  OReportSection& rReportSection = rxSection->getReportSection();
1383  tools::Long nX = 0;
1384  tools::Long nY = 0;
1385 
1386  if ( nCode == KEY_UP )
1387  nY = -1;
1388  else if ( nCode == KEY_DOWN )
1389  nY = 1;
1390  else if ( nCode == KEY_LEFT )
1391  nX = -1;
1392  else if ( nCode == KEY_RIGHT )
1393  nX = 1;
1394 
1395  if ( rReportSection.getSectionView().AreObjectsMarked() )
1396  {
1397  if ( _rCode.IsMod2() )
1398  {
1399  // move in 1 pixel distance
1400  const Size aPixelSize = rReportSection.PixelToLogic( Size( 1, 1 ) );
1401  nX *= aPixelSize.Width();
1402  nY *= aPixelSize.Height();
1403  }
1404  else
1405  {
1406  // move in 1 mm distance
1407  nX *= DEFAUL_MOVE_SIZE;
1408  nY *= DEFAUL_MOVE_SIZE;
1409  }
1410 
1411  OSectionView& rView = rReportSection.getSectionView();
1412  const SdrHdlList& rHdlList = rView.GetHdlList();
1413  SdrHdl* pHdl = rHdlList.GetFocusHdl();
1414 
1415  if ( pHdl == nullptr )
1416  {
1417  // no handle selected
1418  if ( rView.IsMoveAllowed() )
1419  {
1420  // restrict movement to work area
1421  tools::Rectangle rWorkArea = rView.GetWorkArea();
1422  rWorkArea.AdjustRight( 1 );
1423 
1424  if ( !rWorkArea.IsEmpty() )
1425  {
1426  if ( rWorkArea.Top() < 0 )
1427  rWorkArea.SetTop( 0 );
1428  tools::Rectangle aMarkRect( rView.GetMarkedObjRect() );
1429  aMarkRect.Move( nX, nY );
1430 
1431  if ( !rWorkArea.Contains( aMarkRect ) )
1432  {
1433  if ( aMarkRect.Left() < rWorkArea.Left() )
1434  nX += rWorkArea.Left() - aMarkRect.Left();
1435 
1436  if ( aMarkRect.Right() > rWorkArea.Right() )
1437  nX -= aMarkRect.Right() - rWorkArea.Right();
1438 
1439  if ( aMarkRect.Top() < rWorkArea.Top() )
1440  nY += rWorkArea.Top() - aMarkRect.Top();
1441 
1442  if ( aMarkRect.Bottom() > rWorkArea.Bottom() )
1443  nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
1444  }
1445  bool bCheck = false;
1446  const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
1447  for (size_t i = 0; !bCheck && i < rMarkList.GetMarkCount(); ++i )
1448  {
1449  SdrMark* pMark = rMarkList.GetMark(i);
1450  bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != nullptr|| dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj());
1451  }
1452 
1453 
1454  if ( bCheck )
1455  {
1456  SdrObject* pOverlapped = isOver(aMarkRect,*rReportSection.getPage(),rView);
1457  if ( pOverlapped )
1458  {
1459  do
1460  {
1461  tools::Rectangle aOver = pOverlapped->GetLastBoundRect();
1462  Point aPos;
1463  if ( nCode == KEY_UP )
1464  {
1465  aPos.setX( aMarkRect.Left() );
1466  aPos.setY( aOver.Top() - aMarkRect.getHeight() );
1467  nY += (aPos.Y() - aMarkRect.Top());
1468  }
1469  else if ( nCode == KEY_DOWN )
1470  {
1471  aPos.setX( aMarkRect.Left() );
1472  aPos.setY( aOver.Bottom() );
1473  nY += (aPos.Y() - aMarkRect.Top());
1474  }
1475  else if ( nCode == KEY_LEFT )
1476  {
1477  aPos.setX( aOver.Left() - aMarkRect.getWidth() );
1478  aPos.setY( aMarkRect.Top() );
1479  nX += (aPos.X() - aMarkRect.Left());
1480  }
1481  else if ( nCode == KEY_RIGHT )
1482  {
1483  aPos.setX( aOver.Right() );
1484  aPos.setY( aMarkRect.Top() );
1485  nX += (aPos.X() - aMarkRect.Left());
1486  }
1487 
1488  aMarkRect.SetPos(aPos);
1489  if ( !rWorkArea.Contains( aMarkRect ) )
1490  {
1491  break;
1492  }
1493  pOverlapped = isOver(aMarkRect,*rReportSection.getPage(),rView);
1494  }
1495  while(pOverlapped != nullptr);
1496  if (pOverlapped != nullptr)
1497  break;
1498  }
1499  }
1500  }
1501 
1502  if ( nX != 0 || nY != 0 )
1503  {
1504  rView.MoveAllMarked( Size( nX, nY ) );
1505  rView.MakeVisible( rView.GetAllMarkedRect(), rReportSection);
1506  }
1507  }
1508  }
1509  else // pHdl != nullptr
1510  {
1511  // move the handle
1512  if (nX || nY)
1513  {
1514  const Point aStartPoint( pHdl->GetPos() );
1515  const Point aEndPoint( pHdl->GetPos() + Point( nX, nY ) );
1516  const SdrDragStat& rDragStat = rView.GetDragStat();
1517 
1518  // start dragging
1519  rView.BegDragObj( aStartPoint, nullptr, pHdl, 0 );
1520 
1521  if ( rView.IsDragObj() )
1522  {
1523  const bool bWasNoSnap = rDragStat.IsNoSnap();
1524  const bool bWasSnapEnabled = rView.IsSnapEnabled();
1525 
1526  // switch snapping off
1527  if ( !bWasNoSnap )
1528  const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
1529  if ( bWasSnapEnabled )
1530  rView.SetSnapEnabled( false );
1531 
1532  tools::Rectangle aNewRect;
1533  bool bCheck = false;
1534  const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
1535  for (size_t i = 0; !bCheck && i < rMarkList.GetMarkCount(); ++i )
1536  {
1537  SdrMark* pMark = rMarkList.GetMark(i);
1538  bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != nullptr || dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj()) != nullptr;
1539  if ( bCheck )
1540  aNewRect.Union(pMark->GetMarkedSdrObj()->GetLastBoundRect());
1541  }
1542 
1543  switch(pHdl->GetKind())
1544  {
1545  case SdrHdlKind::Left:
1546  case SdrHdlKind::UpperLeft:
1547  case SdrHdlKind::LowerLeft:
1548  case SdrHdlKind::Upper:
1549  aNewRect.AdjustLeft(nX );
1550  aNewRect.AdjustTop(nY );
1551  break;
1552  case SdrHdlKind::UpperRight:
1553  case SdrHdlKind::Right:
1554  case SdrHdlKind::LowerRight:
1555  case SdrHdlKind::Lower:
1556  aNewRect.setWidth(aNewRect.getWidth() + nX);
1557  aNewRect.setHeight(aNewRect.getHeight() + nY);
1558  break;
1559  default:
1560  break;
1561  }
1562  if ( !(bCheck && isOver(aNewRect,*rReportSection.getPage(),rView)) )
1563  rView.MovAction(aEndPoint);
1564  rView.EndDragObj();
1565 
1566  // restore snap
1567  if ( !bWasNoSnap )
1568  const_cast<SdrDragStat&>(rDragStat).SetNoSnap( bWasNoSnap );
1569  if ( bWasSnapEnabled )
1570  rView.SetSnapEnabled( bWasSnapEnabled );
1571  }
1572 
1573  // make moved handle visible
1574  const tools::Rectangle aVisRect( aEndPoint - Point( DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE ), Size( 200, 200 ) );
1575  rView.MakeVisible( aVisRect, rReportSection);
1576  }
1577  }
1578  rView.AdjustMarkHdl();
1579  }
1580  }
1581 }
1582 
1584 {
1585  ::std::for_each(m_aSections.begin(),m_aSections.end(),
1586  [] (const TSectionsMap::value_type& sectionPtr) {
1587  sectionPtr->getReportSection().stopScrollTimer();
1588  });
1589 }
1590 
1591 void OViewsWindow::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
1592 {
1593  sal_uInt16 i = 0;
1594  for (const auto& rxSection : m_aSections)
1595  {
1596  if ( rxSection->getStartMarker().isCollapsed() )
1597  _rCollapsedPositions.push_back(i);
1598  ++i;
1599  }
1600 }
1601 
1602 void OViewsWindow::collapseSections(const uno::Sequence< beans::PropertyValue>& _aCollapsedSections)
1603 {
1604  for (const beans::PropertyValue& rSection : _aCollapsedSections)
1605  {
1606  sal_uInt16 nPos = sal_uInt16(-1);
1607  if ( (rSection.Value >>= nPos) && nPos < m_aSections.size() )
1608  {
1609  m_aSections[nPos]->setCollapsed(true);
1610  }
1611  }
1612 }
1613 
1614 void OViewsWindow::zoom(const Fraction& _aZoom)
1615 {
1616  const MapMode& aMapMode = GetMapMode();
1617 
1619  if ( _aZoom < aMapMode.GetScaleX() )
1620  aStartWidth *= aMapMode.GetScaleX();
1621  else
1622  aStartWidth *= _aZoom;
1623 
1624  setZoomFactor(_aZoom,*this);
1625 
1626  for (const auto& rxSection : m_aSections)
1627  {
1628  rxSection->zoom(_aZoom);
1629  }
1630 
1631  Resize();
1632 
1633  Size aOut = GetOutputSizePixel();
1634  aOut.setWidth( tools::Long(aStartWidth) );
1635  aOut = PixelToLogic(aOut);
1636 
1637  tools::Rectangle aRect(PixelToLogic(Point(0,0)),aOut);
1638  Invalidate(aRect, InvalidateFlags::NoChildren);
1639 }
1640 
1641 void OViewsWindow::scrollChildren(const Point& _aThumbPos)
1642 {
1643  const Point aPos(PixelToLogic(_aThumbPos));
1644  {
1645  MapMode aMapMode = GetMapMode();
1646  const Point aOld = aMapMode.GetOrigin();
1647  aMapMode.SetOrigin(m_pParent->GetMapMode().GetOrigin());
1648 
1649  const Point aPosY(m_pParent->PixelToLogic(_aThumbPos,aMapMode));
1650 
1651  aMapMode.SetOrigin( Point(aOld.X() , - aPosY.Y()));
1652  SetMapMode( aMapMode );
1653  Scroll(0, -( aOld.Y() + aPosY.Y()),ScrollFlags::Children);
1654  }
1655 
1656  for (const auto& rxSection : m_aSections)
1657  {
1658  rxSection->scrollChildren(aPos.X());
1659  }
1660 }
1661 
1662 void OViewsWindow::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
1663 {
1664  for (const auto& rxSection : m_aSections)
1665  {
1666  rxSection->getReportSection().fillControlModelSelection(_rSelection);
1667  }
1668 }
1669 
1670 } // rptui
1671 
1672 
1673 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const Fraction & GetScaleX() const
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
TSectionsMap m_aSections
Definition: ViewsWindow.hxx:78
ConfigurationHints
static sal_Int32 GetSplitSize()
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const
virtual bool BegDragObj(const Point &rPnt, OutputDevice *pOut, SdrHdl *pHdl, short nMinMov=-3, SdrDragMethod *pForcedMeth=nullptr)
void BrkAction()
calls on every section BrkAction
OSectionWindow * getMarkedSection(NearSectionAccess nsa=CURRENT) const override
returns the section which is currently marked.
size_t GetMarkCount() const
virtual const tools::Rectangle & GetCurrentBoundRect() const
sal_Int32 getMinHeight() const
Definition: StartMarker.cxx:90
css::awt::Point AWTPoint(const ::Point &rVCLPoint)
void SortMarkedObjects() const
#define PROPERTY_RIGHTMARGIN
Definition: strings.hxx:103
void Delete()
Deletes the current selection in this section.
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:837
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
const css::uno::Reference< css::report::XSection > & getSection() const
void setWidth(tools::Long nWidth)
tools::Long getWidth() const
InvalidateFlags
static SotClipboardFormatId getDescriptorFormatId()
returns the format id.
Definition: dlgedclip.cxx:37
constexpr tools::Long Left() const
bool Contains(const Point &rPOINT) const
void scrollChildren(const Point &_aThumbPos)
tools::Long const nLeftMargin
bool AreObjectsMarked() const
const SdrDragStat & GetDragStat() const
long Long
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
static TSectionElements extractCopies(const TransferableDataHelper &_rData)
extract the section elements
Definition: dlgedclip.cxx:64
static const AllSettings & GetSettings()
bool EndDragObj(bool bCopy=false)
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
VclPtr< OReportWindow > m_pParent
Definition: ViewsWindow.hxx:80
OSectionWindow * getSectionWindow(const sal_uInt16 _nPos) const
return the section at the given position
void MovAction(const Point &rPnt, const OSectionView *_pSection, bool _bControlKeySet)
const MapMode & GetMapMode() const
void SetTextFillColor()
sal_uInt16 GetCode() const
DataChangedEventType GetType() const
SdrMark * GetMark(size_t nNum) const
css::uno::Sequence< css::beans::NamedValue > TSectionElements
Definition: dlgedclip.hxx:39
const Point & GetPos() const
void handleKey(const vcl::KeyCode &_rCode)
virtual void dispose() override
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
void collapseSections(const css::uno::Sequence< css::beans::PropertyValue > &_aCollapsedSections)
collapse all sections given by their position
Center
EmbeddedObjectRef * pObject
bool HasFormat(SotClipboardFormatId nFormat) const
bool isCollapsed() const
bool IsMoveAllowed() const
const css::uno::Reference< css::report::XReportComponent > & getReportComponent() const
Definition: RptObject.hxx:105
constexpr sal_uInt16 KEY_UP
void BegDragObj_createInvisibleObjectAtPosition(const tools::Rectangle &_aRect, const OSectionView &_rSection)
virtual void markSection(const sal_uInt16 _nPos) override
mark the section on the given position .
void collectRectangles(TRectangleMap &_rMap)
const tools::Rectangle & GetMarkedObjRect() const
virtual const tools::Rectangle & GetSnapRect() const
SdrObjKind
sal_uInt32 getMarkedObjectCount() const
TSectionsMap::iterator getIteratorAtPos(sal_uInt16 _nPos)
returns the iterator at pos _nPos or the end()
tools::Long getHeight() const
constexpr tools::Long Width() const
void Paste(const css::uno::Sequence< css::beans::NamedValue > &_aAllreadyCopiedObjects, bool _bForce=false)
paste a new control in this section
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
bool HasSelection() const
returns when an object is marked
void SetMode(DlgEdMode m_eMode)
void SetBackground()
bool IsPasteAllowed() const
returns if paste is allowed
SdrPage * getSdrPageFromSdrObject() const
const Fraction & GetScaleY() const
#define PROPERTY_LEFTMARGIN
Definition: strings.hxx:102
int nCount
void fillCollapsedSections(::std::vector< sal_uInt16 > &_rCollapsedPositions) const
fills the positions of all collapsed sections.
void EndDragObj(bool _bDragIntoNewSection, const OSectionView *_pSection, const Point &_aPnt)
AllSettingsFlags GetFlags() const
ControlModification
Definition: RptDef.hxx:48
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
::std::multimap< tools::Rectangle,::std::pair< SdrObject *, OSectionView * >, RectangleLess > TRectangleMap
Definition: ViewsWindow.hxx:73
#define REPORT_STARTMARKER_WIDTH
void impl_resizeSectionWindow(OSectionWindow &_rSectionWindow, Point &_rStartPoint, bool _bSet)
void BegMarkObj(const Point &_aPnt, const OSectionView *_pSection)
void EndDragObj_removeInvisibleObjects()
bool IsDragObj() const
void setMarked(OSectionView const *_pSectionView, bool _bMark)
the section as marked or not marked
tools::Rectangle GetIntersection(const tools::Rectangle &rRect) const
#define DEFAUL_MOVE_SIZE
Definition: ViewsWindow.cxx:49
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin) override
Definition: SectionView.cxx:69
virtual void SetChanged(bool bFlg=true)
sal_uInt16 nCode
void SetSnapEnabled(bool bOn)
virtual void Paint(vcl::RenderContext &, const tools::Rectangle &rRect) override
constexpr bool IsEmpty() const
constexpr void SetLeft(tools::Long v)
OReportSection & getReportSection()
virtual void Resize() override
constexpr sal_uInt16 KEY_DOWN
static bool lcl_getNewRectSize(const tools::Rectangle &_aObjRect, tools::Long &_nXMov, tools::Long &_nYMov, SdrObject const *_pObj, SdrView const *_pView, ControlModification _nControlModification)
Definition: ViewsWindow.cxx:54
SdrObject * GetMarkedSdrObj() const
WinBits const WB_DIALOGCONTROL
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
virtual std::unique_ptr< SdrUndoAction > CreateUndoMoveObject(SdrObject &rObject, const Size &rDist)
bool handleKeyEvent(const KeyEvent &_rEvent)
checks if the keycode is known by the child windows
#define SAL_MAX_INT32
Point LogicToPixel(const Point &rLogicPt) const
OUString RptResId(TranslateId aId)
int i
void showRuler(bool _bShow)
shows or hides the ruler.
#define PROPERTY_PAPERSIZE
Definition: strings.hxx:62
tools::Long DoScrollAction(ScrollType eScrollType)
void createDefault()
creates a default object
size_t GetMarkedObjectCount() const
const MapMode & GetMapMode() const
bool IsSnapEnabled() const
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
const SdrMarkList & GetMarkedObjectList() const
void SetOrigin(const Point &rOrigin)
void addSection(const css::uno::Reference< css::report::XSection > &_xSection, const OUString &_sColorEntry, sal_uInt16 _nPosition)
adds a new section at position _nPosition.
constexpr tools::Long Right() const
void SetFillColor()
sal_Int32 getTotalHeight() const
returns the total accumulated height of all sections until _pSection is reached
bool IsDragResize() const
constexpr tools::Long Top() const
void setGridSnap(bool bOn)
OScrollWindowHelper * getScrollWindow() const
void BegMarkObj(const Point &rPnt, bool bUnmark=false)
void fillControlModelSelection(::std::vector< css::uno::Reference< css::uno::XInterface > > &_rSelection) const
fills the vector with all selected control models /param _rSelection The vector will be filled and wi...
bool IsAction() const
virtual void SetLogicRect(const tools::Rectangle &rRect)
defines a clipboard format for copying selection elements.
Definition: dlgedclip.hxx:36
inline::Point VCLPoint(const css::awt::Point &rAWTPoint)
virtual void Move(const Size &rSiz)
constexpr void SetRight(tools::Long v)
void SetPaintTransparent(bool bTransparent)
constexpr void SetBottom(tools::Long v)
Point PixelToLogic(const Point &rDevicePt) const
void GrabFocus()
const tools::Rectangle & GetAllMarkedRect() const
constexpr void SetTop(tools::Long v)
SdrUndoFactory & GetSdrUndoFactory() const
void toggleGrid(bool _bVisible)
turns the grid on or off
void Paste()
paste a new control in this section
bool IsChanged() const
constexpr Point Center() const
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
tools::Long AdjustTop(tools::Long nVertMoveDelta)
SdrHdl * GetDragHdl() const
constexpr sal_uInt16 KEY_RIGHT
virtual std::unique_ptr< SdrUndoAction > CreateUndoGeoObject(SdrObject &rObject)
constexpr tools::Long Bottom() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SdrHdl * GetFocusHdl() const
void SetInsertObj(SdrObjKind eObj, const OUString &_sShapeType)
void zoom(const Fraction &_aZoom)
zoom the ruler and view windows
virtual const tools::Rectangle & GetLastBoundRect() const
void unmarkAllObjects(OSectionView const *_pSectionView)
unmark all objects on the views without the given one.
SdrHdl * GetHdl(size_t nNum) const
ODesignView * getReportView() const
virtual void ConfigurationChanged(utl::ConfigurationBroadcaster *, ConfigurationHints) override
void resize(const OSectionWindow &_rSectionWindow)
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
sal_uInt16 getPosition(const OSectionWindow *_pSectionWindow) const
returns the current position in the list
tools::Rectangle & Union(const tools::Rectangle &rRect)
constexpr tools::Long Height() const
void setWidth(tools::Long n)
void setDragStripes(bool bOn)
virtual void dispose() override
bool IsVisible() const
#define SAL_INFO(area, stream)
void Copy(css::uno::Sequence< css::beans::NamedValue > &_rAllreadyCopiedObjects)
copies the current selection in this section
void EnableChildTransparentMode(bool bEnable=true)
bool IsLeft() const
tools::Long AdjustWidth(tools::Long n)
void SetWorkArea(const tools::Rectangle &rRect)
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
void Copy()
copies the current selection in this section
bool IsMod1() const
void * p
OStartMarker & getStartMarker()
void setSpecialMode()
Definition: RptPage.hxx:72
tools::Long const nRightMargin
OViewsWindow(OViewsWindow const &)=delete
const Point & GetOrigin() const
void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection)
align all marked objects in all sections
OReportPage * getPage() const
tools::Long AdjustHeight(tools::Long n)
OSectionView * getSectionRelativeToPosition(const OSectionView *_pSection, Point &_rPnt)
return the section at the given point which is relative to the given section
SdrPageView * GetSdrPageView() const
Size GetOutputSizePixel() const
virtual ~OViewsWindow() override
void setHeight(tools::Long nHeight)
::std::vector< SdrObject * > m_aBegDragTempList
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
bool IsDragObj() const
reference_type * get() const
virtual void MovAction(const Point &rPnt) override
static void collectBoundResizeRect(const TRectangleMap &_rSortRectangles, ControlModification _nControlModification, bool _bAlignAtSection, tools::Rectangle &_rBound, tools::Rectangle &_rResize)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
SdrModel & getSdrModelFromSdrView() const
void setZoomFactor(const Fraction &_aZoom, vcl::Window &_rWindow)
sets the map mode at the window
Definition: UITools.cxx:990
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
constexpr sal_uInt16 KEY_LEFT
const SdrHdlList & GetHdlList() const
void BegDragObj(const Point &_aPnt, SdrHdl *_pHdl, const OSectionView *_pSection)
SdrMark * GetSdrMarkByIndex(size_t nNum) const
OReportSection * getReportSection() const
Definition: SectionView.hxx:56
virtual void BrkAction() override
void MoveAllMarked(const Size &rSiz, bool bCopy=false)
SectionViewAction m_eAction
OReportWindow * getView() const
SdrModel * GetModel() const
SAL_DLLPRIVATE void DrawWallpaper(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const Wallpaper &rWallpaper)
void SetMapMode()
void removeSection(sal_uInt16 _nPosition)
removes the section at the given position.
svtools::ColorConfig m_aColorConfig
Definition: ViewsWindow.hxx:79
const tools::Rectangle & GetWorkArea() const
void SelectAll(const SdrObjKind _nObjectType)
All objects will be marked.
bool IsMoveProtect() const
void setHeight(tools::Long n)
sal_uInt16 nPos
OReportController & getController() const
Definition: DesignView.hxx:97
SdrHdlKind GetKind() const
void resetSpecialMode()
Definition: RptPage.cxx:143
void createDefault(const OUString &_sType)
creates a default object (custom shape)
const css::uno::Reference< css::report::XReportDefinition > & getReportDefinition() const
gives access to the report definition
bool m_bDetectedRangeSegmentation false
sal_uInt16 getSectionCount() const
bool IsMod2() const
OSectionView & getSectionView() const