diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-04-22 15:09:06 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-04-22 15:09:06 +0200 |
commit | 83380a7805f69b18f432895fc17c53cf0354bf4d (patch) | |
tree | b38d271cb6a768b6c2f9d3bee37d0d88e0472cb4 /vcl/inc/ilstbox.hxx | |
parent | Fix typo; NF_KEY_FALSE should be "FALSE". (diff) | |
parent | masterfix DEV300: #i10000# fixed includes (diff) | |
download | core-83380a7805f69b18f432895fc17c53cf0354bf4d.tar.gz core-83380a7805f69b18f432895fc17c53cf0354bf4d.zip |
Merge commit 'ooo/DEV300_m106' into libreoffice-3-4
Conflicts:
cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
l10ntools/scripts/localize.pl
l10ntools/source/directory.cxx
l10ntools/source/srciter.cxx
padmin/Executable_spadmin.bin.mk
padmin/Library_spa.mk
svtools/inc/svtools/filter.hxx
svtools/inc/svtools/grfmgr.hxx
svtools/source/filter/filter.cxx
svtools/source/filter/filter2.cxx
svtools/source/filter/wmf/emfwr.cxx
svtools/source/filter/wmf/enhwmf.cxx
svtools/source/filter/wmf/winmtf.cxx
svtools/source/filter/wmf/winmtf.hxx
svtools/source/filter/wmf/winwmf.cxx
svtools/source/filter/wmf/wmfwr.cxx
svtools/source/graphic/grfmgr.cxx
svtools/source/graphic/grfmgr2.cxx
toolkit/source/controls/controlmodelcontainerbase.cxx
toolkit/source/controls/unocontrol.cxx
toolkit/source/helper/formpdfexport.cxx
toolkit/source/helper/unowrapper.cxx
vcl/Package_osx.mk
vcl/aqua/source/app/salinst.cxx
vcl/aqua/source/app/salsys.cxx
vcl/aqua/source/dtrans/aqua_service.cxx
vcl/aqua/source/dtrans/test_aquacb.cxx
vcl/aqua/source/res/makefile.mk
vcl/aqua/source/window/salframe.cxx
vcl/aqua/source/window/salframeview.mm
vcl/inc/aqua/salgdi.h
vcl/inc/aqua/salinst.h
vcl/inc/graphite_adaptors.hxx
vcl/inc/graphite_cache.hxx
vcl/inc/graphite_serverfont.hxx
vcl/inc/impprn.hxx
vcl/inc/svdata.hxx
vcl/inc/unx/i18n_status.hxx
vcl/inc/unx/saldata.hxx
vcl/inc/unx/salfont.h
vcl/inc/unx/salinst.h
vcl/inc/unx/salprn.h
vcl/inc/unx/salsys.h
vcl/inc/unx/sm.hxx
vcl/inc/vcl/gdimtf.hxx
vcl/inc/vcl/graph.hxx
vcl/inc/vcl/outdev.hxx
vcl/inc/vcl/polyscan.hxx
vcl/inc/vcl/svcompat.hxx
vcl/inc/vcl/svgread.hxx
vcl/inc/vcl/unobrok.hxx
vcl/inc/win/salgdi.h
vcl/inc/win/wincomp.hxx
vcl/prj/d.lst
vcl/source/app/dbggui.cxx
vcl/source/app/idlemgr.cxx
vcl/source/app/makefile.mk
vcl/source/app/settings.cxx
vcl/source/app/sound.cxx
vcl/source/app/stdtext.cxx
vcl/source/app/svapp.cxx
vcl/source/app/svdata.cxx
vcl/source/app/svmain.cxx
vcl/source/app/timer.cxx
vcl/source/app/unohelp.cxx
vcl/source/components/dtranscomp.cxx
vcl/source/control/button.cxx
vcl/source/control/combobox.cxx
vcl/source/control/ctrl.cxx
vcl/source/control/edit.cxx
vcl/source/control/field2.cxx
vcl/source/control/ilstbox.cxx
vcl/source/gdi/bitmap.cxx
vcl/source/gdi/bitmapex.cxx
vcl/source/gdi/cvtgrf.cxx
vcl/source/gdi/font.cxx
vcl/source/gdi/image.cxx
vcl/source/gdi/imagerepository.cxx
vcl/source/gdi/impbmp.cxx
vcl/source/gdi/impgraph.cxx
vcl/source/gdi/impimagetree.cxx
vcl/source/gdi/jobset.cxx
vcl/source/gdi/makefile.mk
vcl/source/gdi/metaact.cxx
vcl/source/gdi/outdev.cxx
vcl/source/gdi/outdev2.cxx
vcl/source/gdi/outdev5.cxx
vcl/source/gdi/outdev6.cxx
vcl/source/gdi/outmap.cxx
vcl/source/gdi/polyscan.cxx
vcl/source/gdi/print.cxx
vcl/source/gdi/print2.cxx
vcl/source/gdi/region.cxx
vcl/source/gdi/salgdilayout.cxx
vcl/source/gdi/sallayout.cxx
vcl/source/gdi/svcompat.cxx
vcl/source/gdi/virdev.cxx
vcl/source/glyphs/gcach_ftyp.cxx
vcl/source/glyphs/gcach_vdev.cxx
vcl/source/glyphs/gcach_vdev.hxx
vcl/source/glyphs/graphite_adaptors.cxx
vcl/source/glyphs/graphite_cache.cxx
vcl/source/glyphs/graphite_layout.cxx
vcl/source/glyphs/graphite_serverfont.cxx
vcl/source/glyphs/graphite_textsrc.hxx
vcl/source/glyphs/makefile.mk
vcl/source/src/makefile.mk
vcl/source/window/accel.cxx
vcl/source/window/brdwin.cxx
vcl/source/window/btndlg.cxx
vcl/source/window/dialog.cxx
vcl/source/window/dndevdis.cxx
vcl/source/window/dockmgr.cxx
vcl/source/window/dockwin.cxx
vcl/source/window/floatwin.cxx
vcl/source/window/introwin.cxx
vcl/source/window/keycod.cxx
vcl/source/window/menu.cxx
vcl/source/window/msgbox.cxx
vcl/source/window/scrwnd.cxx
vcl/source/window/split.cxx
vcl/source/window/splitwin.cxx
vcl/source/window/status.cxx
vcl/source/window/syswin.cxx
vcl/source/window/tabpage.cxx
vcl/source/window/toolbox.cxx
vcl/source/window/toolbox2.cxx
vcl/source/window/window.cxx
vcl/source/window/window2.cxx
vcl/source/window/winproc.cxx
vcl/source/window/wrkwin.cxx
vcl/unx/generic/app/i18n_cb.cxx
vcl/unx/generic/app/i18n_ic.cxx
vcl/unx/generic/app/saldata.cxx
vcl/unx/generic/app/saldisp.cxx
vcl/unx/generic/app/salinst.cxx
vcl/unx/generic/app/wmadaptor.cxx
vcl/unx/generic/fontmanager/afm_hash.cpp
vcl/unx/generic/gdi/salbmp.cxx
vcl/unx/generic/gdi/salgdi3.cxx
vcl/unx/generic/gdi/xrender_peer.cxx
vcl/unx/generic/window/salframe.cxx
vcl/unx/generic/window/salobj.cxx
vcl/unx/gtk/a11y/makefile.mk
vcl/unx/gtk/app/gtksys.cxx
vcl/unx/gtk/app/makefile.mk
vcl/unx/gtk/window/gtkframe.cxx
vcl/unx/gtk/window/gtkobject.cxx
vcl/unx/headless/svpinst.cxx
vcl/unx/headless/svpinst.hxx
vcl/unx/headless/svpprn.hxx
vcl/unx/kde/kdedata.cxx
vcl/unx/kde/salnativewidgets-kde.cxx
vcl/unx/kde4/KDESalDisplay.hxx
vcl/unx/kde4/KDEXLib.cxx
vcl/unx/kde4/KDEXLib.hxx
vcl/unx/kde4/VCLKDEApplication.cxx
vcl/unx/kde4/makefile.mk
vcl/unx/source/app/makefile.mk
vcl/unx/source/fontmanager/makefile.mk
vcl/unx/source/gdi/makefile.mk
vcl/unx/source/inc/salcursors.h
vcl/util/linksvp/makefile.mk
vcl/win/source/app/saldata.cxx
vcl/win/source/app/salinst.cxx
vcl/win/source/app/salshl.cxx
vcl/win/source/gdi/makefile.mk
vcl/win/source/gdi/salbmp.cxx
vcl/win/source/gdi/salgdi.cxx
vcl/win/source/gdi/salgdi2.cxx
vcl/win/source/gdi/salgdi3.cxx
vcl/win/source/gdi/salgdi_gdiplus.cxx
vcl/win/source/gdi/salprn.cxx
vcl/win/source/gdi/salvd.cxx
vcl/win/source/gdi/winlayout.cxx
vcl/win/source/window/salframe.cxx
vcl/win/source/window/salmenu.cxx
vcl/win/source/window/salobj.cxx
Diffstat (limited to 'vcl/inc/ilstbox.hxx')
-rw-r--r-- | vcl/inc/ilstbox.hxx | 651 |
1 files changed, 651 insertions, 0 deletions
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx new file mode 100644 index 000000000000..850531c64d9d --- /dev/null +++ b/vcl/inc/ilstbox.hxx @@ -0,0 +1,651 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef _SV_ILSTBOX_HXX +#define _SV_ILSTBOX_HXX + +#include <vcl/sv.h> +#include <vcl/image.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/button.hxx> +#include <vcl/floatwin.hxx> +#include <vcl/lstbox.h> +#include <vcl/timer.hxx> + +#include "vcl/quickselectionengine.hxx" + +class ScrollBar; +class ScrollBarBox; + +// ----------------- +// - ListBox-Types - +// ----------------- + +#define HORZ_SCROLL 4 +#define IMG_TXT_DISTANCE 6 + +enum LB_EVENT_TYPE +{ + LET_MBDOWN, + LET_TRACKING, + LET_TRACKING_END, + LET_KEYMOVE, + LET_KEYSPACE +}; + +// ----------------- +// - ImplEntryType - +// ----------------- + +struct ImplEntryType +{ + XubString maStr; + Image maImage; + void* mpUserData; + sal_Bool mbIsSelected; + long mnFlags; + long mnHeight; + + ImplEntryType( const XubString& rStr, const Image& rImage ) : + maStr( rStr ), + maImage( rImage ), + mnFlags( 0 ), + mnHeight( 0 ) + { + mbIsSelected = sal_False; + mpUserData = NULL; + } + + ImplEntryType( const XubString& rStr ) : + maStr( rStr ), + mnFlags( 0 ), + mnHeight( 0 ) + { + mbIsSelected = sal_False; + mpUserData = NULL; + } + + ImplEntryType( const Image& rImage ) : + maImage( rImage ), + mnFlags( 0 ), + mnHeight( 0 ) + { + mbIsSelected = sal_False; + mpUserData = NULL; + } +}; + +// ----------------- +// - ImplEntryList - +// ----------------- + +class ImplEntryList : private List +{ +private: + Window* mpWindow; // For getting the current locale when matching strings + sal_uInt16 mnLastSelected; + sal_uInt16 mnSelectionAnchor; + sal_uInt16 mnImages; + + sal_uInt16 mnMRUCount; + sal_uInt16 mnMaxMRUCount; + + Link maSelectionChangedHdl; + sal_Bool mbCallSelectionChangedHdl; + + ImplEntryType* GetEntry( sal_uInt16 nPos ) const { return (ImplEntryType*)List::GetObject( nPos ); } + +public: + ImplEntryList( Window* pWindow ); + ~ImplEntryList(); + + sal_uInt16 InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry, sal_Bool bSort ); + void RemoveEntry( sal_uInt16 nPos ); + const ImplEntryType* GetEntryPtr( sal_uInt16 nPos ) const { return (const ImplEntryType*) GetObject( nPos ); } + ImplEntryType* GetMutableEntryPtr( sal_uInt16 nPos ) const { return (ImplEntryType*) GetObject( nPos ); } + void Clear(); + + sal_uInt16 FindMatchingEntry( const XubString& rStr, sal_uInt16 nStart = 0, sal_Bool bForward = sal_True, sal_Bool bLazy = sal_True ) const; + sal_uInt16 FindEntry( const XubString& rStr, sal_Bool bSearchMRUArea = sal_False ) const; + sal_uInt16 FindEntry( const void* pData ) const; + + // helper: add up heights up to index nEndIndex. + // GetAddedHeight( 0 ) returns 0 + // GetAddedHeight( LISTBOX_ENTRY_NOTFOUND ) returns 0 + // GetAddedHeight( i, k ) with k > i is equivalent -GetAddedHeight( k, i ) + long GetAddedHeight( sal_uInt16 nEndIndex, sal_uInt16 nBeginIndex = 0, long nBeginHeight = 0 ) const; + long GetEntryHeight( sal_uInt16 nPos ) const; + + sal_uInt16 GetEntryCount() const { return (sal_uInt16)List::Count(); } + sal_Bool HasImages() const { return mnImages ? sal_True : sal_False; } + + XubString GetEntryText( sal_uInt16 nPos ) const; + + sal_Bool HasEntryImage( sal_uInt16 nPos ) const; + Image GetEntryImage( sal_uInt16 nPos ) const; + + void SetEntryData( sal_uInt16 nPos, void* pNewData ); + void* GetEntryData( sal_uInt16 nPos ) const; + + void SetEntryFlags( sal_uInt16 nPos, long nFlags ); + long GetEntryFlags( sal_uInt16 nPos ) const; + + void SelectEntry( sal_uInt16 nPos, sal_Bool bSelect ); + + sal_uInt16 GetSelectEntryCount() const; + XubString GetSelectEntry( sal_uInt16 nIndex ) const; + sal_uInt16 GetSelectEntryPos( sal_uInt16 nIndex ) const; + sal_Bool IsEntrySelected( const XubString& rStr ) const; + sal_Bool IsEntryPosSelected( sal_uInt16 nIndex ) const; + + void SetLastSelected( sal_uInt16 nPos ) { mnLastSelected = nPos; } + sal_uInt16 GetLastSelected() const { return mnLastSelected; } + + void SetSelectionAnchor( sal_uInt16 nPos ) { mnSelectionAnchor = nPos; } + sal_uInt16 GetSelectionAnchor() const { return mnSelectionAnchor; } + + + void SetSelectionChangedHdl( const Link& rLnk ) { maSelectionChangedHdl = rLnk; } + void SetCallSelectionChangedHdl( sal_Bool bCall ) { mbCallSelectionChangedHdl = bCall; } + + void SetMRUCount( sal_uInt16 n ) { mnMRUCount = n; } + sal_uInt16 GetMRUCount() const { return mnMRUCount; } + + void SetMaxMRUCount( sal_uInt16 n ) { mnMaxMRUCount = n; } + sal_uInt16 GetMaxMRUCount() const { return mnMaxMRUCount; } + + /** An Entry is selectable if its mnFlags does not have the + LISTBOX_ENTRY_FLAG_DISABLE_SELECTION flag set. */ + bool IsEntrySelectable( sal_uInt16 nPos ) const; + + /** returns the first entry found from the given position nPos that is selectable + or LISTBOX_ENTRY_NOTFOUND if non is found. If the entry at nPos is not selectable, + it returns the first selectable entry after nPos if bForward is true and the + first selectable entry after nPos is bForward is false. + */ + sal_uInt16 FindFirstSelectable( sal_uInt16 nPos, bool bForward = true ); +}; + +// --------------------- +// - ImplListBoxWindow - +// --------------------- + +class ImplListBoxWindow : public Control, public ::vcl::ISearchableStringList +{ +private: + ImplEntryList* mpEntryList; // EntryListe + Rectangle maFocusRect; + + Size maUserItemSize; + + long mnMaxTxtHeight; // Maximale Hoehe eines Text-Items + long mnMaxTxtWidth; // Maximale Breite eines Text-Items + // Entry ohne Image + long mnMaxImgTxtWidth;// Maximale Breite eines Text-Items + // Entry UND Image + long mnMaxImgWidth; // Maximale Breite eines Image-Items + long mnMaxImgHeight; // Maximale Hoehe eines Image-Items + long mnMaxWidth; // Maximale Breite eines Eintrags + long mnMaxHeight; // Maximale Hoehe eines Eintrags + + sal_uInt16 mnCurrentPos; // Position (Focus) + sal_uInt16 mnTrackingSaveSelection; // Selektion vor Tracking(); + + sal_uInt16 mnSeparatorPos; // Separator + + sal_uInt16 mnUserDrawEntry; + + sal_uInt16 mnTop; // Ausgabe ab Zeile + long mnLeft; // Ausgabe ab Spalte + long mnBorder; // Abstand Rahmen - Text + long mnTextHeight; // Texthoehe + ProminentEntry meProminentType; // where is the "prominent" entry + + sal_uInt16 mnSelectModifier; // Modifiers + + sal_Bool mbHasFocusRect: 1, + mbSort: 1, // ListBox sortiert + mbTrack: 1, // Tracking + mbMulti: 1, // MultiListBox + mbStackMode: 1, // StackSelection + mbSimpleMode: 1, // SimpleMode fuer MultiListBox + mbImgsDiffSz: 1, // Images haben verschiedene Groessen + mbTravelSelect: 1, // TravelSelect + mbTrackingSelect: 1, // Selektiert bei MouseMove + mbSelectionChanged: 1, // Select() nicht zu oft rufen... + mbMouseMoveSelect: 1, // Selektieren bei MouseMove + mbGrabFocus: 1, // Focus bei MBDown grabben + mbUserDrawEnabled: 1, // UserDraw possible + mbInUserDraw: 1, // In UserDraw + mbReadOnly: 1, // ReadOnly + mbMirroring: 1, // pb: #106948# explicit mirroring for calc + mbRight: 1, // right align Text output + mbCenter: 1; // center Text output + + Link maScrollHdl; + Link maSelectHdl; + Link maCancelHdl; + Link maDoubleClickHdl; + Link maUserDrawHdl; + Link maMRUChangedHdl; + + ::vcl::QuickSelectionEngine + maQuickSelectionEngine; + +protected: + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Resize(); + virtual void GetFocus(); + virtual void LoseFocus(); + + sal_Bool SelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLET, sal_Bool bShift = sal_False, sal_Bool bCtrl = sal_False ); + void ImplPaint( sal_uInt16 nPos, sal_Bool bErase = sal_False, bool bLayout = false ); + void ImplDoPaint( const Rectangle& rRect, bool bLayout = false ); + void ImplCalcMetrics(); + void ImplUpdateEntryMetrics( ImplEntryType& rEntry ); + void ImplCallSelect(); + + void ImplShowFocusRect(); + void ImplHideFocusRect(); + + + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +public: + virtual void FillLayoutData() const; + + ImplListBoxWindow( Window* pParent, WinBits nWinStyle ); + ~ImplListBoxWindow(); + + ImplEntryList* GetEntryList() const { return mpEntryList; } + + sal_uInt16 InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry ); + void RemoveEntry( sal_uInt16 nPos ); + void Clear(); + void ResetCurrentPos() { mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; } + sal_uInt16 GetCurrentPos() const { return mnCurrentPos; } + sal_uInt16 GetDisplayLineCount() const; + void SetEntryFlags( sal_uInt16 nPos, long nFlags ); + + void DrawEntry( sal_uInt16 nPos, sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos = sal_False, bool bLayout = false ); + + void SelectEntry( sal_uInt16 nPos, sal_Bool bSelect ); + void DeselectAll(); + sal_uInt16 GetEntryPosForPoint( const Point& rPoint ) const; + sal_uInt16 GetLastVisibleEntry() const; + + sal_Bool ProcessKeyInput( const KeyEvent& rKEvt ); + + void SetTopEntry( sal_uInt16 nTop ); + sal_uInt16 GetTopEntry() const { return mnTop; } + // ShowProminentEntry will set the entry correspoding to nEntryPos + // either at top or in the middle depending on the chosen style + void ShowProminentEntry( sal_uInt16 nEntryPos ); + void SetProminentEntryType( ProminentEntry eType ) { meProminentType = eType; } + ProminentEntry GetProminentEntryType() const { return meProminentType; } + using Window::IsVisible; + sal_Bool IsVisible( sal_uInt16 nEntry ) const; + + long GetLeftIndent() const { return mnLeft; } + void SetLeftIndent( long n ); + void ScrollHorz( long nDiff ); + + void AllowGrabFocus( sal_Bool b ) { mbGrabFocus = b; } + sal_Bool IsGrabFocusAllowed() const { return mbGrabFocus; } + + void SetSeparatorPos( sal_uInt16 n ) { mnSeparatorPos = n; } + sal_uInt16 GetSeparatorPos() const { return mnSeparatorPos; } + + void SetTravelSelect( sal_Bool bTravelSelect ) { mbTravelSelect = bTravelSelect; } + sal_Bool IsTravelSelect() const { return mbTravelSelect; } + sal_Bool IsTrackingSelect() const { return mbTrackingSelect; } + + void SetUserItemSize( const Size& rSz ); + const Size& GetUserItemSize() const { return maUserItemSize; } + + void EnableUserDraw( sal_Bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; } + sal_Bool IsUserDrawEnabled() const { return mbUserDrawEnabled; } + + void EnableMultiSelection( sal_Bool bMulti, sal_Bool bStackMode ) { mbMulti = bMulti; mbStackMode = bStackMode; } + sal_Bool IsMultiSelectionEnabled() const { return mbMulti; } + + void SetMultiSelectionSimpleMode( sal_Bool bSimple ) { mbSimpleMode = bSimple; } + sal_Bool IsMultiSelectionSimpleMode() const { return mbSimpleMode; } + + void EnableMouseMoveSelect( sal_Bool bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; } + sal_Bool IsMouseMoveSelectEnabled() const { return mbMouseMoveSelect; } + sal_Bool IsMouseMoveSelect() const { return mbMouseMoveSelect||mbStackMode; } + + Size CalcSize( sal_uInt16 nMaxLines ) const; + Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const; + + long GetEntryHeight() const { return mnMaxHeight; } + long GetMaxEntryWidth() const { return mnMaxWidth; } + + void SetScrollHdl( const Link& rLink ) { maScrollHdl = rLink; } + const Link& GetScrollHdl() const { return maScrollHdl; } + void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } + const Link& GetSelectHdl() const { return maSelectHdl; } + void SetCancelHdl( const Link& rLink ) { maCancelHdl = rLink; } + const Link& GetCancelHdl() const { return maCancelHdl; } + void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; } + const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; } + void SetUserDrawHdl( const Link& rLink ) { maUserDrawHdl = rLink; } + const Link& GetUserDrawHdl() const { return maUserDrawHdl; } + void SetMRUChangedHdl( const Link& rLink ) { maMRUChangedHdl = rLink; } + const Link& GetMRUChangedHdl() const { return maMRUChangedHdl; } + + sal_Bool IsSelectionChanged() const { return mbSelectionChanged; } + sal_uInt16 GetSelectModifier() const { return mnSelectModifier; } + + void EnableSort( sal_Bool b ) { mbSort = b; } + + void SetReadOnly( sal_Bool bReadOnly ) { mbReadOnly = bReadOnly; } + sal_Bool IsReadOnly() const { return mbReadOnly; } + + using Control::ImplInitSettings; + void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ); + sal_uInt16 ImplGetTextStyle() const; + + // pb: #106948# explicit mirroring for calc + inline void EnableMirroring() { mbMirroring = sal_True; } + inline sal_Bool IsMirroring() const { return mbMirroring; } + +protected: + // ISearchableStringList + virtual ::vcl::StringEntryIdentifier CurrentEntry( String& _out_entryText ) const; + virtual ::vcl::StringEntryIdentifier NextEntry( ::vcl::StringEntryIdentifier _currentEntry, String& _out_entryText ) const; + virtual void SelectEntry( ::vcl::StringEntryIdentifier _entry ); +}; + +// --------------- +// - ImplListBox - +// --------------- + +class ImplListBox : public Control +{ +private: + ImplListBoxWindow maLBWindow; + ScrollBar* mpHScrollBar; + ScrollBar* mpVScrollBar; + ScrollBarBox* mpScrollBarBox; + sal_Bool mbVScroll : 1, // VScroll an oder aus + mbHScroll : 1, // HScroll an oder aus + mbAutoHScroll : 1; // AutoHScroll an oder aus + Link maScrollHdl; // Weil der vom ImplListBoxWindow selbst benoetigt wird. + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer; + +protected: + virtual void GetFocus(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + long Notify( NotifyEvent& rNEvt ); + + void ImplResizeControls(); + void ImplCheckScrollBars(); + void ImplInitScrollBars(); + + DECL_LINK( ScrollBarHdl, ScrollBar* ); + DECL_LINK( LBWindowScrolled, void* ); + DECL_LINK( MRUChanged, void* ); + +public: + ImplListBox( Window* pParent, WinBits nWinStyle ); + ~ImplListBox(); + + const ImplEntryList* GetEntryList() const { return maLBWindow.GetEntryList(); } + ImplListBoxWindow* GetMainWindow() { return &maLBWindow; } + + virtual void Resize(); + virtual const Wallpaper& GetDisplayBackground() const; + virtual Window* GetPreferredKeyInputWindow(); + + sal_uInt16 InsertEntry( sal_uInt16 nPos, const XubString& rStr ); + sal_uInt16 InsertEntry( sal_uInt16 nPos, const Image& rImage ); + sal_uInt16 InsertEntry( sal_uInt16 nPos, const XubString& rStr, const Image& rImage ); + void RemoveEntry( sal_uInt16 nPos ); + void SetEntryData( sal_uInt16 nPos, void* pNewData ) { maLBWindow.GetEntryList()->SetEntryData( nPos, pNewData ); } + void Clear(); + + void SetEntryFlags( sal_uInt16 nPos, long nFlags ); + long GetEntryFlags( sal_uInt16 nPos ) const; + + void SelectEntry( sal_uInt16 nPos, sal_Bool bSelect ); + void SetNoSelection(); + void ResetCurrentPos() { maLBWindow.ResetCurrentPos(); } + sal_uInt16 GetCurrentPos() const { return maLBWindow.GetCurrentPos(); } + + sal_Bool ProcessKeyInput( const KeyEvent& rKEvt ) { return maLBWindow.ProcessKeyInput( rKEvt ); } + sal_Bool HandleWheelAsCursorTravel( const CommandEvent& rCEvt ); + + void SetSeparatorPos( sal_uInt16 n ) { maLBWindow.SetSeparatorPos( n ); } + sal_uInt16 GetSeparatorPos() const { return maLBWindow.GetSeparatorPos(); } + + void SetTopEntry( sal_uInt16 nTop ) { maLBWindow.SetTopEntry( nTop ); } + sal_uInt16 GetTopEntry() const { return maLBWindow.GetTopEntry(); } + void ShowProminentEntry( sal_uInt16 nPos ) { maLBWindow.ShowProminentEntry( nPos ); } + using Window::IsVisible; + sal_Bool IsVisible( sal_uInt16 nEntry ) const { return maLBWindow.IsVisible( nEntry ); } + + void SetProminentEntryType( ProminentEntry eType ) { maLBWindow.SetProminentEntryType( eType ); } + ProminentEntry GetProminentEntryType() const { return maLBWindow.GetProminentEntryType(); } + + long GetLeftIndent() const { return maLBWindow.GetLeftIndent(); } + void SetLeftIndent( sal_uInt16 n ) { maLBWindow.SetLeftIndent( n ); } + void ScrollHorz( short nDiff ) { maLBWindow.ScrollHorz( nDiff ); } + + void SetTravelSelect( sal_Bool bTravelSelect ) { maLBWindow.SetTravelSelect( bTravelSelect ); } + sal_Bool IsTravelSelect() const { return maLBWindow.IsTravelSelect(); } + sal_Bool IsTrackingSelect() const { return maLBWindow.IsTrackingSelect(); } + + void EnableMultiSelection( sal_Bool bMulti, sal_Bool bStackMode ) { maLBWindow.EnableMultiSelection( bMulti, bStackMode ); } + sal_Bool IsMultiSelectionEnabled() const { return maLBWindow.IsMultiSelectionEnabled(); } + + void SetMultiSelectionSimpleMode( sal_Bool bSimple ) { maLBWindow.SetMultiSelectionSimpleMode( bSimple ); } + sal_Bool IsMultiSelectionSimpleMode() const { return maLBWindow.IsMultiSelectionSimpleMode(); } + + void SetReadOnly( sal_Bool b ) { maLBWindow.SetReadOnly( b ); } + sal_Bool IsReadOnly() const { return maLBWindow.IsReadOnly(); } + + + Size CalcSize( sal_uInt16 nMaxLines ) const { return maLBWindow.CalcSize( nMaxLines ); } + long GetEntryHeight() const { return maLBWindow.GetEntryHeight(); } + long GetMaxEntryWidth() const { return maLBWindow.GetMaxEntryWidth(); } + + void SetScrollHdl( const Link& rLink ) { maScrollHdl = rLink; } + const Link& GetScrollHdl() const { return maScrollHdl; } + void SetSelectHdl( const Link& rLink ) { maLBWindow.SetSelectHdl( rLink ); } + const Link& GetSelectHdl() const { return maLBWindow.GetSelectHdl(); } + void SetCancelHdl( const Link& rLink ) { maLBWindow.SetCancelHdl( rLink ); } + const Link& GetCancelHdl() const { return maLBWindow.GetCancelHdl(); } + void SetDoubleClickHdl( const Link& rLink ) { maLBWindow.SetDoubleClickHdl( rLink ); } + const Link& GetDoubleClickHdl() const { return maLBWindow.GetDoubleClickHdl(); } + void SetUserDrawHdl( const Link& rLink ) { maLBWindow.SetUserDrawHdl( rLink ); } + const Link& GetUserDrawHdl() const { return maLBWindow.GetUserDrawHdl(); } + + void SetSelectionChangedHdl( const Link& rLnk ) { maLBWindow.GetEntryList()->SetSelectionChangedHdl( rLnk ); } + void SetCallSelectionChangedHdl( sal_Bool bCall ) { maLBWindow.GetEntryList()->SetCallSelectionChangedHdl( bCall ); } + sal_Bool IsSelectionChanged() const { return maLBWindow.IsSelectionChanged(); } + sal_uInt16 GetSelectModifier() const { return maLBWindow.GetSelectModifier(); } + + void SetMRUEntries( const XubString& rEntries, xub_Unicode cSep ); + XubString GetMRUEntries( xub_Unicode cSep ) const; + void SetMaxMRUCount( sal_uInt16 n ) { maLBWindow.GetEntryList()->SetMaxMRUCount( n ); } + sal_uInt16 GetMaxMRUCount() const { return maLBWindow.GetEntryList()->GetMaxMRUCount(); } + sal_uInt16 GetDisplayLineCount() const + { return maLBWindow.GetDisplayLineCount(); } + + // pb: #106948# explicit mirroring for calc + inline void EnableMirroring() { maLBWindow.EnableMirroring(); } + inline void SetDropTraget(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_xDNDListenerContainer){ mxDNDListenerContainer= i_xDNDListenerContainer; } +}; + +// ----------------------------- +// - ImplListBoxFloatingWindow - +// ----------------------------- + +class ImplListBoxFloatingWindow : public FloatingWindow +{ +private: + ImplListBox* mpImplLB; + Size maPrefSz; + sal_uInt16 mnDDLineCount; + sal_uInt16 mnPopupModeStartSaveSelection; + sal_Bool mbAutoWidth; + +protected: + long PreNotify( NotifyEvent& rNEvt ); + +public: + ImplListBoxFloatingWindow( Window* pParent ); + + void SetImplListBox( ImplListBox* pLB ) { mpImplLB = pLB; } + + void SetPrefSize( const Size& rSz ) { maPrefSz = rSz; } + const Size& GetPrefSize() const { return maPrefSz; } + + void SetAutoWidth( sal_Bool b ) { mbAutoWidth = b; } + sal_Bool IsAutoWidth() const { return mbAutoWidth; } + + Size CalcFloatSize(); + void StartFloat( sal_Bool bStartTracking ); + + virtual void SetPosSizePixel( long nX, long nY, + long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL ); + void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) + { FloatingWindow::SetPosSizePixel( rNewPos, rNewSize ); } + + void SetDropDownLineCount( sal_uInt16 n ) { mnDDLineCount = n; } + sal_uInt16 GetDropDownLineCount() const { return mnDDLineCount; } + + sal_uInt16 GetPopupModeStartSaveSelection() const { return mnPopupModeStartSaveSelection; } + + virtual void Resize(); +}; + +// ----------- +// - ImplWin - +// ----------- + +class ImplWin : public Control +{ +private: + + sal_uInt16 mnItemPos; // wegen UserDraw muss ich wissen, welches Item ich darstelle. + XubString maString; + Image maImage; + + Rectangle maFocusRect; + Size maUserItemSize; + + Link maMBDownHdl; + Link maUserDrawHdl; + + sal_Bool mbUserDrawEnabled : 1, + mbInUserDraw : 1; + + + void ImplDraw( bool bLayout = false ); +protected: + virtual void FillLayoutData() const; +public: + + ImplWin( Window* pParent, WinBits nWinStyle = 0 ); + ~ImplWin() {}; + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Resize(); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + sal_uInt16 GetItemPos() const { return mnItemPos; } + void SetItemPos( sal_uInt16 n ) { mnItemPos = n; } + + const XubString& GetString() const { return maString; } + void SetString( const XubString& rStr ) { maString = rStr; } + + const Image& GetImage() const { return maImage; } + void SetImage( const Image& rImg ) { maImage = rImg; } + + sal_Bool SetModeImage( const Image& rImage ); + const Image& GetModeImage( ) const; + + + virtual void MBDown(); + void SetMBDownHdl( const Link& rLink ) { maMBDownHdl = rLink; } + const Link& GetMBDownHdl() const { return maMBDownHdl; } + + void SetUserDrawHdl( const Link& rLink ) { maUserDrawHdl = rLink; } + const Link& GetUserDrawHdl() const { return maUserDrawHdl; } + + void SetUserItemSize( const Size& rSz ) { maUserItemSize = rSz; } + const Size& GetUserItemSize() const { return maUserItemSize; } + + void EnableUserDraw( sal_Bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; } + sal_Bool IsUserDrawEnabled() const { return mbUserDrawEnabled; } + + void DrawEntry( sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos = sal_False, bool bLayout = false ); +}; + +// ----------- +// - ImplBtn - +// ----------- + +class ImplBtn : public PushButton +{ +private: + sal_Bool mbDown; + + Link maMBDownHdl; + +public: + ImplBtn( Window* pParent, WinBits nWinStyle = 0 ); + ~ImplBtn() {}; + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + + virtual void MBDown(); + void SetMBDownHdl( const Link& rLink ) { maMBDownHdl = rLink; } + const Link& GetMBDownHdl() const { return maMBDownHdl; } +}; + + +void ImplInitFieldSettings( Window* pWin, sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ); +void ImplInitDropDownButton( PushButton* pButton ); + +#endif // _SV_ILSTBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |