1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svtools.hxx" 26 27 #include <svtools/urlcontrol.hxx> 28 #include "svl/filenotation.hxx" 29 30 //......................................................................... 31 namespace svt 32 { 33 //......................................................................... 34 35 //===================================================================== 36 //= OFileURLControl 37 //===================================================================== 38 //--------------------------------------------------------------------- OFileURLControl(Window * _pParent)39 OFileURLControl::OFileURLControl(Window* _pParent) 40 :SvtURLBox(_pParent, INET_PROT_FILE) 41 { 42 DisableHistory(); 43 } 44 45 //--------------------------------------------------------------------- OFileURLControl(Window * _pParent,const ResId & _rId)46 OFileURLControl::OFileURLControl(Window* _pParent, const ResId& _rId) 47 :SvtURLBox(_pParent, _rId, INET_PROT_FILE) 48 { 49 DisableHistory(); 50 } 51 52 //--------------------------------------------------------------------- PreNotify(NotifyEvent & _rNEvt)53 long OFileURLControl::PreNotify( NotifyEvent& _rNEvt ) 54 { 55 if (GetSubEdit() == _rNEvt.GetWindow()) 56 if (EVENT_KEYINPUT == _rNEvt.GetType()) 57 if (KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode()) 58 if (IsInDropDown()) 59 m_sPreservedText = GetURL(); 60 61 return SvtURLBox::PreNotify(_rNEvt); 62 } 63 64 //--------------------------------------------------------------------- Notify(NotifyEvent & _rNEvt)65 long OFileURLControl::Notify( NotifyEvent& _rNEvt ) 66 { 67 if (GetSubEdit() == _rNEvt.GetWindow()) 68 if (EVENT_KEYINPUT == _rNEvt.GetType()) 69 if (KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode()) 70 if (IsInDropDown()) 71 { 72 long nReturn = SvtURLBox::Notify(_rNEvt); 73 74 // build a system dependent (thus more user readable) file name 75 OFileNotation aTransformer(m_sPreservedText, OFileNotation::N_URL); 76 SetText(aTransformer.get(OFileNotation::N_SYSTEM)); 77 Modify(); 78 79 // Update the pick list 80 UpdatePickList(); 81 82 return nReturn; 83 } 84 85 return SvtURLBox::Notify(_rNEvt); 86 } 87 88 //......................................................................... 89 } // namespace svt 90 //......................................................................... 91 92