25 #include <UITools.hxx>
27 #include <propbrw.hxx>
31 #include <rptui_slotid.hrc>
44 using namespace ::
dbaui;
45 using namespace ::
utl;
49 using namespace beans;
52 #define START_SIZE_TASKPANE 30
63 explicit OTaskWindow(
vcl::Window* _pParent) :
Window(_pParent),m_pPropWin(nullptr){}
64 virtual ~OTaskWindow()
override { disposeOnce(); }
67 void setPropertyBrowser(PropBrw* _pPropWin)
69 m_pPropWin = _pPropWin;
72 virtual void Resize()
override
74 const Size aSize = GetOutputSizePixel();
75 if ( m_pPropWin && aSize.
Height() && aSize.
Width() )
76 m_pPropWin->SetSizePixel(aSize);
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 );
112 m_aSplitWin->SetSplitHdl(
LINK(
this, ODesignView,SplitHdl));
113 m_aSplitWin->SetAlign(WindowAlign::Left);
116 m_aMarkIdle.SetInvokeHandler(
LINK(
this, ODesignView, MarkTimeout ) );
120 ODesignView::~ODesignView()
125 void ODesignView::dispose()
129 m_aScrollWindow->Hide();
139 aDlgOpt.
SetWindowState(OStringToOUString(m_xAddField->getDialog()->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_ASCII_US));
141 if (m_xAddField->getDialog()->get_visible())
146 if ( m_xReportExplorer )
148 SvtViewOptions aDlgOpt(EViewType::Window, OStringToOUString(m_xReportExplorer->get_help_id(), RTL_TEXTENCODING_UTF8));
149 aDlgOpt.
SetWindowState(OStringToOUString(m_xReportExplorer->getDialog()->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_ASCII_US));
151 if (m_xReportExplorer->getDialog()->get_visible())
154 m_xReportExplorer.reset();
157 m_pTaskPane.disposeAndClear();
158 m_aScrollWindow.disposeAndClear();
159 m_aSplitWin.disposeAndClear();
163 void 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 MouseNotifyEvent::KEYINPUT:
189 if ( m_pPropWin && m_pPropWin->HasChildPathFocus() )
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() )
230 if ( m_pPropWin && m_pPropWin->IsVisible() )
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);
253 const tools::Long nTaskPaneSize =
static_cast<tools::Long>((aPlaygroundSize.Width() - aTaskPanePos.X())*100/aPlaygroundSize.Width());
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 );
272 if ( m_pPropWin && m_pPropWin->IsVisible() )
274 m_pPropWin->Update(m_pCurrentView);
275 uno::Reference<beans::XPropertySet> xProp(m_xReportComponent,uno::UNO_QUERY);
278 m_pPropWin->Update(xProp);
279 static_cast<OTaskWindow*
>(m_pTaskPane.get())->
Resize();
289 if ( m_eMode == DlgEdMode::Select )
290 m_eActObj = SdrObjKind::NONE;
292 m_aScrollWindow->SetMode(_eNewMode);
295 void ODesignView::SetInsertObj(
SdrObjKind eObj,
const OUString& _sShapeType )
298 m_aScrollWindow->SetInsertObj( eObj,_sShapeType );
301 OUString
const & ODesignView::GetInsertObjString()
const
303 return m_aScrollWindow->GetInsertObjString();
307 void ODesignView::Cut()
314 void ODesignView::Copy()
316 m_aScrollWindow->Copy();
320 void ODesignView::Paste()
322 m_aScrollWindow->Paste();
325 void ODesignView::Delete()
327 m_aScrollWindow->Delete();
330 bool ODesignView::HasSelection()
const
332 return m_aScrollWindow->HasSelection();
336 bool 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();
358 void ODesignView::toggleGrid(
bool _bGridVisible)
360 m_aScrollWindow->toggleGrid(_bGridVisible);
363 sal_uInt16 ODesignView::getSectionCount()
const
365 return m_aScrollWindow->getSectionCount();
368 void ODesignView::showRuler(
bool _bShow)
370 m_aScrollWindow->showRuler(_bShow);
373 void ODesignView::removeSection(sal_uInt16 _nPosition)
375 m_aScrollWindow->removeSection(_nPosition);
378 void ODesignView::addSection(
const uno::Reference< report::XSection >& _xSection,
const OUString& _sColorEntry,sal_uInt16 _nPosition)
380 m_aScrollWindow->addSection(_xSection,_sColorEntry,_nPosition);
383 void ODesignView::GetFocus()
389 OSectionWindow* pSectionWindow = m_aScrollWindow->getMarkedSection();
390 if ( pSectionWindow )
395 void ODesignView::ImplInitSettings()
404 const Size aOutputSize = GetOutputSizePixel();
407 if ( m_pPropWin && m_pPropWin->IsVisible() )
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);
421 void ODesignView::unmarkAllObjects()
423 m_aScrollWindow->unmarkAllObjects();
426 void ODesignView::togglePropertyBrowser(
bool _bToggleOn)
428 if ( !m_pPropWin && _bToggleOn )
431 m_pPropWin->Invalidate();
432 static_cast<OTaskWindow*
>(m_pTaskPane.get())->setPropertyBrowser(m_pPropWin);
435 if ( !(m_pPropWin && _bToggleOn != m_pPropWin->IsVisible()) )
438 if ( !m_pCurrentView && !m_xReportComponent.is() )
439 m_xReportComponent = getController().getReportDefinition();
441 const bool bWillBeVisible = _bToggleOn;
442 m_pPropWin->Show(bWillBeVisible);
443 m_pTaskPane->Show(bWillBeVisible);
444 m_pTaskPane->Invalidate();
446 if ( bWillBeVisible )
451 if ( bWillBeVisible )
455 void 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;
467 bool ODesignView::isReportExplorerVisible()
const
469 return m_xReportExplorer && m_xReportExplorer->getDialog()->get_visible();
472 void ODesignView::toggleReportExplorer()
474 if ( !m_xReportExplorer )
477 m_xReportExplorer = std::make_shared<ONavigator>(
GetFrameWeld(), rReportController);
478 SvtViewOptions aDlgOpt(EViewType::Window, OStringToOUString(m_xReportExplorer->get_help_id(), RTL_TEXTENCODING_UTF8));
479 if ( aDlgOpt.Exists() )
480 m_xReportExplorer->getDialog()->set_window_state(
OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_ASCII_US));
483 if (!m_xReportExplorer->getDialog()->get_visible())
489 bool ODesignView::isAddFieldVisible()
const
491 return m_xAddField && m_xAddField->getDialog()->get_visible();
494 void 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);
519 m_xAddField->Update();
521 if (!m_xAddField->getDialog()->get_visible())
527 uno::Reference< report::XSection > ODesignView::getCurrentSection()
const
529 uno::Reference< report::XSection > xSection;
530 if ( m_pCurrentView )
531 xSection = m_pCurrentView->getReportSection()->getSection();
536 uno::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);
551 OSectionWindow* ODesignView::getSectionWindow(
const css::uno::Reference< css::report::XSection>& _xSection)
const
553 return m_aScrollWindow->getSectionWindow(_xSection);
556 void ODesignView::markSection(
const sal_uInt16 _nPos)
558 m_aScrollWindow->markSection(_nPos);
561 void ODesignView::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions)
const
563 m_aScrollWindow->fillCollapsedSections(_rCollapsedPositions);
566 void ODesignView::collapseSections(
const uno::Sequence< beans::PropertyValue>& _aCollapsedSections)
568 m_aScrollWindow->collapseSections(_aCollapsedSections);
571 OUString ODesignView::getCurrentPage()
const
573 return m_pPropWin ? m_pPropWin->getCurrentPage() : OUString();
576 void ODesignView::setCurrentPage(
const OUString& _sLastActivePage)
579 m_pPropWin->setCurrentPage(_sLastActivePage);
584 m_aScrollWindow->alignMarkedObjects(_nControlModification, _bAlignAtSection);
587 bool ODesignView::handleKeyEvent(
const KeyEvent& _rEvent)
589 if ( m_pPropWin && m_pPropWin->HasChildPathFocus() )
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);
598 void 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;
607 void 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);
626 uno::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); });
647 void ODesignView::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection)
const
649 m_aScrollWindow->fillControlModelSelection(_rSelection);
652 void ODesignView::setGridSnap(
bool bOn)
654 m_aScrollWindow->setGridSnap(bOn);
658 void ODesignView::setDragStripes(
bool bOn)
660 m_aScrollWindow->setDragStripes(bOn);
663 bool ODesignView::isHandleEvent()
const
665 return m_pPropWin && m_pPropWin->HasChildPathFocus();
668 sal_uInt32 ODesignView::getMarkedObjectCount()
const
670 return m_aScrollWindow->getMarkedObjectCount();
675 m_aScrollWindow->zoom(_aZoom);
680 return m_aScrollWindow->getZoomFactor(_eType);
#define LINK(Instance, Class, Member)
static sal_Int32 GetSplitSize()
virtual void SetHelpId(const OString &) override
#define SPLITWINDOW_APPEND
virtual void dispose() override
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...
static const AllSettings & GetSettings()
static css::awt::KeyEvent st_VCLKey2AWTKey(const vcl::KeyCode &aKey)
DataChangedEventType GetType() const
const KeyEvent * GetKeyEvent() const
virtual void dispose() override
#define UID_RPT_RPT_APP_VIEW
ODesignView(ODesignView const &)=delete
constexpr tools::Long Width() const
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
IMPL_LINK_NOARG(ODesignView, SplitHdl, SplitWindow *, void)
AllSettingsFlags GetFlags() const
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
OReportSection & getReportSection()
WinBits const WB_DIALOGCONTROL
void SetWindowState(const OUString &sState)
MouseNotifyEvent GetType() const
css::uno::Reference< css::sdbc::XRowSet > const & getRowSet()
returns the RowSet which reflects the current settings of the report definition
OUString GetWindowState() const
VclPtr< PropBrw > m_pPropWin
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...
const vcl::KeyCode & GetKeyCode() const
constexpr tools::Long Height() const
#define START_SIZE_TASKPANE
mem_fun1_t< Tp, Arg > mem_fun(void(Tp::*f)(Arg))
static VclPtr< reference_type > Create(Arg &&...arg)
Sequence< sal_Int8 > aSeq
void RemoveWindow(vcl::Window *pWindow)
Reference< XModel > xModel
void AddWindow(vcl::Window *pWindow)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
const css::uno::Reference< css::report::XReportDefinition > & getReportDefinition() const
gives access to the report definition
bool m_bDetectedRangeSegmentation false