2010-10-14 08:27:31 +02:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-09-18 16:07:07 +00:00
/*************************************************************************
*
2008-04-11 07:30:30 +00:00
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER .
2000-09-18 16:07:07 +00:00
*
2010-02-12 15:01:35 +01:00
* Copyright 2000 , 2010 Oracle and / or its affiliates .
2000-09-18 16:07:07 +00:00
*
2008-04-11 07:30:30 +00:00
* OpenOffice . org - a multi - platform office productivity suite
2000-09-18 16:07:07 +00:00
*
2008-04-11 07:30:30 +00:00
* This file is part of OpenOffice . org .
2000-09-18 16:07:07 +00:00
*
2008-04-11 07:30:30 +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
*
2008-04-11 07:30:30 +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
*
2008-04-11 07:30:30 +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
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2006-09-17 10:51:42 +00:00
// MARKER(update_precomp.py): autogen include statement, do not remove
# include "precompiled_vcl.hxx"
2011-01-24 16:34:14 +01:00
2000-09-18 16:07:07 +00:00
# include <tools/table.hxx>
# include <tools/debug.hxx>
2004-01-06 12:16:21 +00:00
# include <tools/rc.h>
2007-06-27 19:04:44 +00:00
# include <vcl/decoview.hxx>
# include <vcl/lstbox.h>
# include <vcl/button.hxx>
# include <vcl/event.hxx>
# include <vcl/combobox.hxx>
2003-12-01 12:10:29 +00:00
2011-01-24 16:34:14 +01:00
# include <svdata.hxx>
# include <subedit.hxx>
# include <ilstbox.hxx>
# include <controldata.hxx>
2000-09-18 16:07:07 +00:00
// =======================================================================
2010-10-13 10:55:27 +01:00
2011-01-12 15:07:10 +01: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 ( ' ' ) ;
2010-09-29 15:46:40 +08:00
sal_uInt16 nPos = pEntryList - > FindEntry ( aToken ) ;
2000-09-18 16:07:07 +00:00
if ( nPos ! = LISTBOX_ENTRY_NOTFOUND )
2006-06-19 18:15:38 +00:00
rSelectedPos . Insert ( ImplCreateKey ( nPos ) , ( void * ) sal_IntPtr ( 1L ) ) ;
2000-09-18 16:07:07 +00:00
}
}
// =======================================================================
2010-10-13 10:55:27 +01:00
2000-09-18 16:07:07 +00:00
ComboBox : : ComboBox ( WindowType nType ) :
Edit ( nType )
{
2006-06-19 18:15:38 +00:00
ImplInitComboBoxData ( ) ;
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
ComboBox : : ComboBox ( Window * pParent , WinBits nStyle ) :
Edit ( WINDOW_COMBOBOX )
{
2006-06-19 18:15:38 +00:00
ImplInitComboBoxData ( ) ;
2000-09-18 16:07:07 +00:00
ImplInit ( pParent , nStyle ) ;
}
// -----------------------------------------------------------------------
ComboBox : : ComboBox ( Window * pParent , const ResId & rResId ) :
Edit ( WINDOW_COMBOBOX )
{
2006-06-19 18:15:38 +00:00
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 ;
}
// -----------------------------------------------------------------------
2006-06-19 18:15:38 +00:00
void ComboBox : : ImplInitComboBoxData ( )
2000-09-18 16:07:07 +00:00
{
mpSubEdit = NULL ;
mpBtn = NULL ;
mpImplLB = NULL ;
mpFloatWin = NULL ;
mnDDHeight = 0 ;
2010-09-29 15:46:40 +08:00
mbDDAutoSize = sal_True ;
mbSyntheticModify = sal_False ;
mbMatchCase = sal_False ;
2000-09-18 16:07:07 +00:00
mcMultiSep = ' ; ' ;
}
// -----------------------------------------------------------------------
void ComboBox : : ImplCalcEditHeight ( )
{
2004-06-17 11:11:35 +00:00
sal_Int32 nLeft , nTop , nRight , nBottom ;
2000-09-18 16:07:07 +00:00
GetBorder ( nLeft , nTop , nRight , nBottom ) ;
2010-09-29 15:46:40 +08:00
mnDDHeight = ( sal_uInt16 ) ( mpSubEdit - > GetTextHeight ( ) + nTop + nBottom + 4 ) ;
2000-09-18 16:07:07 +00:00
if ( ! IsDropDownBox ( ) )
mnDDHeight + = 4 ;
2007-08-03 13:06:48 +00:00
2010-07-05 11:20:24 +02:00
Rectangle aCtrlRegion ( Point ( 0 , 0 ) , Size ( 10 , 10 ) ) ;
Rectangle aBoundRegion , aContentRegion ;
2009-08-07 10:16:34 +00:00
ImplControlValue aControlValue ;
ControlType aType = IsDropDownBox ( ) ? CTRL_COMBOBOX : CTRL_EDITBOX ;
if ( GetNativeControlRegion ( aType , PART_ENTIRE_CONTROL ,
aCtrlRegion ,
CTRL_STATE_ENABLED ,
aControlValue , rtl : : OUString ( ) ,
aBoundRegion , aContentRegion ) )
2007-08-03 13:06:48 +00:00
{
2010-07-05 11:20:24 +02:00
const long nNCHeight = aBoundRegion . GetHeight ( ) ;
2009-08-07 10:16:34 +00:00
if ( mnDDHeight < nNCHeight )
2010-09-29 15:46:40 +08:00
mnDDHeight = sal : : static_int_cast < sal_uInt16 > ( nNCHeight ) ;
2007-08-03 13:06:48 +00:00
}
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void ComboBox : : ImplInit ( Window * pParent , WinBits nStyle )
{
ImplInitStyle ( nStyle ) ;
2010-09-29 15:46:40 +08:00
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 ?
2004-07-05 14:41:42 +00:00
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 ) ;
2010-09-29 15:46:40 +08:00
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 ) ;
2010-09-29 15:46:40 +08:00
mpSubEdit - > EnableRTL ( sal_False ) ;
2000-09-18 16:07:07 +00:00
SetSubEdit ( mpSubEdit ) ;
mpSubEdit - > SetPosPixel ( Point ( ) ) ;
2010-09-29 15:46:40 +08:00
EnableAutocomplete ( sal_True ) ;
2000-09-18 16:07:07 +00:00
mpSubEdit - > Show ( ) ;
Window * pLBParent = this ;
if ( mpFloatWin )
pLBParent = mpFloatWin ;
2010-11-19 18:12:56 -05:00
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 ) ;
2004-05-10 14:46:12 +00:00
else
2010-09-29 15:46:40 +08:00
mpImplLB - > GetMainWindow ( ) - > AllowGrabFocus ( sal_True ) ;
2000-09-18 16:07:07 +00:00
ImplCalcEditHeight ( ) ;
2010-09-29 15:46:40 +08:00
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 ) ;
2011-01-12 15:07:10 +01:00
sal_uLong nNumber = ReadLongRes ( ) ;
2000-09-18 16:07:07 +00:00
if ( nNumber )
{
2010-09-29 15:46:40 +08:00
for ( sal_uInt16 i = 0 ; i < nNumber ; i + + )
2000-09-18 16:07:07 +00:00
{
InsertEntry ( ReadStringRes ( ) , LISTBOX_APPEND ) ;
}
}
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
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 ( ) ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_Bool ComboBox : : IsAutocompleteEnabled ( ) const
2000-09-18 16:07:07 +00:00
{
return mpSubEdit - > GetAutocompleteHdl ( ) . IsSet ( ) ;
}
// -----------------------------------------------------------------------
IMPL_LINK ( ComboBox , ImplClickBtnHdl , void * , EMPTYARG )
{
2009-09-17 14:37:24 +00:00
ImplCallEventListeners ( VCLEVENT_DROPDOWN_PRE_OPEN ) ;
2000-09-18 16:07:07 +00:00
mpSubEdit - > GrabFocus ( ) ;
if ( ! mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) )
ImplUpdateFloatSelection ( ) ;
else
2010-09-29 15:46:40 +08:00
mpImplLB - > SelectEntry ( 0 , sal_True ) ;
mpBtn - > SetPressed ( sal_True ) ;
2001-07-17 15:45:11 +00:00
SetSelection ( Selection ( 0 , SELECTION_MAX ) ) ;
2010-09-29 15:46:40 +08:00
mpFloatWin - > StartFloat ( sal_True ) ;
2002-04-19 10:43:32 +00:00
ImplCallEventListeners ( VCLEVENT_DROPDOWN_OPEN ) ;
2004-05-18 09:53:59 +00:00
ImplClearLayoutData ( ) ;
if ( mpImplLB )
mpImplLB - > GetMainWindow ( ) - > ImplClearLayoutData ( ) ;
2000-09-18 16:07:07 +00:00
return 0 ;
}
// -----------------------------------------------------------------------
2006-06-19 18:15:38 +00:00
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 ( ) )
2002-12-12 15:26:01 +00:00
{
if ( ! mpImplLB - > GetEntryList ( ) - > IsEntryPosSelected ( mpFloatWin - > GetPopupModeStartSaveSelection ( ) ) )
{
2010-09-29 15:46:40 +08:00
mpImplLB - > SelectEntry ( mpFloatWin - > GetPopupModeStartSaveSelection ( ) , sal_True ) ;
sal_Bool bTravelSelect = mpImplLB - > IsTravelSelect ( ) ;
mpImplLB - > SetTravelSelect ( sal_True ) ;
2002-12-12 15:26:01 +00:00
Select ( ) ;
mpImplLB - > SetTravelSelect ( bTravelSelect ) ;
}
}
2002-08-23 13:34:36 +00:00
2004-05-18 09:53:59 +00:00
ImplClearLayoutData ( ) ;
if ( mpImplLB )
mpImplLB - > GetMainWindow ( ) - > ImplClearLayoutData ( ) ;
2010-09-29 15:46:40 +08:00
mpBtn - > SetPressed ( sal_False ) ;
2002-04-19 10:43:32 +00:00
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 ( ) ;
2008-06-25 13:29:42 +00:00
/* 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 ( ) ) ;
2010-09-29 15:46:40 +08:00
sal_uInt16 nStart = mpImplLB - > GetCurrentPos ( ) ;
2000-09-18 16:07:07 +00:00
if ( nStart = = LISTBOX_ENTRY_NOTFOUND )
nStart = 0 ;
2010-09-29 15:46:40 +08:00
sal_Bool bForward = sal_True ;
2000-09-18 16:07:07 +00:00
if ( eAction = = AUTOCOMPLETE_TABFORWARD )
nStart + + ;
else if ( eAction = = AUTOCOMPLETE_TABBACKWARD )
{
2010-09-29 15:46:40 +08:00
bForward = sal_False ;
2006-07-19 15:46:32 +00:00
nStart = nStart ? nStart - 1 : mpImplLB - > GetEntryList ( ) - > GetEntryCount ( ) - 1 ;
2000-09-18 16:07:07 +00:00
}
2008-06-25 13:29:42 +00:00
2010-09-29 15:46:40 +08:00
sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND ;
2008-06-25 13:29:42 +00:00
if ( ! mbMatchCase )
{
// Try match case insensitive from current position
2010-09-29 15:46:40 +08:00
nPos = mpImplLB - > GetEntryList ( ) - > FindMatchingEntry ( aStartText , nStart , bForward , sal_True ) ;
2008-06-25 13:29:42 +00:00
if ( nPos = = LISTBOX_ENTRY_NOTFOUND )
// Try match case insensitive, but from start
2010-09-29 15:46:40 +08:00
nPos = mpImplLB - > GetEntryList ( ) - > FindMatchingEntry ( aStartText , bForward ? 0 : ( mpImplLB - > GetEntryList ( ) - > GetEntryCount ( ) - 1 ) , bForward , sal_True ) ;
2008-06-25 13:29:42 +00:00
}
if ( nPos = = LISTBOX_ENTRY_NOTFOUND )
// Try match full from current position
2010-09-29 15:46:40 +08:00
nPos = mpImplLB - > GetEntryList ( ) - > FindMatchingEntry ( aStartText , nStart , bForward , sal_False ) ;
2000-09-18 16:07:07 +00:00
if ( nPos = = LISTBOX_ENTRY_NOTFOUND )
2008-06-25 13:29:42 +00:00
// Match full, but from start
2010-09-29 15:46:40 +08:00
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 ) ;
2006-06-19 18:15:38 +00:00
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 )
{
2010-09-29 15:46:40 +08:00
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 ( ' ' ) ;
2010-09-29 15:46:40 +08:00
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 ) ;
2006-06-19 18:15:38 +00:00
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 ( ) ) ;
2010-09-29 15:46:40 +08:00
sal_uInt16 nSelectedEntries = mpImplLB - > GetEntryList ( ) - > GetSelectEntryCount ( ) ;
for ( sal_uInt16 n = 0 ; n < nSelectedEntries ; n + + )
2000-09-18 16:07:07 +00:00
{
2010-09-29 15:46:40 +08: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 ) ;
2010-09-29 15:46:40 +08:00
bCallSelect = sal_True ;
2001-04-09 10:45:28 +00:00
}
// #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 ( ) ;
2010-09-29 15:46:40 +08:00
mbSyntheticModify = sal_True ;
2000-09-18 16:07:07 +00:00
Modify ( ) ;
2010-09-29 15:46:40 +08:00
mbSyntheticModify = sal_False ;
2010-10-06 10:16:39 +01:00
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 ( ) )
{
2011-01-12 15:07:10 +01:00
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 ;
}
// -----------------------------------------------------------------------
2002-04-16 15:11:36 +00:00
void ComboBox : : ToggleDropDown ( )
{
if ( IsDropDownBox ( ) )
{
if ( mpFloatWin - > IsInPopupMode ( ) )
mpFloatWin - > EndPopupMode ( ) ;
else
{
mpSubEdit - > GrabFocus ( ) ;
if ( ! mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) )
ImplUpdateFloatSelection ( ) ;
else
2010-09-29 15:46:40 +08:00
mpImplLB - > SelectEntry ( 0 , sal_True ) ;
2009-09-17 14:37:24 +00:00
ImplCallEventListeners ( VCLEVENT_DROPDOWN_PRE_OPEN ) ;
2010-09-29 15:46:40 +08:00
mpBtn - > SetPressed ( sal_True ) ;
2002-04-16 15:11:36 +00:00
SetSelection ( Selection ( 0 , SELECTION_MAX ) ) ;
2010-09-29 15:46:40 +08:00
mpFloatWin - > StartFloat ( sal_True ) ;
2002-04-19 10:43:32 +00:00
ImplCallEventListeners ( VCLEVENT_DROPDOWN_OPEN ) ;
2002-04-16 15:11:36 +00:00
}
}
}
// -----------------------------------------------------------------------
2000-09-18 16:07:07 +00:00
void ComboBox : : Select ( )
{
2004-10-22 11:12:33 +00:00
ImplCallEventListenersAndHandler ( VCLEVENT_COMBOBOX_SELECT , maSelectHdl , this ) ;
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void ComboBox : : DoubleClick ( )
{
2004-10-22 11:12:33 +00:00
ImplCallEventListenersAndHandler ( VCLEVENT_COMBOBOX_DOUBLECLICK , maDoubleClickHdl , this ) ;
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08: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
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
void ComboBox : : EnableDDAutoWidth ( sal_Bool b )
2002-11-01 08:01:04 +00:00
{
if ( mpFloatWin )
mpFloatWin - > SetAutoWidth ( b ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_Bool ComboBox : : IsDDAutoWidthEnabled ( ) const
2002-11-01 08:01:04 +00:00
{
2010-09-29 15:46:40 +08:00
return mpFloatWin ? mpFloatWin - > IsAutoWidth ( ) : sal_False ;
2002-11-01 08:01:04 +00:00
}
2000-09-18 16:07:07 +00:00
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
void ComboBox : : SetDropDownLineCount ( sal_uInt16 nLines )
2000-09-18 16:07:07 +00:00
{
if ( mpFloatWin )
mpFloatWin - > SetDropDownLineCount ( nLines ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_uInt16 ComboBox : : GetDropDownLineCount ( ) const
2000-09-18 16:07:07 +00:00
{
2010-09-29 15:46:40 +08: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 ,
2010-09-29 15:46:40 +08:00
sal_uInt16 nFlags )
2000-09-18 16:07:07 +00:00
{
if ( IsDropDownBox ( ) & & ( nFlags & WINDOW_POSSIZE_SIZE ) )
{
Size aPrefSz = mpFloatWin - > GetPrefSize ( ) ;
2004-05-10 14:46:12 +00:00
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 ) ;
2002-03-21 09:44:32 +00:00
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 ( )
{
2002-05-08 15:05:42 +00:00
Control : : Resize ( ) ;
2000-09-18 16:07:07 +00:00
Size aOutSz = GetOutputSizePixel ( ) ;
if ( IsDropDownBox ( ) )
{
long nSBWidth = GetSettings ( ) . GetStyleSettings ( ) . GetScrollBarSize ( ) ;
2004-05-10 14:46:12 +00:00
long nTop = 0 ;
long nBottom = aOutSz . Height ( ) ;
Window * pBorder = GetWindow ( WINDOW_BORDER ) ;
ImplControlValue aControlValue ;
Point aPoint ;
2010-07-05 11:20:24 +02:00
Rectangle aContent , aBound ;
2004-05-10 14:46:12 +00:00
// use the full extent of the control
2010-07-05 11:20:24 +02:00
Rectangle aArea ( aPoint , pBorder - > GetOutputSizePixel ( ) ) ;
2004-05-10 14:46:12 +00:00
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 ( ) ) ;
2010-07-05 11:20:24 +02:00
mpBtn - > SetPosSizePixel ( aContent . Left ( ) , nTop , aContent . getWidth ( ) , ( nBottom - nTop ) ) ;
2004-05-10 14:46:12 +00:00
// 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
2010-07-05 11:20:24 +02:00
mpSubEdit - > SetPosSizePixel ( aContent . TopLeft ( ) , aContent . GetSize ( ) ) ;
2004-05-10 14:46:12 +00:00
}
else
2006-03-22 09:37:50 +00:00
{
// use the themes drop down size for the button
2010-07-05 11:20:24 +02:00
aOutSz . Width ( ) - = aContent . getWidth ( ) ;
2004-05-10 14:46:12 +00:00
mpSubEdit - > SetSizePixel ( aOutSz ) ;
2006-03-22 09:37:50 +00:00
}
2004-05-10 14:46:12 +00:00
}
else
{
nSBWidth = CalcZoom ( nSBWidth ) ;
2008-12-16 13:30:53 +00:00
mpSubEdit - > SetPosSizePixel ( Point ( 0 , 0 ) , Size ( aOutSz . Width ( ) - nSBWidth , aOutSz . Height ( ) ) ) ;
2004-05-10 14:46:12 +00:00
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 ( ) ) ;
}
// -----------------------------------------------------------------------
2002-05-03 12:04:12 +00:00
void ComboBox : : FillLayoutData ( ) const
{
2009-09-14 12:09:22 +00:00
mpControlData - > mpLayoutData = new vcl : : ControlLayoutData ( ) ;
2002-05-03 12:04:12 +00:00
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 ( ) ) ) ;
2010-09-29 15:46:40 +08:00
mpImplLB - > GetMainWindow ( ) - > EnableSort ( ( GetStyle ( ) & WB_SORT ) ? sal_True : sal_False ) ;
2000-09-18 16:07:07 +00:00
}
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.
2004-05-10 14:46:12 +00:00
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 ( ) ;
2010-09-29 15:46:40 +08:00
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 ( ) )
{
2009-09-17 14:37:24 +00:00
ImplCallEventListeners ( VCLEVENT_DROPDOWN_PRE_OPEN ) ;
2010-09-29 15:46:40 +08:00
mpBtn - > SetPressed ( sal_True ) ;
2000-09-18 16:07:07 +00:00
if ( mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) )
2010-09-29 15:46:40 +08:00
mpImplLB - > SelectEntry ( 0 , sal_True ) ;
2001-07-17 15:45:11 +00:00
SetSelection ( Selection ( 0 , SELECTION_MAX ) ) ;
2010-09-29 15:46:40 +08:00
mpFloatWin - > StartFloat ( sal_False ) ;
2002-04-19 10:43:32 +00:00
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
2003-03-27 16:59:30 +00:00
{
2000-09-18 16:07:07 +00:00
nDone = mpImplLB - > ProcessKeyInput ( aKeyEvt ) ;
2003-03-27 16:59:30 +00:00
}
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 ( ) ;
2010-09-29 15:46:40 +08:00
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 ) )
{
2010-09-29 15:46:40 +08:00
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 ( )
)
)
{
2006-05-04 07:56:30 +00:00
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
}
2006-05-04 07:56:30 +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
{
2006-05-04 07:56:30 +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 )
{
2008-07-25 08:09:37 +00:00
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 )
{
2008-07-25 08:09:37 +00:00
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
2010-09-29 15:46:40 +08:00
mpImplLB - > SetCallSelectionChangedHdl ( sal_False ) ;
2000-09-18 16:07:07 +00:00
if ( ! IsMultiSelectionEnabled ( ) )
{
XubString aSearchStr ( mpSubEdit - > GetText ( ) ) ;
2010-09-29 15:46:40 +08:00
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 )
2001-08-08 09:36:14 +00:00
nSelect = mpImplLB - > GetEntryList ( ) - > FindEntry ( aSearchStr ) ;
2000-09-18 16:07:07 +00:00
if ( nSelect = = LISTBOX_ENTRY_NOTFOUND )
{
2001-08-08 09:36:14 +00:00
nSelect = mpImplLB - > GetEntryList ( ) - > FindMatchingEntry ( aSearchStr ) ;
2010-09-29 15:46:40 +08:00
bSelect = sal_False ;
2000-09-18 16:07:07 +00:00
}
if ( nSelect ! = LISTBOX_ENTRY_NOTFOUND )
{
if ( ! mpImplLB - > IsVisible ( nSelect ) )
2009-12-18 15:29:59 +01:00
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 )
2010-09-29 15:46:40 +08:00
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 ( ) ) ;
2010-09-29 15:46:40 +08:00
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 ) ) ) ;
}
2010-09-29 15:46:40 +08:00
mpImplLB - > SetCallSelectionChangedHdl ( sal_True ) ;
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_uInt16 ComboBox : : InsertEntry ( const XubString & rStr , sal_uInt16 nPos )
2000-09-18 16:07:07 +00:00
{
2010-09-29 15:46:40 +08:00
sal_uInt16 nRealPos = mpImplLB - > InsertEntry ( nPos + mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) , rStr ) ;
nRealPos = sal : : static_int_cast < sal_uInt16 > ( nRealPos - mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) ) ;
2006-06-19 18:15:38 +00:00
CallEventListeners ( VCLEVENT_COMBOBOX_ITEMADDED , ( void * ) sal_IntPtr ( nRealPos ) ) ;
2000-09-18 16:07:07 +00:00
return nRealPos ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_uInt16 ComboBox : : InsertEntry ( const XubString & rStr , const Image & rImage , sal_uInt16 nPos )
2000-09-18 16:07:07 +00:00
{
2010-09-29 15:46:40 +08:00
sal_uInt16 nRealPos = mpImplLB - > InsertEntry ( nPos + mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) , rStr , rImage ) ;
nRealPos = sal : : static_int_cast < sal_uInt16 > ( nRealPos - mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) ) ;
2006-06-19 18:15:38 +00:00
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 ) ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
void ComboBox : : RemoveEntry ( sal_uInt16 nPos )
2000-09-18 16:07:07 +00:00
{
mpImplLB - > RemoveEntry ( nPos + mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) ) ;
2006-06-19 18:15:38 +00:00
CallEventListeners ( VCLEVENT_COMBOBOX_ITEMREMOVED , ( void * ) sal_IntPtr ( nPos ) ) ;
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void ComboBox : : Clear ( )
{
mpImplLB - > Clear ( ) ;
2006-06-19 18:15:38 +00:00
CallEventListeners ( VCLEVENT_COMBOBOX_ITEMREMOVED , ( void * ) sal_IntPtr ( - 1 ) ) ;
2000-09-18 16:07:07 +00:00
}
2010-07-01 11:46:35 +02:00
// -----------------------------------------------------------------------
2010-11-10 13:50:33 +08:00
Image ComboBox : : GetEntryImage ( sal_uInt16 nPos ) const
2010-07-01 11:46:35 +02:00
{
if ( mpImplLB - > GetEntryList ( ) - > HasEntryImage ( nPos ) )
return mpImplLB - > GetEntryList ( ) - > GetEntryImage ( nPos ) ;
return Image ( ) ;
}
2000-09-18 16:07:07 +00:00
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_uInt16 ComboBox : : GetEntryPos ( const XubString & rStr ) const
2000-09-18 16:07:07 +00:00
{
2010-09-29 15:46:40 +08:00
sal_uInt16 nPos = mpImplLB - > GetEntryList ( ) - > FindEntry ( rStr ) ;
2000-09-18 16:07:07 +00:00
if ( nPos ! = LISTBOX_ENTRY_NOTFOUND )
2010-09-29 15:46:40 +08:00
nPos = sal : : static_int_cast < sal_uInt16 > ( nPos - mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) ) ;
2000-09-18 16:07:07 +00:00
return nPos ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_uInt16 ComboBox : : GetEntryPos ( const void * pData ) const
2000-09-18 16:07:07 +00:00
{
2010-09-29 15:46:40 +08:00
sal_uInt16 nPos = mpImplLB - > GetEntryList ( ) - > FindEntry ( pData ) ;
2000-09-18 16:07:07 +00:00
if ( nPos ! = LISTBOX_ENTRY_NOTFOUND )
2010-09-29 15:46:40 +08:00
nPos = sal : : static_int_cast < sal_uInt16 > ( nPos - mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) ) ;
2000-09-18 16:07:07 +00:00
return nPos ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
XubString ComboBox : : GetEntry ( sal_uInt16 nPos ) const
2000-09-18 16:07:07 +00:00
{
return mpImplLB - > GetEntryList ( ) - > GetEntryText ( nPos + mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_uInt16 ComboBox : : GetEntryCount ( ) const
2000-09-18 16:07:07 +00:00
{
return mpImplLB - > GetEntryList ( ) - > GetEntryCount ( ) - mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_Bool ComboBox : : IsTravelSelect ( ) const
2000-09-18 16:07:07 +00:00
{
return mpImplLB - > IsTravelSelect ( ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_Bool ComboBox : : IsInDropDown ( ) const
2000-09-18 16:07:07 +00:00
{
return mpFloatWin & & mpFloatWin - > IsInPopupMode ( ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
void ComboBox : : EnableMultiSelection ( sal_Bool bMulti )
2000-09-18 16:07:07 +00:00
{
2010-09-29 15:46:40 +08:00
mpImplLB - > EnableMultiSelection ( bMulti , sal_False ) ;
mpImplLB - > SetMultiSelectionSimpleMode ( sal_True ) ;
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_Bool ComboBox : : IsMultiSelectionEnabled ( ) const
2000-09-18 16:07:07 +00:00
{
return mpImplLB - > IsMultiSelectionEnabled ( ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
long ComboBox : : CalcWindowSizePixel ( sal_uInt16 nLines ) const
2000-09-18 16:07:07 +00:00
{
return mpImplLB - > GetEntryHeight ( ) * nLines ;
}
// -----------------------------------------------------------------------
2008-01-14 12:04:45 +00:00
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 ;
2004-06-17 11:11:35 +00:00
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 ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
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 ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
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 ( ) ;
2010-09-29 15:46:40 +08:00
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 ( ) ;
2010-09-29 15:46:40 +08:00
rnCols = ( sal_uInt16 ) ( aOutSz . Width ( ) / nCharWidth ) ;
2000-09-18 16:07:07 +00:00
rnLines = 1 ;
}
}
// -----------------------------------------------------------------------
2011-01-12 15:07:10 +01:00
void ComboBox : : Draw ( OutputDevice * pDev , const Point & rPos , const Size & rSize , sal_uLong nFlags )
2000-09-18 16:07:07 +00:00
{
2010-09-29 15:46:40 +08: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 ( ) ;
2010-09-29 15:46:40 +08:00
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 )
{
2004-09-08 16:47:00 +00:00
ImplDrawFrame ( pDev , aRect ) ;
2000-09-18 16:07:07 +00:00
}
if ( bBackground )
{
pDev - > SetFillColor ( GetControlBackground ( ) ) ;
pDev - > DrawRect ( aRect ) ;
}
}
// Inhalt
2001-07-17 09:31:47 +00:00
if ( ! IsDropDownBox ( ) )
2000-09-18 16:07:07 +00:00
{
2004-07-05 14:41:42 +00:00
long nOnePixel = GetDrawPixel ( pDev , 1 ) ;
long nTextHeight = pDev - > GetTextHeight ( ) ;
long nEditHeight = nTextHeight + 6 * nOnePixel ;
2010-09-29 15:46:40 +08:00
sal_uInt16 nTextStyle = TEXT_DRAW_VCENTER ;
2000-09-18 16:07:07 +00:00
2004-07-05 14:41:42 +00:00
// First, draw the edit part
2000-09-18 16:07:07 +00:00
mpSubEdit - > Draw ( pDev , aPos , Size ( aSize . Width ( ) , nEditHeight ) , nFlags ) ;
2004-07-05 14:41:42 +00:00
// 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 ) ;
2010-09-29 15:46:40 +08:00
sal_uInt16 nLines = ( sal_uInt16 ) ( ( aSize . Height ( ) - nEditHeight ) / nTextHeight ) ;
2000-09-18 16:07:07 +00:00
if ( ! nLines )
nLines = 1 ;
2010-09-29 15:46:40 +08:00
sal_uInt16 nTEntry = IsReallyVisible ( ) ? mpImplLB - > GetTopEntry ( ) : 0 ;
2004-07-05 14:41:42 +00:00
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
2010-09-29 15:46:40 +08:00
for ( sal_uInt16 n = 0 ; n < nLines ; n + + )
2004-07-05 14:41:42 +00:00
{
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 ( ) ;
2003-06-12 07:18:32 +00:00
// 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 ( ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
void ComboBox : : EnableUserDraw ( sal_Bool bUserDraw )
2000-09-18 16:07:07 +00:00
{
mpImplLB - > GetMainWindow ( ) - > EnableUserDraw ( bUserDraw ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_Bool ComboBox : : IsUserDrawEnabled ( ) const
2000-09-18 16:07:07 +00:00
{
return mpImplLB - > GetMainWindow ( ) - > IsUserDrawEnabled ( ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
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 ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
void ComboBox : : SetSeparatorPos ( sal_uInt16 n )
2000-09-18 16:07:07 +00:00
{
mpImplLB - > SetSeparatorPos ( n ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
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 ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
void ComboBox : : SetMaxMRUCount ( sal_uInt16 n )
2000-09-18 16:07:07 +00:00
{
mpImplLB - > SetMaxMRUCount ( n ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_uInt16 ComboBox : : GetMaxMRUCount ( ) const
2000-09-18 16:07:07 +00:00
{
return mpImplLB - > GetMaxMRUCount ( ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_uInt16 ComboBox : : GetDisplayLineCount ( ) const
2002-04-16 15:11:36 +00:00
{
return mpImplLB - > GetDisplayLineCount ( ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
void ComboBox : : SetEntryData ( sal_uInt16 nPos , void * pNewData )
2000-09-18 16:07:07 +00:00
{
mpImplLB - > SetEntryData ( nPos + mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) , pNewData ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
void * ComboBox : : GetEntryData ( sal_uInt16 nPos ) const
2000-09-18 16:07:07 +00:00
{
return mpImplLB - > GetEntryList ( ) - > GetEntryData ( nPos + mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) ) ;
}
2002-04-19 10:43:32 +00:00
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
void ComboBox : : SetTopEntry ( sal_uInt16 nPos )
2002-04-19 10:43:32 +00:00
{
mpImplLB - > SetTopEntry ( nPos + mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
void ComboBox : : ShowProminentEntry ( sal_uInt16 nPos )
2009-12-18 15:29:59 +01:00
{
mpImplLB - > ShowProminentEntry ( nPos + mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) ) ;
}
// -----------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_uInt16 ComboBox : : GetTopEntry ( ) const
2002-04-19 10:43:32 +00:00
{
2010-09-29 15:46:40 +08:00
sal_uInt16 nPos = GetEntryCount ( ) ? mpImplLB - > GetTopEntry ( ) : LISTBOX_ENTRY_NOTFOUND ;
2002-04-19 10:43:32 +00:00
if ( nPos < mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) )
nPos = 0 ;
return nPos ;
}
2002-04-19 11:11:57 +00:00
// -----------------------------------------------------------------------
2009-12-18 15:29:59 +01: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 ( ) ;
}
2002-05-08 12:24:39 +00:00
// -----------------------------------------------------------------------
2003-04-11 16:28:16 +00:00
Rectangle ComboBox : : GetListPosSizePixel ( ) const
{
return mpFloatWin ? Rectangle ( ) : mpImplLB - > GetMainWindow ( ) - > GetWindowExtentsRelative ( const_cast < ComboBox * > ( this ) ) ;
}
// -----------------------------------------------------------------------
2002-05-08 12:24:39 +00:00
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 ;
}
2003-03-27 16:59:30 +00:00
// -----------------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_uInt16 ComboBox : : GetSelectEntryCount ( ) const
2003-03-27 16:59:30 +00:00
{
return mpImplLB - > GetEntryList ( ) - > GetSelectEntryCount ( ) ;
}
// -----------------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_uInt16 ComboBox : : GetSelectEntryPos ( sal_uInt16 nIndex ) const
2003-03-27 16:59:30 +00:00
{
2010-09-29 15:46:40 +08:00
sal_uInt16 nPos = mpImplLB - > GetEntryList ( ) - > GetSelectEntryPos ( nIndex ) ;
2003-03-27 16:59:30 +00:00
if ( nPos ! = LISTBOX_ENTRY_NOTFOUND )
{
if ( nPos < mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) )
nPos = mpImplLB - > GetEntryList ( ) - > FindEntry ( mpImplLB - > GetEntryList ( ) - > GetEntryText ( nPos ) ) ;
2010-09-29 15:46:40 +08:00
nPos = sal : : static_int_cast < sal_uInt16 > ( nPos - mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) ) ;
2003-03-27 16:59:30 +00:00
}
return nPos ;
}
// -----------------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
sal_Bool ComboBox : : IsEntryPosSelected ( sal_uInt16 nPos ) const
2003-03-27 16:59:30 +00:00
{
return mpImplLB - > GetEntryList ( ) - > IsEntryPosSelected ( nPos + mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) ) ;
}
// -----------------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
void ComboBox : : SelectEntryPos ( sal_uInt16 nPos , sal_Bool bSelect )
2003-03-27 16:59:30 +00:00
{
if ( nPos < mpImplLB - > GetEntryList ( ) - > GetEntryCount ( ) )
mpImplLB - > SelectEntry ( nPos + mpImplLB - > GetEntryList ( ) - > GetMRUCount ( ) , bSelect ) ;
}
// -----------------------------------------------------------------------------
void ComboBox : : SetNoSelection ( )
{
mpImplLB - > SetNoSelection ( ) ;
mpSubEdit - > SetText ( String ( ) ) ;
}
// -----------------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
Rectangle ComboBox : : GetBoundingRectangle ( sal_uInt16 nItem ) const
2003-03-27 16:59:30 +00:00
{
Rectangle aRect = mpImplLB - > GetMainWindow ( ) - > GetBoundingRectangle ( nItem ) ;
Rectangle aOffset = mpImplLB - > GetMainWindow ( ) - > GetWindowExtentsRelative ( ( Window * ) this ) ;
aRect . Move ( aOffset . TopLeft ( ) . X ( ) , aOffset . TopLeft ( ) . Y ( ) ) ;
return aRect ;
}
// -----------------------------------------------------------------------------
2003-09-04 06:42:20 +00:00
2010-09-29 15:46:40 +08:00
void ComboBox : : SetBorderStyle ( sal_uInt16 nBorderStyle )
2003-09-04 06:42:20 +00:00
{
Window : : SetBorderStyle ( nBorderStyle ) ;
if ( ! IsDropDownBox ( ) )
{
mpSubEdit - > SetBorderStyle ( nBorderStyle ) ;
mpImplLB - > SetBorderStyle ( nBorderStyle ) ;
}
}
2004-05-18 09:53:59 +00:00
// -----------------------------------------------------------------------------
2010-09-29 15:46:40 +08:00
long ComboBox : : GetIndexForPoint ( const Point & rPoint , sal_uInt16 & rPos ) const
2004-05-18 09:53:59 +00:00
{
2009-09-14 12:09:22 +00:00
if ( ! HasLayoutData ( ) )
2004-05-18 09:53:59 +00:00
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
2010-09-29 15:46:40 +08:00
sal_uInt16 nEntry = pMain - > GetEntryPosForPoint ( aConvPoint ) ;
2004-05-18 09:53:59 +00:00
if ( nEntry = = LISTBOX_ENTRY_NOTFOUND )
nIndex = - 1 ;
else
rPos = nEntry ;
}
// get line relative index
if ( nIndex ! = - 1 )
nIndex = ToRelativeLineIndex ( nIndex ) ;
return nIndex ;
}
2010-10-14 08:27:31 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */