LCOV - code coverage report
Current view: top level - svtools/source/control - fileurlbox.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 35 2.9 %
Date: 2015-06-13 12:38:46 Functions: 2 6 33.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 <svtools/fileurlbox.hxx>
      21             : #include <osl/file.h>
      22             : #include <svl/filenotation.hxx>
      23             : 
      24             : 
      25             : namespace svt
      26             : {
      27             : 
      28             : 
      29             : 
      30             :     //= FileURLBox
      31             : 
      32             : 
      33           0 :     FileURLBox::FileURLBox( vcl::Window* _pParent, WinBits _nStyle )
      34           0 :         :SvtURLBox( _pParent, _nStyle, INetProtocol::File )
      35             :     {
      36           0 :         DisableHistory();
      37           0 :     }
      38             : 
      39             : 
      40           0 :     void FileURLBox::DisplayURL( const OUString& _rURL )
      41             :     {
      42           0 :         OUString sOldText = GetText();
      43             : 
      44           0 :         OFileNotation aTransformer( _rURL, OFileNotation::N_URL );
      45           0 :         OUString sNewText = aTransformer.get( OFileNotation::N_SYSTEM );
      46           0 :         SetText( sNewText );
      47             : 
      48           0 :         if ( sOldText != sNewText )
      49           0 :             Modify();
      50             : 
      51           0 :         UpdatePickList();
      52           0 :     }
      53             : 
      54             : 
      55           0 :     bool FileURLBox::PreNotify( NotifyEvent& _rNEvt )
      56             :     {
      57           0 :         switch ( _rNEvt.GetType() )
      58             :         {
      59             :         case MouseNotifyEvent::KEYINPUT:
      60           0 :             if  (   ( GetSubEdit() == _rNEvt.GetWindow()                         )
      61           0 :                 &&  ( KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode() )
      62           0 :                 &&  ( IsInDropDown()                                             )
      63             :                 )
      64           0 :                 m_sPreservedText = GetURL();
      65           0 :             break;
      66             : 
      67             :         case MouseNotifyEvent::LOSEFOCUS:
      68           0 :             if ( IsWindowOrChild( _rNEvt.GetWindow() ) )
      69           0 :                 DisplayURL( GetText() );
      70           0 :             break;
      71             : 
      72             :         default:
      73           0 :             break;
      74             :         }
      75             : 
      76           0 :         return SvtURLBox::PreNotify(_rNEvt);
      77             :     }
      78             : 
      79           0 :     bool FileURLBox::Notify( NotifyEvent& _rNEvt )
      80             :     {
      81           0 :         if (_rNEvt.GetType() == MouseNotifyEvent::KEYINPUT)
      82             :         {
      83           0 :             if  (   ( GetSubEdit() == _rNEvt.GetWindow()                         )
      84           0 :                 &&  ( KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode() )
      85           0 :                 &&  ( IsInDropDown()                                             )
      86             :                 )
      87             :             {
      88           0 :                 bool nReturn = SvtURLBox::Notify(_rNEvt);
      89           0 :                 DisplayURL( m_sPreservedText );
      90           0 :                 return nReturn;
      91             :             }
      92             :         }
      93             : 
      94           0 :         return SvtURLBox::Notify(_rNEvt);
      95             :     }
      96             : 
      97         798 : }   // namespace svt
      98             : 
      99             : 
     100             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11