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 "SectionWindow.hxx" 29*cdf0e10cSrcweir #include "ReportWindow.hxx" 30*cdf0e10cSrcweir #include "ReportRuler.hxx" 31*cdf0e10cSrcweir #include "rptui_slotid.hrc" 32*cdf0e10cSrcweir #include "ReportController.hxx" 33*cdf0e10cSrcweir #include "SectionView.hxx" 34*cdf0e10cSrcweir #include "RptDef.hxx" 35*cdf0e10cSrcweir #include "ReportSection.hxx" 36*cdf0e10cSrcweir #include "DesignView.hxx" 37*cdf0e10cSrcweir #include "uistrings.hrc" 38*cdf0e10cSrcweir #include "helpids.hrc" 39*cdf0e10cSrcweir #include "RptResId.hrc" 40*cdf0e10cSrcweir #include "StartMarker.hxx" 41*cdf0e10cSrcweir #include "EndMarker.hxx" 42*cdf0e10cSrcweir #include "ViewsWindow.hxx" 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir #include <svtools/colorcfg.hxx> 45*cdf0e10cSrcweir #include <boost/bind.hpp> 46*cdf0e10cSrcweir #include <functional> 47*cdf0e10cSrcweir #include <algorithm> 48*cdf0e10cSrcweir #include <vcl/svapp.hxx> 49*cdf0e10cSrcweir #include <connectivity/dbtools.hxx> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir namespace rptui 52*cdf0e10cSrcweir { 53*cdf0e10cSrcweir #define SECTION_OFFSET 3 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir using namespace ::com::sun::star; 56*cdf0e10cSrcweir using namespace ::comphelper; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir DBG_NAME( rpt_OSectionWindow ) 59*cdf0e10cSrcweir OSectionWindow::OSectionWindow( OViewsWindow* _pParent,const uno::Reference< report::XSection >& _xSection,const ::rtl::OUString& _sColorEntry) 60*cdf0e10cSrcweir : Window( _pParent,WB_DIALOGCONTROL) 61*cdf0e10cSrcweir ,OPropertyChangeListener(m_aMutex) 62*cdf0e10cSrcweir ,m_pParent(_pParent) 63*cdf0e10cSrcweir ,m_aStartMarker( this,_sColorEntry) 64*cdf0e10cSrcweir ,m_aReportSection( this,_xSection) 65*cdf0e10cSrcweir ,m_aSplitter(this) 66*cdf0e10cSrcweir ,m_aEndMarker( this,_sColorEntry) 67*cdf0e10cSrcweir { 68*cdf0e10cSrcweir DBG_CTOR( rpt_OSectionWindow,NULL); 69*cdf0e10cSrcweir SetUniqueId(UID_RPT_SECTIONSWINDOW); 70*cdf0e10cSrcweir const MapMode& rMapMode = _pParent->GetMapMode(); 71*cdf0e10cSrcweir SetMapMode( rMapMode ); 72*cdf0e10cSrcweir ImplInitSettings(); 73*cdf0e10cSrcweir // TRY 74*cdf0e10cSrcweir m_aSplitter.SetMapMode( MapMode( MAP_100TH_MM ) ); 75*cdf0e10cSrcweir m_aSplitter.SetStartSplitHdl(LINK(this, OSectionWindow,StartSplitHdl)); 76*cdf0e10cSrcweir m_aSplitter.SetSplitHdl(LINK(this, OSectionWindow,SplitHdl)); 77*cdf0e10cSrcweir m_aSplitter.SetEndSplitHdl(LINK(this, OSectionWindow,EndSplitHdl)); 78*cdf0e10cSrcweir m_aSplitter.SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() )); 79*cdf0e10cSrcweir m_aSplitter.SetSplitPosPixel(m_aSplitter.LogicToPixel(Size(0,_xSection->getHeight())).Height()); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir m_aStartMarker.setCollapsedHdl(LINK(this,OSectionWindow,Collapsed)); 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir m_aStartMarker.zoom(rMapMode.GetScaleX()); 85*cdf0e10cSrcweir setZoomFactor(rMapMode.GetScaleX(),m_aReportSection); 86*cdf0e10cSrcweir setZoomFactor(rMapMode.GetScaleX(),m_aSplitter); 87*cdf0e10cSrcweir setZoomFactor(rMapMode.GetScaleX(),m_aEndMarker); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir m_aSplitter.Show(); 90*cdf0e10cSrcweir m_aStartMarker.Show(); 91*cdf0e10cSrcweir m_aReportSection.Show(); 92*cdf0e10cSrcweir m_aEndMarker.Show(); 93*cdf0e10cSrcweir Show(); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir m_pSectionMulti = new OPropertyChangeMultiplexer(this,_xSection.get()); 96*cdf0e10cSrcweir m_pSectionMulti->addProperty(PROPERTY_NAME); 97*cdf0e10cSrcweir m_pSectionMulti->addProperty(PROPERTY_HEIGHT); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir beans::PropertyChangeEvent aEvent; 100*cdf0e10cSrcweir aEvent.Source = _xSection; 101*cdf0e10cSrcweir aEvent.PropertyName = PROPERTY_NAME; 102*cdf0e10cSrcweir uno::Reference< report::XGroup > xGroup(_xSection->getGroup()); 103*cdf0e10cSrcweir if ( xGroup.is() ) 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir m_pGroupMulti = new OPropertyChangeMultiplexer(this,xGroup.get()); 106*cdf0e10cSrcweir m_pGroupMulti->addProperty(PROPERTY_EXPRESSION); 107*cdf0e10cSrcweir aEvent.Source = xGroup; 108*cdf0e10cSrcweir aEvent.PropertyName = PROPERTY_EXPRESSION; 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir _propertyChanged(aEvent); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 114*cdf0e10cSrcweir OSectionWindow::~OSectionWindow() 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir DBG_DTOR( rpt_OSectionWindow,NULL); 117*cdf0e10cSrcweir try 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir if ( m_pSectionMulti.is() ) 120*cdf0e10cSrcweir m_pSectionMulti->dispose(); 121*cdf0e10cSrcweir if ( m_pGroupMulti.is() ) 122*cdf0e10cSrcweir m_pGroupMulti->dispose(); 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir catch (uno::Exception&) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 129*cdf0e10cSrcweir void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException) 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir const uno::Reference< report::XSection > xSection(_rEvent.Source,uno::UNO_QUERY); 132*cdf0e10cSrcweir if ( xSection.is() ) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir const uno::Reference< report::XSection> xCurrentSection = m_aReportSection.getSection(); 135*cdf0e10cSrcweir if ( _rEvent.PropertyName.equals(PROPERTY_HEIGHT) ) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir static bool t4 = true; 138*cdf0e10cSrcweir if ( t4 ) 139*cdf0e10cSrcweir m_pParent->getView()->SetUpdateMode(sal_False); 140*cdf0e10cSrcweir //Resize(); 141*cdf0e10cSrcweir m_pParent->getView()->notifySizeChanged(); 142*cdf0e10cSrcweir m_pParent->resize(*this); 143*cdf0e10cSrcweir if ( t4 ) 144*cdf0e10cSrcweir m_pParent->getView()->SetUpdateMode(sal_True); 145*cdf0e10cSrcweir // getViewsWindow()->getView()->getReportView()->getController().resetZoomType(); 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir else if ( _rEvent.PropertyName.equals(PROPERTY_NAME) && !xSection->getGroup().is() ) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir uno::Reference< report::XReportDefinition > xReport = xSection->getReportDefinition(); 150*cdf0e10cSrcweir if ( setReportSectionTitle(xReport,RID_STR_REPORT_HEADER,::std::mem_fun(&OReportHelper::getReportHeader),::std::mem_fun(&OReportHelper::getReportHeaderOn)) 151*cdf0e10cSrcweir || setReportSectionTitle(xReport,RID_STR_REPORT_FOOTER,::std::mem_fun(&OReportHelper::getReportFooter),::std::mem_fun(&OReportHelper::getReportFooterOn)) 152*cdf0e10cSrcweir || setReportSectionTitle(xReport,RID_STR_PAGE_HEADER,::std::mem_fun(&OReportHelper::getPageHeader),::std::mem_fun(&OReportHelper::getPageHeaderOn)) 153*cdf0e10cSrcweir || setReportSectionTitle(xReport,RID_STR_PAGE_FOOTER,::std::mem_fun(&OReportHelper::getPageFooter),::std::mem_fun(&OReportHelper::getPageFooterOn)) ) 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir m_aStartMarker.Invalidate(INVALIDATE_NOERASE); 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir else 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir String sTitle = String(ModuleRes(RID_STR_DETAIL)); 160*cdf0e10cSrcweir m_aStartMarker.setTitle(sTitle); 161*cdf0e10cSrcweir m_aStartMarker.Invalidate(INVALIDATE_CHILDREN); 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir } // if ( xSection.is() ) 165*cdf0e10cSrcweir else if ( _rEvent.PropertyName.equals(PROPERTY_EXPRESSION) ) 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir uno::Reference< report::XGroup > xGroup(_rEvent.Source,uno::UNO_QUERY); 168*cdf0e10cSrcweir if ( xGroup.is() && !setGroupSectionTitle(xGroup,RID_STR_HEADER,::std::mem_fun(&OGroupHelper::getHeader),::std::mem_fun(&OGroupHelper::getHeaderOn))) 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir setGroupSectionTitle(xGroup,RID_STR_FOOTER,::std::mem_fun(&OGroupHelper::getFooter),::std::mem_fun(&OGroupHelper::getFooterOn)); 171*cdf0e10cSrcweir } 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 175*cdf0e10cSrcweir bool OSectionWindow::setReportSectionTitle(const uno::Reference< report::XReportDefinition>& _xReport,sal_uInt16 _nResId,::std::mem_fun_t<uno::Reference<report::XSection> , OReportHelper> _pGetSection,::std::mem_fun_t<sal_Bool,OReportHelper> _pIsSectionOn) 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir OReportHelper aReportHelper(_xReport); 178*cdf0e10cSrcweir const bool bRet = _pIsSectionOn(&aReportHelper) && _pGetSection(&aReportHelper) == m_aReportSection.getSection(); 179*cdf0e10cSrcweir if ( bRet ) 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir String sTitle = String(ModuleRes(_nResId)); 182*cdf0e10cSrcweir m_aStartMarker.setTitle(sTitle); 183*cdf0e10cSrcweir m_aStartMarker.Invalidate(INVALIDATE_CHILDREN); 184*cdf0e10cSrcweir } // if ( bRet ) 185*cdf0e10cSrcweir return bRet; 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 188*cdf0e10cSrcweir bool OSectionWindow::setGroupSectionTitle(const uno::Reference< report::XGroup>& _xGroup,sal_uInt16 _nResId,::std::mem_fun_t<uno::Reference<report::XSection> , OGroupHelper> _pGetSection,::std::mem_fun_t<sal_Bool,OGroupHelper> _pIsSectionOn) 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir OGroupHelper aGroupHelper(_xGroup); 191*cdf0e10cSrcweir const bool bRet = _pIsSectionOn(&aGroupHelper) && _pGetSection(&aGroupHelper) == m_aReportSection.getSection() ; 192*cdf0e10cSrcweir if ( bRet ) 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir ::rtl::OUString sExpression = _xGroup->getExpression(); 195*cdf0e10cSrcweir ::rtl::OUString sLabel = getViewsWindow()->getView()->getReportView()->getController().getColumnLabel_throw(sExpression); 196*cdf0e10cSrcweir if ( sLabel.getLength() ) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir sExpression = sLabel; 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir String sTitle = String(ModuleRes(_nResId)); 202*cdf0e10cSrcweir sTitle.SearchAndReplace('#',sExpression); 203*cdf0e10cSrcweir m_aStartMarker.setTitle(sTitle); 204*cdf0e10cSrcweir m_aStartMarker.Invalidate(INVALIDATE_CHILDREN); 205*cdf0e10cSrcweir } // if ( _pIsSectionOn(&aGroupHelper) ) 206*cdf0e10cSrcweir return bRet; 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir //------------------------------------------------------------------------------ 209*cdf0e10cSrcweir void OSectionWindow::ImplInitSettings() 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir static bool t = false; 212*cdf0e10cSrcweir if ( t ) 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir EnableChildTransparentMode( sal_True ); 215*cdf0e10cSrcweir SetParentClipMode( PARENTCLIPMODE_NOCLIP ); 216*cdf0e10cSrcweir SetPaintTransparent( sal_True ); 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir SetBackground( ); 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir //----------------------------------------------------------------------------- 221*cdf0e10cSrcweir void OSectionWindow::DataChanged( const DataChangedEvent& rDCEvt ) 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir Window::DataChanged( rDCEvt ); 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 226*cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir ImplInitSettings(); 229*cdf0e10cSrcweir Invalidate(); 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir //------------------------------------------------------------------------------ 233*cdf0e10cSrcweir void OSectionWindow::Resize() 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir Window::Resize(); 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir Size aOutputSize = GetOutputSizePixel(); 238*cdf0e10cSrcweir Fraction aEndWidth(long(REPORT_ENDMARKER_WIDTH)); 239*cdf0e10cSrcweir aEndWidth *= GetMapMode().GetScaleX(); 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir const Point aThumbPos = m_pParent->getView()->getThumbPos(); 242*cdf0e10cSrcweir aOutputSize.Width() -= aThumbPos.X(); 243*cdf0e10cSrcweir aOutputSize.Height() -= m_aSplitter.GetSizePixel().Height(); 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir if ( m_aStartMarker.isCollapsed() ) 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir Point aPos(0,0); 248*cdf0e10cSrcweir m_aStartMarker.SetPosSizePixel(aPos,aOutputSize); 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir else 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir const bool bShowEndMarker = m_pParent->getView()->GetTotalWidth() <= (aThumbPos.X() + aOutputSize.Width() ); 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH)); 255*cdf0e10cSrcweir aStartWidth *= GetMapMode().GetScaleX(); 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir // set start marker 258*cdf0e10cSrcweir m_aStartMarker.SetPosSizePixel(Point(0,0),Size(aStartWidth,aOutputSize.Height())); 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir // set report section 261*cdf0e10cSrcweir const uno::Reference< report::XSection> xSection = m_aReportSection.getSection(); 262*cdf0e10cSrcweir Size aSectionSize = LogicToPixel( Size( 0,xSection->getHeight() ) ); 263*cdf0e10cSrcweir Point aReportPos(aStartWidth,0); 264*cdf0e10cSrcweir aSectionSize.Width() = aOutputSize.Width() - (long)aStartWidth; 265*cdf0e10cSrcweir if ( bShowEndMarker ) 266*cdf0e10cSrcweir aSectionSize.Width() -= (long)aEndWidth; 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir m_aReportSection.SetPosSizePixel(aReportPos,aSectionSize); 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir // set splitter 271*cdf0e10cSrcweir aReportPos.Y() += aSectionSize.Height(); 272*cdf0e10cSrcweir m_aSplitter.SetPosSizePixel(aReportPos,Size(aSectionSize.Width(),m_aSplitter.GetSizePixel().Height())); 273*cdf0e10cSrcweir aSectionSize.Height() = (long)(1000 * (double)GetMapMode().GetScaleY()); 274*cdf0e10cSrcweir m_aSplitter.SetDragRectPixel( Rectangle(Point(aStartWidth,0),aSectionSize)); 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir // set end marker 277*cdf0e10cSrcweir aReportPos.X() += aSectionSize.Width(); 278*cdf0e10cSrcweir aReportPos.Y() = 0; 279*cdf0e10cSrcweir m_aEndMarker.Show(bShowEndMarker); 280*cdf0e10cSrcweir m_aEndMarker.SetPosSizePixel(aReportPos,Size(aEndWidth,aOutputSize.Height())); 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 284*cdf0e10cSrcweir void OSectionWindow::setCollapsed(sal_Bool _bCollapsed) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir if ( m_aStartMarker.isCollapsed() != _bCollapsed ) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir m_aStartMarker.setCollapsed(_bCollapsed); 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir //----------------------------------------------------------------------------- 292*cdf0e10cSrcweir void OSectionWindow::showProperties() 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir m_pParent->getView()->showProperties( m_aReportSection.getSection().get() ); 295*cdf0e10cSrcweir } 296*cdf0e10cSrcweir //----------------------------------------------------------------------------- 297*cdf0e10cSrcweir void OSectionWindow::setMarked(sal_Bool _bMark) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir m_aStartMarker.setMarked(_bMark); 300*cdf0e10cSrcweir m_aEndMarker.setMarked(_bMark); 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 303*cdf0e10cSrcweir IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker ) 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir if ( _pMarker ) 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir sal_Bool bShow = !_pMarker->isCollapsed(); 308*cdf0e10cSrcweir m_aReportSection.Show(bShow); 309*cdf0e10cSrcweir m_aEndMarker.Show(bShow); 310*cdf0e10cSrcweir m_aSplitter.Show(bShow); 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir m_pParent->resize(*this); 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir return 0L; 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 317*cdf0e10cSrcweir void OSectionWindow::zoom(const Fraction& _aZoom) 318*cdf0e10cSrcweir { 319*cdf0e10cSrcweir setZoomFactor(_aZoom,*this); 320*cdf0e10cSrcweir m_aStartMarker.zoom(_aZoom); 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir setZoomFactor(_aZoom,m_aReportSection); 323*cdf0e10cSrcweir setZoomFactor(_aZoom,m_aSplitter); 324*cdf0e10cSrcweir setZoomFactor(_aZoom,m_aEndMarker); 325*cdf0e10cSrcweir //Resize(); 326*cdf0e10cSrcweir Invalidate(/*INVALIDATE_UPDATE |*/ /* | INVALIDATE_TRANSPARENT *//*INVALIDATE_NOCHILDREN*/); 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir //----------------------------------------------------------------------------- 329*cdf0e10cSrcweir IMPL_LINK( OSectionWindow, StartSplitHdl, Splitter*, ) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir const String sUndoAction( ModuleRes( RID_STR_UNDO_CHANGE_SIZE ) ); 332*cdf0e10cSrcweir getViewsWindow()->getView()->getReportView()->getController().getUndoManager().EnterListAction( sUndoAction, String() ); 333*cdf0e10cSrcweir return 0L; 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir //------------------------------------------------------------------------------ 336*cdf0e10cSrcweir IMPL_LINK( OSectionWindow, EndSplitHdl, Splitter*, ) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir getViewsWindow()->getView()->getReportView()->getController().getUndoManager().LeaveListAction(); 339*cdf0e10cSrcweir return 0L; 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir //----------------------------------------------------------------------------- 342*cdf0e10cSrcweir IMPL_LINK( OSectionWindow, SplitHdl, Splitter*, _pSplitter ) 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir if ( !getViewsWindow()->getView()->getReportView()->getController().isEditable() ) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir return 0L; 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir sal_Int32 nSplitPos = _pSplitter->GetSplitPosPixel(); 350*cdf0e10cSrcweir const Point aPos = _pSplitter->GetPosPixel(); 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir const uno::Reference< report::XSection> xSection = m_aReportSection.getSection(); 354*cdf0e10cSrcweir nSplitPos = m_aSplitter.PixelToLogic(Size(0,nSplitPos)).Height(); 355*cdf0e10cSrcweir // nSplitPos = xSection->getHeight() + m_aSplitter.PixelToLogic(Size(0,nSplitPos - aPos.Y() )).Height(); 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir const sal_Int32 nCount = xSection->getCount(); 358*cdf0e10cSrcweir for (sal_Int32 i = 0; i < nCount; ++i) 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir uno::Reference<report::XReportComponent> xReportComponent(xSection->getByIndex(i),uno::UNO_QUERY); 361*cdf0e10cSrcweir if ( xReportComponent.is() /*&& nSplitPos < (xReportComponent->getPositionY() + xReportComponent->getHeight())*/ ) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir nSplitPos = ::std::max(nSplitPos,xReportComponent->getPositionY() + xReportComponent->getHeight()); 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir } // for (sal_Int32 i = 0; i < nCount; ++i) 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir if ( nSplitPos < 0 ) 368*cdf0e10cSrcweir nSplitPos = 0; 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir xSection->setHeight(nSplitPos); 371*cdf0e10cSrcweir m_aSplitter.SetSplitPosPixel(m_aSplitter.LogicToPixel(Size(0,nSplitPos)).Height()); 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir return 0L; 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 376*cdf0e10cSrcweir void lcl_scroll(Window& _rWindow,const Point& _aDelta) 377*cdf0e10cSrcweir { 378*cdf0e10cSrcweir _rWindow.Scroll(-_aDelta.X(),-_aDelta.Y()/*,SCROLL_CHILDREN*//*|SCROLL_CLIP*/); 379*cdf0e10cSrcweir _rWindow.Invalidate(INVALIDATE_TRANSPARENT); 380*cdf0e10cSrcweir } 381*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 382*cdf0e10cSrcweir void lcl_setOrigin(Window& _rWindow,long _nX, long _nY) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir MapMode aMap = _rWindow.GetMapMode(); 385*cdf0e10cSrcweir aMap.SetOrigin( Point(- _nX, - _nY)); 386*cdf0e10cSrcweir _rWindow.SetMapMode( aMap ); 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir //---------------------------------------------------------------------------- 389*cdf0e10cSrcweir void OSectionWindow::scrollChildren(long _nX) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir const Point aDelta( _nX,0 ); 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir MapMode aMapMode( m_aReportSection.GetMapMode() ); 394*cdf0e10cSrcweir const Point aOld = aMapMode.GetOrigin(); 395*cdf0e10cSrcweir lcl_setOrigin(m_aReportSection,aDelta.X(), 0); 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir aMapMode = m_aReportSection.GetMapMode(); 398*cdf0e10cSrcweir const Point aNew = aMapMode.GetOrigin(); 399*cdf0e10cSrcweir const Point aDiff = aOld - aNew; 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir //OWindowPositionCorrector aCorrector(&m_aReportSection,-aDelta.Width(),0); 402*cdf0e10cSrcweir lcl_scroll(m_aReportSection,aDiff); 403*cdf0e10cSrcweir } 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir //lcl_setOrigin(m_aEndMarker,_nDeltaX, 0); 406*cdf0e10cSrcweir lcl_scroll(m_aEndMarker,m_aEndMarker.PixelToLogic(Point(_nX,0))); 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir lcl_setOrigin(m_aSplitter,_nX, 0); 409*cdf0e10cSrcweir lcl_scroll(m_aSplitter,aDiff); 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir //============================================================================== 412*cdf0e10cSrcweir } // rptui 413*cdf0e10cSrcweir //============================================================================== 414*cdf0e10cSrcweir 415