Files
libreoffice/vcl/source/control/combobox.cxx

1588 lines
50 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 16:07:07 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:07:07 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 16:07:07 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 16:07:07 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
2000-09-18 16:07:07 +00:00
#include <tools/table.hxx>
#include <tools/debug.hxx>
#include <tools/rc.h>
#include <vcl/decoview.hxx>
#include <vcl/lstbox.h>
#include <vcl/button.hxx>
#include <vcl/event.hxx>
#include <vcl/combobox.hxx>
#include <svdata.hxx>
#include <subedit.hxx>
#include <ilstbox.hxx>
#include <controldata.hxx>
2000-09-18 16:07:07 +00:00
// =======================================================================
inline sal_uLong ImplCreateKey( sal_uInt16 nPos )
2000-09-18 16:07:07 +00:00
{
// Key = Pos+1, wegen Pos 0
return nPos+1;
}
// -----------------------------------------------------------------------
static void lcl_GetSelectedEntries( Table& rSelectedPos, const XubString& rText, xub_Unicode cTokenSep, const ImplEntryList* pEntryList )
{
for( xub_StrLen n = rText.GetTokenCount( cTokenSep ); n; )
{
XubString aToken = rText.GetToken( --n, cTokenSep );
aToken.EraseLeadingAndTrailingChars( ' ' );
sal_uInt16 nPos = pEntryList->FindEntry( aToken );
2000-09-18 16:07:07 +00:00
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
rSelectedPos.Insert( ImplCreateKey( nPos ), (void*)sal_IntPtr(1L) );
2000-09-18 16:07:07 +00:00
}
}
// =======================================================================
2000-09-18 16:07:07 +00:00
ComboBox::ComboBox( WindowType nType ) :
Edit( nType )
{
ImplInitComboBoxData();
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
ComboBox::ComboBox( Window* pParent, WinBits nStyle ) :
Edit( WINDOW_COMBOBOX )
{
ImplInitComboBoxData();
2000-09-18 16:07:07 +00:00
ImplInit( pParent, nStyle );
}
// -----------------------------------------------------------------------
ComboBox::ComboBox( Window* pParent, const ResId& rResId ) :
Edit( WINDOW_COMBOBOX )
{
ImplInitComboBoxData();
2000-09-18 16:07:07 +00:00
rResId.SetRT( RSC_COMBOBOX );
WinBits nStyle = ImplInitRes( rResId );
ImplInit( pParent, nStyle );
ImplLoadRes( rResId );
if ( !(nStyle & WB_HIDE ) )
Show();
}
// -----------------------------------------------------------------------
ComboBox::~ComboBox()
{
SetSubEdit( NULL );
delete mpSubEdit;
delete mpImplLB;
mpImplLB = NULL;
delete mpFloatWin;
delete mpBtn;
}
// -----------------------------------------------------------------------
void ComboBox::ImplInitComboBoxData()
2000-09-18 16:07:07 +00:00
{
mpSubEdit = NULL;
mpBtn = NULL;
mpImplLB = NULL;
mpFloatWin = NULL;
mnDDHeight = 0;
mbDDAutoSize = sal_True;
mbSyntheticModify = sal_False;
mbMatchCase = sal_False;
2000-09-18 16:07:07 +00:00
mcMultiSep = ';';
}
// -----------------------------------------------------------------------
void ComboBox::ImplCalcEditHeight()
{
sal_Int32 nLeft, nTop, nRight, nBottom;
2000-09-18 16:07:07 +00:00
GetBorder( nLeft, nTop, nRight, nBottom );
mnDDHeight = (sal_uInt16)(mpSubEdit->GetTextHeight() + nTop + nBottom + 4);
2000-09-18 16:07:07 +00:00
if ( !IsDropDownBox() )
mnDDHeight += 4;
Rectangle aCtrlRegion( Point( 0, 0 ), Size( 10, 10 ) );
Rectangle aBoundRegion, aContentRegion;
ImplControlValue aControlValue;
ControlType aType = IsDropDownBox() ? CTRL_COMBOBOX : CTRL_EDITBOX;
if( GetNativeControlRegion( aType, PART_ENTIRE_CONTROL,
aCtrlRegion,
CTRL_STATE_ENABLED,
aControlValue, rtl::OUString(),
aBoundRegion, aContentRegion ) )
{
const long nNCHeight = aBoundRegion.GetHeight();
if( mnDDHeight < nNCHeight )
mnDDHeight = sal::static_int_cast<sal_uInt16>( nNCHeight );
}
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void ComboBox::ImplInit( Window* pParent, WinBits nStyle )
{
ImplInitStyle( nStyle );
sal_Bool bNoBorder = ( nStyle & WB_NOBORDER ) ? sal_True : sal_False;
2000-09-18 16:07:07 +00:00
if ( !(nStyle & WB_DROPDOWN) )
{
nStyle &= ~WB_BORDER;
nStyle |= WB_NOBORDER;
}
else
{
if ( !bNoBorder )
nStyle |= WB_BORDER;
}
Edit::ImplInit( pParent, nStyle );
SetBackground();
// DropDown ?
WinBits nEditStyle = nStyle & ( WB_LEFT | WB_RIGHT | WB_CENTER );
2000-09-18 16:07:07 +00:00
WinBits nListStyle = nStyle;
if( nStyle & WB_DROPDOWN )
{
mpFloatWin = new ImplListBoxFloatingWindow( this );
mpFloatWin->SetAutoWidth( sal_True );
2000-09-18 16:07:07 +00:00
mpFloatWin->SetPopupModeEndHdl( LINK( this, ComboBox, ImplPopupModeEndHdl ) );
mpBtn = new ImplBtn( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
ImplInitDropDownButton( mpBtn );
mpBtn->SetMBDownHdl( LINK( this, ComboBox, ImplClickBtnHdl ) );
mpBtn->Show();
nEditStyle |= WB_NOBORDER;
nListStyle &= ~WB_BORDER;
nListStyle |= WB_NOBORDER;
}
else
{
if ( !bNoBorder )
{
nEditStyle |= WB_BORDER;
nListStyle &= ~WB_NOBORDER;
nListStyle |= WB_BORDER;
}
}
mpSubEdit = new Edit( this, nEditStyle );
mpSubEdit->EnableRTL( sal_False );
2000-09-18 16:07:07 +00:00
SetSubEdit( mpSubEdit );
mpSubEdit->SetPosPixel( Point() );
EnableAutocomplete( sal_True );
2000-09-18 16:07:07 +00:00
mpSubEdit->Show();
Window* pLBParent = this;
if ( mpFloatWin )
pLBParent = mpFloatWin;
mpImplLB = new ImplListBox( pLBParent, nListStyle|WB_SIMPLEMODE|WB_AUTOHSCROLL );
2000-09-18 16:07:07 +00:00
mpImplLB->SetPosPixel( Point() );
mpImplLB->SetSelectHdl( LINK( this, ComboBox, ImplSelectHdl ) );
mpImplLB->SetCancelHdl( LINK( this, ComboBox, ImplCancelHdl ) );
mpImplLB->SetDoubleClickHdl( LINK( this, ComboBox, ImplDoubleClickHdl ) );
mpImplLB->SetUserDrawHdl( LINK( this, ComboBox, ImplUserDrawHdl ) );
mpImplLB->SetSelectionChangedHdl( LINK( this, ComboBox, ImplSelectionChangedHdl ) );
mpImplLB->Show();
if ( mpFloatWin )
mpFloatWin->SetImplListBox( mpImplLB );
else
mpImplLB->GetMainWindow()->AllowGrabFocus( sal_True );
2000-09-18 16:07:07 +00:00
ImplCalcEditHeight();
SetCompoundControl( sal_True );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
WinBits ComboBox::ImplInitStyle( WinBits nStyle )
{
if ( !(nStyle & WB_NOTABSTOP) )
nStyle |= WB_TABSTOP;
if ( !(nStyle & WB_NOGROUP) )
nStyle |= WB_GROUP;
return nStyle;
}
// -----------------------------------------------------------------------
void ComboBox::ImplLoadRes( const ResId& rResId )
{
Edit::ImplLoadRes( rResId );
sal_uLong nNumber = ReadLongRes();
2000-09-18 16:07:07 +00:00
if( nNumber )
{
for( sal_uInt16 i = 0; i < nNumber; i++ )
2000-09-18 16:07:07 +00:00
{
InsertEntry( ReadStringRes(), LISTBOX_APPEND );
}
}
}
// -----------------------------------------------------------------------
void ComboBox::EnableAutocomplete( sal_Bool bEnable, sal_Bool bMatchCase )
2000-09-18 16:07:07 +00:00
{
mbMatchCase = bMatchCase;
if ( bEnable )
mpSubEdit->SetAutocompleteHdl( LINK( this, ComboBox, ImplAutocompleteHdl ) );
else
mpSubEdit->SetAutocompleteHdl( Link() );
}
// -----------------------------------------------------------------------
sal_Bool ComboBox::IsAutocompleteEnabled() const
2000-09-18 16:07:07 +00:00
{
return mpSubEdit->GetAutocompleteHdl().IsSet();
}
// -----------------------------------------------------------------------
IMPL_LINK( ComboBox, ImplClickBtnHdl, void*, EMPTYARG )
{
ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN );
2000-09-18 16:07:07 +00:00
mpSubEdit->GrabFocus();
if ( !mpImplLB->GetEntryList()->GetMRUCount() )
ImplUpdateFloatSelection();
else
mpImplLB->SelectEntry( 0 , sal_True );
mpBtn->SetPressed( sal_True );
2001-07-17 15:45:11 +00:00
SetSelection( Selection( 0, SELECTION_MAX ) );
mpFloatWin->StartFloat( sal_True );
ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN );
ImplClearLayoutData();
if( mpImplLB )
mpImplLB->GetMainWindow()->ImplClearLayoutData();
2000-09-18 16:07:07 +00:00
return 0;
}
// -----------------------------------------------------------------------
IMPL_LINK( ComboBox, ImplPopupModeEndHdl, void*, EMPTYARG )
2000-09-18 16:07:07 +00:00
{
2002-08-23 13:34:36 +00:00
if( mpFloatWin->IsPopupModeCanceled() )
{
if ( !mpImplLB->GetEntryList()->IsEntryPosSelected( mpFloatWin->GetPopupModeStartSaveSelection() ) )
{
mpImplLB->SelectEntry( mpFloatWin->GetPopupModeStartSaveSelection(), sal_True );
sal_Bool bTravelSelect = mpImplLB->IsTravelSelect();
mpImplLB->SetTravelSelect( sal_True );
Select();
mpImplLB->SetTravelSelect( bTravelSelect );
}
}
2002-08-23 13:34:36 +00:00
ImplClearLayoutData();
if( mpImplLB )
mpImplLB->GetMainWindow()->ImplClearLayoutData();
mpBtn->SetPressed( sal_False );
ImplCallEventListeners( VCLEVENT_DROPDOWN_CLOSE );
2000-09-18 16:07:07 +00:00
return 0;
}
// -----------------------------------------------------------------------
IMPL_LINK( ComboBox, ImplAutocompleteHdl, Edit*, pEdit )
{
Selection aSel = pEdit->GetSelection();
AutocompleteAction eAction = pEdit->GetAutocompleteAction();
/* If there is no current selection do not auto complete on
Tab/Shift-Tab since then we would not cycle to the next field.
*/
2000-09-18 16:07:07 +00:00
if ( aSel.Len() ||
((eAction != AUTOCOMPLETE_TABFORWARD) && (eAction != AUTOCOMPLETE_TABBACKWARD)) )
{
XubString aFullText = pEdit->GetText();
XubString aStartText = aFullText.Copy( 0, (xub_StrLen)aSel.Max() );
sal_uInt16 nStart = mpImplLB->GetCurrentPos();
2000-09-18 16:07:07 +00:00
if ( nStart == LISTBOX_ENTRY_NOTFOUND )
nStart = 0;
sal_Bool bForward = sal_True;
2000-09-18 16:07:07 +00:00
if ( eAction == AUTOCOMPLETE_TABFORWARD )
nStart++;
else if ( eAction == AUTOCOMPLETE_TABBACKWARD )
{
bForward = sal_False;
nStart = nStart ? nStart - 1 : mpImplLB->GetEntryList()->GetEntryCount()-1;
2000-09-18 16:07:07 +00:00
}
sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND;
if( ! mbMatchCase )
{
// Try match case insensitive from current position
nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, nStart, bForward, sal_True );
if ( nPos == LISTBOX_ENTRY_NOTFOUND )
// Try match case insensitive, but from start
nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, bForward ? 0 : (mpImplLB->GetEntryList()->GetEntryCount()-1), bForward, sal_True );
}
if ( nPos == LISTBOX_ENTRY_NOTFOUND )
// Try match full from current position
nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, nStart, bForward, sal_False );
2000-09-18 16:07:07 +00:00
if ( nPos == LISTBOX_ENTRY_NOTFOUND )
// Match full, but from start
nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, bForward ? 0 : (mpImplLB->GetEntryList()->GetEntryCount()-1), bForward, sal_False );
2000-09-18 16:07:07 +00:00
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
{
XubString aText = mpImplLB->GetEntryList()->GetEntryText( nPos );
Selection aSelection( aText.Len(), aStartText.Len() );
pEdit->SetText( aText, aSelection );
2000-09-18 16:07:07 +00:00
}
}
return 0;
}
// -----------------------------------------------------------------------
IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG )
{
sal_Bool bPopup = IsInDropDown();
sal_Bool bCallSelect = sal_False;
2000-09-18 16:07:07 +00:00
if ( mpImplLB->IsSelectionChanged() || bPopup )
{
XubString aText;
if ( IsMultiSelectionEnabled() )
{
aText = mpSubEdit->GetText();
// Alle Eintraege entfernen, zu denen es einen Entry gibt, der aber nicht selektiert ist.
xub_StrLen nIndex = 0;
while ( nIndex != STRING_NOTFOUND )
{
xub_StrLen nPrevIndex = nIndex;
XubString aToken = aText.GetToken( 0, mcMultiSep, nIndex );
xub_StrLen nTokenLen = aToken.Len();
aToken.EraseLeadingAndTrailingChars( ' ' );
sal_uInt16 nP = mpImplLB->GetEntryList()->FindEntry( aToken );
2000-09-18 16:07:07 +00:00
if ( (nP != LISTBOX_ENTRY_NOTFOUND) && (!mpImplLB->GetEntryList()->IsEntryPosSelected( nP )) )
{
aText.Erase( nPrevIndex, nTokenLen );
nIndex = sal::static_int_cast<xub_StrLen>(nIndex - nTokenLen);
2000-09-18 16:07:07 +00:00
if ( (nPrevIndex < aText.Len()) && (aText.GetChar( nPrevIndex ) == mcMultiSep) )
{
aText.Erase( nPrevIndex, 1 );
nIndex--;
}
}
aText.EraseLeadingAndTrailingChars( ' ' );
}
// Fehlende Eintraege anhaengen...
Table aSelInText;
lcl_GetSelectedEntries( aSelInText, aText, mcMultiSep, mpImplLB->GetEntryList() );
sal_uInt16 nSelectedEntries = mpImplLB->GetEntryList()->GetSelectEntryCount();
for ( sal_uInt16 n = 0; n < nSelectedEntries; n++ )
2000-09-18 16:07:07 +00:00
{
sal_uInt16 nP = mpImplLB->GetEntryList()->GetSelectEntryPos( n );
2000-09-18 16:07:07 +00:00
if ( !aSelInText.IsKeyValid( ImplCreateKey( nP ) ) )
{
if ( aText.Len() && (aText.GetChar( aText.Len()-1 ) != mcMultiSep) )
aText += mcMultiSep;
if ( aText.Len() )
aText += ' '; // etwas auflockern
aText += mpImplLB->GetEntryList()->GetEntryText( nP );
aText += mcMultiSep;
}
}
if ( aText.Len() && (aText.GetChar( aText.Len()-1 ) == mcMultiSep) )
aText.Erase( aText.Len()-1, 1 );
}
else
{
aText = mpImplLB->GetEntryList()->GetSelectEntry( 0 );
}
mpSubEdit->SetText( aText );
Selection aNewSelection( 0, aText.Len() );
if ( IsMultiSelectionEnabled() )
aNewSelection.Min() = aText.Len();
mpSubEdit->SetSelection( aNewSelection );
bCallSelect = sal_True;
}
// #84652# Call GrabFocus and EndPopupMode before calling Select/Modify, but after changing the text
if ( bPopup && !mpImplLB->IsTravelSelect() &&
( !IsMultiSelectionEnabled() || !mpImplLB->GetSelectModifier() ) )
{
mpFloatWin->EndPopupMode();
GrabFocus();
}
if ( bCallSelect )
{
2000-09-18 16:07:07 +00:00
mpSubEdit->SetModifyFlag();
mbSyntheticModify = sal_True;
2000-09-18 16:07:07 +00:00
Modify();
mbSyntheticModify = sal_False;
if (ImplGetWindowImpl() != NULL) //liuchen 2009-7-28, resolve the problem that soffice get crashed if in ComboBox_Change event a Worksheets("SheetX").Activate sentence needs to be executed
{
Select();
}
2000-09-18 16:07:07 +00:00
}
return 0;
}
// -----------------------------------------------------------------------
IMPL_LINK( ComboBox, ImplCancelHdl, void*, EMPTYARG )
{
if( IsInDropDown() )
mpFloatWin->EndPopupMode();
return 1;
}
// -----------------------------------------------------------------------
IMPL_LINK( ComboBox, ImplSelectionChangedHdl, void*, n )
{
if ( !mpImplLB->IsTrackingSelect() )
{
sal_uInt16 nChanged = (sal_uInt16)(sal_uLong)n;
2000-09-18 16:07:07 +00:00
if ( !mpSubEdit->IsReadOnly() && mpImplLB->GetEntryList()->IsEntryPosSelected( nChanged ) )
mpSubEdit->SetText( mpImplLB->GetEntryList()->GetEntryText( nChanged ) );
}
return 1;
}
// -----------------------------------------------------------------------
IMPL_LINK( ComboBox, ImplDoubleClickHdl, void*, EMPTYARG )
{
DoubleClick();
return 0;
}
// -----------------------------------------------------------------------
void ComboBox::ToggleDropDown()
{
if( IsDropDownBox() )
{
if( mpFloatWin->IsInPopupMode() )
mpFloatWin->EndPopupMode();
else
{
mpSubEdit->GrabFocus();
if ( !mpImplLB->GetEntryList()->GetMRUCount() )
ImplUpdateFloatSelection();
else
mpImplLB->SelectEntry( 0 , sal_True );
ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN );
mpBtn->SetPressed( sal_True );
SetSelection( Selection( 0, SELECTION_MAX ) );
mpFloatWin->StartFloat( sal_True );
ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN );
}
}
}
// -----------------------------------------------------------------------
2000-09-18 16:07:07 +00:00
void ComboBox::Select()
{
ImplCallEventListenersAndHandler( VCLEVENT_COMBOBOX_SELECT, maSelectHdl, this );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void ComboBox::DoubleClick()
{
ImplCallEventListenersAndHandler( VCLEVENT_COMBOBOX_DOUBLECLICK, maDoubleClickHdl, this );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void ComboBox::EnableAutoSize( sal_Bool bAuto )
2000-09-18 16:07:07 +00:00
{
mbDDAutoSize = bAuto;
if ( mpFloatWin )
{
if ( bAuto && !mpFloatWin->GetDropDownLineCount() )
mpFloatWin->SetDropDownLineCount( 5 );
else if ( !bAuto )
mpFloatWin->SetDropDownLineCount( 0 );
}
}
2002-11-01 08:01:04 +00:00
// -----------------------------------------------------------------------
void ComboBox::EnableDDAutoWidth( sal_Bool b )
2002-11-01 08:01:04 +00:00
{
if ( mpFloatWin )
mpFloatWin->SetAutoWidth( b );
}
// -----------------------------------------------------------------------
sal_Bool ComboBox::IsDDAutoWidthEnabled() const
2002-11-01 08:01:04 +00:00
{
return mpFloatWin ? mpFloatWin->IsAutoWidth() : sal_False;
2002-11-01 08:01:04 +00:00
}
2000-09-18 16:07:07 +00:00
// -----------------------------------------------------------------------
void ComboBox::SetDropDownLineCount( sal_uInt16 nLines )
2000-09-18 16:07:07 +00:00
{
if ( mpFloatWin )
mpFloatWin->SetDropDownLineCount( nLines );
}
// -----------------------------------------------------------------------
sal_uInt16 ComboBox::GetDropDownLineCount() const
2000-09-18 16:07:07 +00:00
{
sal_uInt16 nLines = 0;
2000-09-18 16:07:07 +00:00
if ( mpFloatWin )
nLines = mpFloatWin->GetDropDownLineCount();
return nLines;
}
// -----------------------------------------------------------------------
void ComboBox::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight,
sal_uInt16 nFlags )
2000-09-18 16:07:07 +00:00
{
if( IsDropDownBox() && ( nFlags & WINDOW_POSSIZE_SIZE ) )
{
Size aPrefSz = mpFloatWin->GetPrefSize();
if ( ( nFlags & WINDOW_POSSIZE_HEIGHT ) && ( nHeight >= 2*mnDDHeight ) )
2000-09-18 16:07:07 +00:00
aPrefSz.Height() = nHeight-mnDDHeight;
if ( nFlags & WINDOW_POSSIZE_WIDTH )
aPrefSz.Width() = nWidth;
mpFloatWin->SetPrefSize( aPrefSz );
if ( IsAutoSizeEnabled() && ! (nFlags & WINDOW_POSSIZE_DROPDOWN) )
2000-09-18 16:07:07 +00:00
nHeight = mnDDHeight;
}
Edit::SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
}
// -----------------------------------------------------------------------
void ComboBox::Resize()
{
Control::Resize();
2000-09-18 16:07:07 +00:00
Size aOutSz = GetOutputSizePixel();
if( IsDropDownBox() )
{
long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
long nTop = 0;
long nBottom = aOutSz.Height();
Window *pBorder = GetWindow( WINDOW_BORDER );
ImplControlValue aControlValue;
Point aPoint;
Rectangle aContent, aBound;
// use the full extent of the control
Rectangle aArea( aPoint, pBorder->GetOutputSizePixel() );
if ( GetNativeControlRegion(CTRL_COMBOBOX, PART_BUTTON_DOWN,
aArea, 0, aControlValue, rtl::OUString(), aBound, aContent) )
{
// convert back from border space to local coordinates
aPoint = pBorder->ScreenToOutputPixel( OutputToScreenPixel( aPoint ) );
aContent.Move(-aPoint.X(), -aPoint.Y());
mpBtn->SetPosSizePixel( aContent.Left(), nTop, aContent.getWidth(), (nBottom-nTop) );
// adjust the size of the edit field
if ( GetNativeControlRegion(CTRL_COMBOBOX, PART_SUB_EDIT,
aArea, 0, aControlValue, rtl::OUString(), aBound, aContent) )
{
// convert back from border space to local coordinates
aContent.Move(-aPoint.X(), -aPoint.Y());
// use the themes drop down size
mpSubEdit->SetPosSizePixel( aContent.TopLeft(), aContent.GetSize() );
}
else
{
// use the themes drop down size for the button
aOutSz.Width() -= aContent.getWidth();
mpSubEdit->SetSizePixel( aOutSz );
}
}
else
{
nSBWidth = CalcZoom( nSBWidth );
CWS-TOOLING: integrate CWS rtlcontrols 2008-12-11 21:08:49 +0100 fs r265367 : CONTEXT_WRITING_MODE is transient 2008-12-11 21:08:00 +0100 fs r265365 : REGISTER_PROP_3 2008-12-11 20:53:44 +0100 fs r265362 : ContextWritingMode is not MAYBEVOID 2008-12-11 15:29:08 +0100 fs r265315 : prevent a deadlock during complex.dbaccess.DatabaseDocument test 2008-12-11 15:01:13 +0100 fs r265304 : manual RESYNC to m37 2008-12-10 20:04:38 +0100 pl r265230 : #i30631# fix a snafu in mirroring 2008-12-10 19:14:45 +0100 pl r265229 : #i30631# rework PaintToDevice for RTL controls 2008-12-05 10:19:13 +0100 fs r264893 : #i10000# ImplInitSettings => ImplInitWindow (ImplInitSettings clashed with base classes ImplInitSettings on unxsols4) 2008-12-03 12:55:24 +0100 fs r264768 : #i100000# 2008-12-03 07:11:48 +0100 fs r264741 : #i10000# 2008-12-02 10:37:51 +0100 fs r264670 : CWS-TOOLING: rebase CWS rtlcontrols to trunk@264325 (milestone: DEV300:m36) 2008-12-02 09:27:50 +0100 fs r264660 : merge from trunk 2008-11-25 10:28:36 +0100 ama r264277 : Fix #i94572# 2008-11-24 11:46:48 +0100 fs r264218 : #i30631# proper context writing mode 2008-11-24 09:38:04 +0100 fs r264204 : #i30631# (approved by PL) 2008-11-24 09:35:47 +0100 fs r264203 : #i30631# Context/WritingMode 2008-11-24 09:33:36 +0100 fs r264202 : #i30631# Context/WritingMode 2008-11-24 09:31:53 +0100 fs r264200 : #i30631# RTL 2008-11-19 08:51:48 +0100 fs r263963 : #i10000# 2008-11-18 20:58:11 +0100 fs r263878 : #i10000# 2008-11-18 15:30:44 +0100 fs r263778 : migrate the CWS from CVS to SVN the CVS changes contained in this change set are the ones between the following two CVS tags: CWS_DEV300_RTLCONTROLS_ANCHOR CWS_DEV300_RTLCONTROLS_PRE_MIGRATION 2008-11-18 12:29:04 +0100 ama r263762 : Fix #i94572#: Context direction for drawing objects 2008-11-18 12:25:50 +0100 ama r263761 : Fix #i94572#: Context direction for drawing objects 2008-11-18 12:02:30 +0100 ama r263759 : Fix #i94572#: Context direction for drawing objects
2008-12-16 13:30:53 +00:00
mpSubEdit->SetPosSizePixel( Point( 0, 0 ), Size( aOutSz.Width() - nSBWidth, aOutSz.Height() ) );
mpBtn->SetPosSizePixel( aOutSz.Width() - nSBWidth, nTop, nSBWidth, (nBottom-nTop) );
}
2000-09-18 16:07:07 +00:00
}
else
{
mpSubEdit->SetSizePixel( Size( aOutSz.Width(), mnDDHeight ) );
mpImplLB->SetPosSizePixel( 0, mnDDHeight, aOutSz.Width(), aOutSz.Height() - mnDDHeight );
if ( GetText().Len() )
ImplUpdateFloatSelection();
}
// FloatingWindow-Groesse auch im unsichtbare Zustand auf Stand halten,
// weil KEY_PGUP/DOWN ausgewertet wird...
if ( mpFloatWin )
mpFloatWin->SetSizePixel( mpFloatWin->CalcFloatSize() );
}
// -----------------------------------------------------------------------
void ComboBox::FillLayoutData() const
{
mpControlData->mpLayoutData = new vcl::ControlLayoutData();
AppendLayoutData( *mpSubEdit );
mpSubEdit->SetLayoutDataParent( this );
Control* pMainWindow = mpImplLB->GetMainWindow();
if( mpFloatWin )
{
// dropdown mode
if( mpFloatWin->IsReallyVisible() )
{
AppendLayoutData( *pMainWindow );
pMainWindow->SetLayoutDataParent( this );
}
}
else
{
AppendLayoutData( *pMainWindow );
pMainWindow->SetLayoutDataParent( this );
}
}
// -----------------------------------------------------------------------
2000-09-18 16:07:07 +00:00
void ComboBox::StateChanged( StateChangedType nType )
{
Edit::StateChanged( nType );
2002-04-24 13:49:10 +00:00
if ( nType == STATE_CHANGE_READONLY )
2000-09-18 16:07:07 +00:00
{
mpImplLB->SetReadOnly( IsReadOnly() );
if ( mpBtn )
mpBtn->Enable( IsEnabled() && !IsReadOnly() );
}
else if ( nType == STATE_CHANGE_ENABLE )
{
mpSubEdit->Enable( IsEnabled() );
mpImplLB->Enable( IsEnabled() && !IsReadOnly() );
if ( mpBtn )
mpBtn->Enable( IsEnabled() && !IsReadOnly() );
Invalidate();
}
else if( nType == STATE_CHANGE_UPDATEMODE )
{
mpImplLB->SetUpdateMode( IsUpdateMode() );
}
else if ( nType == STATE_CHANGE_ZOOM )
{
mpImplLB->SetZoom( GetZoom() );
mpSubEdit->SetZoom( GetZoom() );
ImplCalcEditHeight();
Resize();
}
else if ( nType == STATE_CHANGE_CONTROLFONT )
{
mpImplLB->SetControlFont( GetControlFont() );
mpSubEdit->SetControlFont( GetControlFont() );
ImplCalcEditHeight();
Resize();
}
else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
{
mpImplLB->SetControlForeground( GetControlForeground() );
mpSubEdit->SetControlForeground( GetControlForeground() );
}
else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
{
mpImplLB->SetControlBackground( GetControlBackground() );
mpSubEdit->SetControlBackground( GetControlBackground() );
}
else if ( nType == STATE_CHANGE_STYLE )
{
SetStyle( ImplInitStyle( GetStyle() ) );
mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? sal_True : sal_False );
2000-09-18 16:07:07 +00:00
}
CWS-TOOLING: integrate CWS rtlcontrols 2008-12-11 21:08:49 +0100 fs r265367 : CONTEXT_WRITING_MODE is transient 2008-12-11 21:08:00 +0100 fs r265365 : REGISTER_PROP_3 2008-12-11 20:53:44 +0100 fs r265362 : ContextWritingMode is not MAYBEVOID 2008-12-11 15:29:08 +0100 fs r265315 : prevent a deadlock during complex.dbaccess.DatabaseDocument test 2008-12-11 15:01:13 +0100 fs r265304 : manual RESYNC to m37 2008-12-10 20:04:38 +0100 pl r265230 : #i30631# fix a snafu in mirroring 2008-12-10 19:14:45 +0100 pl r265229 : #i30631# rework PaintToDevice for RTL controls 2008-12-05 10:19:13 +0100 fs r264893 : #i10000# ImplInitSettings => ImplInitWindow (ImplInitSettings clashed with base classes ImplInitSettings on unxsols4) 2008-12-03 12:55:24 +0100 fs r264768 : #i100000# 2008-12-03 07:11:48 +0100 fs r264741 : #i10000# 2008-12-02 10:37:51 +0100 fs r264670 : CWS-TOOLING: rebase CWS rtlcontrols to trunk@264325 (milestone: DEV300:m36) 2008-12-02 09:27:50 +0100 fs r264660 : merge from trunk 2008-11-25 10:28:36 +0100 ama r264277 : Fix #i94572# 2008-11-24 11:46:48 +0100 fs r264218 : #i30631# proper context writing mode 2008-11-24 09:38:04 +0100 fs r264204 : #i30631# (approved by PL) 2008-11-24 09:35:47 +0100 fs r264203 : #i30631# Context/WritingMode 2008-11-24 09:33:36 +0100 fs r264202 : #i30631# Context/WritingMode 2008-11-24 09:31:53 +0100 fs r264200 : #i30631# RTL 2008-11-19 08:51:48 +0100 fs r263963 : #i10000# 2008-11-18 20:58:11 +0100 fs r263878 : #i10000# 2008-11-18 15:30:44 +0100 fs r263778 : migrate the CWS from CVS to SVN the CVS changes contained in this change set are the ones between the following two CVS tags: CWS_DEV300_RTLCONTROLS_ANCHOR CWS_DEV300_RTLCONTROLS_PRE_MIGRATION 2008-11-18 12:29:04 +0100 ama r263762 : Fix #i94572#: Context direction for drawing objects 2008-11-18 12:25:50 +0100 ama r263761 : Fix #i94572#: Context direction for drawing objects 2008-11-18 12:02:30 +0100 ama r263759 : Fix #i94572#: Context direction for drawing objects
2008-12-16 13:30:53 +00:00
else if( nType == STATE_CHANGE_MIRRORING )
{
if( mpBtn )
{
mpBtn->EnableRTL( IsRTLEnabled() );
ImplInitDropDownButton( mpBtn );
}
mpSubEdit->StateChanged( STATE_CHANGE_MIRRORING );
mpImplLB->EnableRTL( IsRTLEnabled() );
Resize();
}
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void ComboBox::DataChanged( const DataChangedEvent& rDCEvt )
{
Control::DataChanged( rDCEvt );
if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
(rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
(rDCEvt.GetFlags() & SETTINGS_STYLE)) )
{
if ( mpBtn )
{
mpBtn->SetSettings( GetSettings() );
ImplInitDropDownButton( mpBtn );
}
Resize();
mpImplLB->Resize(); // Wird nicht durch ComboBox::Resize() gerufen, wenn sich die ImplLB nicht aendert.
SetBackground(); // due to a hack in Window::UpdateSettings the background must be reset
// otherwise it will overpaint NWF drawn comboboxes
2000-09-18 16:07:07 +00:00
}
}
// -----------------------------------------------------------------------
long ComboBox::PreNotify( NotifyEvent& rNEvt )
{
2009-09-08 10:44:42 +00:00
return Edit::PreNotify( rNEvt );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
long ComboBox::Notify( NotifyEvent& rNEvt )
{
long nDone = 0;
if( ( rNEvt.GetType() == EVENT_KEYINPUT ) && ( rNEvt.GetWindow() == mpSubEdit )
&& !IsReadOnly() )
{
KeyEvent aKeyEvt = *rNEvt.GetKeyEvent();
sal_uInt16 nKeyCode = aKeyEvt.GetKeyCode().GetCode();
2000-09-18 16:07:07 +00:00
switch( nKeyCode )
{
case KEY_UP:
case KEY_DOWN:
case KEY_PAGEUP:
case KEY_PAGEDOWN:
{
ImplUpdateFloatSelection();
if( ( nKeyCode == KEY_DOWN ) && mpFloatWin && !mpFloatWin->IsInPopupMode() && aKeyEvt.GetKeyCode().IsMod2() )
{
ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN );
mpBtn->SetPressed( sal_True );
2000-09-18 16:07:07 +00:00
if ( mpImplLB->GetEntryList()->GetMRUCount() )
mpImplLB->SelectEntry( 0 , sal_True );
2001-07-17 15:45:11 +00:00
SetSelection( Selection( 0, SELECTION_MAX ) );
mpFloatWin->StartFloat( sal_False );
ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN );
2000-09-18 16:07:07 +00:00
nDone = 1;
}
else if( ( nKeyCode == KEY_UP ) && mpFloatWin && mpFloatWin->IsInPopupMode() && aKeyEvt.GetKeyCode().IsMod2() )
{
mpFloatWin->EndPopupMode();
nDone = 1;
}
else
{
2000-09-18 16:07:07 +00:00
nDone = mpImplLB->ProcessKeyInput( aKeyEvt );
}
2000-09-18 16:07:07 +00:00
}
break;
case KEY_RETURN:
{
if( ( rNEvt.GetWindow() == mpSubEdit ) && IsInDropDown() )
{
mpImplLB->ProcessKeyInput( aKeyEvt );
nDone = 1;
}
}
break;
}
}
else if ( (rNEvt.GetType() == EVENT_LOSEFOCUS) && mpFloatWin )
{
if( mpFloatWin->HasChildPathFocus() )
mpSubEdit->GrabFocus();
else if ( mpFloatWin->IsInPopupMode() && !HasChildPathFocus( sal_True ) )
2000-09-18 16:07:07 +00:00
mpFloatWin->EndPopupMode();
}
else if( (rNEvt.GetType() == EVENT_COMMAND) &&
(rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL) &&
(rNEvt.GetWindow() == mpSubEdit) )
{
sal_uInt16 nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() );
CWS-TOOLING: integrate CWS dba32c 2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion 2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time 2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths 2009-06-29 10:08:54 +0200 fs r273455 : #i103138# refactored the code for positioning/zooming the control Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to take an additional ViewTransformation parameter, describing the transformation to obtain the actual control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter. This has become necessary since during painting, the device which we created our control for might not necessarily have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size, this would lead to wrong results. Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken. Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ... I consider it broken, since: - we need the map mode to obtain the proper zoom level, which is to be forwarded to the control - there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears). It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand one has no possibility to obtain the current zoom by other means. Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used, which means the controls have a zoom of "1:1" set, which is wrong here. 2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties 2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning 2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed 2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc 2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux 2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux 2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar 2009-06-15 14:11:27 +0200 fs r272983 : added since tag 2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted 2009-06-15 11:08:53 +0200 fs r272969 : #i10000# 2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701# 2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src 2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50) 2009-06-02 09:53:10 +0200 fs r272483 : #i10000# 2009-05-29 15:55:03 +0200 fs r272465 : #i100818# 2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any 2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition 2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex 2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed 2009-05-27 14:53:36 +0200 fs r272347 : #i10000# 2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast 2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly 2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used 2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function 2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well 2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution 2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set 2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition 2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria 2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR 2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein 2009-05-25 15:49:57 +0200 fs r272254 : #i999704# 2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property 2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString 2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein 2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property 2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property) 2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default 2009-05-25 14:39:31 +0200 fs r272243 : removed dead import 2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns 2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent 2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel 2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event 2009-05-22 21:42:47 +0200 fs r272211 : #i102003# 2009-05-22 21:42:20 +0200 fs r272210 : grammar 2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously 2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear 2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG 2009-05-22 12:03:42 +0200 fs r272180 : #i88878# provided by noel.power@novell.com implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs 2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them 2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values 2009-05-15 15:08:31 +0200 fs r271937 : includes 2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint 2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity 2009-05-15 10:15:44 +0200 fs r271928 : #i10000# 2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:23:23 +0200 fs r271919 : #i101622# 2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids 2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b) 2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48 2009-05-07 14:43:19 +0200 fs r271670 : #i101477# 2009-05-07 14:37:30 +0200 fs r271668 : #i101477# 2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch 2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics 2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47) 2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control 2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
if ( ( nWheelBehavior == MOUSE_WHEEL_ALWAYS )
|| ( ( nWheelBehavior == MOUSE_WHEEL_FOCUS_ONLY )
&& HasChildPathFocus()
)
)
{
nDone = mpImplLB->HandleWheelAsCursorTravel( *rNEvt.GetCommandEvent() );
CWS-TOOLING: integrate CWS dba32c 2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion 2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time 2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths 2009-06-29 10:08:54 +0200 fs r273455 : #i103138# refactored the code for positioning/zooming the control Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to take an additional ViewTransformation parameter, describing the transformation to obtain the actual control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter. This has become necessary since during painting, the device which we created our control for might not necessarily have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size, this would lead to wrong results. Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken. Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ... I consider it broken, since: - we need the map mode to obtain the proper zoom level, which is to be forwarded to the control - there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears). It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand one has no possibility to obtain the current zoom by other means. Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used, which means the controls have a zoom of "1:1" set, which is wrong here. 2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties 2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning 2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed 2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc 2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux 2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux 2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar 2009-06-15 14:11:27 +0200 fs r272983 : added since tag 2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted 2009-06-15 11:08:53 +0200 fs r272969 : #i10000# 2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701# 2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src 2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50) 2009-06-02 09:53:10 +0200 fs r272483 : #i10000# 2009-05-29 15:55:03 +0200 fs r272465 : #i100818# 2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any 2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition 2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex 2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed 2009-05-27 14:53:36 +0200 fs r272347 : #i10000# 2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast 2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly 2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used 2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function 2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well 2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution 2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set 2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition 2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria 2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR 2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein 2009-05-25 15:49:57 +0200 fs r272254 : #i999704# 2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property 2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString 2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein 2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property 2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property) 2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default 2009-05-25 14:39:31 +0200 fs r272243 : removed dead import 2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns 2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent 2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel 2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event 2009-05-22 21:42:47 +0200 fs r272211 : #i102003# 2009-05-22 21:42:20 +0200 fs r272210 : grammar 2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously 2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear 2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG 2009-05-22 12:03:42 +0200 fs r272180 : #i88878# provided by noel.power@novell.com implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs 2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them 2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values 2009-05-15 15:08:31 +0200 fs r271937 : includes 2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint 2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity 2009-05-15 10:15:44 +0200 fs r271928 : #i10000# 2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:23:23 +0200 fs r271919 : #i101622# 2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids 2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b) 2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48 2009-05-07 14:43:19 +0200 fs r271670 : #i101477# 2009-05-07 14:37:30 +0200 fs r271668 : #i101477# 2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch 2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics 2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47) 2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control 2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
}
else
CWS-TOOLING: integrate CWS dba32c 2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion 2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time 2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths 2009-06-29 10:08:54 +0200 fs r273455 : #i103138# refactored the code for positioning/zooming the control Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to take an additional ViewTransformation parameter, describing the transformation to obtain the actual control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter. This has become necessary since during painting, the device which we created our control for might not necessarily have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size, this would lead to wrong results. Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken. Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ... I consider it broken, since: - we need the map mode to obtain the proper zoom level, which is to be forwarded to the control - there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears). It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand one has no possibility to obtain the current zoom by other means. Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used, which means the controls have a zoom of "1:1" set, which is wrong here. 2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties 2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning 2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed 2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc 2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux 2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux 2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar 2009-06-15 14:11:27 +0200 fs r272983 : added since tag 2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted 2009-06-15 11:08:53 +0200 fs r272969 : #i10000# 2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701# 2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src 2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50) 2009-06-02 09:53:10 +0200 fs r272483 : #i10000# 2009-05-29 15:55:03 +0200 fs r272465 : #i100818# 2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any 2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition 2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex 2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed 2009-05-27 14:53:36 +0200 fs r272347 : #i10000# 2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast 2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly 2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used 2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function 2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well 2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution 2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set 2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition 2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria 2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR 2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein 2009-05-25 15:49:57 +0200 fs r272254 : #i999704# 2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property 2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString 2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein 2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property 2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property) 2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default 2009-05-25 14:39:31 +0200 fs r272243 : removed dead import 2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns 2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent 2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel 2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event 2009-05-22 21:42:47 +0200 fs r272211 : #i102003# 2009-05-22 21:42:20 +0200 fs r272210 : grammar 2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously 2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear 2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG 2009-05-22 12:03:42 +0200 fs r272180 : #i88878# provided by noel.power@novell.com implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs 2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them 2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values 2009-05-15 15:08:31 +0200 fs r271937 : includes 2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint 2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity 2009-05-15 10:15:44 +0200 fs r271928 : #i10000# 2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:23:23 +0200 fs r271919 : #i101622# 2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids 2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b) 2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48 2009-05-07 14:43:19 +0200 fs r271670 : #i101477# 2009-05-07 14:37:30 +0200 fs r271668 : #i101477# 2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch 2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics 2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47) 2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control 2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
{
nDone = 0; // don't eat this event, let the default handling happen (i.e. scroll the context)
CWS-TOOLING: integrate CWS dba32c 2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion 2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time 2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths 2009-06-29 10:08:54 +0200 fs r273455 : #i103138# refactored the code for positioning/zooming the control Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to take an additional ViewTransformation parameter, describing the transformation to obtain the actual control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter. This has become necessary since during painting, the device which we created our control for might not necessarily have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size, this would lead to wrong results. Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken. Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ... I consider it broken, since: - we need the map mode to obtain the proper zoom level, which is to be forwarded to the control - there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears). It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand one has no possibility to obtain the current zoom by other means. Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used, which means the controls have a zoom of "1:1" set, which is wrong here. 2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties 2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning 2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed 2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc 2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux 2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux 2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar 2009-06-15 14:11:27 +0200 fs r272983 : added since tag 2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted 2009-06-15 11:08:53 +0200 fs r272969 : #i10000# 2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701# 2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src 2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50) 2009-06-02 09:53:10 +0200 fs r272483 : #i10000# 2009-05-29 15:55:03 +0200 fs r272465 : #i100818# 2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any 2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition 2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex 2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed 2009-05-27 14:53:36 +0200 fs r272347 : #i10000# 2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast 2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly 2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used 2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function 2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well 2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution 2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set 2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition 2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria 2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR 2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein 2009-05-25 15:49:57 +0200 fs r272254 : #i999704# 2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property 2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString 2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein 2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property 2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property) 2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default 2009-05-25 14:39:31 +0200 fs r272243 : removed dead import 2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns 2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent 2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel 2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event 2009-05-22 21:42:47 +0200 fs r272211 : #i102003# 2009-05-22 21:42:20 +0200 fs r272210 : grammar 2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously 2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear 2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG 2009-05-22 12:03:42 +0200 fs r272180 : #i88878# provided by noel.power@novell.com implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs 2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them 2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values 2009-05-15 15:08:31 +0200 fs r271937 : includes 2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint 2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity 2009-05-15 10:15:44 +0200 fs r271928 : #i10000# 2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:23:23 +0200 fs r271919 : #i101622# 2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids 2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b) 2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48 2009-05-07 14:43:19 +0200 fs r271670 : #i101477# 2009-05-07 14:37:30 +0200 fs r271668 : #i101477# 2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch 2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics 2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47) 2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control 2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
}
2000-09-18 16:07:07 +00:00
}
2009-09-08 10:44:42 +00:00
else if( ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) && ( rNEvt.GetWindow() == mpImplLB->GetMainWindow() ) )
{
mpSubEdit->GrabFocus();
}
2000-09-18 16:07:07 +00:00
return nDone ? nDone : Edit::Notify( rNEvt );
}
// -----------------------------------------------------------------------
void ComboBox::SetText( const XubString& rStr )
{
ImplCallEventListeners( VCLEVENT_COMBOBOX_SETTEXT );
2000-09-18 16:07:07 +00:00
Edit::SetText( rStr );
ImplUpdateFloatSelection();
}
// -----------------------------------------------------------------------
void ComboBox::SetText( const XubString& rStr, const Selection& rNewSelection )
{
ImplCallEventListeners( VCLEVENT_COMBOBOX_SETTEXT );
2000-09-18 16:07:07 +00:00
Edit::SetText( rStr, rNewSelection );
ImplUpdateFloatSelection();
}
// -----------------------------------------------------------------------
void ComboBox::Modify()
{
if ( !mbSyntheticModify )
ImplUpdateFloatSelection();
Edit::Modify();
}
// -----------------------------------------------------------------------
void ComboBox::ImplUpdateFloatSelection()
{
// Text in der ListBox in den sichtbaren Bereich bringen
mpImplLB->SetCallSelectionChangedHdl( sal_False );
2000-09-18 16:07:07 +00:00
if ( !IsMultiSelectionEnabled() )
{
XubString aSearchStr( mpSubEdit->GetText() );
sal_uInt16 nSelect = LISTBOX_ENTRY_NOTFOUND;
sal_Bool bSelect = sal_True;
2000-09-18 16:07:07 +00:00
if ( mpImplLB->GetCurrentPos() != LISTBOX_ENTRY_NOTFOUND )
{
XubString aCurrent = mpImplLB->GetEntryList()->GetEntryText( mpImplLB->GetCurrentPos() );
if ( aCurrent == aSearchStr )
nSelect = mpImplLB->GetCurrentPos();
}
if ( nSelect == LISTBOX_ENTRY_NOTFOUND )
nSelect = mpImplLB->GetEntryList()->FindEntry( aSearchStr );
2000-09-18 16:07:07 +00:00
if ( nSelect == LISTBOX_ENTRY_NOTFOUND )
{
nSelect = mpImplLB->GetEntryList()->FindMatchingEntry( aSearchStr );
bSelect = sal_False;
2000-09-18 16:07:07 +00:00
}
if( nSelect != LISTBOX_ENTRY_NOTFOUND )
{
if ( !mpImplLB->IsVisible( nSelect ) )
mpImplLB->ShowProminentEntry( nSelect );
2000-09-18 16:07:07 +00:00
mpImplLB->SelectEntry( nSelect, bSelect );
}
else
{
nSelect = mpImplLB->GetEntryList()->GetSelectEntryPos( 0 );
if( nSelect != LISTBOX_ENTRY_NOTFOUND )
mpImplLB->SelectEntry( nSelect, sal_False );
2000-09-18 16:07:07 +00:00
mpImplLB->ResetCurrentPos();
}
}
else
{
Table aSelInText;
lcl_GetSelectedEntries( aSelInText, mpSubEdit->GetText(), mcMultiSep, mpImplLB->GetEntryList() );
for ( sal_uInt16 n = 0; n < mpImplLB->GetEntryList()->GetEntryCount(); n++ )
2000-09-18 16:07:07 +00:00
mpImplLB->SelectEntry( n, aSelInText.IsKeyValid( ImplCreateKey( n ) ) );
}
mpImplLB->SetCallSelectionChangedHdl( sal_True );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
sal_uInt16 ComboBox::InsertEntry( const XubString& rStr, sal_uInt16 nPos )
2000-09-18 16:07:07 +00:00
{
sal_uInt16 nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr );
nRealPos = sal::static_int_cast<sal_uInt16>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount());
CallEventListeners( VCLEVENT_COMBOBOX_ITEMADDED, (void*) sal_IntPtr(nRealPos) );
2000-09-18 16:07:07 +00:00
return nRealPos;
}
// -----------------------------------------------------------------------
sal_uInt16 ComboBox::InsertEntry( const XubString& rStr, const Image& rImage, sal_uInt16 nPos )
2000-09-18 16:07:07 +00:00
{
sal_uInt16 nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr, rImage );
nRealPos = sal::static_int_cast<sal_uInt16>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount());
CallEventListeners( VCLEVENT_COMBOBOX_ITEMADDED, (void*) sal_IntPtr(nRealPos) );
2000-09-18 16:07:07 +00:00
return nRealPos;
}
// -----------------------------------------------------------------------
void ComboBox::RemoveEntry( const XubString& rStr )
{
RemoveEntry( GetEntryPos( rStr ) );
}
// -----------------------------------------------------------------------
void ComboBox::RemoveEntry( sal_uInt16 nPos )
2000-09-18 16:07:07 +00:00
{
mpImplLB->RemoveEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
CallEventListeners( VCLEVENT_COMBOBOX_ITEMREMOVED, (void*) sal_IntPtr(nPos) );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void ComboBox::Clear()
{
mpImplLB->Clear();
CallEventListeners( VCLEVENT_COMBOBOX_ITEMREMOVED, (void*) sal_IntPtr(-1) );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
Image ComboBox::GetEntryImage( sal_uInt16 nPos ) const
{
if ( mpImplLB->GetEntryList()->HasEntryImage( nPos ) )
return mpImplLB->GetEntryList()->GetEntryImage( nPos );
return Image();
}
2000-09-18 16:07:07 +00:00
// -----------------------------------------------------------------------
sal_uInt16 ComboBox::GetEntryPos( const XubString& rStr ) const
2000-09-18 16:07:07 +00:00
{
sal_uInt16 nPos = mpImplLB->GetEntryList()->FindEntry( rStr );
2000-09-18 16:07:07 +00:00
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
nPos = sal::static_int_cast<sal_uInt16>(nPos - mpImplLB->GetEntryList()->GetMRUCount());
2000-09-18 16:07:07 +00:00
return nPos;
}
// -----------------------------------------------------------------------
sal_uInt16 ComboBox::GetEntryPos( const void* pData ) const
2000-09-18 16:07:07 +00:00
{
sal_uInt16 nPos = mpImplLB->GetEntryList()->FindEntry( pData );
2000-09-18 16:07:07 +00:00
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
nPos = sal::static_int_cast<sal_uInt16>(nPos - mpImplLB->GetEntryList()->GetMRUCount());
2000-09-18 16:07:07 +00:00
return nPos;
}
// -----------------------------------------------------------------------
XubString ComboBox::GetEntry( sal_uInt16 nPos ) const
2000-09-18 16:07:07 +00:00
{
return mpImplLB->GetEntryList()->GetEntryText( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
}
// -----------------------------------------------------------------------
sal_uInt16 ComboBox::GetEntryCount() const
2000-09-18 16:07:07 +00:00
{
return mpImplLB->GetEntryList()->GetEntryCount() - mpImplLB->GetEntryList()->GetMRUCount();
}
// -----------------------------------------------------------------------
sal_Bool ComboBox::IsTravelSelect() const
2000-09-18 16:07:07 +00:00
{
return mpImplLB->IsTravelSelect();
}
// -----------------------------------------------------------------------
sal_Bool ComboBox::IsInDropDown() const
2000-09-18 16:07:07 +00:00
{
return mpFloatWin && mpFloatWin->IsInPopupMode();
}
// -----------------------------------------------------------------------
void ComboBox::EnableMultiSelection( sal_Bool bMulti )
2000-09-18 16:07:07 +00:00
{
mpImplLB->EnableMultiSelection( bMulti, sal_False );
mpImplLB->SetMultiSelectionSimpleMode( sal_True );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
sal_Bool ComboBox::IsMultiSelectionEnabled() const
2000-09-18 16:07:07 +00:00
{
return mpImplLB->IsMultiSelectionEnabled();
}
// -----------------------------------------------------------------------
long ComboBox::CalcWindowSizePixel( sal_uInt16 nLines ) const
2000-09-18 16:07:07 +00:00
{
return mpImplLB->GetEntryHeight() * nLines;
}
// -----------------------------------------------------------------------
Size ComboBox::GetOptimalSize(WindowSizeType eType) const
{
switch (eType) {
case WINDOWSIZE_MINIMUM:
return CalcMinimumSize();
default:
return Edit::GetOptimalSize( eType );
}
}
// -----------------------------------------------------------------------
2000-09-18 16:07:07 +00:00
Size ComboBox::CalcMinimumSize() const
{
Size aSz;
if ( !IsDropDownBox() )
{
aSz = mpImplLB->CalcSize( mpImplLB->GetEntryList()->GetEntryCount() );
aSz.Height() += mnDDHeight;
}
else
{
aSz.Height() = mpImplLB->CalcSize( 1 ).Height();
aSz.Width() = mpImplLB->GetMaxEntryWidth();
aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
}
aSz = CalcWindowSize( aSz );
return aSz;
}
// -----------------------------------------------------------------------
Size ComboBox::CalcAdjustedSize( const Size& rPrefSize ) const
{
Size aSz = rPrefSize;
sal_Int32 nLeft, nTop, nRight, nBottom;
2000-09-18 16:07:07 +00:00
((Window*)this)->GetBorder( nLeft, nTop, nRight, nBottom );
aSz.Height() -= nTop+nBottom;
if ( !IsDropDownBox() )
{
long nEntryHeight = CalcSize( 1, 1 ).Height();
long nLines = aSz.Height() / nEntryHeight;
if ( nLines < 1 )
nLines = 1;
aSz.Height() = nLines * nEntryHeight;
aSz.Height() += mnDDHeight;
}
else
{
aSz.Height() = mnDDHeight;
}
aSz.Height() += nTop+nBottom;
aSz = CalcWindowSize( aSz );
return aSz;
}
// -----------------------------------------------------------------------
Size ComboBox::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
2000-09-18 16:07:07 +00:00
{
// ggf. werden ScrollBars eingeblendet
Size aMinSz = CalcMinimumSize();
Size aSz;
// Hoehe
if ( nLines )
{
if ( !IsDropDownBox() )
aSz.Height() = mpImplLB->CalcSize( nLines ).Height() + mnDDHeight;
else
aSz.Height() = mnDDHeight;
}
else
aSz.Height() = aMinSz.Height();
// Breite
if ( nColumns )
aSz.Width() = nColumns * GetTextWidth( UniString( 'X' ) );
else
aSz.Width() = aMinSz.Width();
if ( IsDropDownBox() )
aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
if ( !IsDropDownBox() )
{
if ( aSz.Width() < aMinSz.Width() )
aSz.Height() += GetSettings().GetStyleSettings().GetScrollBarSize();
if ( aSz.Height() < aMinSz.Height() )
aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
}
aSz = CalcWindowSize( aSz );
return aSz;
}
// -----------------------------------------------------------------------
void ComboBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const
2000-09-18 16:07:07 +00:00
{
long nCharWidth = GetTextWidth( UniString( 'x' ) );
if ( !IsDropDownBox() )
{
Size aOutSz = mpImplLB->GetMainWindow()->GetOutputSizePixel();
rnCols = (sal_uInt16)(aOutSz.Width()/nCharWidth);
rnLines = (sal_uInt16)(aOutSz.Height()/mpImplLB->GetEntryHeight());
2000-09-18 16:07:07 +00:00
}
else
{
Size aOutSz = mpSubEdit->GetOutputSizePixel();
rnCols = (sal_uInt16)(aOutSz.Width()/nCharWidth);
2000-09-18 16:07:07 +00:00
rnLines = 1;
}
}
// -----------------------------------------------------------------------
void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags )
2000-09-18 16:07:07 +00:00
{
mpImplLB->GetMainWindow()->ImplInitSettings( sal_True, sal_True, sal_True );
2000-09-18 16:07:07 +00:00
Point aPos = pDev->LogicToPixel( rPos );
Size aSize = pDev->LogicToPixel( rSize );
Font aFont = mpImplLB->GetMainWindow()->GetDrawPixelFont( pDev );
OutDevType eOutDevType = pDev->GetOutDevType();
pDev->Push();
pDev->SetMapMode();
pDev->SetFont( aFont );
pDev->SetTextFillColor();
// Border/Background
pDev->SetLineColor();
pDev->SetFillColor();
sal_Bool bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER);
sal_Bool bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground();
2000-09-18 16:07:07 +00:00
if ( bBorder || bBackground )
{
Rectangle aRect( aPos, aSize );
// aRect.Top() += nEditHeight;
if ( bBorder )
{
ImplDrawFrame( pDev, aRect );
2000-09-18 16:07:07 +00:00
}
if ( bBackground )
{
pDev->SetFillColor( GetControlBackground() );
pDev->DrawRect( aRect );
}
}
// Inhalt
if ( !IsDropDownBox() )
2000-09-18 16:07:07 +00:00
{
long nOnePixel = GetDrawPixel( pDev, 1 );
long nTextHeight = pDev->GetTextHeight();
long nEditHeight = nTextHeight + 6*nOnePixel;
sal_uInt16 nTextStyle = TEXT_DRAW_VCENTER;
2000-09-18 16:07:07 +00:00
// First, draw the edit part
2000-09-18 16:07:07 +00:00
mpSubEdit->Draw( pDev, aPos, Size( aSize.Width(), nEditHeight ), nFlags );
// Second, draw the listbox
if ( GetStyle() & WB_CENTER )
nTextStyle |= TEXT_DRAW_CENTER;
else if ( GetStyle() & WB_RIGHT )
nTextStyle |= TEXT_DRAW_RIGHT;
else
nTextStyle |= TEXT_DRAW_LEFT;
2000-09-18 16:07:07 +00:00
if ( ( nFlags & WINDOW_DRAW_MONO ) || ( eOutDevType == OUTDEV_PRINTER ) )
{
pDev->SetTextColor( Color( COL_BLACK ) );
}
else
{
if ( !(nFlags & WINDOW_DRAW_NODISABLE ) && !IsEnabled() )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
pDev->SetTextColor( rStyleSettings.GetDisableColor() );
}
else
{
pDev->SetTextColor( GetTextColor() );
}
}
Rectangle aClip( aPos, aSize );
pDev->IntersectClipRegion( aClip );
sal_uInt16 nLines = (sal_uInt16) ( (aSize.Height()-nEditHeight) / nTextHeight );
2000-09-18 16:07:07 +00:00
if ( !nLines )
nLines = 1;
sal_uInt16 nTEntry = IsReallyVisible() ? mpImplLB->GetTopEntry() : 0;
Rectangle aTextRect( aPos, aSize );
aTextRect.Left() += 3*nOnePixel;
aTextRect.Right() -= 3*nOnePixel;
aTextRect.Top() += nEditHeight + nOnePixel;
aTextRect.Bottom() = aTextRect.Top() + nTextHeight;
// the drawing starts here
for ( sal_uInt16 n = 0; n < nLines; n++ )
{
pDev->DrawText( aTextRect, mpImplLB->GetEntryList()->GetEntryText( n+nTEntry ), nTextStyle );
aTextRect.Top() += nTextHeight;
aTextRect.Bottom() += nTextHeight;
}
2000-09-18 16:07:07 +00:00
}
pDev->Pop();
// Call Edit::Draw after restoring the MapMode...
if ( IsDropDownBox() )
{
mpSubEdit->Draw( pDev, rPos, rSize, nFlags );
// DD-Button ?
}
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
IMPL_LINK( ComboBox, ImplUserDrawHdl, UserDrawEvent*, pEvent )
{
UserDraw( *pEvent );
return 1;
}
// -----------------------------------------------------------------------
void ComboBox::UserDraw( const UserDrawEvent& )
{
}
// -----------------------------------------------------------------------
void ComboBox::SetUserItemSize( const Size& rSz )
{
mpImplLB->GetMainWindow()->SetUserItemSize( rSz );
}
// -----------------------------------------------------------------------
const Size& ComboBox::GetUserItemSize() const
{
return mpImplLB->GetMainWindow()->GetUserItemSize();
}
// -----------------------------------------------------------------------
void ComboBox::EnableUserDraw( sal_Bool bUserDraw )
2000-09-18 16:07:07 +00:00
{
mpImplLB->GetMainWindow()->EnableUserDraw( bUserDraw );
}
// -----------------------------------------------------------------------
sal_Bool ComboBox::IsUserDrawEnabled() const
2000-09-18 16:07:07 +00:00
{
return mpImplLB->GetMainWindow()->IsUserDrawEnabled();
}
// -----------------------------------------------------------------------
void ComboBox::DrawEntry( const UserDrawEvent& rEvt, sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos )
2000-09-18 16:07:07 +00:00
{
DBG_ASSERT( rEvt.GetDevice() == mpImplLB->GetMainWindow(), "DrawEntry?!" );
mpImplLB->GetMainWindow()->DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
}
// -----------------------------------------------------------------------
void ComboBox::SetSeparatorPos( sal_uInt16 n )
2000-09-18 16:07:07 +00:00
{
mpImplLB->SetSeparatorPos( n );
}
// -----------------------------------------------------------------------
sal_uInt16 ComboBox::GetSeparatorPos() const
2000-09-18 16:07:07 +00:00
{
return mpImplLB->GetSeparatorPos();
}
// -----------------------------------------------------------------------
void ComboBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep )
{
mpImplLB->SetMRUEntries( rEntries, cSep );
}
// -----------------------------------------------------------------------
XubString ComboBox::GetMRUEntries( xub_Unicode cSep ) const
{
return mpImplLB->GetMRUEntries( cSep );
}
// -----------------------------------------------------------------------
void ComboBox::SetMaxMRUCount( sal_uInt16 n )
2000-09-18 16:07:07 +00:00
{
mpImplLB->SetMaxMRUCount( n );
}
// -----------------------------------------------------------------------
sal_uInt16 ComboBox::GetMaxMRUCount() const
2000-09-18 16:07:07 +00:00
{
return mpImplLB->GetMaxMRUCount();
}
// -----------------------------------------------------------------------
sal_uInt16 ComboBox::GetDisplayLineCount() const
{
return mpImplLB->GetDisplayLineCount();
}
// -----------------------------------------------------------------------
void ComboBox::SetEntryData( sal_uInt16 nPos, void* pNewData )
2000-09-18 16:07:07 +00:00
{
mpImplLB->SetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount(), pNewData );
}
// -----------------------------------------------------------------------
void* ComboBox::GetEntryData( sal_uInt16 nPos ) const
2000-09-18 16:07:07 +00:00
{
return mpImplLB->GetEntryList()->GetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
}
// -----------------------------------------------------------------------
void ComboBox::SetTopEntry( sal_uInt16 nPos )
{
mpImplLB->SetTopEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
}
// -----------------------------------------------------------------------
void ComboBox::ShowProminentEntry( sal_uInt16 nPos )
{
mpImplLB->ShowProminentEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
}
// -----------------------------------------------------------------------
sal_uInt16 ComboBox::GetTopEntry() const
{
sal_uInt16 nPos = GetEntryCount() ? mpImplLB->GetTopEntry() : LISTBOX_ENTRY_NOTFOUND;
if ( nPos < mpImplLB->GetEntryList()->GetMRUCount() )
nPos = 0;
return nPos;
}
2002-04-19 11:11:57 +00:00
// -----------------------------------------------------------------------
void ComboBox::SetProminentEntryType( ProminentEntry eType )
{
mpImplLB->SetProminentEntryType( eType );
}
// -----------------------------------------------------------------------
ProminentEntry ComboBox::GetProminentEntryType() const
{
return mpImplLB->GetProminentEntryType();
}
// -----------------------------------------------------------------------
2002-04-19 11:11:57 +00:00
Rectangle ComboBox::GetDropDownPosSizePixel() const
{
return mpFloatWin ? mpFloatWin->GetWindowExtentsRelative( const_cast<ComboBox*>(this) ) : Rectangle();
}
// -----------------------------------------------------------------------
Rectangle ComboBox::GetListPosSizePixel() const
{
return mpFloatWin ? Rectangle() : mpImplLB->GetMainWindow()->GetWindowExtentsRelative( const_cast<ComboBox*>(this) );
}
// -----------------------------------------------------------------------
const Wallpaper& ComboBox::GetDisplayBackground() const
{
if( ! mpSubEdit->IsBackground() )
return Control::GetDisplayBackground();
const Wallpaper& rBack = mpSubEdit->GetBackground();
if( ! rBack.IsBitmap() &&
! rBack.IsGradient() &&
rBack.GetColor().GetColor() == COL_TRANSPARENT
)
return Control::GetDisplayBackground();
return rBack;
}
// -----------------------------------------------------------------------------
sal_uInt16 ComboBox::GetSelectEntryCount() const
{
return mpImplLB->GetEntryList()->GetSelectEntryCount();
}
// -----------------------------------------------------------------------------
sal_uInt16 ComboBox::GetSelectEntryPos( sal_uInt16 nIndex ) const
{
sal_uInt16 nPos = mpImplLB->GetEntryList()->GetSelectEntryPos( nIndex );
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
{
if ( nPos < mpImplLB->GetEntryList()->GetMRUCount() )
nPos = mpImplLB->GetEntryList()->FindEntry( mpImplLB->GetEntryList()->GetEntryText( nPos ) );
nPos = sal::static_int_cast<sal_uInt16>(nPos - mpImplLB->GetEntryList()->GetMRUCount());
}
return nPos;
}
// -----------------------------------------------------------------------------
sal_Bool ComboBox::IsEntryPosSelected( sal_uInt16 nPos ) const
{
return mpImplLB->GetEntryList()->IsEntryPosSelected( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
}
// -----------------------------------------------------------------------------
void ComboBox::SelectEntryPos( sal_uInt16 nPos, sal_Bool bSelect)
{
if ( nPos < mpImplLB->GetEntryList()->GetEntryCount() )
mpImplLB->SelectEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), bSelect );
}
// -----------------------------------------------------------------------------
void ComboBox::SetNoSelection()
{
mpImplLB->SetNoSelection();
mpSubEdit->SetText( String() );
}
// -----------------------------------------------------------------------------
Rectangle ComboBox::GetBoundingRectangle( sal_uInt16 nItem ) const
{
Rectangle aRect = mpImplLB->GetMainWindow()->GetBoundingRectangle( nItem );
Rectangle aOffset = mpImplLB->GetMainWindow()->GetWindowExtentsRelative( (Window*)this );
aRect.Move( aOffset.TopLeft().X(), aOffset.TopLeft().Y() );
return aRect;
}
// -----------------------------------------------------------------------------
void ComboBox::SetBorderStyle( sal_uInt16 nBorderStyle )
{
Window::SetBorderStyle( nBorderStyle );
if ( !IsDropDownBox() )
{
mpSubEdit->SetBorderStyle( nBorderStyle );
mpImplLB->SetBorderStyle( nBorderStyle );
}
}
// -----------------------------------------------------------------------------
long ComboBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rPos ) const
{
if( !HasLayoutData() )
FillLayoutData();
// check whether rPoint fits at all
long nIndex = Control::GetIndexForPoint( rPoint );
if( nIndex != -1 )
{
// point must be either in main list window
// or in impl window (dropdown case)
ImplListBoxWindow* pMain = mpImplLB->GetMainWindow();
// convert coordinates to ImplListBoxWindow pixel coordinate space
Point aConvPoint = LogicToPixel( rPoint );
aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint );
aConvPoint = pMain->AbsoluteScreenToOutputPixel( aConvPoint );
aConvPoint = pMain->PixelToLogic( aConvPoint );
// try to find entry
sal_uInt16 nEntry = pMain->GetEntryPosForPoint( aConvPoint );
if( nEntry == LISTBOX_ENTRY_NOTFOUND )
nIndex = -1;
else
rPos = nEntry;
}
// get line relative index
if( nIndex != -1 )
nIndex = ToRelativeLineIndex( nIndex );
return nIndex;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */