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

Generated by: LCOV version 1.11