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