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
47namespace rptui
48{
49#define DEFAUL_MOVE_SIZE 100
50
51using namespace ::com::sun::star;
52using namespace ::comphelper;
53
54static 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.getOpenWidth();
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.getOpenHeight();
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.getOpenHeight();
144 bMoveAllowed = _nYMov != nYTemp;
145 nXTemp = aNewRect.getOpenWidth();
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{
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
192void 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
213void 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
250void 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);
265 Wallpaper aWall(m_aColorConfig.GetColorValue(::svtools::APPBACKGROUND).nColor);
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
286void 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
294void 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
309void 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
332void 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
394OSectionWindow* 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
469void 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{
479}
480
481void 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
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
525void 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
569OViewsWindow::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
577void 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
584void 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
599void 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
644void 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.getOpenWidth() > aObjRect.getOpenWidth() )
655 _rResize = aObjRect;
656 break;
658 if ( _rResize.getOpenHeight() > aObjRect.getOpenHeight() )
659 _rResize = aObjRect;
660 break;
662 if ( _rResize.getOpenWidth() < aObjRect.getOpenWidth() )
663 _rResize = aObjRect;
664 break;
666 if ( _rResize.getOpenHeight() < aObjRect.getOpenHeight() )
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
705void 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.getOpenWidth();
828 nYMov = aResize.getOpenHeight();
829 switch(_nControlModification)
830 {
833 if ( _nControlModification == ControlModification::HEIGHT_GREATEST )
834 nXMov = aObjRect.getOpenWidth();
835 else if ( _nControlModification == ControlModification::WIDTH_GREATEST )
836 nYMov = aObjRect.getOpenHeight();
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.getOpenHeight()));
849 else if ( _nControlModification == ControlModification::HEIGHT_GREATEST || _nControlModification == ControlModification::HEIGHT_SMALLEST )
850 pObjBase->getReportComponent()->setSize(awt::Size(aObjRect.getOpenWidth(),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 )
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
885sal_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
892OSectionWindow* 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
902namespace
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 {
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.get());
979 rView.GetModel().SetChanged(bChanged);
980 m_aBegDragTempList.push_back(pNewObj.get());
981
982 rView.MarkObj( pNewObj.get(), rView.GetSdrPageView() );
983 }
984 const tools::Long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
985 aNewPos.AdjustY( -nSectionHeight );
986 }
987}
988
989void 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);
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
1098void 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
1180void 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
1286void 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 ScrollAdaptor& rScrollBar = ( nCode == KEY_LEFT || nCode == KEY_RIGHT ) ? pScrollWindow->GetHScroll() : pScrollWindow->GetVScroll();
1375 if ( rScrollBar.IsVisible() )
1376 {
1377 auto nCurrentPos = rScrollBar.GetThumbPos();
1378 auto nLineSize = rScrollBar.GetLineSize();
1379 rScrollBar.DoScroll(( nCode == KEY_RIGHT || nCode == KEY_UP ) ? (nCurrentPos - nLineSize) : (nCurrentPos + nLineSize));
1380 }
1381 return;
1382 }
1383
1384 for (const auto& rxSection : m_aSections)
1385 {
1386 OReportSection& rReportSection = rxSection->getReportSection();
1387 tools::Long nX = 0;
1388 tools::Long nY = 0;
1389
1390 if ( nCode == KEY_UP )
1391 nY = -1;
1392 else if ( nCode == KEY_DOWN )
1393 nY = 1;
1394 else if ( nCode == KEY_LEFT )
1395 nX = -1;
1396 else if ( nCode == KEY_RIGHT )
1397 nX = 1;
1398
1399 if ( rReportSection.getSectionView().AreObjectsMarked() )
1400 {
1401 if ( _rCode.IsMod2() )
1402 {
1403 // move in 1 pixel distance
1404 const Size aPixelSize = rReportSection.PixelToLogic( Size( 1, 1 ) );
1405 nX *= aPixelSize.Width();
1406 nY *= aPixelSize.Height();
1407 }
1408 else
1409 {
1410 // move in 1 mm distance
1411 nX *= DEFAUL_MOVE_SIZE;
1412 nY *= DEFAUL_MOVE_SIZE;
1413 }
1414
1415 OSectionView& rView = rReportSection.getSectionView();
1416 const SdrHdlList& rHdlList = rView.GetHdlList();
1417 SdrHdl* pHdl = rHdlList.GetFocusHdl();
1418
1419 if ( pHdl == nullptr )
1420 {
1421 // no handle selected
1422 if ( rView.IsMoveAllowed() )
1423 {
1424 // restrict movement to work area
1425 tools::Rectangle rWorkArea = rView.GetWorkArea();
1426 rWorkArea.AdjustRight( 1 );
1427
1428 if ( !rWorkArea.IsEmpty() )
1429 {
1430 if ( rWorkArea.Top() < 0 )
1431 rWorkArea.SetTop( 0 );
1432 tools::Rectangle aMarkRect( rView.GetMarkedObjRect() );
1433 aMarkRect.Move( nX, nY );
1434
1435 if ( !rWorkArea.Contains( aMarkRect ) )
1436 {
1437 if ( aMarkRect.Left() < rWorkArea.Left() )
1438 nX += rWorkArea.Left() - aMarkRect.Left();
1439
1440 if ( aMarkRect.Right() > rWorkArea.Right() )
1441 nX -= aMarkRect.Right() - rWorkArea.Right();
1442
1443 if ( aMarkRect.Top() < rWorkArea.Top() )
1444 nY += rWorkArea.Top() - aMarkRect.Top();
1445
1446 if ( aMarkRect.Bottom() > rWorkArea.Bottom() )
1447 nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
1448 }
1449 bool bCheck = false;
1450 const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
1451 for (size_t i = 0; !bCheck && i < rMarkList.GetMarkCount(); ++i )
1452 {
1453 SdrMark* pMark = rMarkList.GetMark(i);
1454 bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != nullptr|| dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj());
1455 }
1456
1457
1458 if ( bCheck )
1459 {
1460 SdrObject* pOverlapped = isOver(aMarkRect,*rReportSection.getPage(),rView);
1461 if ( pOverlapped )
1462 {
1463 do
1464 {
1465 tools::Rectangle aOver = pOverlapped->GetLastBoundRect();
1466 Point aPos;
1467 if ( nCode == KEY_UP )
1468 {
1469 aPos.setX( aMarkRect.Left() );
1470 aPos.setY( aOver.Top() - aMarkRect.getOpenHeight() );
1471 nY += (aPos.Y() - aMarkRect.Top());
1472 }
1473 else if ( nCode == KEY_DOWN )
1474 {
1475 aPos.setX( aMarkRect.Left() );
1476 aPos.setY( aOver.Bottom() );
1477 nY += (aPos.Y() - aMarkRect.Top());
1478 }
1479 else if ( nCode == KEY_LEFT )
1480 {
1481 aPos.setX( aOver.Left() - aMarkRect.getOpenWidth() );
1482 aPos.setY( aMarkRect.Top() );
1483 nX += (aPos.X() - aMarkRect.Left());
1484 }
1485 else if ( nCode == KEY_RIGHT )
1486 {
1487 aPos.setX( aOver.Right() );
1488 aPos.setY( aMarkRect.Top() );
1489 nX += (aPos.X() - aMarkRect.Left());
1490 }
1491
1492 aMarkRect.SetPos(aPos);
1493 if ( !rWorkArea.Contains( aMarkRect ) )
1494 {
1495 break;
1496 }
1497 pOverlapped = isOver(aMarkRect,*rReportSection.getPage(),rView);
1498 }
1499 while(pOverlapped != nullptr);
1500 if (pOverlapped != nullptr)
1501 break;
1502 }
1503 }
1504 }
1505
1506 if ( nX != 0 || nY != 0 )
1507 {
1508 rView.MoveAllMarked( Size( nX, nY ) );
1509 rView.MakeVisible( rView.GetAllMarkedRect(), rReportSection);
1510 }
1511 }
1512 }
1513 else // pHdl != nullptr
1514 {
1515 // move the handle
1516 if (nX || nY)
1517 {
1518 const Point aStartPoint( pHdl->GetPos() );
1519 const Point aEndPoint( pHdl->GetPos() + Point( nX, nY ) );
1520 const SdrDragStat& rDragStat = rView.GetDragStat();
1521
1522 // start dragging
1523 rView.BegDragObj( aStartPoint, nullptr, pHdl, 0 );
1524
1525 if ( rView.IsDragObj() )
1526 {
1527 const bool bWasNoSnap = rDragStat.IsNoSnap();
1528 const bool bWasSnapEnabled = rView.IsSnapEnabled();
1529
1530 // switch snapping off
1531 if ( !bWasNoSnap )
1532 const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
1533 if ( bWasSnapEnabled )
1534 rView.SetSnapEnabled( false );
1535
1536 tools::Rectangle aNewRect;
1537 bool bCheck = false;
1538 const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
1539 for (size_t i = 0; !bCheck && i < rMarkList.GetMarkCount(); ++i )
1540 {
1541 SdrMark* pMark = rMarkList.GetMark(i);
1542 bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != nullptr || dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj()) != nullptr;
1543 if ( bCheck )
1544 aNewRect.Union(pMark->GetMarkedSdrObj()->GetLastBoundRect());
1545 }
1546
1547 switch(pHdl->GetKind())
1548 {
1549 case SdrHdlKind::Left:
1550 case SdrHdlKind::UpperLeft:
1551 case SdrHdlKind::LowerLeft:
1552 case SdrHdlKind::Upper:
1553 aNewRect.AdjustLeft(nX );
1554 aNewRect.AdjustTop(nY );
1555 break;
1556 case SdrHdlKind::UpperRight:
1557 case SdrHdlKind::Right:
1558 case SdrHdlKind::LowerRight:
1559 case SdrHdlKind::Lower:
1560 aNewRect.setWidth(aNewRect.getOpenWidth() + nX);
1561 aNewRect.setHeight(aNewRect.getOpenHeight() + nY);
1562 break;
1563 default:
1564 break;
1565 }
1566 if ( !(bCheck && isOver(aNewRect,*rReportSection.getPage(),rView)) )
1567 rView.MovAction(aEndPoint);
1568 rView.EndDragObj();
1569
1570 // restore snap
1571 if ( !bWasNoSnap )
1572 const_cast<SdrDragStat&>(rDragStat).SetNoSnap( bWasNoSnap );
1573 if ( bWasSnapEnabled )
1574 rView.SetSnapEnabled( bWasSnapEnabled );
1575 }
1576
1577 // make moved handle visible
1578 const tools::Rectangle aVisRect( aEndPoint - Point( DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE ), Size( 200, 200 ) );
1579 rView.MakeVisible( aVisRect, rReportSection);
1580 }
1581 }
1582 rView.AdjustMarkHdl();
1583 }
1584 }
1585}
1586
1588{
1589 ::std::for_each(m_aSections.begin(),m_aSections.end(),
1590 [] (const TSectionsMap::value_type& sectionPtr) {
1591 sectionPtr->getReportSection().stopScrollTimer();
1592 });
1593}
1594
1595void OViewsWindow::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
1596{
1597 sal_uInt16 i = 0;
1598 for (const auto& rxSection : m_aSections)
1599 {
1600 if ( rxSection->getStartMarker().isCollapsed() )
1601 _rCollapsedPositions.push_back(i);
1602 ++i;
1603 }
1604}
1605
1606void OViewsWindow::collapseSections(const uno::Sequence< beans::PropertyValue>& _aCollapsedSections)
1607{
1608 for (const beans::PropertyValue& rSection : _aCollapsedSections)
1609 {
1610 sal_uInt16 nPos = sal_uInt16(-1);
1611 if ( (rSection.Value >>= nPos) && nPos < m_aSections.size() )
1612 {
1613 m_aSections[nPos]->setCollapsed(true);
1614 }
1615 }
1616}
1617
1618void OViewsWindow::zoom(const Fraction& _aZoom)
1619{
1620 const MapMode& aMapMode = GetMapMode();
1621
1623 if ( _aZoom < aMapMode.GetScaleX() )
1624 aStartWidth *= aMapMode.GetScaleX();
1625 else
1626 aStartWidth *= _aZoom;
1627
1628 setZoomFactor(_aZoom,*this);
1629
1630 for (const auto& rxSection : m_aSections)
1631 {
1632 rxSection->zoom(_aZoom);
1633 }
1634
1635 Resize();
1636
1637 Size aOut = GetOutputSizePixel();
1638 aOut.setWidth( tools::Long(aStartWidth) );
1639 aOut = PixelToLogic(aOut);
1640
1641 tools::Rectangle aRect(PixelToLogic(Point(0,0)),aOut);
1642 Invalidate(aRect, InvalidateFlags::NoChildren);
1643}
1644
1646{
1647 const Point aPos(PixelToLogic(_aThumbPos));
1648 {
1649 MapMode aMapMode = GetMapMode();
1650 const Point aOld = aMapMode.GetOrigin();
1651 aMapMode.SetOrigin(m_pParent->GetMapMode().GetOrigin());
1652
1653 const Point aPosY(m_pParent->PixelToLogic(_aThumbPos,aMapMode));
1654
1655 aMapMode.SetOrigin( Point(aOld.X() , - aPosY.Y()));
1656 SetMapMode( aMapMode );
1657 Scroll(0, -( aOld.Y() + aPosY.Y()),ScrollFlags::Children);
1658 }
1659
1660 for (const auto& rxSection : m_aSections)
1661 {
1662 rxSection->scrollChildren(aPos.X());
1663 }
1664}
1665
1666void OViewsWindow::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
1667{
1668 for (const auto& rxSection : m_aSections)
1669 {
1670 rxSection->getReportSection().fillControlModelSelection(_rSelection);
1671 }
1672}
1673
1674} // rptui
1675
1676
1677/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define REPORT_STARTMARKER_WIDTH
SectionViewAction m_eAction
#define DEFAUL_MOVE_SIZE
Definition: ViewsWindow.cxx:49
static const AllSettings & GetSettings()
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
void SetOrigin(const Point &rOrigin)
const Fraction & GetScaleX() const
const Point & GetOrigin() const
const Fraction & GetScaleY() const
bool IsLeft() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
void SetFillColor()
const MapMode & GetMapMode() const
void SetTextFillColor()
void SetBackground()
SAL_DLLPRIVATE void DrawWallpaper(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const Wallpaper &rWallpaper)
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
constexpr tools::Long X() const
virtual tools::Long GetThumbPos() const override
virtual tools::Long DoScroll(tools::Long nNewPos) override
virtual tools::Long GetLineSize() const override
virtual void MovAction(const Point &rPnt) override
virtual void BrkAction() override
bool IsNoSnap() const
bool EndDragObj(bool bCopy=false)
const tools::Rectangle & GetWorkArea() const
void SetWorkArea(const tools::Rectangle &rRect)
virtual bool BegDragObj(const Point &rPnt, OutputDevice *pOut, SdrHdl *pHdl, short nMinMov=-3, SdrDragMethod *pForcedMeth=nullptr)
SdrHdl * GetDragHdl() const
bool IsDragObj() const
bool IsMoveAllowed() const
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
void MoveAllMarked(const Size &rSiz, bool bCopy=false)
SdrHdl * GetFocusHdl() const
SdrHdl * GetHdl(size_t nNum) const
SdrHdlKind GetKind() const
const Point & GetPos() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
void SortMarkedObjects() const
void BegMarkObj(const Point &rPnt, bool bUnmark=false)
const SdrHdlList & GetHdlList() const
size_t GetMarkedObjectCount() const
SdrMark * GetSdrMarkByIndex(size_t nNum) const
const tools::Rectangle & GetMarkedObjRect() const
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
const tools::Rectangle & GetAllMarkedRect() const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
SdrObject * GetMarkedSdrObj() const
virtual void SetChanged(bool bFlg=true)
bool IsChanged() const
SdrUndoFactory & GetSdrUndoFactory() const
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
bool IsMoveProtect() const
virtual void Move(const Size &rSiz)
virtual const tools::Rectangle & GetCurrentBoundRect() const
virtual const tools::Rectangle & GetSnapRect() const
virtual const tools::Rectangle & GetLastBoundRect() const
SdrPage * getSdrPageFromSdrObject() const
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const
SdrModel & getSdrModelFromSdrView() const
const SdrDragStat & GetDragStat() const
SdrPageView * GetSdrPageView() const
SdrModel & GetModel() const
void SetSnapEnabled(bool bOn)
bool IsSnapEnabled() const
virtual std::unique_ptr< SdrUndoAction > CreateUndoMoveObject(SdrObject &rObject, const Size &rDist)
virtual std::unique_ptr< SdrUndoAction > CreateUndoGeoObject(SdrObject &rObject)
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static sal_Int32 GetSplitSize()
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
bool HasFormat(SotClipboardFormatId nFormat) const
bool isCollapsed() const
OReportController & getController() const
Definition: DesignView.hxx:97
const css::uno::Reference< css::report::XReportDefinition > & getReportDefinition() const
gives access to the report definition
defines a clipboard format for copying selection elements.
Definition: dlgedclip.hxx:37
css::uno::Sequence< css::beans::NamedValue > TSectionElements
Definition: dlgedclip.hxx:39
static SotClipboardFormatId getDescriptorFormatId()
returns the format id.
Definition: dlgedclip.cxx:37
static TSectionElements extractCopies(const TransferableDataHelper &_rData)
extract the section elements
Definition: dlgedclip.cxx:64
void setSpecialMode()
Definition: RptPage.hxx:72
void resetSpecialMode()
Definition: RptPage.cxx:144
void Paste(const css::uno::Sequence< css::beans::NamedValue > &_aAllreadyCopiedObjects, bool _bForce=false)
paste a new control in this section
OReportPage * getPage() const
const css::uno::Reference< css::report::XSection > & getSection() const
OSectionView & getSectionView() const
void createDefault(const OUString &_sType)
creates a default object (custom shape)
void Copy(css::uno::Sequence< css::beans::NamedValue > &_rAllreadyCopiedObjects)
copies the current selection in this section
OScrollWindowHelper * getScrollWindow() const
ODesignView * getReportView() const
ScrollAdaptor & GetVScroll()
ScrollAdaptor & GetHScroll()
OReportSection * getReportSection() const
Definition: SectionView.hxx:56
bool IsDragResize() const
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin) override
Definition: SectionView.cxx:68
OReportSection & getReportSection()
OStartMarker & getStartMarker()
sal_Int32 getMinHeight() const
Definition: StartMarker.cxx:90
void Delete()
Deletes the current selection in this section.
bool HasSelection() const
returns <TRUE> when an object is marked
void createDefault()
creates a default object
void showRuler(bool _bShow)
shows or hides the ruler.
void BegDragObj(const Point &_aPnt, SdrHdl *_pHdl, const OSectionView *_pSection)
void resize(const OSectionWindow &_rSectionWindow)
void collectRectangles(TRectangleMap &_rMap)
void setMarked(OSectionView const *_pSectionView, bool _bMark)
the section as marked or not marked
void SetMode(DlgEdMode m_eMode)
void toggleGrid(bool _bVisible)
turns the grid on or off
svtools::ColorConfig m_aColorConfig
Definition: ViewsWindow.hxx:79
void fillCollapsedSections(::std::vector< sal_uInt16 > &_rCollapsedPositions) const
fills the positions of all collapsed sections.
void addSection(const css::uno::Reference< css::report::XSection > &_xSection, const OUString &_sColorEntry, sal_uInt16 _nPosition)
adds a new section at position _nPosition.
void Paste()
paste a new control in this section
void zoom(const Fraction &_aZoom)
zoom the ruler and view windows
void setDragStripes(bool bOn)
sal_uInt32 getMarkedObjectCount() const
TSectionsMap::iterator getIteratorAtPos(sal_uInt16 _nPos)
returns the iterator at pos _nPos or the end()
OSectionWindow * getSectionWindow(const sal_uInt16 _nPos) const
return the section at the given position
OViewsWindow(OViewsWindow const &)=delete
sal_Int32 getTotalHeight() const
returns the total accumulated height of all sections until _pSection is reached
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
void BegDragObj_createInvisibleObjectAtPosition(const tools::Rectangle &_aRect, const OSectionView &_rSection)
bool IsPasteAllowed() const
returns if paste is allowed
void impl_resizeSectionWindow(OSectionWindow &_rSectionWindow, Point &_rStartPoint, bool _bSet)
virtual ~OViewsWindow() override
void removeSection(sal_uInt16 _nPosition)
removes the section at the given position.
virtual void Paint(vcl::RenderContext &, const tools::Rectangle &rRect) override
OSectionWindow * getMarkedSection(NearSectionAccess nsa=CURRENT) const override
returns the section which is currently marked.
virtual void ConfigurationChanged(utl::ConfigurationBroadcaster *, ConfigurationHints) override
virtual void markSection(const sal_uInt16 _nPos) override
mark the section on the given position .
void scrollChildren(const Point &_aThumbPos)
VclPtr< OReportWindow > m_pParent
Definition: ViewsWindow.hxx:80
OReportWindow * getView() const
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
bool IsDragObj() const
sal_uInt16 getSectionCount() const
void EndDragObj_removeInvisibleObjects()
void BegMarkObj(const Point &_aPnt, const OSectionView *_pSection)
sal_uInt16 getPosition(const OSectionWindow *_pSectionWindow) const
returns the current position in the list
void SetInsertObj(SdrObjKind eObj, const OUString &_sShapeType)
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
void setGridSnap(bool bOn)
void MovAction(const Point &rPnt, const OSectionView *_pSection, bool _bControlKeySet)
void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection)
align all marked objects in all sections
void collapseSections(const css::uno::Sequence< css::beans::PropertyValue > &_aCollapsedSections)
collapse all sections given by their position
void Copy()
copies the current selection in this section
void handleKey(const vcl::KeyCode &_rCode)
bool IsAction() const
static void collectBoundResizeRect(const TRectangleMap &_rSortRectangles, ControlModification _nControlModification, bool _bAlignAtSection, tools::Rectangle &_rBound, tools::Rectangle &_rResize)
::std::multimap< tools::Rectangle,::std::pair< SdrObject *, OSectionView * >, RectangleLess > TRectangleMap
Definition: ViewsWindow.hxx:73
bool handleKeyEvent(const KeyEvent &_rEvent)
checks if the keycode is known by the child windows
OSectionView * getSectionRelativeToPosition(const OSectionView *_pSection, Point &_rPnt)
return the section at the given point which is relative to the given section
virtual void Resize() override
void EndDragObj(bool _bDragIntoNewSection, const OSectionView *_pSection, const Point &_aPnt)
void BrkAction()
calls on every section BrkAction
void unmarkAllObjects(OSectionView const *_pSectionView)
unmark all objects on the views without the given one.
TSectionsMap m_aSections
Definition: ViewsWindow.hxx:78
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...
::std::vector< SdrObject * > m_aBegDragTempList
void SelectAll(const SdrObjKind _nObjectType)
All objects will be marked.
virtual void dispose() override
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
constexpr Point Center() const
bool Contains(const Point &rPOINT) const
constexpr void SetLeft(tools::Long v)
constexpr void SetTop(tools::Long v)
tools::Rectangle GetIntersection(const tools::Rectangle &rRect) const
constexpr tools::Long Top() const
tools::Long getOpenHeight() const
void SetPos(const Point &rPoint)
void setWidth(tools::Long n)
constexpr void SetRight(tools::Long v)
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long Right() const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
constexpr void SetBottom(tools::Long v)
tools::Rectangle & Union(const tools::Rectangle &rRect)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
void setHeight(tools::Long n)
tools::Long getOpenWidth() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
constexpr bool IsEmpty() const
bool IsMod1() const
sal_uInt16 GetCode() const
bool IsMod2() const
virtual void dispose() override
Point LogicToPixel(const Point &rLogicPt) const
void GrabFocus()
void SetMapMode()
const MapMode & GetMapMode() const
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
Point PixelToLogic(const Point &rDevicePt) const
Size GetOutputSizePixel() const
void SetPaintTransparent(bool bTransparent)
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
void EnableChildTransparentMode(bool bEnable=true)
css::awt::Point AWTPoint(const ::Point &rVCLPoint)
inline ::Point VCLPoint(const css::awt::Point &rAWTPoint)
OUString RptResId(TranslateId aId)
int nCount
EmbeddedObjectRef * pObject
void * p
constexpr sal_uInt16 KEY_LEFT
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_DOWN
sal_uInt16 nPos
#define SAL_INFO(area, stream)
tools::Long const nRightMargin
tools::Long const nLeftMargin
int i
ControlModification
Definition: RptDef.hxx:49
SdrObject * isOver(const tools::Rectangle &_rRect, SdrPage const &_rPage, SdrView const &_rView, bool _bAllObjects=false, SdrObject const *_pIgnore=nullptr, sal_Int16 _nIgnoreType=0)
checks whether the given rectangle overlapps another OUnoObject object in that view.
Definition: UITools.cxx:846
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
void setZoomFactor(const Fraction &_aZoom, vcl::Window &_rWindow)
sets the map mode at the window
Definition: UITools.cxx:999
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
ConfigurationHints
constexpr OUStringLiteral PROPERTY_RIGHTMARGIN
Definition: strings.hxx:103
constexpr OUStringLiteral PROPERTY_LEFTMARGIN
Definition: strings.hxx:102
constexpr OUStringLiteral PROPERTY_PAPERSIZE
Definition: strings.hxx:62
SdrObjKind
#define SAL_MAX_INT32
InvalidateFlags
WinBits const WB_DIALOGCONTROL
sal_Int32 _nPos