LCOV - code coverage report
Current view: top level - libreoffice/svx/source/dialog - frmdirlbox.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 43 0.0 %
Date: 2012-12-27 Functions: 0 14 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <svx/frmdirlbox.hxx>
      21             : 
      22             : namespace svx {
      23             : 
      24             : // ============================================================================
      25             : 
      26             : namespace {
      27             : 
      28           0 : inline void* lclEnumToVoid( SvxFrameDirection eDirection )
      29             : {
      30           0 :     return reinterpret_cast< void* >( static_cast< sal_uInt32 >( eDirection ) );
      31             : }
      32             : 
      33           0 : inline SvxFrameDirection lclVoidToEnum( void* pDirection )
      34             : {
      35           0 :     return static_cast< SvxFrameDirection >( reinterpret_cast< sal_IntPtr >( pDirection ) );
      36             : }
      37             : 
      38             : } // namespace
      39             : 
      40             : // ============================================================================
      41             : 
      42           0 : FrameDirectionListBox::FrameDirectionListBox( Window* pParent, const ResId& rResId ) :
      43           0 :     ListBox( pParent, rResId )
      44             : {
      45           0 : }
      46             : 
      47           0 : FrameDirectionListBox::~FrameDirectionListBox()
      48             : {
      49           0 : }
      50             : 
      51           0 : void FrameDirectionListBox::InsertEntryValue( const String& rString, SvxFrameDirection eDirection, sal_uInt16 nPos )
      52             : {
      53           0 :     sal_uInt16 nRealPos = InsertEntry( rString, nPos );
      54           0 :     SetEntryData( nRealPos, lclEnumToVoid( eDirection ) );
      55           0 : }
      56             : 
      57           0 : void FrameDirectionListBox::RemoveEntryValue( SvxFrameDirection eDirection )
      58             : {
      59           0 :     sal_uInt16 nPos = GetEntryPos( lclEnumToVoid( eDirection ) );
      60           0 :     if( nPos != LISTBOX_ENTRY_NOTFOUND )
      61           0 :         RemoveEntry( nPos );
      62           0 : }
      63             : 
      64           0 : void FrameDirectionListBox::SelectEntryValue( SvxFrameDirection eDirection )
      65             : {
      66           0 :     sal_uInt16 nPos = GetEntryPos( lclEnumToVoid( eDirection ) );
      67           0 :     if( nPos == LISTBOX_ENTRY_NOTFOUND )
      68           0 :         SetNoSelection();
      69             :     else
      70           0 :         SelectEntryPos( nPos );
      71           0 : }
      72             : 
      73           0 : SvxFrameDirection FrameDirectionListBox::GetSelectEntryValue() const
      74             : {
      75           0 :     sal_uInt16 nPos = GetSelectEntryPos();
      76           0 :     if( nPos == LISTBOX_ENTRY_NOTFOUND )
      77           0 :         return static_cast< SvxFrameDirection >( 0xFFFF );
      78           0 :     return lclVoidToEnum( GetEntryData( nPos ) );
      79             : }
      80             : 
      81             : // ============================================================================
      82             : 
      83           0 : FrameDirListBoxWrapper::FrameDirListBoxWrapper( FrameDirListBox& rListBox ) :
      84           0 :     SingleControlWrapperType( rListBox )
      85             : {
      86           0 : }
      87             : 
      88           0 : bool FrameDirListBoxWrapper::IsControlDontKnow() const
      89             : {
      90           0 :     return GetControl().GetSelectEntryCount() == 0;
      91             : }
      92             : 
      93           0 : void FrameDirListBoxWrapper::SetControlDontKnow( bool bSet )
      94             : {
      95           0 :     if( bSet )
      96           0 :         GetControl().SetNoSelection();
      97           0 : }
      98             : 
      99           0 : SvxFrameDirection FrameDirListBoxWrapper::GetControlValue() const
     100             : {
     101           0 :     return GetControl().GetSelectEntryValue();
     102             : }
     103             : 
     104           0 : void FrameDirListBoxWrapper::SetControlValue( SvxFrameDirection eValue )
     105             : {
     106           0 :     GetControl().SelectEntryValue( eValue );
     107           0 : }
     108             : 
     109             : // ============================================================================
     110             : 
     111             : } // namespace svx
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10