summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM>2010-11-24 18:50:17 +0100
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM>2010-11-24 18:50:17 +0100
commit41baca264de67907e7460bf729e94efff1a3cfd8 (patch)
treee76b928e80c58ff0e8c68216caedfa6b7b20f7cf /vcl
parent696996791d1dbfd8f410236e30be5a1fb100de70 (diff)
parent8dc3743ca56382374183bec5cd1a11d53f3085b8 (diff)
merge with DEV300_m94
Diffstat (limited to 'vcl')
-rwxr-xr-xvcl/aqua/source/app/vclnsapp.mm3
-rw-r--r--vcl/inc/vcl/ilstbox.hxx16
-rw-r--r--vcl/inc/vcl/mnemonicengine.hxx6
-rw-r--r--vcl/inc/vcl/quickselectionengine.hxx95
-rw-r--r--vcl/inc/vcl/window.hxx1
-rw-r--r--vcl/prj/d.lst1
-rw-r--r--vcl/source/control/ilstbox.cxx145
-rw-r--r--vcl/source/control/makefile.mk3
-rw-r--r--vcl/source/control/quickselectionengine.cxx183
-rw-r--r--vcl/source/gdi/outdev.cxx6
-rwxr-xr-xvcl/source/window/window.cxx6
-rw-r--r--vcl/unx/source/printer/ppdparser.cxx62
12 files changed, 425 insertions, 102 deletions
diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm
index df089fe17cb1..6402f5c60d75 100755
--- a/vcl/aqua/source/app/vclnsapp.mm
+++ b/vcl/aqua/source/app/vclnsapp.mm
@@ -39,6 +39,8 @@
#include "vcl/cmdevt.hxx"
#include "rtl/ustrbuf.hxx"
+#include "vcl/impimagetree.hxx"
+
#include "premac.h"
#import "Carbon/Carbon.h"
#import "apple_remote/RemoteControl.h"
@@ -431,6 +433,7 @@
GetpApp()->AppEvent( aEv );
// call DeInitVCL only after our YIELD_GUARD has expired,
// else its Mutex will be alredy destroyed when it runs out of scope !
+ ImplImageTreeSingletonRef()->shutDown();
bCallDeInit = true;
}
}
diff --git a/vcl/inc/vcl/ilstbox.hxx b/vcl/inc/vcl/ilstbox.hxx
index ac278f76f65b..6580538f5d10 100644
--- a/vcl/inc/vcl/ilstbox.hxx
+++ b/vcl/inc/vcl/ilstbox.hxx
@@ -36,6 +36,7 @@
#include <vcl/lstbox.h>
#include <vcl/timer.hxx>
+#include "vcl/quickselectionengine.hxx"
class ScrollBar;
class ScrollBarBox;
@@ -193,13 +194,11 @@ public:
// - ImplListBoxWindow -
// ---------------------
-class ImplListBoxWindow : public Control
+class ImplListBoxWindow : public Control, public ::vcl::ISearchableStringList
{
private:
ImplEntryList* mpEntryList; // EntryListe
Rectangle maFocusRect;
- String maSearchStr;
- Timer maSearchTimeout;
Size maUserItemSize;
@@ -254,9 +253,10 @@ private:
Link maUserDrawHdl;
Link maMRUChangedHdl;
-protected:
- DECL_LINK( SearchStringTimeout, Timer* );
+ ::vcl::QuickSelectionEngine
+ maQuickSelectionEngine;
+protected:
virtual void KeyInput( const KeyEvent& rKEvt );
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseMove( const MouseEvent& rMEvt );
@@ -379,6 +379,12 @@ public:
// pb: #106948# explicit mirroring for calc
inline void EnableMirroring() { mbMirroring = TRUE; }
inline 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 );
};
// ---------------
diff --git a/vcl/inc/vcl/mnemonicengine.hxx b/vcl/inc/vcl/mnemonicengine.hxx
index d12b3db2417e..fcd303510203 100644
--- a/vcl/inc/vcl/mnemonicengine.hxx
+++ b/vcl/inc/vcl/mnemonicengine.hxx
@@ -59,7 +59,7 @@ namespace vcl
If this value is <NULL/>, searching stops.
*/
- virtual const void* FirstSearchEntry( String& _rEntryText ) = 0;
+ virtual const void* FirstSearchEntry( String& _rEntryText ) const = 0;
/** returns the next list entry for the mnemonic search
@@ -74,7 +74,7 @@ namespace vcl
to <member>FirstSearchEntry</member> (i.e. you cycled
around), then searching stops, too.
*/
- virtual const void* NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) = 0;
+ virtual const void* NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) const = 0;
/** "selects" a given entry.
@@ -117,7 +117,7 @@ namespace vcl
the entry to select. This is the return value of a previous call
to <member>FirstSearchEntry</member> or <member>NextSearchEntry</member>.
*/
- virtual void ExecuteSearchEntry( const void* _pEntry ) = 0;
+ virtual void ExecuteSearchEntry( const void* _pEntry ) const = 0;
};
//====================================================================
diff --git a/vcl/inc/vcl/quickselectionengine.hxx b/vcl/inc/vcl/quickselectionengine.hxx
new file mode 100644
index 000000000000..f70736428010
--- /dev/null
+++ b/vcl/inc/vcl/quickselectionengine.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* 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 VCL_QUICKSELECTIONENGINE_HXX
+#define VCL_QUICKSELECTIONENGINE_HXX
+
+#include "dllapi.h"
+
+#include <tools/string.hxx>
+
+#include <memory>
+
+class KeyEvent;
+
+//........................................................................
+namespace vcl
+{
+//........................................................................
+
+ typedef const void* StringEntryIdentifier;
+
+ //====================================================================
+ //= ISearchableStringList
+ //====================================================================
+ // TODO: consolidate this with ::vcl::IMnemonicEntryList
+ class SAL_NO_VTABLE VCL_DLLPUBLIC ISearchableStringList
+ {
+ public:
+ /** returns the current entry in the list of searchable strings.
+
+ Search operations will start with this entry.
+ */
+ virtual StringEntryIdentifier CurrentEntry( String& _out_entryText ) const = 0;
+
+ /** returns the next entry in the list.
+
+ The implementation is expected to wrap around. That is, if the given entry denotes the last
+ entry in the list, then NextEntry should return the first entry.
+ */
+ virtual StringEntryIdentifier NextEntry( StringEntryIdentifier _currentEntry, String& _out_entryText ) const = 0;
+
+ /** selects a given entry
+ */
+ virtual void SelectEntry( StringEntryIdentifier _entry ) = 0;
+ };
+
+ //====================================================================
+ //= QuickSelectionEngine
+ //====================================================================
+ struct QuickSelectionEngine_Data;
+ class VCL_DLLPUBLIC QuickSelectionEngine
+ {
+ public:
+ QuickSelectionEngine( ISearchableStringList& _entryList );
+ ~QuickSelectionEngine();
+
+ bool HandleKeyEvent( const KeyEvent& _rKEvt );
+ void Reset();
+
+ private:
+ ::std::auto_ptr< QuickSelectionEngine_Data > m_pData;
+
+ private:
+ QuickSelectionEngine(); // never implemented
+ QuickSelectionEngine( const QuickSelectionEngine& ); // never implemented
+ QuickSelectionEngine& operator=( const QuickSelectionEngine& ); // never implemented
+ };
+
+//........................................................................
+} // namespace vcl
+//........................................................................
+
+#endif // VCL_QUICKSELECTIONENGINE_HXX
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index f72036fadc35..3ed9725bf080 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -598,6 +598,7 @@ public:
virtual void KeyUp( const KeyEvent& rKEvt );
virtual void PrePaint();
virtual void Paint( const Rectangle& rRect );
+ virtual void PostPaint();
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags );
virtual void Move();
virtual void Resize();
diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst
index 028118327e7b..3667e883afa6 100644
--- a/vcl/prj/d.lst
+++ b/vcl/prj/d.lst
@@ -76,6 +76,7 @@ mkdir: %_DEST%\inc%_EXT%\vcl
..\inc\vcl\metric.hxx %_DEST%\inc%_EXT%\vcl\metric.hxx
..\inc\vcl\mnemonic.hxx %_DEST%\inc%_EXT%\vcl\mnemonic.hxx
..\inc\vcl\mnemonicengine.hxx %_DEST%\inc%_EXT%\vcl\mnemonicengine.hxx
+..\inc\vcl\quickselectionengine.hxx %_DEST%\inc%_EXT%\vcl\quickselectionengine.hxx
..\inc\vcl\morebtn.hxx %_DEST%\inc%_EXT%\vcl\morebtn.hxx
..\inc\vcl\msgbox.hxx %_DEST%\inc%_EXT%\vcl\msgbox.hxx
..\inc\vcl\octree.hxx %_DEST%\inc%_EXT%\vcl\octree.hxx
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index b4b7e3f80357..bd0179ffe454 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -529,7 +529,8 @@ USHORT ImplEntryList::FindFirstSelectable( USHORT nPos, bool bForward /* = true
// =======================================================================
ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) :
- Control( pParent, 0 )
+ Control( pParent, 0 ),
+ maQuickSelectionEngine( *this )
{
mpEntryList = new ImplEntryList( this );
@@ -568,9 +569,6 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) :
SetTextFillColor();
SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) );
- maSearchTimeout.SetTimeout( 2500 );
- maSearchTimeout.SetTimeoutHdl( LINK( this, ImplListBoxWindow, SearchStringTimeout ) );
-
ImplInitSettings( TRUE, TRUE, TRUE );
ImplCalcMetrics();
}
@@ -579,7 +577,6 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) :
ImplListBoxWindow::~ImplListBoxWindow()
{
- maSearchTimeout.Stop();
delete mpEntryList;
}
@@ -624,14 +621,6 @@ void ImplListBoxWindow::ImplCalcMetrics()
// -----------------------------------------------------------------------
-IMPL_LINK( ImplListBoxWindow, SearchStringTimeout, Timer*, EMPTYARG )
-{
- maSearchStr.Erase();
- return 1;
-}
-
-// -----------------------------------------------------------------------
-
void ImplListBoxWindow::Clear()
{
mpEntryList->Clear();
@@ -648,6 +637,7 @@ void ImplListBoxWindow::Clear()
ImplClearLayoutData();
mnCurrentPos = LISTBOX_ENTRY_NOTFOUND;
+ maQuickSelectionEngine.Reset();
Invalidate();
}
@@ -918,7 +908,7 @@ USHORT ImplListBoxWindow::GetLastVisibleEntry() const
void ImplListBoxWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
mbMouseMoveSelect = FALSE; // Nur bis zum ersten MouseButtonDown
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
if ( !IsReadOnly() )
{
@@ -1465,7 +1455,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1492,7 +1482,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1523,7 +1513,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
}
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1557,7 +1547,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
}
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1578,7 +1568,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
bDone = TRUE;
}
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1604,7 +1594,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
}
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1615,7 +1605,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
ScrollHorz( -HORZ_SCROLL );
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1626,7 +1616,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
ScrollHorz( HORZ_SCROLL );
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1638,7 +1628,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
ImplCallSelect();
bDone = FALSE; // RETURN nicht abfangen.
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1653,7 +1643,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
}
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1673,7 +1663,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
SetUpdateMode( bUpdates );
Invalidate();
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
bDone = TRUE;
break;
@@ -1682,43 +1672,12 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
// fall through intentional
default:
{
- xub_Unicode c = rKEvt.GetCharCode();
-
- if ( !IsReadOnly() && (c >= 32) && (c != 127) && !rKEvt.GetKeyCode().IsMod2() )
+ if ( !IsReadOnly() )
{
- maSearchStr += c;
- XubString aTmpSearch( maSearchStr );
-
- nSelect = mpEntryList->FindMatchingEntry( aTmpSearch, mnCurrentPos );
- if ( (nSelect == LISTBOX_ENTRY_NOTFOUND) && (aTmpSearch.Len() > 1) )
- {
- // Wenn alles die gleichen Buchstaben, dann anderer Such-Modus
- BOOL bAllEqual = TRUE;
- for ( USHORT n = aTmpSearch.Len(); n && bAllEqual; )
- bAllEqual = aTmpSearch.GetChar( --n ) == c;
- if ( bAllEqual )
- {
- aTmpSearch = c;
- nSelect = mpEntryList->FindMatchingEntry( aTmpSearch, mnCurrentPos+1 );
- }
- }
- if ( nSelect == LISTBOX_ENTRY_NOTFOUND )
- nSelect = mpEntryList->FindMatchingEntry( aTmpSearch, 0 );
-
- if ( nSelect != LISTBOX_ENTRY_NOTFOUND )
- {
- ShowProminentEntry( nSelect );
-
- if ( mpEntryList->IsEntryPosSelected( nSelect ) )
- nSelect = LISTBOX_ENTRY_NOTFOUND;
-
- maSearchTimeout.Start();
- }
- else
- maSearchStr.Erase();
- bDone = TRUE;
+ bDone = maQuickSelectionEngine.HandleKeyEvent( rKEvt );
}
- }
+ }
+ break;
}
if ( ( nSelect != LISTBOX_ENTRY_NOTFOUND )
@@ -1744,6 +1703,72 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
}
// -----------------------------------------------------------------------
+namespace
+{
+ static ::vcl::StringEntryIdentifier lcl_getEntry( const ImplEntryList& _rList, USHORT _nPos, String& _out_entryText )
+ {
+ OSL_PRECOND( ( _nPos != LISTBOX_ENTRY_NOTFOUND ), "lcl_getEntry: invalid position!" );
+ USHORT nEntryCount( _rList.GetEntryCount() );
+ if ( _nPos >= nEntryCount )
+ _nPos = 0;
+ _out_entryText = _rList.GetEntryText( _nPos );
+
+ // ::vcl::StringEntryIdentifier does not allow for 0 values, but our position is 0-based
+ // => normalize
+ return reinterpret_cast< ::vcl::StringEntryIdentifier >( _nPos + 1 );
+ }
+
+ static USHORT lcl_getEntryPos( ::vcl::StringEntryIdentifier _entry )
+ {
+ // our pos is 0-based, but StringEntryIdentifier does not allow for a NULL
+ return static_cast< USHORT >( reinterpret_cast< sal_Int64 >( _entry ) ) - 1;
+ }
+}
+
+// -----------------------------------------------------------------------
+::vcl::StringEntryIdentifier ImplListBoxWindow::CurrentEntry( String& _out_entryText ) const
+{
+ return lcl_getEntry( *GetEntryList(), ( mnCurrentPos == LISTBOX_ENTRY_NOTFOUND ) ? 0 : mnCurrentPos + 1, _out_entryText );
+}
+
+// -----------------------------------------------------------------------
+::vcl::StringEntryIdentifier ImplListBoxWindow::NextEntry( ::vcl::StringEntryIdentifier _currentEntry, String& _out_entryText ) const
+{
+ USHORT nNextPos = lcl_getEntryPos( _currentEntry ) + 1;
+ return lcl_getEntry( *GetEntryList(), nNextPos, _out_entryText );
+}
+
+// -----------------------------------------------------------------------
+void ImplListBoxWindow::SelectEntry( ::vcl::StringEntryIdentifier _entry )
+{
+ USHORT nSelect = lcl_getEntryPos( _entry );
+ if ( mpEntryList->IsEntryPosSelected( nSelect ) )
+ {
+ // ignore that. This method is a callback from the QuickSelectionEngine, which means the user attempted
+ // to select the given entry by typing its starting letters. No need to act.
+ return;
+ }
+
+ // normalize
+ OSL_ENSURE( nSelect < mpEntryList->GetEntryCount(), "ImplListBoxWindow::SelectEntry: how that?" );
+ if( nSelect >= mpEntryList->GetEntryCount() )
+ nSelect = mpEntryList->GetEntryCount()-1;
+
+ // make visible
+ ShowProminentEntry( nSelect );
+
+ // actually select
+ mnCurrentPos = nSelect;
+ if ( SelectEntries( nSelect, LET_KEYMOVE, FALSE, FALSE ) )
+ {
+ mbTravelSelect = TRUE;
+ mnSelectModifier = 0;
+ ImplCallSelect();
+ mbTravelSelect = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
void ImplListBoxWindow::ImplPaint( USHORT nPos, BOOL bErase, bool bLayout )
{
diff --git a/vcl/source/control/makefile.mk b/vcl/source/control/makefile.mk
index a2553333246d..b1644e58ccd9 100644
--- a/vcl/source/control/makefile.mk
+++ b/vcl/source/control/makefile.mk
@@ -62,7 +62,8 @@ SLOFILES= $(SLO)$/button.obj \
$(SLO)$/slider.obj \
$(SLO)$/spinfld.obj \
$(SLO)$/spinbtn.obj \
- $(SLO)$/tabctrl.obj
+ $(SLO)$/tabctrl.obj \
+ $(SLO)$/quickselectionengine.obj
EXCEPTIONSFILES= \
$(SLO)$/button.obj \
diff --git a/vcl/source/control/quickselectionengine.cxx b/vcl/source/control/quickselectionengine.cxx
new file mode 100644
index 000000000000..2d32393bf79a
--- /dev/null
+++ b/vcl/source/control/quickselectionengine.cxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* 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.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "vcl/quickselectionengine.hxx"
+#include "vcl/event.hxx"
+#include "vcl/timer.hxx"
+#include "vcl/i18nhelp.hxx"
+#include "vcl/svapp.hxx"
+
+#include <boost/optional.hpp>
+
+//........................................................................
+namespace vcl
+{
+//........................................................................
+
+ //====================================================================
+ //= QuickSelectionEngine_Data
+ //====================================================================
+ struct QuickSelectionEngine_Data
+ {
+ ISearchableStringList& rEntryList;
+ String sCurrentSearchString;
+ ::boost::optional< sal_Unicode > aSingleSearchChar;
+ Timer aSearchTimeout;
+
+ QuickSelectionEngine_Data( ISearchableStringList& _entryList )
+ :rEntryList( _entryList )
+ ,sCurrentSearchString()
+ ,aSingleSearchChar()
+ ,aSearchTimeout()
+ {
+ aSearchTimeout.SetTimeout( 2500 );
+ aSearchTimeout.SetTimeoutHdl( LINK( this, QuickSelectionEngine_Data, SearchStringTimeout ) );
+ }
+
+ ~QuickSelectionEngine_Data()
+ {
+ aSearchTimeout.Stop();
+ }
+
+ DECL_LINK( SearchStringTimeout, Timer* );
+ };
+
+ //--------------------------------------------------------------------
+ namespace
+ {
+ static void lcl_reset( QuickSelectionEngine_Data& _data )
+ {
+ _data.sCurrentSearchString.Erase();
+ _data.aSingleSearchChar.reset();
+ _data.aSearchTimeout.Stop();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ IMPL_LINK( QuickSelectionEngine_Data, SearchStringTimeout, Timer*, /*EMPTYARG*/ )
+ {
+ lcl_reset( *this );
+ return 1;
+ }
+
+ //--------------------------------------------------------------------
+ static StringEntryIdentifier findMatchingEntry( const String& _searchString, QuickSelectionEngine_Data& _engineData )
+ {
+ const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetLocaleI18nHelper();
+ // TODO: do we really need the Window's settings here? The original code used it ...
+
+ String sEntryText;
+ // get the "current + 1" entry
+ StringEntryIdentifier pSearchEntry = _engineData.rEntryList.CurrentEntry( sEntryText );
+ if ( pSearchEntry )
+ pSearchEntry = _engineData.rEntryList.NextEntry( pSearchEntry, sEntryText );
+ // loop 'til we find another matching entry
+ StringEntryIdentifier pStartedWith = pSearchEntry;
+ while ( pSearchEntry )
+ {
+ if ( rI18nHelper.MatchString( _searchString, sEntryText ) != 0 )
+ break;
+
+ pSearchEntry = _engineData.rEntryList.NextEntry( pSearchEntry, sEntryText );
+ if ( pSearchEntry == pStartedWith )
+ pSearchEntry = NULL;
+ }
+
+ return pSearchEntry;
+ }
+
+ //====================================================================
+ //= QuickSelectionEngine
+ //====================================================================
+ //--------------------------------------------------------------------
+ QuickSelectionEngine::QuickSelectionEngine( ISearchableStringList& _entryList )
+ :m_pData( new QuickSelectionEngine_Data( _entryList ) )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ QuickSelectionEngine::~QuickSelectionEngine()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ bool QuickSelectionEngine::HandleKeyEvent( const KeyEvent& _keyEvent )
+ {
+ xub_Unicode c = _keyEvent.GetCharCode();
+
+ if ( ( c >= 32 ) && ( c != 127 ) && !_keyEvent.GetKeyCode().IsMod2() )
+ {
+ m_pData->sCurrentSearchString += c;
+ OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: searching for %s", ByteString( m_pData->sCurrentSearchString, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+
+ if ( m_pData->sCurrentSearchString.Len() == 1 )
+ { // first character in the search -> remmeber
+ m_pData->aSingleSearchChar.reset( c );
+ }
+ else if ( m_pData->sCurrentSearchString.Len() > 1 )
+ {
+ if ( !!m_pData->aSingleSearchChar && ( *m_pData->aSingleSearchChar != c ) )
+ // we already have a "single char", but the current one is different -> reset
+ m_pData->aSingleSearchChar.reset();
+ }
+
+ XubString aSearchTemp( m_pData->sCurrentSearchString );
+
+ StringEntryIdentifier pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData );
+ OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: found %p", pMatchingEntry );
+ if ( !pMatchingEntry && ( aSearchTemp.Len() > 1 ) && !!m_pData->aSingleSearchChar )
+ {
+ // if there's only one letter in the search string, use a different search mode
+ aSearchTemp = *m_pData->aSingleSearchChar;
+ pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData );
+ }
+
+ if ( pMatchingEntry )
+ {
+ m_pData->rEntryList.SelectEntry( pMatchingEntry );
+ m_pData->aSearchTimeout.Start();
+ }
+ else
+ {
+ lcl_reset( *m_pData );
+ }
+
+ return true;
+ }
+ return false;
+ }
+
+ //--------------------------------------------------------------------
+ void QuickSelectionEngine::Reset()
+ {
+ lcl_reset( *m_pData );
+ }
+
+//........................................................................
+} // namespace vcl
+//........................................................................
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index a011e4ee4a92..847a8d7a299a 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -2495,6 +2495,9 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt,
const bool bDashUsed(LINE_DASH == aInfo.GetStyle());
const bool bLineWidthUsed(aInfo.GetWidth() > 1);
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
if(bDashUsed || bLineWidthUsed)
{
basegfx::B2DPolygon aLinePolygon;
@@ -2505,9 +2508,6 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt,
}
else
{
- if ( mbInitLineColor )
- ImplInitLineColor();
-
mpGraphics->DrawLine( aStartPt.X(), aStartPt.Y(), aEndPt.X(), aEndPt.Y(), this );
}
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 0c91d0a0bc16..d423f25e3dab 100755
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -4882,6 +4882,12 @@ void Window::Paint( const Rectangle& rRect )
// -----------------------------------------------------------------------
+void Window::PostPaint()
+{
+}
+
+// -----------------------------------------------------------------------
+
void Window::Draw( OutputDevice*, const Point&, const Size&, ULONG )
{
DBG_CHKTHIS( Window, ImplDbgCheckWindow );
diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx
index b2549573d099..587e58be5bc7 100644
--- a/vcl/unx/source/printer/ppdparser.cxx
+++ b/vcl/unx/source/printer/ppdparser.cxx
@@ -405,51 +405,53 @@ void PPDParser::scanPPDDir( const String& rDir )
const int nSuffixes = sizeof(pSuffixes)/sizeof(pSuffixes[0]);
osl::Directory aDir( rDir );
- aDir.open();
- osl::DirectoryItem aItem;
-
- INetURLObject aPPDDir(rDir);
- while( aDir.getNextItem( aItem ) == osl::FileBase::E_None )
+ if ( aDir.open() == osl::FileBase::E_None )
{
- osl::FileStatus aStatus( FileStatusMask_FileName );
- if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None )
+ osl::DirectoryItem aItem;
+
+ INetURLObject aPPDDir(rDir);
+ while( aDir.getNextItem( aItem ) == osl::FileBase::E_None )
{
- rtl::OUStringBuffer aURLBuf( rDir.Len() + 64 );
- aURLBuf.append( rDir );
- aURLBuf.append( sal_Unicode( '/' ) );
- aURLBuf.append( aStatus.getFileName() );
+ osl::FileStatus aStatus( FileStatusMask_FileName );
+ if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None )
+ {
+ rtl::OUStringBuffer aURLBuf( rDir.Len() + 64 );
+ aURLBuf.append( rDir );
+ aURLBuf.append( sal_Unicode( '/' ) );
+ aURLBuf.append( aStatus.getFileName() );
- rtl::OUString aFileURL, aFileName;
- osl::FileStatus::Type eType = osl::FileStatus::Unknown;
+ rtl::OUString aFileURL, aFileName;
+ osl::FileStatus::Type eType = osl::FileStatus::Unknown;
- if( resolveLink( aURLBuf.makeStringAndClear(), aFileURL, aFileName, eType ) == osl::FileBase::E_None )
- {
- if( eType == osl::FileStatus::Regular )
+ if( resolveLink( aURLBuf.makeStringAndClear(), aFileURL, aFileName, eType ) == osl::FileBase::E_None )
{
- INetURLObject aPPDFile = aPPDDir;
- aPPDFile.Append( aFileName );
-
- // match extension
- for( int nSuffix = 0; nSuffix < nSuffixes; nSuffix++ )
+ if( eType == osl::FileStatus::Regular )
{
- if( aFileName.getLength() > pSuffixes[nSuffix].nSuffixLen )
+ INetURLObject aPPDFile = aPPDDir;
+ aPPDFile.Append( aFileName );
+
+ // match extension
+ for( int nSuffix = 0; nSuffix < nSuffixes; nSuffix++ )
{
- if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) )
+ if( aFileName.getLength() > pSuffixes[nSuffix].nSuffixLen )
{
- (*pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName();
- break;
+ if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) )
+ {
+ (*pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName();
+ break;
+ }
}
}
}
- }
- else if( eType == osl::FileStatus::Directory )
- {
- scanPPDDir( aFileURL );
+ else if( eType == osl::FileStatus::Directory )
+ {
+ scanPPDDir( aFileURL );
+ }
}
}
}
+ aDir.close();
}
- aDir.close();
}
void PPDParser::initPPDFiles()