Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <svtools/urlcontrol.hxx>
31 : : #include "svl/filenotation.hxx"
32 : :
33 : : //.........................................................................
34 : : namespace svt
35 : : {
36 : : //.........................................................................
37 : :
38 : : //=====================================================================
39 : : //= OFileURLControl
40 : : //=====================================================================
41 : : //---------------------------------------------------------------------
42 : 0 : OFileURLControl::OFileURLControl(Window* _pParent, const ResId& _rId)
43 [ # # ]: 0 : :SvtURLBox(_pParent, _rId, INET_PROT_FILE)
44 : : {
45 [ # # ]: 0 : DisableHistory();
46 : 0 : }
47 : :
48 : : //---------------------------------------------------------------------
49 : 0 : long OFileURLControl::PreNotify( NotifyEvent& _rNEvt )
50 : : {
51 [ # # ]: 0 : if (GetSubEdit() == _rNEvt.GetWindow())
52 [ # # ]: 0 : if (EVENT_KEYINPUT == _rNEvt.GetType())
53 [ # # ]: 0 : if (KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode())
54 [ # # ]: 0 : if (IsInDropDown())
55 [ # # ]: 0 : m_sPreservedText = GetURL();
56 : :
57 : 0 : return SvtURLBox::PreNotify(_rNEvt);
58 : : }
59 : :
60 : : //---------------------------------------------------------------------
61 : 0 : long OFileURLControl::Notify( NotifyEvent& _rNEvt )
62 : : {
63 [ # # ]: 0 : if (GetSubEdit() == _rNEvt.GetWindow())
64 [ # # ]: 0 : if (EVENT_KEYINPUT == _rNEvt.GetType())
65 [ # # ]: 0 : if (KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode())
66 [ # # ]: 0 : if (IsInDropDown())
67 : : {
68 [ # # ]: 0 : long nReturn = SvtURLBox::Notify(_rNEvt);
69 : :
70 : : // build a system dependent (thus more user readable) file name
71 [ # # ][ # # ]: 0 : OFileNotation aTransformer(m_sPreservedText, OFileNotation::N_URL);
72 [ # # ][ # # ]: 0 : SetText(aTransformer.get(OFileNotation::N_SYSTEM));
[ # # ][ # # ]
73 [ # # ]: 0 : Modify();
74 : :
75 : : // Update the pick list
76 [ # # ]: 0 : UpdatePickList();
77 : :
78 [ # # ]: 0 : return nReturn;
79 : : }
80 : :
81 : 0 : return SvtURLBox::Notify(_rNEvt);
82 : : }
83 : :
84 : : //.........................................................................
85 : : } // namespace svt
86 : : //.........................................................................
87 : :
88 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|