1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #include "precompiled_reportdesign.hxx"
28*cdf0e10cSrcweir #include "ScrollHelper.hxx"
29*cdf0e10cSrcweir #include "DesignView.hxx"
30*cdf0e10cSrcweir #include "ReportController.hxx"
31*cdf0e10cSrcweir #include "ReportWindow.hxx"
32*cdf0e10cSrcweir #include "UITools.hxx"
33*cdf0e10cSrcweir #include <tools/debug.hxx>
34*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
35*cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
36*cdf0e10cSrcweir #include <vcl/svapp.hxx>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir namespace rptui
39*cdf0e10cSrcweir {
40*cdf0e10cSrcweir #define LINE_SIZE			50
41*cdf0e10cSrcweir #define SECTION_OFFSET	    3
42*cdf0e10cSrcweir #define SCR_LINE_SIZE       10
43*cdf0e10cSrcweir using namespace ::com::sun::star;
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir // -----------------------------------------------------------------------------
46*cdf0e10cSrcweir void lcl_setScrollBar(sal_Int32 _nNewValue,const Point& _aPos,const Size& _aSize,ScrollBar& _rScrollBar)
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir     _rScrollBar.SetPosSizePixel(_aPos,_aSize);
49*cdf0e10cSrcweir 	_rScrollBar.SetPageSize( _nNewValue );
50*cdf0e10cSrcweir 	_rScrollBar.SetVisibleSize( _nNewValue );
51*cdf0e10cSrcweir }
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir // -----------------------------------------------------------------------------
54*cdf0e10cSrcweir DBG_NAME( rpt_OScrollWindowHelper );
55*cdf0e10cSrcweir OScrollWindowHelper::OScrollWindowHelper( ODesignView* _pDesignView)
56*cdf0e10cSrcweir 	: OScrollWindowHelper_BASE( _pDesignView,WB_DIALOGCONTROL)
57*cdf0e10cSrcweir     ,OPropertyChangeListener(m_aMutex)
58*cdf0e10cSrcweir 	,m_aHScroll( this, WB_HSCROLL|WB_REPEAT|WB_DRAG )
59*cdf0e10cSrcweir 	,m_aVScroll( this, WB_VSCROLL|WB_REPEAT|WB_DRAG )
60*cdf0e10cSrcweir 	,m_aCornerWin( this )
61*cdf0e10cSrcweir 	,m_pParent(_pDesignView)
62*cdf0e10cSrcweir 	,m_aReportWindow(this,m_pParent)
63*cdf0e10cSrcweir     ,m_pReportDefintionMultiPlexer(NULL)
64*cdf0e10cSrcweir {
65*cdf0e10cSrcweir 	DBG_CTOR( rpt_OScrollWindowHelper,NULL);
66*cdf0e10cSrcweir 	SetMapMode( MapMode( MAP_100TH_MM ) );
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir     impl_initScrollBar( m_aHScroll );
69*cdf0e10cSrcweir     impl_initScrollBar( m_aVScroll );
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 	m_aReportWindow.SetMapMode( MapMode( MAP_100TH_MM ) );
72*cdf0e10cSrcweir 	m_aReportWindow.Show();
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir 	// normally we should be SCROLL_PANE
75*cdf0e10cSrcweir 	SetAccessibleRole(accessibility::AccessibleRole::SCROLL_PANE);
76*cdf0e10cSrcweir     ImplInitSettings();
77*cdf0e10cSrcweir }
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir // -----------------------------------------------------------------------------
80*cdf0e10cSrcweir OScrollWindowHelper::~OScrollWindowHelper()
81*cdf0e10cSrcweir {
82*cdf0e10cSrcweir 	DBG_DTOR( rpt_OScrollWindowHelper,NULL);
83*cdf0e10cSrcweir     if ( m_pReportDefintionMultiPlexer.is() )
84*cdf0e10cSrcweir     	m_pReportDefintionMultiPlexer->dispose();
85*cdf0e10cSrcweir }
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir // -----------------------------------------------------------------------------
88*cdf0e10cSrcweir void OScrollWindowHelper::impl_initScrollBar( ScrollBar& _rScrollBar ) const
89*cdf0e10cSrcweir {
90*cdf0e10cSrcweir     AllSettings aSettings( _rScrollBar.GetSettings() );
91*cdf0e10cSrcweir     StyleSettings aStyle( aSettings.GetStyleSettings() );
92*cdf0e10cSrcweir     aStyle.SetDragFullOptions( aStyle.GetDragFullOptions() | DRAGFULL_OPTION_SCROLL ); // live scrolling
93*cdf0e10cSrcweir     aSettings.SetStyleSettings( aStyle );
94*cdf0e10cSrcweir     _rScrollBar.SetSettings( aSettings );
95*cdf0e10cSrcweir     //_rScrollBar.SetMapMode( MapMode( MAP_100TH_MM ) );
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir 	_rScrollBar.SetScrollHdl( LINK( this, OScrollWindowHelper, ScrollHdl ) );
98*cdf0e10cSrcweir     _rScrollBar.SetLineSize( SCR_LINE_SIZE );
99*cdf0e10cSrcweir }
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir // -----------------------------------------------------------------------------
102*cdf0e10cSrcweir void OScrollWindowHelper::initialize()
103*cdf0e10cSrcweir {
104*cdf0e10cSrcweir     uno::Reference<report::XReportDefinition> xReportDefinition = m_pParent->getController().getReportDefinition();
105*cdf0e10cSrcweir     m_pReportDefintionMultiPlexer = addStyleListener(xReportDefinition,this);
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 	m_aReportWindow.initialize();
108*cdf0e10cSrcweir }
109*cdf0e10cSrcweir //------------------------------------------------------------------------------
110*cdf0e10cSrcweir void OScrollWindowHelper::setTotalSize(sal_Int32 _nWidth ,sal_Int32 _nHeight)
111*cdf0e10cSrcweir {
112*cdf0e10cSrcweir     m_aTotalPixelSize.Width() = _nWidth;
113*cdf0e10cSrcweir 	m_aTotalPixelSize.Height() = _nHeight;
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     // now set the ranges without start marker
116*cdf0e10cSrcweir     Fraction aStartWidth(REPORT_STARTMARKER_WIDTH * m_pParent->getController().getZoomValue(),100);
117*cdf0e10cSrcweir     long nWidth = long(_nWidth - (double)aStartWidth);
118*cdf0e10cSrcweir     m_aHScroll.SetRangeMax( nWidth );
119*cdf0e10cSrcweir     m_aVScroll.SetRangeMax( m_aTotalPixelSize.Height() );
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     Resize();
122*cdf0e10cSrcweir }
123*cdf0e10cSrcweir //------------------------------------------------------------------------------
124*cdf0e10cSrcweir Size OScrollWindowHelper::ResizeScrollBars()
125*cdf0e10cSrcweir {
126*cdf0e10cSrcweir 	// get the new output-size in pixel
127*cdf0e10cSrcweir 	Size aOutPixSz = GetOutputSizePixel();
128*cdf0e10cSrcweir     if ( aOutPixSz.Width() == 0 || aOutPixSz.Height() == 0 )
129*cdf0e10cSrcweir         return aOutPixSz;
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir     aOutPixSz.Height() -= m_aReportWindow.getRulerHeight();
132*cdf0e10cSrcweir 	// determine the size of the output-area and if we need scrollbars
133*cdf0e10cSrcweir 	const long nScrSize = GetSettings().GetStyleSettings().GetScrollBarSize();
134*cdf0e10cSrcweir 	bool bVVisible = false; // by default no vertical-ScrollBar
135*cdf0e10cSrcweir 	bool bHVisible = false; // by default no horizontal-ScrollBar
136*cdf0e10cSrcweir 	bool bChanged;			// determines if a visiblility was changed
137*cdf0e10cSrcweir 	do
138*cdf0e10cSrcweir 	{
139*cdf0e10cSrcweir 		bChanged = false;
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 		// does we need a vertical ScrollBar
142*cdf0e10cSrcweir 		if ( aOutPixSz.Width() < m_aTotalPixelSize.Width() && !bHVisible )
143*cdf0e10cSrcweir 		{
144*cdf0e10cSrcweir 			bHVisible = true;
145*cdf0e10cSrcweir 			aOutPixSz.Height() -= nScrSize;
146*cdf0e10cSrcweir 			bChanged = true;
147*cdf0e10cSrcweir 		}
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 		// does we need a horizontal ScrollBar
150*cdf0e10cSrcweir 		if ( aOutPixSz.Height() < m_aTotalPixelSize.Height() && !bVVisible )
151*cdf0e10cSrcweir 		{
152*cdf0e10cSrcweir 			bVVisible = true;
153*cdf0e10cSrcweir 			aOutPixSz.Width() -= nScrSize;
154*cdf0e10cSrcweir 			bChanged = true;
155*cdf0e10cSrcweir 		}
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 	}
158*cdf0e10cSrcweir 	while ( bChanged );   // until no visibility has changed
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir     aOutPixSz.Height() += m_aReportWindow.getRulerHeight();
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 	// show or hide scrollbars
163*cdf0e10cSrcweir 	m_aVScroll.Show( bVVisible );
164*cdf0e10cSrcweir 	m_aHScroll.Show( bHVisible );
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 	// disable painting in the corner between the scrollbars
167*cdf0e10cSrcweir 	if ( bVVisible && bHVisible )
168*cdf0e10cSrcweir 	{
169*cdf0e10cSrcweir 		m_aCornerWin.SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()), Size(nScrSize, nScrSize) );
170*cdf0e10cSrcweir 		m_aCornerWin.Show();
171*cdf0e10cSrcweir 	}
172*cdf0e10cSrcweir 	else
173*cdf0e10cSrcweir 		m_aCornerWin.Hide();
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 	const Point aOffset = LogicToPixel( Point( SECTION_OFFSET, SECTION_OFFSET ), MAP_APPFONT );
176*cdf0e10cSrcweir 	// resize scrollbars and set their ranges
177*cdf0e10cSrcweir 	{
178*cdf0e10cSrcweir         Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH*m_pParent->getController().getZoomValue()),100);
179*cdf0e10cSrcweir 		const sal_Int32 nNewWidth = aOutPixSz.Width() - aOffset.X() - (long)aStartWidth;
180*cdf0e10cSrcweir         lcl_setScrollBar(nNewWidth,Point( (long)aStartWidth + aOffset.X(), aOutPixSz.Height() ),Size( nNewWidth, nScrSize ),m_aHScroll);
181*cdf0e10cSrcweir 	}
182*cdf0e10cSrcweir 	{
183*cdf0e10cSrcweir 		const sal_Int32 nNewHeight = aOutPixSz.Height() - m_aReportWindow.getRulerHeight();
184*cdf0e10cSrcweir         lcl_setScrollBar(nNewHeight,Point( aOutPixSz.Width(), m_aReportWindow.getRulerHeight() ),Size( nScrSize,nNewHeight),m_aVScroll);
185*cdf0e10cSrcweir 	}
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 	return aOutPixSz;
188*cdf0e10cSrcweir }
189*cdf0e10cSrcweir //------------------------------------------------------------------------------
190*cdf0e10cSrcweir void OScrollWindowHelper::Resize()
191*cdf0e10cSrcweir {
192*cdf0e10cSrcweir 	OScrollWindowHelper_BASE::Resize();
193*cdf0e10cSrcweir 	const Size aTotalOutputSize = ResizeScrollBars();
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir 	m_aReportWindow.SetPosSizePixel(Point( 0, 0 ),aTotalOutputSize);
196*cdf0e10cSrcweir }
197*cdf0e10cSrcweir //------------------------------------------------------------------------------
198*cdf0e10cSrcweir IMPL_LINK( OScrollWindowHelper, ScrollHdl, ScrollBar*, /*pScroll*/ )
199*cdf0e10cSrcweir {
200*cdf0e10cSrcweir     m_aReportWindow.ScrollChildren( getThumbPos() );
201*cdf0e10cSrcweir     return 0;
202*cdf0e10cSrcweir }
203*cdf0e10cSrcweir //------------------------------------------------------------------------------
204*cdf0e10cSrcweir void OScrollWindowHelper::addSection(const uno::Reference< report::XSection >& _xSection
205*cdf0e10cSrcweir 								   ,const ::rtl::OUString& _sColorEntry
206*cdf0e10cSrcweir 								   ,sal_uInt16 _nPosition)
207*cdf0e10cSrcweir {
208*cdf0e10cSrcweir 	m_aReportWindow.addSection(_xSection,_sColorEntry,_nPosition);
209*cdf0e10cSrcweir }
210*cdf0e10cSrcweir //------------------------------------------------------------------------------
211*cdf0e10cSrcweir void OScrollWindowHelper::removeSection(sal_uInt16 _nPosition)
212*cdf0e10cSrcweir {
213*cdf0e10cSrcweir 	m_aReportWindow.removeSection(_nPosition);
214*cdf0e10cSrcweir }
215*cdf0e10cSrcweir //------------------------------------------------------------------------------
216*cdf0e10cSrcweir void OScrollWindowHelper::toggleGrid(sal_Bool _bVisible)
217*cdf0e10cSrcweir {
218*cdf0e10cSrcweir 	m_aReportWindow.toggleGrid(_bVisible);
219*cdf0e10cSrcweir }
220*cdf0e10cSrcweir //------------------------------------------------------------------------------
221*cdf0e10cSrcweir sal_uInt16 OScrollWindowHelper::getSectionCount() const
222*cdf0e10cSrcweir {
223*cdf0e10cSrcweir 	return m_aReportWindow.getSectionCount();
224*cdf0e10cSrcweir }
225*cdf0e10cSrcweir //------------------------------------------------------------------------------
226*cdf0e10cSrcweir void OScrollWindowHelper::SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType )
227*cdf0e10cSrcweir {
228*cdf0e10cSrcweir 	m_aReportWindow.SetInsertObj(eObj,_sShapeType);
229*cdf0e10cSrcweir }
230*cdf0e10cSrcweir //----------------------------------------------------------------------------
231*cdf0e10cSrcweir rtl::OUString OScrollWindowHelper::GetInsertObjString() const
232*cdf0e10cSrcweir {
233*cdf0e10cSrcweir 	return m_aReportWindow.GetInsertObjString();
234*cdf0e10cSrcweir }
235*cdf0e10cSrcweir //------------------------------------------------------------------------------
236*cdf0e10cSrcweir void OScrollWindowHelper::SetMode( DlgEdMode _eNewMode )
237*cdf0e10cSrcweir {
238*cdf0e10cSrcweir 	m_aReportWindow.SetMode(_eNewMode);
239*cdf0e10cSrcweir }
240*cdf0e10cSrcweir //------------------------------------------------------------------------------
241*cdf0e10cSrcweir sal_Bool OScrollWindowHelper::HasSelection() const
242*cdf0e10cSrcweir {
243*cdf0e10cSrcweir 	return m_aReportWindow.HasSelection();
244*cdf0e10cSrcweir }
245*cdf0e10cSrcweir //----------------------------------------------------------------------------
246*cdf0e10cSrcweir void OScrollWindowHelper::Delete()
247*cdf0e10cSrcweir {
248*cdf0e10cSrcweir     m_aReportWindow.Delete();
249*cdf0e10cSrcweir }
250*cdf0e10cSrcweir //----------------------------------------------------------------------------
251*cdf0e10cSrcweir void OScrollWindowHelper::Copy()
252*cdf0e10cSrcweir {
253*cdf0e10cSrcweir     m_aReportWindow.Copy();
254*cdf0e10cSrcweir }
255*cdf0e10cSrcweir //----------------------------------------------------------------------------
256*cdf0e10cSrcweir void OScrollWindowHelper::Paste()
257*cdf0e10cSrcweir {
258*cdf0e10cSrcweir     m_aReportWindow.Paste();
259*cdf0e10cSrcweir }
260*cdf0e10cSrcweir //----------------------------------------------------------------------------
261*cdf0e10cSrcweir sal_Bool OScrollWindowHelper::IsPasteAllowed() const
262*cdf0e10cSrcweir {
263*cdf0e10cSrcweir     return m_aReportWindow.IsPasteAllowed();
264*cdf0e10cSrcweir }
265*cdf0e10cSrcweir //-----------------------------------------------------------------------------
266*cdf0e10cSrcweir void OScrollWindowHelper::SelectAll(const sal_uInt16 _nObjectType)
267*cdf0e10cSrcweir {
268*cdf0e10cSrcweir 	m_aReportWindow.SelectAll(_nObjectType);
269*cdf0e10cSrcweir }
270*cdf0e10cSrcweir //----------------------------------------------------------------------------
271*cdf0e10cSrcweir void OScrollWindowHelper::unmarkAllObjects(OSectionView* _pSectionView)
272*cdf0e10cSrcweir {
273*cdf0e10cSrcweir 	m_aReportWindow.unmarkAllObjects(_pSectionView);
274*cdf0e10cSrcweir }
275*cdf0e10cSrcweir //------------------------------------------------------------------------------
276*cdf0e10cSrcweir sal_Int32 OScrollWindowHelper::getMaxMarkerWidth(sal_Bool _bWithEnd) const
277*cdf0e10cSrcweir {
278*cdf0e10cSrcweir 	return m_aReportWindow.getMaxMarkerWidth(_bWithEnd);
279*cdf0e10cSrcweir }
280*cdf0e10cSrcweir //----------------------------------------------------------------------------
281*cdf0e10cSrcweir void OScrollWindowHelper::showRuler(sal_Bool _bShow)
282*cdf0e10cSrcweir {
283*cdf0e10cSrcweir 	m_aReportWindow.showRuler(_bShow);
284*cdf0e10cSrcweir }
285*cdf0e10cSrcweir //------------------------------------------------------------------------------
286*cdf0e10cSrcweir sal_Bool OScrollWindowHelper::handleKeyEvent(const KeyEvent& _rEvent)
287*cdf0e10cSrcweir {
288*cdf0e10cSrcweir 	return m_aReportWindow.handleKeyEvent(_rEvent);
289*cdf0e10cSrcweir }
290*cdf0e10cSrcweir //------------------------------------------------------------------------
291*cdf0e10cSrcweir void OScrollWindowHelper::setMarked(OSectionView* _pSectionView,sal_Bool _bMark)
292*cdf0e10cSrcweir {
293*cdf0e10cSrcweir 	m_aReportWindow.setMarked(_pSectionView,_bMark);
294*cdf0e10cSrcweir }
295*cdf0e10cSrcweir //------------------------------------------------------------------------
296*cdf0e10cSrcweir void OScrollWindowHelper::setMarked(const uno::Reference< report::XSection>& _xSection,sal_Bool _bMark)
297*cdf0e10cSrcweir {
298*cdf0e10cSrcweir 	m_aReportWindow.setMarked(_xSection,_bMark);
299*cdf0e10cSrcweir }
300*cdf0e10cSrcweir //------------------------------------------------------------------------
301*cdf0e10cSrcweir void OScrollWindowHelper::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _xShape,sal_Bool _bMark)
302*cdf0e10cSrcweir {
303*cdf0e10cSrcweir 	m_aReportWindow.setMarked(_xShape,_bMark);
304*cdf0e10cSrcweir }
305*cdf0e10cSrcweir // -------------------------------------------------------------------------
306*cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getMarkedSection(NearSectionAccess nsa) const
307*cdf0e10cSrcweir {
308*cdf0e10cSrcweir 	return m_aReportWindow.getMarkedSection(nsa);
309*cdf0e10cSrcweir }
310*cdf0e10cSrcweir // -------------------------------------------------------------------------
311*cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
312*cdf0e10cSrcweir {
313*cdf0e10cSrcweir 	return  m_aReportWindow.getSectionWindow(_xSection);
314*cdf0e10cSrcweir }
315*cdf0e10cSrcweir // -------------------------------------------------------------------------
316*cdf0e10cSrcweir void OScrollWindowHelper::markSection(const sal_uInt16 _nPos)
317*cdf0e10cSrcweir {
318*cdf0e10cSrcweir 	m_aReportWindow.markSection(_nPos);
319*cdf0e10cSrcweir }
320*cdf0e10cSrcweir // -----------------------------------------------------------------------------
321*cdf0e10cSrcweir void OScrollWindowHelper::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
322*cdf0e10cSrcweir {
323*cdf0e10cSrcweir     m_aReportWindow.fillCollapsedSections(_rCollapsedPositions);
324*cdf0e10cSrcweir }
325*cdf0e10cSrcweir // -----------------------------------------------------------------------------
326*cdf0e10cSrcweir void OScrollWindowHelper::collapseSections(const uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections)
327*cdf0e10cSrcweir {
328*cdf0e10cSrcweir     m_aReportWindow.collapseSections(_aCollpasedSections);
329*cdf0e10cSrcweir }
330*cdf0e10cSrcweir //------------------------------------------------------------------------------
331*cdf0e10cSrcweir long OScrollWindowHelper::Notify( NotifyEvent& rNEvt )
332*cdf0e10cSrcweir {
333*cdf0e10cSrcweir     const CommandEvent* pCommandEvent = rNEvt.GetCommandEvent();
334*cdf0e10cSrcweir     if ( pCommandEvent &&
335*cdf0e10cSrcweir         ( ((pCommandEvent->GetCommand() == COMMAND_WHEEL) ||
336*cdf0e10cSrcweir 		 (pCommandEvent->GetCommand() == COMMAND_STARTAUTOSCROLL) ||
337*cdf0e10cSrcweir 		 (pCommandEvent->GetCommand() == COMMAND_AUTOSCROLL))) )
338*cdf0e10cSrcweir 	{
339*cdf0e10cSrcweir 		ScrollBar* pHScrBar = NULL;
340*cdf0e10cSrcweir 		ScrollBar* pVScrBar = NULL;
341*cdf0e10cSrcweir 		if ( m_aHScroll.IsVisible() )
342*cdf0e10cSrcweir 			pHScrBar = &m_aHScroll;
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir 		if ( m_aVScroll.IsVisible() )
345*cdf0e10cSrcweir 			pVScrBar = &m_aVScroll;
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir 		if ( HandleScrollCommand( *pCommandEvent, pHScrBar, pVScrBar ) )
348*cdf0e10cSrcweir 			return 1L;
349*cdf0e10cSrcweir 	}
350*cdf0e10cSrcweir     return OScrollWindowHelper_BASE::Notify(rNEvt);
351*cdf0e10cSrcweir }
352*cdf0e10cSrcweir // -----------------------------------------------------------------------------
353*cdf0e10cSrcweir void OScrollWindowHelper::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects)
354*cdf0e10cSrcweir {
355*cdf0e10cSrcweir     m_aReportWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects);
356*cdf0e10cSrcweir }
357*cdf0e10cSrcweir //------------------------------------------------------------------------------
358*cdf0e10cSrcweir void OScrollWindowHelper::ImplInitSettings()
359*cdf0e10cSrcweir {
360*cdf0e10cSrcweir     SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ));
361*cdf0e10cSrcweir     // SetBackground( Wallpaper( COL_LIGHTRED ));
362*cdf0e10cSrcweir 	SetFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
363*cdf0e10cSrcweir 	SetTextFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
364*cdf0e10cSrcweir }
365*cdf0e10cSrcweir //-----------------------------------------------------------------------------
366*cdf0e10cSrcweir void OScrollWindowHelper::DataChanged( const DataChangedEvent& rDCEvt )
367*cdf0e10cSrcweir {
368*cdf0e10cSrcweir 	Window::DataChanged( rDCEvt );
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
371*cdf0e10cSrcweir 		 (rDCEvt.GetFlags() & SETTINGS_STYLE) )
372*cdf0e10cSrcweir 	{
373*cdf0e10cSrcweir 		ImplInitSettings();
374*cdf0e10cSrcweir 		Invalidate();
375*cdf0e10cSrcweir 	}
376*cdf0e10cSrcweir }
377*cdf0e10cSrcweir // -----------------------------------------------------------------------------
378*cdf0e10cSrcweir void OScrollWindowHelper::_propertyChanged(const beans::PropertyChangeEvent& /*_rEvent*/) throw( uno::RuntimeException)
379*cdf0e10cSrcweir {
380*cdf0e10cSrcweir     m_aReportWindow.notifySizeChanged();
381*cdf0e10cSrcweir }
382*cdf0e10cSrcweir // -----------------------------------------------------------------------------
383*cdf0e10cSrcweir void OScrollWindowHelper::setGridSnap(sal_Bool bOn)
384*cdf0e10cSrcweir {
385*cdf0e10cSrcweir     m_aReportWindow.setGridSnap(bOn);
386*cdf0e10cSrcweir }
387*cdf0e10cSrcweir // -----------------------------------------------------------------------------
388*cdf0e10cSrcweir void OScrollWindowHelper::setDragStripes(sal_Bool bOn)
389*cdf0e10cSrcweir {
390*cdf0e10cSrcweir     m_aReportWindow.setDragStripes(bOn);
391*cdf0e10cSrcweir }
392*cdf0e10cSrcweir // -----------------------------------------------------------------------------
393*cdf0e10cSrcweir sal_uInt32 OScrollWindowHelper::getMarkedObjectCount() const
394*cdf0e10cSrcweir {
395*cdf0e10cSrcweir     return m_aReportWindow.getMarkedObjectCount();
396*cdf0e10cSrcweir }
397*cdf0e10cSrcweir // -----------------------------------------------------------------------------
398*cdf0e10cSrcweir void OScrollWindowHelper::zoom(const Fraction& _aZoom)
399*cdf0e10cSrcweir {
400*cdf0e10cSrcweir     m_aReportWindow.zoom(_aZoom);
401*cdf0e10cSrcweir     Resize();
402*cdf0e10cSrcweir     Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_TRANSPARENT);
403*cdf0e10cSrcweir }
404*cdf0e10cSrcweir // -----------------------------------------------------------------------------
405*cdf0e10cSrcweir void OScrollWindowHelper::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
406*cdf0e10cSrcweir {
407*cdf0e10cSrcweir     m_aReportWindow.fillControlModelSelection(_rSelection);
408*cdf0e10cSrcweir }
409*cdf0e10cSrcweir // -----------------------------------------------------------------------------
410*cdf0e10cSrcweir sal_uInt16 OScrollWindowHelper::getZoomFactor(SvxZoomType _eType) const
411*cdf0e10cSrcweir {
412*cdf0e10cSrcweir     return m_aReportWindow.getZoomFactor(_eType);
413*cdf0e10cSrcweir }
414*cdf0e10cSrcweir //==============================================================================
415*cdf0e10cSrcweir } // rptui
416*cdf0e10cSrcweir //==============================================================================
417