LCOV - code coverage report
Current view: top level - svtools/source/control - roadmap.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 398 0.0 %
Date: 2012-08-25 Functions: 0 80 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 364 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 <svtools/roadmap.hxx>
      30                 :            : 
      31                 :            : #ifndef _STRING_HXX
      32                 :            : #define _STRING_HXX
      33                 :            : #endif
      34                 :            : 
      35                 :            : #include <vector>
      36                 :            : #include <algorithm>
      37                 :            : #include <vcl/bitmap.hxx>
      38                 :            : #include <tools/color.hxx>
      39                 :            : #include <rtl/ustring.hxx>
      40                 :            : #include <boost/scoped_ptr.hpp>
      41                 :            : 
      42                 :            : #define ROADMAP_INDENT_X        4
      43                 :            : #define ROADMAP_INDENT_Y        27
      44                 :            : #define ROADMAP_ITEM_DISTANCE_Y 6
      45                 :            : #define RMINCOMPLETE        -1
      46                 :            : 
      47                 :            : //.........................................................................
      48                 :            : namespace svt
      49                 :            : {
      50                 :            : //.........................................................................
      51                 :            : 
      52                 :            :     typedef std::vector< RoadmapItem* > HL_Vector;
      53                 :            : 
      54                 :            :     //=====================================================================
      55                 :            :     //= ColorChanger
      56                 :            :     //=====================================================================
      57                 :            :     class IDLabel :  public FixedText
      58                 :            :     {
      59                 :            :     public:
      60                 :            :         IDLabel( Window* _pParent, WinBits _nWinStyle = 0 );
      61                 :            :         ~IDLabel( );
      62                 :            :         virtual void    DataChanged( const DataChangedEvent& rDCEvt );
      63                 :            :     };
      64                 :            : 
      65                 :            :     //=====================================================================
      66                 :            :     //= ColorChanger
      67                 :            :     //=====================================================================
      68                 :            :     class ColorChanger
      69                 :            :     {
      70                 :            :     protected:
      71                 :            :         OutputDevice*   m_pDev;
      72                 :            : 
      73                 :            :     public:
      74                 :            :         ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor, const Color& _rNewFillColor )
      75                 :            :             :m_pDev( _pDev )
      76                 :            :         {
      77                 :            :             m_pDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
      78                 :            :             m_pDev->SetLineColor( _rNewLineColor );
      79                 :            :             m_pDev->SetFillColor( _rNewFillColor );
      80                 :            :         }
      81                 :            : 
      82                 :            :         ~ColorChanger()
      83                 :            :         {
      84                 :            :             m_pDev->Pop();
      85                 :            :         }
      86                 :            :     };
      87                 :            : 
      88                 :            :     //=====================================================================
      89                 :            :     //= RoadmapItem
      90                 :            :     //=====================================================================
      91                 :            :     class RoadmapItem : public RoadmapTypes
      92                 :            :     {
      93                 :            :     private:
      94                 :            :         IDLabel*                mpID;
      95                 :            :         HyperLabel*             mpDescription;
      96                 :            :         const Size              m_aItemPlayground;
      97                 :            : 
      98                 :            :     public:
      99                 :            :         RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground );
     100                 :            :         ~RoadmapItem( );
     101                 :            : 
     102                 :            :         void                    SetID( sal_Int16 _ID );
     103                 :            :         sal_Int16               GetID() const;
     104                 :            : 
     105                 :            :         void                    SetIndex( ItemIndex _Index );
     106                 :            :         ItemIndex               GetIndex() const;
     107                 :            : 
     108                 :            :         void                    Update( ItemIndex _RMIndex, const ::rtl::OUString& _rText );
     109                 :            : 
     110                 :            :         void                    SetPosition( RoadmapItem* OldHyperLabel );
     111                 :            : 
     112                 :            :         void                    ToggleBackgroundColor( const Color& _rGBColor );
     113                 :            :         void                    SetInteractive( sal_Bool _bInteractive );
     114                 :            : 
     115                 :            :         void                    SetClickHdl( const Link& rLink );
     116                 :            :         void                    Enable( sal_Bool bEnable = sal_True);
     117                 :            :         sal_Bool                    IsEnabled() const;
     118                 :            :         void                    GrabFocus();
     119                 :            : 
     120                 :            :         bool                    Contains( const Window* _pWindow ) const;
     121                 :            : 
     122                 :          0 :         HyperLabel*             GetDescriptionHyperLabel() const { return mpDescription; }
     123                 :            : 
     124                 :            :     private:
     125                 :            :         void                    ImplUpdateIndex( const ItemIndex _nIndex );
     126                 :            :         void                    ImplUpdatePosSize();
     127                 :            :     };
     128                 :            : 
     129                 :            :     //=====================================================================
     130                 :            :     //= RoadmapImpl
     131                 :            :     //=====================================================================
     132                 :          0 :     class RoadmapImpl : public RoadmapTypes
     133                 :            :     {
     134                 :            :     protected:
     135                 :            :         const ORoadmap&     m_rAntiImpl;
     136                 :            :         Link                m_aSelectHdl;
     137                 :            :         BitmapEx            m_aPicture;
     138                 :            :         HL_Vector           m_aRoadmapSteps;
     139                 :            :         ItemId              m_iCurItemID;
     140                 :            :         sal_Bool            m_bInteractive;
     141                 :            :         sal_Bool            m_bComplete;
     142                 :            :         Size                m_aItemSizePixel;
     143                 :            : 
     144                 :            :     public:
     145                 :          0 :         RoadmapImpl( const ORoadmap& _rAntiImpl )
     146                 :            :             :m_rAntiImpl( _rAntiImpl )
     147                 :            :             ,m_iCurItemID( -1 )
     148                 :            :             ,m_bInteractive( sal_True )
     149         [ #  # ]:          0 :             ,m_bComplete( sal_True )
     150                 :            :         {
     151                 :          0 :         }
     152                 :            : 
     153                 :            :         RoadmapItem* InCompleteHyperLabel;
     154                 :            : 
     155                 :            :         void                addHyperLabel( RoadmapItem*  _rRoadmapStep ) { m_aRoadmapSteps.push_back(_rRoadmapStep); }
     156                 :            : 
     157                 :          0 :         HL_Vector&          getHyperLabels() { return m_aRoadmapSteps; }
     158                 :            :         const HL_Vector&    getHyperLabels() const { return m_aRoadmapSteps; }
     159                 :            : 
     160 [ #  # ][ #  # ]:          0 :         void                insertHyperLabel( ItemIndex _Index, RoadmapItem* _rRoadmapStep ) { m_aRoadmapSteps.insert( m_aRoadmapSteps.begin() + _Index, _rRoadmapStep ); }
     161                 :            : 
     162                 :          0 :         ItemIndex           getItemCount() const { return m_aRoadmapSteps.size();}
     163                 :            : 
     164                 :          0 :         void                setCurItemID( ItemId i ) {m_iCurItemID = i; }
     165                 :          0 :         ItemId              getCurItemID() const { return m_iCurItemID; }
     166                 :            : 
     167                 :          0 :         void                setInteractive(const sal_Bool _bInteractive) {m_bInteractive = _bInteractive; }
     168                 :          0 :         sal_Bool            isInteractive() const { return m_bInteractive; };
     169                 :            : 
     170                 :          0 :         void                setComplete(const sal_Bool _bComplete) {m_bComplete = _bComplete; }
     171                 :          0 :         sal_Bool            isComplete() const { return m_bComplete; };
     172                 :            : 
     173                 :          0 :         void                setPicture( const BitmapEx& _rPic ) { m_aPicture = _rPic; }
     174                 :          0 :         const BitmapEx&     getPicture( ) const { return m_aPicture; }
     175                 :            : 
     176                 :          0 :         void                setSelectHdl( const Link& _rHdl ) { m_aSelectHdl = _rHdl; }
     177                 :          0 :         const Link&         getSelectHdl( ) const { return m_aSelectHdl; }
     178                 :            : 
     179                 :            :         void                initItemSize();
     180                 :          0 :         const Size&         getItemSize() const { return m_aItemSizePixel; }
     181                 :            : 
     182                 :          0 :         void removeHyperLabel( ItemIndex _Index )
     183                 :            :         {
     184 [ #  # ][ #  # ]:          0 :             if ( ( _Index > -1 ) && ( _Index < getItemCount() ) )
                 [ #  # ]
     185                 :            :             {
     186         [ #  # ]:          0 :                 delete m_aRoadmapSteps[_Index];
     187 [ #  # ][ #  # ]:          0 :                 m_aRoadmapSteps.erase( m_aRoadmapSteps.begin() + _Index);
     188                 :            :             }
     189                 :          0 :         }
     190                 :            :     };
     191                 :            : 
     192                 :            :     //---------------------------------------------------------------------
     193                 :          0 :     void RoadmapImpl::initItemSize()
     194                 :            :     {
     195                 :          0 :         Size aLabelSize( m_rAntiImpl.GetOutputSizePixel() );
     196 [ #  # ][ #  # ]:          0 :         aLabelSize.Height() = m_rAntiImpl.LogicToPixel( Size( 0, LABELBASEMAPHEIGHT ), MAP_APPFONT ).Height();
                 [ #  # ]
     197 [ #  # ][ #  # ]:          0 :         aLabelSize.Width() -= m_rAntiImpl.LogicToPixel( Size( 2 * ROADMAP_INDENT_X, 0 ), MAP_APPFONT ).Width();
                 [ #  # ]
     198                 :          0 :         m_aItemSizePixel = aLabelSize;
     199                 :          0 :     }
     200                 :            : 
     201                 :            :     //=====================================================================
     202                 :            :     //= Roadmap
     203                 :            :     //=====================================================================
     204                 :            :     //---------------------------------------------------------------------
     205                 :          0 :     ORoadmap::ORoadmap( Window* _pParent, WinBits _nWinStyle )
     206                 :            :         :Control( _pParent, _nWinStyle )
     207 [ #  # ][ #  # ]:          0 :         ,m_pImpl( new RoadmapImpl( *this ) )
     208                 :            : 
     209                 :            :     {
     210         [ #  # ]:          0 :         implInit();
     211                 :          0 :     }
     212                 :            : 
     213                 :            :     //---------------------------------------------------------------------
     214                 :          0 :     void ORoadmap::implInit()
     215                 :            :     {
     216                 :          0 :         const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     217                 :          0 :         Color aTextColor = rStyleSettings.GetFieldTextColor();
     218         [ #  # ]:          0 :         Font aFont = GetFont( );
     219         [ #  # ]:          0 :         aFont.SetColor( aTextColor );
     220         [ #  # ]:          0 :         aFont.SetWeight( WEIGHT_BOLD );
     221         [ #  # ]:          0 :         aFont.SetUnderline( UNDERLINE_SINGLE );
     222         [ #  # ]:          0 :         SetFont( aFont );
     223 [ #  # ][ #  # ]:          0 :         SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) );
                 [ #  # ]
     224                 :          0 :         m_pImpl->InCompleteHyperLabel = NULL;
     225                 :          0 :         m_pImpl->setCurItemID(-1 );
     226                 :          0 :         m_pImpl->setComplete( sal_True );
     227                 :            : 
     228                 :            :         // Roadmap control should be reachable as one unit with a Tab key
     229                 :            :         // the next Tab key should spring out of the control.
     230                 :            :         // To reach it the control itself should get focus and set it
     231                 :            :         // on entries. The entries themself should not be reachable with
     232                 :            :         // the Tab key directly. So each entry should have WB_NOTABSTOP.
     233                 :            :         //
     234                 :            :         // In other words the creator should create the control with the following
     235                 :            :         // flags:
     236                 :            :         // SetStyle( ( GetStyle() | WB_TABSTOP ) & ~WB_DIALOGCONTROL );
     237                 :            : 
     238                 :            : // TODO: if somebody sets a new font from outside (OutputDevice::SetFont), we would have to react
     239                 :            : // on this with calculating a new bold font.
     240                 :            : // Unfortunately, the OutputDevice does not offer a notify mechanism for a changed font.
     241                 :            : // So settings the font from outside is simply a forbidded scenario at the moment
     242 [ #  # ][ #  # ]:          0 :         EnableMapMode( sal_False );
     243                 :          0 :     }
     244                 :            : 
     245                 :            :     //---------------------------------------------------------------------
     246                 :          0 :     ORoadmap::~ORoadmap( )
     247                 :            :     {
     248         [ #  # ]:          0 :         HL_Vector aItemsCopy = m_pImpl->getHyperLabels();
     249                 :          0 :         m_pImpl->getHyperLabels().clear();
     250 [ #  # ][ #  # ]:          0 :         for ( HL_Vector::iterator i = aItemsCopy.begin(); i< aItemsCopy.end(); ++i )
     251                 :            :         {
     252 [ #  # ][ #  # ]:          0 :             delete *i;
     253                 :            :         }
     254         [ #  # ]:          0 :         if ( ! m_pImpl->isComplete() )
     255 [ #  # ][ #  # ]:          0 :             delete m_pImpl->InCompleteHyperLabel;
     256 [ #  # ][ #  # ]:          0 :         delete m_pImpl;
     257                 :          0 :         m_pImpl = NULL;
     258         [ #  # ]:          0 :     }
     259                 :            : 
     260                 :            : 
     261                 :          0 :     RoadmapTypes::ItemId ORoadmap::GetCurrentRoadmapItemID() const
     262                 :            :     {
     263                 :          0 :         return m_pImpl->getCurItemID();
     264                 :            :     }
     265                 :            : 
     266                 :            : 
     267                 :          0 :     RoadmapItem* ORoadmap::GetPreviousHyperLabel( ItemIndex _Index)
     268                 :            :     {
     269                 :          0 :         RoadmapItem* pOldItem = NULL;
     270         [ #  # ]:          0 :         if ( _Index > 0 )
     271                 :          0 :             pOldItem = m_pImpl->getHyperLabels().at( _Index - 1 );
     272                 :          0 :         return pOldItem;
     273                 :            :     }
     274                 :            : 
     275                 :            : 
     276                 :            :        //---------------------------------------------------------------------
     277                 :            : 
     278                 :          0 :     RoadmapItem* ORoadmap::InsertHyperLabel( ItemIndex _Index, const ::rtl::OUString& _sLabel, ItemId _RMID, sal_Bool _bEnabled)
     279                 :            :     {
     280         [ #  # ]:          0 :         if ( m_pImpl->getItemCount() == 0 )
     281                 :          0 :             m_pImpl->initItemSize();
     282                 :            : 
     283                 :          0 :         RoadmapItem* pItem = NULL;
     284                 :          0 :         RoadmapItem* pOldItem = GetPreviousHyperLabel( _Index );
     285                 :            : 
     286         [ #  # ]:          0 :         pItem = new RoadmapItem( *this, m_pImpl->getItemSize() );
     287         [ #  # ]:          0 :         if ( _RMID != RMINCOMPLETE )
     288                 :            :         {
     289                 :          0 :             pItem->SetInteractive( m_pImpl->isInteractive() );
     290                 :          0 :             m_pImpl->insertHyperLabel( _Index, pItem );
     291                 :            :         }
     292                 :            :         else
     293                 :            :         {
     294                 :          0 :             pItem->SetInteractive( sal_False );
     295                 :            :         }
     296                 :          0 :         pItem->SetPosition( pOldItem );
     297                 :          0 :         pItem->Update( _Index, _sLabel );
     298                 :          0 :         pItem->SetClickHdl(LINK( this, ORoadmap, ImplClickHdl ) );
     299                 :          0 :         pItem->SetID( _RMID );
     300                 :          0 :         pItem->SetIndex( _Index );
     301         [ #  # ]:          0 :         if (!_bEnabled)
     302                 :          0 :             pItem->Enable( _bEnabled );
     303                 :          0 :         return pItem;
     304                 :            :     }
     305                 :            : 
     306                 :            :     //---------------------------------------------------------------------
     307                 :          0 :     void ORoadmap::SetRoadmapBitmap( const BitmapEx& _rBmp, sal_Bool _bInvalidate )
     308                 :            :     {
     309                 :          0 :         m_pImpl->setPicture( _rBmp );
     310         [ #  # ]:          0 :         if ( _bInvalidate )
     311                 :          0 :             Invalidate( );
     312                 :          0 :     }
     313                 :            : 
     314                 :            :     //---------------------------------------------------------------------
     315                 :          0 :     void ORoadmap::SetRoadmapInteractive( sal_Bool _bInteractive )
     316                 :            :     {
     317                 :          0 :         m_pImpl->setInteractive( _bInteractive );
     318                 :            : 
     319                 :          0 :         const HL_Vector& rItems = m_pImpl->getHyperLabels();
     320 [ #  # ][ #  # ]:          0 :         for (   HL_Vector::const_iterator i = rItems.begin();
     321                 :          0 :                 i < rItems.end();
     322                 :            :                 ++i
     323                 :            :             )
     324                 :            :         {
     325         [ #  # ]:          0 :             (*i)->SetInteractive( _bInteractive );
     326                 :            :         }
     327                 :          0 :     }
     328                 :            : 
     329                 :            :     //---------------------------------------------------------------------
     330                 :          0 :     sal_Bool ORoadmap::IsRoadmapInteractive()
     331                 :            :     {
     332                 :          0 :         return m_pImpl->isInteractive();
     333                 :            :     }
     334                 :            : 
     335                 :            :     //---------------------------------------------------------------------
     336                 :          0 :     void ORoadmap::SetRoadmapComplete( sal_Bool _bComplete )
     337                 :            :     {
     338                 :          0 :         sal_Bool bWasComplete = m_pImpl->isComplete();
     339                 :          0 :         m_pImpl->setComplete( _bComplete );
     340         [ #  # ]:          0 :         if ( _bComplete )
     341                 :            :         {
     342         [ #  # ]:          0 :             if ( m_pImpl->InCompleteHyperLabel != NULL)
     343                 :            :             {
     344         [ #  # ]:          0 :                 delete m_pImpl->InCompleteHyperLabel;
     345                 :          0 :                 m_pImpl->InCompleteHyperLabel = NULL;
     346                 :            :             }
     347                 :            :         }
     348         [ #  # ]:          0 :         else if ( bWasComplete )
     349         [ #  # ]:          0 :             m_pImpl->InCompleteHyperLabel = InsertHyperLabel( m_pImpl->getItemCount(), rtl::OUString("..."), RMINCOMPLETE );
     350                 :          0 :     }
     351                 :            : 
     352                 :            :     //---------------------------------------------------------------------
     353                 :          0 :     void ORoadmap::UpdatefollowingHyperLabels( ItemIndex _nIndex )
     354                 :            :     {
     355                 :          0 :         const HL_Vector& rItems = m_pImpl->getHyperLabels();
     356         [ #  # ]:          0 :         if ( _nIndex < (ItemIndex)rItems.size() )
     357                 :            :         {
     358                 :          0 :             RoadmapItem* pItem = NULL;
     359 [ #  # ][ #  # ]:          0 :             for (   HL_Vector::const_iterator i = rItems.begin() + _nIndex;
                 [ #  # ]
     360                 :          0 :                     i< rItems.end();
     361                 :            :                     ++i, ++_nIndex
     362                 :            :                 )
     363                 :            :             {
     364                 :          0 :                 pItem = *i;
     365                 :            : 
     366         [ #  # ]:          0 :                 pItem->SetIndex( _nIndex );
     367 [ #  # ][ #  # ]:          0 :                 pItem->SetPosition( GetPreviousHyperLabel( _nIndex ) );
     368                 :            :             }
     369                 :            :         }
     370         [ #  # ]:          0 :         if ( ! m_pImpl->isComplete() )
     371                 :            :         {
     372                 :          0 :             RoadmapItem* pOldItem = GetPreviousHyperLabel( m_pImpl->getItemCount() );
     373                 :          0 :             m_pImpl->InCompleteHyperLabel->SetPosition( pOldItem );
     374         [ #  # ]:          0 :             m_pImpl->InCompleteHyperLabel->Update( m_pImpl->getItemCount(), rtl::OUString("...") );
     375                 :            :         }
     376                 :          0 :     }
     377                 :            : 
     378                 :            :     //---------------------------------------------------------------------
     379                 :          0 :     void ORoadmap::ReplaceRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _RMID, sal_Bool _bEnabled )
     380                 :            :     {
     381                 :          0 :         RoadmapItem* pItem = GetByIndex( _Index);
     382         [ #  # ]:          0 :         if ( pItem != NULL )
     383                 :            :         {
     384                 :          0 :             pItem->Update( _Index,  _RoadmapItem );
     385                 :          0 :             pItem->SetID( _RMID );
     386                 :          0 :             pItem->Enable( _bEnabled );
     387                 :            :         }
     388                 :          0 :     }
     389                 :            : 
     390                 :            :     //---------------------------------------------------------------------
     391                 :          0 :     RoadmapTypes::ItemIndex ORoadmap::GetItemCount() const
     392                 :            :     {
     393                 :          0 :         return m_pImpl->getItemCount();
     394                 :            :     }
     395                 :            : 
     396                 :            :     //---------------------------------------------------------------------
     397                 :          0 :     RoadmapTypes::ItemId ORoadmap::GetItemID( ItemIndex _nIndex ) const
     398                 :            :     {
     399                 :          0 :         const RoadmapItem* pHyperLabel = GetByIndex( _nIndex );
     400         [ #  # ]:          0 :         if ( pHyperLabel )
     401                 :          0 :             return pHyperLabel->GetID();
     402                 :          0 :         return -1;
     403                 :            :     }
     404                 :            : 
     405                 :            :     //---------------------------------------------------------------------
     406                 :          0 :     void ORoadmap::InsertRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled )
     407                 :            :     {
     408                 :          0 :         InsertHyperLabel( _Index, _RoadmapItem, _nUniqueId, _bEnabled );
     409                 :            :             // Todo: YPos is superfluous, if items are always appended
     410                 :          0 :         UpdatefollowingHyperLabels( _Index + 1 );
     411                 :          0 :     }
     412                 :            : 
     413                 :            :     //---------------------------------------------------------------------
     414                 :          0 :     void ORoadmap::DeleteRoadmapItem( ItemIndex _Index )
     415                 :            :     {
     416 [ #  # ][ #  # ]:          0 :         if ( m_pImpl->getItemCount() > 0 && ( _Index > -1)  &&  ( _Index < m_pImpl->getItemCount() ) )
         [ #  # ][ #  # ]
     417                 :            :         {
     418                 :          0 :             m_pImpl->removeHyperLabel( _Index );
     419                 :          0 :             UpdatefollowingHyperLabels( _Index );
     420                 :            :         }
     421                 :          0 :     }
     422                 :            : 
     423                 :            :     //---------------------------------------------------------------------
     424                 :          0 :     sal_Bool ORoadmap::IsRoadmapComplete( ) const
     425                 :            :     {
     426                 :          0 :         return m_pImpl->isComplete();
     427                 :            :     }
     428                 :            : 
     429                 :            :     //---------------------------------------------------------------------
     430                 :          0 :     void ORoadmap::EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex )
     431                 :            :     {
     432                 :          0 :         RoadmapItem* pItem = GetByID( _nItemId, _nStartIndex );
     433         [ #  # ]:          0 :         if ( pItem != NULL )
     434                 :          0 :             pItem->Enable( _bEnable );
     435                 :          0 :     }
     436                 :            : 
     437                 :            :     //---------------------------------------------------------------------
     438                 :          0 :     void ORoadmap::ChangeRoadmapItemLabel( ItemId _nID, const ::rtl::OUString& _sLabel, ItemIndex _nStartIndex )
     439                 :            :     {
     440                 :          0 :         RoadmapItem* pItem = GetByID( _nID, _nStartIndex );
     441         [ #  # ]:          0 :         if ( pItem != NULL )
     442                 :            :         {
     443                 :          0 :             pItem->Update( pItem->GetIndex(), _sLabel );
     444                 :            : 
     445                 :          0 :             const HL_Vector& rItems = m_pImpl->getHyperLabels();
     446 [ #  # ][ #  # ]:          0 :             for (   HL_Vector::const_iterator i = rItems.begin() + _nStartIndex;
                 [ #  # ]
     447                 :          0 :                     i < rItems.end();
     448                 :            :                     ++i
     449                 :            :                 )
     450                 :            :             {
     451 [ #  # ][ #  # ]:          0 :                 (*i)->SetPosition( GetPreviousHyperLabel( i - rItems.begin() ) );
                 [ #  # ]
     452                 :            :             }
     453                 :            :         }
     454                 :          0 :     }
     455                 :            : 
     456                 :            :     //---------------------------------------------------------------------
     457                 :          0 :     void ORoadmap::ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex )
     458                 :            :     {
     459                 :          0 :         RoadmapItem* pItem = GetByID( _nID, _nStartIndex );
     460         [ #  # ]:          0 :         if ( pItem != NULL )
     461                 :          0 :             pItem->SetID( _NewID );
     462                 :          0 :     }
     463                 :            : 
     464                 :            :     //---------------------------------------------------------------------
     465                 :          0 :     RoadmapItem* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex)
     466                 :            :     {
     467                 :          0 :         ItemId nLocID = 0;
     468                 :          0 :         const HL_Vector& rItems = m_pImpl->getHyperLabels();
     469 [ #  # ][ #  # ]:          0 :         for (   HL_Vector::const_iterator i = rItems.begin() + _nStartIndex;
                 [ #  # ]
     470                 :          0 :                 i < rItems.end();
     471                 :            :                 ++i
     472                 :            :             )
     473                 :            :         {
     474         [ #  # ]:          0 :             nLocID = (*i)->GetID();
     475         [ #  # ]:          0 :             if ( nLocID == _nID )
     476                 :          0 :                 return *i;
     477                 :            :         }
     478                 :          0 :         return NULL;
     479                 :            :     }
     480                 :            : 
     481                 :            :     //---------------------------------------------------------------------
     482                 :          0 :     const RoadmapItem* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex  ) const
     483                 :            :     {
     484                 :          0 :         return const_cast< ORoadmap* >( this )->GetByID( _nID, _nStartIndex );
     485                 :            :     }
     486                 :            : 
     487                 :            :     //---------------------------------------------------------------------
     488                 :          0 :     RoadmapItem* ORoadmap::GetByIndex( ItemIndex _nItemIndex)
     489                 :            :     {
     490                 :          0 :         const HL_Vector& rItems = m_pImpl->getHyperLabels();
     491 [ #  # ][ #  # ]:          0 :         if ( ( _nItemIndex > -1 ) && ( _nItemIndex < (ItemIndex)rItems.size() ) )
                 [ #  # ]
     492                 :            :         {
     493                 :          0 :             return rItems.at( _nItemIndex );
     494                 :            :         }
     495                 :          0 :         return NULL;
     496                 :            :     }
     497                 :            : 
     498                 :            :     //---------------------------------------------------------------------
     499                 :          0 :     const RoadmapItem* ORoadmap::GetByIndex( ItemIndex _nItemIndex ) const
     500                 :            :     {
     501                 :          0 :         return const_cast< ORoadmap* >( this )->GetByIndex( _nItemIndex );
     502                 :            :     }
     503                 :            : 
     504                 :            :     //---------------------------------------------------------------------
     505                 :          0 :     RoadmapTypes::ItemId ORoadmap::GetNextAvailableItemId( ItemIndex _nNewIndex )
     506                 :            :     {
     507                 :          0 :         RoadmapItem* pItem = NULL;
     508                 :            : 
     509                 :          0 :         ItemIndex searchIndex = ++_nNewIndex;
     510         [ #  # ]:          0 :         while ( searchIndex < m_pImpl->getItemCount() )
     511                 :            :         {
     512                 :          0 :             pItem = GetByIndex( searchIndex );
     513         [ #  # ]:          0 :             if ( pItem->IsEnabled() )
     514                 :          0 :                 return pItem->GetID( );
     515                 :            : 
     516                 :          0 :             ++searchIndex;
     517                 :            :         }
     518                 :          0 :         return -1;
     519                 :            :     }
     520                 :            : 
     521                 :            :     //---------------------------------------------------------------------
     522                 :          0 :     RoadmapTypes::ItemId ORoadmap::GetPreviousAvailableItemId( ItemIndex _nNewIndex )
     523                 :            :     {
     524                 :          0 :         RoadmapItem* pItem = NULL;
     525                 :          0 :         ItemIndex searchIndex = --_nNewIndex;
     526         [ #  # ]:          0 :         while ( searchIndex > -1 )
     527                 :            :         {
     528                 :          0 :             pItem = GetByIndex( searchIndex );
     529         [ #  # ]:          0 :             if ( pItem->IsEnabled() )
     530                 :          0 :                 return pItem->GetID( );
     531                 :            : 
     532                 :          0 :             searchIndex--;
     533                 :            :         }
     534                 :          0 :         return -1;
     535                 :            :     }
     536                 :            : 
     537                 :            :     //---------------------------------------------------------------------
     538                 :          0 :     void ORoadmap::DeselectOldRoadmapItems()
     539                 :            :     {
     540                 :          0 :         const HL_Vector& rItems = m_pImpl->getHyperLabels();
     541 [ #  # ][ #  # ]:          0 :         for (   HL_Vector::const_iterator i = rItems.begin();
     542                 :          0 :                 i < rItems.end();
     543                 :            :                 ++i
     544                 :            :             )
     545                 :            :         {
     546         [ #  # ]:          0 :             (*i)->ToggleBackgroundColor( COL_TRANSPARENT );
     547                 :            :         }
     548                 :          0 :     }
     549                 :            : 
     550                 :            :     //---------------------------------------------------------------------
     551                 :          0 :     void ORoadmap::SetItemSelectHdl( const Link& _rHdl )
     552                 :            :     {
     553                 :          0 :         m_pImpl->setSelectHdl( _rHdl );
     554                 :          0 :     }
     555                 :            : 
     556                 :            :     //---------------------------------------------------------------------
     557                 :          0 :     Link ORoadmap::GetItemSelectHdl( ) const
     558                 :            :     {
     559                 :          0 :         return m_pImpl->getSelectHdl();
     560                 :            :     }
     561                 :            : 
     562                 :            :     //---------------------------------------------------------------------
     563                 :          0 :     void ORoadmap::Select()
     564                 :            :     {
     565         [ #  # ]:          0 :         GetItemSelectHdl().Call( this );
     566                 :          0 :         CallEventListeners( VCLEVENT_ROADMAP_ITEMSELECTED );
     567                 :          0 :     }
     568                 :            : 
     569                 :            :     //---------------------------------------------------------------------
     570                 :          0 :     void ORoadmap::GetFocus()
     571                 :            :     {
     572                 :          0 :         RoadmapItem* pCurHyperLabel = GetByID( GetCurrentRoadmapItemID() );
     573         [ #  # ]:          0 :         if ( pCurHyperLabel != NULL )
     574                 :          0 :             pCurHyperLabel->GrabFocus();
     575                 :          0 :     }
     576                 :            : 
     577                 :            :     //---------------------------------------------------------------------
     578                 :          0 :     sal_Bool ORoadmap::SelectRoadmapItemByID( ItemId _nNewID )
     579                 :            :     {
     580                 :          0 :         DeselectOldRoadmapItems();
     581                 :          0 :         RoadmapItem* pItem = GetByID( _nNewID );
     582         [ #  # ]:          0 :         if ( pItem != NULL )
     583                 :            :         {
     584         [ #  # ]:          0 :             if ( pItem->IsEnabled() )
     585                 :            :             {
     586                 :          0 :                 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     587                 :          0 :                 pItem->ToggleBackgroundColor( rStyleSettings.GetHighlightColor() ); //HighlightColor
     588                 :            : 
     589                 :          0 :                 pItem->GrabFocus();
     590                 :          0 :                 m_pImpl->setCurItemID(_nNewID);
     591                 :            : 
     592                 :          0 :                 Select();
     593                 :          0 :                 return sal_True;
     594                 :            :             }
     595                 :            :         }
     596                 :          0 :         return sal_False;
     597                 :            :     }
     598                 :            : 
     599                 :            :     //---------------------------------------------------------------------
     600                 :          0 :     void ORoadmap::Paint( const Rectangle& _rRect )
     601                 :            :     {
     602                 :          0 :         Control::Paint( _rRect );
     603                 :            : 
     604                 :            : 
     605                 :            :         // draw the bitmap
     606         [ #  # ]:          0 :         if ( !!m_pImpl->getPicture() )
     607                 :            :         {
     608                 :          0 :             Size aBitmapSize = m_pImpl->getPicture().GetSizePixel();
     609                 :          0 :             Size aMySize = GetOutputSizePixel();
     610                 :            : 
     611                 :          0 :             Point aBitmapPos( aMySize.Width() - aBitmapSize.Width(),  aMySize.Height() - aBitmapSize.Height() );
     612                 :            : 
     613                 :            :             // draw it
     614         [ #  # ]:          0 :             DrawBitmapEx( aBitmapPos, m_pImpl->getPicture() );
     615                 :            :         }
     616                 :            : 
     617                 :            :         //.................................................................
     618                 :            :         // draw the headline
     619                 :          0 :         DrawHeadline();
     620                 :          0 :     }
     621                 :            : 
     622                 :            :     //---------------------------------------------------------------------
     623                 :          0 :     void ORoadmap::DrawHeadline()
     624                 :            :     {
     625 [ #  # ][ #  # ]:          0 :         Point aTextPos = LogicToPixel( Point( ROADMAP_INDENT_X, 8 ), MAP_APPFONT );
                 [ #  # ]
     626                 :            : 
     627                 :          0 :         Size aOutputSize( GetOutputSizePixel() );
     628                 :            : 
     629                 :            :         // draw it
     630 [ #  # ][ #  # ]:          0 :         DrawText( Rectangle( aTextPos, aOutputSize ), GetText(), TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
         [ #  # ][ #  # ]
     631         [ #  # ]:          0 :         DrawTextLine( aTextPos, aOutputSize.Width(), STRIKEOUT_NONE, UNDERLINE_SINGLE, UNDERLINE_NONE, sal_False );
     632                 :          0 :         const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     633         [ #  # ]:          0 :         SetLineColor( rStyleSettings.GetFieldTextColor());
     634         [ #  # ]:          0 :         SetTextColor(rStyleSettings.GetFieldTextColor());
     635                 :          0 :     }
     636                 :            : 
     637                 :            :     //---------------------------------------------------------------------
     638                 :          0 :     RoadmapItem* ORoadmap::GetByPointer(Window* pWindow)
     639                 :            :     {
     640                 :          0 :         const HL_Vector& rItems = m_pImpl->getHyperLabels();
     641 [ #  # ][ #  # ]:          0 :         for (   HL_Vector::const_iterator i = rItems.begin();
     642                 :          0 :                 i < rItems.end();
     643                 :            :                 ++i
     644                 :            :             )
     645                 :            :         {
     646         [ #  # ]:          0 :             if ( (*i)->Contains( pWindow ) )
     647                 :          0 :                 return *i;
     648                 :            :         }
     649                 :          0 :         return NULL;
     650                 :            :     }
     651                 :            : 
     652                 :            :     //---------------------------------------------------------------------
     653                 :          0 :     long ORoadmap::PreNotify( NotifyEvent& _rNEvt )
     654                 :            :     {
     655                 :            :         // capture KeyEvents for taskpane cycling
     656         [ #  # ]:          0 :         if ( _rNEvt.GetType() == EVENT_KEYINPUT )
     657                 :            :         {
     658                 :          0 :             Window* pWindow = _rNEvt.GetWindow();
     659                 :          0 :             RoadmapItem* pItem = GetByPointer( pWindow );
     660         [ #  # ]:          0 :             if ( pItem != NULL )
     661                 :            :             {
     662                 :          0 :                 sal_Int16 nKeyCode = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
     663   [ #  #  #  # ]:          0 :                 switch( nKeyCode )
     664                 :            :                 {
     665                 :            :                     case KEY_UP:
     666                 :            :                         {   // Note: Performancewise this is not optimal, because we search for an ID in the labels
     667                 :            :                             //       and afterwards we search again for a label with the appropriate ID ->
     668                 :            :                             //       unnecessarily we search twice!!!
     669                 :          0 :                             ItemId nPrevItemID = GetPreviousAvailableItemId( pItem->GetIndex() );
     670         [ #  # ]:          0 :                             if ( nPrevItemID != -1 )
     671                 :          0 :                                 return SelectRoadmapItemByID( nPrevItemID );
     672                 :            :                         }
     673                 :          0 :                         break;
     674                 :            :                     case KEY_DOWN:
     675                 :            :                         {
     676                 :          0 :                             ItemId nNextItemID = GetNextAvailableItemId( pItem->GetIndex() );
     677         [ #  # ]:          0 :                             if ( nNextItemID != -1 )
     678                 :          0 :                                 return SelectRoadmapItemByID( nNextItemID );
     679                 :            :                         }
     680                 :          0 :                         break;
     681                 :            :                     case KEY_SPACE:
     682                 :          0 :                         return SelectRoadmapItemByID( pItem->GetID() );
     683                 :            :                 }
     684                 :            :             }
     685                 :            :         }
     686                 :          0 :         return Window::PreNotify( _rNEvt );
     687                 :            :     }
     688                 :            : 
     689                 :            :     //---------------------------------------------------------------------
     690                 :          0 :       IMPL_LINK(ORoadmap, ImplClickHdl, HyperLabel*, _CurHyperLabel)
     691                 :            :     {
     692                 :          0 :        return SelectRoadmapItemByID( _CurHyperLabel->GetID() );
     693                 :            :     }
     694                 :            : 
     695                 :            : 
     696                 :            : 
     697                 :            :     //---------------------------------------------------------------------
     698                 :          0 :     void ORoadmap::DataChanged( const DataChangedEvent& rDCEvt )
     699                 :            :     {
     700   [ #  #  #  #  :          0 :         if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS )   ||
           #  # ][ #  # ]
     701                 :          0 :             ( rDCEvt.GetType() == DATACHANGED_DISPLAY   ))  &&
     702                 :          0 :             ( rDCEvt.GetFlags() & SETTINGS_STYLE        ))
     703                 :            :         {
     704                 :          0 :             const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     705 [ #  # ][ #  # ]:          0 :             SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) );
                 [ #  # ]
     706                 :          0 :             Color aTextColor = rStyleSettings.GetFieldTextColor();
     707         [ #  # ]:          0 :             Font aFont = GetFont();
     708         [ #  # ]:          0 :             aFont.SetColor( aTextColor );
     709         [ #  # ]:          0 :             SetFont( aFont );
     710         [ #  # ]:          0 :             RoadmapTypes::ItemId curItemID = GetCurrentRoadmapItemID();
     711         [ #  # ]:          0 :             RoadmapItem* pLabelItem = GetByID( curItemID );
     712         [ #  # ]:          0 :             pLabelItem->ToggleBackgroundColor(rStyleSettings.GetHighlightColor());
     713 [ #  # ][ #  # ]:          0 :             Invalidate();
     714                 :            :         }
     715                 :          0 :     }
     716                 :            : 
     717                 :            : 
     718                 :            :     //---------------------------------------------------------------------
     719                 :          0 :     RoadmapItem::RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground )
     720                 :          0 :         :m_aItemPlayground( _rItemPlayground )
     721                 :            :     {
     722         [ #  # ]:          0 :         mpID = new IDLabel( &_rParent, WB_WORDBREAK );
     723                 :          0 :         mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
     724                 :          0 :         mpID->Show();
     725         [ #  # ]:          0 :         mpDescription = new HyperLabel( &_rParent, WB_NOTABSTOP | WB_WORDBREAK );
     726                 :          0 :         mpDescription->Show();
     727                 :          0 :     }
     728                 :            : 
     729                 :            :     //---------------------------------------------------------------------
     730                 :          0 :     bool RoadmapItem::Contains( const Window* _pWindow ) const
     731                 :            :     {
     732 [ #  # ][ #  # ]:          0 :         return ( mpID == _pWindow ) || ( mpDescription == _pWindow );
     733                 :            :     }
     734                 :            : 
     735                 :            :     //---------------------------------------------------------------------
     736                 :          0 :     void RoadmapItem::GrabFocus()
     737                 :            :     {
     738         [ #  # ]:          0 :         if ( mpDescription )
     739                 :          0 :             mpDescription->GrabFocus();
     740                 :          0 :     }
     741                 :            : 
     742                 :            :     //---------------------------------------------------------------------
     743                 :          0 :     void RoadmapItem::SetInteractive( sal_Bool _bInteractive )
     744                 :            :     {
     745         [ #  # ]:          0 :         if ( mpDescription )
     746                 :          0 :         mpDescription->SetInteractive(_bInteractive);
     747                 :          0 :     }
     748                 :            : 
     749                 :            :     //---------------------------------------------------------------------
     750                 :          0 :     void RoadmapItem::SetID( sal_Int16 _ID )
     751                 :            :     {
     752         [ #  # ]:          0 :         if ( mpDescription )
     753                 :          0 :             mpDescription->SetID(_ID);
     754                 :          0 :     }
     755                 :            : 
     756                 :            :     //---------------------------------------------------------------------
     757                 :          0 :     sal_Int16 RoadmapItem::GetID() const
     758                 :            :     {
     759         [ #  # ]:          0 :         return mpDescription ? mpDescription->GetID() : sal_Int16(-1);
     760                 :            :     }
     761                 :            : 
     762                 :            :     //---------------------------------------------------------------------
     763                 :          0 :     void RoadmapItem::ImplUpdateIndex( const ItemIndex _nIndex )
     764                 :            :     {
     765         [ #  # ]:          0 :         if ( mpDescription )
     766                 :          0 :             mpDescription->SetIndex( _nIndex );
     767                 :            : 
     768         [ #  # ]:          0 :         if ( mpID )
     769                 :            :         {
     770         [ #  # ]:          0 :             ::rtl::OUString aIDText = ::rtl::OUString::valueOf( (sal_Int32)( _nIndex + 1 ) ) +  ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ));
     771 [ #  # ][ #  # ]:          0 :              mpID->SetText( aIDText );
                 [ #  # ]
     772                 :            :         }
     773                 :            : 
     774                 :            :         // update the geometry of both controls
     775                 :          0 :         ImplUpdatePosSize();
     776                 :          0 :     }
     777                 :            : 
     778                 :            :     //---------------------------------------------------------------------
     779                 :          0 :     void RoadmapItem::SetIndex( ItemIndex _Index )
     780                 :            :     {
     781                 :          0 :         ImplUpdateIndex( _Index );
     782                 :          0 :     }
     783                 :            : 
     784                 :            :     //---------------------------------------------------------------------
     785                 :          0 :     RoadmapTypes::ItemIndex RoadmapItem::GetIndex() const
     786                 :            :     {
     787         [ #  # ]:          0 :         return mpDescription ? mpDescription->GetIndex() : ItemIndex(-1);
     788                 :            :     }
     789                 :            : 
     790                 :            :     //---------------------------------------------------------------------
     791                 :          0 :     void RoadmapItem::SetPosition( RoadmapItem* _pOldItem )
     792                 :            :     {
     793                 :          0 :         Point aIDPos;
     794         [ #  # ]:          0 :         if ( _pOldItem == NULL )
     795                 :            :         {
     796 [ #  # ][ #  # ]:          0 :             aIDPos = mpID->LogicToPixel( Point( ROADMAP_INDENT_X, ROADMAP_INDENT_Y ), MAP_APPFONT );
                 [ #  # ]
     797                 :            :         }
     798                 :            :         else
     799                 :            :         {
     800         [ #  # ]:          0 :             Size aOldSize = _pOldItem->GetDescriptionHyperLabel()->GetSizePixel();
     801                 :            : 
     802         [ #  # ]:          0 :             aIDPos = _pOldItem->mpID->GetPosPixel();
     803                 :          0 :             aIDPos.Y() += aOldSize.Height();
     804 [ #  # ][ #  # ]:          0 :             aIDPos.Y() += mpID->GetParent()->LogicToPixel( Size( 0, ROADMAP_ITEM_DISTANCE_Y ) ).Height();
     805                 :            :         }
     806         [ #  # ]:          0 :         mpID->SetPosPixel( aIDPos );
     807                 :            : 
     808         [ #  # ]:          0 :         sal_Int32 nDescPos = aIDPos.X() + mpID->GetSizePixel().Width();
     809         [ #  # ]:          0 :         mpDescription->SetPosPixel( Point( nDescPos, aIDPos.Y() ) );
     810                 :          0 :     }
     811                 :            : 
     812                 :            :     //---------------------------------------------------------------------
     813                 :          0 :     void RoadmapItem::Enable( sal_Bool _bEnable)
     814                 :            :     {
     815                 :          0 :         mpID->Enable(_bEnable);
     816                 :          0 :         mpDescription->Enable(_bEnable);
     817                 :          0 :     }
     818                 :            : 
     819                 :            :     //---------------------------------------------------------------------
     820                 :          0 :     sal_Bool RoadmapItem::IsEnabled() const
     821                 :            :     {
     822                 :          0 :         return mpID->IsEnabled();
     823                 :            :     }
     824                 :            : 
     825                 :            :     //---------------------------------------------------------------------
     826                 :          0 :     void RoadmapItem::ToggleBackgroundColor( const Color& _rGBColor )
     827                 :            :     {
     828         [ #  # ]:          0 :         if (_rGBColor == COL_TRANSPARENT)
     829                 :            :         {
     830                 :          0 :             mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
     831         [ #  # ]:          0 :             mpID->SetControlBackground( COL_TRANSPARENT );
     832                 :            :         }
     833                 :            :         else
     834                 :            :         {
     835                 :          0 :             mpID->SetControlBackground( mpID->GetSettings().GetStyleSettings().GetHighlightColor() );
     836                 :          0 :             mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetHighlightTextColor( ) );
     837                 :            :         }
     838                 :          0 :         mpDescription->ToggleBackgroundColor(_rGBColor);
     839                 :          0 :     }
     840                 :            : 
     841                 :            :     //---------------------------------------------------------------------
     842                 :          0 :     void RoadmapItem::ImplUpdatePosSize()
     843                 :            :     {
     844                 :            :         // calculate widths
     845 [ #  # ][ #  # ]:          0 :         long nIDWidth = mpID->GetTextWidth( mpID->GetText() );
                 [ #  # ]
     846 [ #  # ][ #  # ]:          0 :         long nMaxIDWidth = mpID->GetTextWidth( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "100." )) );
         [ #  # ][ #  # ]
     847         [ #  # ]:          0 :         nIDWidth = ::std::min( nIDWidth, nMaxIDWidth );
     848                 :            : 
     849                 :            :         // check how many space the description would need
     850         [ #  # ]:          0 :         Size aDescriptionSize = mpDescription->CalcMinimumSize( m_aItemPlayground.Width() - nIDWidth );
     851                 :            : 
     852                 :            :         // position and size both controls
     853                 :          0 :         Size aIDSize( nIDWidth, aDescriptionSize.Height() );
     854         [ #  # ]:          0 :          mpID->SetSizePixel( aIDSize );
     855                 :            : 
     856         [ #  # ]:          0 :         Point aIDPos = mpID->GetPosPixel();
     857         [ #  # ]:          0 :         mpDescription->SetPosPixel( Point( aIDPos.X() + nIDWidth, aIDPos.Y() ) );
     858         [ #  # ]:          0 :         mpDescription->SetSizePixel( aDescriptionSize );
     859                 :          0 :     }
     860                 :            : 
     861                 :            :     //---------------------------------------------------------------------
     862                 :          0 :     void RoadmapItem::Update( ItemIndex _RMIndex, const ::rtl::OUString& _rText )
     863                 :            :     {
     864                 :            :         // update description label
     865                 :          0 :         mpDescription->SetLabel( _rText );
     866                 :            : 
     867                 :            :         // update the index in both controls, which triggers updating the geometry of both
     868                 :          0 :         ImplUpdateIndex( _RMIndex );
     869                 :          0 :     }
     870                 :            : 
     871                 :            :     //---------------------------------------------------------------------
     872                 :          0 :     RoadmapItem::~RoadmapItem( )
     873                 :            :     {
     874                 :            :         {
     875                 :          0 :             boost::scoped_ptr<Control> xTakeOnership(mpID);
     876         [ #  # ]:          0 :             mpID = NULL;
     877                 :            :         }
     878                 :            :         {
     879                 :          0 :             boost::scoped_ptr<Control> xTakeOnership(mpDescription);
     880         [ #  # ]:          0 :             mpDescription = NULL;
     881                 :            :         }
     882                 :          0 :     }
     883                 :            : 
     884                 :            :     //---------------------------------------------------------------------
     885                 :          0 :     void RoadmapItem::SetClickHdl( const Link& rLink )
     886                 :            :     {
     887         [ #  # ]:          0 :         if ( mpDescription )
     888                 :          0 :             mpDescription->SetClickHdl( rLink);
     889                 :          0 :     }
     890                 :            : 
     891                 :            :     //---------------------------------------------------------------------
     892                 :          0 :     IDLabel::IDLabel( Window* _pParent, WinBits _nWinStyle )
     893                 :          0 :         :FixedText( _pParent, _nWinStyle )
     894                 :            :     {
     895                 :            : 
     896                 :          0 :     }
     897                 :            : 
     898                 :            :     //---------------------------------------------------------------------
     899                 :          0 :     IDLabel::~IDLabel( )
     900                 :            :     {
     901         [ #  # ]:          0 :     }
     902                 :            : 
     903                 :            :     //---------------------------------------------------------------------
     904                 :          0 :     void IDLabel::DataChanged( const DataChangedEvent& rDCEvt )
     905                 :            :     {
     906                 :          0 :         const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     907                 :          0 :         FixedText::DataChanged( rDCEvt );
     908 [ #  # ][ #  #  :          0 :         if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS )   ||
             #  #  #  # ]
     909                 :          0 :             ( rDCEvt.GetType() == DATACHANGED_DISPLAY   ))  &&
     910                 :          0 :             ( rDCEvt.GetFlags() & SETTINGS_STYLE        ))
     911                 :            :         {
     912                 :          0 :             const Color& rGBColor = GetControlBackground();
     913         [ #  # ]:          0 :             if (rGBColor == COL_TRANSPARENT)
     914                 :          0 :                 SetTextColor( rStyleSettings.GetFieldTextColor( ) );
     915                 :            :             else
     916                 :            :             {
     917                 :          0 :                 SetControlBackground(rStyleSettings.GetHighlightColor());
     918                 :          0 :                 SetTextColor( rStyleSettings.GetHighlightTextColor( ) );
     919                 :            :             }
     920                 :          0 :             Invalidate();
     921                 :            :         }
     922                 :          0 :     }
     923                 :            : 
     924                 :            : 
     925                 :            : 
     926                 :            : 
     927                 :            : //.........................................................................
     928                 :            : }   // namespace svt
     929                 :            : //.........................................................................
     930                 :            : 
     931                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10