LCOV - code coverage report
Current view: top level - reportdesign/source/ui/report - DesignView.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 364 0.0 %
Date: 2014-04-11 Functions: 0 65 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10