LCOV - code coverage report
Current view: top level - reportdesign/source/ui/report - DesignView.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 364 0.0 %
Date: 2012-08-25 Functions: 0 65 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

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

Generated by: LCOV version 1.10