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 .
20 #include <svl/filenotation.hxx>
21 #include <svtools/urlcontrol.hxx>
22 #include <vcl/layout.hxx>
23 #include <vcl/builderfactory.hxx>
28 OFileURLControl::OFileURLControl(vcl::Window
* _pParent
, WinBits nStyle
)
29 : SvtURLBox(_pParent
, nStyle
, INetProtocol::File
)
34 VCL_BUILDER_DECL_FACTORY(OFileURLControl
)
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);
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())
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())
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
));
69 // Update the pick list
75 return SvtURLBox::Notify(_rNEvt
);
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */