26#include <core_resource.hxx>
51 const MapMode& rMapMode = _pParent->GetMapMode();
52 SetMapMode( rMapMode );
55 m_aSplitter->SetMapMode(
MapMode( MapUnit::Map100thMM ) );
56 m_aSplitter->SetStartSplitHdl(
LINK(
this, OSectionWindow,StartSplitHdl));
57 m_aSplitter->SetSplitHdl(
LINK(
this, OSectionWindow,SplitHdl));
58 m_aSplitter->SetEndSplitHdl(
LINK(
this, OSectionWindow,EndSplitHdl));
60 m_aSplitter->SetSplitPosPixel(m_aSplitter->LogicToPixel(
Size(0,_xSection->getHeight())).Height());
63 m_aStartMarker->setCollapsedHdl(
LINK(
this,OSectionWindow,Collapsed));
65 m_aStartMarker->zoom(rMapMode.
GetScaleX());
71 m_aStartMarker->Show();
72 m_aReportSection->Show();
76 m_pSectionMulti =
new OPropertyChangeMultiplexer(
this,_xSection);
80 beans::PropertyChangeEvent
aEvent;
83 uno::Reference< report::XGroup > xGroup(_xSection->getGroup());
86 m_pGroupMulti =
new OPropertyChangeMultiplexer(
this,xGroup);
92 _propertyChanged(aEvent);
95OSectionWindow::~OSectionWindow()
100void OSectionWindow::dispose()
104 if ( m_pSectionMulti.is() )
105 m_pSectionMulti->dispose();
106 m_pSectionMulti.clear();
107 if ( m_pGroupMulti.is() )
108 m_pGroupMulti->dispose();
109 m_pGroupMulti.clear();
111 catch (uno::Exception&)
114 m_aStartMarker.disposeAndClear();
115 m_aReportSection.disposeAndClear();
116 m_aSplitter.disposeAndClear();
117 m_aEndMarker.disposeAndClear();
122void OSectionWindow::_propertyChanged(
const beans::PropertyChangeEvent& _rEvent)
125 const uno::Reference< report::XSection > xSection(_rEvent.Source,uno::UNO_QUERY);
130 m_pParent->getView()->SetUpdateMode(
false);
132 m_pParent->getView()->notifySizeChanged();
133 m_pParent->resize(*
this);
134 m_pParent->getView()->SetUpdateMode(
true);
137 else if ( _rEvent.PropertyName ==
PROPERTY_NAME && !xSection->getGroup().is() )
139 uno::Reference< report::XReportDefinition > xReport = xSection->getReportDefinition();
140 if ( setReportSectionTitle(xReport,RID_STR_REPORT_HEADER,::std::mem_fn(&OReportHelper::getReportHeader),::std::mem_fn(&OReportHelper::getReportHeaderOn))
141 || setReportSectionTitle(xReport,RID_STR_REPORT_FOOTER,::std::mem_fn(&OReportHelper::getReportFooter),::std::mem_fn(&OReportHelper::getReportFooterOn))
142 || setReportSectionTitle(xReport,RID_STR_PAGE_HEADER,::std::mem_fn(&OReportHelper::getPageHeader),::std::mem_fn(&OReportHelper::getPageHeaderOn))
143 || setReportSectionTitle(xReport,RID_STR_PAGE_FOOTER,::std::mem_fn(&OReportHelper::getPageFooter),::std::mem_fn(&OReportHelper::getPageFooterOn)) )
145 m_aStartMarker->Invalidate(InvalidateFlags::NoErase);
149 OUString sTitle =
RptResId(RID_STR_DETAIL);
150 m_aStartMarker->setTitle(sTitle);
151 m_aStartMarker->Invalidate(InvalidateFlags::Children);
157 uno::Reference< report::XGroup > xGroup(_rEvent.Source,uno::UNO_QUERY);
158 if ( xGroup.is() && !setGroupSectionTitle(xGroup,RID_STR_HEADER,::std::mem_fn(&OGroupHelper::getHeader),::std::mem_fn(&OGroupHelper::getHeaderOn)))
160 setGroupSectionTitle(xGroup,RID_STR_FOOTER,::std::mem_fn(&OGroupHelper::getFooter),::std::mem_fn(&OGroupHelper::getFooterOn));
165bool OSectionWindow::setReportSectionTitle(
166 const uno::Reference<report::XReportDefinition>& _xReport,
TranslateId pResId,
167 const ::std::function<uno::Reference<report::XSection>(
OReportHelper*)>& _pGetSection,
171 const bool bRet = _pIsSectionOn(&aReportHelper) && _pGetSection(&aReportHelper) == m_aReportSection->getSection();
175 m_aStartMarker->setTitle(sTitle);
176 m_aStartMarker->Invalidate(InvalidateFlags::Children);
181bool OSectionWindow::setGroupSectionTitle(
182 const uno::Reference<report::XGroup>& _xGroup,
TranslateId pResId,
183 const ::std::function<uno::Reference<report::XSection>(
OGroupHelper*)>& _pGetSection,
184 const ::std::function<
bool(
OGroupHelper*)>& _pIsSectionOn)
187 const bool bRet = _pIsSectionOn(&aGroupHelper) && _pGetSection(&aGroupHelper) == m_aReportSection->getSection() ;
190 OUString sExpression = _xGroup->getExpression();
191 OUString sLabel = getViewsWindow()->getView()->getReportView()->getController().getColumnLabel_throw(sExpression);
192 if ( !sLabel.isEmpty() )
194 sExpression = sLabel;
198 sTitle = sTitle.replaceFirst(
"#", sExpression);
199 m_aStartMarker->setTitle( sTitle );
200 m_aStartMarker->Invalidate(InvalidateFlags::Children);
205void OSectionWindow::ImplInitSettings()
207 EnableChildTransparentMode();
208 SetParentClipMode( ParentClipMode::NoClip );
209 SetPaintTransparent(
true );
215 Window::DataChanged( rDCEvt );
217 if ( (rDCEvt.
GetType() == DataChangedEventType::SETTINGS) &&
218 (rDCEvt.
GetFlags() & AllSettingsFlags::STYLE) )
225void OSectionWindow::Resize()
229 Size aOutputSize = GetOutputSizePixel();
232 const Point aThumbPos = m_pParent->getView()->getThumbPos();
234 aOutputSize.
AdjustHeight( -m_aSplitter->GetSizePixel().Height() );
236 if ( m_aStartMarker->isCollapsed() )
239 m_aStartMarker->SetPosSizePixel(aPos,aOutputSize);
243 const bool bShowEndMarker = m_pParent->getView()->GetTotalWidth() <= (aThumbPos.
X() + aOutputSize.
Width() );
248 m_aStartMarker->SetPosSizePixel(
Point(0,0),
Size(nStartWidth,aOutputSize.
Height()));
251 const uno::Reference< report::XSection> xSection = m_aReportSection->getSection();
252 Size aSectionSize = LogicToPixel(
Size( 0,xSection->getHeight() ) );
253 Point aReportPos(nStartWidth,0);
255 if ( bShowEndMarker )
258 m_aReportSection->SetPosSizePixel(aReportPos,aSectionSize);
262 m_aSplitter->SetPosSizePixel(aReportPos,
Size(aSectionSize.
Width(),m_aSplitter->GetSizePixel().Height()));
263 aSectionSize.
setHeight(
static_cast<tools::Long>(1000 *
static_cast<double>(GetMapMode().GetScaleY())) );
268 aReportPos.
setY( 0 );
269 m_aEndMarker->Show(bShowEndMarker);
270 m_aEndMarker->SetPosSizePixel(aReportPos,
Size(nEndWidth,aOutputSize.
Height()));
274void OSectionWindow::setCollapsed(
bool _bCollapsed)
276 if ( m_aStartMarker->isCollapsed() != _bCollapsed )
278 m_aStartMarker->setCollapsed(_bCollapsed);
282void OSectionWindow::showProperties()
284 m_pParent->getView()->showProperties( m_aReportSection->getSection() );
287void OSectionWindow::setMarked(
bool _bMark)
289 m_aStartMarker->setMarked(_bMark);
290 m_aEndMarker->setMarked(_bMark);
295 bool bShow = !_rMarker.isCollapsed();
296 m_aReportSection->Show(bShow);
297 m_aEndMarker->Show(bShow);
298 m_aSplitter->Show(bShow);
300 m_pParent->resize(*
this);
306 m_aStartMarker->zoom(_aZoom);
316 const OUString sUndoAction(
RptResId( RID_STR_UNDO_CHANGE_SIZE ) );
317 getViewsWindow()->getView()->getReportView()->getController().getUndoManager().EnterListAction( sUndoAction, OUString(), 0,
ViewShellId(-1) );
322 getViewsWindow()->getView()->getReportView()->getController().getUndoManager().LeaveListAction();
327 if ( !getViewsWindow()->
getView()->getReportView()->getController().isEditable() )
332 sal_Int32 nSplitPos = _pSplitter->GetSplitPosPixel();
334 const uno::Reference< report::XSection> xSection = m_aReportSection->getSection();
335 nSplitPos = m_aSplitter->PixelToLogic(
Size(0,nSplitPos)).Height();
337 const sal_Int32
nCount = xSection->getCount();
340 uno::Reference<report::XReportComponent> xReportComponent(xSection->getByIndex(
i),uno::UNO_QUERY);
341 if ( xReportComponent.is() )
343 nSplitPos = ::std::max(nSplitPos,xReportComponent->getPositionY() + xReportComponent->getHeight());
350 xSection->setHeight(nSplitPos);
351 m_aSplitter->SetSplitPosPixel(m_aSplitter->LogicToPixel(
Size(0,nSplitPos)).
Height());
356 _rWindow.
Scroll(-_aDelta.
X(),-_aDelta.
Y());
357 _rWindow.
Invalidate(InvalidateFlags::Transparent);
369 const Point aDelta( _nX,0 );
371 MapMode aMapMode( m_aReportSection->GetMapMode() );
375 aMapMode = m_aReportSection->GetMapMode();
377 const Point aDiff = aOld - aNew;
#define REPORT_STARTMARKER_WIDTH
#define REPORT_ENDMARKER_WIDTH
static const AllSettings & GetSettings()
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
const Fraction & GetScaleX() const
const Point & GetOrigin() const
constexpr tools::Long Y() const
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
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
Helper class to allow std::mem_fun for SAL_CALL.
Helper class to allow std::mem_fun for SAL_CALL.
OSectionWindow(OSectionWindow const &)=delete
virtual void dispose() override
const MapMode & GetMapMode() const
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
OUString RptResId(TranslateId aId)
#define LINK(Instance, Class, Member)
SwView * getView(const uno::Reference< frame::XModel > &xModel)
static void lcl_scroll(vcl::Window &_rWindow, const Point &_aDelta)
IMPL_LINK_NOARG(OSectionWindow, EndSplitHdl, Splitter *, void)
static void lcl_setOrigin(vcl::Window &_rWindow, tools::Long _nX, tools::Long _nY)
IMPL_LINK(OSectionWindow, SplitHdl, Splitter *, _pSplitter, void)
void setZoomFactor(const Fraction &_aZoom, vcl::Window &_rWindow)
sets the map mode at the window
HashMap_OWString_Interface aMap
constexpr OUStringLiteral PROPERTY_EXPRESSION
constexpr OUStringLiteral PROPERTY_NAME
constexpr OUStringLiteral PROPERTY_HEIGHT
WinBits const WB_DIALOGCONTROL