19e0e4191SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
39e0e4191SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
49e0e4191SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
59e0e4191SAndrew Rist  * distributed with this work for additional information
69e0e4191SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
79e0e4191SAndrew Rist  * to you under the Apache License, Version 2.0 (the
89e0e4191SAndrew Rist  * "License"); you may not use this file except in compliance
99e0e4191SAndrew Rist  * with the License.  You may obtain a copy of the License at
109e0e4191SAndrew Rist  *
119e0e4191SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
129e0e4191SAndrew Rist  *
139e0e4191SAndrew Rist  * Unless required by applicable law or agreed to in writing,
149e0e4191SAndrew Rist  * software distributed under the License is distributed on an
159e0e4191SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169e0e4191SAndrew Rist  * KIND, either express or implied.  See the License for the
179e0e4191SAndrew Rist  * specific language governing permissions and limitations
189e0e4191SAndrew Rist  * under the License.
199e0e4191SAndrew Rist  *
209e0e4191SAndrew Rist  *************************************************************/
219e0e4191SAndrew Rist 
229e0e4191SAndrew Rist 
23*b63233d8Sdamjan #include "precompiled_rptui.hxx"
24cdf0e10cSrcweir #include "ReportWindow.hxx"
25cdf0e10cSrcweir #include "ReportSection.hxx"
26cdf0e10cSrcweir #include "SectionView.hxx"
27cdf0e10cSrcweir #include "ViewsWindow.hxx"
28cdf0e10cSrcweir #include "ReportRuler.hxx"
29cdf0e10cSrcweir #include "DesignView.hxx"
30cdf0e10cSrcweir #include "UITools.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <tools/debug.hxx>
33cdf0e10cSrcweir #include <svtools/colorcfg.hxx>
34cdf0e10cSrcweir #include <svl/itempool.hxx>
35cdf0e10cSrcweir #include <unotools/syslocale.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include "RptDef.hxx"
38cdf0e10cSrcweir #include "dlgedfunc.hxx"
39cdf0e10cSrcweir #include "RptModel.hxx"
40cdf0e10cSrcweir #include "uistrings.hrc"
41cdf0e10cSrcweir #include "RptPage.hxx"
42cdf0e10cSrcweir #include "ReportController.hxx"
43cdf0e10cSrcweir #include "EndMarker.hxx"
44cdf0e10cSrcweir #include "ColorChanger.hxx"
45cdf0e10cSrcweir #include "ScrollHelper.hxx"
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include "helpids.hrc"
48cdf0e10cSrcweir #include "dlgedfac.hxx"
49cdf0e10cSrcweir #include <boost/bind.hpp>
50cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 
53cdf0e10cSrcweir #define SECTION_OFFSET	3
54cdf0e10cSrcweir namespace rptui
55cdf0e10cSrcweir {
56cdf0e10cSrcweir using namespace ::com::sun::star;
57cdf0e10cSrcweir using namespace ::comphelper;
58cdf0e10cSrcweir //==================================================================
59cdf0e10cSrcweir // class OReportWindow
60cdf0e10cSrcweir //==================================================================
DBG_NAME(rpt_OReportWindow)61cdf0e10cSrcweir DBG_NAME( rpt_OReportWindow )
62cdf0e10cSrcweir //------------------------------------------------------------------------------
63cdf0e10cSrcweir OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView)
64cdf0e10cSrcweir : Window(_pParent,WB_DIALOGCONTROL)
65cdf0e10cSrcweir , ::comphelper::OPropertyChangeListener(m_aMutex)
66cdf0e10cSrcweir ,m_aHRuler(this)
67cdf0e10cSrcweir ,m_pView(_pView)
68cdf0e10cSrcweir ,m_pParent(_pParent)
69cdf0e10cSrcweir ,m_aViewsWindow(this)
70cdf0e10cSrcweir ,m_pObjFac( new DlgEdFactory() )
71cdf0e10cSrcweir {
72cdf0e10cSrcweir 	DBG_CTOR( rpt_OReportWindow,NULL);
73cdf0e10cSrcweir 	SetHelpId(UID_RPT_REPORTWINDOW);
74cdf0e10cSrcweir 	SetMapMode( MapMode( MAP_100TH_MM ) );
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	m_aViewsWindow.Show();
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	m_aHRuler.Show();
79cdf0e10cSrcweir 	m_aHRuler.Activate();
80cdf0e10cSrcweir 	m_aHRuler.SetPagePos(0);
81cdf0e10cSrcweir 	m_aHRuler.SetBorders();
82cdf0e10cSrcweir 	m_aHRuler.SetIndents();
83cdf0e10cSrcweir 	m_aHRuler.SetMargin1();
84cdf0e10cSrcweir 	m_aHRuler.SetMargin2();
85cdf0e10cSrcweir     const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
86cdf0e10cSrcweir     m_aHRuler.SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH);
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	ImplInitSettings();
89cdf0e10cSrcweir     m_pReportListener = addStyleListener(_pView->getController().getReportDefinition(),this);
90cdf0e10cSrcweir }
91cdf0e10cSrcweir //------------------------------------------------------------------------------
~OReportWindow()92cdf0e10cSrcweir OReportWindow::~OReportWindow()
93cdf0e10cSrcweir {
94cdf0e10cSrcweir 	DBG_DTOR( rpt_OReportWindow,NULL);
95cdf0e10cSrcweir     if ( m_pReportListener.is() )
96cdf0e10cSrcweir 		m_pReportListener->dispose();
97cdf0e10cSrcweir }
98cdf0e10cSrcweir // -----------------------------------------------------------------------------
initialize()99cdf0e10cSrcweir void OReportWindow::initialize()
100cdf0e10cSrcweir {
101cdf0e10cSrcweir 	m_aViewsWindow.initialize();
102cdf0e10cSrcweir }
103cdf0e10cSrcweir //----------------------------------------------------------------------------
SetInsertObj(sal_uInt16 eObj,const::rtl::OUString & _sShapeType)104cdf0e10cSrcweir void OReportWindow::SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType )
105cdf0e10cSrcweir {
106cdf0e10cSrcweir 	m_aViewsWindow.SetInsertObj( eObj,_sShapeType);
107cdf0e10cSrcweir }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir //----------------------------------------------------------------------------
GetInsertObjString() const110cdf0e10cSrcweir rtl::OUString OReportWindow::GetInsertObjString() const
111cdf0e10cSrcweir {
112cdf0e10cSrcweir 	return m_aViewsWindow.GetInsertObjString();
113cdf0e10cSrcweir }
114cdf0e10cSrcweir //------------------------------------------------------------------------------
SetMode(DlgEdMode eNewMode)115cdf0e10cSrcweir void OReportWindow::SetMode( DlgEdMode eNewMode )
116cdf0e10cSrcweir {
117cdf0e10cSrcweir 	m_aViewsWindow.SetMode(eNewMode);
118cdf0e10cSrcweir }
119cdf0e10cSrcweir //----------------------------------------------------------------------------
removeSection(sal_uInt16 _nPosition)120cdf0e10cSrcweir void OReportWindow::removeSection(sal_uInt16 _nPosition)
121cdf0e10cSrcweir {
122cdf0e10cSrcweir 	m_aViewsWindow.removeSection(_nPosition);
123cdf0e10cSrcweir 	m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight());
124cdf0e10cSrcweir     m_aViewsWindow.Invalidate(INVALIDATE_TRANSPARENT);
125cdf0e10cSrcweir 	//Resize();
126cdf0e10cSrcweir }
127cdf0e10cSrcweir //----------------------------------------------------------------------------
addSection(const uno::Reference<report::XSection> & _xSection,const::rtl::OUString & _sColorEntry,sal_uInt16 _nPosition)128cdf0e10cSrcweir void OReportWindow::addSection(const uno::Reference< report::XSection >& _xSection,const ::rtl::OUString& _sColorEntry,sal_uInt16 _nPosition)
129cdf0e10cSrcweir {
130cdf0e10cSrcweir 	if ( !_xSection.is() )
131cdf0e10cSrcweir 		return;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	m_aViewsWindow.addSection(_xSection,_sColorEntry,_nPosition);
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 	m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight());
136cdf0e10cSrcweir }
137cdf0e10cSrcweir //------------------------------------------------------------------------------
toggleGrid(sal_Bool _bVisible)138cdf0e10cSrcweir void OReportWindow::toggleGrid(sal_Bool _bVisible)
139cdf0e10cSrcweir {
140cdf0e10cSrcweir 	m_aViewsWindow.toggleGrid(_bVisible);
141cdf0e10cSrcweir }
142cdf0e10cSrcweir //----------------------------------------------------------------------------
showRuler(sal_Bool _bShow)143cdf0e10cSrcweir void OReportWindow::showRuler(sal_Bool _bShow)
144cdf0e10cSrcweir {
145cdf0e10cSrcweir 	m_aHRuler.Show(_bShow);
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 	m_aViewsWindow.showRuler(_bShow);
148cdf0e10cSrcweir }
149cdf0e10cSrcweir //------------------------------------------------------------------------------
getMaxMarkerWidth(sal_Bool _bWithEnd) const150cdf0e10cSrcweir sal_Int32 OReportWindow::getMaxMarkerWidth(sal_Bool _bWithEnd) const
151cdf0e10cSrcweir {
152cdf0e10cSrcweir     Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
153cdf0e10cSrcweir     aStartWidth *= m_aViewsWindow.GetMapMode().GetScaleX();
154cdf0e10cSrcweir     if ( _bWithEnd )
155cdf0e10cSrcweir         aStartWidth += Fraction(long(REPORT_ENDMARKER_WIDTH));
156cdf0e10cSrcweir 	return sal_Int32((long)aStartWidth);
157cdf0e10cSrcweir }
158cdf0e10cSrcweir //------------------------------------------------------------------------------
GetTotalWidth() const159cdf0e10cSrcweir sal_Int32 OReportWindow::GetTotalWidth() const
160cdf0e10cSrcweir {
161cdf0e10cSrcweir 	sal_Int32 nWidth = 0;
162cdf0e10cSrcweir 	if ( !m_aViewsWindow.empty() )
163cdf0e10cSrcweir 	{
164cdf0e10cSrcweir         Fraction aStartWidth(long(REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH ));
165cdf0e10cSrcweir         const Fraction aZoom(m_pView->getController().getZoomValue(),100);
166cdf0e10cSrcweir         aStartWidth *= aZoom; // m_aViewsWindow.GetMapMode().GetScaleX();;
167cdf0e10cSrcweir 		const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_pView->getController().getReportDefinition(),PROPERTY_PAPERSIZE).Width;
168cdf0e10cSrcweir         Fraction aPaperWidth(nPaperWidth,1);
169cdf0e10cSrcweir         aPaperWidth *= aZoom;
170cdf0e10cSrcweir 		const Size aPageSize = LogicToPixel(Size(aPaperWidth,0));
171cdf0e10cSrcweir 		nWidth = aPageSize.Width() + long(aStartWidth);
172cdf0e10cSrcweir 	}
173cdf0e10cSrcweir 	return nWidth;
174cdf0e10cSrcweir }
175cdf0e10cSrcweir //------------------------------------------------------------------------------
Resize()176cdf0e10cSrcweir void OReportWindow::Resize()
177cdf0e10cSrcweir {
178cdf0e10cSrcweir 	Window::Resize();
179cdf0e10cSrcweir 	if ( !m_aViewsWindow.empty() )
180cdf0e10cSrcweir 	{
181cdf0e10cSrcweir 		const Size aTotalOutputSize = GetOutputSizePixel();
182cdf0e10cSrcweir         Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH)*m_pView->getController().getZoomValue(),100);
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 		const Point aOffset = LogicToPixel( Point( SECTION_OFFSET, 0 ), MAP_APPFONT );
185cdf0e10cSrcweir 		Point aStartPoint((long)aStartWidth + aOffset.X(),0);
186cdf0e10cSrcweir 		uno::Reference<report::XReportDefinition> xReportDefinition = getReportView()->getController().getReportDefinition();
187cdf0e10cSrcweir 		const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width;
188cdf0e10cSrcweir 		sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
189cdf0e10cSrcweir 		sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
190cdf0e10cSrcweir 		Size aPageSize  = m_aViewsWindow.LogicToPixel(Size(nPaperWidth ,0));
191cdf0e10cSrcweir 		nLeftMargin     = m_aViewsWindow.LogicToPixel(Size(nLeftMargin,0)).Width();
192cdf0e10cSrcweir 		nRightMargin    = m_aViewsWindow.LogicToPixel(Size(nRightMargin,0)).Width();
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 		aPageSize.Height() = m_aHRuler.GetSizePixel().Height();
195cdf0e10cSrcweir 
196cdf0e10cSrcweir         const long nTermp(m_aViewsWindow.getTotalHeight() + aPageSize.Height());
197cdf0e10cSrcweir 		long nSectionsHeight = ::std::max<long>(nTermp,aTotalOutputSize.Height());
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 		m_aHRuler.SetPosSizePixel(aStartPoint,aPageSize);
200cdf0e10cSrcweir 		m_aHRuler.SetNullOffset(nLeftMargin);
201cdf0e10cSrcweir 		m_aHRuler.SetMargin1(0);
202cdf0e10cSrcweir 		m_aHRuler.SetMargin2(aPageSize.Width() - nLeftMargin - nRightMargin);
203cdf0e10cSrcweir 
204cdf0e10cSrcweir 		aStartPoint.Y() += aPageSize.Height();
205cdf0e10cSrcweir 		nSectionsHeight -= aStartPoint.Y();
206cdf0e10cSrcweir 
207cdf0e10cSrcweir         aStartPoint.X() = aOffset.X();
208cdf0e10cSrcweir 
209cdf0e10cSrcweir         m_aViewsWindow.SetPosSizePixel(aStartPoint,Size(aTotalOutputSize.Width(),nSectionsHeight));
210cdf0e10cSrcweir 	}
211cdf0e10cSrcweir }
212cdf0e10cSrcweir //------------------------------------------------------------------------------
getThumbPos() const213cdf0e10cSrcweir Point OReportWindow::getThumbPos() const
214cdf0e10cSrcweir {
215cdf0e10cSrcweir 	return m_pParent->getThumbPos();
216cdf0e10cSrcweir }
217cdf0e10cSrcweir //------------------------------------------------------------------------------
ImplInitSettings()218cdf0e10cSrcweir void OReportWindow::ImplInitSettings()
219cdf0e10cSrcweir {
220cdf0e10cSrcweir 	SetBackground( );
221cdf0e10cSrcweir }
222cdf0e10cSrcweir //-----------------------------------------------------------------------------
DataChanged(const DataChangedEvent & rDCEvt)223cdf0e10cSrcweir void OReportWindow::DataChanged( const DataChangedEvent& rDCEvt )
224cdf0e10cSrcweir {
225cdf0e10cSrcweir 	Window::DataChanged( rDCEvt );
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
228cdf0e10cSrcweir 		 (rDCEvt.GetFlags() & SETTINGS_STYLE) )
229cdf0e10cSrcweir 	{
230cdf0e10cSrcweir 		ImplInitSettings();
231cdf0e10cSrcweir         Invalidate();
232cdf0e10cSrcweir 	}
233cdf0e10cSrcweir }
234cdf0e10cSrcweir //------------------------------------------------------------------------------
GetTotalHeight() const235cdf0e10cSrcweir sal_Int32 OReportWindow::GetTotalHeight() const
236cdf0e10cSrcweir {
237cdf0e10cSrcweir 	return m_aViewsWindow.getTotalHeight();
238cdf0e10cSrcweir }
239cdf0e10cSrcweir //------------------------------------------------------------------------------
ScrollChildren(const Point & _aThumbPos)240cdf0e10cSrcweir void OReportWindow::ScrollChildren(const Point& _aThumbPos)
241cdf0e10cSrcweir {
242cdf0e10cSrcweir     MapMode aMap = m_aHRuler.GetMapMode();
243cdf0e10cSrcweir     Point aOrg( aMap.GetOrigin() );
244cdf0e10cSrcweir     if ( aOrg.X() != (-_aThumbPos.X()) )
245cdf0e10cSrcweir     {
246cdf0e10cSrcweir         aMap.SetOrigin( Point(- _aThumbPos.X(), aOrg.Y()));
247cdf0e10cSrcweir         m_aHRuler.SetMapMode( aMap );
248cdf0e10cSrcweir         m_aHRuler.Scroll(-(aOrg.X() + _aThumbPos.X()),0);
249cdf0e10cSrcweir     }
250cdf0e10cSrcweir 
251cdf0e10cSrcweir     /*const Point aPos(PixelToLogic(_aThumbPos));*/
252cdf0e10cSrcweir     m_aViewsWindow.scrollChildren(_aThumbPos);
253cdf0e10cSrcweir }
254cdf0e10cSrcweir //----------------------------------------------------------------------------
getSectionCount() const255cdf0e10cSrcweir sal_uInt16 OReportWindow::getSectionCount() const
256cdf0e10cSrcweir {
257cdf0e10cSrcweir 	return m_aViewsWindow.getSectionCount();
258cdf0e10cSrcweir }
259cdf0e10cSrcweir //----------------------------------------------------------------------------
notifySizeChanged()260cdf0e10cSrcweir void OReportWindow::notifySizeChanged()
261cdf0e10cSrcweir {
262cdf0e10cSrcweir 	m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight());
263cdf0e10cSrcweir }
264cdf0e10cSrcweir //----------------------------------------------------------------------------
HasSelection() const265cdf0e10cSrcweir sal_Bool OReportWindow::HasSelection() const
266cdf0e10cSrcweir {
267cdf0e10cSrcweir 	return m_aViewsWindow.HasSelection();
268cdf0e10cSrcweir }
269cdf0e10cSrcweir //----------------------------------------------------------------------------
Delete()270cdf0e10cSrcweir void OReportWindow::Delete()
271cdf0e10cSrcweir {
272cdf0e10cSrcweir 
273cdf0e10cSrcweir 	m_aViewsWindow.Delete();
274cdf0e10cSrcweir }
275cdf0e10cSrcweir //----------------------------------------------------------------------------
Copy()276cdf0e10cSrcweir void OReportWindow::Copy()
277cdf0e10cSrcweir {
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 	m_aViewsWindow.Copy();
280cdf0e10cSrcweir }
281cdf0e10cSrcweir //----------------------------------------------------------------------------
Paste()282cdf0e10cSrcweir void OReportWindow::Paste()
283cdf0e10cSrcweir {
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 	m_aViewsWindow.Paste();
286cdf0e10cSrcweir }
287cdf0e10cSrcweir //----------------------------------------------------------------------------
IsPasteAllowed() const288cdf0e10cSrcweir sal_Bool OReportWindow::IsPasteAllowed() const
289cdf0e10cSrcweir {
290cdf0e10cSrcweir     return m_aViewsWindow.IsPasteAllowed();
291cdf0e10cSrcweir }
292cdf0e10cSrcweir //-----------------------------------------------------------------------------
SelectAll(const sal_uInt16 _nObjectType)293cdf0e10cSrcweir void OReportWindow::SelectAll(const sal_uInt16 _nObjectType)
294cdf0e10cSrcweir {
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	m_aViewsWindow.SelectAll(_nObjectType);
297cdf0e10cSrcweir }
298cdf0e10cSrcweir //-----------------------------------------------------------------------------
unmarkAllObjects(OSectionView * _pSectionView)299cdf0e10cSrcweir void OReportWindow::unmarkAllObjects(OSectionView* _pSectionView)
300cdf0e10cSrcweir {
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 	m_aViewsWindow.unmarkAllObjects(_pSectionView);
303cdf0e10cSrcweir }
304cdf0e10cSrcweir //-----------------------------------------------------------------------------
showProperties(const uno::Reference<report::XSection> & _xReportComponent)305cdf0e10cSrcweir void OReportWindow::showProperties(const uno::Reference< report::XSection>& _xReportComponent)
306cdf0e10cSrcweir {
307cdf0e10cSrcweir 	::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aViewsWindow.getSectionWindow( _xReportComponent );
308cdf0e10cSrcweir     m_pView->UpdatePropertyBrowserDelayed(pSectionWindow->getReportSection().getSectionView());
309cdf0e10cSrcweir }
310cdf0e10cSrcweir //------------------------------------------------------------------------------
handleKeyEvent(const KeyEvent & _rEvent)311cdf0e10cSrcweir sal_Bool OReportWindow::handleKeyEvent(const KeyEvent& _rEvent)
312cdf0e10cSrcweir {
313cdf0e10cSrcweir 	return m_aViewsWindow.handleKeyEvent(_rEvent);
314cdf0e10cSrcweir }
315cdf0e10cSrcweir //------------------------------------------------------------------------
setMarked(OSectionView * _pSectionView,sal_Bool _bMark)316cdf0e10cSrcweir void OReportWindow::setMarked(OSectionView* _pSectionView,sal_Bool _bMark)
317cdf0e10cSrcweir {
318cdf0e10cSrcweir 	if ( _pSectionView )
319cdf0e10cSrcweir 		m_aViewsWindow.setMarked(_pSectionView,_bMark);
320cdf0e10cSrcweir }
321cdf0e10cSrcweir //------------------------------------------------------------------------
setMarked(const uno::Reference<report::XSection> & _xSection,sal_Bool _bMark)322cdf0e10cSrcweir void OReportWindow::setMarked(const uno::Reference< report::XSection>& _xSection,sal_Bool _bMark)
323cdf0e10cSrcweir {
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 	m_aViewsWindow.setMarked(_xSection,_bMark);
326cdf0e10cSrcweir }
327cdf0e10cSrcweir //------------------------------------------------------------------------
setMarked(const uno::Sequence<uno::Reference<report::XReportComponent>> & _xShape,sal_Bool _bMark)328cdf0e10cSrcweir void OReportWindow::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _xShape,sal_Bool _bMark)
329cdf0e10cSrcweir {
330cdf0e10cSrcweir 
331cdf0e10cSrcweir 	m_aViewsWindow.setMarked(_xShape,_bMark);
332cdf0e10cSrcweir }
333cdf0e10cSrcweir //-----------------------------------------------------------------------------
getMarkedSection(NearSectionAccess nsa) const334cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> OReportWindow::getMarkedSection(NearSectionAccess nsa) const
335cdf0e10cSrcweir {
336cdf0e10cSrcweir 	return  m_aViewsWindow.getMarkedSection(nsa);
337cdf0e10cSrcweir }
338cdf0e10cSrcweir //-----------------------------------------------------------------------------
getSectionWindow(const::com::sun::star::uno::Reference<::com::sun::star::report::XSection> & _xSection) const339cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> OReportWindow::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
340cdf0e10cSrcweir {
341cdf0e10cSrcweir 	return  m_aViewsWindow.getSectionWindow(_xSection);
342cdf0e10cSrcweir }
343cdf0e10cSrcweir // -------------------------------------------------------------------------
markSection(const sal_uInt16 _nPos)344cdf0e10cSrcweir void OReportWindow::markSection(const sal_uInt16 _nPos)
345cdf0e10cSrcweir {
346cdf0e10cSrcweir 
347cdf0e10cSrcweir     m_aViewsWindow.markSection(_nPos);
348cdf0e10cSrcweir }
349cdf0e10cSrcweir // -----------------------------------------------------------------------------
fillCollapsedSections(::std::vector<sal_uInt16> & _rCollapsedPositions) const350cdf0e10cSrcweir void OReportWindow::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
351cdf0e10cSrcweir {
352cdf0e10cSrcweir 
353cdf0e10cSrcweir     m_aViewsWindow.fillCollapsedSections(_rCollapsedPositions);
354cdf0e10cSrcweir }
355cdf0e10cSrcweir // -----------------------------------------------------------------------------
collapseSections(const uno::Sequence<::com::sun::star::beans::PropertyValue> & _aCollpasedSections)356cdf0e10cSrcweir void OReportWindow::collapseSections(const uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections)
357cdf0e10cSrcweir {
358cdf0e10cSrcweir 
359cdf0e10cSrcweir     m_aViewsWindow.collapseSections(_aCollpasedSections);
360cdf0e10cSrcweir }
361cdf0e10cSrcweir // -----------------------------------------------------------------------------
alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection,bool bBoundRects)362cdf0e10cSrcweir void OReportWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects)
363cdf0e10cSrcweir {
364cdf0e10cSrcweir 
365cdf0e10cSrcweir     m_aViewsWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects);
366cdf0e10cSrcweir }
367cdf0e10cSrcweir // -----------------------------------------------------------------------------
setGridSnap(sal_Bool bOn)368cdf0e10cSrcweir void OReportWindow::setGridSnap(sal_Bool bOn)
369cdf0e10cSrcweir {
370cdf0e10cSrcweir 
371cdf0e10cSrcweir     m_aViewsWindow.setGridSnap(bOn);
372cdf0e10cSrcweir }
373cdf0e10cSrcweir // -----------------------------------------------------------------------------
setDragStripes(sal_Bool bOn)374cdf0e10cSrcweir void OReportWindow::setDragStripes(sal_Bool bOn)
375cdf0e10cSrcweir {
376cdf0e10cSrcweir     m_aViewsWindow.setDragStripes(bOn);
377cdf0e10cSrcweir }
378cdf0e10cSrcweir // -----------------------------------------------------------------------------
getMarkedObjectCount() const379cdf0e10cSrcweir sal_uInt32 OReportWindow::getMarkedObjectCount() const
380cdf0e10cSrcweir {
381cdf0e10cSrcweir     return m_aViewsWindow.getMarkedObjectCount();
382cdf0e10cSrcweir }
383cdf0e10cSrcweir // -----------------------------------------------------------------------------
zoom(const Fraction & _aZoom)384cdf0e10cSrcweir void OReportWindow::zoom(const Fraction& _aZoom)
385cdf0e10cSrcweir {
386cdf0e10cSrcweir     m_aHRuler.SetZoom(_aZoom);
387cdf0e10cSrcweir     m_aHRuler.Invalidate();
388cdf0e10cSrcweir 
389cdf0e10cSrcweir     //setZoomFactor(_aZoom,*this); // if this will be include the H - ruler has the wrong size
390cdf0e10cSrcweir     m_aViewsWindow.zoom(_aZoom);
391cdf0e10cSrcweir 
392cdf0e10cSrcweir     notifySizeChanged();
393cdf0e10cSrcweir     const Point aNewThumbPos( m_pParent->getThumbPos() );
394cdf0e10cSrcweir 
395cdf0e10cSrcweir     ScrollChildren( aNewThumbPos );
396cdf0e10cSrcweir     Resize();
397cdf0e10cSrcweir 
398cdf0e10cSrcweir     Invalidate(INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT);
399cdf0e10cSrcweir }
400cdf0e10cSrcweir // -----------------------------------------------------------------------------
fillControlModelSelection(::std::vector<uno::Reference<uno::XInterface>> & _rSelection) const401cdf0e10cSrcweir void OReportWindow::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
402cdf0e10cSrcweir {
403cdf0e10cSrcweir     m_aViewsWindow.fillControlModelSelection(_rSelection);
404cdf0e10cSrcweir }
405cdf0e10cSrcweir // -----------------------------------------------------------------------------
impl_getRealPixelWidth() const406cdf0e10cSrcweir sal_Int32 OReportWindow::impl_getRealPixelWidth() const
407cdf0e10cSrcweir {
408cdf0e10cSrcweir     const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_pView->getController().getReportDefinition(),PROPERTY_PAPERSIZE).Width;
409cdf0e10cSrcweir     MapMode aMap( MAP_100TH_MM );
410cdf0e10cSrcweir     const Size aPageSize = LogicToPixel(Size(nPaperWidth,0),aMap);
411cdf0e10cSrcweir     return aPageSize.Width() + REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH + SECTION_OFFSET;
412cdf0e10cSrcweir }
413cdf0e10cSrcweir // -----------------------------------------------------------------------------
getZoomFactor(SvxZoomType _eType) const414cdf0e10cSrcweir sal_uInt16 OReportWindow::getZoomFactor(SvxZoomType _eType) const
415cdf0e10cSrcweir {
416cdf0e10cSrcweir     sal_uInt16 nZoom(100);
417cdf0e10cSrcweir     const Size aSize( GetSizePixel() );
418cdf0e10cSrcweir     switch( _eType)
419cdf0e10cSrcweir     {
420cdf0e10cSrcweir         case SVX_ZOOM_PERCENT:
421cdf0e10cSrcweir             nZoom = m_pView->getController().getZoomValue();
422cdf0e10cSrcweir             break;
423cdf0e10cSrcweir         case SVX_ZOOM_OPTIMAL:
424cdf0e10cSrcweir             break;
425cdf0e10cSrcweir         case SVX_ZOOM_WHOLEPAGE:
426cdf0e10cSrcweir             {
427cdf0e10cSrcweir                 nZoom = (sal_uInt16)(long)Fraction(aSize.Width()*100,impl_getRealPixelWidth());
428cdf0e10cSrcweir                 MapMode aMap( MAP_100TH_MM );
429cdf0e10cSrcweir                 const Size aHeight = m_aViewsWindow.LogicToPixel(m_aViewsWindow.PixelToLogic(Size(0,GetTotalHeight() + m_aHRuler.GetSizePixel().Height())),aMap);
430cdf0e10cSrcweir                 nZoom = ::std::min(nZoom,(sal_uInt16)(long)Fraction(aSize.Height()*100,aHeight.Height()));
431cdf0e10cSrcweir             }
432cdf0e10cSrcweir             break;
433cdf0e10cSrcweir         case SVX_ZOOM_PAGEWIDTH:
434cdf0e10cSrcweir             nZoom = (sal_uInt16)(long)Fraction(aSize.Width()*100,impl_getRealPixelWidth());
435cdf0e10cSrcweir             break;
436cdf0e10cSrcweir         default:
437cdf0e10cSrcweir             break;
438cdf0e10cSrcweir     }
439cdf0e10cSrcweir 
440cdf0e10cSrcweir     return nZoom;
441cdf0e10cSrcweir }
442cdf0e10cSrcweir // -----------------------------------------------------------------------------
_propertyChanged(const beans::PropertyChangeEvent & _rEvent)443cdf0e10cSrcweir void OReportWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException)
444cdf0e10cSrcweir {
445cdf0e10cSrcweir     (void)_rEvent;
446cdf0e10cSrcweir     Resize();
447cdf0e10cSrcweir     m_aViewsWindow.Resize();
448cdf0e10cSrcweir     static sal_Int32 nIn = INVALIDATE_TRANSPARENT;
449cdf0e10cSrcweir     Invalidate(nIn);
450cdf0e10cSrcweir }
451cdf0e10cSrcweir //==================================================================
452cdf0e10cSrcweir }	//rptui
453cdf0e10cSrcweir //==================================================================
454cdf0e10cSrcweir 
455