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 29*cdf0e10cSrcweir #include "DesignView.hxx" 30*cdf0e10cSrcweir #include <tools/debug.hxx> 31*cdf0e10cSrcweir #include "ReportController.hxx" 32*cdf0e10cSrcweir #include <comphelper/types.hxx> 33*cdf0e10cSrcweir #include <unotools/syslocale.hxx> 34*cdf0e10cSrcweir #include <unotools/viewoptions.hxx> 35*cdf0e10cSrcweir #include "RptDef.hxx" 36*cdf0e10cSrcweir #include "UITools.hxx" 37*cdf0e10cSrcweir #include "RptObject.hxx" 38*cdf0e10cSrcweir #include "propbrw.hxx" 39*cdf0e10cSrcweir #include <toolkit/helper/convert.hxx> 40*cdf0e10cSrcweir #include "helpids.hrc" 41*cdf0e10cSrcweir #include "SectionView.hxx" 42*cdf0e10cSrcweir #include "ReportSection.hxx" 43*cdf0e10cSrcweir #include "rptui_slotid.hrc" 44*cdf0e10cSrcweir #include <svx/svxids.hrc> 45*cdf0e10cSrcweir #include "AddField.hxx" 46*cdf0e10cSrcweir #include "ScrollHelper.hxx" 47*cdf0e10cSrcweir #include "Navigator.hxx" 48*cdf0e10cSrcweir #include "SectionWindow.hxx" 49*cdf0e10cSrcweir #include "RptResId.hrc" 50*cdf0e10cSrcweir #include <vcl/svapp.hxx> 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir namespace rptui 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir using namespace ::dbaui; 55*cdf0e10cSrcweir using namespace ::utl; 56*cdf0e10cSrcweir using namespace ::com::sun::star; 57*cdf0e10cSrcweir using namespace uno; 58*cdf0e10cSrcweir using namespace lang; 59*cdf0e10cSrcweir using namespace beans; 60*cdf0e10cSrcweir using namespace container; 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir #define LINE_SIZE 50 63*cdf0e10cSrcweir #define START_SIZE_TASKPANE 30 64*cdf0e10cSrcweir #define COLSET_ID 1 65*cdf0e10cSrcweir #define REPORT_ID 2 66*cdf0e10cSrcweir #define TASKPANE_ID 3 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir class OTaskWindow : public Window 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir PropBrw* m_pPropWin; 71*cdf0e10cSrcweir public: 72*cdf0e10cSrcweir OTaskWindow(Window* _pParent) : Window(_pParent),m_pPropWin(NULL){} 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir inline void setPropertyBrowser(PropBrw* _pPropWin) 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir m_pPropWin = _pPropWin; 77*cdf0e10cSrcweir } 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir virtual void Resize() 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir const Size aSize = GetOutputSizePixel(); 82*cdf0e10cSrcweir if ( m_pPropWin && aSize.Height() && aSize.Width() ) 83*cdf0e10cSrcweir m_pPropWin->SetSizePixel(aSize); 84*cdf0e10cSrcweir } 85*cdf0e10cSrcweir long getMinimumWidth() const 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir long nRet = 0; 88*cdf0e10cSrcweir if ( m_pPropWin ) 89*cdf0e10cSrcweir nRet = m_pPropWin->getMinimumSize().Width(); 90*cdf0e10cSrcweir return nRet; 91*cdf0e10cSrcweir } 92*cdf0e10cSrcweir }; 93*cdf0e10cSrcweir class OwnSplitWindow : public SplitWindow 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir public: 96*cdf0e10cSrcweir OwnSplitWindow(Window* pParent) : SplitWindow(pParent,WB_DIALOGCONTROL){SetBackground( );} 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir virtual void Split() 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir SplitWindow::Split(); 101*cdf0e10cSrcweir setItemSizes(); 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir void setItemSizes() 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir const long nOutWidth = GetOutputSizePixel().Width(); 106*cdf0e10cSrcweir long nTaskPaneMinSplitSize = static_cast<OTaskWindow*>(GetItemWindow(TASKPANE_ID))->getMinimumWidth(); 107*cdf0e10cSrcweir nTaskPaneMinSplitSize = static_cast<long>(nTaskPaneMinSplitSize*100/nOutWidth); 108*cdf0e10cSrcweir if ( !nTaskPaneMinSplitSize ) 109*cdf0e10cSrcweir nTaskPaneMinSplitSize = START_SIZE_TASKPANE; 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir const long nReportMinSplitSize = static_cast<long>(12000/nOutWidth); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir long nReportSize = GetItemSize( REPORT_ID ); 114*cdf0e10cSrcweir long nTaskPaneSize = GetItemSize( TASKPANE_ID ); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir sal_Bool bMod = sal_False; 117*cdf0e10cSrcweir if( nReportSize < nReportMinSplitSize ) 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir nReportSize = nReportMinSplitSize; 120*cdf0e10cSrcweir nTaskPaneSize = 99 - nReportMinSplitSize; 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir bMod = sal_True; 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir else if( nTaskPaneSize < nTaskPaneMinSplitSize ) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir nTaskPaneSize = nTaskPaneMinSplitSize; 127*cdf0e10cSrcweir nReportSize = 99 - nTaskPaneMinSplitSize; 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir bMod = sal_True; 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir if( bMod ) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir SetItemSize( REPORT_ID, nReportSize ); 135*cdf0e10cSrcweir SetItemSize( TASKPANE_ID, nTaskPaneSize ); 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir }; 139*cdf0e10cSrcweir //================================================================== 140*cdf0e10cSrcweir // class ODesignView 141*cdf0e10cSrcweir //================================================================== 142*cdf0e10cSrcweir DBG_NAME( rpt_ODesignView ) 143*cdf0e10cSrcweir //------------------------------------------------------------------------------ 144*cdf0e10cSrcweir ODesignView::ODesignView( Window* pParent, 145*cdf0e10cSrcweir const Reference< XMultiServiceFactory >& _rxOrb, 146*cdf0e10cSrcweir OReportController& _rController) : 147*cdf0e10cSrcweir ODataView( pParent, _rController, _rxOrb, WB_DIALOGCONTROL ) 148*cdf0e10cSrcweir ,m_aSplitWin(this) 149*cdf0e10cSrcweir ,m_rReportController( _rController ) 150*cdf0e10cSrcweir ,m_aScrollWindow(this) 151*cdf0e10cSrcweir ,m_pPropWin(NULL) 152*cdf0e10cSrcweir ,m_pAddField(NULL) 153*cdf0e10cSrcweir ,m_pCurrentView(NULL) 154*cdf0e10cSrcweir ,m_pReportExplorer(NULL) 155*cdf0e10cSrcweir ,m_eMode( RPTUI_SELECT ) 156*cdf0e10cSrcweir ,m_nCurrentPosition(USHRT_MAX) 157*cdf0e10cSrcweir ,m_eActObj( OBJ_NONE ) 158*cdf0e10cSrcweir ,m_bFirstDraw(sal_False) 159*cdf0e10cSrcweir ,m_aGridSizeCoarse( 1000, 1000 ) // #i93595# 100TH_MM changed to grid using coarse 1 cm grid 160*cdf0e10cSrcweir ,m_aGridSizeFine( 250, 250 ) // and a 0,25 cm subdivision for better visualisation 161*cdf0e10cSrcweir ,m_bGridVisible(sal_True) 162*cdf0e10cSrcweir ,m_bGridSnap(sal_True) 163*cdf0e10cSrcweir ,m_bDeleted( sal_False ) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir DBG_CTOR( rpt_ODesignView,NULL); 166*cdf0e10cSrcweir SetHelpId(UID_RPT_RPT_APP_VIEW); 167*cdf0e10cSrcweir ImplInitSettings(); 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir SetMapMode( MapMode( MAP_100TH_MM ) ); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir // now create the task pane on the right side :-) 172*cdf0e10cSrcweir m_pTaskPane = new OTaskWindow(this); 173*cdf0e10cSrcweir //m_pTaskPane->Show(); 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir m_aSplitWin.InsertItem( COLSET_ID,100,SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE | SWIB_COLSET ); 176*cdf0e10cSrcweir m_aSplitWin.InsertItem( REPORT_ID, &m_aScrollWindow, 100/*m_aScrollWindow.getMaxMarkerWidth(sal_False)*/, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE /*SWIB_COLSET*/); 177*cdf0e10cSrcweir //m_aSplitWin.InsertItem( TASKPANE_ID, m_pTaskPane, 50, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE ); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir // Splitter einrichten 180*cdf0e10cSrcweir //m_aSplitter.SetSplitHdl(LINK(this, ODesignView,SplitHdl)); 181*cdf0e10cSrcweir m_aSplitWin.SetSplitHdl(LINK(this, ODesignView,SplitHdl)); 182*cdf0e10cSrcweir m_aSplitWin.ShowAutoHideButton(); 183*cdf0e10cSrcweir m_aSplitWin.SetAlign(WINDOWALIGN_LEFT); 184*cdf0e10cSrcweir m_aSplitWin.Show(); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir m_aMarkTimer.SetTimeout( 100 ); 187*cdf0e10cSrcweir m_aMarkTimer.SetTimeoutHdl( LINK( this, ODesignView, MarkTimeout ) ); 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir //------------------------------------------------------------------------------ 191*cdf0e10cSrcweir ODesignView::~ODesignView() 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir DBG_DTOR( rpt_ODesignView,NULL); 194*cdf0e10cSrcweir m_bDeleted = sal_True; 195*cdf0e10cSrcweir Hide(); 196*cdf0e10cSrcweir m_aScrollWindow.Hide(); 197*cdf0e10cSrcweir m_aMarkTimer.Stop(); 198*cdf0e10cSrcweir if ( m_pPropWin ) 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); 201*cdf0e10cSrcweir ::std::auto_ptr<Window> aTemp2(m_pPropWin); 202*cdf0e10cSrcweir m_pPropWin = NULL; 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir if ( m_pAddField ) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromAscii( UID_RPT_RPT_APP_VIEW ) ); 207*cdf0e10cSrcweir aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pAddField->GetWindowState(WINDOWSTATE_MASK_ALL).GetBuffer() ) ); 208*cdf0e10cSrcweir notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); 209*cdf0e10cSrcweir ::std::auto_ptr<Window> aTemp2(m_pAddField); 210*cdf0e10cSrcweir m_pAddField = NULL; 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir if ( m_pReportExplorer ) 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_NAVIGATOR ) ); 215*cdf0e10cSrcweir aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pReportExplorer->GetWindowState(WINDOWSTATE_MASK_ALL).GetBuffer() ) ); 216*cdf0e10cSrcweir notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); 217*cdf0e10cSrcweir ::std::auto_ptr<Window> aTemp2(m_pReportExplorer); 218*cdf0e10cSrcweir m_pReportExplorer = NULL; 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir ::std::auto_ptr<Window> aTemp2(m_pTaskPane); 222*cdf0e10cSrcweir m_pTaskPane = NULL; 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 226*cdf0e10cSrcweir void ODesignView::initialize() 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir SetMapMode( MapMode( MAP_100TH_MM ) ); 229*cdf0e10cSrcweir m_aScrollWindow.initialize(); 230*cdf0e10cSrcweir m_aScrollWindow.Show(); 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir //----------------------------------------------------------------------------- 233*cdf0e10cSrcweir void ODesignView::DataChanged( const DataChangedEvent& rDCEvt ) 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir ODataView::DataChanged( rDCEvt ); 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 238*cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir ImplInitSettings(); 241*cdf0e10cSrcweir Invalidate(); 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir //------------------------------------------------------------------------------ 245*cdf0e10cSrcweir long ODesignView::PreNotify( NotifyEvent& rNEvt ) 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir long nRet = ODataView::PreNotify(rNEvt); // 1 := has to be handled here 248*cdf0e10cSrcweir switch(rNEvt.GetType()) 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir case EVENT_KEYINPUT: 251*cdf0e10cSrcweir if ( (m_pPropWin && m_pPropWin->HasChildPathFocus()) ) 252*cdf0e10cSrcweir return 0L; 253*cdf0e10cSrcweir if ( (m_pAddField && m_pAddField->HasChildPathFocus()) ) 254*cdf0e10cSrcweir return 0L; 255*cdf0e10cSrcweir if ( (m_pReportExplorer && m_pReportExplorer->HasChildPathFocus()) ) 256*cdf0e10cSrcweir return 0L; 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); 259*cdf0e10cSrcweir if ( handleKeyEvent(*pKeyEvent) ) 260*cdf0e10cSrcweir nRet = 1L; 261*cdf0e10cSrcweir else if ( nRet == 1L && m_pAccel.get() ) 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir const KeyCode& rCode = pKeyEvent->GetKeyCode(); 264*cdf0e10cSrcweir util::URL aUrl; 265*cdf0e10cSrcweir aUrl.Complete = m_pAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rCode)); 266*cdf0e10cSrcweir if ( !aUrl.Complete.getLength() || !m_rController.isCommandEnabled( aUrl.Complete ) ) 267*cdf0e10cSrcweir nRet = 0L; 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir break; 271*cdf0e10cSrcweir default: 272*cdf0e10cSrcweir break; 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir return nRet; 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir //------------------------------------------------------------------------------ 278*cdf0e10cSrcweir void ODesignView::resizeDocumentView(Rectangle& _rPlayground) 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir if ( !_rPlayground.IsEmpty() ) 281*cdf0e10cSrcweir { 282*cdf0e10cSrcweir const Size aPlaygroundSize( _rPlayground.GetSize() ); 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir // calc the split pos, and forward it to the controller 285*cdf0e10cSrcweir sal_Int32 nSplitPos = getController().getSplitPos(); 286*cdf0e10cSrcweir if ( 0 != aPlaygroundSize.Width() ) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir if ( ( -1 == nSplitPos ) 289*cdf0e10cSrcweir || ( nSplitPos >= aPlaygroundSize.Width() ) 290*cdf0e10cSrcweir ) 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir long nMinWidth = static_cast<long>(0.1*aPlaygroundSize.Width()); 293*cdf0e10cSrcweir if ( m_pPropWin && m_pPropWin->IsVisible() ) 294*cdf0e10cSrcweir nMinWidth = m_pPropWin->GetMinOutputSizePixel().Width(); 295*cdf0e10cSrcweir nSplitPos = static_cast<sal_Int32>(_rPlayground.Right() - nMinWidth); 296*cdf0e10cSrcweir getController().setSplitPos(nSplitPos); 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir } // if ( 0 != _rPlaygroundSize.Width() ) 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir Size aReportWindowSize(aPlaygroundSize); 301*cdf0e10cSrcweir if ( m_aSplitWin.IsItemValid(TASKPANE_ID) ) 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir // normalize the split pos 304*cdf0e10cSrcweir const long nSplitterWidth = GetSettings().GetStyleSettings().GetSplitSize(); 305*cdf0e10cSrcweir Point aTaskPanePos(nSplitPos + nSplitterWidth, _rPlayground.Top()); 306*cdf0e10cSrcweir if ( m_pTaskPane && m_pTaskPane->IsVisible() ) 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir aTaskPanePos.X() = aPlaygroundSize.Width() - m_pTaskPane->GetSizePixel().Width(); 309*cdf0e10cSrcweir sal_Int32 nMinWidth = m_pPropWin->getMinimumSize().Width(); 310*cdf0e10cSrcweir if ( nMinWidth > (aPlaygroundSize.Width() - aTaskPanePos.X()) ) 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir aTaskPanePos.X() = aPlaygroundSize.Width() - nMinWidth; 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir nSplitPos = aTaskPanePos.X() - nSplitterWidth; 315*cdf0e10cSrcweir getController().setSplitPos(nSplitPos); 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir const long nTaskPaneSize = static_cast<long>((aPlaygroundSize.Width() - aTaskPanePos.X())*100/aPlaygroundSize.Width()); 318*cdf0e10cSrcweir if ( m_aSplitWin.GetItemSize( TASKPANE_ID ) != nTaskPaneSize ) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir m_aSplitWin.SetItemSize( REPORT_ID, 99 - nTaskPaneSize ); 321*cdf0e10cSrcweir m_aSplitWin.SetItemSize( TASKPANE_ID, nTaskPaneSize ); 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir // set the size of the report window 326*cdf0e10cSrcweir m_aSplitWin.SetPosSizePixel( _rPlayground.TopLeft(),aPlaygroundSize ); 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir // just for completeness: there is no space left, we occupied it all ... 329*cdf0e10cSrcweir _rPlayground.SetPos( _rPlayground.BottomRight() ); 330*cdf0e10cSrcweir _rPlayground.SetSize( Size( 0, 0 ) ); 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 334*cdf0e10cSrcweir // set the view readonly or not 335*cdf0e10cSrcweir void ODesignView::setReadOnly(sal_Bool /*_bReadOnly*/) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir //---------------------------------------------------------------------------- 339*cdf0e10cSrcweir IMPL_LINK( ODesignView, MarkTimeout, Timer *, EMPTYARG ) 340*cdf0e10cSrcweir { 341*cdf0e10cSrcweir if ( m_pPropWin && m_pPropWin->IsVisible() ) 342*cdf0e10cSrcweir { 343*cdf0e10cSrcweir m_pPropWin->Update(m_pCurrentView); 344*cdf0e10cSrcweir uno::Reference<beans::XPropertySet> xProp(m_xReportComponent,uno::UNO_QUERY); 345*cdf0e10cSrcweir if ( xProp.is() ) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir m_pPropWin->Update(xProp); 348*cdf0e10cSrcweir static_cast<OTaskWindow*>(m_pTaskPane)->Resize(); 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir Resize(); 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir return 0; 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir //---------------------------------------------------------------------------- 357*cdf0e10cSrcweir void ODesignView::SetMode( DlgEdMode _eNewMode ) 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir m_eMode = _eNewMode; 360*cdf0e10cSrcweir if ( m_eMode == RPTUI_SELECT ) 361*cdf0e10cSrcweir m_eActObj = OBJ_NONE; 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir m_aScrollWindow.SetMode(_eNewMode); 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir //---------------------------------------------------------------------------- 366*cdf0e10cSrcweir void ODesignView::SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType ) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir m_eActObj = eObj; 369*cdf0e10cSrcweir m_aScrollWindow.SetInsertObj( eObj,_sShapeType ); 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir //---------------------------------------------------------------------------- 372*cdf0e10cSrcweir rtl::OUString ODesignView::GetInsertObjString() const 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir return m_aScrollWindow.GetInsertObjString(); 375*cdf0e10cSrcweir } 376*cdf0e10cSrcweir //---------------------------------------------------------------------------- 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir sal_uInt16 ODesignView::GetInsertObj() const 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir return m_eActObj; 381*cdf0e10cSrcweir } 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir //---------------------------------------------------------------------------- 384*cdf0e10cSrcweir void ODesignView::Cut() 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir Copy(); 387*cdf0e10cSrcweir Delete(); 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir //---------------------------------------------------------------------------- 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir void ODesignView::Copy() 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir m_aScrollWindow.Copy(); 395*cdf0e10cSrcweir } 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir //---------------------------------------------------------------------------- 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir void ODesignView::Paste() 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir m_aScrollWindow.Paste(); 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir //---------------------------------------------------------------------------- 404*cdf0e10cSrcweir void ODesignView::Delete() 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir m_aScrollWindow.Delete(); 407*cdf0e10cSrcweir } 408*cdf0e10cSrcweir //---------------------------------------------------------------------------- 409*cdf0e10cSrcweir sal_Bool ODesignView::HasSelection() const 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir return m_aScrollWindow.HasSelection(); 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir //---------------------------------------------------------------------------- 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir sal_Bool ODesignView::IsPasteAllowed() const 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir return m_aScrollWindow.IsPasteAllowed(); 418*cdf0e10cSrcweir } 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir //---------------------------------------------------------------------------- 421*cdf0e10cSrcweir void ODesignView::UpdatePropertyBrowserDelayed(OSectionView& _rView) 422*cdf0e10cSrcweir { 423*cdf0e10cSrcweir if ( m_pCurrentView != &_rView ) 424*cdf0e10cSrcweir { 425*cdf0e10cSrcweir if ( m_pCurrentView ) 426*cdf0e10cSrcweir m_aScrollWindow.setMarked(m_pCurrentView,sal_False); 427*cdf0e10cSrcweir m_pCurrentView = &_rView; 428*cdf0e10cSrcweir if ( m_pCurrentView ) 429*cdf0e10cSrcweir m_aScrollWindow.setMarked(m_pCurrentView,sal_True); 430*cdf0e10cSrcweir m_xReportComponent.clear(); 431*cdf0e10cSrcweir DlgEdHint aHint( RPTUI_HINT_SELECTIONCHANGED ); 432*cdf0e10cSrcweir Broadcast( aHint ); 433*cdf0e10cSrcweir } 434*cdf0e10cSrcweir m_aMarkTimer.Start(); 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir //---------------------------------------------------------------------------- 438*cdf0e10cSrcweir void ODesignView::toggleGrid(sal_Bool _bGridVisible) 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir m_aScrollWindow.toggleGrid(_bGridVisible); 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir //---------------------------------------------------------------------------- 443*cdf0e10cSrcweir sal_uInt16 ODesignView::getSectionCount() const 444*cdf0e10cSrcweir { 445*cdf0e10cSrcweir return m_aScrollWindow.getSectionCount(); 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir //---------------------------------------------------------------------------- 448*cdf0e10cSrcweir void ODesignView::showRuler(sal_Bool _bShow) 449*cdf0e10cSrcweir { 450*cdf0e10cSrcweir m_aScrollWindow.showRuler(_bShow); 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir //---------------------------------------------------------------------------- 453*cdf0e10cSrcweir void ODesignView::removeSection(sal_uInt16 _nPosition) 454*cdf0e10cSrcweir { 455*cdf0e10cSrcweir m_aScrollWindow.removeSection(_nPosition); 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir //---------------------------------------------------------------------------- 458*cdf0e10cSrcweir void ODesignView::addSection(const uno::Reference< report::XSection >& _xSection,const ::rtl::OUString& _sColorEntry,sal_uInt16 _nPosition) 459*cdf0e10cSrcweir { 460*cdf0e10cSrcweir m_aScrollWindow.addSection(_xSection,_sColorEntry,_nPosition); 461*cdf0e10cSrcweir } 462*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 463*cdf0e10cSrcweir void ODesignView::GetFocus() 464*cdf0e10cSrcweir { 465*cdf0e10cSrcweir Window::GetFocus(); 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir if ( !m_bDeleted ) 468*cdf0e10cSrcweir { 469*cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aScrollWindow.getMarkedSection(); 470*cdf0e10cSrcweir if ( pSectionWindow ) 471*cdf0e10cSrcweir pSectionWindow->GrabFocus(); 472*cdf0e10cSrcweir } 473*cdf0e10cSrcweir } 474*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 475*cdf0e10cSrcweir void ODesignView::ImplInitSettings() 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir //#if OSL_DEBUG_LEVEL > 0 478*cdf0e10cSrcweir // SetBackground( Wallpaper( COL_RED )); 479*cdf0e10cSrcweir //#else 480*cdf0e10cSrcweir SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() )); 481*cdf0e10cSrcweir //#endif 482*cdf0e10cSrcweir SetFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() ); 483*cdf0e10cSrcweir SetTextFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() ); 484*cdf0e10cSrcweir } 485*cdf0e10cSrcweir //----------------------------------------------------------------------------- 486*cdf0e10cSrcweir IMPL_LINK( ODesignView, SplitHdl, void*, ) 487*cdf0e10cSrcweir { 488*cdf0e10cSrcweir const Size aOutputSize = GetOutputSizePixel(); 489*cdf0e10cSrcweir const long nTest = aOutputSize.Width() * m_aSplitWin.GetItemSize(TASKPANE_ID) / 100; 490*cdf0e10cSrcweir long nMinWidth = static_cast<long>(0.1*aOutputSize.Width()); 491*cdf0e10cSrcweir if ( m_pPropWin && m_pPropWin->IsVisible() ) 492*cdf0e10cSrcweir nMinWidth = m_pPropWin->GetMinOutputSizePixel().Width(); 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir if ( (aOutputSize.Width() - nTest) >= nMinWidth && nTest > m_aScrollWindow.getMaxMarkerWidth(sal_False) ) 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir long nOldSplitPos = getController().getSplitPos(); 497*cdf0e10cSrcweir (void)nOldSplitPos; 498*cdf0e10cSrcweir getController().setSplitPos(nTest); 499*cdf0e10cSrcweir } 500*cdf0e10cSrcweir 501*cdf0e10cSrcweir return 0L; 502*cdf0e10cSrcweir } 503*cdf0e10cSrcweir //----------------------------------------------------------------------------- 504*cdf0e10cSrcweir void ODesignView::SelectAll(const sal_uInt16 _nObjectType) 505*cdf0e10cSrcweir { 506*cdf0e10cSrcweir m_aScrollWindow.SelectAll(_nObjectType); 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir //----------------------------------------------------------------------------- 509*cdf0e10cSrcweir void ODesignView::unmarkAllObjects(OSectionView* _pSectionView) 510*cdf0e10cSrcweir { 511*cdf0e10cSrcweir m_aScrollWindow.unmarkAllObjects(_pSectionView); 512*cdf0e10cSrcweir } 513*cdf0e10cSrcweir //----------------------------------------------------------------------------- 514*cdf0e10cSrcweir void ODesignView::togglePropertyBrowser(sal_Bool _bToogleOn) 515*cdf0e10cSrcweir { 516*cdf0e10cSrcweir if ( !m_pPropWin && _bToogleOn ) 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir m_pPropWin = new PropBrw(getController().getORB(),m_pTaskPane,this); 519*cdf0e10cSrcweir m_pPropWin->Invalidate(); 520*cdf0e10cSrcweir static_cast<OTaskWindow*>(m_pTaskPane)->setPropertyBrowser(m_pPropWin); 521*cdf0e10cSrcweir notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::AddWindow)); 522*cdf0e10cSrcweir } 523*cdf0e10cSrcweir if ( m_pPropWin && _bToogleOn != m_pPropWin->IsVisible() ) 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir if ( !m_pCurrentView && !m_xReportComponent.is() ) 526*cdf0e10cSrcweir m_xReportComponent = getController().getReportDefinition(); 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir const sal_Bool bWillBeVisible = _bToogleOn; 529*cdf0e10cSrcweir m_pPropWin->Show(bWillBeVisible); 530*cdf0e10cSrcweir m_pTaskPane->Show(bWillBeVisible); 531*cdf0e10cSrcweir m_pTaskPane->Invalidate(); 532*cdf0e10cSrcweir 533*cdf0e10cSrcweir if ( bWillBeVisible ) 534*cdf0e10cSrcweir m_aSplitWin.InsertItem( TASKPANE_ID, m_pTaskPane,START_SIZE_TASKPANE, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE/*|SWIB_COLSET */); 535*cdf0e10cSrcweir else 536*cdf0e10cSrcweir m_aSplitWin.RemoveItem(TASKPANE_ID); 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir // TRY 539*cdf0e10cSrcweir // Invalidate(/*INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE*/); 540*cdf0e10cSrcweir if ( bWillBeVisible ) 541*cdf0e10cSrcweir m_aMarkTimer.Start(); 542*cdf0e10cSrcweir } 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir //----------------------------------------------------------------------------- 545*cdf0e10cSrcweir void ODesignView::showProperties(const uno::Reference< uno::XInterface>& _xReportComponent) 546*cdf0e10cSrcweir { 547*cdf0e10cSrcweir if ( m_xReportComponent != _xReportComponent ) 548*cdf0e10cSrcweir { 549*cdf0e10cSrcweir m_xReportComponent = _xReportComponent; 550*cdf0e10cSrcweir if ( m_pCurrentView ) 551*cdf0e10cSrcweir m_aScrollWindow.setMarked(m_pCurrentView,sal_False); 552*cdf0e10cSrcweir m_pCurrentView = NULL; 553*cdf0e10cSrcweir m_aMarkTimer.Start(); 554*cdf0e10cSrcweir } 555*cdf0e10cSrcweir } 556*cdf0e10cSrcweir //----------------------------------------------------------------------------- 557*cdf0e10cSrcweir sal_Bool ODesignView::isReportExplorerVisible() const 558*cdf0e10cSrcweir { 559*cdf0e10cSrcweir return m_pReportExplorer && m_pReportExplorer->IsVisible(); 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir //----------------------------------------------------------------------------- 562*cdf0e10cSrcweir void ODesignView::toggleReportExplorer() 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir if ( !m_pReportExplorer ) 565*cdf0e10cSrcweir { 566*cdf0e10cSrcweir OReportController& rReportController = getController(); 567*cdf0e10cSrcweir m_pReportExplorer = new ONavigator(this,rReportController); 568*cdf0e10cSrcweir SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_NAVIGATOR ) ); 569*cdf0e10cSrcweir if ( aDlgOpt.Exists() ) 570*cdf0e10cSrcweir m_pReportExplorer->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) ); 571*cdf0e10cSrcweir m_pReportExplorer->AddEventListener(LINK(&rReportController,OReportController,EventLstHdl)); 572*cdf0e10cSrcweir notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::AddWindow)); 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir else 575*cdf0e10cSrcweir m_pReportExplorer->Show(!m_pReportExplorer->IsVisible()); 576*cdf0e10cSrcweir } 577*cdf0e10cSrcweir //----------------------------------------------------------------------------- 578*cdf0e10cSrcweir sal_Bool ODesignView::isAddFieldVisible() const 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir return m_pAddField && m_pAddField->IsVisible(); 581*cdf0e10cSrcweir } 582*cdf0e10cSrcweir //----------------------------------------------------------------------------- 583*cdf0e10cSrcweir void ODesignView::toggleAddField() 584*cdf0e10cSrcweir { 585*cdf0e10cSrcweir if ( !m_pAddField ) 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir uno::Reference< report::XReportDefinition > xReport(m_xReportComponent,uno::UNO_QUERY); 588*cdf0e10cSrcweir uno::Reference< report::XReportComponent > xReportComponent(m_xReportComponent,uno::UNO_QUERY); 589*cdf0e10cSrcweir OReportController& rReportController = getController(); 590*cdf0e10cSrcweir if ( !m_pCurrentView && !xReport.is() ) 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir if ( xReportComponent.is() ) 593*cdf0e10cSrcweir xReport = xReportComponent->getSection()->getReportDefinition(); 594*cdf0e10cSrcweir else 595*cdf0e10cSrcweir xReport = rReportController.getReportDefinition().get(); 596*cdf0e10cSrcweir } 597*cdf0e10cSrcweir else if ( m_pCurrentView ) 598*cdf0e10cSrcweir { 599*cdf0e10cSrcweir uno::Reference< report::XSection > xSection = m_pCurrentView->getReportSection()->getSection(); 600*cdf0e10cSrcweir xReport = xSection->getReportDefinition(); 601*cdf0e10cSrcweir } 602*cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xSet(rReportController.getRowSet(),uno::UNO_QUERY); 603*cdf0e10cSrcweir m_pAddField = new OAddFieldWindow(this,xSet); 604*cdf0e10cSrcweir m_pAddField->SetCreateHdl(LINK( &rReportController, OReportController, OnCreateHdl ) ); 605*cdf0e10cSrcweir SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromAscii( UID_RPT_RPT_APP_VIEW ) ); 606*cdf0e10cSrcweir if ( aDlgOpt.Exists() ) 607*cdf0e10cSrcweir m_pAddField->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) ); 608*cdf0e10cSrcweir m_pAddField->Update(); 609*cdf0e10cSrcweir m_pAddField->AddEventListener(LINK(&rReportController,OReportController,EventLstHdl)); 610*cdf0e10cSrcweir notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::AddWindow)); 611*cdf0e10cSrcweir m_pAddField->Show(); 612*cdf0e10cSrcweir } 613*cdf0e10cSrcweir else 614*cdf0e10cSrcweir m_pAddField->Show(!m_pAddField->IsVisible()); 615*cdf0e10cSrcweir } 616*cdf0e10cSrcweir // ------------------------------------------------------------------------- 617*cdf0e10cSrcweir uno::Reference< report::XSection > ODesignView::getCurrentSection() const 618*cdf0e10cSrcweir { 619*cdf0e10cSrcweir uno::Reference< report::XSection > xSection; 620*cdf0e10cSrcweir if ( m_pCurrentView ) 621*cdf0e10cSrcweir xSection = m_pCurrentView->getReportSection()->getSection(); 622*cdf0e10cSrcweir 623*cdf0e10cSrcweir // why do we need the code below? 624*cdf0e10cSrcweir //else 625*cdf0e10cSrcweir // { 626*cdf0e10cSrcweir // OReportController& rReportController = getController(); 627*cdf0e10cSrcweir // xSection = rReportController.getReportDefinition()->getDetail(); 628*cdf0e10cSrcweir // } 629*cdf0e10cSrcweir return xSection; 630*cdf0e10cSrcweir } 631*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 632*cdf0e10cSrcweir uno::Reference< report::XReportComponent > ODesignView::getCurrentControlModel() const 633*cdf0e10cSrcweir { 634*cdf0e10cSrcweir uno::Reference< report::XReportComponent > xModel; 635*cdf0e10cSrcweir if ( m_pCurrentView ) 636*cdf0e10cSrcweir { 637*cdf0e10cSrcweir xModel = m_pCurrentView->getReportSection()->getCurrentControlModel(); 638*cdf0e10cSrcweir } 639*cdf0e10cSrcweir return xModel; 640*cdf0e10cSrcweir } 641*cdf0e10cSrcweir // ------------------------------------------------------------------------- 642*cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> ODesignView::getMarkedSection(NearSectionAccess nsa) const 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir return m_aScrollWindow.getMarkedSection(nsa); 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir //----------------------------------------------------------------------------- 647*cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const 648*cdf0e10cSrcweir { 649*cdf0e10cSrcweir return m_aScrollWindow.getSectionWindow(_xSection); 650*cdf0e10cSrcweir } 651*cdf0e10cSrcweir // ------------------------------------------------------------------------- 652*cdf0e10cSrcweir void ODesignView::markSection(const sal_uInt16 _nPos) 653*cdf0e10cSrcweir { 654*cdf0e10cSrcweir m_aScrollWindow.markSection(_nPos); 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 657*cdf0e10cSrcweir void ODesignView::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const 658*cdf0e10cSrcweir { 659*cdf0e10cSrcweir m_aScrollWindow.fillCollapsedSections(_rCollapsedPositions); 660*cdf0e10cSrcweir } 661*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 662*cdf0e10cSrcweir void ODesignView::collapseSections(const uno::Sequence< beans::PropertyValue>& _aCollpasedSections) 663*cdf0e10cSrcweir { 664*cdf0e10cSrcweir m_aScrollWindow.collapseSections(_aCollpasedSections); 665*cdf0e10cSrcweir } 666*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 667*cdf0e10cSrcweir ::rtl::OUString ODesignView::getCurrentPage() const 668*cdf0e10cSrcweir { 669*cdf0e10cSrcweir return m_pPropWin ? m_pPropWin->getCurrentPage() : ::rtl::OUString(); 670*cdf0e10cSrcweir } 671*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 672*cdf0e10cSrcweir void ODesignView::setCurrentPage(const ::rtl::OUString& _sLastActivePage) 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir if ( m_pPropWin ) 675*cdf0e10cSrcweir m_pPropWin->setCurrentPage(_sLastActivePage); 676*cdf0e10cSrcweir } 677*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 678*cdf0e10cSrcweir void ODesignView::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects) 679*cdf0e10cSrcweir { 680*cdf0e10cSrcweir m_aScrollWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection,bBoundRects); 681*cdf0e10cSrcweir } 682*cdf0e10cSrcweir #if 0 683*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 684*cdf0e10cSrcweir sal_Bool ODesignView::isAlignPossible() const 685*cdf0e10cSrcweir { 686*cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection(); 687*cdf0e10cSrcweir return pMarkedSection.get() && pMarkedSection->getReportSection().getSectionView().IsAlignPossible(); 688*cdf0e10cSrcweir } 689*cdf0e10cSrcweir #endif 690*cdf0e10cSrcweir //------------------------------------------------------------------------------ 691*cdf0e10cSrcweir sal_Bool ODesignView::handleKeyEvent(const KeyEvent& _rEvent) 692*cdf0e10cSrcweir { 693*cdf0e10cSrcweir if ( (m_pPropWin && m_pPropWin->HasChildPathFocus()) ) 694*cdf0e10cSrcweir return sal_False; 695*cdf0e10cSrcweir if ( (m_pAddField && m_pAddField->HasChildPathFocus()) ) 696*cdf0e10cSrcweir return sal_False; 697*cdf0e10cSrcweir if ( (m_pReportExplorer && m_pReportExplorer->HasChildPathFocus()) ) 698*cdf0e10cSrcweir return sal_False; 699*cdf0e10cSrcweir return m_aScrollWindow.handleKeyEvent(_rEvent); 700*cdf0e10cSrcweir } 701*cdf0e10cSrcweir //------------------------------------------------------------------------ 702*cdf0e10cSrcweir void ODesignView::setMarked(const uno::Reference< report::XSection>& _xSection,sal_Bool _bMark) 703*cdf0e10cSrcweir { 704*cdf0e10cSrcweir m_aScrollWindow.setMarked(_xSection,_bMark); 705*cdf0e10cSrcweir if ( _bMark ) 706*cdf0e10cSrcweir UpdatePropertyBrowserDelayed(getMarkedSection()->getReportSection().getSectionView()); 707*cdf0e10cSrcweir else 708*cdf0e10cSrcweir m_pCurrentView = NULL; 709*cdf0e10cSrcweir } 710*cdf0e10cSrcweir //------------------------------------------------------------------------ 711*cdf0e10cSrcweir void ODesignView::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _aShapes,sal_Bool _bMark) 712*cdf0e10cSrcweir { 713*cdf0e10cSrcweir m_aScrollWindow.setMarked(_aShapes,_bMark); 714*cdf0e10cSrcweir if ( _aShapes.hasElements() && _bMark ) 715*cdf0e10cSrcweir showProperties(_aShapes[0]); 716*cdf0e10cSrcweir else 717*cdf0e10cSrcweir m_xReportComponent.clear(); 718*cdf0e10cSrcweir } 719*cdf0e10cSrcweir //------------------------------------------------------------------------------ 720*cdf0e10cSrcweir void ODesignView::MouseButtonDown( const MouseEvent& rMEvt ) 721*cdf0e10cSrcweir { 722*cdf0e10cSrcweir if ( rMEvt.IsLeft() ) 723*cdf0e10cSrcweir { 724*cdf0e10cSrcweir const uno::Sequence< beans::PropertyValue> aArgs; 725*cdf0e10cSrcweir getController().executeChecked(SID_SELECT_REPORT,aArgs); 726*cdf0e10cSrcweir } 727*cdf0e10cSrcweir ODataView::MouseButtonDown(rMEvt); 728*cdf0e10cSrcweir } 729*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 730*cdf0e10cSrcweir uno::Any ODesignView::getCurrentlyShownProperty() const 731*cdf0e10cSrcweir { 732*cdf0e10cSrcweir uno::Any aRet; 733*cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> pSectionWindow = getMarkedSection(); 734*cdf0e10cSrcweir if ( pSectionWindow ) 735*cdf0e10cSrcweir { 736*cdf0e10cSrcweir ::std::vector< uno::Reference< uno::XInterface > > aSelection; 737*cdf0e10cSrcweir pSectionWindow->getReportSection().fillControlModelSelection(aSelection); 738*cdf0e10cSrcweir if ( !aSelection.empty() ) 739*cdf0e10cSrcweir { 740*cdf0e10cSrcweir ::std::vector< uno::Reference< uno::XInterface > >::iterator aIter = aSelection.begin(); 741*cdf0e10cSrcweir uno::Sequence< uno::Reference< report::XReportComponent > > aSeq(aSelection.size()); 742*cdf0e10cSrcweir for(sal_Int32 i = 0; i < aSeq.getLength(); ++i,++aIter) 743*cdf0e10cSrcweir { 744*cdf0e10cSrcweir aSeq[i].set(*aIter,uno::UNO_QUERY); 745*cdf0e10cSrcweir } 746*cdf0e10cSrcweir aRet <<= aSeq; 747*cdf0e10cSrcweir } 748*cdf0e10cSrcweir } 749*cdf0e10cSrcweir return aRet; 750*cdf0e10cSrcweir } 751*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 752*cdf0e10cSrcweir void ODesignView::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const 753*cdf0e10cSrcweir { 754*cdf0e10cSrcweir m_aScrollWindow.fillControlModelSelection(_rSelection); 755*cdf0e10cSrcweir } 756*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 757*cdf0e10cSrcweir void ODesignView::setGridSnap(sal_Bool bOn) 758*cdf0e10cSrcweir { 759*cdf0e10cSrcweir m_aScrollWindow.setGridSnap(bOn); 760*cdf0e10cSrcweir 761*cdf0e10cSrcweir } 762*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 763*cdf0e10cSrcweir void ODesignView::setDragStripes(sal_Bool bOn) 764*cdf0e10cSrcweir { 765*cdf0e10cSrcweir m_aScrollWindow.setDragStripes(bOn); 766*cdf0e10cSrcweir } 767*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 768*cdf0e10cSrcweir sal_Bool ODesignView::isHandleEvent(sal_uInt16 /*_nId*/) const 769*cdf0e10cSrcweir { 770*cdf0e10cSrcweir return m_pPropWin && m_pPropWin->HasChildPathFocus(); 771*cdf0e10cSrcweir } 772*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 773*cdf0e10cSrcweir sal_uInt32 ODesignView::getMarkedObjectCount() const 774*cdf0e10cSrcweir { 775*cdf0e10cSrcweir return m_aScrollWindow.getMarkedObjectCount(); 776*cdf0e10cSrcweir } 777*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 778*cdf0e10cSrcweir void ODesignView::zoom(const Fraction& _aZoom) 779*cdf0e10cSrcweir { 780*cdf0e10cSrcweir m_aScrollWindow.zoom(_aZoom); 781*cdf0e10cSrcweir } 782*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 783*cdf0e10cSrcweir sal_uInt16 ODesignView::getZoomFactor(SvxZoomType _eType) const 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir return m_aScrollWindow.getZoomFactor(_eType); 786*cdf0e10cSrcweir } 787*cdf0e10cSrcweir //============================================================================ 788*cdf0e10cSrcweir } // rptui 789*cdf0e10cSrcweir //============================================================================ 790