LCOV - code coverage report
Current view: top level - libreoffice/reportdesign/source/ui/dlg - Navigator.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 460 0.0 %
Date: 2012-12-27 Functions: 0 54 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 "Navigator.hxx"
      21             : 
      22             : #include "uistrings.hrc"
      23             : #include "ReportController.hxx"
      24             : #include "UITools.hxx"
      25             : #include "RptUndo.hxx"
      26             : #include "reportformula.hxx"
      27             : #include <com/sun/star/container/XContainerListener.hpp>
      28             : #include <com/sun/star/report/XReportDefinition.hpp>
      29             : #include <com/sun/star/report/XFixedText.hpp>
      30             : #include <com/sun/star/report/XFixedLine.hpp>
      31             : #include <com/sun/star/report/XFormattedField.hpp>
      32             : #include <com/sun/star/report/XImageControl.hpp>
      33             : #include <com/sun/star/report/XShape.hpp>
      34             : #include "helpids.hrc"
      35             : #include "RptResId.hrc"
      36             : #include "rptui_slotid.hrc"
      37             : #include <tools/debug.hxx>
      38             : #include <comphelper/propmultiplex.hxx>
      39             : #include <comphelper/containermultiplexer.hxx>
      40             : #include <comphelper/types.hxx>
      41             : #include "cppuhelper/basemutex.hxx"
      42             : #include "comphelper/SelectionMultiplex.hxx"
      43             : #include <svtools/treelistbox.hxx>
      44             : #include "svtools/treelistentry.hxx"
      45             : #include <svl/solar.hrc>
      46             : #include "ReportVisitor.hxx"
      47             : #include "ModuleHelper.hxx"
      48             : #include <rtl/ref.hxx>
      49             : 
      50             : #include <memory>
      51             : #include <algorithm>
      52             : 
      53             : #define RID_SVXIMG_COLLAPSEDNODE            (RID_FORMS_START + 2)
      54             : #define RID_SVXIMG_EXPANDEDNODE             (RID_FORMS_START + 3)
      55             : #define DROP_ACTION_TIMER_INITIAL_TICKS     10
      56             : #define DROP_ACTION_TIMER_SCROLL_TICKS      3
      57             : #define DROP_ACTION_TIMER_TICK_BASE         10
      58             : 
      59             : namespace rptui
      60             : {
      61             : using namespace ::com::sun::star;
      62             : using namespace utl;
      63             : using namespace ::comphelper;
      64             : 
      65           0 : sal_uInt16 lcl_getImageId(const uno::Reference< report::XReportComponent>& _xElement)
      66             : {
      67           0 :     sal_uInt16 nId = 0;
      68           0 :     uno::Reference< report::XFixedLine> xFixedLine(_xElement,uno::UNO_QUERY);
      69           0 :     if ( uno::Reference< report::XFixedText>(_xElement,uno::UNO_QUERY).is() )
      70           0 :         nId = SID_FM_FIXEDTEXT;
      71           0 :     else if ( xFixedLine.is() )
      72           0 :         nId = xFixedLine->getOrientation() ? SID_INSERT_VFIXEDLINE : SID_INSERT_HFIXEDLINE;
      73           0 :     else if ( uno::Reference< report::XFormattedField>(_xElement,uno::UNO_QUERY).is() )
      74           0 :         nId = SID_FM_EDIT;
      75           0 :     else if ( uno::Reference< report::XImageControl>(_xElement,uno::UNO_QUERY).is() )
      76           0 :         nId = SID_FM_IMAGECONTROL;
      77           0 :     else if ( uno::Reference< report::XShape>(_xElement,uno::UNO_QUERY).is() )
      78           0 :         nId = SID_DRAWTBX_CS_BASIC;
      79           0 :     return nId;
      80             : }
      81             : // -----------------------------------------------------------------------------
      82           0 : ::rtl::OUString lcl_getName(const uno::Reference< beans::XPropertySet>& _xElement)
      83             : {
      84             :     OSL_ENSURE(_xElement.is(),"Found report element which is NULL!");
      85           0 :     ::rtl::OUString sTempName;
      86           0 :     _xElement->getPropertyValue(PROPERTY_NAME) >>= sTempName;
      87           0 :     ::rtl::OUStringBuffer sName = sTempName;
      88           0 :     uno::Reference< report::XFixedText> xFixedText(_xElement,uno::UNO_QUERY);
      89           0 :     uno::Reference< report::XReportControlModel> xReportModel(_xElement,uno::UNO_QUERY);
      90           0 :     if ( xFixedText.is() )
      91             :     {
      92           0 :         sName.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" : ")));
      93           0 :         sName.append(xFixedText->getLabel());
      94             :     }
      95           0 :     else if ( xReportModel.is() && _xElement->getPropertySetInfo()->hasPropertyByName(PROPERTY_DATAFIELD) )
      96             :     {
      97           0 :         ReportFormula aFormula( xReportModel->getDataField() );
      98           0 :         if ( aFormula.isValid() )
      99             :         {
     100           0 :             sName.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" : ")));
     101           0 :             sName.append( aFormula.getUndecoratedContent() );
     102           0 :         }
     103             :     }
     104           0 :     return sName.makeStringAndClear();
     105             : }
     106             : // -----------------------------------------------------------------------------
     107             : 
     108             : class NavigatorTree :   public ::cppu::BaseMutex
     109             :                     ,   public SvTreeListBox
     110             :                     ,   public reportdesign::ITraverseReport
     111             :                     ,   public comphelper::OSelectionChangeListener
     112             :                     ,   public ::comphelper::OPropertyChangeListener
     113             : {
     114             :     class UserData;
     115             :     friend class UserData;
     116             :     class UserData : public ::cppu::BaseMutex
     117             :                     ,public ::comphelper::OPropertyChangeListener
     118             :                     ,public ::comphelper::OContainerListener
     119             :     {
     120             :         uno::Reference< uno::XInterface >                           m_xContent;
     121             :         ::rtl::Reference< comphelper::OPropertyChangeMultiplexer>   m_pListener;
     122             :         ::rtl::Reference< comphelper::OContainerListenerAdapter>    m_pContainerListener;
     123             :         NavigatorTree*                                              m_pTree;
     124             :     public:
     125             :         UserData(NavigatorTree* _pTree,const uno::Reference<uno::XInterface>& _xContent);
     126             :         ~UserData();
     127             : 
     128           0 :         inline uno::Reference< uno::XInterface > getContent() const { return m_xContent; }
     129           0 :         inline void setContent(const uno::Reference< uno::XInterface >& _xContent) { m_xContent = _xContent; }
     130             :     protected:
     131             :         // OPropertyChangeListener
     132             :         virtual void _propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException);
     133             : 
     134             :         // OContainerListener
     135             :         virtual void _elementInserted( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException);
     136             :         virtual void _elementRemoved( const container::ContainerEvent& _Event ) throw(uno::RuntimeException);
     137             :         virtual void _elementReplaced( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException);
     138             :         virtual void _disposing(const lang::EventObject& _rSource) throw( uno::RuntimeException);
     139             :     };
     140             : 
     141             :     enum DROP_ACTION        { DA_SCROLLUP, DA_SCROLLDOWN, DA_EXPANDNODE };
     142             :     AutoTimer                                                                   m_aDropActionTimer;
     143             :     Timer                                                                       m_aSynchronizeTimer;
     144             :     ImageList                                                                   m_aNavigatorImages;
     145             :     Point                                                                       m_aTimerTriggered;      // die Position, an der der DropTimer angeschaltet wurde
     146             :     DROP_ACTION                                                                 m_aDropActionType;
     147             :     OReportController&                                                          m_rController;
     148             :     SvTreeListEntry*                                                                m_pMasterReport;
     149             :     SvTreeListEntry*                                                                m_pDragedEntry;
     150             :     ::rtl::Reference< comphelper::OPropertyChangeMultiplexer>                   m_pReportListener;
     151             :     ::rtl::Reference< comphelper::OSelectionChangeMultiplexer>                  m_pSelectionListener;
     152             :     unsigned short                                                              m_nTimerCounter;
     153             : 
     154             :     SvTreeListEntry* insertEntry(const ::rtl::OUString& _sName,SvTreeListEntry* _pParent,sal_uInt16 _nImageId,sal_uLong _nPosition,UserData* _pData);
     155             :     void traverseSection(const uno::Reference< report::XSection>& _xSection,SvTreeListEntry* _pParent,sal_uInt16 _nImageId,sal_uLong _nPosition = LIST_APPEND);
     156             :     void traverseFunctions(const uno::Reference< report::XFunctions>& _xFunctions,SvTreeListEntry* _pParent);
     157             : 
     158             :     NavigatorTree(const NavigatorTree&);
     159             :     void operator =(const NavigatorTree&);
     160             : protected:
     161             :     virtual void        Command( const CommandEvent& rEvt );
     162             :     // DragSourceHelper overridables
     163             :     virtual void        StartDrag( sal_Int8 nAction, const Point& rPosPixel );
     164             :     // DropTargetHelper overridables
     165             :     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& _rEvt );
     166             :     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& _rEvt );
     167             : 
     168             :     // OSelectionChangeListener
     169             :     virtual void _disposing(const lang::EventObject& _rSource) throw( uno::RuntimeException);
     170             : 
     171             :     // OPropertyChangeListener
     172             :     virtual void _propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException);
     173             : 
     174             :     // OContainerListener Helper
     175             :     void _elementInserted( const container::ContainerEvent& _rEvent );
     176             :     void _elementRemoved( const container::ContainerEvent& _Event );
     177             :     void _elementReplaced( const container::ContainerEvent& _rEvent );
     178             : 
     179             : public:
     180             :     NavigatorTree(Window* pParent,OReportController& _rController );
     181             :     virtual ~NavigatorTree();
     182             : 
     183             :     DECL_LINK(OnEntrySelDesel, NavigatorTree*);
     184             :     DECL_LINK( OnDropActionTimer, void* );
     185             : 
     186             :     virtual void _selectionChanged( const lang::EventObject& aEvent ) throw (uno::RuntimeException);
     187             : 
     188             :     // ITraverseReport
     189             :     virtual void traverseReport(const uno::Reference< report::XReportDefinition>& _xReport);
     190             :     virtual void traverseReportFunctions(const uno::Reference< report::XFunctions>& _xFunctions);
     191             :     virtual void traverseReportHeader(const uno::Reference< report::XSection>& _xSection);
     192             :     virtual void traverseReportFooter(const uno::Reference< report::XSection>& _xSection);
     193             :     virtual void traversePageHeader(const uno::Reference< report::XSection>& _xSection);
     194             :     virtual void traversePageFooter(const uno::Reference< report::XSection>& _xSection);
     195             : 
     196             :     virtual void traverseGroups(const uno::Reference< report::XGroups>& _xGroups);
     197             :     virtual void traverseGroup(const uno::Reference< report::XGroup>& _xGroup);
     198             :     virtual void traverseGroupFunctions(const uno::Reference< report::XFunctions>& _xFunctions);
     199             :     virtual void traverseGroupHeader(const uno::Reference< report::XSection>& _xSection);
     200             :     virtual void traverseGroupFooter(const uno::Reference< report::XSection>& _xSection);
     201             : 
     202             :     virtual void traverseDetail(const uno::Reference< report::XSection>& _xSection);
     203             : 
     204             :     SvTreeListEntry* find(const uno::Reference< uno::XInterface >& _xContent);
     205             :     void removeEntry(SvTreeListEntry* _pEntry,bool _bRemove = true);
     206             : private:
     207             :     using SvTreeListBox::ExecuteDrop;
     208             : };
     209             : DBG_NAME(rpt_NavigatorTree)
     210             : // -----------------------------------------------------------------------------
     211           0 : NavigatorTree::NavigatorTree( Window* pParent,OReportController& _rController )
     212             :         :SvTreeListBox( pParent, WB_TABSTOP| WB_HASBUTTONS|WB_HASLINES|WB_BORDER|WB_HSCROLL|WB_HASBUTTONSATROOT )
     213             :         ,comphelper::OSelectionChangeListener(m_aMutex)
     214             :         ,OPropertyChangeListener(m_aMutex)
     215             :         ,m_aTimerTriggered(-1,-1)
     216             :         ,m_aDropActionType( DA_SCROLLUP )
     217             :         ,m_rController(_rController)
     218             :         ,m_pMasterReport(NULL)
     219             :         ,m_pDragedEntry(NULL)
     220           0 :         ,m_nTimerCounter( DROP_ACTION_TIMER_INITIAL_TICKS )
     221             : {
     222             :     DBG_CTOR(rpt_NavigatorTree,NULL);
     223           0 :     m_pReportListener = new OPropertyChangeMultiplexer(this,m_rController.getReportDefinition().get());
     224           0 :     m_pReportListener->addProperty(PROPERTY_PAGEHEADERON);
     225           0 :     m_pReportListener->addProperty(PROPERTY_PAGEFOOTERON);
     226           0 :     m_pReportListener->addProperty(PROPERTY_REPORTHEADERON);
     227           0 :     m_pReportListener->addProperty(PROPERTY_REPORTFOOTERON);
     228             : 
     229           0 :     m_pSelectionListener = new OSelectionChangeMultiplexer(this,&m_rController);
     230             : 
     231           0 :     SetHelpId( HID_REPORT_NAVIGATOR_TREE );
     232             : 
     233           0 :     m_aNavigatorImages = ImageList( ModuleRes( RID_SVXIMGLIST_RPTEXPL ) );
     234             : 
     235             :     SetNodeBitmaps(
     236             :         m_aNavigatorImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ),
     237             :         m_aNavigatorImages.GetImage( RID_SVXIMG_EXPANDEDNODE )
     238           0 :     );
     239             : 
     240           0 :     SetDragDropMode(0xFFFF);
     241           0 :     EnableInplaceEditing( sal_False );
     242           0 :     SetSelectionMode(MULTIPLE_SELECTION);
     243           0 :     Clear();
     244             : 
     245           0 :     m_aDropActionTimer.SetTimeoutHdl(LINK(this, NavigatorTree, OnDropActionTimer));
     246           0 :     SetSelectHdl(LINK(this, NavigatorTree, OnEntrySelDesel));
     247           0 :     SetDeselectHdl(LINK(this, NavigatorTree, OnEntrySelDesel));
     248           0 : }
     249             : // -----------------------------------------------------------------------------
     250           0 : NavigatorTree::~NavigatorTree()
     251             : {
     252           0 :     SvTreeListEntry* pCurrent = First();
     253           0 :     while ( pCurrent )
     254             :     {
     255           0 :         delete static_cast<UserData*>(pCurrent->GetUserData());
     256           0 :         pCurrent = Next(pCurrent);
     257             :     }
     258           0 :     m_pReportListener->dispose();
     259           0 :     m_pSelectionListener->dispose();
     260             :     DBG_DTOR(rpt_NavigatorTree,NULL);
     261           0 : }
     262             : //------------------------------------------------------------------------------
     263           0 : void NavigatorTree::Command( const CommandEvent& rEvt )
     264             : {
     265           0 :     sal_Bool bHandled = sal_False;
     266           0 :     switch( rEvt.GetCommand() )
     267             :     {
     268             :         case COMMAND_CONTEXTMENU:
     269             :         {
     270             :             // die Stelle, an der geklickt wurde
     271           0 :             SvTreeListEntry* ptClickedOn = NULL;
     272           0 :             ::Point aWhere;
     273           0 :             if (rEvt.IsMouseEvent())
     274             :             {
     275           0 :                 aWhere = rEvt.GetMousePosPixel();
     276           0 :                 ptClickedOn = GetEntry(aWhere);
     277           0 :                 if (ptClickedOn == NULL)
     278             :                     break;
     279           0 :                 if ( !IsSelected(ptClickedOn) )
     280             :                 {
     281           0 :                     SelectAll(sal_False);
     282           0 :                     Select(ptClickedOn, sal_True);
     283           0 :                     SetCurEntry(ptClickedOn);
     284             :                 }
     285             :             }
     286             :             else
     287             :             {
     288           0 :                 ptClickedOn = GetCurEntry();
     289           0 :                 if ( !ptClickedOn )
     290             :                     break;
     291           0 :                 aWhere = GetEntryPosition(ptClickedOn);
     292             :             }
     293           0 :             UserData* pData = static_cast<UserData*>(ptClickedOn->GetUserData());
     294           0 :             uno::Reference< report::XFunctionsSupplier> xSupplier(pData->getContent(),uno::UNO_QUERY);
     295           0 :             uno::Reference< report::XFunctions> xFunctions(pData->getContent(),uno::UNO_QUERY);
     296           0 :             uno::Reference< report::XGroup> xGroup(pData->getContent(),uno::UNO_QUERY);
     297           0 :             sal_Bool bDeleteAllowed = m_rController.isEditable() && (xGroup.is() ||
     298           0 :                                       uno::Reference< report::XFunction>(pData->getContent(),uno::UNO_QUERY).is());
     299           0 :             PopupMenu aContextMenu( ModuleRes( RID_MENU_NAVIGATOR ) );
     300             : 
     301           0 :             sal_uInt16 nCount = aContextMenu.GetItemCount();
     302           0 :             for (sal_uInt16 i = 0; i < nCount; ++i)
     303             :             {
     304           0 :                 if ( MENUITEM_SEPARATOR != aContextMenu.GetItemType(i))
     305             :                 {
     306           0 :                     sal_uInt16 nId = aContextMenu.GetItemId(i);
     307             : 
     308           0 :                     aContextMenu.CheckItem(nId,m_rController.isCommandChecked(nId));
     309           0 :                     sal_Bool bEnabled = m_rController.isCommandEnabled(nId);
     310           0 :                     if ( nId == SID_RPT_NEW_FUNCTION )
     311           0 :                         aContextMenu.EnableItem(nId,m_rController.isEditable() && (xSupplier.is() || xFunctions.is()) );
     312             :                     // special condition, check for function and group
     313           0 :                     else if ( nId == SID_DELETE )
     314           0 :                         aContextMenu.EnableItem(SID_DELETE,bDeleteAllowed);
     315             :                     else
     316           0 :                         aContextMenu.EnableItem(nId,bEnabled);
     317             :                 }
     318             :             }
     319           0 :             sal_uInt16 nId = aContextMenu.Execute(this, aWhere);
     320           0 :             if ( nId )
     321             :             {
     322           0 :                 uno::Sequence< beans::PropertyValue> aArgs;
     323           0 :                 if ( nId == SID_RPT_NEW_FUNCTION )
     324             :                 {
     325           0 :                     aArgs.realloc(1);
     326           0 :                     aArgs[0].Value <<= (xFunctions.is() ? xFunctions : xSupplier->getFunctions());
     327             :                 }
     328           0 :                 else if ( nId == SID_DELETE )
     329             :                 {
     330           0 :                     if ( xGroup.is() )
     331           0 :                         nId = SID_GROUP_REMOVE;
     332           0 :                     aArgs.realloc(1);
     333           0 :                     aArgs[0].Name = PROPERTY_GROUP;
     334           0 :                     aArgs[0].Value <<= pData->getContent();
     335             :                 }
     336           0 :                 m_rController.executeUnChecked(nId,aArgs);
     337             :             }
     338             : 
     339           0 :             bHandled = sal_True;
     340           0 :         } break;
     341             :     }
     342             : 
     343           0 :     if (!bHandled)
     344           0 :         SvTreeListBox::Command( rEvt );
     345           0 : }
     346             : // -----------------------------------------------------------------------------
     347           0 : sal_Int8 NavigatorTree::AcceptDrop( const AcceptDropEvent& _rEvt )
     348             : {
     349           0 :     sal_Int8 nDropOption = DND_ACTION_NONE;
     350           0 :     ::Point aDropPos = _rEvt.maPosPixel;
     351           0 :     if (_rEvt.mbLeaving)
     352             :     {
     353           0 :         if (m_aDropActionTimer.IsActive())
     354           0 :             m_aDropActionTimer.Stop();
     355             :     }
     356             :     else
     357             :     {
     358           0 :         bool bNeedTrigger = false;
     359             :         // auf dem ersten Eintrag ?
     360           0 :         if ((aDropPos.Y() >= 0) && (aDropPos.Y() < GetEntryHeight()))
     361             :         {
     362           0 :             m_aDropActionType = DA_SCROLLUP;
     363           0 :             bNeedTrigger = true;
     364             :         }
     365           0 :         else if ((aDropPos.Y() < GetSizePixel().Height()) && (aDropPos.Y() >= GetSizePixel().Height() - GetEntryHeight()))
     366             :         {
     367           0 :             m_aDropActionType = DA_SCROLLDOWN;
     368           0 :             bNeedTrigger = true;
     369             :         }
     370             :         else
     371             :         {
     372           0 :             SvTreeListEntry* pDropppedOn = GetEntry(aDropPos);
     373           0 :             if (pDropppedOn && (GetChildCount(pDropppedOn) > 0) && !IsExpanded(pDropppedOn))
     374             :             {
     375           0 :                 m_aDropActionType = DA_EXPANDNODE;
     376           0 :                 bNeedTrigger = true;
     377             :             }
     378             :         }
     379             : 
     380           0 :         if (bNeedTrigger && (m_aTimerTriggered != aDropPos))
     381             :         {
     382             :             // neu anfangen zu zaehlen
     383           0 :             m_nTimerCounter = DROP_ACTION_TIMER_INITIAL_TICKS;
     384             :             // die Pos merken, da ich auch AcceptDrops bekomme, wenn sich die Maus gar nicht bewegt hat
     385           0 :             m_aTimerTriggered = aDropPos;
     386             :             // und den Timer los
     387           0 :             if (!m_aDropActionTimer.IsActive()) // gibt es den Timer schon ?
     388             :             {
     389           0 :                 m_aDropActionTimer.SetTimeout(DROP_ACTION_TIMER_TICK_BASE);
     390           0 :                 m_aDropActionTimer.Start();
     391             :             }
     392             :         }
     393           0 :         else if (!bNeedTrigger)
     394           0 :             m_aDropActionTimer.Stop();
     395             :     }
     396             : 
     397           0 :     return nDropOption;
     398             : }
     399             : // -------------------------------------------------------------------------
     400           0 : sal_Int8 NavigatorTree::ExecuteDrop( const ExecuteDropEvent& /*_rEvt*/ )
     401             : {
     402           0 :     return DND_ACTION_NONE;
     403             : }
     404             : // -------------------------------------------------------------------------
     405           0 : void NavigatorTree::StartDrag( sal_Int8 /*_nAction*/, const Point& _rPosPixel )
     406             : {
     407           0 :     m_pDragedEntry = GetEntry(_rPosPixel);
     408           0 :     if ( m_pDragedEntry )
     409             :     {
     410           0 :         EndSelection();
     411             :     }
     412           0 : }
     413             : //------------------------------------------------------------------------
     414           0 : IMPL_LINK_NOARG(NavigatorTree, OnDropActionTimer)
     415             : {
     416           0 :     if (--m_nTimerCounter > 0)
     417           0 :         return 0L;
     418             : 
     419           0 :     switch ( m_aDropActionType )
     420             :     {
     421             :     case DA_EXPANDNODE:
     422             :     {
     423           0 :         SvTreeListEntry* pToExpand = GetEntry(m_aTimerTriggered);
     424           0 :         if (pToExpand && (GetChildCount(pToExpand) > 0) &&  !IsExpanded(pToExpand))
     425             :             // tja, eigentlich muesste ich noch testen, ob die Node nicht schon expandiert ist, aber ich
     426             :             // habe dazu weder in den Basisklassen noch im Model eine Methode gefunden ...
     427             :             // aber ich denke, die BK sollte es auch so vertragen
     428           0 :             Expand(pToExpand);
     429             : 
     430             :         // nach dem Expand habe ich im Gegensatz zum Scrollen natuerlich nix mehr zu tun
     431           0 :         m_aDropActionTimer.Stop();
     432             :     }
     433           0 :     break;
     434             : 
     435             :     case DA_SCROLLUP :
     436           0 :         ScrollOutputArea( 1 );
     437           0 :         m_nTimerCounter = DROP_ACTION_TIMER_SCROLL_TICKS;
     438           0 :         break;
     439             : 
     440             :     case DA_SCROLLDOWN :
     441           0 :         ScrollOutputArea( -1 );
     442           0 :         m_nTimerCounter = DROP_ACTION_TIMER_SCROLL_TICKS;
     443           0 :         break;
     444             : 
     445             :     }
     446             : 
     447           0 :     return 0L;
     448             : }
     449             : 
     450             : // -----------------------------------------------------------------------------
     451           0 : IMPL_LINK(NavigatorTree, OnEntrySelDesel, NavigatorTree*, /*pThis*/)
     452             : {
     453           0 :     if ( !m_pSelectionListener->locked() )
     454             :     {
     455           0 :         m_pSelectionListener->lock();
     456           0 :         SvTreeListEntry* pEntry = GetCurEntry();
     457           0 :         uno::Any aSelection;
     458           0 :         if ( IsSelected(pEntry) )
     459           0 :             aSelection <<= static_cast<UserData*>(pEntry->GetUserData())->getContent();
     460           0 :         m_rController.select(aSelection);
     461           0 :         m_pSelectionListener->unlock();
     462             :     }
     463             : 
     464           0 :     return 0L;
     465             : }
     466             : // -----------------------------------------------------------------------------
     467           0 : void NavigatorTree::_selectionChanged( const lang::EventObject& aEvent ) throw (uno::RuntimeException)
     468             : {
     469           0 :     m_pSelectionListener->lock();
     470           0 :     uno::Reference< view::XSelectionSupplier> xSelectionSupplier(aEvent.Source,uno::UNO_QUERY);
     471           0 :     uno::Any aSec = xSelectionSupplier->getSelection();
     472           0 :     uno::Sequence< uno::Reference< report::XReportComponent > > aSelection;
     473           0 :     aSec >>= aSelection;
     474           0 :     if ( !aSelection.getLength() )
     475             :     {
     476           0 :         uno::Reference< uno::XInterface> xSelection(aSec,uno::UNO_QUERY);
     477           0 :         SvTreeListEntry* pEntry = find(xSelection);
     478           0 :         if ( pEntry && !IsSelected(pEntry) )
     479             :         {
     480           0 :             Select(pEntry, sal_True);
     481           0 :             SetCurEntry(pEntry);
     482             :         }
     483           0 :         else if ( !pEntry )
     484           0 :             SelectAll(sal_False,sal_False);
     485             :     }
     486             :     else
     487             :     {
     488           0 :         const uno::Reference< report::XReportComponent >* pIter = aSelection.getConstArray();
     489           0 :         const uno::Reference< report::XReportComponent >* pEnd  = pIter + aSelection.getLength();
     490           0 :         for (; pIter != pEnd; ++pIter)
     491             :         {
     492           0 :             SvTreeListEntry* pEntry = find(*pIter);
     493           0 :             if ( pEntry && !IsSelected(pEntry) )
     494             :             {
     495           0 :                 Select(pEntry, sal_True);
     496           0 :                 SetCurEntry(pEntry);
     497             :             }
     498             :         }
     499             :     }
     500           0 :     m_pSelectionListener->unlock();
     501           0 : }
     502             : // -----------------------------------------------------------------------------
     503           0 : SvTreeListEntry* NavigatorTree::insertEntry(const ::rtl::OUString& _sName,SvTreeListEntry* _pParent,sal_uInt16 _nImageId,sal_uLong _nPosition,UserData* _pData)
     504             : {
     505           0 :     SvTreeListEntry* pEntry = NULL;
     506           0 :     if ( _nImageId )
     507             :     {
     508           0 :         const Image aImage( m_aNavigatorImages.GetImage( _nImageId ) );
     509           0 :         pEntry = InsertEntry(_sName,aImage,aImage,_pParent,sal_False,_nPosition,_pData);
     510             :     }
     511             :     else
     512           0 :         pEntry = InsertEntry(_sName,_pParent,sal_False,_nPosition,_pData);
     513           0 :     return pEntry;
     514             : }
     515             : // -----------------------------------------------------------------------------
     516           0 : void NavigatorTree::traverseSection(const uno::Reference< report::XSection>& _xSection,SvTreeListEntry* _pParent,sal_uInt16 _nImageId,sal_uLong _nPosition)
     517             : {
     518           0 :     SvTreeListEntry* pSection = insertEntry(_xSection->getName(),_pParent,_nImageId,_nPosition,new UserData(this,_xSection));
     519           0 :     const sal_Int32 nCount = _xSection->getCount();
     520           0 :     for (sal_Int32 i = 0; i < nCount; ++i)
     521             :     {
     522           0 :         uno::Reference< report::XReportComponent> xElement(_xSection->getByIndex(i),uno::UNO_QUERY_THROW);
     523             :         OSL_ENSURE(xElement.is(),"Found report element which is NULL!");
     524           0 :         insertEntry(lcl_getName(xElement.get()),pSection,lcl_getImageId(xElement),LIST_APPEND,new UserData(this,xElement));
     525           0 :         uno::Reference< report::XReportDefinition> xSubReport(xElement,uno::UNO_QUERY);
     526           0 :         if ( xSubReport.is() )
     527             :         {
     528           0 :             m_pMasterReport = find(_xSection->getReportDefinition());
     529           0 :             reportdesign::OReportVisitor aSubVisitor(this);
     530           0 :             aSubVisitor.start(xSubReport);
     531             :         }
     532           0 :     }
     533           0 : }
     534             : // -----------------------------------------------------------------------------
     535           0 : void NavigatorTree::traverseFunctions(const uno::Reference< report::XFunctions>& _xFunctions,SvTreeListEntry* _pParent)
     536             : {
     537           0 :     SvTreeListEntry* pFunctions = insertEntry(String(ModuleRes(RID_STR_FUNCTIONS)),_pParent,SID_RPT_NEW_FUNCTION,LIST_APPEND,new UserData(this,_xFunctions));
     538           0 :     const sal_Int32 nCount = _xFunctions->getCount();
     539           0 :     for (sal_Int32 i = 0; i< nCount; ++i)
     540             :     {
     541           0 :         uno::Reference< report::XFunction> xElement(_xFunctions->getByIndex(i),uno::UNO_QUERY);
     542           0 :         insertEntry(xElement->getName(),pFunctions,SID_RPT_NEW_FUNCTION,LIST_APPEND,new UserData(this,xElement));
     543           0 :     }
     544           0 : }
     545             : // -----------------------------------------------------------------------------
     546           0 : SvTreeListEntry* NavigatorTree::find(const uno::Reference< uno::XInterface >& _xContent)
     547             : {
     548           0 :     SvTreeListEntry* pRet = NULL;
     549           0 :     if ( _xContent.is() )
     550             :     {
     551           0 :         SvTreeListEntry* pCurrent = First();
     552           0 :         while ( pCurrent )
     553             :         {
     554           0 :             UserData* pData = static_cast<UserData*>(pCurrent->GetUserData());
     555             :             OSL_ENSURE(pData,"No UserData set an entry!");
     556           0 :             if ( pData->getContent() == _xContent )
     557             :             {
     558           0 :                 pRet = pCurrent;
     559           0 :                 break;
     560             :             }
     561           0 :             pCurrent = Next(pCurrent);
     562             :         }
     563             :     }
     564           0 :     return pRet;
     565             : }
     566             : // -----------------------------------------------------------------------------
     567             : // ITraverseReport
     568             : // -----------------------------------------------------------------------------
     569           0 : void NavigatorTree::traverseReport(const uno::Reference< report::XReportDefinition>& _xReport)
     570             : {
     571           0 :     insertEntry(_xReport->getName(),m_pMasterReport,SID_SELECT_REPORT,LIST_APPEND,new UserData(this,_xReport));
     572           0 : }
     573             : // -----------------------------------------------------------------------------
     574           0 : void NavigatorTree::traverseReportFunctions(const uno::Reference< report::XFunctions>& _xFunctions)
     575             : {
     576           0 :     SvTreeListEntry* pReport = find(_xFunctions->getParent());
     577           0 :     traverseFunctions(_xFunctions,pReport);
     578           0 : }
     579             : // -----------------------------------------------------------------------------
     580           0 : void NavigatorTree::traverseReportHeader(const uno::Reference< report::XSection>& _xSection)
     581             : {
     582           0 :     SvTreeListEntry* pReport = find(_xSection->getReportDefinition());
     583           0 :     traverseSection(_xSection,pReport,SID_REPORTHEADERFOOTER);
     584           0 : }
     585             : // -----------------------------------------------------------------------------
     586           0 : void NavigatorTree::traverseReportFooter(const uno::Reference< report::XSection>& _xSection)
     587             : {
     588           0 :     SvTreeListEntry* pReport = find(_xSection->getReportDefinition());
     589           0 :     traverseSection(_xSection,pReport,SID_REPORTHEADERFOOTER);
     590           0 : }
     591             : // -----------------------------------------------------------------------------
     592           0 : void NavigatorTree::traversePageHeader(const uno::Reference< report::XSection>& _xSection)
     593             : {
     594           0 :     SvTreeListEntry* pReport = find(_xSection->getReportDefinition());
     595           0 :     traverseSection(_xSection,pReport,SID_PAGEHEADERFOOTER);
     596           0 : }
     597             : // -----------------------------------------------------------------------------
     598           0 : void NavigatorTree::traversePageFooter(const uno::Reference< report::XSection>& _xSection)
     599             : {
     600           0 :     SvTreeListEntry* pReport = find(_xSection->getReportDefinition());
     601           0 :     traverseSection(_xSection,pReport,SID_PAGEHEADERFOOTER);
     602           0 : }
     603             : // -----------------------------------------------------------------------------
     604           0 : void NavigatorTree::traverseGroups(const uno::Reference< report::XGroups>& _xGroups)
     605             : {
     606           0 :     SvTreeListEntry* pReport = find(_xGroups->getReportDefinition());
     607           0 :     insertEntry(String(ModuleRes(RID_STR_GROUPS)),pReport,SID_SORTINGANDGROUPING,LIST_APPEND,new UserData(this,_xGroups));
     608           0 : }
     609             : // -----------------------------------------------------------------------------
     610           0 : void NavigatorTree::traverseGroup(const uno::Reference< report::XGroup>& _xGroup)
     611             : {
     612           0 :     uno::Reference< report::XGroups> xGroups(_xGroup->getParent(),uno::UNO_QUERY);
     613           0 :     SvTreeListEntry* pGroups = find(xGroups);
     614             :     OSL_ENSURE(pGroups,"No Groups inserted so far. Why!");
     615           0 :     insertEntry(_xGroup->getExpression(),pGroups,SID_GROUP,rptui::getPositionInIndexAccess(xGroups.get(),_xGroup),new UserData(this,_xGroup));
     616           0 : }
     617             : // -----------------------------------------------------------------------------
     618           0 : void NavigatorTree::traverseGroupFunctions(const uno::Reference< report::XFunctions>& _xFunctions)
     619             : {
     620           0 :     SvTreeListEntry* pGroup = find(_xFunctions->getParent());
     621           0 :     traverseFunctions(_xFunctions,pGroup);
     622           0 : }
     623             : // -----------------------------------------------------------------------------
     624           0 : void NavigatorTree::traverseGroupHeader(const uno::Reference< report::XSection>& _xSection)
     625             : {
     626           0 :     SvTreeListEntry* pGroup = find(_xSection->getGroup());
     627             :     OSL_ENSURE(pGroup,"No group found");
     628           0 :     traverseSection(_xSection,pGroup,SID_GROUPHEADER,1);
     629           0 : }
     630             : // -----------------------------------------------------------------------------
     631           0 : void NavigatorTree::traverseGroupFooter(const uno::Reference< report::XSection>& _xSection)
     632             : {
     633           0 :     SvTreeListEntry* pGroup = find(_xSection->getGroup());
     634             :     OSL_ENSURE(pGroup,"No group found");
     635           0 :     traverseSection(_xSection,pGroup,SID_GROUPFOOTER);
     636           0 : }
     637             : // -----------------------------------------------------------------------------
     638           0 : void NavigatorTree::traverseDetail(const uno::Reference< report::XSection>& _xSection)
     639             : {
     640           0 :     uno::Reference< report::XReportDefinition> xReport = _xSection->getReportDefinition();
     641           0 :     SvTreeListEntry* pParent = find(xReport);
     642           0 :     traverseSection(_xSection,pParent,SID_ICON_DETAIL);
     643           0 : }
     644             : // -----------------------------------------------------------------------------
     645           0 : void NavigatorTree::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException)
     646             : {
     647           0 :     uno::Reference< report::XReportDefinition> xReport(_rEvent.Source,uno::UNO_QUERY);
     648           0 :     if ( xReport.is() )
     649             :     {
     650           0 :         sal_Bool bEnabled = sal_False;
     651           0 :         _rEvent.NewValue >>= bEnabled;
     652           0 :         if ( bEnabled )
     653             :         {
     654           0 :             SvTreeListEntry* pParent = find(xReport);
     655           0 :             if ( _rEvent.PropertyName == PROPERTY_REPORTHEADERON )
     656             :             {
     657           0 :                 sal_uLong nPos = xReport->getReportHeaderOn() ? 2 : 1;
     658           0 :                 traverseSection(xReport->getReportHeader(),pParent,SID_REPORTHEADERFOOTER,nPos);
     659             :             }
     660           0 :             else if ( _rEvent.PropertyName == PROPERTY_PAGEHEADERON )
     661             :             {
     662           0 :                 traverseSection(xReport->getPageHeader(),pParent, SID_PAGEHEADERFOOTER,1);
     663             :             }
     664           0 :             else if ( _rEvent.PropertyName == PROPERTY_PAGEFOOTERON )
     665           0 :                 traverseSection(xReport->getPageFooter(),pParent, SID_PAGEHEADERFOOTER);
     666           0 :             else if ( _rEvent.PropertyName == PROPERTY_REPORTFOOTERON )
     667             :             {
     668           0 :                 sal_uLong nPos = xReport->getPageFooterOn() ? (GetLevelChildCount(pParent) - 1) : LIST_APPEND;
     669           0 :                 traverseSection(xReport->getReportFooter(),pParent,SID_REPORTHEADERFOOTER,nPos);
     670             :             }
     671             :         }
     672           0 :     }
     673           0 : }
     674             : // -----------------------------------------------------------------------------
     675           0 : void NavigatorTree::_elementInserted( const container::ContainerEvent& _rEvent )
     676             : {
     677           0 :     SvTreeListEntry* pEntry = find(_rEvent.Source);
     678           0 :     uno::Reference<beans::XPropertySet> xProp(_rEvent.Element,uno::UNO_QUERY_THROW);
     679           0 :     ::rtl::OUString sName;
     680           0 :     uno::Reference< beans::XPropertySetInfo> xInfo = xProp->getPropertySetInfo();
     681           0 :     if ( xInfo.is() )
     682             :     {
     683           0 :         if ( xInfo->hasPropertyByName(PROPERTY_NAME) )
     684           0 :             xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
     685           0 :         else if ( xInfo->hasPropertyByName(PROPERTY_EXPRESSION) )
     686           0 :             xProp->getPropertyValue(PROPERTY_EXPRESSION) >>= sName;
     687             :     }
     688           0 :     uno::Reference< report::XGroup> xGroup(xProp,uno::UNO_QUERY);
     689           0 :     if ( xGroup.is() )
     690             :     {
     691           0 :         reportdesign::OReportVisitor aSubVisitor(this);
     692           0 :         aSubVisitor.start(xGroup);
     693             :     }
     694             :     else
     695             :     {
     696           0 :         uno::Reference< report::XReportComponent> xElement(xProp,uno::UNO_QUERY);
     697           0 :         if ( xProp.is() )
     698           0 :             sName = lcl_getName(xProp);
     699           0 :         insertEntry(sName,pEntry,(!xElement.is() ? sal_uInt16(SID_RPT_NEW_FUNCTION) : lcl_getImageId(xElement)),LIST_APPEND,new UserData(this,xProp));
     700             :     }
     701           0 :     if ( !IsExpanded(pEntry) )
     702           0 :         Expand(pEntry);
     703           0 : }
     704             : // -----------------------------------------------------------------------------
     705           0 : void NavigatorTree::_elementRemoved( const container::ContainerEvent& _rEvent )
     706             : {
     707           0 :     uno::Reference<beans::XPropertySet> xProp(_rEvent.Element,uno::UNO_QUERY);
     708           0 :     SvTreeListEntry* pEntry = find(xProp);
     709             :     OSL_ENSURE(pEntry,"NavigatorTree::_elementRemoved: No Entry found!");
     710             : 
     711           0 :     if ( pEntry )
     712             :     {
     713           0 :         SvTreeListEntry* pParent = GetParent(pEntry);
     714           0 :         removeEntry(pEntry);
     715           0 :         PaintEntry(pParent);
     716           0 :     }
     717           0 : }
     718             : // -----------------------------------------------------------------------------
     719           0 : void NavigatorTree::_elementReplaced( const container::ContainerEvent& _rEvent )
     720             : {
     721           0 :     uno::Reference<beans::XPropertySet> xProp(_rEvent.ReplacedElement,uno::UNO_QUERY);
     722           0 :     SvTreeListEntry* pEntry = find(xProp);
     723           0 :     if ( pEntry )
     724             :     {
     725           0 :         UserData* pData = static_cast<UserData*>(pEntry->GetUserData());
     726           0 :         xProp.set(_rEvent.Element,uno::UNO_QUERY);
     727           0 :         pData->setContent(xProp);
     728           0 :         ::rtl::OUString sName;
     729           0 :         xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
     730           0 :         SetEntryText(pEntry,sName);
     731           0 :     }
     732           0 : }
     733             : // -----------------------------------------------------------------------------
     734           0 : void NavigatorTree::_disposing(const lang::EventObject& _rSource)throw( uno::RuntimeException)
     735             : {
     736           0 :     removeEntry(find(_rSource.Source));
     737           0 : }
     738             : // -----------------------------------------------------------------------------
     739           0 : void NavigatorTree::removeEntry(SvTreeListEntry* _pEntry,bool _bRemove)
     740             : {
     741           0 :     if ( _pEntry )
     742             :     {
     743           0 :         SvTreeListEntry* pChild = FirstChild(_pEntry);
     744           0 :         while( pChild )
     745             :         {
     746           0 :             removeEntry(pChild,false);
     747           0 :             pChild = NextSibling(pChild);
     748             :         }
     749           0 :         delete static_cast<UserData*>(_pEntry->GetUserData());
     750           0 :         if ( _bRemove )
     751           0 :             GetModel()->Remove(_pEntry);
     752             :     }
     753           0 : }
     754             : DBG_NAME(rpt_NavigatorTree_UserData)
     755             : // -----------------------------------------------------------------------------
     756           0 : NavigatorTree::UserData::UserData(NavigatorTree* _pTree,const uno::Reference<uno::XInterface>& _xContent)
     757             :     : OPropertyChangeListener(m_aMutex)
     758             :     , OContainerListener(m_aMutex)
     759             :     , m_xContent(_xContent)
     760           0 :     , m_pTree(_pTree)
     761             : {
     762             :     DBG_CTOR(rpt_NavigatorTree_UserData,NULL);
     763           0 :     uno::Reference<beans::XPropertySet> xProp(m_xContent,uno::UNO_QUERY);
     764           0 :     if ( xProp.is() )
     765             :     {
     766           0 :         uno::Reference< beans::XPropertySetInfo> xInfo = xProp->getPropertySetInfo();
     767           0 :         if ( xInfo.is() )
     768             :         {
     769           0 :             m_pListener = new ::comphelper::OPropertyChangeMultiplexer(this,xProp);
     770           0 :             if ( xInfo->hasPropertyByName(PROPERTY_NAME) )
     771           0 :                 m_pListener->addProperty(PROPERTY_NAME);
     772           0 :             else if ( xInfo->hasPropertyByName(PROPERTY_EXPRESSION) )
     773           0 :                 m_pListener->addProperty(PROPERTY_EXPRESSION);
     774           0 :             if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) )
     775           0 :                 m_pListener->addProperty(PROPERTY_DATAFIELD);
     776           0 :             if ( xInfo->hasPropertyByName(PROPERTY_LABEL) )
     777           0 :                 m_pListener->addProperty(PROPERTY_LABEL);
     778           0 :             if ( xInfo->hasPropertyByName(PROPERTY_HEADERON) )
     779           0 :                 m_pListener->addProperty(PROPERTY_HEADERON);
     780           0 :             if ( xInfo->hasPropertyByName(PROPERTY_FOOTERON) )
     781           0 :                 m_pListener->addProperty(PROPERTY_FOOTERON);
     782           0 :         }
     783             :     }
     784           0 :     uno::Reference< container::XContainer> xContainer(m_xContent,uno::UNO_QUERY);
     785           0 :     if ( xContainer.is() )
     786             :     {
     787           0 :         m_pContainerListener = new ::comphelper::OContainerListenerAdapter(this,xContainer);
     788           0 :     }
     789           0 : }
     790             : // -----------------------------------------------------------------------------
     791           0 : NavigatorTree::UserData::~UserData()
     792             : {
     793             :     DBG_DTOR(rpt_NavigatorTree_UserData,NULL);
     794           0 :     if ( m_pContainerListener.is() )
     795           0 :         m_pContainerListener->dispose();
     796           0 :     if ( m_pListener.is() )
     797           0 :         m_pListener->dispose();
     798           0 : }
     799             : // -----------------------------------------------------------------------------
     800             : // OPropertyChangeListener
     801           0 : void NavigatorTree::UserData::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException)
     802             : {
     803           0 :     SvTreeListEntry* pEntry = m_pTree->find(_rEvent.Source);
     804             :     OSL_ENSURE(pEntry,"No entry could be found! Why not!");
     805           0 :     const bool bFooterOn = (PROPERTY_FOOTERON == _rEvent.PropertyName);
     806             :     try
     807             :     {
     808           0 :         if ( bFooterOn || PROPERTY_HEADERON == _rEvent.PropertyName )
     809             :         {
     810           0 :             sal_Int32 nPos = 1;
     811           0 :             uno::Reference< report::XGroup> xGroup(_rEvent.Source,uno::UNO_QUERY);
     812           0 :             ::std::mem_fun_t< sal_Bool,OGroupHelper> pIsOn = ::std::mem_fun(&OGroupHelper::getHeaderOn);
     813           0 :             ::std::mem_fun_t< uno::Reference<report::XSection> ,OGroupHelper> pMemFunSection = ::std::mem_fun(&OGroupHelper::getHeader);
     814           0 :             if ( bFooterOn )
     815             :             {
     816           0 :                 pIsOn = ::std::mem_fun(&OGroupHelper::getFooterOn);
     817           0 :                 pMemFunSection = ::std::mem_fun(&OGroupHelper::getFooter);
     818           0 :                 nPos = m_pTree->GetChildCount(pEntry) - 1;
     819             :             }
     820             : 
     821           0 :             OGroupHelper aGroupHelper(xGroup);
     822           0 :             if ( pIsOn(&aGroupHelper) )
     823             :             {
     824           0 :                 if ( bFooterOn )
     825           0 :                     ++nPos;
     826           0 :                 m_pTree->traverseSection(pMemFunSection(&aGroupHelper),pEntry,bFooterOn ? SID_GROUPFOOTER : SID_GROUPHEADER,nPos);
     827           0 :             }
     828             :         }
     829           0 :         else if ( PROPERTY_EXPRESSION == _rEvent.PropertyName)
     830             :         {
     831           0 :             ::rtl::OUString sNewName;
     832           0 :             _rEvent.NewValue >>= sNewName;
     833           0 :             m_pTree->SetEntryText(pEntry,sNewName);
     834             :         }
     835           0 :         else if ( PROPERTY_DATAFIELD == _rEvent.PropertyName || PROPERTY_LABEL == _rEvent.PropertyName || PROPERTY_NAME == _rEvent.PropertyName )
     836             :         {
     837           0 :             uno::Reference<beans::XPropertySet> xProp(_rEvent.Source,uno::UNO_QUERY);
     838           0 :             m_pTree->SetEntryText(pEntry,lcl_getName(xProp));
     839             :         }
     840             :     }
     841           0 :     catch(const uno::Exception &)
     842             :     {}
     843           0 : }
     844             : // -----------------------------------------------------------------------------
     845           0 : void NavigatorTree::UserData::_elementInserted( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException)
     846             : {
     847           0 :     m_pTree->_elementInserted( _rEvent );
     848           0 : }
     849             : // -----------------------------------------------------------------------------
     850           0 : void NavigatorTree::UserData::_elementRemoved( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException)
     851             : {
     852           0 :     m_pTree->_elementRemoved( _rEvent );
     853           0 : }
     854             : // -----------------------------------------------------------------------------
     855           0 : void NavigatorTree::UserData::_elementReplaced( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException)
     856             : {
     857           0 :     m_pTree->_elementReplaced( _rEvent );
     858           0 : }
     859             : // -----------------------------------------------------------------------------
     860           0 : void NavigatorTree::UserData::_disposing(const lang::EventObject& _rSource) throw( uno::RuntimeException)
     861             : {
     862           0 :     m_pTree->_disposing( _rSource );
     863           0 : }
     864             : // -----------------------------------------------------------------------------
     865             : // class ONavigatorImpl
     866             : // -----------------------------------------------------------------------------
     867             : class ONavigatorImpl
     868             : {
     869             :     ONavigatorImpl(const ONavigatorImpl&);
     870             :     void operator =(const ONavigatorImpl&);
     871             : public:
     872             :     ONavigatorImpl(OReportController& _rController,ONavigator* _pParent);
     873             :     virtual ~ONavigatorImpl();
     874             : 
     875             :     uno::Reference< report::XReportDefinition>  m_xReport;
     876             :     ::rptui::OReportController&                 m_rController;
     877             :     ::std::auto_ptr<NavigatorTree>              m_pNavigatorTree;
     878             : };
     879             : 
     880           0 : ONavigatorImpl::ONavigatorImpl(OReportController& _rController,ONavigator* _pParent)
     881             :     :m_xReport(_rController.getReportDefinition())
     882             :     ,m_rController(_rController)
     883           0 :     ,m_pNavigatorTree(new NavigatorTree(_pParent,_rController))
     884             : {
     885           0 :     reportdesign::OReportVisitor aVisitor(m_pNavigatorTree.get());
     886           0 :     aVisitor.start(m_xReport);
     887           0 :     m_pNavigatorTree->Expand(m_pNavigatorTree->find(m_xReport));
     888           0 :     lang::EventObject aEvent(m_rController);
     889           0 :     m_pNavigatorTree->_selectionChanged(aEvent);
     890           0 : }
     891             : //------------------------------------------------------------------------
     892           0 : ONavigatorImpl::~ONavigatorImpl()
     893             : {
     894           0 : }
     895             : // -----------------------------------------------------------------------------
     896             : DBG_NAME( rpt_ONavigator )
     897             : const long STD_WIN_SIZE_X = 210;
     898             : const long STD_WIN_SIZE_Y = 280;
     899             : const long LISTBOX_BORDER = 2;
     900             : //========================================================================
     901             : // class ONavigator
     902             : //========================================================================
     903           0 : ONavigator::ONavigator( Window* _pParent
     904             :                         ,OReportController& _rController)
     905           0 :     : FloatingWindow( _pParent, ModuleRes(RID_NAVIGATOR) )
     906             : {
     907             :     DBG_CTOR( rpt_ONavigator,NULL);
     908             : 
     909           0 :     m_pImpl.reset(new ONavigatorImpl(_rController,this));
     910             : 
     911           0 :     FreeResource();
     912           0 :     m_pImpl->m_pNavigatorTree->Show();
     913           0 :     m_pImpl->m_pNavigatorTree->GrabFocus();
     914           0 :     SetSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
     915           0 :     Show();
     916             : 
     917           0 : }
     918             : // -----------------------------------------------------------------------------
     919             : 
     920             : //------------------------------------------------------------------------
     921           0 : ONavigator::~ONavigator()
     922             : {
     923             :     DBG_DTOR( rpt_ONavigator,NULL);
     924           0 : }
     925             : //------------------------------------------------------------------------------
     926           0 : void ONavigator::Resize()
     927             : {
     928           0 :     FloatingWindow::Resize();
     929             : 
     930           0 :     Size aSize( GetOutputSizePixel() );
     931             : 
     932             :     //////////////////////////////////////////////////////////////////////
     933             : 
     934             :     // Groesse der form::ListBox anpassen
     935           0 :     Point aLBPos( LISTBOX_BORDER, LISTBOX_BORDER );
     936           0 :     Size aLBSize( aSize );
     937           0 :     aLBSize.Width() -= (2*LISTBOX_BORDER);
     938           0 :     aLBSize.Height() -= (2*LISTBOX_BORDER);
     939             : 
     940           0 :     m_pImpl->m_pNavigatorTree->SetPosSizePixel( aLBPos, aLBSize );
     941           0 : }
     942             : // -----------------------------------------------------------------------------
     943             : // -----------------------------------------------------------------------------
     944           0 : void ONavigator::GetFocus()
     945             : {
     946           0 :     Window::GetFocus();
     947           0 :     if ( m_pImpl->m_pNavigatorTree.get() )
     948           0 :         m_pImpl->m_pNavigatorTree->GrabFocus();
     949           0 : }
     950             : // =============================================================================
     951             : } // rptui
     952             : // =============================================================================
     953             : 
     954             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10