summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comphelper/inc/comphelper/namedvaluecollection.hxx12
-rw-r--r--comphelper/inc/comphelper/optionalvalue.hxx187
-rw-r--r--comphelper/inc/comphelper/property.hxx8
-rw-r--r--comphelper/inc/comphelper/querydeep.hxx484
-rw-r--r--comphelper/inc/comphelper/scopeguard.hxx16
-rw-r--r--comphelper/inc/comphelper/servicedecl.hxx4
-rw-r--r--comphelper/source/misc/makefile.mk1
-rw-r--r--comphelper/source/misc/namedvaluecollection.cxx49
-rw-r--r--comphelper/source/misc/querydeep.cxx76
-rw-r--r--comphelper/source/property/propagg.cxx24
-rw-r--r--cppcanvas/inc/cppcanvas/renderer.hxx18
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx46
-rw-r--r--cppcanvas/source/mtfrenderer/textaction.cxx20
-rw-r--r--svtools/inc/svtools/svicnvw.hxx3
-rw-r--r--svtools/inc/svtools/svlbox.hxx30
-rw-r--r--svtools/inc/svtools/svtreebx.hxx12
-rw-r--r--svtools/source/contnr/svicnvw.cxx11
-rw-r--r--svtools/source/contnr/svimpbox.cxx70
-rw-r--r--svtools/source/contnr/svimpicn.cxx19
-rw-r--r--svtools/source/contnr/svlbox.cxx73
-rw-r--r--svtools/source/contnr/svtreebx.cxx37
-rw-r--r--svtools/source/inc/svimpbox.hxx4
-rw-r--r--svtools/source/inc/svimpicn.hxx3
-rw-r--r--svtools/source/uno/treecontrolpeer.cxx24
-rw-r--r--toolkit/source/controls/unocontrols.cxx14
-rw-r--r--tools/inc/tools/wintypes.hxx13
-rw-r--r--unotools/source/config/pathoptions.cxx13
-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
-rwxr-xr-xvcl/source/window/window.cxx6
36 files changed, 727 insertions, 1000 deletions
diff --git a/comphelper/inc/comphelper/namedvaluecollection.hxx b/comphelper/inc/comphelper/namedvaluecollection.hxx
index 72cd0e7cdfbe..e13059361b0a 100644
--- a/comphelper/inc/comphelper/namedvaluecollection.hxx
+++ b/comphelper/inc/comphelper/namedvaluecollection.hxx
@@ -39,6 +39,7 @@
#include <memory>
#include <algorithm>
+#include <vector>
//........................................................................
namespace comphelper
@@ -91,6 +92,11 @@ namespace comphelper
~NamedValueCollection();
+ inline void assign( const ::com::sun::star::uno::Any& i_rWrappedElements )
+ {
+ impl_assign( i_rWrappedElements );
+ }
+
inline void assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments )
{
impl_assign( _rArguments );
@@ -117,6 +123,11 @@ namespace comphelper
/// determines whether the collection is empty
bool empty() const;
+ /** returns the names of all elements in the collection
+ */
+ ::std::vector< ::rtl::OUString >
+ getNames() const;
+
/** merges the content of another collection into |this|
@param _rAdditionalValues
the collection whose values are to be merged
@@ -312,6 +323,7 @@ namespace comphelper
}
private:
+ void impl_assign( const ::com::sun::star::uno::Any& i_rWrappedElements );
void impl_assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments );
void impl_assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments );
void impl_assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArguments );
diff --git a/comphelper/inc/comphelper/optionalvalue.hxx b/comphelper/inc/comphelper/optionalvalue.hxx
deleted file mode 100644
index f63e1cde51aa..000000000000
--- a/comphelper/inc/comphelper/optionalvalue.hxx
+++ /dev/null
@@ -1,187 +0,0 @@
-/*************************************************************************
- *
- * 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 _COMPHELPER_OPTIONALVALUE_HXX
-#define _COMPHELPER_OPTIONALVALUE_HXX
-
-#include <com/sun/star/uno/Any.hxx>
-
-namespace comphelper
-{
-
-/** @deprecated
- Use boost/optional.hpp instead.
-*/
-
-
-
- /* Definition of OptionalValue template */
-
- /** This template provides 'optionality' for the given value type.
-
- Especially for PODs, optionality either needs to be achieved
- by special 'magic' values (i.e. an int value is not set when
- -1 etc.), or an additional bool denoting value
- validity. This template encapsulates the latter into an atomic
- data type.
-
- @tpl Element
- The value type that should be made optional
- */
- template< typename Element > class OptionalValue
- {
- public:
- typedef Element ValueType;
-
- /** Default-construct the value.
-
- A default-constructed value is not valid. You have to
- explicitely set a value.
- */
- OptionalValue() :
- maValue(),
- mbValid( false )
- {
- }
-
- /** Construct the value.
-
- An explicitely constructed value is valid. To create an
- invalid value, you have to default-construct it.
- */
- OptionalValue( const Element& rValue ) :
- maValue( rValue ),
- mbValid( true )
- {
- }
-
- // default copy/assignment operators are okay here
- //OptionalValue(const OptionalValue&);
- //OptionalValue& operator=( const OptionalValue& );
-
- /** Query whether the value is valid
-
- @return true, if this object contains a valid value.
- */
- bool isValid() const
- {
- return mbValid;
- }
-
- /** Set a value.
-
- After this call, the object contains a valid value.
- */
- void setValue( const Element& rValue )
- {
- maValue = rValue;
- mbValid = true;
- }
-
- /** Get the value.
-
- The return value of this method is undefined, if the
- object does not contain a valid value.
- */
- Element getValue() const
- {
- return maValue;
- }
-
- /** Clear the value.
-
- After this call, the object no longer contains a valid
- value.
- */
- void clearValue()
- {
- mbValid = false;
- }
-
- // NOTE: The following two methods would optimally have been
- // implemented as operator>>=/operator<<=
- // overloads. Unfortunately, there's already a templatized
- // version for those two methods, namely for UNO interface
- // types. Adding a second would lead to ambiguities.
-
- /** Export the value into an Any.
-
- This method extracts the value into an Any. If the value
- is invalid, the Any will be cleared.
-
- @return true, if the value has been successfully
- transferred to the Any. Clearing the Any from an invalid
- object is also considered a successful operation.
- */
- bool exportValue( ::com::sun::star::uno::Any& o_rAny )
- {
- o_rAny.clear();
-
- if( isValid() )
- {
- if( !(o_rAny <<= getValue()) )
- return false;
- }
-
- return true;
- }
-
- /** Import the value from an Any.
-
- This method imports the value from an Any. If the Any
- is invalid, the object will get an invalid value.
-
- @return true, if the value has been successfully
- transferred from the Any. Setting the value to invalid
- from an empty Any is also considered a successful
- operation.
- */
- bool importValue( const ::com::sun::star::uno::Any& rAny )
- {
- clearValue();
-
- if( rAny.hasValue() )
- {
- Element tmp;
-
- if( !(rAny >>= tmp) )
- return false;
-
- setValue( tmp );
- }
-
- return true;
- }
-
- private:
- Element maValue;
- bool mbValid;
- };
-
-}
-
-#endif /* _COMPHELPER_OPTIONALVALUE_HXX */
diff --git a/comphelper/inc/comphelper/property.hxx b/comphelper/inc/comphelper/property.hxx
index 5631cf5670f2..9b5b1a9804fe 100644
--- a/comphelper/inc/comphelper/property.hxx
+++ b/comphelper/inc/comphelper/property.hxx
@@ -150,11 +150,11 @@ COMPHELPER_DLLPUBLIC void copyProperties(const staruno::Reference<starbeans::XPr
sal_False, if the value could be converted and has not changed
@exception InvalidArgumentException thrown if the value could not be converted to the requested type (which is the template argument)
*/
-template <class TYPE>
-sal_Bool tryPropertyValue(staruno::Any& /*out*/_rConvertedValue, staruno::Any& /*out*/_rOldValue, const staruno::Any& _rValueToSet, const TYPE& _rCurrentValue)
+template <typename T>
+sal_Bool tryPropertyValue(staruno::Any& /*out*/_rConvertedValue, staruno::Any& /*out*/_rOldValue, const staruno::Any& _rValueToSet, const T& _rCurrentValue)
{
sal_Bool bModified(sal_False);
- TYPE aNewValue;
+ T aNewValue = T();
::cppu::convertPropertyValue(aNewValue, _rValueToSet);
if (aNewValue != _rCurrentValue)
{
@@ -207,7 +207,7 @@ sal_Bool tryPropertyValueEnum(staruno::Any& /*out*/_rConvertedValue, staruno::An
inline sal_Bool tryPropertyValue(staruno::Any& /*out*/_rConvertedValue, staruno::Any& /*out*/_rOldValue, const staruno::Any& _rValueToSet, sal_Bool _bCurrentValue)
{
sal_Bool bModified(sal_False);
- sal_Bool bNewValue;
+ sal_Bool bNewValue(sal_False);
::cppu::convertPropertyValue(bNewValue, _rValueToSet);
if (bNewValue != _bCurrentValue)
{
diff --git a/comphelper/inc/comphelper/querydeep.hxx b/comphelper/inc/comphelper/querydeep.hxx
deleted file mode 100644
index 4115412d8d6c..000000000000
--- a/comphelper/inc/comphelper/querydeep.hxx
+++ /dev/null
@@ -1,484 +0,0 @@
-/*************************************************************************
- *
- * 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 _COMPHELPER_QUERYDEEPINTERFACE_HXX
-#define _COMPHELPER_QUERYDEEPINTERFACE_HXX
-
-#include <com/sun/star/uno/XInterface.hpp>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Type.hxx>
-
-/** */ //for docpp
-namespace comphelper
-{
-
-//--------------------------------------------------------------------------------------------------------
-/**
- * Inspect interfaces types whether they are related by inheritance.
- *<BR>
- * @return true if rType is derived from rBaseType
- * @param rBaseType a <type>Type</type> of an interface.
- * @param rType a <type>Type</type> of an interface.
- */
-sal_Bool isDerivedFrom(
- const ::com::sun::star::uno::Type & rBaseType,
- const ::com::sun::star::uno::Type & rType );
-
-//--------------------------------------------------------------------------------------------------------
-/**
- * Inspect interface types whether they are related by inheritance.
- *<BR>
- * @return true if p is of a type derived from rBaseType
- * @param rBaseType a <type>Type</type> of an interface.
- * @param p a pointer to an interface.
- */
-template <class Interface>
-inline sal_Bool isDerivedFrom(
- const ::com::sun::star::uno::Type& rBaseType,
- Interface* /*p*/)
-{
- return isDerivedFrom(rBaseType, Interface::static_type());
-}
-
-//--------------------------------------------------------------------------------------------------------
-// possible optimization ?
-// Any aRet(::cppu::queryInterface(rType, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12));
-// if (aRet.hasValue())
-// return aRet;
-
-/**
- * Inspect types and choose return proper interface.
- *<BR>
- * @param p1 a pointer to an interface.
- */
-template< class Interface1 >
-inline ::com::sun::star::uno::Any queryDeepInterface(
- const ::com::sun::star::uno::Type & rType,
- Interface1 * p1 )
-{
- if (isDerivedFrom(rType, Interface1::static_type()))
- return ::com::sun::star::uno::Any( &p1, rType );
- else
- return ::com::sun::star::uno::Any();
-}
-
-/**
- * Inspect types and choose return proper interface.
- *<BR>
- * @param p1 a pointer to an interface.
- * @param p2 a pointer to an interface.
- */
-template< class Interface1, class Interface2 >
-inline ::com::sun::star::uno::Any queryDeepInterface(
- const ::com::sun::star::uno::Type & rType,
- Interface1 * p1, Interface2 * p2 )
-{
- if (isDerivedFrom(rType, Interface1::static_type()))
- return ::com::sun::star::uno::Any( &p1, rType );
- else if (isDerivedFrom(rType, Interface2::static_type()))
- return ::com::sun::star::uno::Any( &p2, rType );
- else
- return ::com::sun::star::uno::Any();
-}
-
-/**
- * Inspect types and choose return proper interface.
- *<BR>
- * @param p1 a pointer to an interface.
- * @param p2 a pointer to an interface.
- * @param p3 a pointer to an interface.
- */
-template< class Interface1, class Interface2, class Interface3 >
-inline ::com::sun::star::uno::Any queryDeepInterface(
- const ::com::sun::star::uno::Type & rType,
- Interface1 * p1, Interface2 * p2, Interface3 * p3 )
-{
- if (isDerivedFrom(rType, Interface1::static_type()))
- return ::com::sun::star::uno::Any( &p1, rType );
- else if (isDerivedFrom(rType, Interface2::static_type()))
- return ::com::sun::star::uno::Any( &p2, rType );
- else if (isDerivedFrom(rType, Interface3::static_type()))
- return ::com::sun::star::uno::Any( &p3, rType );
- else
- return ::com::sun::star::uno::Any();
-}
-
-/**
- * Inspect types and choose return proper interface.
- *<BR>
- * @param p1 a pointer to an interface.
- * @param p2 a pointer to an interface.
- * @param p3 a pointer to an interface.
- * @param p4 a pointer to an interface.
- */
-template< class Interface1, class Interface2, class Interface3, class Interface4 >
-inline ::com::sun::star::uno::Any queryDeepInterface(
- const ::com::sun::star::uno::Type & rType,
- Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4 )
-{
- if (isDerivedFrom(rType, Interface1::static_type()))
- return ::com::sun::star::uno::Any( &p1, rType );
- else if (isDerivedFrom(rType, Interface2::static_type()))
- return ::com::sun::star::uno::Any( &p2, rType );
- else if (isDerivedFrom(rType, Interface3::static_type()))
- return ::com::sun::star::uno::Any( &p3, rType );
- else if (isDerivedFrom(rType, Interface4::static_type()))
- return ::com::sun::star::uno::Any( &p4, rType );
- else
- return ::com::sun::star::uno::Any();
-}
-
-/**
- * Inspect types and choose return proper interface.
- *<BR>
- * @param p1 a pointer to an interface.
- * @param p2 a pointer to an interface.
- * @param p3 a pointer to an interface.
- * @param p4 a pointer to an interface.
- * @param p5 a pointer to an interface.
- */
-template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5 >
-inline ::com::sun::star::uno::Any queryDeepInterface(
- const ::com::sun::star::uno::Type & rType,
- Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5 )
-{
- if (isDerivedFrom(rType, Interface1::static_type()))
- return ::com::sun::star::uno::Any( &p1, rType );
- else if (isDerivedFrom(rType, Interface2::static_type()))
- return ::com::sun::star::uno::Any( &p2, rType );
- else if (isDerivedFrom(rType, Interface3::static_type()))
- return ::com::sun::star::uno::Any( &p3, rType );
- else if (isDerivedFrom(rType, Interface4::static_type()))
- return ::com::sun::star::uno::Any( &p4, rType );
- else if (isDerivedFrom(rType, Interface5::static_type()))
- return ::com::sun::star::uno::Any( &p5, rType );
- else
- return ::com::sun::star::uno::Any();
-}
-
-/**
- * Inspect types and choose return proper interface.
- *<BR>
- * @param p1 a pointer to an interface.
- * @param p2 a pointer to an interface.
- * @param p3 a pointer to an interface.
- * @param p4 a pointer to an interface.
- * @param p5 a pointer to an interface.
- * @param p6 a pointer to an interface.
- */
-template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
- class Interface6 >
-inline ::com::sun::star::uno::Any queryDeepInterface(
- const ::com::sun::star::uno::Type & rType,
- Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
- Interface6 * p6 )
-{
- if (isDerivedFrom(rType, Interface1::static_type()))
- return ::com::sun::star::uno::Any( &p1, rType );
- else if (isDerivedFrom(rType, Interface2::static_type()))
- return ::com::sun::star::uno::Any( &p2, rType );
- else if (isDerivedFrom(rType, Interface3::static_type()))
- return ::com::sun::star::uno::Any( &p3, rType );
- else if (isDerivedFrom(rType, Interface4::static_type()))
- return ::com::sun::star::uno::Any( &p4, rType );
- else if (isDerivedFrom(rType, Interface5::static_type()))
- return ::com::sun::star::uno::Any( &p5, rType );
- else if (isDerivedFrom(rType, Interface6::static_type()))
- return ::com::sun::star::uno::Any( &p6, rType );
- else
- return ::com::sun::star::uno::Any();
-}
-
-/**
- * Inspect types and choose return proper interface.
- *<BR>
- * @param p1 a pointer to an interface.
- * @param p2 a pointer to an interface.
- * @param p3 a pointer to an interface.
- * @param p4 a pointer to an interface.
- * @param p5 a pointer to an interface.
- * @param p6 a pointer to an interface.
- * @param p7 a pointer to an interface.
- */
-template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
- class Interface6, class Interface7 >
-inline ::com::sun::star::uno::Any queryDeepInterface(
- const ::com::sun::star::uno::Type & rType,
- Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
- Interface6 * p6, Interface7 * p7 )
-{
- if (isDerivedFrom(rType, Interface1::static_type()))
- return ::com::sun::star::uno::Any( &p1, rType );
- else if (isDerivedFrom(rType, Interface2::static_type()))
- return ::com::sun::star::uno::Any( &p2, rType );
- else if (isDerivedFrom(rType, Interface3::static_type()))
- return ::com::sun::star::uno::Any( &p3, rType );
- else if (isDerivedFrom(rType, Interface4::static_type()))
- return ::com::sun::star::uno::Any( &p4, rType );
- else if (isDerivedFrom(rType, Interface5::static_type()))
- return ::com::sun::star::uno::Any( &p5, rType );
- else if (isDerivedFrom(rType, Interface6::static_type()))
- return ::com::sun::star::uno::Any( &p6, rType );
- else if (isDerivedFrom(rType, Interface7::static_type()))
- return ::com::sun::star::uno::Any( &p7, rType );
- else
- return ::com::sun::star::uno::Any();
-}
-
-/**
- * Inspect types and choose return proper interface.
- *<BR>
- * @param p1 a pointer to an interface.
- * @param p2 a pointer to an interface.
- * @param p3 a pointer to an interface.
- * @param p4 a pointer to an interface.
- * @param p5 a pointer to an interface.
- * @param p6 a pointer to an interface.
- * @param p7 a pointer to an interface.
- * @param p8 a pointer to an interface.
- */
-template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
- class Interface6, class Interface7, class Interface8 >
-inline ::com::sun::star::uno::Any queryDeepInterface(
- const ::com::sun::star::uno::Type & rType,
- Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
- Interface6 * p6, Interface7 * p7, Interface8 * p8 )
-{
- if (isDerivedFrom(rType, Interface1::static_type()))
- return ::com::sun::star::uno::Any( &p1, rType );
- else if (isDerivedFrom(rType, Interface2::static_type()))
- return ::com::sun::star::uno::Any( &p2, rType );
- else if (isDerivedFrom(rType, Interface3::static_type()))
- return ::com::sun::star::uno::Any( &p3, rType );
- else if (isDerivedFrom(rType, Interface4::static_type()))
- return ::com::sun::star::uno::Any( &p4, rType );
- else if (isDerivedFrom(rType, Interface5::static_type()))
- return ::com::sun::star::uno::Any( &p5, rType );
- else if (isDerivedFrom(rType, Interface6::static_type()))
- return ::com::sun::star::uno::Any( &p6, rType );
- else if (isDerivedFrom(rType, Interface7::static_type()))
- return ::com::sun::star::uno::Any( &p7, rType );
- else if (isDerivedFrom(rType, Interface8::static_type()))
- return ::com::sun::star::uno::Any( &p8, rType );
- else
- return ::com::sun::star::uno::Any();
-}
-
-/**
- * Inspect types and choose return proper interface.
- *<BR>
- * @param p1 a pointer to an interface.
- * @param p2 a pointer to an interface.
- * @param p3 a pointer to an interface.
- * @param p4 a pointer to an interface.
- * @param p5 a pointer to an interface.
- * @param p6 a pointer to an interface.
- * @param p7 a pointer to an interface.
- * @param p8 a pointer to an interface.
- * @param p9 a pointer to an interface.
- */
-template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
- class Interface6, class Interface7, class Interface8, class Interface9 >
-inline ::com::sun::star::uno::Any queryDeepInterface(
- const ::com::sun::star::uno::Type & rType,
- Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
- Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9 )
-{
- if (isDerivedFrom(rType, Interface1::static_type()))
- return ::com::sun::star::uno::Any( &p1, rType );
- else if (isDerivedFrom(rType, Interface2::static_type()))
- return ::com::sun::star::uno::Any( &p2, rType );
- else if (isDerivedFrom(rType, Interface3::static_type()))
- return ::com::sun::star::uno::Any( &p3, rType );
- else if (isDerivedFrom(rType, Interface4::static_type()))
- return ::com::sun::star::uno::Any( &p4, rType );
- else if (isDerivedFrom(rType, Interface5::static_type()))
- return ::com::sun::star::uno::Any( &p5, rType );
- else if (isDerivedFrom(rType, Interface6::static_type()))
- return ::com::sun::star::uno::Any( &p6, rType );
- else if (isDerivedFrom(rType, Interface7::static_type()))
- return ::com::sun::star::uno::Any( &p7, rType );
- else if (isDerivedFrom(rType, Interface8::static_type()))
- return ::com::sun::star::uno::Any( &p8, rType );
- else if (isDerivedFrom(rType, Interface9::static_type()))
- return ::com::sun::star::uno::Any( &p9, rType );
- else
- return ::com::sun::star::uno::Any();
-}
-
-/**
- * Inspect types and choose return proper interface.
- *<BR>
- * @param p1 a pointer to an interface.
- * @param p2 a pointer to an interface.
- * @param p3 a pointer to an interface.
- * @param p4 a pointer to an interface.
- * @param p5 a pointer to an interface.
- * @param p6 a pointer to an interface.
- * @param p7 a pointer to an interface.
- * @param p8 a pointer to an interface.
- * @param p9 a pointer to an interface.
- * @param p10 a pointer to an interface.
- */
-template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
- class Interface6, class Interface7, class Interface8, class Interface9, class Interface10 >
-inline ::com::sun::star::uno::Any queryDeepInterface(
- const ::com::sun::star::uno::Type & rType,
- Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
- Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10 )
-{
- if (isDerivedFrom(rType, Interface1::static_type()))
- return ::com::sun::star::uno::Any( &p1, rType );
- else if (isDerivedFrom(rType, Interface2::static_type()))
- return ::com::sun::star::uno::Any( &p2, rType );
- else if (isDerivedFrom(rType, Interface3::static_type()))
- return ::com::sun::star::uno::Any( &p3, rType );
- else if (isDerivedFrom(rType, Interface4::static_type()))
- return ::com::sun::star::uno::Any( &p4, rType );
- else if (isDerivedFrom(rType, Interface5::static_type()))
- return ::com::sun::star::uno::Any( &p5, rType );
- else if (isDerivedFrom(rType, Interface6::static_type()))
- return ::com::sun::star::uno::Any( &p6, rType );
- else if (isDerivedFrom(rType, Interface7::static_type()))
- return ::com::sun::star::uno::Any( &p7, rType );
- else if (isDerivedFrom(rType, Interface8::static_type()))
- return ::com::sun::star::uno::Any( &p8, rType );
- else if (isDerivedFrom(rType, Interface9::static_type()))
- return ::com::sun::star::uno::Any( &p9, rType );
- else if (isDerivedFrom(rType, Interface10::static_type()))
- return ::com::sun::star::uno::Any( &p10, rType );
- else
- return ::com::sun::star::uno::Any();
-}
-
-/**
- * Inspect types and choose return proper interface.
- *<BR>
- * @param p1 a pointer to an interface.
- * @param p2 a pointer to an interface.
- * @param p3 a pointer to an interface.
- * @param p4 a pointer to an interface.
- * @param p5 a pointer to an interface.
- * @param p6 a pointer to an interface.
- * @param p7 a pointer to an interface.
- * @param p8 a pointer to an interface.
- * @param p9 a pointer to an interface.
- * @param p10 a pointer to an interface.
- * @param p11 a pointer to an interface.
- */
-template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
- class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
- class Interface11 >
-inline ::com::sun::star::uno::Any queryDeepInterface(
- const ::com::sun::star::uno::Type & rType,
- Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
- Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
- Interface11 * p11 )
-{
- if (isDerivedFrom(rType, Interface1::static_type()))
- return ::com::sun::star::uno::Any( &p1, rType );
- else if (isDerivedFrom(rType, Interface2::static_type()))
- return ::com::sun::star::uno::Any( &p2, rType );
- else if (isDerivedFrom(rType, Interface3::static_type()))
- return ::com::sun::star::uno::Any( &p3, rType );
- else if (isDerivedFrom(rType, Interface4::static_type()))
- return ::com::sun::star::uno::Any( &p4, rType );
- else if (isDerivedFrom(rType, Interface5::static_type()))
- return ::com::sun::star::uno::Any( &p5, rType );
- else if (isDerivedFrom(rType, Interface6::static_type()))
- return ::com::sun::star::uno::Any( &p6, rType );
- else if (isDerivedFrom(rType, Interface7::static_type()))
- return ::com::sun::star::uno::Any( &p7, rType );
- else if (isDerivedFrom(rType, Interface8::static_type()))
- return ::com::sun::star::uno::Any( &p8, rType );
- else if (isDerivedFrom(rType, Interface9::static_type()))
- return ::com::sun::star::uno::Any( &p9, rType );
- else if (isDerivedFrom(rType, Interface10::static_type()))
- return ::com::sun::star::uno::Any( &p10, rType );
- else if (isDerivedFrom(rType, Interface11::static_type()))
- return ::com::sun::star::uno::Any( &p11, rType );
- else
- return ::com::sun::star::uno::Any();
-}
-
-/**
- * Inspect types and choose return proper interface.
- *<BR>
- * @param p1 a pointer to an interface.
- * @param p2 a pointer to an interface.
- * @param p3 a pointer to an interface.
- * @param p4 a pointer to an interface.
- * @param p5 a pointer to an interface.
- * @param p6 a pointer to an interface.
- * @param p7 a pointer to an interface.
- * @param p8 a pointer to an interface.
- * @param p9 a pointer to an interface.
- * @param p10 a pointer to an interface.
- * @param p11 a pointer to an interface.
- * @param p12 a pointer to an interface.
- */
-template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
- class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
- class Interface11, class Interface12 >
-inline ::com::sun::star::uno::Any queryDeepInterface(
- const ::com::sun::star::uno::Type & rType,
- Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
- Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
- Interface11 * p11, Interface12 * p12 )
-{
- if (isDerivedFrom(rType, Interface1::static_type()))
- return ::com::sun::star::uno::Any( &p1, rType );
- else if (isDerivedFrom(rType, Interface2::static_type()))
- return ::com::sun::star::uno::Any( &p2, rType );
- else if (isDerivedFrom(rType, Interface3::static_type()))
- return ::com::sun::star::uno::Any( &p3, rType );
- else if (isDerivedFrom(rType, Interface4::static_type()))
- return ::com::sun::star::uno::Any( &p4, rType );
- else if (isDerivedFrom(rType, Interface5::static_type()))
- return ::com::sun::star::uno::Any( &p5, rType );
- else if (isDerivedFrom(rType, Interface6::static_type()))
- return ::com::sun::star::uno::Any( &p6, rType );
- else if (isDerivedFrom(rType, Interface7::static_type()))
- return ::com::sun::star::uno::Any( &p7, rType );
- else if (isDerivedFrom(rType, Interface8::static_type()))
- return ::com::sun::star::uno::Any( &p8, rType );
- else if (isDerivedFrom(rType, Interface9::static_type()))
- return ::com::sun::star::uno::Any( &p9, rType );
- else if (isDerivedFrom(rType, Interface10::static_type()))
- return ::com::sun::star::uno::Any( &p10, rType );
- else if (isDerivedFrom(rType, Interface11::static_type()))
- return ::com::sun::star::uno::Any( &p11, rType );
- else if (isDerivedFrom(rType, Interface12::static_type()))
- return ::com::sun::star::uno::Any( &p12, rType );
- else
- return ::com::sun::star::uno::Any();
-}
-
-} // namespace comphelper
-
-#endif // _COMPHELPER_QUERYDEEPINTERFACE_HXX
-
diff --git a/comphelper/inc/comphelper/scopeguard.hxx b/comphelper/inc/comphelper/scopeguard.hxx
index 4841a564ae61..1fdd179404a2 100644
--- a/comphelper/inc/comphelper/scopeguard.hxx
+++ b/comphelper/inc/comphelper/scopeguard.hxx
@@ -33,6 +33,7 @@
#endif
#include "boost/function.hpp"
#include "boost/noncopyable.hpp"
+#include "boost/bind.hpp"
namespace comphelper {
@@ -66,6 +67,21 @@ private:
exc_handling const m_excHandling;
};
+class COMPHELPER_DLLPUBLIC FlagGuard : ScopeGuard
+{
+public:
+ explicit FlagGuard( bool& i_flagRef, exc_handling i_excHandling = IGNORE_EXCEPTIONS )
+ :ScopeGuard( ::boost::bind( ResetFlag, ::boost::ref( i_flagRef ) ), i_excHandling )
+ {
+ }
+
+private:
+ static void ResetFlag( bool& i_flagRef )
+ {
+ i_flagRef = false;
+ }
+};
+
} // namespace comphelper
#endif // ! defined(INCLUDED_COMPHELPER_SCOPEGUARD_HXX)
diff --git a/comphelper/inc/comphelper/servicedecl.hxx b/comphelper/inc/comphelper/servicedecl.hxx
index adf120b3bae2..5ea7972e29a2 100644
--- a/comphelper/inc/comphelper/servicedecl.hxx
+++ b/comphelper/inc/comphelper/servicedecl.hxx
@@ -67,7 +67,7 @@ typedef ::boost::function3<
The declaration can be done in various ways, the (simplest) form is
<pre>
- class MyClass : cppu::WeakImplHelper2<XInterface1, XInterface2> {
+ class MyClass : public cppu::WeakImplHelper2<XInterface1, XInterface2> {
public:
MyClass( uno::Reference<uno::XComponentContext> const& xContext )
[...]
@@ -85,7 +85,7 @@ typedef ::boost::function3<
context:
<pre>
- class MyClass : cppu::WeakImplHelper2<XInterface1, XInterface2> {
+ class MyClass : public cppu::WeakImplHelper2<XInterface1, XInterface2> {
public:
MyClass( uno::Sequence<uno::Any> const& args,
uno::Reference<uno:XComponentContext> const& xContext )
diff --git a/comphelper/source/misc/makefile.mk b/comphelper/source/misc/makefile.mk
index cecba554b332..0bb4defb4165 100644
--- a/comphelper/source/misc/makefile.mk
+++ b/comphelper/source/misc/makefile.mk
@@ -74,7 +74,6 @@ SLOFILES= \
$(SLO)$/officeresourcebundle.obj \
$(SLO)$/officerestartmanager.obj \
$(SLO)$/proxyaggregation.obj \
- $(SLO)$/querydeep.obj \
$(SLO)$/regpathhelper.obj \
$(SLO)$/scopeguard.obj \
$(SLO)$/SelectionMultiplex.obj \
diff --git a/comphelper/source/misc/namedvaluecollection.cxx b/comphelper/source/misc/namedvaluecollection.cxx
index 8bab7fa3d7c7..566e5526019c 100644
--- a/comphelper/source/misc/namedvaluecollection.cxx
+++ b/comphelper/source/misc/namedvaluecollection.cxx
@@ -99,21 +99,7 @@ namespace comphelper
NamedValueCollection::NamedValueCollection( const Any& _rElements )
:m_pImpl( new NamedValueCollection_Impl )
{
- Sequence< NamedValue > aNamedValues;
- Sequence< PropertyValue > aPropertyValues;
- NamedValue aNamedValue;
- PropertyValue aPropertyValue;
-
- if ( _rElements >>= aNamedValues )
- impl_assign( aNamedValues );
- else if ( _rElements >>= aPropertyValues )
- impl_assign( aPropertyValues );
- else if ( _rElements >>= aNamedValue )
- impl_assign( Sequence< NamedValue >( &aNamedValue, 1 ) );
- else if ( _rElements >>= aPropertyValue )
- impl_assign( Sequence< PropertyValue >( &aPropertyValue, 1 ) );
- else
- OSL_ENSURE( !_rElements.hasValue(), "NamedValueCollection::NamedValueCollection(Any): unsupported type!" );
+ impl_assign( _rElements );
}
//--------------------------------------------------------------------
@@ -170,6 +156,39 @@ namespace comphelper
}
//--------------------------------------------------------------------
+ ::std::vector< ::rtl::OUString > NamedValueCollection::getNames() const
+ {
+ ::std::vector< ::rtl::OUString > aNames( m_pImpl->aValues.size() );
+ ::std::transform(
+ m_pImpl->aValues.begin(),
+ m_pImpl->aValues.end(),
+ aNames.begin(),
+ ::std::select1st< NamedValueRepository::value_type >()
+ );
+ return aNames;
+ }
+
+ //--------------------------------------------------------------------
+ void NamedValueCollection::impl_assign( const Any& i_rWrappedElements )
+ {
+ Sequence< NamedValue > aNamedValues;
+ Sequence< PropertyValue > aPropertyValues;
+ NamedValue aNamedValue;
+ PropertyValue aPropertyValue;
+
+ if ( i_rWrappedElements >>= aNamedValues )
+ impl_assign( aNamedValues );
+ else if ( i_rWrappedElements >>= aPropertyValues )
+ impl_assign( aPropertyValues );
+ else if ( i_rWrappedElements >>= aNamedValue )
+ impl_assign( Sequence< NamedValue >( &aNamedValue, 1 ) );
+ else if ( i_rWrappedElements >>= aPropertyValue )
+ impl_assign( Sequence< PropertyValue >( &aPropertyValue, 1 ) );
+ else
+ OSL_ENSURE( !i_rWrappedElements.hasValue(), "NamedValueCollection::impl_assign(Any): unsupported type!" );
+ }
+
+ //--------------------------------------------------------------------
void NamedValueCollection::impl_assign( const Sequence< Any >& _rArguments )
{
{
diff --git a/comphelper/source/misc/querydeep.cxx b/comphelper/source/misc/querydeep.cxx
deleted file mode 100644
index 92e475686783..000000000000
--- a/comphelper/source/misc/querydeep.cxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_comphelper.hxx"
-#include <comphelper/querydeep.hxx>
-#include <typelib/typedescription.h>
-
-//__________________________________________________________________________________________________
-
-sal_Bool comphelper::isDerivedFrom(
- const ::com::sun::star::uno::Type & rBaseType,
- const ::com::sun::star::uno::Type & rType )
-{
- using namespace ::com::sun::star::uno;
-
- TypeClass eClass = rBaseType.getTypeClass();
-
- if (eClass != TypeClass_INTERFACE)
- return sal_False;
-
- // supported TypeClass - do the types match ?
- if (eClass != rType.getTypeClass())
- return sal_False;
-
- sal_Bool bRet;
-
- // shortcut for simple case
- if (rBaseType == ::getCppuType(static_cast<const Reference< XInterface > *>(0)))
- {
- bRet = sal_True;
- }
- else
- {
- // now ask in cppu (aka typelib)
- ::typelib_TypeDescription *pBaseTD = 0, *pTD = 0;
-
- rBaseType. getDescription(&pBaseTD);
- rType. getDescription(&pTD);
-
- // interfaces are assignable to a base
- bRet = ::typelib_typedescription_isAssignableFrom(pBaseTD, pTD);
-
- ::typelib_typedescription_release(pBaseTD);
- ::typelib_typedescription_release(pTD);
- }
-
- return bRet;
-}
-
-
-
diff --git a/comphelper/source/property/propagg.cxx b/comphelper/source/property/propagg.cxx
index e796c29eba90..9c2fd868d973 100644
--- a/comphelper/source/property/propagg.cxx
+++ b/comphelper/source/property/propagg.cxx
@@ -87,20 +87,36 @@ OPropertyArrayAggregationHelper::OPropertyArrayAggregationHelper(
const Property* pDelegateProps = _rProperties.getConstArray();
Property* pMergedProps = m_aProperties.getArray();
+ // if properties are present both at the delegatee and the aggregate, then the former are supposed to win.
+ // So, we'll need an existence check.
+ ::std::set< ::rtl::OUString > aDelegatorProps;
+
// create the map for the delegator properties
sal_Int32 nMPLoop = 0;
for ( ; nMPLoop < nDelegatorProps; ++nMPLoop, ++pDelegateProps )
+ {
m_aPropertyAccessors[ pDelegateProps->Handle ] = OPropertyAccessor( -1, nMPLoop, sal_False );
+ OSL_ENSURE( aDelegatorProps.find( pDelegateProps->Name ) == aDelegatorProps.end(),
+ "OPropertyArrayAggregationHelper::OPropertyArrayAggregationHelper: duplicate delegatee property!" );
+ aDelegatorProps.insert( pDelegateProps->Name );
+ }
// create the map for the aggregate properties
sal_Int32 nAggregateHandle = _nFirstAggregateId;
pMergedProps += nDelegatorProps;
- for ( ; nMPLoop < nMergedProps; ++nMPLoop, ++pMergedProps, ++pAggregateProps )
+ for ( ; nMPLoop < nMergedProps; ++pAggregateProps )
{
+ // if the aggregate property is present at the delegatee already, ignore it
+ if ( aDelegatorProps.find( pAggregateProps->Name ) != aDelegatorProps.end() )
+ {
+ --nMergedProps;
+ continue;
+ }
+
// next aggregate property - remember it
*pMergedProps = *pAggregateProps;
- // determine the handle for the property which we will expose to the ourside world
+ // determine the handle for the property which we will expose to the outside world
sal_Int32 nHandle = -1;
// ask the infor service first
if ( _pInfoService )
@@ -123,7 +139,11 @@ OPropertyArrayAggregationHelper::OPropertyArrayAggregationHelper(
// remember the accessor for this property
m_aPropertyAccessors[ nHandle ] = OPropertyAccessor( pMergedProps->Handle, nMPLoop, sal_True );
pMergedProps->Handle = nHandle;
+
+ ++nMPLoop;
+ ++pMergedProps;
}
+ m_aProperties.realloc( nMergedProps );
pMergedProps = m_aProperties.getArray(); // reset, needed again below
// sortieren der Properties nach Namen
diff --git a/cppcanvas/inc/cppcanvas/renderer.hxx b/cppcanvas/inc/cppcanvas/renderer.hxx
index 780a27f31503..0b8bb43d7e3e 100644
--- a/cppcanvas/inc/cppcanvas/renderer.hxx
+++ b/cppcanvas/inc/cppcanvas/renderer.hxx
@@ -32,7 +32,7 @@
#include <rtl/ustring.hxx>
#include <boost/shared_ptr.hpp>
-#include <comphelper/optionalvalue.hxx>
+#include <boost/optional.hpp>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <cppcanvas/canvasgraphic.hxx>
#include <cppcanvas/color.hxx>
@@ -109,16 +109,16 @@ namespace cppcanvas
struct Parameters
{
/// Optionally forces the fill color attribute for all actions
- ::comphelper::OptionalValue< Color::IntSRGBA > maFillColor;
+ ::boost::optional< Color::IntSRGBA > maFillColor;
/// Optionally forces the line color attribute for all actions
- ::comphelper::OptionalValue< Color::IntSRGBA > maLineColor;
+ ::boost::optional< Color::IntSRGBA > maLineColor;
/// Optionally forces the text color attribute for all actions
- ::comphelper::OptionalValue< Color::IntSRGBA > maTextColor;
+ ::boost::optional< Color::IntSRGBA > maTextColor;
/// Optionally forces the given fontname for all text actions
- ::comphelper::OptionalValue< ::rtl::OUString > maFontName;
+ ::boost::optional< ::rtl::OUString > maFontName;
/** Optionally transforms all text output actions with the
given matrix (in addition to the overall canvas
@@ -128,16 +128,16 @@ namespace cppcanvas
rect coordinate system, i.e. the metafile is assumed
to be contained in the unit rect.
*/
- ::comphelper::OptionalValue< ::basegfx::B2DHomMatrix > maTextTransformation;
+ ::boost::optional< ::basegfx::B2DHomMatrix > maTextTransformation;
/// Optionally forces the given font weight for all text actions
- ::comphelper::OptionalValue< sal_Int8 > maFontWeight;
+ ::boost::optional< sal_Int8 > maFontWeight;
/// Optionally forces the given font letter form (italics etc.) for all text actions
- ::comphelper::OptionalValue< sal_Int8 > maFontLetterForm;
+ ::boost::optional< sal_Int8 > maFontLetterForm;
/// Optionally forces underlining for all text actions
- ::comphelper::OptionalValue< bool > maFontUnderline;
+ ::boost::optional< bool > maFontUnderline;
};
};
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 1423cd42ed93..006d55a01de6 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -831,8 +831,8 @@ namespace cppcanvas
{
rendering::FontRequest aFontRequest;
- if( rParms.mrParms.maFontName.isValid() )
- aFontRequest.FontDescription.FamilyName = rParms.mrParms.maFontName.getValue();
+ if( rParms.mrParms.maFontName.is_initialized() )
+ aFontRequest.FontDescription.FamilyName = *rParms.mrParms.maFontName;
else
aFontRequest.FontDescription.FamilyName = rFont.GetName();
@@ -843,12 +843,12 @@ namespace cppcanvas
// TODO(F2): improve vclenum->panose conversion
aFontRequest.FontDescription.FontDescription.Weight =
- rParms.mrParms.maFontWeight.isValid() ?
- rParms.mrParms.maFontWeight.getValue() :
+ rParms.mrParms.maFontWeight.is_initialized() ?
+ *rParms.mrParms.maFontWeight :
::canvas::tools::numeric_cast<sal_Int8>( ::basegfx::fround( rFont.GetWeight() ) );
aFontRequest.FontDescription.FontDescription.Letterform =
- rParms.mrParms.maFontLetterForm.isValid() ?
- rParms.mrParms.maFontLetterForm.getValue() :
+ rParms.mrParms.maFontLetterForm.is_initialized() ?
+ *rParms.mrParms.maFontLetterForm :
(rFont.GetItalic() == ITALIC_NONE) ? 0 : 9;
LanguageType aLang = rFont.GetLanguage();
@@ -1445,7 +1445,7 @@ namespace cppcanvas
break;
case META_LINECOLOR_ACTION:
- if( !rParms.maLineColor.isValid() )
+ if( !rParms.maLineColor.is_initialized() )
{
setStateColor( static_cast<MetaLineColorAction*>(pCurrAct),
getState( rStates ).isLineColorSet,
@@ -1455,7 +1455,7 @@ namespace cppcanvas
break;
case META_FILLCOLOR_ACTION:
- if( !rParms.maFillColor.isValid() )
+ if( !rParms.maFillColor.is_initialized() )
{
setStateColor( static_cast<MetaFillColorAction*>(pCurrAct),
getState( rStates ).isFillColorSet,
@@ -1466,7 +1466,7 @@ namespace cppcanvas
case META_TEXTCOLOR_ACTION:
{
- if( !rParms.maTextColor.isValid() )
+ if( !rParms.maTextColor.is_initialized() )
{
// Text color is set unconditionally, thus, no
// use of setStateColor here
@@ -1486,7 +1486,7 @@ namespace cppcanvas
break;
case META_TEXTFILLCOLOR_ACTION:
- if( !rParms.maTextColor.isValid() )
+ if( !rParms.maTextColor.is_initialized() )
{
setStateColor( static_cast<MetaTextFillColorAction*>(pCurrAct),
getState( rStates ).isTextFillColorSet,
@@ -1496,7 +1496,7 @@ namespace cppcanvas
break;
case META_TEXTLINECOLOR_ACTION:
- if( !rParms.maTextColor.isValid() )
+ if( !rParms.maTextColor.is_initialized() )
{
setStateColor( static_cast<MetaTextLineColorAction*>(pCurrAct),
getState( rStates ).isTextLineColorSet,
@@ -1526,8 +1526,8 @@ namespace cppcanvas
// TODO(Q2): define and use appropriate enumeration types
rState.textReliefStyle = (sal_Int8)rFont.GetRelief();
rState.textOverlineStyle = (sal_Int8)rFont.GetOverline();
- rState.textUnderlineStyle = rParms.maFontUnderline.isValid() ?
- (rParms.maFontUnderline.getValue() ? (sal_Int8)UNDERLINE_SINGLE : (sal_Int8)UNDERLINE_NONE) :
+ rState.textUnderlineStyle = rParms.maFontUnderline.is_initialized() ?
+ (*rParms.maFontUnderline ? (sal_Int8)UNDERLINE_SINGLE : (sal_Int8)UNDERLINE_NONE) :
(sal_Int8)rFont.GetUnderline();
rState.textStrikeoutStyle = (sal_Int8)rFont.GetStrikeout();
rState.textEmphasisMarkStyle = (sal_Int8)rFont.GetEmphasisMark();
@@ -2946,28 +2946,28 @@ namespace cppcanvas
getState( aStateStack ).textLineColor = pColor->getDeviceColor( 0x000000FF );
// apply overrides from the Parameters struct
- if( rParams.maFillColor.isValid() )
+ if( rParams.maFillColor.is_initialized() )
{
getState( aStateStack ).isFillColorSet = true;
- getState( aStateStack ).fillColor = pColor->getDeviceColor( rParams.maFillColor.getValue() );
+ getState( aStateStack ).fillColor = pColor->getDeviceColor( *rParams.maFillColor );
}
- if( rParams.maLineColor.isValid() )
+ if( rParams.maLineColor.is_initialized() )
{
getState( aStateStack ).isLineColorSet = true;
- getState( aStateStack ).lineColor = pColor->getDeviceColor( rParams.maLineColor.getValue() );
+ getState( aStateStack ).lineColor = pColor->getDeviceColor( *rParams.maLineColor );
}
- if( rParams.maTextColor.isValid() )
+ if( rParams.maTextColor.is_initialized() )
{
getState( aStateStack ).isTextFillColorSet = true;
getState( aStateStack ).isTextLineColorSet = true;
getState( aStateStack ).textColor =
getState( aStateStack ).textFillColor =
- getState( aStateStack ).textLineColor = pColor->getDeviceColor( rParams.maTextColor.getValue() );
+ getState( aStateStack ).textLineColor = pColor->getDeviceColor( *rParams.maTextColor );
}
- if( rParams.maFontName.isValid() ||
- rParams.maFontWeight.isValid() ||
- rParams.maFontLetterForm.isValid() ||
- rParams.maFontUnderline.isValid() )
+ if( rParams.maFontName.is_initialized() ||
+ rParams.maFontWeight.is_initialized() ||
+ rParams.maFontLetterForm.is_initialized() ||
+ rParams.maFontUnderline.is_initialized() )
{
::cppcanvas::internal::OutDevState& rState = getState( aStateStack );
diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx
index bc4cf6688ca3..56ce197b7e8e 100644
--- a/cppcanvas/source/mtfrenderer/textaction.cxx
+++ b/cppcanvas/source/mtfrenderer/textaction.cxx
@@ -2069,7 +2069,7 @@ namespace cppcanvas
rCanvas->getUNOCanvas()->getDevice(),
aResultingPolyPolygon ) );
- if( rParms.maTextTransformation.isValid() )
+ if( rParms.maTextTransformation.is_initialized() )
{
return ActionSharedPtr(
new OutlineAction(
@@ -2085,7 +2085,7 @@ namespace cppcanvas
rVDev,
rCanvas,
rState,
- rParms.maTextTransformation.getValue() ) );
+ *rParms.maTextTransformation ) );
}
else
{
@@ -2186,7 +2186,7 @@ namespace cppcanvas
rShadowColor == aEmptyColor )
{
// nope
- if( rParms.maTextTransformation.isValid() )
+ if( rParms.maTextTransformation.is_initialized() )
{
return ActionSharedPtr( new TextAction(
aStartPoint,
@@ -2195,7 +2195,7 @@ namespace cppcanvas
nLen,
rCanvas,
rState,
- rParms.maTextTransformation.getValue() ) );
+ *rParms.maTextTransformation ) );
}
else
{
@@ -2211,7 +2211,7 @@ namespace cppcanvas
else
{
// at least one of the effects requested
- if( rParms.maTextTransformation.isValid() )
+ if( rParms.maTextTransformation.is_initialized() )
return ActionSharedPtr( new EffectTextAction(
aStartPoint,
aReliefOffset,
@@ -2224,7 +2224,7 @@ namespace cppcanvas
rVDev,
rCanvas,
rState,
- rParms.maTextTransformation.getValue() ) );
+ *rParms.maTextTransformation ) );
else
return ActionSharedPtr( new EffectTextAction(
aStartPoint,
@@ -2250,7 +2250,7 @@ namespace cppcanvas
rShadowColor == aEmptyColor )
{
// nope
- if( rParms.maTextTransformation.isValid() )
+ if( rParms.maTextTransformation.is_initialized() )
return ActionSharedPtr( new TextArrayAction(
aStartPoint,
rText,
@@ -2259,7 +2259,7 @@ namespace cppcanvas
aCharWidths,
rCanvas,
rState,
- rParms.maTextTransformation.getValue() ) );
+ *rParms.maTextTransformation ) );
else
return ActionSharedPtr( new TextArrayAction(
aStartPoint,
@@ -2273,7 +2273,7 @@ namespace cppcanvas
else
{
// at least one of the effects requested
- if( rParms.maTextTransformation.isValid() )
+ if( rParms.maTextTransformation.is_initialized() )
return ActionSharedPtr( new EffectTextArrayAction(
aStartPoint,
aReliefOffset,
@@ -2287,7 +2287,7 @@ namespace cppcanvas
rVDev,
rCanvas,
rState,
- rParms.maTextTransformation.getValue() ) );
+ *rParms.maTextTransformation ) );
else
return ActionSharedPtr( new EffectTextArrayAction(
aStartPoint,
diff --git a/svtools/inc/svtools/svicnvw.hxx b/svtools/inc/svtools/svicnvw.hxx
index ac15f0b55be6..68a76d25e108 100644
--- a/svtools/inc/svtools/svicnvw.hxx
+++ b/svtools/inc/svtools/svicnvw.hxx
@@ -89,7 +89,6 @@ class SvIconView : public SvLBox
SvImpIconView* pImp;
Image aCollapsedEntryBmp;
Image aExpandedEntryBmp;
- WinBits nWinBits;
USHORT nIcnVwFlags;
void SetModel( SvLBoxTreeList* );
@@ -111,6 +110,7 @@ protected:
virtual void ReadDragServerInfo( const Point&, SvLBoxDDInfo* );
virtual void Command( const CommandEvent& rCEvt );
virtual void PreparePaint( SvLBoxEntry* );
+ virtual void StateChanged( StateChangedType nStateChange );
public:
@@ -203,7 +203,6 @@ public:
SvLBoxEntry* GetEntryFromLogicPos( const Point& rDocPos ) const;
- void SetWindowBits( WinBits nWinStyle );
virtual void PaintEntry( SvLBoxEntry* );
virtual void PaintEntry( SvLBoxEntry*, const Point& rDocPos );
Rectangle GetFocusRect( SvLBoxEntry* );
diff --git a/svtools/inc/svtools/svlbox.hxx b/svtools/inc/svtools/svlbox.hxx
index f33784f45397..95fbd9f014d1 100644
--- a/svtools/inc/svtools/svlbox.hxx
+++ b/svtools/inc/svtools/svlbox.hxx
@@ -47,6 +47,7 @@
#include <vcl/accel.hxx>
#endif
#include <vcl/mnemonicengine.hxx>
+#include <vcl/quickselectionengine.hxx>
#include <tools/gen.hxx>
#include <svtools/treelist.hxx>
#include <svl/svarray.hxx>
@@ -253,10 +254,12 @@ DECLARE_SVTREELIST(SvLBoxTreeList, SvLBoxEntry*)
class SvLBox;
struct SvLBox_Impl
{
- bool m_bIsEmptyTextAllowed;
- bool m_bEntryMnemonicsEnabled;
- Link* m_pLink;
- ::vcl::MnemonicEngine m_aMnemonicEngine;
+ bool m_bIsEmptyTextAllowed;
+ bool m_bEntryMnemonicsEnabled;
+ bool m_bDoingQuickSelection;
+ Link* m_pLink;
+ ::vcl::MnemonicEngine m_aMnemonicEngine;
+ ::vcl::QuickSelectionEngine m_aQuickSelectionEngine;
SvLBox_Impl( SvLBox& _rBox );
};
@@ -267,6 +270,7 @@ class SVT_DLLPUBLIC SvLBox
,public DropTargetHelper
,public DragSourceHelper
,public ::vcl::IMnemonicEntryList
+ ,public ::vcl::ISearchableStringList
{
friend class SvLBoxEntry;
@@ -290,7 +294,6 @@ class SVT_DLLPUBLIC SvLBox
protected:
- WinBits nWindowStyle;
Link aExpandedHdl;
Link aExpandingHdl;
Link aSelectHdl;
@@ -376,11 +379,18 @@ protected:
// for asynchronous D&D
sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, SvLBox* pSourceView );
- // IMnemonicEntryList
- virtual const void* FirstSearchEntry( String& _rEntryText );
- virtual const void* NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText );
- virtual void SelectSearchEntry( const void* _pEntry );
- virtual void ExecuteSearchEntry( const void* _pEntry );
+ void OnCurrentEntryChanged();
+
+ // IMnemonicEntryList
+ virtual const void* FirstSearchEntry( String& _rEntryText ) const;
+ virtual const void* NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) const;
+ virtual void SelectSearchEntry( const void* _pEntry );
+ virtual void ExecuteSearchEntry( const void* _pEntry ) const;
+
+ // 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 );
public:
diff --git a/svtools/inc/svtools/svtreebx.hxx b/svtools/inc/svtools/svtreebx.hxx
index 787e0956888f..79402cb13f23 100644
--- a/svtools/inc/svtools/svtreebx.hxx
+++ b/svtools/inc/svtools/svtreebx.hxx
@@ -39,11 +39,6 @@ class TabBar;
#define SV_TAB_BORDER 8
-#define WB_HASBUTTONSATROOT ((WinBits)0x0800)
-#define WB_NOINITIALSELECTION WB_DROPDOWN
-#define WB_HIDESELECTION WB_NOHIDESELECTION
-#define WB_FORCE_MAKEVISIBLE WB_SPIN
-
#define SV_LISTBOX_ID_TREEBOX 1 // fuer SvLBox::IsA()
#define SV_ENTRYHEIGHTOFFS_PIXEL 2
@@ -97,9 +92,11 @@ class SVT_DLLPUBLIC SvTreeListBox : public SvLBox
USHORT nTabFlagMask=0xffff,
BOOL bHasClipRegion=FALSE );
- SVT_DLLPRIVATE void InitTreeView( WinBits nWinStyle );
+ SVT_DLLPRIVATE void InitTreeView();
SVT_DLLPRIVATE SvLBoxItem* GetItem_Impl( SvLBoxEntry*, long nX, SvLBoxTab** ppTab,
USHORT nEmptyWidth );
+ SVT_DLLPRIVATE void ImplInitStyle();
+
#endif
protected:
@@ -318,9 +315,6 @@ public:
SvLBoxEntry* GetEntry( SvLBoxEntry* pParent, ULONG nPos ) const { return SvLBox::GetEntry(pParent,nPos); }
SvLBoxEntry* GetEntry( ULONG nRootPos ) const { return SvLBox::GetEntry(nRootPos);}
- void SetWindowBits( WinBits nWinStyle );
- WinBits GetWindowBits() const { return nWindowStyle; }
-
void PaintEntry( SvLBoxEntry* );
long PaintEntry( SvLBoxEntry*, long nLine,
USHORT nTabFlagMask=0xffff );
diff --git a/svtools/source/contnr/svicnvw.cxx b/svtools/source/contnr/svicnvw.cxx
index b16cd67d12a5..6fd0f5bf0c9c 100644
--- a/svtools/source/contnr/svicnvw.cxx
+++ b/svtools/source/contnr/svicnvw.cxx
@@ -50,7 +50,6 @@ SvIcnVwDataEntry::~SvIcnVwDataEntry()
SvIconView::SvIconView( Window* pParent, WinBits nWinStyle ) :
SvLBox( pParent, nWinStyle | WB_BORDER )
{
- nWinBits = nWinStyle;
nIcnVwFlags = 0;
pImp = new SvImpIconView( this, GetModel(), nWinStyle | WB_ICON );
pImp->mpViewData = 0;
@@ -72,8 +71,6 @@ SvIconView::SvIconView( Window* pParent , const ResId& rResId ) :
SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) );
SetDefaultFont();
pImp->SetSelectionMode( GetSelectionMode() );
- pImp->SetWindowBits( nWindowStyle );
- nWinBits = nWindowStyle;
}
SvIconView::~SvIconView()
@@ -403,10 +400,11 @@ SvLBoxEntry* SvIconView::GetEntryFromLogicPos( const Point& rDocPos ) const
}
-void SvIconView::SetWindowBits( WinBits nWinStyle )
+void SvIconView::StateChanged( StateChangedType i_nStateChange )
{
- nWinBits = nWinStyle;
- pImp->SetWindowBits( nWinStyle );
+ SvLBox::StateChanged( i_nStateChange );
+ if ( i_nStateChange == STATE_CHANGE_STYLE )
+ pImp->SetStyle( GetStyle() );
}
void SvIconView::PaintEntry( SvLBoxEntry* pEntry )
@@ -469,6 +467,7 @@ void SvIconView::SelectAll( BOOL bSelect, BOOL )
void SvIconView::SetCurEntry( SvLBoxEntry* _pEntry )
{
pImp->SetCursor( _pEntry );
+ OnCurrentEntryChanged();
}
SvLBoxEntry* SvIconView::GetCurEntry() const
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 35324d551858..c251903d02bd 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -45,6 +45,7 @@
#include <svimpbox.hxx>
#include <rtl/instance.hxx>
#include <svtools/svtdata.hxx>
+#include <tools/wintypes.hxx>
#ifndef _SVTOOLS_HRC
#include <svtools/svtools.hrc>
@@ -83,7 +84,7 @@ SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvLBoxTreeList* pLBTree, WinBits n
pTree = pLBTree;
aSelEng.SetFunctionSet( (FunctionSet*)&aFctSet );
aSelEng.ExpandSelectionOnMouseMove( FALSE );
- SetWindowBits( nWinStyle );
+ SetStyle( nWinStyle );
SetSelectionMode( SINGLE_SELECTION );
SetDragDropMode( 0 );
@@ -253,10 +254,10 @@ void SvImpLBox::CalcCellFocusRect( SvLBoxEntry* pEntry, Rectangle& rRect )
}
}
-void SvImpLBox::SetWindowBits( WinBits nWinStyle )
+void SvImpLBox::SetStyle( WinBits i_nWinStyle )
{
- nWinBits = nWinStyle;
- if((nWinStyle & WB_SIMPLEMODE) && aSelEng.GetSelectionMode()==MULTIPLE_SELECTION)
+ m_nStyle = i_nWinStyle;
+ if ( ( m_nStyle & WB_SIMPLEMODE) && ( aSelEng.GetSelectionMode() == MULTIPLE_SELECTION ) )
aSelEng.AddAlways( TRUE );
}
@@ -683,6 +684,8 @@ void SvImpLBox::SetCursor( SvLBoxEntry* pEntry, BOOL bForceNoSelect )
}
}
nFlags &= (~F_DESEL_ALL);
+
+ pView->OnCurrentEntryChanged();
}
void SvImpLBox::ShowCursor( BOOL bShow )
@@ -952,7 +955,7 @@ void SvImpLBox::Paint( const Rectangle& rRect )
// erst die Linien Zeichnen, dann clippen!
pView->SetClipRegion();
- if( nWinBits & ( WB_HASLINES | WB_HASLINESATROOT ) )
+ if( m_nStyle & ( WB_HASLINES | WB_HASLINESATROOT ) )
DrawNet();
pView->SetClipRegion( aClipRegion );
@@ -969,7 +972,7 @@ void SvImpLBox::Paint( const Rectangle& rRect )
{
// do not select if multiselection or explicit set
BOOL bNotSelect = ( aSelEng.GetSelectionMode() == MULTIPLE_SELECTION )
- || ( ( nWinBits & WB_NOINITIALSELECTION ) == WB_NOINITIALSELECTION );
+ || ( ( m_nStyle & WB_NOINITIALSELECTION ) == WB_NOINITIALSELECTION );
SetCursor( pStartEntry, bNotSelect );
}
@@ -994,7 +997,7 @@ void SvImpLBox::MakeVisible( SvLBoxEntry* pEntry, BOOL bMoveToTop )
if( bInView && (!bMoveToTop || pStartEntry == pEntry) )
return; // ist schon sichtbar
- if( pStartEntry || (nWinBits & WB_FORCE_MAKEVISIBLE) )
+ if( pStartEntry || (m_nStyle & WB_FORCE_MAKEVISIBLE) )
nFlags &= (~F_FILLING);
if( !bInView )
{
@@ -1132,7 +1135,7 @@ void SvImpLBox::DrawNet()
pView->DrawLine( aPos1, aPos2 );
}
// Sichtbar im Control ?
- if( n>= nOffs && ((nWinBits & WB_HASLINESATROOT) || !pTree->IsAtRootDepth(pEntry)))
+ if( n>= nOffs && ((m_nStyle & WB_HASLINESATROOT) || !pTree->IsAtRootDepth(pEntry)))
{
// kann aPos1 recyclet werden ?
if( !pView->IsExpanded(pEntry) )
@@ -1154,7 +1157,7 @@ void SvImpLBox::DrawNet()
nY += nEntryHeight;
pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
}
- if( nWinBits & WB_HASLINESATROOT )
+ if( m_nStyle & WB_HASLINESATROOT )
{
pEntry = pView->First();
aPos1.X() = pView->GetTabPos( pEntry, pFirstDynamicTab);
@@ -1248,7 +1251,8 @@ USHORT SvImpLBox::AdjustScrollBars( Size& rSize )
Size aOSize( pView->Control::GetOutputSizePixel() );
- BOOL bVerSBar = ( pView->nWindowStyle & WB_VSCROLL ) != 0;
+ const WinBits nWindowStyle = pView->GetStyle();
+ BOOL bVerSBar = ( nWindowStyle & WB_VSCROLL ) != 0;
BOOL bHorBar = FALSE;
long nMaxRight = aOSize.Width(); //GetOutputSize().Width();
Point aOrigin( pView->GetMapMode().GetOrigin() );
@@ -1256,7 +1260,7 @@ USHORT SvImpLBox::AdjustScrollBars( Size& rSize )
nMaxRight += aOrigin.X() - 1;
long nVis = nMostRight - aOrigin.X();
if( pTabBar || (
- (pView->nWindowStyle & WB_HSCROLL) &&
+ (nWindowStyle & WB_HSCROLL) &&
(nVis < nMostRight || nMaxRight < nMostRight) ))
bHorBar = TRUE;
@@ -1274,7 +1278,7 @@ USHORT SvImpLBox::AdjustScrollBars( Size& rSize )
nMaxRight -= nVerSBarWidth;
if( !bHorBar )
{
- if( (pView->nWindowStyle & WB_HSCROLL) &&
+ if( (nWindowStyle & WB_HSCROLL) &&
(nVis < nMostRight || nMaxRight < nMostRight) )
bHorBar = TRUE;
}
@@ -1439,7 +1443,7 @@ void SvImpLBox::FillView()
void SvImpLBox::ShowVerSBar()
{
- BOOL bVerBar = ( pView->nWindowStyle & WB_VSCROLL ) != 0;
+ BOOL bVerBar = ( pView->GetStyle() & WB_VSCROLL ) != 0;
ULONG nVis = 0;
if( !bVerBar )
nVis = pView->GetVisibleCount();
@@ -1681,7 +1685,7 @@ void SvImpLBox::EntrySelected( SvLBoxEntry* pEntry, BOOL bSelect )
return;
/*
- if( (nWinBits & WB_HIDESELECTION) && pEntry && !pView->HasFocus() )
+ if( (m_nStyle & WB_HIDESELECTION) && pEntry && !pView->HasFocus() )
{
SvViewData* pViewData = pView->GetViewData( pEntry );
pViewData->SetCursored( bSelect );
@@ -1943,7 +1947,7 @@ void SvImpLBox::EntryInserted( SvLBoxEntry* pEntry )
// die Linien invalidieren
/*
if( (bEntryVisible || bPrevEntryVisible) &&
- (nWinBits & ( WB_HASLINES | WB_HASLINESATROOT )) )
+ (m_nStyle & ( WB_HASLINES | WB_HASLINESATROOT )) )
{
SvLBoxTab* pTab = pView->GetFirstDynamicTab();
if( pTab )
@@ -2265,6 +2269,7 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt)
SvLBoxEntry* pNewCursor;
+ const WinBits nWindowStyle = pView->GetStyle();
switch( aCode )
{
case KEY_UP:
@@ -2348,7 +2353,7 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt)
CallEventListeners( VCLEVENT_LISTBOX_SELECT, pCursor );
}
}
- else if( pView->nWindowStyle & WB_HSCROLL )
+ else if( nWindowStyle & WB_HSCROLL )
{
long nThumb = aHorSBar.GetThumbPos();
nThumb += aHorSBar.GetLineSize();
@@ -2379,7 +2384,7 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt)
CallEventListeners( VCLEVENT_LISTBOX_SELECT, pCursor );
}
}
- else if ( pView->nWindowStyle & WB_HSCROLL )
+ else if ( nWindowStyle & WB_HSCROLL )
{
long nThumb = aHorSBar.GetThumbPos();
nThumb -= aHorSBar.GetLineSize();
@@ -2481,13 +2486,17 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt)
else if ( !bShift /*&& !bMod1*/ )
{
if ( aSelEng.IsAddMode() )
+ {
// toggle selection
pView->Select( pCursor, !pView->IsSelected( pCursor ) );
- else
+ }
+ else if ( !pView->IsSelected( pCursor ) )
{
SelAllDestrAnch( FALSE );
pView->Select( pCursor, TRUE );
}
+ else
+ bKeyUsed = FALSE;
}
else
bKeyUsed = FALSE;
@@ -2520,7 +2529,7 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt)
case KEY_F8:
if( bShift && pView->GetSelectionMode()==MULTIPLE_SELECTION &&
- !(nWinBits & WB_SIMPLEMODE))
+ !(m_nStyle & WB_SIMPLEMODE))
{
if( aSelEng.IsAlwaysAdding() )
aSelEng.AddAlways( FALSE );
@@ -2568,8 +2577,8 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt)
case KEY_A:
if( bMod1 )
SelAllDestrAnch( TRUE );
-// else
-// bKeyUsed = FALSE; #105907# assume user wants to use quicksearch with key "a", so key is handled!
+ else
+ bKeyUsed = FALSE;
break;
case KEY_SUBTRACT:
@@ -2680,10 +2689,15 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt)
break;
default:
- if( bMod1 || rKeyCode.GetGroup() == KEYGROUP_FKEYS )
- // #105907# CTRL or Function key is pressed, assume user don't want to use quicksearch...
- // if there are groups of keys which should not be handled, they can be added here
- bKeyUsed = FALSE;
+ // is there any reason why we should eat the events here? The only place where this is called
+ // is from SvTreeListBox::KeyInput. If we set bKeyUsed to TRUE here, then the key input
+ // is just silenced. However, we want SvLBox::KeyInput to get a chance, to do the QuickSelection
+ // handling.
+ // (The old code here which intentionally set bKeyUsed to TRUE said this was because of "quick search"
+ // handling, but actually there was no quick search handling anymore. We just re-implemented it.)
+ // #i31275# / 2009-06-16 / frank.schoenheit@sun.com
+ bKeyUsed = FALSE;
+ break;
}
return bKeyUsed;
}
@@ -2698,7 +2712,7 @@ void __EXPORT SvImpLBox::GetFocus()
// if( bSimpleTravel && !pView->IsSelected(pCursor) )
// pView->Select( pCursor, TRUE );
}
- if( nWinBits & WB_HIDESELECTION )
+ if( m_nStyle & WB_HIDESELECTION )
{
SvLBoxEntry* pEntry = pView->FirstSelected();
while( pEntry )
@@ -2731,7 +2745,7 @@ void __EXPORT SvImpLBox::LoseFocus()
pView->SetEntryFocus( pCursor,FALSE );
ShowCursor( FALSE );
- if( nWinBits & WB_HIDESELECTION )
+ if( m_nStyle & WB_HIDESELECTION )
{
SvLBoxEntry* pEntry = pView->FirstSelected();
while( pEntry )
@@ -3029,7 +3043,7 @@ void SvImpLBox::SetSelectionMode( SelectionMode eSelMode )
bSimpleTravel = TRUE;
else
bSimpleTravel = FALSE;
- if( (nWinBits & WB_SIMPLEMODE) && (eSelMode == MULTIPLE_SELECTION) )
+ if( (m_nStyle & WB_SIMPLEMODE) && (eSelMode == MULTIPLE_SELECTION) )
aSelEng.AddAlways( TRUE );
}
diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx
index d1e471953663..0d335429d564 100644
--- a/svtools/source/contnr/svimpicn.cxx
+++ b/svtools/source/contnr/svimpicn.cxx
@@ -708,7 +708,7 @@ public:
SvImpIconView::SvImpIconView( SvIconView* pCurView, SvLBoxTreeList* pTree,
- WinBits nWinStyle ) :
+ WinBits i_nWinStyle ) :
aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ),
aHorSBar( pCurView, WB_DRAG | WB_HSCROLL )
{
@@ -716,7 +716,7 @@ SvImpIconView::SvImpIconView( SvIconView* pCurView, SvLBoxTreeList* pTree,
pModel = pTree;
pCurParent = 0;
pZOrderList = new SvPtrarr;
- SetWindowBits( nWinStyle );
+ SetStyle( i_nWinStyle );
nHorDist = 0;
nVerDist = 0;
nFlags = 0;
@@ -785,13 +785,12 @@ void SvImpIconView::Clear( BOOL bInCtor )
AdjustScrollBars();
}
-void SvImpIconView::SetWindowBits( WinBits nWinStyle )
+void SvImpIconView::SetStyle( const WinBits i_nWinStyle )
{
- nWinBits = nWinStyle;
nViewMode = VIEWMODE_TEXT;
- if( nWinStyle & WB_NAME )
+ if( i_nWinStyle & WB_NAME )
nViewMode = VIEWMODE_NAME;
- if( nWinStyle & WB_ICON )
+ if( i_nWinStyle & WB_ICON )
nViewMode = VIEWMODE_ICON;
}
@@ -1754,8 +1753,8 @@ void SvImpIconView::AdjustScrollBars()
else
nVisibleHeight = nRealHeight;
- bool bVerSBar = (pView->nWindowStyle & WB_VSCROLL) ? true : false;
- bool bHorSBar = (pView->nWindowStyle & WB_HSCROLL) ? true : false;
+ bool bVerSBar = (pView->GetStyle() & WB_VSCROLL) ? true : false;
+ bool bHorSBar = (pView->GetStyle() & WB_HSCROLL) ? true : false;
USHORT nResult = 0;
if( nVirtHeight )
@@ -1903,7 +1902,7 @@ BOOL SvImpIconView::CheckHorScrollBar()
return FALSE;
const MapMode& rMapMode = pView->GetMapMode();
Point aOrigin( rMapMode.GetOrigin() );
- if(!(pView->nWindowStyle & WB_HSCROLL) && !aOrigin.X() )
+ if(!(pView->GetStyle() & WB_HSCROLL) && !aOrigin.X() )
{
long nWidth = aOutputSize.Width();
USHORT nCount = pZOrderList->Count();
@@ -1941,7 +1940,7 @@ BOOL SvImpIconView::CheckVerScrollBar()
return FALSE;
const MapMode& rMapMode = pView->GetMapMode();
Point aOrigin( rMapMode.GetOrigin() );
- if(!(pView->nWindowStyle & WB_VSCROLL) && !aOrigin.Y() )
+ if(!(pView->GetStyle() & WB_VSCROLL) && !aOrigin.Y() )
{
long nDeepest = 0;
long nHeight = aOutputSize.Height();
diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx
index a69253c69629..11e19c6bab3c 100644
--- a/svtools/source/contnr/svlbox.cxx
+++ b/svtools/source/contnr/svlbox.cxx
@@ -685,6 +685,7 @@ SvLBox_Impl::SvLBox_Impl( SvLBox& _rBox )
,m_bEntryMnemonicsEnabled( false )
,m_pLink( NULL )
,m_aMnemonicEngine( _rBox )
+ ,m_aQuickSelectionEngine( _rBox )
{
}
@@ -699,7 +700,6 @@ SvLBox::SvLBox( Window* pParent, WinBits nWinStyle ) :
DropTargetHelper( this ), DragSourceHelper( this ), eSelMode( NO_SELECTION )
{
DBG_CTOR(SvLBox,0);
- nWindowStyle = nWinStyle;
nDragOptions = DND_ACTION_COPYMOVE | DND_ACTION_LINK;
nImpFlags = 0;
pTargetEntry = 0;
@@ -724,7 +724,6 @@ SvLBox::SvLBox( Window* pParent, const ResId& rResId ) :
DBG_CTOR(SvLBox,0);
pTargetEntry = 0;
nImpFlags = 0;
- nWindowStyle = 0;
pLBoxImpl = new SvLBox_Impl( *this );
nDragOptions = DND_ACTION_COPYMOVE | DND_ACTION_LINK;
nDragDropMode = 0;
@@ -1251,6 +1250,12 @@ ULONG SvLBox::SelectChilds( SvLBoxEntry* , BOOL )
return 0;
}
+void SvLBox::OnCurrentEntryChanged()
+{
+ if ( !pLBoxImpl->m_bDoingQuickSelection )
+ pLBoxImpl->m_aQuickSelectionEngine.Reset();
+}
+
void SvLBox::SelectAll( BOOL /* bSelect */ , BOOL /* bPaint */ )
{
DBG_CHKTHIS(SvLBox,0);
@@ -1535,15 +1540,14 @@ void SvLBox::KeyInput( const KeyEvent& rKEvt )
Control::KeyInput( rKEvt );
}
-const void* SvLBox::FirstSearchEntry( String& _rEntryText )
+const void* SvLBox::FirstSearchEntry( String& _rEntryText ) const
{
SvLBoxEntry* pEntry = GetCurEntry();
if ( pEntry )
pEntry = const_cast< SvLBoxEntry* >( static_cast< const SvLBoxEntry* >( NextSearchEntry( pEntry, _rEntryText ) ) );
else
{
- if ( !pEntry )
- pEntry = FirstSelected();
+ pEntry = FirstSelected();
if ( !pEntry )
pEntry = First();
}
@@ -1554,11 +1558,23 @@ const void* SvLBox::FirstSearchEntry( String& _rEntryText )
return pEntry;
}
-const void* SvLBox::NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText )
+const void* SvLBox::NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) const
{
SvLBoxEntry* pEntry = const_cast< SvLBoxEntry* >( static_cast< const SvLBoxEntry* >( _pCurrentSearchEntry ) );
- pEntry = Next( pEntry );
+ if ( ( ( GetChildCount( pEntry ) > 0 )
+ || ( pEntry->HasChildsOnDemand() )
+ )
+ && !IsExpanded( pEntry )
+ )
+ {
+ pEntry = NextSibling( pEntry );
+ }
+ else
+ {
+ pEntry = Next( pEntry );
+ }
+
if ( !pEntry )
pEntry = First();
@@ -1572,7 +1588,7 @@ void SvLBox::SelectSearchEntry( const void* _pEntry )
{
SvLBoxEntry* pEntry = const_cast< SvLBoxEntry* >( static_cast< const SvLBoxEntry* >( _pEntry ) );
DBG_ASSERT( pEntry, "SvLBox::SelectSearchEntry: invalid entry!" );
- if ( pEntry )
+ if ( !pEntry )
return;
SelectAll( FALSE );
@@ -1580,17 +1596,50 @@ void SvLBox::SelectSearchEntry( const void* _pEntry )
Select( pEntry );
}
-void SvLBox::ExecuteSearchEntry( const void* /*_pEntry*/ )
+void SvLBox::ExecuteSearchEntry( const void* /*_pEntry*/ ) const
{
// nothing to do here, we have no "execution"
}
+::vcl::StringEntryIdentifier SvLBox::CurrentEntry( String& _out_entryText ) const
+{
+ // always accept the current entry if there is one
+ SvLBoxEntry* pCurrentEntry( GetCurEntry() );
+ if ( pCurrentEntry )
+ {
+ _out_entryText = GetEntryText( pCurrentEntry );
+ return pCurrentEntry;
+ }
+ return FirstSearchEntry( _out_entryText );
+}
+
+::vcl::StringEntryIdentifier SvLBox::NextEntry( ::vcl::StringEntryIdentifier _currentEntry, String& _out_entryText ) const
+{
+ return NextSearchEntry( _currentEntry, _out_entryText );
+}
+
+void SvLBox::SelectEntry( ::vcl::StringEntryIdentifier _entry )
+{
+ SelectSearchEntry( _entry );
+}
+
bool SvLBox::HandleKeyInput( const KeyEvent& _rKEvt )
{
- if ( !IsEntryMnemonicsEnabled() )
- return false;
+ if ( IsEntryMnemonicsEnabled()
+ && pLBoxImpl->m_aMnemonicEngine.HandleKeyEvent( _rKEvt )
+ )
+ return true;
+
+ if ( ( GetStyle() & WB_QUICK_SEARCH ) != 0 )
+ {
+ pLBoxImpl->m_bDoingQuickSelection = true;
+ const bool bHandled = pLBoxImpl->m_aQuickSelectionEngine.HandleKeyEvent( _rKEvt );
+ pLBoxImpl->m_bDoingQuickSelection = false;
+ if ( bHandled )
+ return true;
+ }
- return pLBoxImpl->m_aMnemonicEngine.HandleKeyEvent( _rKEvt );
+ return false;
}
SvLBoxEntry* SvLBox::GetEntry( const Point&, BOOL ) const
diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx
index a8635c99d127..f4780fbf08ad 100644
--- a/svtools/source/contnr/svtreebx.cxx
+++ b/svtools/source/contnr/svtreebx.cxx
@@ -65,10 +65,10 @@ DBG_NAME(SvTreeListBox)
#define SV_LBOX_DEFAULT_INDENT_PIXEL 20
SvTreeListBox::SvTreeListBox( Window* pParent, WinBits nWinStyle )
- : SvLBox(pParent,nWinStyle )
+ : SvLBox( pParent, nWinStyle )
{
DBG_CTOR(SvTreeListBox,0);
- InitTreeView( nWinStyle );
+ InitTreeView();
SetSublistOpenWithLeftRight();
}
@@ -78,13 +78,13 @@ SvTreeListBox::SvTreeListBox( Window* pParent , const ResId& rResId )
{
DBG_CTOR(SvTreeListBox,0);
- InitTreeView( 0 );
+ InitTreeView();
Resize();
SetSublistOpenWithLeftRight();
}
-void SvTreeListBox::InitTreeView( WinBits nWinStyle )
+void SvTreeListBox::InitTreeView()
{
DBG_CHKTHIS(SvTreeListBox,0);
pCheckButtonData = NULL;
@@ -102,7 +102,7 @@ void SvTreeListBox::InitTreeView( WinBits nWinStyle )
nTreeFlags = TREEFLAG_RECALCTABS;
nIndent = SV_LBOX_DEFAULT_INDENT_PIXEL;
nEntryHeightOffs = SV_ENTRYHEIGHTOFFS_PIXEL;
- pImp = new SvImpLBox( this, GetModel(), nWinStyle );
+ pImp = new SvImpLBox( this, GetModel(), GetStyle() );
aContextBmpMode = SVLISTENTRYFLAG_EXPANDED;
nContextBmpWidthMax = 0;
@@ -110,7 +110,7 @@ void SvTreeListBox::InitTreeView( WinBits nWinStyle )
SetSpaceBetweenEntries( 0 );
SetLineColor();
InitSettings( TRUE, TRUE, TRUE );
- SetWindowBits( nWinStyle );
+ ImplInitStyle();
SetTabs();
}
@@ -227,8 +227,9 @@ void SvTreeListBox::SetTabs()
EndEditing( TRUE );
nTreeFlags &= (~TREEFLAG_RECALCTABS);
nFocusWidth = -1;
- BOOL bHasButtons = (nWindowStyle & WB_HASBUTTONS)!=0;
- BOOL bHasButtonsAtRoot = (nWindowStyle & (WB_HASLINESATROOT |
+ const WinBits nStyle( GetStyle() );
+ BOOL bHasButtons = (nStyle & WB_HASBUTTONS)!=0;
+ BOOL bHasButtonsAtRoot = (nStyle & (WB_HASLINESATROOT |
WB_HASBUTTONSATROOT))!=0;
long nStartPos = TAB_STARTPOS;
long nNodeWidthPixel = GetExpandedNodeBmp().GetSizePixel().Width();
@@ -1492,12 +1493,14 @@ SvLBoxEntry* SvTreeListBox::GetCurEntry() const
return pImp->GetCurEntry();
}
-void SvTreeListBox::SetWindowBits( WinBits nWinStyle )
+void SvTreeListBox::ImplInitStyle()
{
DBG_CHKTHIS(SvTreeListBox,0);
- nWindowStyle = nWinStyle;
+
+ const WinBits nWindowStyle = GetStyle();
+
nTreeFlags |= TREEFLAG_RECALCTABS;
- if( nWinStyle & WB_SORT )
+ if( nWindowStyle & WB_SORT )
{
GetModel()->SetSortMode( SortAscending );
GetModel()->SetCompareHdl( LINK(this,SvTreeListBox,DefaultCompare));
@@ -1508,9 +1511,9 @@ void SvTreeListBox::SetWindowBits( WinBits nWinStyle )
GetModel()->SetCompareHdl( Link() );
}
#ifdef OS2
- nWinStyle |= WB_VSCROLL;
+ nWindowStyle |= WB_VSCROLL;
#endif
- pImp->SetWindowBits( nWinStyle );
+ pImp->SetStyle( nWindowStyle );
pImp->Resize();
Invalidate();
}
@@ -1578,8 +1581,9 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,USHORT nTabFlags,
BOOL bInUse = pEntry->HasInUseEmphasis();
// wenn eine ClipRegion von aussen gesetzt wird, dann
// diese nicht zuruecksetzen
- BOOL bResetClipRegion = !bHasClipRegion;
- BOOL bHideSelection = ((nWindowStyle & WB_HIDESELECTION) && !HasFocus())!=0;
+ const WinBits nWindowStyle = GetStyle();
+ const BOOL bResetClipRegion = !bHasClipRegion;
+ const BOOL bHideSelection = ((nWindowStyle & WB_HIDESELECTION) && !HasFocus())!=0;
const StyleSettings& rSettings = GetSettings().GetStyleSettings();
Font aHighlightFont( GetFont() );
@@ -2367,6 +2371,7 @@ void SvTreeListBox::ModelNotification( USHORT nActionId, SvListEntry* pEntry1,
long SvTreeListBox::GetTextOffset() const
{
DBG_CHKTHIS(SvTreeListBox,0);
+ const WinBits nWindowStyle = GetStyle();
BOOL bHasButtons = (nWindowStyle & WB_HASBUTTONS)!=0;
BOOL bHasButtonsAtRoot = (nWindowStyle & (WB_HASLINESATROOT |
WB_HASBUTTONSATROOT))!=0;
@@ -2519,6 +2524,8 @@ void SvTreeListBox::DataChanged( const DataChangedEvent& rDCEvt )
void SvTreeListBox::StateChanged( StateChangedType i_nStateChange )
{
SvLBox::StateChanged( i_nStateChange );
+ if ( i_nStateChange == STATE_CHANGE_STYLE )
+ ImplInitStyle();
}
void SvTreeListBox::InitSettings(BOOL bFont,BOOL bForeground,BOOL bBackground)
diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx
index 92b9f960b65c..6919944daef4 100644
--- a/svtools/source/inc/svimpbox.hxx
+++ b/svtools/source/inc/svimpbox.hxx
@@ -153,7 +153,7 @@ private:
USHORT nFlags;
USHORT nCurTabPos;
- WinBits nWinBits;
+ WinBits m_nStyle;
ExtendedWinBits nExtendedWinBits;
BOOL bSimpleTravel : 1; // ist TRUE bei SINGLE_SELECTION
BOOL bUpdateMode : 1;
@@ -264,7 +264,7 @@ public:
~SvImpLBox();
void Clear();
- void SetWindowBits( WinBits nWinStyle );
+ void SetStyle( WinBits i_nWinStyle );
void SetExtendedWindowBits( ExtendedWinBits _nBits );
ExtendedWinBits GetExtendedWindowBits() const { return nExtendedWinBits; }
void SetModel( SvLBoxTreeList* pModel ) { pTree = pModel;}
diff --git a/svtools/source/inc/svimpicn.hxx b/svtools/source/inc/svimpicn.hxx
index 20f98d2bcbbd..7d5c2b1b41e3 100644
--- a/svtools/source/inc/svimpicn.hxx
+++ b/svtools/source/inc/svimpicn.hxx
@@ -96,7 +96,6 @@ class SvImpIconView
nGridDY;
long nHorSBarHeight,
nVerSBarWidth;
- WinBits nWinBits;
int nViewMode;
long nHorDist;
long nVerDist;
@@ -171,7 +170,7 @@ public:
~SvImpIconView();
void Clear( BOOL bInCtor = FALSE );
- void SetWindowBits( WinBits nWinStyle );
+ void SetStyle( const WinBits i_nWinStyle );
void SetModel( SvLBoxTreeList* pTree, SvLBoxEntry* pParent )
{ pModel = pTree; SetCurParent(pParent); }
void EntryInserted( SvLBoxEntry*);
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index d1ea854cce61..f37d5f80ed68 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -1327,12 +1327,12 @@ void TreeControlPeer::setProperty( const ::rtl::OUString& PropertyName, const An
sal_Bool bEnabled = sal_False;
if ( aValue >>= bEnabled )
{
- WinBits nStyle = rTree.GetWindowBits();
+ WinBits nStyle = rTree.GetStyle();
if ( bEnabled )
nStyle |= WB_HIDESELECTION;
else
nStyle &= ~WB_HIDESELECTION;
- rTree.SetWindowBits( nStyle );
+ rTree.SetStyle( nStyle );
}
}
break;
@@ -1390,11 +1390,11 @@ void TreeControlPeer::setProperty( const ::rtl::OUString& PropertyName, const An
sal_Bool bEnabled = false;
if( aValue >>= bEnabled )
{
- WinBits nBits = rTree.GetWindowBits() & (~WB_HASLINES);
+ WinBits nBits = rTree.GetStyle() & (~WB_HASLINES);
if( bEnabled )
nBits |= WB_HASLINES;
- if( nBits != rTree.GetWindowBits() )
- rTree.SetWindowBits( nBits );
+ if( nBits != rTree.GetStyle() )
+ rTree.SetStyle( nBits );
}
break;
}
@@ -1403,11 +1403,11 @@ void TreeControlPeer::setProperty( const ::rtl::OUString& PropertyName, const An
sal_Bool bEnabled = false;
if( aValue >>= bEnabled )
{
- WinBits nBits = rTree.GetWindowBits() & (~WB_HASLINESATROOT);
+ WinBits nBits = rTree.GetStyle() & (~WB_HASLINESATROOT);
if( bEnabled )
nBits |= WB_HASLINESATROOT;
- if( nBits != rTree.GetWindowBits() )
- rTree.SetWindowBits( nBits );
+ if( nBits != rTree.GetStyle() )
+ rTree.SetStyle( nBits );
}
break;
}
@@ -1428,7 +1428,7 @@ Any TreeControlPeer::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru
switch(nPropId)
{
case BASEPROPERTY_HIDEINACTIVESELECTION:
- return Any( ( rTree.GetWindowBits() & WB_HIDESELECTION ) != 0 ? sal_True : sal_False );
+ return Any( ( rTree.GetStyle() & WB_HIDESELECTION ) != 0 ? sal_True : sal_False );
case BASEPROPERTY_TREE_SELECTIONTYPE:
{
@@ -1456,9 +1456,9 @@ Any TreeControlPeer::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru
case BASEPROPERTY_TREE_ROOTDISPLAYED:
return Any( mbIsRootDisplayed );
case BASEPROPERTY_TREE_SHOWSHANDLES:
- return Any( (rTree.GetWindowBits() & WB_HASLINES) != 0 ? sal_True : sal_False );
+ return Any( (rTree.GetStyle() & WB_HASLINES) != 0 ? sal_True : sal_False );
case BASEPROPERTY_TREE_SHOWSROOTHANDLES:
- return Any( (rTree.GetWindowBits() & WB_HASLINESATROOT) != 0 ? sal_True : sal_False );
+ return Any( (rTree.GetStyle() & WB_HASLINESATROOT) != 0 ? sal_True : sal_False );
}
}
return VCLXWindow::getProperty( PropertyName );
@@ -1527,7 +1527,7 @@ UnoTreeListBoxImpl::UnoTreeListBoxImpl( TreeControlPeer* pPeer, Window* pParent,
: SvTreeListBox( pParent, nWinStyle )
, mxPeer( pPeer )
{
- SetWindowBits( WB_BORDER | WB_HASLINES |WB_HASBUTTONS | WB_HASLINESATROOT | WB_HASBUTTONSATROOT | WB_HSCROLL );
+ SetStyle( WB_BORDER | WB_HASLINES |WB_HASBUTTONS | WB_HASLINESATROOT | WB_HASBUTTONSATROOT | WB_HSCROLL );
SetNodeDefaultImages();
SetSelectHdl( LINK(this, UnoTreeListBoxImpl, OnSelectionChangeHdl) );
SetDeselectHdl( LINK(this, UnoTreeListBoxImpl, OnSelectionChangeHdl) );
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index d0961188d06c..d3838a7421a4 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -592,7 +592,7 @@ void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 n
mbAdjustingGraphic = true;
::rtl::OUString sImageURL;
OSL_VERIFY( rValue >>= sImageURL );
- setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
+ setDependentFastPropertyValue( BASEPROPERTY_GRAPHIC, uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
mbAdjustingGraphic = false;
}
break;
@@ -601,7 +601,7 @@ void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 n
if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
{
mbAdjustingGraphic = true;
- setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ), uno::makeAny( ::rtl::OUString() ) );
+ setDependentFastPropertyValue( BASEPROPERTY_IMAGEURL, uno::makeAny( ::rtl::OUString() ) );
mbAdjustingGraphic = false;
}
break;
@@ -612,7 +612,7 @@ void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 n
mbAdjustingImagePosition = true;
sal_Int16 nUNOValue = 0;
OSL_VERIFY( rValue >>= nUNOValue );
- setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEPOSITION ), uno::makeAny( getExtendedImagePosition( nUNOValue ) ) );
+ setDependentFastPropertyValue( BASEPROPERTY_IMAGEPOSITION, uno::makeAny( getExtendedImagePosition( nUNOValue ) ) );
mbAdjustingImagePosition = false;
}
break;
@@ -622,7 +622,7 @@ void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 n
mbAdjustingImagePosition = true;
sal_Int16 nUNOValue = 0;
OSL_VERIFY( rValue >>= nUNOValue );
- setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEALIGN ), uno::makeAny( getCompatibleImageAlign( translateImagePosition( nUNOValue ) ) ) );
+ setDependentFastPropertyValue( BASEPROPERTY_IMAGEALIGN, uno::makeAny( getCompatibleImageAlign( translateImagePosition( nUNOValue ) ) ) );
mbAdjustingImagePosition = false;
}
break;
@@ -888,7 +888,7 @@ void SAL_CALL UnoControlImageControlModel::setFastPropertyValue_NoBroadcast( sal
mbAdjustingImageScaleMode = true;
sal_Int16 nScaleMode( awt::ImageScaleMode::Anisotropic );
OSL_VERIFY( _rValue >>= nScaleMode );
- setPropertyValue( GetPropertyName( BASEPROPERTY_SCALEIMAGE ), uno::makeAny( sal_Bool( nScaleMode != awt::ImageScaleMode::None ) ) );
+ setDependentFastPropertyValue( BASEPROPERTY_SCALEIMAGE, uno::makeAny( sal_Bool( nScaleMode != awt::ImageScaleMode::None ) ) );
mbAdjustingImageScaleMode = false;
}
break;
@@ -898,7 +898,7 @@ void SAL_CALL UnoControlImageControlModel::setFastPropertyValue_NoBroadcast( sal
mbAdjustingImageScaleMode = true;
sal_Bool bScale = sal_True;
OSL_VERIFY( _rValue >>= bScale );
- setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGE_SCALE_MODE ), uno::makeAny( bScale ? awt::ImageScaleMode::Anisotropic : awt::ImageScaleMode::None ) );
+ setDependentFastPropertyValue( BASEPROPERTY_IMAGE_SCALE_MODE, uno::makeAny( bScale ? awt::ImageScaleMode::Anisotropic : awt::ImageScaleMode::None ) );
mbAdjustingImageScaleMode = false;
}
break;
@@ -1917,7 +1917,7 @@ void SAL_CALL UnoControlListBoxModel::setFastPropertyValue_NoBroadcast( sal_Int3
uno::Sequence<sal_Int16> aSeq;
uno::Any aAny;
aAny <<= aSeq;
- setPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny );
+ setDependentFastPropertyValue( BASEPROPERTY_SELECTEDITEMS, aAny );
if ( !m_pData->m_bSettingLegacyProperty )
{
diff --git a/tools/inc/tools/wintypes.hxx b/tools/inc/tools/wintypes.hxx
index 7d6296b76e8c..9c7052e22d77 100644
--- a/tools/inc/tools/wintypes.hxx
+++ b/tools/inc/tools/wintypes.hxx
@@ -274,9 +274,16 @@ typedef sal_Int64 WinBits;
#define WB_STDTABCONTROL 0
// For TreeListBox
-#define WB_HASBUTTONS ((WinBits)0x00800000)
-#define WB_HASLINES ((WinBits)0x01000000)
-#define WB_HASLINESATROOT ((WinBits)0x02000000)
+#define WB_HASBUTTONS ((WinBits)SAL_CONST_INT64(0x000100000000))
+#define WB_HASLINES ((WinBits)SAL_CONST_INT64(0x000200000000))
+#define WB_HASLINESATROOT ((WinBits)SAL_CONST_INT64(0x000400000000))
+#define WB_HASBUTTONSATROOT ((WinBits)SAL_CONST_INT64(0x000800000000))
+#define WB_NOINITIALSELECTION ((WinBits)SAL_CONST_INT64(0x001000000000))
+#define WB_HIDESELECTION ((WinBits)SAL_CONST_INT64(0x002000000000))
+#define WB_FORCE_MAKEVISIBLE ((WinBits)SAL_CONST_INT64(0x004000000000))
+// DO NOT USE: 0x008000000000, that's WB_SYSTEMCHILDWINDOW
+#define WB_QUICK_SEARCH ((WinBits)SAL_CONST_INT64(0x010000000000))
+
// For FileOpen Dialog
#define WB_PATH ((WinBits)0x00100000)
diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx
index 2ae6f0c97f0c..3cf43a1f3bc9 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -46,12 +46,14 @@
#include <unotools/ucbhelper.hxx>
#include <vos/process.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/util/XStringSubstitution.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
#include <rtl/instance.hxx>
#include <itemholder1.hxx>
@@ -998,6 +1000,17 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath )
if ( LocalFileHelper::ConvertPhysicalNameToURL( aPathToken, aURL ) )
aObj.SetURL( aURL );
}
+ if ( aObj.GetProtocol() == INET_PROT_VND_SUN_STAR_EXPAND )
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XMacroExpander > xMacroExpander( aContext.getSingleton( "com.sun.star.util.theMacroExpander" ), UNO_QUERY );
+ OSL_ENSURE( xMacroExpander.is(), "SvtPathOptions::SearchFile: unable to access the MacroExpander singleton!" );
+ if ( xMacroExpander.is() )
+ {
+ const ::rtl::OUString sExpandedPath = xMacroExpander->expandMacros( aObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ) );
+ aObj.SetURL( sExpandedPath );
+ }
+ }
xub_StrLen i, nCount = aIniFile.GetTokenCount( '/' );
for ( i = 0; i < nCount; ++i )
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 7c72f40d2767..d209becfb4ae 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 e28dc755e8a8..9e6d39d925c0 100644
--- a/vcl/prj/d.lst
+++ b/vcl/prj/d.lst
@@ -78,6 +78,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/window/window.cxx b/vcl/source/window/window.cxx
index 69999f6c7188..77da205131ea 100755
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -4862,6 +4862,12 @@ void Window::Paint( const Rectangle& rRect )
// -----------------------------------------------------------------------
+void Window::PostPaint()
+{
+}
+
+// -----------------------------------------------------------------------
+
void Window::Draw( OutputDevice*, const Point&, const Size&, ULONG )
{
DBG_CHKTHIS( Window, ImplDbgCheckWindow );