Branch data 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 <FldRefTreeListBox.hxx>
22 : :
23 : : #include <helpid.h>
24 : : #include <vcl/help.hxx>
25 : :
26 : 0 : SwFldRefTreeListBox::SwFldRefTreeListBox( Window* pParent,
27 : : const ResId& rResId)
28 : 0 : : SvTreeListBox( pParent, rResId )
29 : : {
30 : 0 : SetHelpId( HID_REFSELECTION_TOOLTIP );
31 : 0 : }
32 : :
33 : 0 : SwFldRefTreeListBox::~SwFldRefTreeListBox()
34 : : {
35 : 0 : }
36 : :
37 : 0 : void SwFldRefTreeListBox::RequestHelp( const HelpEvent& rHEvt )
38 : : {
39 : 0 : bool bCallBase( true );
40 : 0 : if ( rHEvt.GetMode() & HELPMODE_QUICK )
41 : : {
42 : 0 : Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
43 : 0 : SvLBoxEntry* pEntry = GetEntry( aPos );
44 : 0 : if( pEntry )
45 : : {
46 : 0 : String sEntry( GetEntryText( pEntry ) );
47 : : SvLBoxTab* pTab;
48 : 0 : SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
49 : 0 : if( pItem )
50 : : {
51 : 0 : aPos = GetEntryPosition( pEntry );
52 : :
53 : 0 : aPos.X() = GetTabPos( pEntry, pTab );
54 : 0 : Size aSize( pItem->GetSize( this, pEntry ) );
55 : :
56 : 0 : if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
57 : 0 : aSize.Width() = GetSizePixel().Width() - aPos.X();
58 : :
59 : 0 : aPos = OutputToScreenPixel(aPos);
60 : 0 : Rectangle aItemRect( aPos, aSize );
61 : : Help::ShowQuickHelp( this, aItemRect, sEntry,
62 : 0 : QUICKHELP_LEFT|QUICKHELP_VCENTER );
63 : 0 : bCallBase = false;
64 : 0 : }
65 : : }
66 : : }
67 : 0 : if ( bCallBase )
68 : : {
69 : 0 : Window::RequestHelp( rHEvt );
70 : : }
71 : 0 : }
72 : :
73 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|