LCOV - code coverage report
Current view: top level - svtools/source/control - fileurlbox.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 34 0.0 %
Date: 2014-04-14 Functions: 0 4 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 <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( Window* _pParent, WinBits _nStyle )
      34           0 :         :SvtURLBox( _pParent, _nStyle, INET_PROT_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 EVENT_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 EVENT_LOSEFOCUS:
      68           0 :             if ( IsWindowOrChild( _rNEvt.GetWindow() ) )
      69           0 :                 DisplayURL( GetText() );
      70           0 :             break;
      71             :         }
      72             : 
      73           0 :         return SvtURLBox::PreNotify(_rNEvt);
      74             :     }
      75             : 
      76             : 
      77           0 :     bool FileURLBox::Notify( NotifyEvent& _rNEvt )
      78             :     {
      79           0 :         switch ( _rNEvt.GetType() )
      80             :         {
      81             :         case EVENT_KEYINPUT:
      82           0 :             if  (   ( GetSubEdit() == _rNEvt.GetWindow()                         )
      83           0 :                 &&  ( KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode() )
      84           0 :                 &&  ( IsInDropDown()                                             )
      85             :                 )
      86             :             {
      87           0 :                 bool nReturn = SvtURLBox::Notify(_rNEvt);
      88           0 :                 DisplayURL( m_sPreservedText );
      89           0 :                 return nReturn;
      90             :             }
      91           0 :             break;
      92             :         }
      93             : 
      94           0 :         return SvtURLBox::Notify(_rNEvt);
      95             :     }
      96             : 
      97             : 
      98             : }   // namespace svt
      99             : 
     100             : 
     101             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10