LCOV - code coverage report
Current view: top level - svx/source/dialog - frmdirlbox.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 47 0.0 %
Date: 2014-04-11 Functions: 0 15 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             : #include <vcl/builder.hxx>
      22             : 
      23             : namespace svx {
      24             : 
      25             : 
      26             : 
      27             : namespace {
      28             : 
      29           0 : inline void* lclEnumToVoid( SvxFrameDirection eDirection )
      30             : {
      31           0 :     return reinterpret_cast< void* >( static_cast< sal_uInt32 >( eDirection ) );
      32             : }
      33             : 
      34           0 : inline SvxFrameDirection lclVoidToEnum( void* pDirection )
      35             : {
      36           0 :     return static_cast< SvxFrameDirection >( reinterpret_cast< sal_IntPtr >( pDirection ) );
      37             : }
      38             : 
      39             : } // namespace
      40             : 
      41           0 : FrameDirectionListBox::FrameDirectionListBox( Window* pParent, WinBits nBits ) :
      42           0 :     ListBox( pParent, nBits )
      43             : {
      44           0 : }
      45             : 
      46           0 : FrameDirectionListBox::~FrameDirectionListBox()
      47             : {
      48           0 : }
      49             : 
      50           0 : extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeFrameDirectionListBox(Window *pParent, VclBuilder::stringmap &)
      51             : {
      52           0 :     FrameDirectionListBox* pListBox = new FrameDirectionListBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK|WB_TABSTOP);
      53           0 :     pListBox->EnableAutoSize(true);
      54           0 :     return pListBox;
      55             : }
      56             : 
      57             : 
      58           0 : void FrameDirectionListBox::InsertEntryValue( const OUString& rString, SvxFrameDirection eDirection, sal_Int32 nPos )
      59             : {
      60           0 :     sal_Int32 nRealPos = InsertEntry( rString, nPos );
      61           0 :     SetEntryData( nRealPos, lclEnumToVoid( eDirection ) );
      62           0 : }
      63             : 
      64           0 : void FrameDirectionListBox::RemoveEntryValue( SvxFrameDirection eDirection )
      65             : {
      66           0 :     sal_Int32 nPos = GetEntryPos( lclEnumToVoid( eDirection ) );
      67           0 :     if( nPos != LISTBOX_ENTRY_NOTFOUND )
      68           0 :         RemoveEntry( nPos );
      69           0 : }
      70             : 
      71           0 : void FrameDirectionListBox::SelectEntryValue( SvxFrameDirection eDirection )
      72             : {
      73           0 :     sal_Int32 nPos = GetEntryPos( lclEnumToVoid( eDirection ) );
      74           0 :     if( nPos == LISTBOX_ENTRY_NOTFOUND )
      75           0 :         SetNoSelection();
      76             :     else
      77           0 :         SelectEntryPos( nPos );
      78           0 : }
      79             : 
      80           0 : SvxFrameDirection FrameDirectionListBox::GetSelectEntryValue() const
      81             : {
      82           0 :     sal_Int32 nPos = GetSelectEntryPos();
      83           0 :     if( nPos == LISTBOX_ENTRY_NOTFOUND )
      84           0 :         return static_cast< SvxFrameDirection >( 0xFFFF );
      85           0 :     return lclVoidToEnum( GetEntryData( nPos ) );
      86             : }
      87             : 
      88             : 
      89             : 
      90           0 : FrameDirListBoxWrapper::FrameDirListBoxWrapper( FrameDirListBox& rListBox ) :
      91           0 :     SingleControlWrapperType( rListBox )
      92             : {
      93           0 : }
      94             : 
      95           0 : bool FrameDirListBoxWrapper::IsControlDontKnow() const
      96             : {
      97           0 :     return GetControl().GetSelectEntryCount() == 0;
      98             : }
      99             : 
     100           0 : void FrameDirListBoxWrapper::SetControlDontKnow( bool bSet )
     101             : {
     102           0 :     if( bSet )
     103           0 :         GetControl().SetNoSelection();
     104           0 : }
     105             : 
     106           0 : SvxFrameDirection FrameDirListBoxWrapper::GetControlValue() const
     107             : {
     108           0 :     return GetControl().GetSelectEntryValue();
     109             : }
     110             : 
     111           0 : void FrameDirListBoxWrapper::SetControlValue( SvxFrameDirection eValue )
     112             : {
     113           0 :     GetControl().SelectEntryValue( eValue );
     114           0 : }
     115             : 
     116             : 
     117             : 
     118             : } // namespace svx
     119             : 
     120             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10