Bump version to 5.0-14
[LibreOffice.git] / svtools / source / control / urlcontrol.cxx
blob00864126fe0c5c1c4b9b1c7674dc310bc04365a7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <svl/filenotation.hxx>
21 #include <svtools/urlcontrol.hxx>
22 #include <vcl/layout.hxx>
23 #include <vcl/builderfactory.hxx>
25 namespace svt
27 //= OFileURLControl
28 OFileURLControl::OFileURLControl(vcl::Window* _pParent, WinBits nStyle)
29 : SvtURLBox(_pParent, nStyle, INetProtocol::File)
31 DisableHistory();
34 VCL_BUILDER_DECL_FACTORY(OFileURLControl)
36 (void)rMap;
37 WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_TABSTOP|
38 WB_DROPDOWN|WB_AUTOSIZE|WB_AUTOHSCROLL;
39 VclPtrInstance<OFileURLControl> pListBox(pParent, nWinBits);
40 pListBox->EnableAutoSize(true);
41 rRet = pListBox;
44 bool OFileURLControl::PreNotify( NotifyEvent& _rNEvt )
46 if (GetSubEdit() == _rNEvt.GetWindow())
47 if (MouseNotifyEvent::KEYINPUT == _rNEvt.GetType())
48 if (KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode())
49 if (IsInDropDown())
50 m_sPreservedText = GetURL();
52 return SvtURLBox::PreNotify(_rNEvt);
55 bool OFileURLControl::Notify( NotifyEvent& _rNEvt )
57 if (GetSubEdit() == _rNEvt.GetWindow())
58 if (MouseNotifyEvent::KEYINPUT == _rNEvt.GetType())
59 if (KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode())
60 if (IsInDropDown())
62 bool nReturn = SvtURLBox::Notify(_rNEvt);
64 // build a system dependent (thus more user readable) file name
65 OFileNotation aTransformer(m_sPreservedText, OFileNotation::N_URL);
66 SetText(aTransformer.get(OFileNotation::N_SYSTEM));
67 Modify();
69 // Update the pick list
70 UpdatePickList();
72 return nReturn;
75 return SvtURLBox::Notify(_rNEvt);
77 } // namespace svt
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */