LCOV - code coverage report
Current view: top level - svx/source/dialog - fontlb.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 65 0.0 %
Date: 2012-08-25 Functions: 0 14 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 82 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 "svx/fontlb.hxx"
      30                 :            : #include <vcl/svapp.hxx>
      31                 :            : 
      32                 :            : // ============================================================================
      33                 :            : 
      34                 :            : DBG_NAME( SvLBoxFontString );
      35                 :            : 
      36                 :          0 : SvLBoxFontString::SvLBoxFontString() :
      37         [ #  # ]:          0 :     SvLBoxString()
      38                 :            : {
      39                 :            :     DBG_CTOR( SvLBoxFontString, 0 );
      40                 :          0 : }
      41                 :            : 
      42                 :          0 : SvLBoxFontString::SvLBoxFontString(
      43                 :            :         SvLBoxEntry* pEntry, sal_uInt16 nFlags, const XubString& rString,
      44                 :            :         const Font& rFont, const Color* pColor ) :
      45                 :            :     SvLBoxString( pEntry, nFlags, rString ),
      46                 :            :     maFont( rFont ),
      47 [ #  # ][ #  # ]:          0 :     mbUseColor( pColor != NULL )
      48                 :            : {
      49                 :            :     DBG_CTOR( SvLBoxFontString, 0 );
      50         [ #  # ]:          0 :     SetText( rString );
      51         [ #  # ]:          0 :     if( pColor )
      52         [ #  # ]:          0 :         maFont.SetColor( *pColor );
      53                 :          0 : }
      54                 :            : 
      55         [ #  # ]:          0 : SvLBoxFontString::~SvLBoxFontString()
      56                 :            : {
      57                 :            :     DBG_DTOR( SvLBoxFontString, 0 );
      58         [ #  # ]:          0 : }
      59                 :            : 
      60                 :            : 
      61                 :          0 : SvLBoxItem* SvLBoxFontString::Create() const
      62                 :            : {
      63                 :            :     DBG_CHKTHIS( SvLBoxFontString, 0 );
      64         [ #  # ]:          0 :     return new SvLBoxFontString;
      65                 :            : }
      66                 :            : 
      67                 :          0 : void SvLBoxFontString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry )
      68                 :            : {
      69                 :            :     DBG_CHKTHIS( SvLBoxFontString, 0 );
      70         [ #  # ]:          0 :     Font aOldFont( rDev.GetFont() );
      71         [ #  # ]:          0 :     Font aNewFont( maFont );
      72                 :          0 :     bool bSel = (nFlags & SVLISTENTRYFLAG_SELECTED) != 0;
      73 [ #  # ][ #  # ]:          0 :     if( !mbUseColor || bSel )       // selection always gets highlight color
      74                 :            :     {
      75         [ #  # ]:          0 :         const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
      76 [ #  # ][ #  # ]:          0 :         aNewFont.SetColor( bSel ? rSett.GetHighlightTextColor() : rSett.GetFieldTextColor() );
      77                 :            :     }
      78                 :            : 
      79         [ #  # ]:          0 :     rDev.SetFont( aNewFont );
      80         [ #  # ]:          0 :     SvLBoxString::Paint( rPos, rDev, nFlags, pEntry );
      81 [ #  # ][ #  # ]:          0 :     rDev.SetFont( aOldFont );
                 [ #  # ]
      82                 :          0 : }
      83                 :            : 
      84                 :          0 : void SvLBoxFontString::InitViewData( SvLBox* pView, SvLBoxEntry* pEntry, SvViewDataItem* pViewData )
      85                 :            : {
      86                 :            :     DBG_CHKTHIS( SvLBoxFontString, 0 );
      87         [ #  # ]:          0 :     Font aOldFont( pView->GetFont() );
      88         [ #  # ]:          0 :     pView->SetFont( maFont );
      89         [ #  # ]:          0 :     SvLBoxString::InitViewData( pView, pEntry, pViewData);
      90 [ #  # ][ #  # ]:          0 :     pView->SetFont( aOldFont );
      91                 :          0 : }
      92                 :            : 
      93                 :            : 
      94                 :            : // ============================================================================
      95                 :            : 
      96                 :          0 : SvxFontListBox::SvxFontListBox( Window* pParent, const ResId& rResId ) :
      97                 :            :     SvTabListBox( pParent, rResId ),
      98                 :          0 :     maStdFont( GetFont() ),
      99 [ #  # ][ #  # ]:          0 :     mbUseFont( false )
     100                 :            : {
     101         [ #  # ]:          0 :     maStdFont.SetTransparent( sal_True );
     102         [ #  # ]:          0 :     maEntryFont = maStdFont;
     103                 :          0 : }
     104                 :            : 
     105                 :          0 : void SvxFontListBox::InsertFontEntry( const String& rString, const Font& rFont, const Color* pColor )
     106                 :            : {
     107                 :          0 :     mbUseFont = true;           // InitEntry() will use maEntryFont
     108                 :          0 :     maEntryFont = rFont;        // font to use in InitEntry() over InsertEntry()
     109                 :          0 :     mpEntryColor = pColor;      // color to use in InitEntry() over InsertEntry()
     110                 :          0 :     InsertEntry( rString );
     111                 :          0 :     mbUseFont = false;
     112                 :          0 : }
     113                 :            : 
     114                 :          0 : void SvxFontListBox::SelectEntryPos( sal_uInt16 nPos, bool bSelect )
     115                 :            : {
     116                 :          0 :     SvLBoxEntry* pEntry = GetEntry( nPos );
     117         [ #  # ]:          0 :     if( pEntry )
     118                 :            :     {
     119                 :          0 :         Select( pEntry, bSelect );
     120                 :          0 :         ShowEntry( pEntry );
     121                 :            :     }
     122                 :          0 : }
     123                 :            : 
     124                 :          0 : void SvxFontListBox::SetNoSelection()
     125                 :            : {
     126                 :          0 :     SelectAll( sal_False, sal_True );
     127                 :          0 : }
     128                 :            : 
     129                 :          0 : sal_uLong SvxFontListBox::GetSelectEntryPos() const
     130                 :            : {
     131                 :          0 :     SvLBoxEntry* pSvLBoxEntry = FirstSelected();
     132         [ #  # ]:          0 :     return pSvLBoxEntry ? GetModel()->GetAbsPos( pSvLBoxEntry ) : LIST_APPEND;
     133                 :            : }
     134                 :            : 
     135                 :          0 : XubString SvxFontListBox::GetSelectEntry() const
     136                 :            : {
     137                 :          0 :     return GetEntryText( GetSelectEntryPos() );
     138                 :            : }
     139                 :            : 
     140                 :          0 : void SvxFontListBox::InitEntry(
     141                 :            :         SvLBoxEntry* pEntry, const XubString& rEntryText,
     142                 :            :         const Image& rCollImg, const Image& rExpImg,
     143                 :            :         SvLBoxButtonKind eButtonKind )
     144                 :            : {
     145         [ #  # ]:          0 :     if( mbUseFont )
     146                 :            :     {
     147         [ #  # ]:          0 :         if( nTreeFlags & TREEFLAG_CHKBTN )
     148                 :            :             pEntry->AddItem( new SvLBoxButton( pEntry, eButtonKind, 0,
     149         [ #  # ]:          0 :                                                pCheckButtonData ) );
     150 [ #  # ][ #  # ]:          0 :         pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, rCollImg, rExpImg, SVLISTENTRYFLAG_EXPANDED ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     151         [ #  # ]:          0 :         pEntry->AddItem( new SvLBoxFontString( pEntry, 0, rEntryText, maEntryFont, mpEntryColor ) );
     152                 :            :     }
     153                 :            :     else
     154                 :            :         SvTreeListBox::InitEntry( pEntry, rEntryText, rCollImg, rExpImg,
     155                 :          0 :                                   eButtonKind );
     156                 :          0 : }
     157                 :            : 
     158                 :            : // ============================================================================
     159                 :            : 
     160                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10