LCOV - code coverage report
Current view: top level - svtools/source/contnr - svlbitm.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 51 263 19.4 %
Date: 2015-06-13 12:38:46 Functions: 18 61 29.5 %
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 <svtools/treelistbox.hxx>
      21             : #include <svtools/svlbitm.hxx>
      22             : #include <svtools/treelistentry.hxx>
      23             : #include <svtools/viewdataentry.hxx>
      24             : #include <vcl/svapp.hxx>
      25             : #include <vcl/button.hxx>
      26             : #include <vcl/decoview.hxx>
      27             : #include <vcl/salnativewidgets.hxx>
      28             : 
      29             : struct SvLBoxButtonData_Impl
      30             : {
      31             :     SvTreeListEntry*    pEntry;
      32             :     bool                bDefaultImages;
      33             :     bool                bShowRadioButton;
      34             : 
      35           0 :     SvLBoxButtonData_Impl() : pEntry( NULL ), bDefaultImages( false ), bShowRadioButton( false ) {}
      36             : };
      37             : 
      38           0 : void SvLBoxButtonData::InitData( bool bImagesFromDefault, bool _bRadioBtn, const Control* pCtrl )
      39             : {
      40           0 :     nWidth = nHeight = 0;
      41             : 
      42           0 :     aBmps.resize((int)SvBmp::STATICIMAGE+1);
      43             : 
      44           0 :     pImpl = new SvLBoxButtonData_Impl;
      45             : 
      46           0 :     bDataOk = false;
      47           0 :     eState = SV_BUTTON_UNCHECKED;
      48           0 :     pImpl->bDefaultImages = bImagesFromDefault;
      49           0 :     pImpl->bShowRadioButton = _bRadioBtn;
      50             : 
      51           0 :     if ( bImagesFromDefault )
      52           0 :         SetDefaultImages( pCtrl );
      53           0 : }
      54             : 
      55           0 : SvLBoxButtonData::SvLBoxButtonData( const Control* pControlForSettings )
      56             : {
      57           0 :     InitData( true, false, pControlForSettings );
      58           0 : }
      59             : 
      60           0 : SvLBoxButtonData::SvLBoxButtonData( const Control* pControlForSettings, bool _bRadioBtn )
      61             : {
      62           0 :     InitData( true, _bRadioBtn, pControlForSettings );
      63           0 : }
      64             : 
      65           0 : SvLBoxButtonData::~SvLBoxButtonData()
      66             : {
      67             : 
      68           0 :     delete pImpl;
      69             : #ifdef DBG_UTIL
      70             :     pImpl = NULL;
      71             : #endif
      72           0 : }
      73             : 
      74           0 : void SvLBoxButtonData::CallLink()
      75             : {
      76           0 :     aLink.Call( this );
      77           0 : }
      78             : 
      79           0 : SvBmp SvLBoxButtonData::GetIndex( SvItemStateFlags nItemState )
      80             : {
      81             :     SvBmp nIdx;
      82           0 :     if (nItemState == SvItemStateFlags::UNCHECKED)
      83           0 :         nIdx = SvBmp::UNCHECKED;
      84           0 :     else if (nItemState == SvItemStateFlags::CHECKED)
      85           0 :         nIdx = SvBmp::CHECKED;
      86           0 :     else if (nItemState == SvItemStateFlags::TRISTATE)
      87           0 :         nIdx = SvBmp::TRISTATE;
      88           0 :     else if (nItemState == (SvItemStateFlags::UNCHECKED | SvItemStateFlags::HILIGHTED))
      89           0 :         nIdx = SvBmp::HIUNCHECKED;
      90           0 :     else if (nItemState == (SvItemStateFlags::CHECKED | SvItemStateFlags::HILIGHTED))
      91           0 :         nIdx = SvBmp::HICHECKED;
      92           0 :     else if (nItemState == (SvItemStateFlags::TRISTATE | SvItemStateFlags::HILIGHTED))
      93           0 :         nIdx = SvBmp::HITRISTATE;
      94             :     else
      95           0 :         nIdx = SvBmp::UNCHECKED;
      96           0 :     return nIdx;
      97             : }
      98             : 
      99           0 : void SvLBoxButtonData::SetWidthAndHeight()
     100             : {
     101           0 :     Size aSize = aBmps[(int)SvBmp::UNCHECKED].GetSizePixel();
     102           0 :     nWidth = aSize.Width();
     103           0 :     nHeight = aSize.Height();
     104           0 :     bDataOk = true;
     105           0 : }
     106             : 
     107             : 
     108           0 : void SvLBoxButtonData::StoreButtonState( SvTreeListEntry* pActEntry, SvItemStateFlags nItemFlags )
     109             : {
     110           0 :     pImpl->pEntry = pActEntry;
     111           0 :     eState = ConvertToButtonState( nItemFlags );
     112           0 : }
     113             : 
     114           0 : SvButtonState SvLBoxButtonData::ConvertToButtonState( SvItemStateFlags nItemFlags )
     115             : {
     116           0 :     nItemFlags &= (SvItemStateFlags::UNCHECKED |
     117             :                    SvItemStateFlags::CHECKED |
     118           0 :                    SvItemStateFlags::TRISTATE);
     119           0 :     switch( nItemFlags )
     120             :     {
     121             :         case SvItemStateFlags::UNCHECKED:
     122           0 :             return SV_BUTTON_UNCHECKED;
     123             :         case SvItemStateFlags::CHECKED:
     124           0 :             return SV_BUTTON_CHECKED;
     125             :         case SvItemStateFlags::TRISTATE:
     126           0 :             return SV_BUTTON_TRISTATE;
     127             :         default:
     128           0 :             return SV_BUTTON_UNCHECKED;
     129             :     }
     130             : }
     131             : 
     132           0 : SvTreeListEntry* SvLBoxButtonData::GetActEntry() const
     133             : {
     134             :     assert(pImpl && "-SvLBoxButtonData::GetActEntry(): don't use me that way!");
     135           0 :     return pImpl->pEntry;
     136             : }
     137             : 
     138           0 : void SvLBoxButtonData::SetDefaultImages( const Control* pCtrl )
     139             : {
     140           0 :     const AllSettings& rSettings = pCtrl? pCtrl->GetSettings() : Application::GetSettings();
     141             : 
     142           0 :     if ( pImpl->bShowRadioButton )
     143             :     {
     144           0 :         SetImage(SvBmp::UNCHECKED,   RadioButton::GetRadioImage( rSettings, DrawButtonFlags::Default ) );
     145           0 :         SetImage(SvBmp::CHECKED,     RadioButton::GetRadioImage( rSettings, DrawButtonFlags::Checked ) );
     146           0 :         SetImage(SvBmp::HICHECKED,   RadioButton::GetRadioImage( rSettings, DrawButtonFlags::Checked | DrawButtonFlags::Pressed ) );
     147           0 :         SetImage(SvBmp::HIUNCHECKED, RadioButton::GetRadioImage( rSettings, DrawButtonFlags::Default | DrawButtonFlags::Pressed ) );
     148           0 :         SetImage(SvBmp::TRISTATE,    RadioButton::GetRadioImage( rSettings, DrawButtonFlags::DontKnow ) );
     149           0 :         SetImage(SvBmp::HITRISTATE,  RadioButton::GetRadioImage( rSettings, DrawButtonFlags::DontKnow | DrawButtonFlags::Pressed ) );
     150             :     }
     151             :     else
     152             :     {
     153           0 :         SetImage(SvBmp::UNCHECKED,   CheckBox::GetCheckImage( rSettings, DrawButtonFlags::Default ) );
     154           0 :         SetImage(SvBmp::CHECKED,     CheckBox::GetCheckImage( rSettings, DrawButtonFlags::Checked ) );
     155           0 :         SetImage(SvBmp::HICHECKED,   CheckBox::GetCheckImage( rSettings, DrawButtonFlags::Checked | DrawButtonFlags::Pressed ) );
     156           0 :         SetImage(SvBmp::HIUNCHECKED, CheckBox::GetCheckImage( rSettings, DrawButtonFlags::Default | DrawButtonFlags::Pressed ) );
     157           0 :         SetImage(SvBmp::TRISTATE,    CheckBox::GetCheckImage( rSettings, DrawButtonFlags::DontKnow ) );
     158           0 :         SetImage(SvBmp::HITRISTATE,  CheckBox::GetCheckImage( rSettings, DrawButtonFlags::DontKnow | DrawButtonFlags::Pressed ) );
     159             :     }
     160           0 : }
     161             : 
     162           0 : bool SvLBoxButtonData::HasDefaultImages() const
     163             : {
     164           0 :     return pImpl->bDefaultImages;
     165             : }
     166             : 
     167           0 : bool SvLBoxButtonData::IsRadio() {
     168           0 :     return pImpl->bShowRadioButton;
     169             : }
     170             : 
     171             : // ***************************************************************
     172             : // class SvLBoxString
     173             : // ***************************************************************
     174             : 
     175             : 
     176         202 : SvLBoxString::SvLBoxString(SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rStr)
     177         202 :     : SvLBoxItem(pEntry, nFlags)
     178             : {
     179         202 :     SetText(rStr);
     180         202 : }
     181             : 
     182           0 : SvLBoxString::SvLBoxString() : SvLBoxItem()
     183             : {
     184           0 : }
     185             : 
     186         304 : SvLBoxString::~SvLBoxString()
     187             : {
     188         304 : }
     189             : 
     190          96 : sal_uInt16 SvLBoxString::GetType() const
     191             : {
     192          96 :     return SV_ITEM_ID_LBOXSTRING;
     193             : }
     194             : 
     195          97 : void SvLBoxString::Paint(
     196             :     const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
     197             :     const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry)
     198             : {
     199          97 :     DrawTextFlags nStyle = rDev.IsEnabled() ? DrawTextFlags::NONE : DrawTextFlags::Disable;
     200          97 :     if (rDev.IsEntryMnemonicsEnabled())
     201           0 :         nStyle |= DrawTextFlags::Mnemonic;
     202          97 :     rRenderContext.DrawText(Rectangle(rPos, GetSize(&rDev, &rEntry)), maText, nStyle);
     203          97 : }
     204             : 
     205           0 : SvLBoxItem* SvLBoxString::Create() const
     206             : {
     207           0 :     return new SvLBoxString;
     208             : }
     209             : 
     210           0 : void SvLBoxString::Clone( SvLBoxItem* pSource )
     211             : {
     212           0 :     maText = static_cast<SvLBoxString*>(pSource)->maText;
     213           0 : }
     214             : 
     215         221 : void SvLBoxString::InitViewData(
     216             :     SvTreeListBox* pView, SvTreeListEntry* pEntry, SvViewDataItem* pViewData)
     217             : {
     218         221 :     if( !pViewData )
     219         120 :         pViewData = pView->GetViewDataItem( pEntry, this );
     220             : 
     221             :     // fdo#72125: GetTextWidth() can get very expensive; let's just count
     222             :     // an approximate width using a cached value when we have many entries
     223             :     long nTextWidth;
     224         221 :     if (pView->GetEntryCount() > 100)
     225             :     {
     226             :         static SvTreeListBox *pPreviousView = NULL;
     227             :         static float fApproximateCharWidth = 0.0;
     228           0 :         if (pPreviousView != pView)
     229             :         {
     230           0 :             pPreviousView = pView;
     231           0 :             fApproximateCharWidth = pView->approximate_char_width();
     232             :         }
     233           0 :         nTextWidth = maText.getLength() * fApproximateCharWidth;
     234             :     }
     235             :     else
     236         221 :         nTextWidth = pView->GetTextWidth(maText);
     237             : 
     238         221 :     pViewData->maSize = Size(nTextWidth, pView->GetTextHeight());
     239         221 : }
     240             : 
     241             : // ***************************************************************
     242             : // class SvLBoxBmp
     243             : // ***************************************************************
     244             : 
     245             : 
     246           0 : SvLBoxBmp::SvLBoxBmp() : SvLBoxItem()
     247             : {
     248           0 : }
     249             : 
     250           0 : SvLBoxBmp::~SvLBoxBmp()
     251             : {
     252           0 : }
     253             : 
     254           0 : sal_uInt16 SvLBoxBmp::GetType() const
     255             : {
     256           0 :     return SV_ITEM_ID_LBOXBMP;
     257             : }
     258             : 
     259           0 : void SvLBoxBmp::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry,
     260             :     SvViewDataItem* pViewData)
     261             : {
     262           0 :     if( !pViewData )
     263           0 :         pViewData = pView->GetViewDataItem( pEntry, this );
     264           0 :     pViewData->maSize = aBmp.GetSizePixel();
     265           0 : }
     266             : 
     267           0 : void SvLBoxBmp::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
     268             :                       const SvViewDataEntry* /*pView*/, const SvTreeListEntry& /*rEntry*/)
     269             : {
     270           0 :     DrawImageFlags nStyle = rDev.IsEnabled() ? DrawImageFlags::NONE : DrawImageFlags::Disable;
     271           0 :     rRenderContext.DrawImage(rPos, aBmp ,nStyle);
     272           0 : }
     273             : 
     274           0 : SvLBoxItem* SvLBoxBmp::Create() const
     275             : {
     276           0 :     return new SvLBoxBmp;
     277             : }
     278             : 
     279           0 : void SvLBoxBmp::Clone( SvLBoxItem* pSource )
     280             : {
     281           0 :     aBmp = static_cast<SvLBoxBmp*>(pSource)->aBmp;
     282           0 : }
     283             : 
     284             : // ***************************************************************
     285             : // class SvLBoxButton
     286             : // ***************************************************************
     287             : 
     288             : 
     289           0 : SvLBoxButton::SvLBoxButton( SvTreeListEntry* pEntry, SvLBoxButtonKind eTheKind,
     290             :                             sal_uInt16 nFlags, SvLBoxButtonData* pBData )
     291             :     : SvLBoxItem( pEntry, nFlags )
     292             :     , isVis(true)
     293             :     , pData(pBData)
     294             :     , eKind(eTheKind)
     295           0 :     , nItemFlags(SvItemStateFlags::NONE)
     296             : {
     297           0 :     SetStateUnchecked();
     298           0 : }
     299             : 
     300           0 : SvLBoxButton::SvLBoxButton()
     301             :     : SvLBoxItem()
     302             :     , isVis(false)
     303             :     , pData(0)
     304             :     , eKind(SvLBoxButtonKind_enabledCheckbox)
     305           0 :     , nItemFlags(SvItemStateFlags::NONE)
     306             : {
     307           0 :     SetStateUnchecked();
     308           0 : }
     309             : 
     310           0 : SvLBoxButton::~SvLBoxButton()
     311             : {
     312           0 : }
     313             : 
     314           0 : sal_uInt16 SvLBoxButton::GetType() const
     315             : {
     316           0 :     return SV_ITEM_ID_LBOXBUTTON;
     317             : }
     318             : 
     319           0 : bool SvLBoxButton::ClickHdl( SvTreeListBox*, SvTreeListEntry* pEntry )
     320             : {
     321           0 :     if ( CheckModification() )
     322             :     {
     323           0 :         if ( IsStateChecked() )
     324           0 :             SetStateUnchecked();
     325             :         else
     326           0 :             SetStateChecked();
     327           0 :         pData->StoreButtonState( pEntry, nItemFlags );
     328           0 :         pData->CallLink();
     329             :     }
     330           0 :     return false;
     331             : }
     332             : 
     333           0 : void SvLBoxButton::Paint(
     334             :     const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
     335             :     const SvViewDataEntry* /*pView*/, const SvTreeListEntry& /*rEntry*/)
     336             : {
     337           0 :     SvBmp nIndex = eKind == SvLBoxButtonKind_staticImage ? SvBmp::STATICIMAGE : SvLBoxButtonData::GetIndex(nItemFlags);
     338           0 :     DrawImageFlags nStyle = eKind != SvLBoxButtonKind_disabledCheckbox && rDev.IsEnabled() ? DrawImageFlags::NONE : DrawImageFlags::Disable;
     339             : 
     340             :     //Native drawing
     341           0 :     bool bNativeOK = false;
     342           0 :     ControlType eCtrlType = (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX;
     343           0 :     if ( nIndex != SvBmp::STATICIMAGE && rRenderContext.IsNativeControlSupported( eCtrlType, PART_ENTIRE_CONTROL) )
     344             : 
     345             :     {
     346           0 :         Size aSize(pData->Width(), pData->Height());
     347           0 :         ImplAdjustBoxSize(aSize, eCtrlType, rRenderContext);
     348           0 :         ImplControlValue aControlValue;
     349           0 :         Rectangle aCtrlRegion( rPos, aSize );
     350           0 :         ControlState nState = ControlState::NONE;
     351             : 
     352             :         //states ControlState::DEFAULT, ControlState::PRESSED and ControlState::ROLLOVER are not implemented
     353           0 :         if (IsStateHilighted())
     354           0 :             nState |= ControlState::FOCUSED;
     355           0 :         if (nStyle != DrawImageFlags::Disable)
     356           0 :             nState |= ControlState::ENABLED;
     357           0 :         if (IsStateChecked())
     358           0 :             aControlValue.setTristateVal(BUTTONVALUE_ON);
     359           0 :         else if (IsStateUnchecked())
     360           0 :             aControlValue.setTristateVal(BUTTONVALUE_OFF);
     361           0 :         else if (IsStateTristate())
     362           0 :             aControlValue.setTristateVal( BUTTONVALUE_MIXED );
     363             : 
     364           0 :         if (isVis)
     365             :             bNativeOK = rRenderContext.DrawNativeControl(eCtrlType, PART_ENTIRE_CONTROL,
     366           0 :                                                          aCtrlRegion, nState, aControlValue, OUString());
     367             :     }
     368             : 
     369           0 :     if (!bNativeOK && isVis)
     370           0 :         rRenderContext.DrawImage(rPos, pData->GetImage(nIndex), nStyle);
     371           0 : }
     372             : 
     373           0 : SvLBoxItem* SvLBoxButton::Create() const
     374             : {
     375           0 :     return new SvLBoxButton;
     376             : }
     377             : 
     378           0 : void SvLBoxButton::Clone( SvLBoxItem* pSource )
     379             : {
     380           0 :     pData = static_cast<SvLBoxButton*>(pSource)->pData;
     381           0 : }
     382             : 
     383           0 : void SvLBoxButton::ImplAdjustBoxSize(Size& io_rSize, ControlType i_eType, vcl::RenderContext& rRenderContext)
     384             : {
     385           0 :     if (rRenderContext.IsNativeControlSupported( i_eType, PART_ENTIRE_CONTROL) )
     386             :     {
     387           0 :         ImplControlValue    aControlValue;
     388           0 :         Rectangle           aCtrlRegion( Point( 0, 0 ), io_rSize );
     389           0 :         ControlState        nState = ControlState::ENABLED;
     390             : 
     391           0 :         aControlValue.setTristateVal( BUTTONVALUE_ON );
     392             : 
     393           0 :         Rectangle aNativeBounds, aNativeContent;
     394             :         bool bNativeOK = rRenderContext.GetNativeControlRegion( i_eType,
     395             :                                                             PART_ENTIRE_CONTROL,
     396             :                                                             aCtrlRegion,
     397             :                                                             nState,
     398             :                                                             aControlValue,
     399             :                                                             OUString(),
     400             :                                                             aNativeBounds,
     401           0 :                                                             aNativeContent );
     402           0 :         if( bNativeOK )
     403             :         {
     404           0 :             Size aContentSize( aNativeContent.GetSize() );
     405             :             // leave a little space around the box image (looks better)
     406           0 :             if( aContentSize.Height() + 2 > io_rSize.Height() )
     407           0 :                 io_rSize.Height() = aContentSize.Height() + 2;
     408           0 :             if( aContentSize.Width() + 2 > io_rSize.Width() )
     409           0 :                 io_rSize.Width() = aContentSize.Width() + 2;
     410           0 :         }
     411             :     }
     412           0 : }
     413             : 
     414           0 : void SvLBoxButton::InitViewData(SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* pViewData)
     415             : {
     416           0 :     if( !pViewData )
     417           0 :         pViewData = pView->GetViewDataItem( pEntry, this );
     418           0 :     Size aSize( pData->Width(), pData->Height() );
     419             : 
     420           0 :     ControlType eCtrlType = (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX;
     421           0 :     if ( eKind != SvLBoxButtonKind_staticImage && pView )
     422           0 :         ImplAdjustBoxSize(aSize, eCtrlType, *pView);
     423           0 :     pViewData->maSize = aSize;
     424           0 : }
     425             : 
     426           0 : bool SvLBoxButton::CheckModification() const
     427             : {
     428           0 :     return eKind == SvLBoxButtonKind_enabledCheckbox;
     429             : }
     430             : 
     431           0 : void SvLBoxButton::SetStateInvisible()
     432             : {
     433           0 :     isVis = false;
     434           0 : }
     435             : 
     436             : // ***************************************************************
     437             : // class SvLBoxContextBmp
     438             : // ***************************************************************
     439             : 
     440         202 : struct SvLBoxContextBmp_Impl
     441             : {
     442             :     Image       m_aImage1;
     443             :     Image       m_aImage2;
     444             : 
     445             :     bool        m_bExpanded;
     446             : };
     447             : 
     448             : // ***************************************************************
     449             : 
     450         101 : SvLBoxContextBmp::SvLBoxContextBmp(
     451             :     SvTreeListEntry* pEntry, sal_uInt16 nItemFlags, Image aBmp1, Image aBmp2,
     452             :     bool bExpanded)
     453             :     :SvLBoxItem( pEntry, nItemFlags )
     454         101 :     ,m_pImpl( new SvLBoxContextBmp_Impl )
     455             : {
     456             : 
     457         101 :     m_pImpl->m_bExpanded = bExpanded;
     458         101 :     SetModeImages( aBmp1, aBmp2 );
     459         101 : }
     460             : 
     461           0 : SvLBoxContextBmp::SvLBoxContextBmp()
     462             :     :SvLBoxItem( )
     463           0 :     ,m_pImpl( new SvLBoxContextBmp_Impl )
     464             : {
     465           0 :     m_pImpl->m_bExpanded = false;
     466           0 : }
     467             : 
     468         303 : SvLBoxContextBmp::~SvLBoxContextBmp()
     469             : {
     470         101 :     delete m_pImpl;
     471         202 : }
     472             : 
     473         549 : sal_uInt16 SvLBoxContextBmp::GetType() const
     474             : {
     475         549 :     return SV_ITEM_ID_LBOXCONTEXTBMP;
     476             : }
     477             : 
     478         101 : bool SvLBoxContextBmp::SetModeImages( const Image& _rBitmap1, const Image& _rBitmap2 )
     479             : {
     480         101 :     bool bSuccess = true;
     481         101 :     m_pImpl->m_aImage1 = _rBitmap1;
     482         101 :     m_pImpl->m_aImage2 = _rBitmap2;
     483         101 :     return bSuccess;
     484             : }
     485             : 
     486         515 : Image& SvLBoxContextBmp::implGetImageStore( bool _bFirst )
     487             : {
     488             : 
     489             :     // OJ: #i27071# wrong mode so we just return the normal images
     490         515 :     return _bFirst ? m_pImpl->m_aImage1 : m_pImpl->m_aImage2;
     491             : }
     492             : 
     493         221 : void SvLBoxContextBmp::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry,
     494             :     SvViewDataItem* pViewData)
     495             : {
     496         221 :     if( !pViewData )
     497         120 :         pViewData = pView->GetViewDataItem( pEntry, this );
     498         221 :     pViewData->maSize = m_pImpl->m_aImage1.GetSizePixel();
     499         221 : }
     500             : 
     501         109 : void SvLBoxContextBmp::Paint(
     502             :     const Point& _rPos, SvTreeListBox& _rDev, vcl::RenderContext& rRenderContext,
     503             :     const SvViewDataEntry* pView, const SvTreeListEntry& rEntry)
     504             : {
     505             : 
     506             :     // get the image.
     507         109 :     const Image& rImage = implGetImageStore(pView->IsExpanded() != m_pImpl->m_bExpanded);
     508             : 
     509         109 :     bool _bSemiTransparent = bool( SvTLEntryFlags::SEMITRANSPARENT & rEntry.GetFlags( ) );
     510             :     // draw
     511         109 :     DrawImageFlags nStyle = _rDev.IsEnabled() ? DrawImageFlags::NONE : DrawImageFlags::Disable;
     512         109 :     if (_bSemiTransparent)
     513           0 :         nStyle |= DrawImageFlags::SemiTransparent;
     514         109 :     rRenderContext.DrawImage(_rPos, rImage, nStyle);
     515         109 : }
     516             : 
     517           0 : SvLBoxItem* SvLBoxContextBmp::Create() const
     518             : {
     519           0 :     return new SvLBoxContextBmp;
     520             : }
     521             : 
     522           0 : void SvLBoxContextBmp::Clone( SvLBoxItem* pSource )
     523             : {
     524           0 :     m_pImpl->m_aImage1 = static_cast< SvLBoxContextBmp* >( pSource )->m_pImpl->m_aImage1;
     525           0 :     m_pImpl->m_aImage2 = static_cast< SvLBoxContextBmp* >( pSource )->m_pImpl->m_aImage2;
     526           0 :     m_pImpl->m_bExpanded = static_cast<SvLBoxContextBmp*>(pSource)->m_pImpl->m_bExpanded;
     527           0 : }
     528             : 
     529           0 : long SvLBoxButtonData::Width()
     530             : {
     531           0 :     if ( !bDataOk )
     532           0 :         SetWidthAndHeight();
     533           0 :     return nWidth;
     534             : }
     535             : 
     536           0 : long SvLBoxButtonData::Height()
     537             : {
     538           0 :     if ( !bDataOk )
     539           0 :         SetWidthAndHeight();
     540           0 :     return nHeight;
     541         798 : }
     542             : 
     543             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11