LCOV - code coverage report
Current view: top level - svtools/source/control - fileurlbox.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 34 0.0 %
Date: 2012-08-25 Functions: 0 4 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 57 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 <svtools/fileurlbox.hxx>
      30                 :            : #include <osl/file.h>
      31                 :            : #include "svl/filenotation.hxx"
      32                 :            : 
      33                 :            : //.........................................................................
      34                 :            : namespace svt
      35                 :            : {
      36                 :            : //.........................................................................
      37                 :            : 
      38                 :            :     //=====================================================================
      39                 :            :     //= FileURLBox
      40                 :            :     //=====================================================================
      41                 :            :     //---------------------------------------------------------------------
      42                 :          0 :     FileURLBox::FileURLBox( Window* _pParent, WinBits _nStyle )
      43         [ #  # ]:          0 :         :SvtURLBox( _pParent, _nStyle, INET_PROT_FILE )
      44                 :            :     {
      45         [ #  # ]:          0 :         DisableHistory();
      46                 :          0 :     }
      47                 :            : 
      48                 :            :     //---------------------------------------------------------------------
      49                 :          0 :     void FileURLBox::DisplayURL( const String& _rURL )
      50                 :            :     {
      51         [ #  # ]:          0 :         String sOldText = GetText();
      52                 :            : 
      53 [ #  # ][ #  # ]:          0 :         OFileNotation aTransformer( _rURL, OFileNotation::N_URL );
      54 [ #  # ][ #  # ]:          0 :         String sNewText = aTransformer.get( OFileNotation::N_SYSTEM );
      55         [ #  # ]:          0 :         SetText( sNewText );
      56                 :            : 
      57 [ #  # ][ #  # ]:          0 :         if ( sOldText != sNewText )
      58         [ #  # ]:          0 :             Modify();
      59                 :            : 
      60 [ #  # ][ #  # ]:          0 :         UpdatePickList();
         [ #  # ][ #  # ]
      61                 :          0 :     }
      62                 :            : 
      63                 :            :     //---------------------------------------------------------------------
      64                 :          0 :     long FileURLBox::PreNotify( NotifyEvent& _rNEvt )
      65                 :            :     {
      66      [ #  #  # ]:          0 :         switch ( _rNEvt.GetType() )
      67                 :            :         {
      68                 :            :         case EVENT_KEYINPUT:
      69   [ #  #  #  #  :          0 :             if  (   ( GetSubEdit() == _rNEvt.GetWindow()                         )
           #  # ][ #  # ]
      70                 :          0 :                 &&  ( KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode() )
      71                 :          0 :                 &&  ( IsInDropDown()                                             )
      72                 :            :                 )
      73         [ #  # ]:          0 :                 m_sPreservedText = GetURL();
      74                 :          0 :             break;
      75                 :            : 
      76                 :            :         case EVENT_LOSEFOCUS:
      77         [ #  # ]:          0 :             if ( IsWindowOrChild( _rNEvt.GetWindow() ) )
      78         [ #  # ]:          0 :                 DisplayURL( GetText() );
      79                 :          0 :             break;
      80                 :            :         }
      81                 :            : 
      82                 :          0 :         return SvtURLBox::PreNotify(_rNEvt);
      83                 :            :     }
      84                 :            : 
      85                 :            :     //---------------------------------------------------------------------
      86                 :          0 :     long FileURLBox::Notify( NotifyEvent& _rNEvt )
      87                 :            :     {
      88         [ #  # ]:          0 :         switch ( _rNEvt.GetType() )
      89                 :            :         {
      90                 :            :         case EVENT_KEYINPUT:
      91   [ #  #  #  #  :          0 :             if  (   ( GetSubEdit() == _rNEvt.GetWindow()                         )
           #  # ][ #  # ]
      92                 :          0 :                 &&  ( KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode() )
      93                 :          0 :                 &&  ( IsInDropDown()                                             )
      94                 :            :                 )
      95                 :            :             {
      96                 :          0 :                 long nReturn = SvtURLBox::Notify(_rNEvt);
      97                 :          0 :                 DisplayURL( m_sPreservedText );
      98                 :          0 :                 return nReturn;
      99                 :            :             }
     100                 :          0 :             break;
     101                 :            :         }
     102                 :            : 
     103                 :          0 :         return SvtURLBox::Notify(_rNEvt);
     104                 :            :     }
     105                 :            : 
     106                 :            : //.........................................................................
     107                 :            : }   // namespace svt
     108                 :            : //.........................................................................
     109                 :            : 
     110                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10