1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <svtools/urlcontrol.hxx>
22 #include "svl/filenotation.hxx"
24 //.........................................................................
27 //.........................................................................
29 //=====================================================================
31 //=====================================================================
32 //---------------------------------------------------------------------
33 OFileURLControl::OFileURLControl(Window
* _pParent
, const ResId
& _rId
)
34 :SvtURLBox(_pParent
, _rId
, INET_PROT_FILE
)
39 //---------------------------------------------------------------------
40 long OFileURLControl::PreNotify( NotifyEvent
& _rNEvt
)
42 if (GetSubEdit() == _rNEvt
.GetWindow())
43 if (EVENT_KEYINPUT
== _rNEvt
.GetType())
44 if (KEY_RETURN
== _rNEvt
.GetKeyEvent()->GetKeyCode().GetCode())
46 m_sPreservedText
= GetURL();
48 return SvtURLBox::PreNotify(_rNEvt
);
51 //---------------------------------------------------------------------
52 long OFileURLControl::Notify( NotifyEvent
& _rNEvt
)
54 if (GetSubEdit() == _rNEvt
.GetWindow())
55 if (EVENT_KEYINPUT
== _rNEvt
.GetType())
56 if (KEY_RETURN
== _rNEvt
.GetKeyEvent()->GetKeyCode().GetCode())
59 long nReturn
= SvtURLBox::Notify(_rNEvt
);
61 // build a system dependent (thus more user readable) file name
62 OFileNotation
aTransformer(m_sPreservedText
, OFileNotation::N_URL
);
63 SetText(aTransformer
.get(OFileNotation::N_SYSTEM
));
66 // Update the pick list
72 return SvtURLBox::Notify(_rNEvt
);
75 //.........................................................................
77 //.........................................................................
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */