31#include <rptui_slotid.hrc>
44using namespace ::
dbaui;
50using namespace container;
52#define START_SIZE_TASKPANE 30
64 virtual ~OTaskWindow()
override { disposeOnce(); }
67 void setPropertyBrowser(PropBrw* _pPropWin)
72 virtual void Resize()
override
74 const Size aSize = GetOutputSizePixel();
85 const Reference< XComponentContext >& _rxOrb,
86 OReportController& _rController) :
89 ,m_rReportController( _rController )
92 ,m_pCurrentView(nullptr)
93 ,m_aMarkIdle(
"reportdesign ODesignView Mark Idle")
96 ,m_aGridSizeCoarse( 1000, 1000 )
97 ,m_aGridSizeFine( 250, 250 )
103 SetMapMode(
MapMode( MapUnit::Map100thMM ) );
108 m_aSplitWin->InsertItem(
COLSET_ID,100,SPLITWINDOW_APPEND, 0, SplitWindowItemFlags::PercentSize | SplitWindowItemFlags::ColSet );
109 m_aSplitWin->InsertItem(
REPORT_ID, m_aScrollWindow.get(), 100, SPLITWINDOW_APPEND,
COLSET_ID, SplitWindowItemFlags::PercentSize);
112 m_aSplitWin->SetSplitHdl(
LINK(
this, ODesignView,SplitHdl));
113 m_aSplitWin->SetAlign(WindowAlign::Left);
116 m_aMarkIdle.SetInvokeHandler(
LINK(
this, ODesignView, MarkTimeout ) );
120ODesignView::~ODesignView()
125void ODesignView::dispose()
129 m_aScrollWindow->Hide();
141 if (m_xAddField->getDialog()->get_visible())
146 if ( m_xReportExplorer )
148 SvtViewOptions aDlgOpt(EViewType::Window, m_xReportExplorer->get_help_id());
151 if (m_xReportExplorer->getDialog()->get_visible())
154 m_xReportExplorer.reset();
157 m_pTaskPane.disposeAndClear();
158 m_aScrollWindow.disposeAndClear();
159 m_aSplitWin.disposeAndClear();
163void ODesignView::initialize()
165 SetMapMode(
MapMode( MapUnit::Map100thMM ) );
166 m_aScrollWindow->initialize();
167 m_aScrollWindow->Show();
172 ODataView::DataChanged( rDCEvt );
174 if ( (rDCEvt.
GetType() == DataChangedEventType::SETTINGS) &&
175 (rDCEvt.
GetFlags() & AllSettingsFlags::STYLE) )
184 bool bRet = ODataView::PreNotify(rNEvt);
187 case NotifyEventType::KEYINPUT:
191 if (m_xAddField && m_xAddField->getDialog()->has_toplevel_focus())
193 if ( m_xReportExplorer && m_xReportExplorer->getDialog()->has_toplevel_focus())
196 if ( handleKeyEvent(*pKeyEvent) )
198 else if ( bRet && m_pAccel )
203 if ( aUrl.Complete.isEmpty() || !m_xController->isCommandEnabled( aUrl.Complete ) )
219 const Size aPlaygroundSize( _rPlayground.
GetSize() );
222 sal_Int32 nSplitPos = getController().getSplitPos();
223 if ( 0 != aPlaygroundSize.
Width() )
225 if ( ( -1 == nSplitPos )
226 || ( nSplitPos >= aPlaygroundSize.
Width() )
231 nMinWidth =
m_pPropWin->GetMinOutputSizePixel().Width();
232 nSplitPos =
static_cast<sal_Int32
>(_rPlayground.
Right() - nMinWidth);
233 getController().setSplitPos(nSplitPos);
241 Point aTaskPanePos(nSplitPos + nSplitterWidth, _rPlayground.
Top());
242 if (m_pTaskPane && m_pTaskPane->IsVisible() &&
m_pPropWin)
244 aTaskPanePos.
setX( aPlaygroundSize.
Width() - m_pTaskPane->GetSizePixel().Width() );
245 sal_Int32 nMinWidth =
m_pPropWin->getMinimumSize().Width();
246 if ( nMinWidth > (aPlaygroundSize.
Width() - aTaskPanePos.
X()) )
248 aTaskPanePos.
setX( aPlaygroundSize.
Width() - nMinWidth );
250 nSplitPos = aTaskPanePos.
X() - nSplitterWidth;
251 getController().setSplitPos(nSplitPos);
254 if ( m_aSplitWin->GetItemSize(
TASKPANE_ID ) != nTaskPaneSize )
256 m_aSplitWin->SetItemSize(
REPORT_ID, 99 - nTaskPaneSize );
257 m_aSplitWin->SetItemSize(
TASKPANE_ID, nTaskPaneSize );
262 m_aSplitWin->SetPosSizePixel( _rPlayground.
TopLeft(),aPlaygroundSize );
275 uno::Reference<beans::XPropertySet> xProp(m_xReportComponent,uno::UNO_QUERY);
279 static_cast<OTaskWindow*
>(m_pTaskPane.get())->
Resize();
289 if ( m_eMode == DlgEdMode::Select )
290 m_eActObj = SdrObjKind::NONE;
292 m_aScrollWindow->SetMode(_eNewMode);
295void ODesignView::SetInsertObj(
SdrObjKind eObj,
const OUString& _sShapeType )
298 m_aScrollWindow->SetInsertObj( eObj,_sShapeType );
301OUString
const & ODesignView::GetInsertObjString()
const
303 return m_aScrollWindow->GetInsertObjString();
307void ODesignView::Cut()
314void ODesignView::Copy()
316 m_aScrollWindow->Copy();
320void ODesignView::Paste()
322 m_aScrollWindow->Paste();
325void ODesignView::Delete()
327 m_aScrollWindow->Delete();
330bool ODesignView::HasSelection()
const
332 return m_aScrollWindow->HasSelection();
336bool ODesignView::IsPasteAllowed()
const
338 return m_aScrollWindow->IsPasteAllowed();
344 if ( m_pCurrentView != &_rView )
346 if ( m_pCurrentView )
347 m_aScrollWindow->setMarked(m_pCurrentView,
false);
348 m_pCurrentView = &_rView;
349 m_aScrollWindow->setMarked(m_pCurrentView,
true);
350 m_xReportComponent.clear();
358void ODesignView::toggleGrid(
bool _bGridVisible)
360 m_aScrollWindow->toggleGrid(_bGridVisible);
363sal_uInt16 ODesignView::getSectionCount()
const
365 return m_aScrollWindow->getSectionCount();
368void ODesignView::showRuler(
bool _bShow)
370 m_aScrollWindow->showRuler(_bShow);
373void ODesignView::removeSection(sal_uInt16 _nPosition)
375 m_aScrollWindow->removeSection(_nPosition);
378void ODesignView::addSection(
const uno::Reference< report::XSection >& _xSection,
const OUString& _sColorEntry,sal_uInt16 _nPosition)
380 m_aScrollWindow->addSection(_xSection,_sColorEntry,_nPosition);
383void ODesignView::GetFocus()
389 OSectionWindow* pSectionWindow = m_aScrollWindow->getMarkedSection();
390 if ( pSectionWindow )
395void ODesignView::ImplInitSettings()
404 const Size aOutputSize = GetOutputSizePixel();
408 nMinWidth =
m_pPropWin->GetMinOutputSizePixel().Width();
410 if ( (aOutputSize.
Width() - nTest) >= nMinWidth && nTest > m_aScrollWindow->getMaxMarkerWidth() )
412 getController().setSplitPos(nTest);
418 m_aScrollWindow->SelectAll(_nObjectType);
421void ODesignView::unmarkAllObjects()
423 m_aScrollWindow->unmarkAllObjects();
426void ODesignView::togglePropertyBrowser(
bool _bToggleOn)
432 static_cast<OTaskWindow*
>(m_pTaskPane.get())->setPropertyBrowser(
m_pPropWin);
438 if ( !m_pCurrentView && !m_xReportComponent.is() )
439 m_xReportComponent = getController().getReportDefinition();
441 const bool bWillBeVisible = _bToggleOn;
443 m_pTaskPane->Show(bWillBeVisible);
444 m_pTaskPane->Invalidate();
446 if ( bWillBeVisible )
451 if ( bWillBeVisible )
455void ODesignView::showProperties(
const uno::Reference< uno::XInterface>& _xReportComponent)
457 if ( m_xReportComponent != _xReportComponent )
459 m_xReportComponent = _xReportComponent;
460 if ( m_pCurrentView )
461 m_aScrollWindow->setMarked(m_pCurrentView,
false);
462 m_pCurrentView =
nullptr;
467bool ODesignView::isReportExplorerVisible()
const
469 return m_xReportExplorer && m_xReportExplorer->getDialog()->get_visible();
472void ODesignView::toggleReportExplorer()
474 if ( !m_xReportExplorer )
477 m_xReportExplorer = std::make_shared<ONavigator>(
GetFrameWeld(), rReportController);
478 SvtViewOptions aDlgOpt(EViewType::Window, m_xReportExplorer->get_help_id());
480 m_xReportExplorer->getDialog()->set_window_state(aDlgOpt.
GetWindowState());
483 if (!m_xReportExplorer->getDialog()->get_visible())
489bool ODesignView::isAddFieldVisible()
const
491 return m_xAddField && m_xAddField->getDialog()->get_visible();
494void ODesignView::toggleAddField()
498 uno::Reference< report::XReportDefinition > xReport(m_xReportComponent,uno::UNO_QUERY);
499 uno::Reference< report::XReportComponent > xReportComponent(m_xReportComponent,uno::UNO_QUERY);
501 if ( !m_pCurrentView && !xReport.is() )
503 if ( xReportComponent.is() )
504 xReport = xReportComponent->getSection()->getReportDefinition();
508 else if ( m_pCurrentView )
510 uno::Reference< report::XSection > xSection = m_pCurrentView->getReportSection()->getSection();
511 xReport = xSection->getReportDefinition();
513 uno::Reference < beans::XPropertySet > xSet(rReportController.
getRowSet(),uno::UNO_QUERY);
514 m_xAddField = std::make_shared<OAddFieldWindow>(
GetFrameWeld(), xSet);
518 m_xAddField->getDialog()->set_window_state(aDlgOpt.
GetWindowState());
519 m_xAddField->Update();
521 if (!m_xAddField->getDialog()->get_visible())
527uno::Reference< report::XSection > ODesignView::getCurrentSection()
const
529 uno::Reference< report::XSection > xSection;
530 if ( m_pCurrentView )
531 xSection = m_pCurrentView->getReportSection()->getSection();
536uno::Reference< report::XReportComponent > ODesignView::getCurrentControlModel()
const
538 uno::Reference< report::XReportComponent >
xModel;
539 if ( m_pCurrentView )
541 xModel = m_pCurrentView->getReportSection()->getCurrentControlModel();
548 return m_aScrollWindow->getMarkedSection(nsa);
551OSectionWindow* ODesignView::getSectionWindow(
const css::uno::Reference< css::report::XSection>& _xSection)
const
553 return m_aScrollWindow->getSectionWindow(_xSection);
556void ODesignView::markSection(
const sal_uInt16 _nPos)
558 m_aScrollWindow->markSection(
_nPos);
561void ODesignView::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions)
const
563 m_aScrollWindow->fillCollapsedSections(_rCollapsedPositions);
566void ODesignView::collapseSections(
const uno::Sequence< beans::PropertyValue>& _aCollapsedSections)
568 m_aScrollWindow->collapseSections(_aCollapsedSections);
571OUString ODesignView::getCurrentPage()
const
576void ODesignView::setCurrentPage(
const OUString& _sLastActivePage)
584 m_aScrollWindow->alignMarkedObjects(_nControlModification, _bAlignAtSection);
587bool ODesignView::handleKeyEvent(
const KeyEvent& _rEvent)
591 if (m_xAddField && m_xAddField->getDialog()->has_toplevel_focus())
593 if (m_xReportExplorer && m_xReportExplorer->getDialog()->has_toplevel_focus())
595 return m_aScrollWindow->handleKeyEvent(_rEvent);
598void ODesignView::setMarked(
const uno::Reference< report::XSection>& _xSection,
bool _bMark)
600 m_aScrollWindow->setMarked(_xSection,_bMark);
602 UpdatePropertyBrowserDelayed(getMarkedSection()->getReportSection().getSectionView());
604 m_pCurrentView =
nullptr;
607void ODesignView::setMarked(
const uno::Sequence< uno::Reference< report::XReportComponent> >& _aShapes,
bool _bMark)
609 m_aScrollWindow->setMarked(_aShapes,_bMark);
610 if ( _aShapes.hasElements() && _bMark )
611 showProperties(_aShapes[0]);
613 m_xReportComponent.clear();
620 const uno::Sequence< beans::PropertyValue> aArgs;
621 getController().executeChecked(SID_SELECT_REPORT,aArgs);
623 ODataView::MouseButtonDown(rMEvt);
626uno::Any ODesignView::getCurrentlyShownProperty()
const
630 if ( pSectionWindow )
632 ::std::vector< uno::Reference< uno::XInterface > > aSelection;
634 if ( !aSelection.empty() )
636 uno::Sequence< uno::Reference< report::XReportComponent > >
aSeq(aSelection.size());
638 aSelection.begin(), aSelection.end(),
aSeq.getArray(),
639 [](
const auto& rxInterface)
640 { return uno::Reference<report::XReportComponent>(rxInterface, uno::UNO_QUERY); });
647void ODesignView::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection)
const
649 m_aScrollWindow->fillControlModelSelection(_rSelection);
652void ODesignView::setGridSnap(
bool bOn)
654 m_aScrollWindow->setGridSnap(bOn);
658void ODesignView::setDragStripes(
bool bOn)
660 m_aScrollWindow->setDragStripes(bOn);
663bool ODesignView::isHandleEvent()
const
668sal_uInt32 ODesignView::getMarkedObjectCount()
const
670 return m_aScrollWindow->getMarkedObjectCount();
675 m_aScrollWindow->zoom(_aZoom);
680 return m_aScrollWindow->getZoomFactor(_eType);
VclPtr< PropBrw > m_pPropWin
#define START_SIZE_TASKPANE
static const AllSettings & GetSettings()
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
const vcl::KeyCode & GetKeyCode() const
const KeyEvent * GetKeyEvent() const
NotifyEventType GetType() const
void setX(tools::Long nX)
constexpr tools::Long X() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static sal_Int32 GetSplitSize()
void SetWindowState(const OUString &sState)
OUString GetWindowState() const
void AddWindow(vcl::Window *pWindow)
void RemoveWindow(vcl::Window *pWindow)
static VclPtr< reference_type > Create(Arg &&... arg)
virtual void dispose() override
ODesignView(ODesignView const &)=delete
const css::uno::Reference< css::report::XReportDefinition > & getReportDefinition() const
gives access to the report definition
css::uno::Reference< css::sdbc::XRowSet > const & getRowSet()
returns the RowSet which reflects the current settings of the report definition
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...
OReportSection & getReportSection()
static css::awt::KeyEvent st_VCLKey2AWTKey(const vcl::KeyCode &aKey)
virtual void dispose() override
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
virtual void SetHelpId(const OUString &) override
#define UID_RPT_RPT_APP_VIEW
#define LINK(Instance, Class, Member)
Sequence< sal_Int8 > aSeq
@ RPTUI_HINT_SELECTIONCHANGED
void notifySystemWindow(vcl::Window const *pWindow, vcl::Window *pToRegister, const ::comphelper::mem_fun1_t< TaskPaneList, vcl::Window * > &rMemFunc)
notifySystemWindow adds or remove the given window _pToRegister at the Systemwindow found when search...
IMPL_LINK_NOARG(ODesignView, SplitHdl, SplitWindow *, void)
#define SPLITWINDOW_APPEND
Reference< XModel > xModel
WinBits const WB_DIALOGCONTROL