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 : #include <FldRefTreeListBox.hxx>
21 :
22 : #include <helpid.h>
23 : #include <vcl/builder.hxx>
24 : #include <vcl/help.hxx>
25 :
26 0 : SwFldRefTreeListBox::SwFldRefTreeListBox(vcl::Window* pParent, WinBits nStyle)
27 0 : : SvTreeListBox(pParent, nStyle)
28 : {
29 0 : }
30 :
31 0 : extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwFldRefTreeListBox(vcl::Window *pParent, VclBuilder::stringmap &rMap)
32 : {
33 0 : WinBits nWinStyle = WB_TABSTOP;
34 0 : OString sBorder = VclBuilder::extractCustomProperty(rMap);
35 0 : if (!sBorder.isEmpty())
36 0 : nWinStyle |= WB_BORDER;
37 0 : return new SwFldRefTreeListBox(pParent, nWinStyle);
38 : }
39 :
40 0 : void SwFldRefTreeListBox::RequestHelp( const HelpEvent& rHEvt )
41 : {
42 0 : bool bCallBase( true );
43 0 : if ( rHEvt.GetMode() & HELPMODE_QUICK )
44 : {
45 0 : Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
46 0 : SvTreeListEntry* pEntry = GetEntry( aPos );
47 0 : if( pEntry )
48 : {
49 0 : OUString sEntry( GetEntryText( pEntry ) );
50 : SvLBoxTab* pTab;
51 0 : SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
52 0 : if( pItem )
53 : {
54 0 : aPos = GetEntryPosition( pEntry );
55 :
56 0 : aPos.X() = GetTabPos( pEntry, pTab );
57 0 : Size aSize( pItem->GetSize( this, pEntry ) );
58 :
59 0 : if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
60 0 : aSize.Width() = GetSizePixel().Width() - aPos.X();
61 :
62 0 : aPos = OutputToScreenPixel(aPos);
63 0 : Rectangle aItemRect( aPos, aSize );
64 : Help::ShowQuickHelp( this, aItemRect, sEntry,
65 0 : QUICKHELP_LEFT|QUICKHELP_VCENTER );
66 0 : bCallBase = false;
67 0 : }
68 : }
69 : }
70 0 : if ( bCallBase )
71 : {
72 0 : Window::RequestHelp( rHEvt );
73 : }
74 0 : }
75 :
76 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|