2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-21 14:30:25 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2008-02-26 09:46:27 +00:00
|
|
|
|
|
|
|
#include <FldRefTreeListBox.hxx>
|
|
|
|
|
|
|
|
#include <helpid.h>
|
2015-05-11 13:42:10 +01:00
|
|
|
#include <vcl/builderfactory.hxx>
|
2008-02-26 09:46:27 +00:00
|
|
|
#include <vcl/help.hxx>
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
SwFieldRefTreeListBox::SwFieldRefTreeListBox(vcl::Window* pParent, WinBits nStyle)
|
2013-08-21 08:54:17 +01:00
|
|
|
: SvTreeListBox(pParent, nStyle)
|
2008-02-26 09:46:27 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
VCL_BUILDER_DECL_FACTORY(SwFieldRefTreeListBox)
|
2008-02-26 09:46:27 +00:00
|
|
|
{
|
2013-08-21 08:54:17 +01:00
|
|
|
WinBits nWinStyle = WB_TABSTOP;
|
|
|
|
OString sBorder = VclBuilder::extractCustomProperty(rMap);
|
|
|
|
if (!sBorder.isEmpty())
|
|
|
|
nWinStyle |= WB_BORDER;
|
2015-05-20 13:05:49 +02:00
|
|
|
rRet = VclPtr<SwFieldRefTreeListBox>::Create(pParent, nWinStyle);
|
2008-02-26 09:46:27 +00:00
|
|
|
}
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
void SwFieldRefTreeListBox::RequestHelp( const HelpEvent& rHEvt )
|
2008-02-26 09:46:27 +00:00
|
|
|
{
|
|
|
|
bool bCallBase( true );
|
2014-11-10 13:34:35 +02:00
|
|
|
if ( rHEvt.GetMode() & HelpEventMode::QUICK )
|
2008-02-26 09:46:27 +00:00
|
|
|
{
|
|
|
|
Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = GetEntry( aPos );
|
2008-02-26 09:46:27 +00:00
|
|
|
if( pEntry )
|
|
|
|
{
|
2013-10-14 10:22:30 +02:00
|
|
|
OUString sEntry( GetEntryText( pEntry ) );
|
2008-02-26 09:46:27 +00:00
|
|
|
SvLBoxTab* pTab;
|
|
|
|
SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
|
|
|
|
if( pItem )
|
|
|
|
{
|
|
|
|
aPos = GetEntryPosition( pEntry );
|
|
|
|
|
|
|
|
aPos.X() = GetTabPos( pEntry, pTab );
|
|
|
|
Size aSize( pItem->GetSize( this, pEntry ) );
|
|
|
|
|
|
|
|
if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
|
|
|
|
aSize.Width() = GetSizePixel().Width() - aPos.X();
|
|
|
|
|
|
|
|
aPos = OutputToScreenPixel(aPos);
|
|
|
|
Rectangle aItemRect( aPos, aSize );
|
|
|
|
Help::ShowQuickHelp( this, aItemRect, sEntry,
|
2015-05-14 10:39:01 +02:00
|
|
|
QuickHelpFlags::Left|QuickHelpFlags::VCenter );
|
2008-02-26 09:46:27 +00:00
|
|
|
bCallBase = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( bCallBase )
|
|
|
|
{
|
|
|
|
Window::RequestHelp( rHEvt );
|
|
|
|
}
|
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|