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 :
21 : #include <svtools/urlcontrol.hxx>
22 : #include "svl/filenotation.hxx"
23 :
24 : //.........................................................................
25 : namespace svt
26 : {
27 : //.........................................................................
28 :
29 : //=====================================================================
30 : //= OFileURLControl
31 : //=====================================================================
32 : //---------------------------------------------------------------------
33 0 : OFileURLControl::OFileURLControl(Window* _pParent, const ResId& _rId)
34 0 : :SvtURLBox(_pParent, _rId, INET_PROT_FILE)
35 : {
36 0 : DisableHistory();
37 0 : }
38 :
39 : //---------------------------------------------------------------------
40 0 : long OFileURLControl::PreNotify( NotifyEvent& _rNEvt )
41 : {
42 0 : if (GetSubEdit() == _rNEvt.GetWindow())
43 0 : if (EVENT_KEYINPUT == _rNEvt.GetType())
44 0 : if (KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode())
45 0 : if (IsInDropDown())
46 0 : m_sPreservedText = GetURL();
47 :
48 0 : return SvtURLBox::PreNotify(_rNEvt);
49 : }
50 :
51 : //---------------------------------------------------------------------
52 0 : long OFileURLControl::Notify( NotifyEvent& _rNEvt )
53 : {
54 0 : if (GetSubEdit() == _rNEvt.GetWindow())
55 0 : if (EVENT_KEYINPUT == _rNEvt.GetType())
56 0 : if (KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode())
57 0 : if (IsInDropDown())
58 : {
59 0 : long nReturn = SvtURLBox::Notify(_rNEvt);
60 :
61 : // build a system dependent (thus more user readable) file name
62 0 : OFileNotation aTransformer(m_sPreservedText, OFileNotation::N_URL);
63 0 : SetText(aTransformer.get(OFileNotation::N_SYSTEM));
64 0 : Modify();
65 :
66 : // Update the pick list
67 0 : UpdatePickList();
68 :
69 0 : return nReturn;
70 : }
71 :
72 0 : return SvtURLBox::Notify(_rNEvt);
73 : }
74 :
75 : //.........................................................................
76 : } // namespace svt
77 : //.........................................................................
78 :
79 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|