diff options
51 files changed, 1024 insertions, 1247 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/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx index 3ce0d4de865a..ebeedc92839d 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx @@ -101,10 +101,12 @@ static bool makeCanonicalFileURL( rtl::OUString & rURL ) OfficeInstallationDirectories::OfficeInstallationDirectories( const uno::Reference< uno::XComponentContext > & xCtx ) -: m_aOfficeDirMacro( RTL_CONSTASCII_USTRINGPARAM( "$(baseinsturl)" ) ), +: m_aOfficeBrandDirMacro( RTL_CONSTASCII_USTRINGPARAM( "$(brandbaseurl)" ) ), + m_aOfficeBaseDirMacro( RTL_CONSTASCII_USTRINGPARAM( "$(baseinsturl)" ) ), m_aUserDirMacro( RTL_CONSTASCII_USTRINGPARAM( "$(userdataurl)" ) ), m_xCtx( xCtx ), - m_pOfficeDir( 0 ), + m_pOfficeBrandDir( 0 ), + m_pOfficeBaseDir( 0 ), m_pUserDir( 0 ) { } @@ -113,6 +115,9 @@ OfficeInstallationDirectories::OfficeInstallationDirectories( // virtual OfficeInstallationDirectories::~OfficeInstallationDirectories() { + delete m_pOfficeBrandDir; + delete m_pOfficeBaseDir; + delete m_pUserDir; } //========================================================================= @@ -124,9 +129,8 @@ rtl::OUString SAL_CALL OfficeInstallationDirectories::getOfficeInstallationDirectoryURL() throw ( uno::RuntimeException ) { - // late init m_pOfficeDir and m_pUserDir initDirs(); - return rtl::OUString( *m_pOfficeDir ); + return rtl::OUString( *m_pOfficeBrandDir ); } //========================================================================= @@ -135,7 +139,6 @@ rtl::OUString SAL_CALL OfficeInstallationDirectories::getOfficeUserDataDirectoryURL() throw ( uno::RuntimeException ) { - // late init m_pOfficeDir and m_pUserDir initDirs(); return rtl::OUString( *m_pUserDir ); } @@ -149,29 +152,39 @@ OfficeInstallationDirectories::makeRelocatableURL( const rtl::OUString& URL ) { if ( URL.getLength() > 0 ) { - // late init m_pOfficeDir and m_pUserDir initDirs(); rtl::OUString aCanonicalURL( URL ); makeCanonicalFileURL( aCanonicalURL ); - sal_Int32 nIndex = aCanonicalURL.indexOf( *m_pOfficeDir ); + sal_Int32 nIndex = aCanonicalURL.indexOf( *m_pOfficeBrandDir ); if ( nIndex != -1 ) { return rtl::OUString( URL.replaceAt( nIndex, - m_pOfficeDir->getLength(), - m_aOfficeDirMacro ) ); + m_pOfficeBrandDir->getLength(), + m_aOfficeBrandDirMacro ) ); } else { - nIndex = aCanonicalURL.indexOf( *m_pUserDir ); + nIndex = aCanonicalURL.indexOf( *m_pOfficeBaseDir ); if ( nIndex != -1 ) { return rtl::OUString( URL.replaceAt( nIndex, - m_pUserDir->getLength(), - m_aUserDirMacro ) ); + m_pOfficeBaseDir->getLength(), + m_aOfficeBaseDirMacro ) ); + } + else + { + nIndex = aCanonicalURL.indexOf( *m_pUserDir ); + if ( nIndex != -1 ) + { + return rtl::OUString( + URL.replaceAt( nIndex, + m_pUserDir->getLength(), + m_aUserDirMacro ) ); + } } } } @@ -186,29 +199,40 @@ OfficeInstallationDirectories::makeAbsoluteURL( const rtl::OUString& URL ) { if ( URL.getLength() > 0 ) { - sal_Int32 nIndex = URL.indexOf( m_aOfficeDirMacro ); + sal_Int32 nIndex = URL.indexOf( m_aOfficeBrandDirMacro ); if ( nIndex != -1 ) { - // late init m_pOfficeDir and m_pUserDir initDirs(); return rtl::OUString( URL.replaceAt( nIndex, - m_aOfficeDirMacro.getLength(), - *m_pOfficeDir ) ); + m_aOfficeBrandDirMacro.getLength(), + *m_pOfficeBrandDir ) ); } else { - nIndex = URL.indexOf( m_aUserDirMacro ); + nIndex = URL.indexOf( m_aOfficeBaseDirMacro ); if ( nIndex != -1 ) { - // late init m_pOfficeDir and m_pUserDir initDirs(); return rtl::OUString( URL.replaceAt( nIndex, - m_aUserDirMacro.getLength(), - *m_pUserDir ) ); + m_aOfficeBaseDirMacro.getLength(), + *m_pOfficeBaseDir ) ); + } + else + { + nIndex = URL.indexOf( m_aUserDirMacro ); + if ( nIndex != -1 ) + { + initDirs(); + + return rtl::OUString( + URL.replaceAt( nIndex, + m_aUserDirMacro.getLength(), + *m_pUserDir ) ); + } } } } @@ -300,13 +324,14 @@ OfficeInstallationDirectories::Create( void OfficeInstallationDirectories::initDirs() { - if ( m_pOfficeDir == 0 ) + if ( m_pOfficeBrandDir == 0 ) { osl::MutexGuard aGuard( m_aMutex ); - if ( m_pOfficeDir == 0 ) + if ( m_pOfficeBrandDir == 0 ) { - m_pOfficeDir = new rtl::OUString; - m_pUserDir = new rtl::OUString; + m_pOfficeBrandDir = new rtl::OUString; + m_pOfficeBaseDir = new rtl::OUString; + m_pUserDir = new rtl::OUString; uno::Reference< util::XMacroExpander > xExpander; @@ -320,15 +345,24 @@ void OfficeInstallationDirectories::initDirs() if ( xExpander.is() ) { - *m_pOfficeDir = + *m_pOfficeBrandDir = + xExpander->expandMacros( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "$BRAND_BASE_DIR" ) ) ); + + OSL_ENSURE( m_pOfficeBrandDir->getLength() > 0, + "Unable to obtain office brand installation directory!" ); + + makeCanonicalFileURL( *m_pOfficeBrandDir ); + + *m_pOfficeBaseDir = xExpander->expandMacros( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap" ) ":BaseInstallation}" ) ) ); - OSL_ENSURE( m_pOfficeDir->getLength() > 0, - "Unable to obtain office installation directory!" ); + OSL_ENSURE( m_pOfficeBaseDir->getLength() > 0, + "Unable to obtain office base installation directory!" ); - makeCanonicalFileURL( *m_pOfficeDir ); + makeCanonicalFileURL( *m_pOfficeBaseDir ); *m_pUserDir = xExpander->expandMacros( @@ -336,7 +370,7 @@ void OfficeInstallationDirectories::initDirs() "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap" ) ":UserInstallation}" ) ) ); OSL_ENSURE( m_pUserDir->getLength() > 0, - "Unable to obtain office user data directory!" ); + "Unable to obtain office user data directory!" ); makeCanonicalFileURL( *m_pUserDir ); } diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx index 2ffb3582718a..9c56f7ce80fd 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx @@ -94,11 +94,13 @@ public: private: void initDirs(); - rtl::OUString m_aOfficeDirMacro; + rtl::OUString m_aOfficeBrandDirMacro; + rtl::OUString m_aOfficeBaseDirMacro; rtl::OUString m_aUserDirMacro; com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xCtx; - rtl::OUString * m_pOfficeDir; + rtl::OUString * m_pOfficeBrandDir; + rtl::OUString * m_pOfficeBaseDir; rtl::OUString * m_pUserDir; }; 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/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx index 8e6976c0efd1..4e3a4cedbe6f 100644 --- a/l10ntools/source/help/HelpLinker.cxx +++ b/l10ntools/source/help/HelpLinker.cxx @@ -46,17 +46,16 @@ #define DBHELP_ONLY - class IndexerPreProcessor { private: - std::string m_aModuleName; - fs::path m_fsIndexBaseDir; - fs::path m_fsCaptionFilesDirName; - fs::path m_fsContentFilesDirName; + std::string m_aModuleName; + fs::path m_fsIndexBaseDir; + fs::path m_fsCaptionFilesDirName; + fs::path m_fsContentFilesDirName; - xsltStylesheetPtr m_xsltStylesheetPtrCaption; - xsltStylesheetPtr m_xsltStylesheetPtrContent; + xsltStylesheetPtr m_xsltStylesheetPtrCaption; + xsltStylesheetPtr m_xsltStylesheetPtrContent; public: IndexerPreProcessor( const std::string& aModuleName, const fs::path& fsIndexBaseDir, @@ -245,7 +244,6 @@ class HelpLinker { public: void main(std::vector<std::string> &args, -// std::string* pExtensionPath = NULL, const rtl::OUString* pOfficeHelpPath = NULL ) std::string* pExtensionPath = NULL, std::string* pDestination = NULL, const rtl::OUString* pOfficeHelpPath = NULL ) @@ -667,8 +665,8 @@ void HelpLinker::link() throw( HelpProcessingException ) if( !bExtensionMode ) std::cout << std::endl; - } // try - catch( HelpProcessingException& ) + } // try + catch( const HelpProcessingException& ) { // catch HelpProcessingException to avoid locking data bases #ifndef DBHELP_ONLY @@ -1039,7 +1037,6 @@ void HelpLinker::main( std::vector<std::string> &args, aStrStream << "language missing" << std::endl; throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); } - link(); } @@ -1102,7 +1099,7 @@ HelpProcessingErrorInfo& HelpProcessingErrorInfo::operator=( const struct HelpPr // Returns true in case of success, false in case of error HELPLINKER_DLLPUBLIC bool compileExtensionHelp ( - const rtl::OUString& aOfficeHelpPath, + const rtl::OUString& aOfficeHelpPath, const rtl::OUString& aExtensionName, const rtl::OUString& aExtensionLanguageRoot, sal_Int32 nXhpFileCount, const rtl::OUString* pXhpFiles, @@ -1112,31 +1109,20 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp { bool bSuccess = true; - sal_Int32 argc = nXhpFileCount + 3; - const char** argv = new const char*[argc]; - argv[0] = ""; - argv[1] = "-mod"; + std::vector<std::string> args; + args.reserve(nXhpFileCount + 2); + args.push_back(std::string("-mod")); rtl::OString aOExtensionName = rtl::OUStringToOString( aExtensionName, fs::getThreadTextEncoding() ); - argv[2] = aOExtensionName.getStr(); + args.push_back(std::string(aOExtensionName.getStr())); for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) { rtl::OUString aXhpFile = pXhpFiles[iXhp]; rtl::OString aOXhpFile = rtl::OUStringToOString( aXhpFile, fs::getThreadTextEncoding() ); - char* pArgStr = new char[aOXhpFile.getLength() + 1]; - strcpy( pArgStr, aOXhpFile.getStr() ); - argv[iXhp + 3] = pArgStr; + args.push_back(std::string(aOXhpFile.getStr())); } - std::vector<std::string> args; - for( sal_Int32 i = 1; i < argc; ++i ) - args.push_back(std::string( argv[i]) ); - - for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) - delete[] argv[iXhp + 3]; - delete[] argv; - rtl::OString aOExtensionLanguageRoot = rtl::OUStringToOString( aExtensionLanguageRoot, fs::getThreadTextEncoding() ); const char* pExtensionPath = aOExtensionLanguageRoot.getStr(); std::string aStdStrExtensionPath = pExtensionPath; @@ -1206,6 +1192,3 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp return bSuccess; } -// vnd.sun.star.help://swriter/52821?Language=en-US&System=UNIX -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ - diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx index f093dc60cbe7..039a29fd2683 100644 --- a/sot/source/sdstor/stgdir.cxx +++ b/sot/source/sdstor/stgdir.cxx @@ -936,8 +936,11 @@ BOOL StgDirStrm::Store() void* StgDirStrm::GetEntry( INT32 n, BOOL bDirty ) { + if( n < 0 ) + return NULL; + n *= STGENTRY_SIZE; - if( n >= nSize ) + if( n < 0 && n >= nSize ) return NULL; return GetPtr( n, TRUE, bDirty ); } diff --git a/svtools/inc/rtfkeywd.hxx b/svtools/inc/rtfkeywd.hxx index 5ccd9149bd68..de59e1d8faf9 100644 --- a/svtools/inc/rtfkeywd.hxx +++ b/svtools/inc/rtfkeywd.hxx @@ -39,6 +39,7 @@ #define OOO_STRING_SVTOOLS_RTF_ALT "\\alt" #define OOO_STRING_SVTOOLS_RTF_ANNOTATION "\\annotation" #define OOO_STRING_SVTOOLS_RTF_ANSI "\\ansi" +#define OOO_STRING_SVTOOLS_RTF_ATNDATE "\\atndate" #define OOO_STRING_SVTOOLS_RTF_ATNID "\\atnid" #define OOO_STRING_SVTOOLS_RTF_AUTHOR "\\author" #define OOO_STRING_SVTOOLS_RTF_B "\\b" @@ -976,12 +977,15 @@ #define OOO_STRING_SVTOOLS_RTF_SHPBXCOLUMN "\\shpbxcolumn" #define OOO_STRING_SVTOOLS_RTF_SHPBXMARGIN "\\shpbxmargin" #define OOO_STRING_SVTOOLS_RTF_SHPBXPAGE "\\shpbxpage" +#define OOO_STRING_SVTOOLS_RTF_SHPBXIGNORE "\\shpbxignore" #define OOO_STRING_SVTOOLS_RTF_SHPBYMARGIN "\\shpbymargin" #define OOO_STRING_SVTOOLS_RTF_SHPBYPAGE "\\shpbypage" #define OOO_STRING_SVTOOLS_RTF_SHPBYPARA "\\shpbypara" +#define OOO_STRING_SVTOOLS_RTF_SHPBYIGNORE "\\shpbyignore" #define OOO_STRING_SVTOOLS_RTF_SHPFBLWTXT "\\shpfblwtxt" #define OOO_STRING_SVTOOLS_RTF_SHPFHDR "\\shpfhdr" #define OOO_STRING_SVTOOLS_RTF_SHPGRP "\\shpgrp" +#define OOO_STRING_SVTOOLS_RTF_SHPINST "\\shpinst" #define OOO_STRING_SVTOOLS_RTF_SHPLEFT "\\shpleft" #define OOO_STRING_SVTOOLS_RTF_SHPLID "\\shplid" #define OOO_STRING_SVTOOLS_RTF_SHPLOCKANCHOR "\\shplockanchor" @@ -993,6 +997,7 @@ #define OOO_STRING_SVTOOLS_RTF_SHPWRK "\\shpwrk" #define OOO_STRING_SVTOOLS_RTF_SHPWR "\\shpwr" #define OOO_STRING_SVTOOLS_RTF_SHPZ "\\shpz" +#define OOO_STRING_SVTOOLS_RTF_SP "\\sp" #define OOO_STRING_SVTOOLS_RTF_SPRSBSP "\\sprsbsp" #define OOO_STRING_SVTOOLS_RTF_SPRSLNSP "\\sprslnsp" #define OOO_STRING_SVTOOLS_RTF_SPRSTSM "\\sprstsm" @@ -1116,6 +1121,7 @@ #define OOO_STRING_SVTOOLS_RTF_SHP "\\shp" #define OOO_STRING_SVTOOLS_RTF_SN "\\sn" #define OOO_STRING_SVTOOLS_RTF_SV "\\sv" +#define OOO_STRING_SVTOOLS_RTF_SP "\\sp" // Support for overline attributes #define OOO_STRING_SVTOOLS_RTF_OL "\\ol" @@ -1138,4 +1144,11 @@ #define OOO_STRING_SVTOOLS_RTF_OLHWAVE "\\olhwave" #define OOO_STRING_SVTOOLS_RTF_OLOLDBWAVE "\\ololdbwave" +// Support for nested tables +#define OOO_STRING_SVTOOLS_RTF_ITAP "\\itap" +#define OOO_STRING_SVTOOLS_RTF_NESTCELL "\\nestcell" +#define OOO_STRING_SVTOOLS_RTF_NESTTABLEPROPRS "\\nesttableprops" +#define OOO_STRING_SVTOOLS_RTF_NESTROW "\\nestrow" +#define OOO_STRING_SVTOOLS_RTF_NONESTTABLES "\\nonesttables" + #endif // _RTFKEYWD_HXX diff --git a/svtools/inc/rtftoken.h b/svtools/inc/rtftoken.h index e75254487312..f292682a0236 100644 --- a/svtools/inc/rtftoken.h +++ b/svtools/inc/rtftoken.h @@ -1258,7 +1258,7 @@ enum RTF_TOKEN_IDS { RTF_SOUTLVL, // shapes - RTF_SHP, RTF_SN, RTF_SV + RTF_SHP, RTF_SN, RTF_SV, RTF_SP /* RTF_SHPLEFT, RTF_SHPTOP, 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/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 6781efc070fe..4aaa55409266 100644..100755 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -41,10 +41,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XRow.hpp> - -#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HDL_ -#include <com/sun/star/task/XInteractionHandler.hdl> -#endif +#include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/ucb/NumberedSortingInfo.hpp> #include <com/sun/star/ucb/XAnyCompareFactory.hpp> #include <com/sun/star/ucb/XProgressHandler.hpp> @@ -165,7 +162,7 @@ SvtMatchContext_Impl::SvtMatchContext_Impl( SvtURLBox* pBoxP, const String& rText ) : aLink( STATIC_LINK( this, SvtMatchContext_Impl, Select_Impl ) ) , aBaseURL( pBoxP->aBaseURL ) - , aText( rText ) + , aText( rText ) , pBox( pBoxP ) , bStop( FALSE ) , bOnlyDirectories( pBoxP->bOnlyDirectories ) @@ -426,7 +423,7 @@ void SvtMatchContext_Impl::ReadFolder( const String& rURL, uno::Reference< XDynamicResultSet > xDynResultSet; ResultSetInclude eInclude = INCLUDE_FOLDERS_AND_DOCUMENTS; if ( bOnlyDirectories ) - eInclude = INCLUDE_FOLDERS_ONLY; + eInclude = INCLUDE_FOLDERS_ONLY; xDynResultSet = aCnt.createDynamicCursor( aProps, eInclude ); @@ -654,7 +651,7 @@ void SvtMatchContext_Impl::run() { // if text input is a directory, it must be part of the match list! Until then it is scanned if ( UCBContentHelper::IsFolder( aMainURL ) && aURLObject.hasFinalSlash() ) - Insert( aText, aMatch ); + Insert( aText, aMatch ); else // otherwise the parent folder will be taken aURLObject.removeSegment(); @@ -684,6 +681,7 @@ void SvtMatchContext_Impl::run() aCurObj.SetURL( *aPickList.GetObject( nPos ) ); aCurObj.SetSmartURL( aCurObj.GetURLNoPass()); aCurMainURL = aCurObj.GetMainURL( INetURLObject::NO_DECODE ); + if( eProt != INET_PROT_NOT_VALID && aCurObj.GetProtocol() != eProt ) continue; @@ -708,7 +706,7 @@ void SvtMatchContext_Impl::run() { // try if text matches the scheme String aScheme( INetURLObject::GetScheme( aCurObj.GetProtocol() ) ); - if ( aText.CompareTo( aScheme, aText.Len() ) == COMPARE_EQUAL && aText.Len() < aScheme.Len() ) + if ( aText.CompareIgnoreCaseToAscii( aScheme, aText.Len() ) == COMPARE_EQUAL && aText.Len() < aScheme.Len() ) { if( bFull ) aMatch = aCurObj.GetMainURL( INetURLObject::NO_DECODE ); @@ -727,7 +725,7 @@ void SvtMatchContext_Impl::run() aCurString.Erase( 0, aScheme.Len() ); } - if( aText.CompareTo( aCurString, aText.Len() )== COMPARE_EQUAL ) + if( aText.CompareIgnoreCaseToAscii( aCurString, aText.Len() )== COMPARE_EQUAL ) { if( bFull ) aMatch = aCurObj.GetMainURL( INetURLObject::NO_DECODE ); @@ -858,6 +856,7 @@ SvtURLBox::SvtURLBox( Window* pParent, const ResId& _rResId, INetProtocol eSmart void SvtURLBox::ImplInit() { pImp = new SvtURLBox_Impl(); + SetHelpId( ".uno:OpenURL" ); EnableAutocomplete( FALSE ); @@ -1314,7 +1313,7 @@ sal_Bool SvtURLBox_Impl::TildeParsing( return sal_False; // no such user #else pPasswd = getpwnam( OUStringToOString( OUString( aUserName ), RTL_TEXTENCODING_ASCII_US ).getStr() ); - if( pPasswd ) + if( pPasswd ) aParseTilde = String::CreateFromAscii( pPasswd->pw_dir ); else return sal_False; // no such user diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 6fcbd92597ba..011dd4cd7956 100644..100755 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -468,6 +468,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) BOOL bNoTicks = FALSE; // Groessenvorberechnung + // Sizes calculation BOOL bVertRight = FALSE; if ( mnWinStyle & WB_HORZ ) nTickWidth = aPixSize.Width(); @@ -486,19 +487,21 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) } long nMaxWidth = maVirDev.PixelToLogic( Size( mpData->nPageWidth, 0 ), maMapMode ).Width(); if ( nMaxWidth < 0 ) - nMaxWidth *= -1; + nMaxWidth = -nMaxWidth; nMaxWidth /= aImplRulerUnitTab[mnUnitIndex].nTickUnit; UniString aNumStr( UniString::CreateFromInt32( nMaxWidth ) ); long nTxtWidth = GetTextWidth( aNumStr ); - if ( (nTxtWidth*2) > nTickWidth ) + + const long nTextOff = 4; + if ( nTickWidth < nTxtWidth+nTextOff ) { + // Calculate the scale of the ruler long nMulti = 1; long nOrgTick3 = nTick3; - long nTextOff = 2; while ( nTickWidth < nTxtWidth+nTextOff ) { long nOldMulti = nMulti; - if ( !nTickWidth ) + if ( !nTickWidth ) //If nTickWidth equals 0 nMulti *= 10; else if ( nMulti < 10 ) nMulti++; @@ -516,8 +519,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) bNoTicks = TRUE; break; } - if ( nMulti >= 100 ) - nTextOff = 4; + nTick3 = nOrgTick3 * nMulti; aPixSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode ); if ( mnWinStyle & WB_HORZ ) @@ -541,7 +543,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) { if ( nStart > nMin ) { - // Nur 0 malen, wenn Margin1 nicht gleich dem NullPunkt ist + // 0 is only painted when Margin1 is not equal to zero if ( (mpData->nMargin1Style & RULER_STYLE_INVISIBLE) || (mpData->nMargin1 != 0) ) { aNumStr = (sal_Unicode)'0'; @@ -564,7 +566,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) else n = aPixSize.Height(); - // Tick3 - Ausgabe (Text) + // Tick3 - Output (Text) if ( !(nTick % nTick3) ) { aNumStr = UniString::CreateFromInt32( nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit ); @@ -573,7 +575,9 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) nX = nStart+n; //different orientation needs a different starting position nY = bVertRight ? nCenter+nTxtHeight2 : nCenter-nTxtHeight2; - if ( nX < nMax ) + + // Check if we can display full number + if ( nX < (nMax-nTxtWidth2) ) { if ( mnWinStyle & WB_HORZ ) nX -= nTxtWidth2; @@ -582,7 +586,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) ImplVDrawText( nX, nY, aNumStr ); } nX = nStart-n; - if ( nX > nMin ) + if ( nX > (nMin+nTxtWidth2) ) { if ( mnWinStyle & WB_HORZ ) nX -= nTxtWidth2; @@ -591,7 +595,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) ImplVDrawText( nX, nY, aNumStr ); } } - // Tick/Tick2 - Ausgabe (Striche) + // Tick/Tick2 - Output (Strokes) else { if ( !(nTick % aImplRulerUnitTab[mnUnitIndex].nTick2) ) @@ -1258,7 +1262,7 @@ void Ruler::ImplFormat() Size aVirDevSize; BOOL b3DLook = !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO); - // VirtualDevice initialisieren + // VirtualDevice initialize if ( mnWinStyle & WB_HORZ ) { aVirDevSize.Width() = mnVirWidth; @@ -1387,15 +1391,15 @@ void Ruler::ImplFormat() if ( nP2 < nVirRight ) nMax--; - // Beschriftung ausgeben + // Draw captions ImplDrawTicks( nMin, nMax, nStart, nCenter ); } - // Spalten ausgeben + // Draw borders if ( mpData->pBorders ) ImplDrawBorders( nVirLeft, nP2, nVirTop, nVirBottom ); - // Einzuege ausgeben + // Draw indents if ( mpData->pIndents ) ImplDrawIndents( nVirLeft, nP2, nVirTop-1, nVirBottom+1 ); @@ -2888,7 +2892,7 @@ void Ruler::SetMargin2( long nPos, USHORT nMarginStyle ) void Ruler::SetLines( USHORT n, const RulerLine* pLineAry ) { - // Testen, ob sich was geaendert hat + // To determine if what has changed if ( mpData->nLines == n ) { USHORT i = n; @@ -2907,18 +2911,18 @@ void Ruler::SetLines( USHORT n, const RulerLine* pLineAry ) return; } - // Neue Werte setzen und neu ausgeben + // New values and new share issue BOOL bMustUpdate; if ( IsReallyVisible() && IsUpdateMode() ) bMustUpdate = TRUE; else bMustUpdate = FALSE; - // Alte Linien loeschen + // Delete old lines if ( bMustUpdate ) ImplInvertLines(); - // Neue Daten setzen + // New data set if ( !n || !pLineAry ) { if ( !mpData->pLines ) 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/svrtf/rtfkey2.cxx b/svtools/source/svrtf/rtfkey2.cxx index 03a7667f48e2..a4335302f475 100644 --- a/svtools/source/svrtf/rtfkey2.cxx +++ b/svtools/source/svrtf/rtfkey2.cxx @@ -1128,6 +1128,7 @@ sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SOUTLVL, "\\soutlvl" ); sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHP, "\\shp" ); sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SN, "\\sn" ); sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SV, "\\sv" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SP, "\\sp" ); /* sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPLEFT, "\\shpleft" ); sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPTOP, "\\shptop" ); diff --git a/svtools/source/svrtf/rtfkeywd.cxx b/svtools/source/svrtf/rtfkeywd.cxx index 27ce3643f8cf..9b29951ddbbf 100644 --- a/svtools/source/svrtf/rtfkeywd.cxx +++ b/svtools/source/svrtf/rtfkeywd.cxx @@ -1160,6 +1160,7 @@ static RTF_TokenEntry __FAR_DATA aRTFTokenTab[] = { */ {{OOO_STRING_SVTOOLS_RTF_SN}, RTF_SN}, {{OOO_STRING_SVTOOLS_RTF_SV}, RTF_SV}, + {{OOO_STRING_SVTOOLS_RTF_SP}, RTF_SP}, // Support for overline attributes {{OOO_STRING_SVTOOLS_RTF_OL}, RTF_OL}, 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 2c69853aebed..cfa08c325573 100644 --- a/tools/inc/tools/wintypes.hxx +++ b/tools/inc/tools/wintypes.hxx @@ -270,9 +270,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/ucbhelper/inc/ucbhelper/simplenameclashresolverequest.hxx b/ucbhelper/inc/ucbhelper/simplenameclashresolverequest.hxx index 7f3da27ece7c..8ab8ead7cffb 100644 --- a/ucbhelper/inc/ucbhelper/simplenameclashresolverequest.hxx +++ b/ucbhelper/inc/ucbhelper/simplenameclashresolverequest.hxx @@ -37,7 +37,7 @@ namespace ucbhelper { /** * This class implements a simple name clash resolve interaction request. * Instances can be passed directly to XInteractionHandler::handle(...). Each - * instance contains an NameClashResolveRequest and two interaction + * instance contains a NameClashResolveRequest and two interaction * continuations: "Abort" and "SupplyName". Another continuation * ("ReplaceExistingData") may be supplied optionally. * @@ -56,11 +56,11 @@ public: * * @param rTargetFolderURL contains the URL of the folder that contains * the clashing resource. - * @param rClashingName contains the clashing name, + * @param rClashingName contains the clashing name. * @param rProposedNewName contains a proposal for the new name or is * empty. - * @param bSupportsOverwriteData indictes whether an - * InteractioneplaceExistingData continuation shall be supplied + * @param bSupportsOverwriteData indicates whether an + * InteractionReplaceExistingData continuation shall be supplied * with the interaction request. */ SimpleNameClashResolveRequest( const rtl::OUString & rTargetFolderURL, diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx index 8505472e1b1f..d6fc260f558b 100644 --- a/ucbhelper/source/client/proxydecider.cxx +++ b/ucbhelper/source/client/proxydecider.cxx @@ -51,13 +51,15 @@ using namespace com::sun::star; using namespace ucbhelper; -#define CONFIG_ROOT_KEY "org.openoffice.Inet/Settings" -#define PROXY_TYPE_KEY "ooInetProxyType" -#define NO_PROXY_LIST_KEY "ooInetNoProxy" -#define HTTP_PROXY_NAME_KEY "ooInetHTTPProxyName" -#define HTTP_PROXY_PORT_KEY "ooInetHTTPProxyPort" -#define FTP_PROXY_NAME_KEY "ooInetFTPProxyName" -#define FTP_PROXY_PORT_KEY "ooInetFTPProxyPort" +#define CONFIG_ROOT_KEY "org.openoffice.Inet/Settings" +#define PROXY_TYPE_KEY "ooInetProxyType" +#define NO_PROXY_LIST_KEY "ooInetNoProxy" +#define HTTP_PROXY_NAME_KEY "ooInetHTTPProxyName" +#define HTTP_PROXY_PORT_KEY "ooInetHTTPProxyPort" +#define HTTPS_PROXY_NAME_KEY "ooInetHTTPSProxyName" +#define HTTPS_PROXY_PORT_KEY "ooInetHTTPSProxyPort" +#define FTP_PROXY_NAME_KEY "ooInetFTPProxyName" +#define FTP_PROXY_PORT_KEY "ooInetFTPProxyPort" //========================================================================= namespace ucbhelper @@ -132,6 +134,7 @@ class InternetProxyDecider_Impl : { mutable osl::Mutex m_aMutex; InternetProxyServer m_aHttpProxy; + InternetProxyServer m_aHttpsProxy; InternetProxyServer m_aFtpProxy; const InternetProxyServer m_aEmptyProxy; sal_Int32 m_nProxyType; @@ -246,6 +249,63 @@ bool WildCard::Matches( const rtl::OUString& rString ) const } //========================================================================= +bool getConfigStringValue( + const uno::Reference< container::XNameAccess > & xNameAccess, + const char * key, + rtl::OUString & value ) +{ + try + { + if ( !( xNameAccess->getByName( rtl::OUString::createFromAscii( key ) ) + >>= value ) ) + { + OSL_ENSURE( sal_False, + "InternetProxyDecider - " + "Error getting config item value!" ); + return false; + } + } + catch ( lang::WrappedTargetException const & ) + { + return false; + } + catch ( container::NoSuchElementException const & ) + { + return false; + } + return true; +} + +//========================================================================= +bool getConfigInt32Value( + const uno::Reference< container::XNameAccess > & xNameAccess, + const char * key, + sal_Int32 & value ) +{ + try + { + uno::Any aValue = xNameAccess->getByName( + rtl::OUString::createFromAscii( key ) ); + if ( aValue.hasValue() && !( aValue >>= value ) ) + { + OSL_ENSURE( sal_False, + "InternetProxyDecider - " + "Error getting config item value!" ); + return false; + } + } + catch ( lang::WrappedTargetException const & ) + { + return false; + } + catch ( container::NoSuchElementException const & ) + { + return false; + } + return true; +} + +//========================================================================= //========================================================================= // // InternetProxyDecider_Impl Implementation. @@ -291,127 +351,43 @@ InternetProxyDecider_Impl::InternetProxyDecider_Impl( if ( xNameAccess.is() ) { - try - { - if ( !( xNameAccess->getByName( - rtl::OUString::createFromAscii( - PROXY_TYPE_KEY ) ) >>= m_nProxyType ) ) - { - OSL_ENSURE( sal_False, - "InternetProxyDecider - " - "Error getting config item value!" ); - } - } - catch ( lang::WrappedTargetException const & ) - { - } - catch ( container::NoSuchElementException const & ) - { - } + // *** Proxy type *** + getConfigInt32Value( + xNameAccess, PROXY_TYPE_KEY, m_nProxyType ); + // *** No proxy list *** rtl::OUString aNoProxyList; - try - { - if ( !( xNameAccess->getByName( - rtl::OUString::createFromAscii( - NO_PROXY_LIST_KEY ) ) >>= aNoProxyList ) ) - { - OSL_ENSURE( sal_False, - "InternetProxyDecider - " - "Error getting config item value!" ); - } - } - catch ( lang::WrappedTargetException const & ) - { - } - catch ( container::NoSuchElementException const & ) - { - } - + getConfigStringValue( + xNameAccess, NO_PROXY_LIST_KEY, aNoProxyList ); setNoProxyList( aNoProxyList ); - try - { - if ( !( xNameAccess->getByName( - rtl::OUString::createFromAscii( - HTTP_PROXY_NAME_KEY ) ) - >>= m_aHttpProxy.aName ) ) - { - OSL_ENSURE( sal_False, - "InternetProxyDecider - " - "Error getting config item value!" ); - } - } - catch ( lang::WrappedTargetException const & ) - { - } - catch ( container::NoSuchElementException const & ) - { - } + // *** HTTP *** + getConfigStringValue( + xNameAccess, HTTP_PROXY_NAME_KEY, m_aHttpProxy.aName ); m_aHttpProxy.nPort = -1; - try - { - uno::Any aValue = xNameAccess->getByName( - rtl::OUString::createFromAscii( - HTTP_PROXY_PORT_KEY ) ); - if ( aValue.hasValue() && - !( aValue >>= m_aHttpProxy.nPort ) ) - { - OSL_ENSURE( sal_False, - "InternetProxyDecider - " - "Error getting config item value!" ); - } - } - catch ( lang::WrappedTargetException const & ) - { - } - catch ( container::NoSuchElementException const & ) - { - } - + getConfigInt32Value( + xNameAccess, HTTP_PROXY_PORT_KEY, m_aHttpProxy.nPort ); if ( m_aHttpProxy.nPort == -1 ) m_aHttpProxy.nPort = 80; // standard HTTP port. - try - { - if ( !( xNameAccess->getByName( - rtl::OUString::createFromAscii( - FTP_PROXY_NAME_KEY ) ) - >>= m_aFtpProxy.aName ) ) - { - OSL_ENSURE( sal_False, - "InternetProxyDecider - " - "Error getting config item value!" ); - } - } - catch ( lang::WrappedTargetException const & ) - { - } - catch ( container::NoSuchElementException const & ) - { - } + // *** HTTPS *** + getConfigStringValue( + xNameAccess, HTTPS_PROXY_NAME_KEY, m_aHttpsProxy.aName ); + + m_aHttpsProxy.nPort = -1; + getConfigInt32Value( + xNameAccess, HTTPS_PROXY_PORT_KEY, m_aHttpsProxy.nPort ); + if ( m_aHttpsProxy.nPort == -1 ) + m_aHttpsProxy.nPort = 443; // standard HTTPS port. + + // *** FTP *** + getConfigStringValue( + xNameAccess, FTP_PROXY_NAME_KEY, m_aFtpProxy.aName ); m_aFtpProxy.nPort = -1; - try - { - uno::Any aValue = xNameAccess->getByName( - rtl::OUString::createFromAscii( - FTP_PROXY_PORT_KEY ) ); - if ( aValue.hasValue() && - !( aValue >>= m_aFtpProxy.nPort ) ) - { - OSL_ENSURE( sal_False, - "InternetProxyDecider - " - "Error getting config item value!" ); - } - } - catch ( lang::WrappedTargetException const & ) - { - } - catch ( container::NoSuchElementException const & ) - { - } + getConfigInt32Value( + xNameAccess, FTP_PROXY_PORT_KEY, m_aFtpProxy.nPort ); } // Register as listener for config changes. @@ -588,6 +564,12 @@ const InternetProxyServer & InternetProxyDecider_Impl::getProxy( if ( m_aFtpProxy.aName.getLength() > 0 && m_aFtpProxy.nPort >= 0 ) return m_aFtpProxy; } + else if ( rProtocol.toAsciiLowerCase() + .equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "https" ) ) ) + { + if ( m_aHttpsProxy.aName.getLength() ) + return m_aHttpsProxy; + } else if ( m_aHttpProxy.aName.getLength() ) { // All other protocols use the HTTP proxy. @@ -662,6 +644,29 @@ void SAL_CALL InternetProxyDecider_Impl::changesOccurred( m_aHttpProxy.nPort = 80; // standard HTTP port. } else if ( aKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( + HTTPS_PROXY_NAME_KEY ) ) ) + { + if ( !( rElem.Element >>= m_aHttpsProxy.aName ) ) + { + OSL_ENSURE( sal_False, + "InternetProxyDecider - changesOccurred - " + "Error getting config item value!" ); + } + } + else if ( aKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( + HTTPS_PROXY_PORT_KEY ) ) ) + { + if ( !( rElem.Element >>= m_aHttpsProxy.nPort ) ) + { + OSL_ENSURE( sal_False, + "InternetProxyDecider - changesOccurred - " + "Error getting config item value!" ); + } + + if ( m_aHttpsProxy.nPort == -1 ) + m_aHttpsProxy.nPort = 443; // standard HTTPS port. + } + else if ( aKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( FTP_PROXY_NAME_KEY ) ) ) { if ( !( rElem.Element >>= m_aFtpProxy.aName ) ) 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/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index df089fe17cb1..6402f5c60d75 100755 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -39,6 +39,8 @@ #include "vcl/cmdevt.hxx" #include "rtl/ustrbuf.hxx" +#include "vcl/impimagetree.hxx" + #include "premac.h" #import "Carbon/Carbon.h" #import "apple_remote/RemoteControl.h" @@ -431,6 +433,7 @@ GetpApp()->AppEvent( aEv ); // call DeInitVCL only after our YIELD_GUARD has expired, // else its Mutex will be alredy destroyed when it runs out of scope ! + ImplImageTreeSingletonRef()->shutDown(); bCallDeInit = true; } } diff --git a/vcl/inc/vcl/ilstbox.hxx b/vcl/inc/vcl/ilstbox.hxx index ac278f76f65b..6580538f5d10 100644 --- a/vcl/inc/vcl/ilstbox.hxx +++ b/vcl/inc/vcl/ilstbox.hxx @@ -36,6 +36,7 @@ #include <vcl/lstbox.h> #include <vcl/timer.hxx> +#include "vcl/quickselectionengine.hxx" class ScrollBar; class ScrollBarBox; @@ -193,13 +194,11 @@ public: // - ImplListBoxWindow - // --------------------- -class ImplListBoxWindow : public Control +class ImplListBoxWindow : public Control, public ::vcl::ISearchableStringList { private: ImplEntryList* mpEntryList; // EntryListe Rectangle maFocusRect; - String maSearchStr; - Timer maSearchTimeout; Size maUserItemSize; @@ -254,9 +253,10 @@ private: Link maUserDrawHdl; Link maMRUChangedHdl; -protected: - DECL_LINK( SearchStringTimeout, Timer* ); + ::vcl::QuickSelectionEngine + maQuickSelectionEngine; +protected: virtual void KeyInput( const KeyEvent& rKEvt ); virtual void MouseButtonDown( const MouseEvent& rMEvt ); virtual void MouseMove( const MouseEvent& rMEvt ); @@ -379,6 +379,12 @@ public: // pb: #106948# explicit mirroring for calc inline void EnableMirroring() { mbMirroring = TRUE; } inline BOOL IsMirroring() const { return mbMirroring; } + +protected: + // ISearchableStringList + virtual ::vcl::StringEntryIdentifier CurrentEntry( String& _out_entryText ) const; + virtual ::vcl::StringEntryIdentifier NextEntry( ::vcl::StringEntryIdentifier _currentEntry, String& _out_entryText ) const; + virtual void SelectEntry( ::vcl::StringEntryIdentifier _entry ); }; // --------------- diff --git a/vcl/inc/vcl/mnemonicengine.hxx b/vcl/inc/vcl/mnemonicengine.hxx index d12b3db2417e..fcd303510203 100644 --- a/vcl/inc/vcl/mnemonicengine.hxx +++ b/vcl/inc/vcl/mnemonicengine.hxx @@ -59,7 +59,7 @@ namespace vcl If this value is <NULL/>, searching stops. */ - virtual const void* FirstSearchEntry( String& _rEntryText ) = 0; + virtual const void* FirstSearchEntry( String& _rEntryText ) const = 0; /** returns the next list entry for the mnemonic search @@ -74,7 +74,7 @@ namespace vcl to <member>FirstSearchEntry</member> (i.e. you cycled around), then searching stops, too. */ - virtual const void* NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) = 0; + virtual const void* NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) const = 0; /** "selects" a given entry. @@ -117,7 +117,7 @@ namespace vcl the entry to select. This is the return value of a previous call to <member>FirstSearchEntry</member> or <member>NextSearchEntry</member>. */ - virtual void ExecuteSearchEntry( const void* _pEntry ) = 0; + virtual void ExecuteSearchEntry( const void* _pEntry ) const = 0; }; //==================================================================== diff --git a/vcl/inc/vcl/quickselectionengine.hxx b/vcl/inc/vcl/quickselectionengine.hxx new file mode 100644 index 000000000000..f70736428010 --- /dev/null +++ b/vcl/inc/vcl/quickselectionengine.hxx @@ -0,0 +1,95 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef VCL_QUICKSELECTIONENGINE_HXX +#define VCL_QUICKSELECTIONENGINE_HXX + +#include "dllapi.h" + +#include <tools/string.hxx> + +#include <memory> + +class KeyEvent; + +//........................................................................ +namespace vcl +{ +//........................................................................ + + typedef const void* StringEntryIdentifier; + + //==================================================================== + //= ISearchableStringList + //==================================================================== + // TODO: consolidate this with ::vcl::IMnemonicEntryList + class SAL_NO_VTABLE VCL_DLLPUBLIC ISearchableStringList + { + public: + /** returns the current entry in the list of searchable strings. + + Search operations will start with this entry. + */ + virtual StringEntryIdentifier CurrentEntry( String& _out_entryText ) const = 0; + + /** returns the next entry in the list. + + The implementation is expected to wrap around. That is, if the given entry denotes the last + entry in the list, then NextEntry should return the first entry. + */ + virtual StringEntryIdentifier NextEntry( StringEntryIdentifier _currentEntry, String& _out_entryText ) const = 0; + + /** selects a given entry + */ + virtual void SelectEntry( StringEntryIdentifier _entry ) = 0; + }; + + //==================================================================== + //= QuickSelectionEngine + //==================================================================== + struct QuickSelectionEngine_Data; + class VCL_DLLPUBLIC QuickSelectionEngine + { + public: + QuickSelectionEngine( ISearchableStringList& _entryList ); + ~QuickSelectionEngine(); + + bool HandleKeyEvent( const KeyEvent& _rKEvt ); + void Reset(); + + private: + ::std::auto_ptr< QuickSelectionEngine_Data > m_pData; + + private: + QuickSelectionEngine(); // never implemented + QuickSelectionEngine( const QuickSelectionEngine& ); // never implemented + QuickSelectionEngine& operator=( const QuickSelectionEngine& ); // never implemented + }; + +//........................................................................ +} // namespace vcl +//........................................................................ + +#endif // VCL_QUICKSELECTIONENGINE_HXX diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index f72036fadc35..3ed9725bf080 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -598,6 +598,7 @@ public: virtual void KeyUp( const KeyEvent& rKEvt ); virtual void PrePaint(); virtual void Paint( const Rectangle& rRect ); + virtual void PostPaint(); virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); virtual void Move(); virtual void Resize(); diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index 028118327e7b..3667e883afa6 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -76,6 +76,7 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\inc\vcl\metric.hxx %_DEST%\inc%_EXT%\vcl\metric.hxx ..\inc\vcl\mnemonic.hxx %_DEST%\inc%_EXT%\vcl\mnemonic.hxx ..\inc\vcl\mnemonicengine.hxx %_DEST%\inc%_EXT%\vcl\mnemonicengine.hxx +..\inc\vcl\quickselectionengine.hxx %_DEST%\inc%_EXT%\vcl\quickselectionengine.hxx ..\inc\vcl\morebtn.hxx %_DEST%\inc%_EXT%\vcl\morebtn.hxx ..\inc\vcl\msgbox.hxx %_DEST%\inc%_EXT%\vcl\msgbox.hxx ..\inc\vcl\octree.hxx %_DEST%\inc%_EXT%\vcl\octree.hxx diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index b4b7e3f80357..bd0179ffe454 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -529,7 +529,8 @@ USHORT ImplEntryList::FindFirstSelectable( USHORT nPos, bool bForward /* = true // ======================================================================= ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) : - Control( pParent, 0 ) + Control( pParent, 0 ), + maQuickSelectionEngine( *this ) { mpEntryList = new ImplEntryList( this ); @@ -568,9 +569,6 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) : SetTextFillColor(); SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) ); - maSearchTimeout.SetTimeout( 2500 ); - maSearchTimeout.SetTimeoutHdl( LINK( this, ImplListBoxWindow, SearchStringTimeout ) ); - ImplInitSettings( TRUE, TRUE, TRUE ); ImplCalcMetrics(); } @@ -579,7 +577,6 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) : ImplListBoxWindow::~ImplListBoxWindow() { - maSearchTimeout.Stop(); delete mpEntryList; } @@ -624,14 +621,6 @@ void ImplListBoxWindow::ImplCalcMetrics() // ----------------------------------------------------------------------- -IMPL_LINK( ImplListBoxWindow, SearchStringTimeout, Timer*, EMPTYARG ) -{ - maSearchStr.Erase(); - return 1; -} - -// ----------------------------------------------------------------------- - void ImplListBoxWindow::Clear() { mpEntryList->Clear(); @@ -648,6 +637,7 @@ void ImplListBoxWindow::Clear() ImplClearLayoutData(); mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; + maQuickSelectionEngine.Reset(); Invalidate(); } @@ -918,7 +908,7 @@ USHORT ImplListBoxWindow::GetLastVisibleEntry() const void ImplListBoxWindow::MouseButtonDown( const MouseEvent& rMEvt ) { mbMouseMoveSelect = FALSE; // Nur bis zum ersten MouseButtonDown - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); if ( !IsReadOnly() ) { @@ -1465,7 +1455,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) bDone = TRUE; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1492,7 +1482,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) bDone = TRUE; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1523,7 +1513,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) } bDone = TRUE; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1557,7 +1547,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) } bDone = TRUE; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1578,7 +1568,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) bDone = TRUE; } } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1604,7 +1594,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) } bDone = TRUE; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1615,7 +1605,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) ScrollHorz( -HORZ_SCROLL ); bDone = TRUE; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1626,7 +1616,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) ScrollHorz( HORZ_SCROLL ); bDone = TRUE; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1638,7 +1628,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) ImplCallSelect(); bDone = FALSE; // RETURN nicht abfangen. } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1653,7 +1643,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) } bDone = TRUE; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1673,7 +1663,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) SetUpdateMode( bUpdates ); Invalidate(); - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); bDone = TRUE; break; @@ -1682,43 +1672,12 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) // fall through intentional default: { - xub_Unicode c = rKEvt.GetCharCode(); - - if ( !IsReadOnly() && (c >= 32) && (c != 127) && !rKEvt.GetKeyCode().IsMod2() ) + if ( !IsReadOnly() ) { - maSearchStr += c; - XubString aTmpSearch( maSearchStr ); - - nSelect = mpEntryList->FindMatchingEntry( aTmpSearch, mnCurrentPos ); - if ( (nSelect == LISTBOX_ENTRY_NOTFOUND) && (aTmpSearch.Len() > 1) ) - { - // Wenn alles die gleichen Buchstaben, dann anderer Such-Modus - BOOL bAllEqual = TRUE; - for ( USHORT n = aTmpSearch.Len(); n && bAllEqual; ) - bAllEqual = aTmpSearch.GetChar( --n ) == c; - if ( bAllEqual ) - { - aTmpSearch = c; - nSelect = mpEntryList->FindMatchingEntry( aTmpSearch, mnCurrentPos+1 ); - } - } - if ( nSelect == LISTBOX_ENTRY_NOTFOUND ) - nSelect = mpEntryList->FindMatchingEntry( aTmpSearch, 0 ); - - if ( nSelect != LISTBOX_ENTRY_NOTFOUND ) - { - ShowProminentEntry( nSelect ); - - if ( mpEntryList->IsEntryPosSelected( nSelect ) ) - nSelect = LISTBOX_ENTRY_NOTFOUND; - - maSearchTimeout.Start(); - } - else - maSearchStr.Erase(); - bDone = TRUE; + bDone = maQuickSelectionEngine.HandleKeyEvent( rKEvt ); } - } + } + break; } if ( ( nSelect != LISTBOX_ENTRY_NOTFOUND ) @@ -1744,6 +1703,72 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) } // ----------------------------------------------------------------------- +namespace +{ + static ::vcl::StringEntryIdentifier lcl_getEntry( const ImplEntryList& _rList, USHORT _nPos, String& _out_entryText ) + { + OSL_PRECOND( ( _nPos != LISTBOX_ENTRY_NOTFOUND ), "lcl_getEntry: invalid position!" ); + USHORT nEntryCount( _rList.GetEntryCount() ); + if ( _nPos >= nEntryCount ) + _nPos = 0; + _out_entryText = _rList.GetEntryText( _nPos ); + + // ::vcl::StringEntryIdentifier does not allow for 0 values, but our position is 0-based + // => normalize + return reinterpret_cast< ::vcl::StringEntryIdentifier >( _nPos + 1 ); + } + + static USHORT lcl_getEntryPos( ::vcl::StringEntryIdentifier _entry ) + { + // our pos is 0-based, but StringEntryIdentifier does not allow for a NULL + return static_cast< USHORT >( reinterpret_cast< sal_Int64 >( _entry ) ) - 1; + } +} + +// ----------------------------------------------------------------------- +::vcl::StringEntryIdentifier ImplListBoxWindow::CurrentEntry( String& _out_entryText ) const +{ + return lcl_getEntry( *GetEntryList(), ( mnCurrentPos == LISTBOX_ENTRY_NOTFOUND ) ? 0 : mnCurrentPos + 1, _out_entryText ); +} + +// ----------------------------------------------------------------------- +::vcl::StringEntryIdentifier ImplListBoxWindow::NextEntry( ::vcl::StringEntryIdentifier _currentEntry, String& _out_entryText ) const +{ + USHORT nNextPos = lcl_getEntryPos( _currentEntry ) + 1; + return lcl_getEntry( *GetEntryList(), nNextPos, _out_entryText ); +} + +// ----------------------------------------------------------------------- +void ImplListBoxWindow::SelectEntry( ::vcl::StringEntryIdentifier _entry ) +{ + USHORT nSelect = lcl_getEntryPos( _entry ); + if ( mpEntryList->IsEntryPosSelected( nSelect ) ) + { + // ignore that. This method is a callback from the QuickSelectionEngine, which means the user attempted + // to select the given entry by typing its starting letters. No need to act. + return; + } + + // normalize + OSL_ENSURE( nSelect < mpEntryList->GetEntryCount(), "ImplListBoxWindow::SelectEntry: how that?" ); + if( nSelect >= mpEntryList->GetEntryCount() ) + nSelect = mpEntryList->GetEntryCount()-1; + + // make visible + ShowProminentEntry( nSelect ); + + // actually select + mnCurrentPos = nSelect; + if ( SelectEntries( nSelect, LET_KEYMOVE, FALSE, FALSE ) ) + { + mbTravelSelect = TRUE; + mnSelectModifier = 0; + ImplCallSelect(); + mbTravelSelect = FALSE; + } +} + +// ----------------------------------------------------------------------- void ImplListBoxWindow::ImplPaint( USHORT nPos, BOOL bErase, bool bLayout ) { diff --git a/vcl/source/control/makefile.mk b/vcl/source/control/makefile.mk index a2553333246d..b1644e58ccd9 100644 --- a/vcl/source/control/makefile.mk +++ b/vcl/source/control/makefile.mk @@ -62,7 +62,8 @@ SLOFILES= $(SLO)$/button.obj \ $(SLO)$/slider.obj \ $(SLO)$/spinfld.obj \ $(SLO)$/spinbtn.obj \ - $(SLO)$/tabctrl.obj + $(SLO)$/tabctrl.obj \ + $(SLO)$/quickselectionengine.obj EXCEPTIONSFILES= \ $(SLO)$/button.obj \ diff --git a/vcl/source/control/quickselectionengine.cxx b/vcl/source/control/quickselectionengine.cxx new file mode 100644 index 000000000000..2d32393bf79a --- /dev/null +++ b/vcl/source/control/quickselectionengine.cxx @@ -0,0 +1,183 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include "vcl/quickselectionengine.hxx" +#include "vcl/event.hxx" +#include "vcl/timer.hxx" +#include "vcl/i18nhelp.hxx" +#include "vcl/svapp.hxx" + +#include <boost/optional.hpp> + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= QuickSelectionEngine_Data + //==================================================================== + struct QuickSelectionEngine_Data + { + ISearchableStringList& rEntryList; + String sCurrentSearchString; + ::boost::optional< sal_Unicode > aSingleSearchChar; + Timer aSearchTimeout; + + QuickSelectionEngine_Data( ISearchableStringList& _entryList ) + :rEntryList( _entryList ) + ,sCurrentSearchString() + ,aSingleSearchChar() + ,aSearchTimeout() + { + aSearchTimeout.SetTimeout( 2500 ); + aSearchTimeout.SetTimeoutHdl( LINK( this, QuickSelectionEngine_Data, SearchStringTimeout ) ); + } + + ~QuickSelectionEngine_Data() + { + aSearchTimeout.Stop(); + } + + DECL_LINK( SearchStringTimeout, Timer* ); + }; + + //-------------------------------------------------------------------- + namespace + { + static void lcl_reset( QuickSelectionEngine_Data& _data ) + { + _data.sCurrentSearchString.Erase(); + _data.aSingleSearchChar.reset(); + _data.aSearchTimeout.Stop(); + } + } + + //-------------------------------------------------------------------- + IMPL_LINK( QuickSelectionEngine_Data, SearchStringTimeout, Timer*, /*EMPTYARG*/ ) + { + lcl_reset( *this ); + return 1; + } + + //-------------------------------------------------------------------- + static StringEntryIdentifier findMatchingEntry( const String& _searchString, QuickSelectionEngine_Data& _engineData ) + { + const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetLocaleI18nHelper(); + // TODO: do we really need the Window's settings here? The original code used it ... + + String sEntryText; + // get the "current + 1" entry + StringEntryIdentifier pSearchEntry = _engineData.rEntryList.CurrentEntry( sEntryText ); + if ( pSearchEntry ) + pSearchEntry = _engineData.rEntryList.NextEntry( pSearchEntry, sEntryText ); + // loop 'til we find another matching entry + StringEntryIdentifier pStartedWith = pSearchEntry; + while ( pSearchEntry ) + { + if ( rI18nHelper.MatchString( _searchString, sEntryText ) != 0 ) + break; + + pSearchEntry = _engineData.rEntryList.NextEntry( pSearchEntry, sEntryText ); + if ( pSearchEntry == pStartedWith ) + pSearchEntry = NULL; + } + + return pSearchEntry; + } + + //==================================================================== + //= QuickSelectionEngine + //==================================================================== + //-------------------------------------------------------------------- + QuickSelectionEngine::QuickSelectionEngine( ISearchableStringList& _entryList ) + :m_pData( new QuickSelectionEngine_Data( _entryList ) ) + { + } + + //-------------------------------------------------------------------- + QuickSelectionEngine::~QuickSelectionEngine() + { + } + + //-------------------------------------------------------------------- + bool QuickSelectionEngine::HandleKeyEvent( const KeyEvent& _keyEvent ) + { + xub_Unicode c = _keyEvent.GetCharCode(); + + if ( ( c >= 32 ) && ( c != 127 ) && !_keyEvent.GetKeyCode().IsMod2() ) + { + m_pData->sCurrentSearchString += c; + OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: searching for %s", ByteString( m_pData->sCurrentSearchString, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); + + if ( m_pData->sCurrentSearchString.Len() == 1 ) + { // first character in the search -> remmeber + m_pData->aSingleSearchChar.reset( c ); + } + else if ( m_pData->sCurrentSearchString.Len() > 1 ) + { + if ( !!m_pData->aSingleSearchChar && ( *m_pData->aSingleSearchChar != c ) ) + // we already have a "single char", but the current one is different -> reset + m_pData->aSingleSearchChar.reset(); + } + + XubString aSearchTemp( m_pData->sCurrentSearchString ); + + StringEntryIdentifier pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData ); + OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: found %p", pMatchingEntry ); + if ( !pMatchingEntry && ( aSearchTemp.Len() > 1 ) && !!m_pData->aSingleSearchChar ) + { + // if there's only one letter in the search string, use a different search mode + aSearchTemp = *m_pData->aSingleSearchChar; + pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData ); + } + + if ( pMatchingEntry ) + { + m_pData->rEntryList.SelectEntry( pMatchingEntry ); + m_pData->aSearchTimeout.Start(); + } + else + { + lcl_reset( *m_pData ); + } + + return true; + } + return false; + } + + //-------------------------------------------------------------------- + void QuickSelectionEngine::Reset() + { + lcl_reset( *m_pData ); + } + +//........................................................................ +} // namespace vcl +//........................................................................ diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index a011e4ee4a92..847a8d7a299a 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -2495,6 +2495,9 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, const bool bDashUsed(LINE_DASH == aInfo.GetStyle()); const bool bLineWidthUsed(aInfo.GetWidth() > 1); + if ( mbInitLineColor ) + ImplInitLineColor(); + if(bDashUsed || bLineWidthUsed) { basegfx::B2DPolygon aLinePolygon; @@ -2505,9 +2508,6 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, } else { - if ( mbInitLineColor ) - ImplInitLineColor(); - mpGraphics->DrawLine( aStartPt.X(), aStartPt.Y(), aEndPt.X(), aEndPt.Y(), this ); } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 0c91d0a0bc16..d423f25e3dab 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -4882,6 +4882,12 @@ void Window::Paint( const Rectangle& rRect ) // ----------------------------------------------------------------------- +void Window::PostPaint() +{ +} + +// ----------------------------------------------------------------------- + void Window::Draw( OutputDevice*, const Point&, const Size&, ULONG ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx index b2549573d099..587e58be5bc7 100644 --- a/vcl/unx/source/printer/ppdparser.cxx +++ b/vcl/unx/source/printer/ppdparser.cxx @@ -405,51 +405,53 @@ void PPDParser::scanPPDDir( const String& rDir ) const int nSuffixes = sizeof(pSuffixes)/sizeof(pSuffixes[0]); osl::Directory aDir( rDir ); - aDir.open(); - osl::DirectoryItem aItem; - - INetURLObject aPPDDir(rDir); - while( aDir.getNextItem( aItem ) == osl::FileBase::E_None ) + if ( aDir.open() == osl::FileBase::E_None ) { - osl::FileStatus aStatus( FileStatusMask_FileName ); - if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None ) + osl::DirectoryItem aItem; + + INetURLObject aPPDDir(rDir); + while( aDir.getNextItem( aItem ) == osl::FileBase::E_None ) { - rtl::OUStringBuffer aURLBuf( rDir.Len() + 64 ); - aURLBuf.append( rDir ); - aURLBuf.append( sal_Unicode( '/' ) ); - aURLBuf.append( aStatus.getFileName() ); + osl::FileStatus aStatus( FileStatusMask_FileName ); + if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None ) + { + rtl::OUStringBuffer aURLBuf( rDir.Len() + 64 ); + aURLBuf.append( rDir ); + aURLBuf.append( sal_Unicode( '/' ) ); + aURLBuf.append( aStatus.getFileName() ); - rtl::OUString aFileURL, aFileName; - osl::FileStatus::Type eType = osl::FileStatus::Unknown; + rtl::OUString aFileURL, aFileName; + osl::FileStatus::Type eType = osl::FileStatus::Unknown; - if( resolveLink( aURLBuf.makeStringAndClear(), aFileURL, aFileName, eType ) == osl::FileBase::E_None ) - { - if( eType == osl::FileStatus::Regular ) + if( resolveLink( aURLBuf.makeStringAndClear(), aFileURL, aFileName, eType ) == osl::FileBase::E_None ) { - INetURLObject aPPDFile = aPPDDir; - aPPDFile.Append( aFileName ); - - // match extension - for( int nSuffix = 0; nSuffix < nSuffixes; nSuffix++ ) + if( eType == osl::FileStatus::Regular ) { - if( aFileName.getLength() > pSuffixes[nSuffix].nSuffixLen ) + INetURLObject aPPDFile = aPPDDir; + aPPDFile.Append( aFileName ); + + // match extension + for( int nSuffix = 0; nSuffix < nSuffixes; nSuffix++ ) { - if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) ) + if( aFileName.getLength() > pSuffixes[nSuffix].nSuffixLen ) { - (*pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName(); - break; + if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) ) + { + (*pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName(); + break; + } } } } - } - else if( eType == osl::FileStatus::Directory ) - { - scanPPDDir( aFileURL ); + else if( eType == osl::FileStatus::Directory ) + { + scanPPDDir( aFileURL ); + } } } } + aDir.close(); } - aDir.close(); } void PPDParser::initPPDFiles() |