37#include <svx/svxids.hrc>
42#include <com/sun/star/awt/PopupMenuDirection.hpp>
43#include <com/sun/star/frame/XPopupMenuController.hpp>
51#include <dlgedclip.hxx>
52#include <rptui_slotid.hrc>
77 , DropTargetHelper(this)
81 , m_xSection(
std::move(_xSection))
82 , m_nPaintEntranceCount(0)
87 SetMapMode(
MapMode(MapUnit::Map100thMM));
88 SetParentClipMode(ParentClipMode::Clip);
89 EnableChildTransparentMode(
false );
90 SetPaintTransparent(
false );
96 catch(uno::Exception&)
101 m_pFunc.reset(
new DlgEdFuncSelect(
this ));
105OReportSection::~OReportSection()
110void OReportSection::dispose()
117 if ( m_pReportListener.is() )
118 m_pReportListener->dispose();
119 m_pReportListener.clear();
124 m_pView->EndListening( *m_pModel );
134 Window::Paint(rRenderContext, rRect);
136 if ( !(m_pView && m_nPaintEntranceCount == 0))
139 ++m_nPaintEntranceCount;
151 OSL_ENSURE(pTargetPaintWindow,
"BeginDrawLayers: Got no SdrPaintWindow (!)");
161 m_pView->CompleteRedraw(&rRenderContext, aPaintRectRegion);
162 --m_nPaintEntranceCount;
165void OReportSection::fill()
167 if ( !m_xSection.is() )
173 m_pReportListener =
addStyleListener(m_xSection->getReportDefinition(),
this);
175 m_pModel = m_pParent->getViewsWindow()->getView()->getReportView()->getController().getSdrModel();
176 m_pPage = m_pModel->getPage(m_xSection);
181 m_pParent->getViewsWindow()->getView());
185 m_pPage->setPageBorderOnlyLeftRight(
true);
188 m_pView->ShowSdrPage( m_pPage );
190 m_pView->SetMoveSnapOnlyTopLeft(
true );
191 ODesignView* pDesignView = m_pParent->getViewsWindow()->getView()->getReportView();
197 m_pView->SetGridCoarse(aGridSizeCoarse);
198 m_pView->SetGridFine(aGridSizeFine);
203 m_pView->SetSnapGridWidth(aX, aY);
205 m_pView->SetGridSnap(
true );
206 m_pView->SetGridFront(
false );
207 m_pView->SetDragStripes(
true );
208 m_pView->SetPageVisible();
209 sal_Int32 nColor = m_xSection->getBackColor();
211 nColor = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),
PROPERTY_BACKCOLOR);
214 uno::Reference<report::XReportDefinition> xReportDefinition = m_xSection->getReportDefinition();
223 m_pView->SetDesignMode();
226 const Size aPageSize = m_pPage->GetSize();
230void OReportSection::Paste(
const uno::Sequence< beans::NamedValue >& _aAllreadyCopiedObjects,
bool _bForce)
232 OSL_ENSURE(m_xSection.is(),
"Why is the section here NULL!");
233 if ( !(m_xSection.is() && _aAllreadyCopiedObjects.hasElements()) )
237 m_pView->BrkAction();
240 m_pView->UnmarkAll();
241 const OUString sSectionName = m_xSection->getName();
242 for(
const beans::NamedValue& rObject : _aAllreadyCopiedObjects)
244 if ( _bForce || rObject.Name == sSectionName)
248 uno::Sequence< uno::Reference<report::XReportComponent> > aCopies;
249 rObject.Value >>= aCopies;
250 for (
const uno::Reference<report::XReportComponent>& rCopy : std::as_const(aCopies))
257 m_pPage->InsertObject(pNewObj.get(), SAL_MAX_SIZE);
261 bool bOverlapping =
true;
262 while ( bOverlapping )
264 bOverlapping =
isOver(aRet,*m_pPage,*m_pView,
true,pNewObj.get()) !=
nullptr;
268 pNewObj->SetLogicRect(aRet);
271 m_pView->AddUndo(m_pView->GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pNewObj));
272 m_pView->MarkObj( pNewObj.get(), m_pView->GetSdrPageView() );
278 catch(uno::Exception&)
288void OReportSection::Delete()
290 if( !m_pView->AreObjectsMarked() )
293 m_pView->BrkAction();
294 m_pView->DeleteMarked();
299 if ( eNewMode == m_eMode )
302 if ( eNewMode == DlgEdMode::Insert )
311 m_pModel->SetReadOnly(
false);
315void OReportSection::Copy(uno::Sequence< beans::NamedValue >& _rAllreadyCopiedObjects)
317 Copy(_rAllreadyCopiedObjects,
false);
320void OReportSection::Copy(uno::Sequence< beans::NamedValue >& _rAllreadyCopiedObjects,
bool _bEraseAnddNoClone)
322 OSL_ENSURE(m_xSection.is(),
"Why is the section here NULL!");
323 if( !m_pView->AreObjectsMarked() || !m_xSection.is() )
327 const SdrMarkList& rMarkedList = m_pView->GetMarkedObjectList();
330 ::std::vector< uno::Reference<report::XReportComponent> > aCopies;
331 aCopies.reserve(nMark);
335 for(
size_t i = nMark;
i > 0; )
339 OObjectBase* pObj =
dynamic_cast<OObjectBase*
>(pSdrObject);
345 aCopies.emplace_back(pNewObj->getUnoShape(),uno::UNO_QUERY);
346 if ( _bEraseAnddNoClone )
349 m_pPage->RemoveObject(pSdrObject->
GetOrdNum());
353 catch(uno::Exception&)
355 OSL_FAIL(
"Can't copy report elements!");
360 if ( !aCopies.empty() )
362 ::std::reverse(aCopies.begin(),aCopies.end());
363 const sal_Int32
nLength = _rAllreadyCopiedObjects.getLength();
364 _rAllreadyCopiedObjects.realloc( nLength + 1);
365 beans::NamedValue* pNewValue = _rAllreadyCopiedObjects.getArray() +
nLength;
366 pNewValue->Name = m_xSection->getName();
367 pNewValue->Value <<= uno::Sequence< uno::Reference<report::XReportComponent> >(&(*aCopies.begin()),aCopies.size());
371void OReportSection::MouseButtonDown(
const MouseEvent& rMEvt )
373 m_pParent->getViewsWindow()->getView()->setMarked(m_pView,
true);
374 m_pFunc->MouseButtonDown( rMEvt );
375 Window::MouseButtonDown(rMEvt);
380 if ( !m_pFunc->MouseButtonUp( rMEvt ) )
381 m_pParent->getViewsWindow()->getView()->getReportView()->getController().executeUnChecked(SID_OBJECT_SELECT,uno::Sequence< beans::PropertyValue>());
387 m_pFunc->MouseMove( rMEvt );
391void OReportSection::SetGridVisible(
bool _bVisible)
393 m_pView->SetGridVisible( _bVisible );
401 if ( _nObjectType == SdrObjKind::NONE )
402 m_pView->MarkAllObj();
405 m_pView->UnmarkAll();
408 while( (pObjIter = aIter.
Next()) !=
nullptr )
411 m_pView->MarkObj( pObjIter, m_pView->GetSdrPageView() );
418 Window::Command(_rCEvt);
419 if (_rCEvt.
GetCommand() != CommandEventId::ContextMenu)
422 OReportController& rController = m_pParent->getViewsWindow()->getView()->getReportView()->getController();
423 uno::Reference<frame::XFrame>
xFrame = rController.getFrame();
424 css::uno::Sequence<css::uno::Any> aArgs {
430 css::uno::Reference<css::uno::XComponentContext> xContext(rController.getORB());
431 css::uno::Reference<css::frame::XPopupMenuController> xMenuController(
432 xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
433 "com.sun.star.comp.framework.ResourceMenuController", aArgs, xContext), css::uno::UNO_QUERY);
435 if (!xMenuController.is())
440 if (!xPopupMenu.is())
443 xMenuController->setPopupMenu(xPopupMenu);
446 m_pView->EndAction();
448 xPopupMenu->execute(GetComponentInterface(),
449 css::awt::Rectangle(aPos.
X(), aPos.
Y(), 1, 1),
450 css::awt::PopupMenuDirection::EXECUTE_DOWN);
452 css::uno::Reference<css::lang::XComponent> xComponent(xMenuController, css::uno::UNO_QUERY);
453 xComponent->dispose();
456void OReportSection::_propertyChanged(
const beans::PropertyChangeEvent& _rEvent)
458 if ( !m_xSection.is() )
463 sal_Int32 nColor = m_xSection->getBackColor();
465 nColor = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),
PROPERTY_BACKCOLOR);
467 Invalidate(InvalidateFlags::NoChildren|InvalidateFlags::NoErase);
471 uno::Reference<report::XReportDefinition> xReportDefinition = m_xSection->getReportDefinition();
474 const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,
PROPERTY_PAPERSIZE).Width;
484 const Size aOldPageSize = m_pPage->GetSize();
485 sal_Int32 nNewHeight = 5*m_xSection->
getHeight();
486 if ( aOldPageSize.
Height() != nNewHeight || nPaperWidth != aOldPageSize.
Width() )
488 m_pPage->SetSize(
Size( nPaperWidth,nNewHeight) );
489 const Size aPageSize = m_pPage->GetSize();
493 m_pParent->Invalidate(InvalidateFlags::Update | InvalidateFlags::Transparent);
496void OReportSection::impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_Int32 i_nLeftMargin,sal_Int32 i_nRightMargin)
500 sal_Int32 nRightBorder = i_nPaperWidth - i_nRightMargin;
501 const sal_Int32
nCount = m_xSection->getCount();
504 uno::Reference< report::XReportComponent> xReportComponent(m_xSection->getByIndex(
i),uno::UNO_QUERY_THROW);
505 awt::Point aPos = xReportComponent->getPosition();
506 awt::Size aSize = xReportComponent->getSize();
510 bool bChanged =
false;
512 OObjectBase& rBase =
dynamic_cast<OObjectBase&
>(*pObject);
513 rBase.EndListening();
514 if ( aPos.X < i_nLeftMargin )
516 aPos.X = i_nLeftMargin;
519 if ( (aPos.X + aSize.Width) > nRightBorder )
521 aPos.X = nRightBorder - aSize.Width;
522 if ( aPos.X < i_nLeftMargin )
524 aSize.Width += aPos.X - i_nLeftMargin;
525 aPos.X = i_nLeftMargin;
527 rBase.StartListening();
528 xReportComponent->setSize(aSize);
529 rBase.EndListening();
537 xReportComponent->setPosition(aPos);
547 rBase.StartListening();
551 catch(
const uno::Exception &)
557bool OReportSection::handleKeyEvent(
const KeyEvent& _rEvent)
559 return m_pFunc && m_pFunc->handleKeyEvent(_rEvent);
562void OReportSection::deactivateOle()
565 m_pFunc->deactivateOle(
true);
568void OReportSection::createDefault(
const OUString& _sType)
570 SdrObject* pObj = m_pView->GetCreateObj();
576void OReportSection::createDefault(
const OUString& _sType,
SdrObject* _pObj)
578 bool bAttributesAppliedFromGallery =
false;
586 [&_sType](
const OUString& rObj) { return rObj.equalsIgnoreAsciiCase(_sType); });
589 auto i =
static_cast<sal_uInt32
>(std::distance(
aObjList.begin(), aIter));
612 aDest.Set( rSource );
617 bAttributesAppliedFromGallery =
true;
623 if ( !bAttributesAppliedFromGallery )
633uno::Reference< report::XReportComponent > OReportSection::getCurrentControlModel()
const
635 uno::Reference< report::XReportComponent >
xModel;
638 const SdrMarkList& rMarkList = m_pView->GetMarkedObjectList();
643 OObjectBase* pObj =
dynamic_cast<OObjectBase*
>(pDlgEdObj);
645 xModel = pObj->getReportComponent().get();
651void OReportSection::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection)
const
656 const SdrMarkList& rMarkList = m_pView->GetMarkedObjectList();
659 for (
size_t i=0;
i < nMarkCount; ++
i)
662 const OObjectBase* pObj =
dynamic_cast<const OObjectBase*
>(pDlgEdObj);
665 uno::Reference<uno::XInterface> xInterface(pObj->getReportComponent());
666 _rSelection.push_back(xInterface);
675 if ( m_pFunc->isOverlapping(aMouseEvt) )
683 sal_uInt16 nCurrentPosition = m_pParent->getViewsWindow()->getPosition(m_pParent);
687 if (nCurrentPosition < 1)
696 if (m_pParent->getViewsWindow()->getSectionCount() > (nCurrentPosition + 1) )
722 if ( m_pFunc->isOverlapping(aMouseEvt) )
729 if ( OReportExchange::canExtract(rFlavors) )
734 m_pParent->getViewsWindow()->BrkAction();
735 m_pParent->getViewsWindow()->unmarkAllObjects(m_pView);
737 else if ( bMultipleFormat
740 m_pParent->getViewsWindow()->getView()->setMarked(m_pView,
true);
741 m_pView->UnmarkAll();
743 if ( aDropPos.
X() < rRect.
Left() )
745 else if ( aDropPos.
X() > rRect.
Right() )
748 if ( aDropPos.
Y() > rRect.
Bottom() )
751 uno::Sequence<beans::PropertyValue> aValues;
752 if ( !bMultipleFormat )
762 for(beans::PropertyValue & propVal : asNonConstRange(aValues))
764 uno::Sequence<beans::PropertyValue> aCurrent;
765 propVal.Value >>= aCurrent;
766 sal_Int32
nLength = aCurrent.getLength();
770 auto pCurrent = aCurrent.getArray();
774 pCurrent[
nLength].Name =
"DNDAction";
777 pCurrent[
nLength].Name =
"Section";
778 pCurrent[
nLength++].Value <<= getSection();
779 propVal.Value <<= aCurrent;
784 OReportController& rController = m_pParent->getViewsWindow()->getView()->getReportView()->getController();
785 rController.executeChecked(SID_ADD_CONTROL_PAIR,aValues);
791void OReportSection::stopScrollTimer()
793 m_pFunc->stopScrollTimer();
796bool OReportSection::isUiActive()
const
798 return m_pFunc->isUiActive();
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
static sal_uInt32 GetSdrObjCount(std::u16string_view rThemeName)
static bool FillObjListTitle(const sal_uInt32 nThemeId, std::vector< OUString > &rList)
static bool GetSdrObj(std::u16string_view rThemeName, sal_uInt32 nSdrModelPos, SdrModel *pModel, BitmapEx *pThumb=nullptr)
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)
constexpr tools::Long X() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
SdrObject * GetMarkedSdrObj() const
const SfxItemPool & GetItemPool() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
SdrObject * GetObj(size_t nNum) const
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
virtual Degree100 GetRotateAngle() const
sal_uInt32 GetOrdNum() const
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
SdrModel & getSdrModelFromSdrObject() const
virtual const tools::Rectangle & GetSnapRect() const
virtual SdrObjKind GetObjIdentifier() const
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const=0
const SfxItemSet & GetMergedItemSet() const
void SetMergedItem(const SfxPoolItem &rItem)
virtual void NbcRotate(const Point &rRef, Degree100 nAngle, double sn, double cs)=0
void DrawLayer(SdrLayerID nID, OutputDevice *pGivenTarget, sdr::contact::ViewObjectContactRedirector *pRedirector=nullptr, const tools::Rectangle &rRect=tools::Rectangle(), basegfx::B2IRectangle const *pPageFrame=nullptr)
const Color & GetApplicationDocumentColor() const
void EndDrawLayers(SdrPaintWindow &rPaintWindow, bool bPaintFormLayer)
SdrPaintWindow * BeginDrawLayers(OutputDevice *pOut, const vcl::Region &rReg, bool bDisableIntersect=false)
OutputDevice & GetTargetOutputDevice()
virtual std::unique_ptr< SdrUndoAction > CreateUndoDeleteObject(SdrObject &rObject, bool bOrdNumDirect=false)
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const DataFlavorExVector & GetDataFlavorExVector() const
const Size & getGridSizeCoarse() const
const Size & getGridSizeFine() const
css::uno::Sequence< css::beans::NamedValue > TSectionElements
OReportSection(OReportSection const &)=delete
static bool extractColumnDescriptor(const TransferableDataHelper &_rData, OUString &_rDatasource, OUString &_rDatabaseLocation, OUString &_rConnectionResource, sal_Int32 &_nCommandType, OUString &_rCommand, OUString &_rFieldName)
static bool canExtractColumnDescriptor(const DataFlavorExVector &_rFlavors, ColumnTransferFormatFlags _nFormats)
css::uno::Sequence< css::beans::PropertyValue > const & createPropertyValueSequence()
static css::uno::Sequence< css::beans::PropertyValue > extractDescriptor(const TransferableDataHelper &_rData)
static bool canExtractDescriptor(const DataFlavorExVector &_rFlavors)
virtual void dispose() override
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
css::awt::Point AWTPoint(const ::Point &rVCLPoint)
inline ::Size VCLSize(const css::awt::Size &rAWTSize)
inline ::Point VCLPoint(const css::awt::Point &rAWTPoint)
#define TOOLS_WARN_EXCEPTION(area, stream)
virtual void SetHelpId(const OUString &) override
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+16)
constexpr sal_uInt16 EE_ITEMS_END(EE_FEATURE_END)
constexpr sal_uInt16 EE_ITEMS_START(OWN_ATTR_VALUE_END+1)
EmbeddedObjectRef * pObject
std::deque< AttachedObject_Impl > aObjList
::std::vector< DataFlavorEx > DataFlavorExVector
#define GALLERY_THEME_POWERPOINT
constexpr OUStringLiteral HID_REPORTSECTION
tools::Long const nRightMargin
tools::Long const nLeftMargin
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
css::uno::Reference< css::uno::XInterface > createDefault(css::uno::Reference< css::uno::XComponentContext > const &context)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
::rtl::Reference< comphelper::OPropertyChangeMultiplexer > addStyleListener(const css::uno::Reference< css::report::XReportDefinition > &_xReportDefinition,::comphelper::OPropertyChangeListener *_pListener)
add a listener for the properties size, left margin, right margin to the page style
void correctOverlapping(SdrObject *pControl, OReportSection const &_aReportSection, bool _bInsert=true)
ensures that no control overlaps the given one.
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.
constexpr SdrLayerID RPT_LAYER_FRONT(0)
static Color lcl_getOverlappedControlColor()
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
constexpr OUStringLiteral PROPERTY_POSITION
constexpr OUStringLiteral PROPERTY_RIGHTMARGIN
constexpr OUStringLiteral DBOVERLAPPEDCONTROL
constexpr OUStringLiteral PROPERTY_LEFTMARGIN
constexpr OUStringLiteral CFG_REPORTDESIGNER
constexpr OUStringLiteral PROPERTY_BACKCOLOR
constexpr OUStringLiteral PROPERTY_PAPERSIZE
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
Reference< XFrame > xFrame
Reference< XModel > xModel
constexpr sal_uInt16 SDRATTR_START(XATTR_START)
constexpr sal_uInt16 SDRATTR_CUSTOMSHAPE_LAST(SDRATTR_CUSTOMSHAPE_GEOMETRY)
constexpr sal_uInt16 SDRATTR_MISC_LAST(SDRATTR_TEXT_CLIPVERTOVERFLOW)
constexpr sal_uInt16 SDRATTR_MISC_FIRST(SDRATTR_CAPTION_LAST+1)
constexpr sal_uInt16 SDRATTR_GRAF_FIRST(SDRATTR_NOTPERSIST_LAST+1)
constexpr sal_uInt16 SDRATTR_SHADOW_LAST(SDRATTR_SHADOWALIGNMENT)
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
#define DND_ACTION_COPYMOVE
WinBits const WB_DIALOGCONTROL