diff options
125 files changed, 2093 insertions, 2307 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/scripts/keyidGen.pl b/l10ntools/scripts/keyidGen.pl index 2a4ac5caefc3..53423c2d6f02 100644 --- a/l10ntools/scripts/keyidGen.pl +++ b/l10ntools/scripts/keyidGen.pl @@ -112,7 +112,7 @@ sub makenumber $h = shift; # 1 2 3 4 # 1234567890123456789012345678901234567890 - $symbols="0123456789abcdefghijklmnopqrstuvwxyz+-<=>"; + $symbols="0123456789abcdefghijklmnopqrstuvwxyz+-[=]"; $order = length($symbols); $result = ""; while ( length( $result ) < 6 ) diff --git a/l10ntools/scripts/localize.pl b/l10ntools/scripts/localize.pl index 230b6d46f395..323f7fe549b6 100755 --- a/l10ntools/scripts/localize.pl +++ b/l10ntools/scripts/localize.pl @@ -175,8 +175,9 @@ sub splitfile{ exit( -1 ); } my $src_root = $ENV{SOURCE_ROOT_DIR}; + my $ooo_src_root = $ENV{SRC_ROOT}; my $so_l10n_path = $src_root."/sun/l10n_so/source"; - my $ooo_l10n_path = $src_root."/ooo/l10n/source"; + my $ooo_l10n_path = $ooo_src_root."/l10n/source"; #print "$so_l10n_path\n"; #print "$ooo_l10n_path\n"; 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/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 5df3044bd6d3..26b3c48998f3 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -66,7 +66,7 @@ bool Converter::convertMeasure( sal_Int32& rValue, bool bNeg = false; double nVal = 0; - sal_Int32 nPos = 0L; + sal_Int32 nPos = 0; sal_Int32 nLen = rString.getLength(); // skip white space @@ -579,7 +579,7 @@ bool Converter::convertNumber( sal_Int32& rValue, bool bNeg = false; rValue = 0; - sal_Int32 nPos = 0L; + sal_Int32 nPos = 0; sal_Int32 nLen = rString.getLength(); // skip white space diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx index 504fed55ce4d..8c553d0f8a32 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/svl/inc/svl/itempool.hxx b/svl/inc/svl/itempool.hxx index cbc6b7c4dd11..daaa2b481ba3 100644 --- a/svl/inc/svl/itempool.hxx +++ b/svl/inc/svl/itempool.hxx @@ -104,7 +104,7 @@ class SVL_DLLPUBLIC SfxItemPool */ { - SVL_DLLPRIVATE void readTheItems(SvStream & rStream, USHORT nCount, USHORT nVersion, + SVL_DLLPRIVATE void readTheItems(SvStream & rStream, sal_uInt32 nCount, USHORT nVersion, SfxPoolItem * pDefItem, SfxPoolItemArray_Impl ** pArr); UniString aName; @@ -208,9 +208,9 @@ public: const SfxPoolItem &rItem, FASTBOOL bDirect = FALSE ) const; - USHORT GetSurrogate(const SfxPoolItem *) const; - const SfxPoolItem * GetItem(USHORT nWhich, USHORT nSurrogate) const; - USHORT GetItemCount(USHORT nWhich) const; + sal_uInt32 GetSurrogate(const SfxPoolItem *) const; + const SfxPoolItem * GetItem2(USHORT nWhich, sal_uInt32 nSurrogate) const; + sal_uInt32 GetItemCount2(USHORT nWhich) const; const SfxPoolItem* LoadSurrogate(SvStream& rStream, USHORT &rWhich, USHORT nSlotId, const SfxItemPool* pRefPool = 0 ); diff --git a/svl/inc/svl/poolcach.hxx b/svl/inc/svl/poolcach.hxx index 949c0aee5bad..78bdca8177e6 100644 --- a/svl/inc/svl/poolcach.hxx +++ b/svl/inc/svl/poolcach.hxx @@ -29,13 +29,24 @@ #include "svl/svldllapi.h" #include <tools/solar.h> +#include <vector> + +//------------------------------------------------------------------------ -class SfxItemModifyArr_Impl; class SfxItemPool; class SfxItemSet; class SfxPoolItem; class SfxSetItem; +struct SfxItemModifyImpl +{ + const SfxSetItem *pOrigItem; + SfxSetItem *pPoolItem; +}; + +typedef std::vector<SfxItemModifyImpl> SfxItemModifyArr_Impl; + + class SVL_DLLPUBLIC SfxItemPoolCache { SfxItemPool *pPool; diff --git a/svl/inc/svl/poolitem.hxx b/svl/inc/svl/poolitem.hxx index c0cf53fb6ded..d78e32877440 100644 --- a/svl/inc/svl/poolitem.hxx +++ b/svl/inc/svl/poolitem.hxx @@ -50,8 +50,9 @@ class IntlWrapper; namespace com { namespace sun { namespace star { namespace uno { class Any; } } } } -#define SFX_ITEMS_DIRECT 0xffff -#define SFX_ITEMS_NULL 0xfff0 // anstelle StoreSurrogate +static const sal_uInt32 SFX_ITEMS_DIRECT= 0xffffffff; +static const sal_uInt32 SFX_ITEMS_NULL= 0xfffffff0; // instead StoreSurrogate +static const sal_uInt32 SFX_ITEMS_DEFAULT= 0xfffffffe; #define SFX_ITEMS_POOLDEFAULT 0xffff #define SFX_ITEMS_STATICDEFAULT 0xfffe diff --git a/svl/inc/svl/svarray.hxx b/svl/inc/svl/svarray.hxx index 99b2901b95f9..d48998247eeb 100644 --- a/svl/inc/svl/svarray.hxx +++ b/svl/inc/svl/svarray.hxx @@ -39,12 +39,6 @@ * enthaelt. (Sie werden im Speicher verschoben, koennen also * z.B. keine String sein) * -* SV_DECL_OBJARR(nm, AE, IS, GS) -* SV_IMPL_OBJARR( nm, AE ) -* definiere/implementiere ein Array das Objecte enthaelt. -* (Hier koennen es auch Strings sein) -* -* * SV_DECL_PTRARR(nm, AE, IS, GS) * SV_IMPL_PTRARR(nm, AE) * definiere/implementiere ein Array das Pointer haelt. Diese @@ -86,10 +80,6 @@ * Basiert auf einem VARARR. * Sortierung mit Hilfe der Object-operatoren "<" und "==" * -* JP 23.12.94 neu: -* SV_DECL_PTRARR_STACK(nm, AE, IS, GS) -* ein Stack mit einem PtrArray als Grundlage. -* * JP 09.10.96: vordefinierte Arrays: * VarArr: SvBools, SvULongs, SvUShorts, SvLongs, SvShorts * PtrArr: SvStrings, SvStringsDtor @@ -207,8 +197,6 @@ public:\ #define _SV_DECL_VARARR(nm, AE, IS, GS ) \ _SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE & ) -#define _SV_DECL_VARARR_PLAIN(nm, AE, IS, GS ) \ -_SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE ) #define SV_DECL_VARARR_GEN(nm, AE, IS, GS, AERef, vis )\ _SV_DECL_VARARR_GEN(nm, AE, IS, GS, AERef, vis )\ @@ -219,15 +207,10 @@ nm& operator=( const nm& );\ #define SV_DECL_VARARR(nm, AE, IS, GS ) \ SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE &, ) -#define SV_DECL_VARARR_PLAIN(nm, AE, IS, GS ) \ -SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE, ) #define SV_DECL_VARARR_VISIBILITY(nm, AE, IS, GS, vis ) \ SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE &, vis ) -#define SV_DECL_VARARR_PLAIN_VISIBILITY(nm, AE, IS, GS, vis ) \ -SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE, vis ) - #define SV_IMPL_VARARR_GEN( nm, AE, AERef )\ nm::nm( USHORT nInit, BYTE )\ : pData (0),\ @@ -329,192 +312,6 @@ _SVVARARR_IMPL_GET_OP_INLINE(nm, AE )\ #define SV_IMPL_VARARR( nm, AE ) \ SV_IMPL_VARARR_GEN( nm, AE, AE & ) -#define SV_IMPL_VARARR_PLAIN( nm, AE ) \ -SV_IMPL_VARARR_GEN( nm, AE, AE ) - -#if defined(PRODUCT) - -#define _SVOBJARR_DEF_GET_OP_INLINE( nm,ArrElem )\ -ArrElem& operator[](USHORT nP) const { return *(pData+nP); }\ -\ -void Insert( const nm *pI, USHORT nP,\ - USHORT nS = 0, USHORT nE = USHRT_MAX )\ -{\ - if( USHRT_MAX == nE ) \ - nE = pI->nA; \ - if( nS < nE ) \ - Insert( (const ArrElem*)pI->pData+nS, (USHORT)nE-nS, nP );\ -} - -#define _SVOBJARR_IMPL_GET_OP_INLINE( nm, ArrElem ) - -#else - -#define _SVOBJARR_DEF_GET_OP_INLINE( nm,ArrElem ) \ -ArrElem& operator[](USHORT nP) const;\ -void Insert( const nm *pI, USHORT nP,\ - USHORT nS = 0, USHORT nE = USHRT_MAX ); - -#define _SVOBJARR_IMPL_GET_OP_INLINE( nm, ArrElem )\ -ArrElem& nm::operator[](USHORT nP) const\ -{\ - DBG_ASSERT( pData && nP < nA,"Op[]");\ - return *(pData+nP);\ -}\ -void nm::Insert( const nm *pI, USHORT nP, USHORT nStt, USHORT nE )\ -{\ - DBG_ASSERT( nP <= nA,"Ins,Ar[Start.End]");\ - if( USHRT_MAX == nE ) \ - nE = pI->nA; \ - if( nStt < nE ) \ - Insert( (const ArrElem*)pI->pData+nStt, (USHORT)nE-nStt, nP );\ -} - -#endif - -#define _SV_DECL_OBJARR(nm, AE, IS, GS)\ -typedef BOOL (*FnForEach_##nm)( const AE&, void* );\ -class nm\ -{\ -protected:\ - AE *pData;\ - USHORT nFree;\ - USHORT nA;\ -\ - void _resize(size_t n);\ - void _destroy();\ -\ -public:\ - nm( USHORT= IS, BYTE= GS );\ - ~nm() { _destroy(); }\ -\ - _SVOBJARR_DEF_GET_OP_INLINE(nm,AE)\ - AE& GetObject(USHORT nP) const { return (*this)[nP]; } \ -\ - void Insert( const AE &aE, USHORT nP );\ - void Insert( const AE *pE, USHORT nL, USHORT nP );\ - void Remove( USHORT nP, USHORT nL = 1 );\ - USHORT Count() const { return nA; }\ - const AE* GetData() const { return (const AE*)pData; }\ -\ - void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( 0, nA, fnForEach, pArgs );\ - }\ - void ForEach( USHORT nS, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( nS, nE, fnForEach, pArgs );\ - }\ -\ - void _ForEach( USHORT nStt, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnCall, void* pArgs = 0 );\ -\ - -#define SV_DECL_OBJARR(nm, AE, IS, GS)\ -_SV_DECL_OBJARR(nm, AE, IS, GS)\ -private:\ -nm( const nm& );\ -nm& operator=( const nm& );\ -}; - -#define SV_IMPL_OBJARR( nm, AE )\ -nm::nm( USHORT nInit, BYTE )\ - : pData (0),\ - nFree (nInit),\ - nA (0)\ -{\ - if( nInit )\ - {\ - pData = (AE*)(rtl_allocateMemory(sizeof(AE) * nInit));\ - DBG_ASSERT( pData, "CTOR, allocate");\ - }\ -}\ -\ -void nm::_destroy()\ -{\ - if(pData)\ - {\ - AE* pTmp=pData;\ - for(USHORT n=0; n < nA; n++,pTmp++ )\ - {\ - pTmp->~AE();\ - }\ - rtl_freeMemory(pData);\ - pData = 0;\ - }\ -}\ -\ -void nm::_resize (size_t n)\ -{\ - USHORT nL = ((n < USHRT_MAX) ? USHORT(n) : USHRT_MAX);\ - AE* pE = (AE*)(rtl_reallocateMemory (pData, sizeof(AE) * nL));\ - if ((pE != 0) || (nL == 0))\ - {\ - pData = pE;\ - nFree = nL - nA;\ - }\ -}\ -\ -void nm::Insert( const AE &aE, USHORT nP )\ -{\ - DBG_ASSERT( nP <= nA && nA < USHRT_MAX,"Ins 1");\ - if (nFree < 1)\ - _resize (nA + ((nA > 1) ? nA : 1));\ - if( pData && nP < nA )\ - memmove( pData+nP+1, pData+nP, (nA-nP) * sizeof( AE ));\ - AE* pTmp = pData+nP;\ - new( (DummyType*) pTmp ) AE( (AE&)aE );\ - ++nA; --nFree;\ -}\ -\ -void nm::Insert( const AE* pE, USHORT nL, USHORT nP )\ -{\ - DBG_ASSERT(nP<=nA && ((long)nA+nL) < USHRT_MAX, "Ins n");\ - if (nFree < nL)\ - _resize (nA + ((nA > nL) ? nA : nL));\ - if( pData && nP < nA )\ - memmove( pData+nP+nL, pData+nP, (nA-nP) * sizeof( AE ));\ - if( pE )\ - {\ - AE* pTmp = pData+nP;\ - for( USHORT n = 0; n < nL; n++, pTmp++, pE++)\ - {\ - new( (DummyType*) pTmp ) AE( (AE&)*pE );\ - }\ - }\ - nA = nA + nL; nFree = nFree - nL;\ -}\ -\ -void nm::Remove( USHORT nP, USHORT nL )\ -{\ - if( !nL )\ - return;\ - DBG_ASSERT( nP < nA && nP + nL <= nA,"Del");\ - AE* pTmp=pData+nP;\ - USHORT nCtr = nP;\ - for(USHORT n=0; n < nL; n++,pTmp++,nCtr++)\ - {\ - if( nCtr < nA )\ - pTmp->~AE();\ - }\ - if( pData && nP+1 < nA )\ - memmove( pData+nP, pData+nP+nL, (nA-nP-nL) * sizeof( AE ));\ - nA = nA - nL; nFree = nFree + nL;\ - if (nFree > nA) \ - _resize (nA);\ -}\ -\ -void nm::_ForEach( USHORT nStt, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnCall, void* pArgs )\ -{\ - if( nStt >= nE || nE > nA )\ - return;\ - for( ; nStt < nE && (*fnCall)( *(pData+nStt), pArgs ); nStt++)\ - ;\ -}\ -\ -_SVOBJARR_IMPL_GET_OP_INLINE(nm, AE)\ #define _SV_DECL_PTRARR_DEF_GEN( nm, AE, IS, GS, AERef, vis )\ _SV_DECL_VARARR_GEN( nm, AE, IS, GS, AERef, vis)\ @@ -523,8 +320,6 @@ USHORT GetPos( const AERef aE ) const;\ #define _SV_DECL_PTRARR_DEF( nm, AE, IS, GS, vis )\ _SV_DECL_PTRARR_DEF_GEN( nm, AE, IS, GS, AE &, vis ) -#define _SV_DECL_PTRARR_DEF_PLAIN( nm, AE, IS, GS, vis )\ -_SV_DECL_PTRARR_DEF_GEN( nm, AE, IS, GS, AE, vis ) #define SV_DECL_PTRARR_GEN(nm, AE, IS, GS, Base, AERef, VPRef, vis )\ typedef BOOL (*FnForEach_##nm)( const AERef, void* );\ @@ -580,13 +375,9 @@ private:\ #define SV_DECL_PTRARR(nm, AE, IS, GS )\ SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, ) -#define SV_DECL_PTRARR_PLAIN(nm, AE, IS, GS )\ -SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, ) #define SV_DECL_PTRARR_VISIBILITY(nm, AE, IS, GS, vis )\ SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, vis ) -#define SV_DECL_PTRARR_PLAIN_VISIBILITY(nm, AE, IS, GS, vis )\ -SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, vis ) #define SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, Base, AERef, VPRef, vis )\ typedef BOOL (*FnForEach_##nm)( const AERef, void* );\ @@ -643,13 +434,9 @@ private:\ #define SV_DECL_PTRARR_DEL(nm, AE, IS, GS )\ SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, ) -#define SV_DECL_PTRARR_DEL_PLAIN(nm, AE, IS, GS )\ -SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, ) #define SV_DECL_PTRARR_DEL_VISIBILITY(nm, AE, IS, GS, vis )\ SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, vis) -#define SV_DECL_PTRARR_DEL_PLAIN_VISIBILITY(nm, AE, IS, GS, vis )\ -SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, vis) #define SV_IMPL_PTRARR_GEN(nm, AE, Base)\ void nm::DeleteAndDestroy( USHORT nP, USHORT nL )\ @@ -664,12 +451,9 @@ void nm::DeleteAndDestroy( USHORT nP, USHORT nL )\ #define SV_IMPL_PTRARR(nm, AE )\ SV_IMPL_PTRARR_GEN(nm, AE, SvPtrarr ) -#define SV_IMPL_PTRARR_PLAIN(nm, AE )\ -SV_IMPL_PTRARR_GEN(nm, AE, SvPtrarrPlain ) typedef void* VoidPtr; _SV_DECL_PTRARR_DEF( SvPtrarr, VoidPtr, 0, 1, SVL_DLLPUBLIC ) -_SV_DECL_PTRARR_DEF_PLAIN( SvPtrarrPlain, VoidPtr, 0, 1, SVL_DLLPUBLIC ) // SORTARR - Begin @@ -983,69 +767,21 @@ SV_IMPL_VARARR(nm##_SAR, AE)\ _SV_IMPL_SORTAR_ALG( nm,AE )\ _SV_SEEK_OBJECT( nm,AE ) -#define SV_DECL_PTRARR_STACK(nm, AE, IS, GS)\ -class nm: private SvPtrarr \ -{\ -public:\ - nm( USHORT nIni=IS, BYTE nG=GS )\ - : SvPtrarr(nIni,nG) {}\ - void Insert( const nm *pI, USHORT nP,\ - USHORT nS = 0, USHORT nE = USHRT_MAX ) {\ - SvPtrarr::Insert( pI, nP, nS, nE ); \ - }\ - void Remove( USHORT nP, USHORT nL = 1 ) {\ - SvPtrarr::Remove( nP, nL ); \ - }\ - void Push( const AE &aE ) {\ - SvPtrarr::Insert( (const VoidPtr &)aE, SvPtrarr::Count() );\ - }\ - USHORT Count() const { return SvPtrarr::Count(); }\ - AE operator[](USHORT nP) const {\ - return (AE)SvPtrarr::operator[]( nP );\ - }\ - AE GetObject(USHORT nP) const {\ - return (AE)SvPtrarr::GetObject( nP );\ - }\ - AE Pop(){\ - AE pRet = 0;\ - if( SvPtrarr::Count() ){\ - pRet = GetObject( SvPtrarr::Count()-1 );\ - SvPtrarr::Remove(Count()-1);\ - }\ - return pRet;\ - }\ - AE Top() const {\ - AE pRet = 0;\ - if( SvPtrarr::Count() )\ - pRet = GetObject( SvPtrarr::Count()-1 ); \ - return pRet;\ - }\ -}; - #if defined (C40) || defined (C41) || defined (C42) || defined(C50) || defined(C52) #define C40_INSERT( c, p, n) Insert( (c const *) p, n ) -#define C40_PUSH( c, p) Push( (c const *) p ) #define C40_PTR_INSERT( c, p) Insert( (c const *) p ) -#define C40_REMOVE( c, p ) Remove( (c const *) p ) #define C40_REPLACE( c, p, n) Replace( (c const *) p, n ) -#define C40_PTR_REPLACE( c, p) Replace( (c const *) p ) #define C40_GETPOS( c, r) GetPos( (c const *)r ) #else #if defined WTC || defined ICC || defined HPUX || (defined GCC && __GNUC__ >= 3) || (defined(WNT) && _MSC_VER >= 1400) #define C40_INSERT( c, p, n ) Insert( (c const *&) p, n ) -#define C40_PUSH( c, p) Push( (c const *&) p ) #define C40_PTR_INSERT( c, p ) Insert( (c const *&) p ) -#define C40_REMOVE( c, p ) Remove( (c const *&) p ) #define C40_REPLACE( c, p, n ) Replace( (c const *&) p, n ) -#define C40_PTR_REPLACE( c, p ) Replace( (c const *&) p ) #define C40_GETPOS( c, r) GetPos( (c const *&) r ) #else #define C40_INSERT( c, p, n ) Insert( p, n ) -#define C40_PUSH( c, p) Push( p ) #define C40_PTR_INSERT( c, p ) Insert( p ) -#define C40_REMOVE( c, p) Remove( p ) #define C40_REPLACE( c, p, n ) Replace( p, n ) -#define C40_PTR_REPLACE( c, p ) Replace( p ) #define C40_GETPOS( c, r) GetPos( r ) #endif #endif diff --git a/svl/inc/svl/svstdarr.hxx b/svl/inc/svl/svstdarr.hxx index fa3c94034256..608705dca43d 100644 --- a/svl/inc/svl/svstdarr.hxx +++ b/svl/inc/svl/svstdarr.hxx @@ -42,20 +42,11 @@ #include "svl/svldllapi.h" #include <svl/svarray.hxx> +#include <deque> -//#ifdef _SVSTDARR_BOOLS -#ifndef _SVSTDARR_BOOLS_DECL -SV_DECL_VARARR_VISIBILITY( SvBools, BOOL, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BOOLS_DECL -#endif -//#endif +typedef std::deque< BOOL > SvBools; -//#ifdef _SVSTDARR_BYTES -#ifndef _SVSTDARR_BYTES_DECL -SV_DECL_VARARR_VISIBILITY( SvBytes, BYTE, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BYTES_DECL -#endif -//#endif +typedef std::deque< BYTE > SvBytes; //#ifdef _SVSTDARR_ULONGS #ifndef _SVSTDARR_ULONGS_DECL @@ -139,12 +130,7 @@ SV_DECL_VARARR_SORT_VISIBILITY( SvLongsSort, long, 1, 1, SVL_DLLPUBLIC ) #endif //#endif -//#ifdef _SVSTDARR_SHORTS -#ifndef _SVSTDARR_SHORTS_DECL -SV_DECL_VARARR_VISIBILITY( SvShorts, short, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_SHORTS_DECL -#endif -//#endif +typedef std::deque< short > SvShorts; /* form here all Arrays for Strings, ByteString and then @@ -255,17 +241,5 @@ SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvByteStringsISortDtor, ByteStringPtr, 1, 1, #endif //#endif -//#ifdef _SVSTDARR_XUB_STRLEN -#ifndef _SVSTDARR_XUB_STRLEN_DECL -SV_DECL_VARARR_VISIBILITY( SvXub_StrLens, xub_StrLen, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_XUB_STRLEN_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_XUB_STRLENSORT -#ifndef _SVSTDARR_XUB_STRLENSORT_DECL -SV_DECL_VARARR_SORT_VISIBILITY( SvXub_StrLensSort, xub_StrLen, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_XUB_STRLENSORT_DECL -#endif -//#endif +typedef std::deque< xub_StrLen > SvXub_StrLens; diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx index 70122a5b1998..79cbbc463700 100644 --- a/svl/source/inc/poolio.hxx +++ b/svl/source/inc/poolio.hxx @@ -25,7 +25,8 @@ * ************************************************************************/ #include <svl/brdcst.hxx> - +#include <boost/shared_ptr.hpp> +#include <deque> #ifndef DELETEZ #define DELETEZ(pPtr) { delete pPtr; pPtr = 0; } @@ -53,16 +54,17 @@ struct SfxPoolVersion_Impl {} }; -SV_DECL_PTRARR( SfxPoolItemArrayBase_Impl, SfxPoolItem*, 0, 5 ) -SV_DECL_PTRARR_DEL( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl*, 0, 2 ) +typedef std::deque<SfxPoolItem*> SfxPoolItemArrayBase_Impl; + +typedef boost::shared_ptr< SfxPoolVersion_Impl > SfxPoolVersion_ImplPtr; +typedef std::deque< SfxPoolVersion_ImplPtr > SfxPoolVersionArr_Impl; struct SfxPoolItemArray_Impl: public SfxPoolItemArrayBase_Impl { - USHORT nFirstFree; + size_t nFirstFree; - SfxPoolItemArray_Impl (USHORT nInitSize = 0) - : SfxPoolItemArrayBase_Impl( nInitSize ), - nFirstFree( 0 ) + SfxPoolItemArray_Impl () + : nFirstFree( 0 ) {} }; @@ -96,7 +98,8 @@ struct SfxItemPool_Impl void DeleteItems() { - delete[] ppPoolItems; ppPoolItems = 0; + delete[] ppPoolItems; + ppPoolItems = 0; } }; diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 5c5f106a1c36..d8bdeb330776 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -38,14 +38,6 @@ #include <svl/brdcst.hxx> #include <svl/smplhint.hxx> #include "poolio.hxx" -#include <algorithm> - -// STATIC DATA ----------------------------------------------------------- - - -//======================================================================== - -SV_IMPL_PTRARR( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl* ); //======================================================================== @@ -275,13 +267,12 @@ SfxItemPool::SfxItemPool (*( ppPoolDefaults + n ))->SetKind( SFX_ITEMS_POOLDEFAULT ); } - // Version-Map kopieren - USHORT nVerCount = rPool.pImp->aVersions.Count(); - for ( USHORT nVer = 0; nVer < nVerCount; ++nVer ) + // Copy Version-Map + for ( size_t nVer = 0; nVer < rPool.pImp->aVersions.size(); ++nVer ) { - const SfxPoolVersion_Impl *pOld = rPool.pImp->aVersions.GetObject(nVer); - const SfxPoolVersion_Impl *pNew = new SfxPoolVersion_Impl( *pOld ); - pImp->aVersions.Insert( pNew, nVer ); + const SfxPoolVersion_ImplPtr pOld = rPool.pImp->aVersions[nVer]; + SfxPoolVersion_ImplPtr pNew = SfxPoolVersion_ImplPtr( new SfxPoolVersion_Impl( *pOld ) ); + pImp->aVersions.push_back( pNew ); } // Verkettung wiederherstellen @@ -454,9 +445,8 @@ void SfxItemPool::SetSecondaryPool( SfxItemPool *pPool ) pSecondary->pImp->ppPoolItems + n; if ( *ppItemArr ) { - SfxPoolItem** ppHtArr = - (SfxPoolItem**)(*ppItemArr)->GetData(); - for( USHORT i = (*ppItemArr)->Count(); i; ++ppHtArr, --i ) + SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin(); + for( size_t i = (*ppItemArr)->size(); i; ++ppHtArr, --i ) if ( !(*ppHtArr) ) { DBG_ERROR( "old secondary pool must be empty" ); @@ -582,8 +572,8 @@ void SfxItemPool::Delete() { if ( *ppItemArr ) { - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) + SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin(); + for ( size_t n = (*ppItemArr)->size(); n; --n, ++ppHtArr ) if (*ppHtArr) { #ifdef DBG_UTIL @@ -614,8 +604,8 @@ void SfxItemPool::Delete() { if ( *ppItemArr ) { - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) + SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin(); + for ( size_t n = (*ppItemArr)->size(); n; --n, ++ppHtArr ) if (*ppHtArr) { #ifdef DBG_UTIL @@ -663,8 +653,8 @@ void SfxItemPool::Cleanup() ((*ppDefaultItem && (*ppDefaultItem)->ISA(SfxSetItem)) || (*ppStaticDefaultItem)->ISA(SfxSetItem)) ) { - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) + SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin(); + for ( size_t n = (*ppItemArr)->size(); n; --n, ++ppHtArr ) if ( *ppHtArr && !(*ppHtArr)->GetRefCount() ) { DELETEZ(*ppHtArr); @@ -681,8 +671,8 @@ void SfxItemPool::Cleanup() { if ( *ppItemArr ) { - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) + SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin(); + for ( size_t n = (*ppItemArr)->size(); n; --n, ++ppHtArr ) if ( *ppHtArr && !(*ppHtArr)->GetRefCount() ) DELETEZ( *ppHtArr ); } @@ -782,15 +772,16 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, USHORT nWhich ) if( !*ppItemArr ) *ppItemArr = new SfxPoolItemArray_Impl; - SfxPoolItem **ppFree = 0; - SfxPoolItem** ppHtArray = (SfxPoolItem**)(*ppItemArr)->GetData(); + SfxPoolItemArrayBase_Impl::iterator ppFree; + BOOL ppFreeIsSet = FALSE; + SfxPoolItemArrayBase_Impl::iterator ppHtArray = (*ppItemArr)->begin(); if ( IsItemFlag_Impl( nIndex, SFX_ITEM_POOLABLE ) ) { // wenn es ueberhaupt gepoolt ist, koennte es schon drin sein if ( IsPooledItem(&rItem) ) { // 1. Schleife: teste ob der Pointer vorhanden ist. - for( USHORT n = (*ppItemArr)->Count(); n; ++ppHtArray, --n ) + for( size_t n = (*ppItemArr)->size(); n; ++ppHtArray, --n ) if( &rItem == (*ppHtArray) ) { AddRef( **ppHtArray ); @@ -799,8 +790,8 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, USHORT nWhich ) } // 2. Schleife: dann muessen eben die Attribute verglichen werden - USHORT n; - for ( n = (*ppItemArr)->Count(), ppHtArray = (SfxPoolItem**)(*ppItemArr)->GetData(); + size_t n; + for ( n = (*ppItemArr)->size(), ppHtArray = (*ppItemArr)->begin(); n; ++ppHtArray, --n ) { if ( *ppHtArray ) @@ -812,22 +803,26 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, USHORT nWhich ) } } else - if ( !ppFree ) + if ( ppFreeIsSet == FALSE ) + { ppFree = ppHtArray; + ppFreeIsSet = TRUE; + } } } else { // freien Platz suchen - SfxPoolItem** ppHtArr; - USHORT n, nCount = (*ppItemArr)->Count(); + SfxPoolItemArrayBase_Impl::iterator ppHtArr; + size_t n, nCount = (*ppItemArr)->size(); for ( n = (*ppItemArr)->nFirstFree, - ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData() + n; + ppHtArr = (*ppItemArr)->begin() + n; n < nCount; ++ppHtArr, ++n ) if ( !*ppHtArr ) { ppFree = ppHtArr; + ppFreeIsSet = TRUE; break; } @@ -853,9 +848,9 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, USHORT nWhich ) #endif #endif AddRef( *pNewItem, pImp->nInitRefCount ); - const SfxPoolItem* pTemp = pNewItem; - if ( !ppFree ) - (*ppItemArr)->Insert( pTemp, (*ppItemArr)->Count() ); + SfxPoolItem* pTemp = pNewItem; + if ( ppFreeIsSet == FALSE ) + (*ppItemArr)->push_back( pTemp ); else { DBG_ASSERT( *ppFree == 0, "using surrogate in use" ); @@ -915,8 +910,8 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem ) // Item im eigenen Pool suchen SfxPoolItemArray_Impl** ppItemArr = (pImp->ppPoolItems + nIndex); SFX_ASSERT( *ppItemArr, rItem.Which(), "removing Item not in Pool" ); - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for( USHORT n = (*ppItemArr)->Count(); n; ++ppHtArr, --n ) + SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin(); + for( size_t n = (*ppItemArr)->size(); n; ++ppHtArr, --n ) if( *ppHtArr == &rItem ) { if ( (*ppHtArr)->GetRefCount() ) //! @@ -928,7 +923,7 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem ) } // ggf. kleinstmoegliche freie Position merken - USHORT nPos = (*ppItemArr)->Count() - n; + size_t nPos = (*ppItemArr)->size() - n; if ( (*ppItemArr)->nFirstFree > nPos ) (*ppItemArr)->nFirstFree = nPos; @@ -1009,24 +1004,24 @@ void SfxItemPool::FillItemIdRanges_Impl( USHORT*& pWhichRanges ) const // ----------------------------------------------------------------------- -const SfxPoolItem *SfxItemPool::GetItem(USHORT nWhich, USHORT nOfst) const +const SfxPoolItem *SfxItemPool::GetItem2(USHORT nWhich, sal_uInt32 nOfst) const { DBG_CHKTHIS(SfxItemPool, 0); if ( !IsInRange(nWhich) ) { if ( pSecondary ) - return pSecondary->GetItem( nWhich, nOfst ); + return pSecondary->GetItem2( nWhich, nOfst ); SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot resolve surrogate" ); return 0; } // dflt-Attribut? - if ( nOfst == SFX_ITEMS_STATICDEFAULT ) + if ( nOfst == SFX_ITEMS_DEFAULT ) return *(ppStaticDefaults + GetIndex_Impl(nWhich)); SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(nWhich)); - if( pItemArr && nOfst < pItemArr->Count() ) + if( pItemArr && nOfst < pItemArr->size() ) return (*pItemArr)[nOfst]; return 0; @@ -1034,21 +1029,21 @@ const SfxPoolItem *SfxItemPool::GetItem(USHORT nWhich, USHORT nOfst) const // ----------------------------------------------------------------------- -USHORT SfxItemPool::GetItemCount(USHORT nWhich) const +sal_uInt32 SfxItemPool::GetItemCount2(USHORT nWhich) const { DBG_CHKTHIS(SfxItemPool, 0); if ( !IsInRange(nWhich) ) { if ( pSecondary ) - return pSecondary->GetItemCount( nWhich ); + return pSecondary->GetItemCount2( nWhich ); SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot resolve surrogate" ); return 0; } SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(nWhich)); if ( pItemArr ) - return pItemArr->Count(); + return pItemArr->size(); return 0; } diff --git a/svl/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx index 89010e15a4b2..ab2bdfb91c84 100644 --- a/svl/source/items/poolcach.cxx +++ b/svl/source/items/poolcach.cxx @@ -41,18 +41,6 @@ DBG_NAME(SfxItemPoolCache) - -//------------------------------------------------------------------------ - -struct SfxItemModifyImpl -{ - const SfxSetItem *pOrigItem; - SfxSetItem *pPoolItem; -}; - -SV_DECL_VARARR( SfxItemModifyArr_Impl, SfxItemModifyImpl, 8, 8 ) -SV_IMPL_VARARR( SfxItemModifyArr_Impl, SfxItemModifyImpl); - //------------------------------------------------------------------------ SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool, @@ -84,7 +72,7 @@ SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool, SfxItemPoolCache::~SfxItemPoolCache() { DBG_DTOR(SfxItemPoolCache, 0); - for ( USHORT nPos = 0; nPos < pCache->Count(); ++nPos ) { + for ( size_t nPos = 0; nPos < pCache->size(); ++nPos ) { pPool->Remove( *(*pCache)[nPos].pPoolItem ); pPool->Remove( *(*pCache)[nPos].pOrigItem ); } @@ -103,8 +91,8 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, BOOL b DBG_ASSERT( IsDefaultItem( &rOrigItem ) || IsPooledItem( &rOrigItem ), "original not in pool" ); - // Suchen, ob diese Transformations schon einmal vorkam - for ( USHORT nPos = 0; nPos < pCache->Count(); ++nPos ) + // Find whether this Transformations ever occurred + for ( size_t nPos = 0; nPos < pCache->size(); ++nPos ) { SfxItemModifyImpl &rMapEntry = (*pCache)[nPos]; if ( rMapEntry.pOrigItem == &rOrigItem ) @@ -143,7 +131,7 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, BOOL b SfxItemModifyImpl aModify; aModify.pOrigItem = &rOrigItem; aModify.pPoolItem = (SfxSetItem*) pNewPoolItem; - pCache->Insert( aModify, pCache->Count() ); + pCache->push_back( aModify ); DBG_ASSERT( !pItemToPut || &pNewPoolItem->GetItemSet().Get( pItemToPut->Which() ) == pItemToPut, diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx index 6aeb64d76d1a..8bf8f2b2434b 100644 --- a/svl/source/items/poolio.cxx +++ b/svl/source/items/poolio.cxx @@ -178,10 +178,10 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const // Version-Maps { SfxMultiVarRecordWriter aVerRec( &rStream, SFX_ITEMPOOL_REC_VERSIONMAP, 0 ); - for ( USHORT nVerNo = 0; nVerNo < pImp->aVersions.Count(); ++nVerNo ) + for ( size_t nVerNo = 0; nVerNo < pImp->aVersions.size(); ++nVerNo ) { aVerRec.NewContent(); - SfxPoolVersion_Impl *pVer = pImp->aVersions[nVerNo]; + SfxPoolVersion_ImplPtr pVer = pImp->aVersions[nVerNo]; rStream << pVer->_nVer << pVer->_nStart << pVer->_nEnd; USHORT nCount = pVer->_nEnd - pVer->_nStart + 1; USHORT nNewWhich = 0; @@ -207,7 +207,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const SfxPoolItemArray_Impl **pArr = pImp->ppPoolItems; SfxPoolItem **ppDefItem = ppStaticDefaults; const USHORT nSize = GetSize_Impl(); - for ( USHORT i = 0; i < nSize && !rStream.GetError(); ++i, ++pArr, ++ppDefItem ) + for ( size_t i = 0; i < nSize && !rStream.GetError(); ++i, ++pArr, ++ppDefItem ) { // Version des Items feststellen USHORT nItemVersion = (*ppDefItem)->GetVersion( _nFileFormatVersion ); @@ -229,16 +229,16 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const aWhichIdsRec.NewContent(nSlotId, 0); rStream << (*ppDefItem)->Which(); rStream << nItemVersion; - const USHORT nCount = (*pArr)->Count(); - DBG_ASSERT(nCount, "ItemArr ist leer"); + const sal_uInt32 nCount = ::std::min<size_t>( (*pArr)->size(), SAL_MAX_UINT32 ); + DBG_ASSERT(nCount, "ItemArr is empty"); rStream << nCount; // Items an sich schreiben SfxMultiMixRecordWriter aItemsRec( &rStream, SFX_ITEMPOOL_REC_ITEMS, 0 ); - for ( USHORT j = 0; j < nCount; ++j ) + for ( size_t j = 0; j < nCount; ++j ) { // Item selbst besorgen - const SfxPoolItem *pItem = (*pArr)->GetObject(j); + const SfxPoolItem *pItem = (*pArr)->operator[](j); if ( pItem && pItem->GetRefCount() ) //! siehe anderes MI-REF { aItemsRec.NewContent(j, 'X' ); @@ -353,8 +353,8 @@ void SfxItemPool::LoadCompleted() if ( *ppItemArr ) { // "uber alle Items mit dieser Which-Id iterieren - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) + SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin(); + for( size_t n = (*ppItemArr)->size(); n; --n, ++ppHtArr ) if (*ppHtArr) { #ifdef DBG_UTIL @@ -382,15 +382,15 @@ void SfxItemPool::LoadCompleted() //============================================================================ // This had to be moved to a method of its own to keep Solaris GCC happy: void SfxItemPool::readTheItems ( - SvStream & rStream, USHORT nItemCount, USHORT nVersion, + SvStream & rStream, sal_uInt32 nItemCount, USHORT nVersion, SfxPoolItem * pDefItem, SfxPoolItemArray_Impl ** ppArr) { SfxMultiRecordReader aItemsRec( &rStream, SFX_ITEMPOOL_REC_ITEMS ); - SfxPoolItemArray_Impl *pNewArr = new SfxPoolItemArray_Impl( nItemCount ); + SfxPoolItemArray_Impl *pNewArr = new SfxPoolItemArray_Impl(); SfxPoolItem *pItem = 0; - USHORT n, nLastSurrogate = USHORT(-1); + ULONG n, nLastSurrogate = ULONG(-1); while (aItemsRec.GetContent()) { // n"achstes Surrogat holen @@ -400,7 +400,7 @@ void SfxItemPool::readTheItems ( // fehlende auff"ullen for ( pItem = 0, n = nLastSurrogate+1; n < nSurrogate; ++n ) - pNewArr->C40_INSERT(SfxPoolItem, pItem, n); + pNewArr->push_back( (SfxPoolItem*) pItem ); nLastSurrogate = nSurrogate; // Ref-Count und Item laden @@ -408,7 +408,7 @@ void SfxItemPool::readTheItems ( rStream >> nRef; pItem = pDefItem->Create(rStream, nVersion); - pNewArr->C40_INSERT(SfxPoolItem, pItem, nSurrogate); + pNewArr->push_back( (SfxPoolItem*) pItem ); if ( !bPersistentRefCounts ) // bis <SfxItemPool::LoadCompleted()> festhalten @@ -424,33 +424,32 @@ void SfxItemPool::readTheItems ( // fehlende auff"ullen for ( pItem = 0, n = nLastSurrogate+1; n < nItemCount; ++n ) - pNewArr->C40_INSERT(SfxPoolItem, pItem, n); + pNewArr->push_back( (SfxPoolItem*) pItem ); SfxPoolItemArray_Impl *pOldArr = *ppArr; *ppArr = pNewArr; // die Items merken, die schon im Pool sind - int bEmpty = TRUE; + bool bEmpty = true; if ( 0 != pOldArr ) - for ( n = 0; bEmpty && n < pOldArr->Count(); ++n ) - bEmpty = pOldArr->GetObject(n) == 0; + for ( n = 0; bEmpty && n < pOldArr->size(); ++n ) + bEmpty = pOldArr->operator[](n) == 0; DBG_ASSERTWARNING( bEmpty, "loading non-empty pool" ); if ( !bEmpty ) { // f"ur alle alten suchen, ob ein gleiches neues existiert - for ( USHORT nOld = 0; nOld < pOldArr->Count(); ++nOld ) + for ( size_t nOld = 0; nOld < pOldArr->size(); ++nOld ) { SfxPoolItem *pOldItem = (*pOldArr)[nOld]; if ( pOldItem ) { - USHORT nFree = USHRT_MAX; - int bFound = FALSE; - USHORT nCount = (*ppArr)->Count(); - for ( USHORT nNew = nCount; !bFound && nNew--; ) + sal_uInt32 nFree = SAL_MAX_UINT32; + bool bFound = false; + for ( size_t nNew = (*ppArr)->size(); nNew--; ) { // geladenes Item SfxPoolItem *&rpNewItem = - (SfxPoolItem*&)(*ppArr)->GetData()[nNew]; + (SfxPoolItem*&)(*ppArr)->operator[](nNew); // surrogat unbenutzt? if ( !rpNewItem ) @@ -464,17 +463,18 @@ void SfxItemPool::readTheItems ( SetRefCount( *rpNewItem, 0 ); delete rpNewItem; rpNewItem = pOldItem; - bFound = TRUE; + bFound = true; + break; } } // vorhervorhandene, nicht geladene uebernehmen if ( !bFound ) { - if ( nFree != USHRT_MAX ) - (SfxPoolItem*&)(*ppArr)->GetData()[nFree] = pOldItem; + if ( nFree != SAL_MAX_UINT32 ) + (SfxPoolItem*&)(*ppArr)->operator[](nFree) = pOldItem; else - (*ppArr)->C40_INSERT( SfxPoolItem, pOldItem, nCount ); + (*ppArr)->push_back( (SfxPoolItem*) pOldItem ); } } } @@ -495,14 +495,14 @@ SvStream &SfxItemPool::Load(SvStream &rStream) // "uber alle Which-Werte iterieren SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems; - for( USHORT nArrCnt = GetSize_Impl(); nArrCnt; --nArrCnt, ++ppItemArr ) + for( size_t nArrCnt = GetSize_Impl(); nArrCnt; --nArrCnt, ++ppItemArr ) { // ist "uberhaupt ein Item mit dem Which-Wert da? if ( *ppItemArr ) { // "uber alle Items mit dieser Which-Id iterieren - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) + SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin(); + for( size_t n = (*ppItemArr)->size(); n; --n, ++ppHtArr ) if (*ppHtArr) { #ifdef DBG_UTIL @@ -611,10 +611,10 @@ SvStream &SfxItemPool::Load(SvStream &rStream) rStream >> nVersion >> nHStart >> nHEnd; USHORT nCount = nHEnd - nHStart + 1; - // Version neuer als bekannt? - if ( nVerNo >= pImp->aVersions.Count() ) + // Is new version is known? + if ( nVerNo >= pImp->aVersions.size() ) { - // neue Version hinzufuegen + // Add new Version USHORT *pMap = new USHORT[nCount]; for ( USHORT n = 0; n < nCount; ++n ) rStream >> pMap[n]; @@ -632,7 +632,8 @@ SvStream &SfxItemPool::Load(SvStream &rStream) while ( aWhichIdsRec.GetContent() ) { // SlotId, Which-Id und Item-Version besorgen - USHORT nCount, nVersion, nWhich; + sal_uInt32 nCount; + USHORT nVersion, nWhich; //!USHORT nSlotId = aWhichIdsRec.GetContentTag(); rStream >> nWhich; if ( pImp->nLoadingVersion != pImp->nVersion ) @@ -799,10 +800,10 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) USHORT nCount = nHEnd - nHStart + 1; USHORT nBytes = (nCount)*sizeof(USHORT); - // Version neuer als bekannt? - if ( nVerNo >= pImp->aVersions.Count() ) + // Is new version is known? + if ( nVerNo >= pImp->aVersions.size() ) { - // neue Version hinzufuegen + // Add new Version USHORT *pMap = new USHORT[nCount]; for ( USHORT n = 0; n < nCount; ++n ) rStream >> pMap[n]; @@ -849,7 +850,7 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) USHORT nIndex = GetIndex_Impl(nWhich); ppArr = pImp->ppPoolItems + nIndex; - pNewArr = new SfxPoolItemArray_Impl( nCount ); + pNewArr = new SfxPoolItemArray_Impl(); pDefItem = *(ppStaticDefaults + nIndex); } @@ -897,8 +898,8 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) AddRef(*pItem, nRef); } } - - pNewArr->C40_INSERT( SfxPoolItem, pItem, j); + //pNewArr->insert( pItem, j ); + pNewArr->push_back( (SfxPoolItem*) pItem ); // restliche gespeicherte Laenge skippen (neueres Format) nLastPos = rStream.Tell(); @@ -924,24 +925,23 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) // die Items merken, die schon im Pool sind int bEmpty = TRUE; if ( 0 != pOldArr ) - for ( USHORT n = 0; bEmpty && n < pOldArr->Count(); ++n ) - bEmpty = pOldArr->GetObject(n) == 0; + for ( size_t n = 0; bEmpty && n < pOldArr->size(); ++n ) + bEmpty = pOldArr->operator[](n) == 0; DBG_ASSERTWARNING( bEmpty, "loading non-empty pool" ); if ( !bEmpty ) { // f"ur alle alten suchen, ob ein gleiches neues existiert - for ( USHORT nOld = 0; nOld < pOldArr->Count(); ++nOld ) + for ( size_t nOld = 0; nOld < pOldArr->size(); ++nOld ) { SfxPoolItem *pOldItem = (*pOldArr)[nOld]; if ( pOldItem ) { - int bFound = FALSE; - for ( USHORT nNew = 0; - !bFound && nNew < (*ppArr)->Count(); - ++nNew ) + bool bFound = false; + for ( size_t nNew = 0; + nNew < (*ppArr)->size(); ++nNew ) { SfxPoolItem *&rpNewItem = - (SfxPoolItem*&)(*ppArr)->GetData()[nNew]; + (SfxPoolItem*&)(*ppArr)->operator[](nNew); if ( rpNewItem && *rpNewItem == *pOldItem ) { @@ -949,11 +949,11 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) SetRefCount( *rpNewItem, 0 ); delete rpNewItem; rpNewItem = pOldItem; - bFound = TRUE; + bFound = true; SFX_TRACE( "reusing item", pOldItem ); + break; } } - //! DBG_ASSERT( bFound, "old-item not found in file" ); if ( !bFound ) { SFX_TRACE( "item not found: ", pOldItem ); @@ -1039,7 +1039,7 @@ const SfxPoolItem* SfxItemPool::LoadSurrogate L"adt Surrogat aus 'rStream' und liefert das dadurch in 'rRefPool' repr"asentierte SfxPoolItem zu"ruck. Ist das im Stream befindliche Surrogat == SFX_ITEMS_DIRECT (!SFX_ITEM_POOLABLE) wird 0 zur"uckgegeben, - das Item ist direkt aus dem Stream zu laden. Bei 0xfff0 (SFX_ITEMS_NULL) + das Item ist direkt aus dem Stream zu laden. Bei 0xfffffff0 (SFX_ITEMS_NULL) wird auch 0 zurueckgegeben und rWhich auf 0 gesetzt, das Item ist nicht verfuegbar. @@ -1071,15 +1071,15 @@ const SfxPoolItem* SfxItemPool::LoadSurrogate */ { - // erstmal das Surrogat lesen - USHORT nSurrogat; + // Read the first surrogate + sal_uInt32 nSurrogat; rStream >> nSurrogat; - // direkt gespeichertes Item? + // Is item stored directly? if ( SFX_ITEMS_DIRECT == nSurrogat ) return 0; - // nicht vorhandenes Item? + // Item does not exist? if ( SFX_ITEMS_NULL == nSurrogat ) { rWhich = 0; @@ -1114,13 +1114,13 @@ const SfxPoolItem* SfxItemPool::LoadSurrogate if ( pTarget->IsInRange(rWhich) ) { // dflt-Attribut? - if ( SFX_ITEMS_STATICDEFAULT == nSurrogat ) + if ( SFX_ITEMS_DEFAULT == nSurrogat ) return *(pTarget->ppStaticDefaults + pTarget->GetIndex_Impl(rWhich)); SfxPoolItemArray_Impl* pItemArr = *(pTarget->pImp->ppPoolItems + pTarget->GetIndex_Impl(rWhich)); - pItem = pItemArr && nSurrogat < pItemArr->Count() + pItem = pItemArr && nSurrogat < pItemArr->size() ? (*pItemArr)[nSurrogat] : 0; if ( !pItem ) @@ -1184,17 +1184,17 @@ FASTBOOL SfxItemPool::StoreSurrogate FASTBOOL bRealSurrogate = IsItemFlag(*pItem, SFX_ITEM_POOLABLE); rStream << ( bRealSurrogate ? GetSurrogate( pItem ) - : (UINT16) SFX_ITEMS_DIRECT ); + : SFX_ITEMS_DIRECT ); return bRealSurrogate; } - rStream << (UINT16) SFX_ITEMS_NULL; + rStream << SFX_ITEMS_NULL; return TRUE; } // ----------------------------------------------------------------------- -USHORT SfxItemPool::GetSurrogate(const SfxPoolItem *pItem) const +sal_uInt32 SfxItemPool::GetSurrogate(const SfxPoolItem *pItem) const { DBG_CHKTHIS(SfxItemPool, 0); DBG_ASSERT( pItem, "no 0-Pointer Surrogate" ); @@ -1210,18 +1210,18 @@ USHORT SfxItemPool::GetSurrogate(const SfxPoolItem *pItem) const // Pointer auf static- oder pool-dflt-Attribut? if( IsStaticDefaultItem(pItem) || IsPoolDefaultItem(pItem) ) - return SFX_ITEMS_STATICDEFAULT; + return SFX_ITEMS_DEFAULT; SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(pItem->Which())); - DBG_ASSERT(pItemArr, "ItemArr nicht vorhanden"); - const USHORT nCount = pItemArr->Count(); - for ( USHORT i = 0; i < nCount; ++i ) + DBG_ASSERT(pItemArr, "ItemArr is not available"); + + for ( size_t i = 0; i < pItemArr->size(); ++i ) { const SfxPoolItem *p = (*pItemArr)[i]; if ( p == pItem ) return i; } - SFX_ASSERT( 0, pItem->Which(), "Item nicht im Pool"); + SFX_ASSERT( 0, pItem->Which(), "Item not in the pool"); return SFX_ITEMS_NULL; } @@ -1326,10 +1326,10 @@ void SfxItemPool::SetVersionMap */ { - // neuen Map-Eintrag erzeugen und einf"ugen - const SfxPoolVersion_Impl *pVerMap = new SfxPoolVersion_Impl( - nVer, nOldStart, nOldEnd, pOldWhichIdTab ); - pImp->aVersions.Insert( pVerMap, pImp->aVersions.Count() ); + // create new map entry to insert + const SfxPoolVersion_ImplPtr pVerMap = SfxPoolVersion_ImplPtr( new SfxPoolVersion_Impl( + nVer, nOldStart, nOldEnd, pOldWhichIdTab ) ); + pImp->aVersions.push_back( pVerMap ); DBG_ASSERT( nVer > pImp->nVersion, "Versions not sorted" ); pImp->nVersion = nVer; @@ -1398,9 +1398,9 @@ USHORT SfxItemPool::GetNewWhich if ( nDiff > 0 ) { // von der Top-Version bis runter zur File-Version stufenweise mappen - for ( USHORT nMap = pImp->aVersions.Count(); nMap > 0; --nMap ) + for ( size_t nMap = pImp->aVersions.size(); nMap > 0; --nMap ) { - SfxPoolVersion_Impl *pVerInfo = pImp->aVersions[nMap-1]; + SfxPoolVersion_ImplPtr pVerInfo = pImp->aVersions[nMap-1]; if ( pVerInfo->_nVer > pImp->nVersion ) { USHORT nOfs; USHORT nCount = pVerInfo->_nEnd - pVerInfo->_nStart + 1; @@ -1424,9 +1424,9 @@ USHORT SfxItemPool::GetNewWhich else if ( nDiff < 0 ) { // von der File-Version bis zur aktuellen Version stufenweise mappen - for ( USHORT nMap = 0; nMap < pImp->aVersions.Count(); ++nMap ) + for ( size_t nMap = 0; nMap < pImp->aVersions.size(); ++nMap ) { - SfxPoolVersion_Impl *pVerInfo = pImp->aVersions[nMap]; + SfxPoolVersion_ImplPtr pVerInfo = pImp->aVersions[nMap]; if ( pVerInfo->_nVer > pImp->nLoadingVersion ) { DBG_ASSERT( nFileWhich >= pVerInfo->_nStart && @@ -1637,7 +1637,8 @@ const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, FASTBOOL bDirect, else { // WID in der Version nicht vorhanden => ueberspringen - USHORT nSurro, nVersion, nLen; + sal_uInt32 nSurro; + USHORT nVersion, nLen; rStream >> nSurro; if ( SFX_ITEMS_DIRECT == nSurro ) { diff --git a/svl/source/items/whassert.hxx b/svl/source/items/whassert.hxx index 9933294b4d86..237cf73f6c7f 100644 --- a/svl/source/items/whassert.hxx +++ b/svl/source/items/whassert.hxx @@ -42,7 +42,7 @@ ByteString aMsg( sMessage ); \ aMsg.Append(RTL_CONSTASCII_STRINGPARAM("\nwith Id/Pos: ")); \ aMsg += ByteString::CreateFromInt32( nId ); \ - DbgOut( aMsg.GetBuffer(), DBG_OUT_ERROR, __FILE__, __LINE__); \ + DbgError( aMsg.GetBuffer(), __FILE__, __LINE__); \ } \ } \ } diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx index b2184442ea0e..622533dceae2 100644 --- a/svl/source/memtools/svarray.cxx +++ b/svl/source/memtools/svarray.cxx @@ -61,7 +61,6 @@ #include <tools/debug.hxx> SV_IMPL_VARARR(SvPtrarr,VoidPtr) -SV_IMPL_VARARR_PLAIN(SvPtrarrPlain,VoidPtr) USHORT SvPtrarr::GetPos( const VoidPtr& aElement ) const { USHORT n; @@ -69,25 +68,12 @@ USHORT SvPtrarr::GetPos( const VoidPtr& aElement ) const return ( n >= nA ? USHRT_MAX : n ); } -USHORT SvPtrarrPlain::GetPos( const VoidPtr aElement ) const -{ USHORT n; - for( n=0; n < nA && *(GetData()+n) != aElement; ) n++; - return ( n >= nA ? USHRT_MAX : n ); -} - - -SV_IMPL_VARARR( SvBools, BOOL ) -SV_IMPL_VARARR( SvBytes, BYTE ) SV_IMPL_VARARR( SvULongs, ULONG ) SV_IMPL_VARARR( SvUShorts, USHORT ) SV_IMPL_VARARR( SvLongs, long) -SV_IMPL_VARARR( SvShorts, short ) SV_IMPL_VARARR_SORT( SvULongsSort, ULONG ) SV_IMPL_VARARR_SORT( SvLongsSort, long ) -SV_IMPL_VARARR_SORT( SvXub_StrLensSort, xub_StrLen ) - -SV_IMPL_VARARR( SvXub_StrLens, xub_StrLen ) SV_IMPL_PTRARR( SvStrings, StringPtr ) SV_IMPL_PTRARR( SvStringsDtor, StringPtr ) diff --git a/svtools/inc/svtools/parrtf.hxx b/svtools/inc/svtools/parrtf.hxx index 179f5a28259a..b96e3937231d 100644 --- a/svtools/inc/svtools/parrtf.hxx +++ b/svtools/inc/svtools/parrtf.hxx @@ -30,7 +30,7 @@ #include "svtools/svtdllapi.h" #include <svtools/svparser.hxx> -#include <svl/svarray.hxx> +#include <stack> struct RtfParserState_Impl { @@ -42,7 +42,7 @@ struct RtfParserState_Impl {} }; -SV_DECL_VARARR( RtfParserStates_Impl, RtfParserState_Impl, 16, 16 ) +typedef std::stack< RtfParserState_Impl > RtfParserStates_Impl; class SVT_DLLPUBLIC SvRTFParser : public SvParser { diff --git a/svtools/inc/svtools/rtfkeywd.hxx b/svtools/inc/svtools/rtfkeywd.hxx index 5ccd9149bd68..de59e1d8faf9 100644 --- a/svtools/inc/svtools/rtfkeywd.hxx +++ b/svtools/inc/svtools/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/svtools/rtftoken.h b/svtools/inc/svtools/rtftoken.h index e75254487312..f292682a0236 100644 --- a/svtools/inc/svtools/rtftoken.h +++ b/svtools/inc/svtools/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/inc/svtools/syntaxhighlight.hxx b/svtools/inc/svtools/syntaxhighlight.hxx index 8cf7126fa24c..e406c33fc54f 100644 --- a/svtools/inc/svtools/syntaxhighlight.hxx +++ b/svtools/inc/svtools/syntaxhighlight.hxx @@ -57,8 +57,6 @@ #include <tools/string.hxx> #include <tools/gen.hxx> -#include <svl/svarray.hxx> - // Token-Typen TT_... enum TokenTypes @@ -79,8 +77,7 @@ enum TokenTypes struct HighlightPortion { UINT16 nBegin; UINT16 nEnd; TokenTypes tokenType; }; - -SV_DECL_VARARR(HighlightPortions, HighlightPortion, 0, 16) +typedef std::vector<HighlightPortion> HighlightPortions; ///////////////////////////////////////////////////////////////////////// // Hilfsklasse zur Untersuchung von JavaScript-Modulen, zunaechst zum 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 7a06c4a30735..df6475c131ce 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -40,6 +40,8 @@ #include <svimpbox.hxx> #include <rtl/instance.hxx> #include <svtools/svtdata.hxx> +#include <tools/wintypes.hxx> +#ifndef _SVTOOLS_HRC #include <svtools/svtools.hrc> // #102891# -------------------- @@ -75,7 +77,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 ); @@ -245,10 +247,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 ); } @@ -675,6 +677,8 @@ void SvImpLBox::SetCursor( SvLBoxEntry* pEntry, BOOL bForceNoSelect ) } } nFlags &= (~F_DESEL_ALL); + + pView->OnCurrentEntryChanged(); } void SvImpLBox::ShowCursor( BOOL bShow ) @@ -944,7 +948,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 ); @@ -961,7 +965,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 ); } @@ -986,7 +990,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 ) { @@ -1124,7 +1128,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) ) @@ -1146,7 +1150,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); @@ -1240,7 +1244,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() ); @@ -1248,7 +1253,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; @@ -1266,7 +1271,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; } @@ -1431,7 +1436,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(); @@ -1673,7 +1678,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 ); @@ -1935,7 +1940,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 ) @@ -2257,6 +2262,7 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt) SvLBoxEntry* pNewCursor; + const WinBits nWindowStyle = pView->GetStyle(); switch( aCode ) { case KEY_UP: @@ -2340,7 +2346,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(); @@ -2371,7 +2377,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(); @@ -2473,13 +2479,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; @@ -2512,7 +2522,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 ); @@ -2560,8 +2570,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: @@ -2672,10 +2682,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; } @@ -2690,7 +2705,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 ) @@ -2723,7 +2738,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 ) @@ -3021,7 +3036,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 e8863ebaf43f..9d6bc78caff9 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 4acb54de7c3f..574f2bde4e1e 100755 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -40,7 +40,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/task/XInteractionHandler.hdl> +#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> @@ -152,7 +152,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 ) @@ -413,7 +413,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 ); @@ -641,7 +641,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(); @@ -671,6 +671,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; @@ -695,7 +696,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 ); @@ -714,7 +715,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 ); @@ -845,6 +846,7 @@ SvtURLBox::SvtURLBox( Window* pParent, const ResId& _rResId, INetProtocol eSmart void SvtURLBox::ImplInit() { pImp = new SvtURLBox_Impl(); + SetHelpId( ".uno:OpenURL" ); EnableAutocomplete( FALSE ); @@ -1301,7 +1303,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 9e04069fea79..bdbcd253c198 100644..100755 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -467,6 +467,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(); @@ -485,19 +486,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++; @@ -515,8 +518,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 ) @@ -540,7 +542,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'; @@ -563,7 +565,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 ); @@ -572,7 +574,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; @@ -581,7 +585,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; @@ -590,7 +594,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) ) @@ -1257,7 +1261,7 @@ void Ruler::ImplFormat() Size aVirDevSize; BOOL b3DLook = !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO); - // VirtualDevice initialisieren + // VirtualDevice initialize if ( mnWinStyle & WB_HORZ ) { aVirDevSize.Width() = mnVirWidth; @@ -1386,15 +1390,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 ); @@ -2887,7 +2891,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; @@ -2906,18 +2910,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/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx index 97c22686c24d..c211413af925 100644 --- a/svtools/source/edit/editsyntaxhighlighter.cxx +++ b/svtools/source/edit/editsyntaxhighlighter.cxx @@ -193,7 +193,7 @@ void MultiLineEditSyntaxHighlight::UpdateData() GetTextEngine()->RemoveAttribs( nLine, TRUE ); HighlightPortions aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); - for ( USHORT i = 0; i < aPortions.Count(); i++ ) + for ( size_t i = 0; i < aPortions.size(); i++ ) { HighlightPortion& r = aPortions[i]; GetTextEngine()->SetAttrib( TextAttribFontColor( GetColorValue(r.tokenType) ), nLine, r.nBegin, r.nEnd, TRUE ); diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx index 5729eb712bfe..87585f5b2587 100644 --- a/svtools/source/edit/syntaxhighlight.cxx +++ b/svtools/source/edit/syntaxhighlight.cxx @@ -34,9 +34,6 @@ #include <tools/debug.hxx> -SV_IMPL_VARARR(HighlightPortions, HighlightPortion) - - // ########################################################################## // ATTENTION: all these words needs to be in small caps // ########################################################################## @@ -849,7 +846,7 @@ void SimpleTokenizer_Impl::getHighlightPortions( UINT32 nParseLine, const String portion.nEnd = (UINT16)(pEndPos - mpStringBegin); portion.tokenType = eType; - portions.Insert(portion, portions.Count()); + portions.push_back(portion); } } diff --git a/svtools/source/edit/textdata.cxx b/svtools/source/edit/textdata.cxx index 32bdfe40a3fb..cb33ea7d50e6 100644 --- a/svtools/source/edit/textdata.cxx +++ b/svtools/source/edit/textdata.cxx @@ -37,7 +37,7 @@ SV_IMPL_PTRARR( TextLines, TextLinePtr ); SV_IMPL_VARARR( TEWritingDirectionInfos, TEWritingDirectionInfo ); -// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- // (+) class TextSelection // ------------------------------------------------------------------------- @@ -66,7 +66,7 @@ void TextSelection::Justify() } -// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- // (+) class TETextPortionList // ------------------------------------------------------------------------- TETextPortionList::TETextPortionList() @@ -129,7 +129,7 @@ USHORT TETextPortionList::GetPortionStartIndex( USHORT nPortion ) */ -// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- // (+) class TEParaPortion // ------------------------------------------------------------------------- TEParaPortion::TEParaPortion( TextNode* pN ) @@ -254,7 +254,7 @@ void TEParaPortion::CorrectValuesBehindLastFormattedLine( USHORT nLastFormattedL } } -// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- // (+) class TEParaPortions // ------------------------------------------------------------------------- TEParaPortions::TEParaPortions() @@ -274,7 +274,7 @@ void TEParaPortions::Reset() clear(); } -// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- // (+) class IdleFormatter // ------------------------------------------------------------------------- IdleFormatter::IdleFormatter() diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx index cde986b3cb7d..f9e4ee6951fb 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/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index 16bb8b20dfe5..7e29dbc4598f 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -44,8 +44,6 @@ const int MAX_TOKEN_LEN = 128; #define RTF_ISDIGIT( c ) (c >= '0' && c <= '9') #define RTF_ISALPHA( c ) ( (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ) -SV_IMPL_VARARR( RtfParserStates_Impl, RtfParserState_Impl ) - SvRTFParser::SvRTFParser( SvStream& rIn, BYTE nStackSize ) : SvParser( rIn, nStackSize ), eUNICodeSet( RTL_TEXTENCODING_MS_1252 ), // default ist ANSI-CodeSet @@ -175,14 +173,13 @@ int SvRTFParser::_GetNextToken() nUCharOverread = (BYTE)nTokenValue; #if 1 //cmc: other ifdef breaks #i3584 - aParserStates[ aParserStates.Count()-1]. + aParserStates.top(). nUCharOverread = nUCharOverread; #else if( !nUCharOverread ) - nUCharOverread = aParserStates[ - aParserStates.Count()-1].nUCharOverread; + nUCharOverread = aParserStates.top().nUCharOverread; else - aParserStates[ aParserStates.Count()-1]. + aParserStates.top(). nUCharOverread = nUCharOverread; #endif } @@ -252,12 +249,12 @@ int SvRTFParser::_GetNextToken() if( 0 <= nOpenBrakets ) { RtfParserState_Impl aState( nUCharOverread, GetSrcEncoding() ); - aParserStates.Insert( - aState, sal::static_int_cast< USHORT >(nOpenBrakets) ); + aParserStates.push( aState ); } ++nOpenBrakets; - DBG_ASSERT( nOpenBrakets == aParserStates.Count(), - "ParserStateStack unequal to bracket count" ); + DBG_ASSERT( + static_cast<size_t>(nOpenBrakets) == aParserStates.size(), + "ParserStateStack unequal to bracket count" ); nRet = nNextCh; } break; @@ -266,12 +263,11 @@ int SvRTFParser::_GetNextToken() --nOpenBrakets; if( 0 <= nOpenBrakets ) { - aParserStates.Remove( - sal::static_int_cast< USHORT >(nOpenBrakets) ); - if( aParserStates.Count() ) + aParserStates.pop(); + if( !aParserStates.empty() ) { const RtfParserState_Impl& rRPS = - aParserStates[ aParserStates.Count() - 1 ]; + aParserStates.top(); nUCharOverread = rRPS.nUCharOverread; SetSrcEncoding( rRPS.eCodeSet ); } @@ -281,8 +277,9 @@ int SvRTFParser::_GetNextToken() SetSrcEncoding( GetCodeSet() ); } } - DBG_ASSERT( nOpenBrakets == aParserStates.Count(), - "ParserStateStack unequal to bracket count" ); + DBG_ASSERT( + static_cast<size_t>(nOpenBrakets) == aParserStates.size(), + "ParserStateStack unequal to bracket count" ); nRet = nNextCh; break; @@ -690,8 +687,8 @@ void SvRTFParser::SetEncoding( rtl_TextEncoding eEnc ) if (eEnc == RTL_TEXTENCODING_DONTKNOW) eEnc = GetCodeSet(); - if (aParserStates.Count()) - aParserStates[aParserStates.Count() - 1].eCodeSet = eEnc; + if (!aParserStates.empty()) + aParserStates.top().eCodeSet = eEnc; SetSrcEncoding(eEnc); } diff --git a/svtools/source/svrtf/rtfkeywd.cxx b/svtools/source/svrtf/rtfkeywd.cxx index caca89492cda..7422961c6881 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 7d6296b76e8c..9c7052e22d77 100644 --- a/tools/inc/tools/wintypes.hxx +++ b/tools/inc/tools/wintypes.hxx @@ -274,9 +274,16 @@ typedef sal_Int64 WinBits; #define WB_STDTABCONTROL 0 // For TreeListBox -#define WB_HASBUTTONS ((WinBits)0x00800000) -#define WB_HASLINES ((WinBits)0x01000000) -#define WB_HASLINESATROOT ((WinBits)0x02000000) +#define WB_HASBUTTONS ((WinBits)SAL_CONST_INT64(0x000100000000)) +#define WB_HASLINES ((WinBits)SAL_CONST_INT64(0x000200000000)) +#define WB_HASLINESATROOT ((WinBits)SAL_CONST_INT64(0x000400000000)) +#define WB_HASBUTTONSATROOT ((WinBits)SAL_CONST_INT64(0x000800000000)) +#define WB_NOINITIALSELECTION ((WinBits)SAL_CONST_INT64(0x001000000000)) +#define WB_HIDESELECTION ((WinBits)SAL_CONST_INT64(0x002000000000)) +#define WB_FORCE_MAKEVISIBLE ((WinBits)SAL_CONST_INT64(0x004000000000)) +// DO NOT USE: 0x008000000000, that's WB_SYSTEMCHILDWINDOW +#define WB_QUICK_SEARCH ((WinBits)SAL_CONST_INT64(0x010000000000)) + // For FileOpen Dialog #define WB_PATH ((WinBits)0x00100000) diff --git a/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/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index e77dc529e410..87fddc0c65cd 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -198,19 +198,19 @@ String ConstructTempDir_Impl( const String* pParent ) void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_True ) { // add a suitable tempname - // Prefix can have 5 chars, leaving 3 for numbers. 26 ** 3 == 17576 - // ER 13.07.00 why not radix 36 [0-9A-Z] ?!? - const unsigned nRadix = 26; + // 36 ** 6 == 2176782336 + unsigned const nRadix = 36; + unsigned long const nMax = (nRadix*nRadix*nRadix*nRadix*nRadix*nRadix); String aName( rName ); aName += String::CreateFromAscii( "sv" ); rName.Erase(); - static unsigned long u = Time::GetSystemTicks(); - for ( unsigned long nOld = u; ++u != nOld; ) + unsigned long nSeed = Time::GetSystemTicks() % nMax; + for ( unsigned long u = nSeed; ++u != nSeed; ) { - u %= (nRadix*nRadix*nRadix); + u %= nMax; String aTmp( aName ); - aTmp += String::CreateFromInt32( (sal_Int32) (unsigned) u, nRadix ); + aTmp += String::CreateFromInt64( static_cast<sal_Int64>(u), nRadix ); aTmp += String::CreateFromAscii( ".tmp" ); if ( bDir ) diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h index 0bceb99d1d0e..4b0385844eed 100644 --- a/vcl/aqua/inc/salinst.h +++ b/vcl/aqua/inc/salinst.h @@ -134,9 +134,10 @@ public: virtual vos::IMutex* GetYieldMutex(); virtual ULONG ReleaseYieldMutex(); virtual void AcquireYieldMutex( ULONG nCount ); + virtual bool CheckYieldMutex(); virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( USHORT nType ); - virtual SalMenu* CreateMenu( BOOL bMenuBar ); + virtual SalMenu* CreateMenu( BOOL bMenuBar, Menu* pVCLMenu ); virtual void DestroyMenu( SalMenu* ); virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); virtual void DestroyMenuItem( SalMenuItem* ); diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 2ebb24437c24..5d2fc3f00741 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -566,6 +566,22 @@ void AquaSalInstance::AcquireYieldMutex( ULONG nCount ) // ----------------------------------------------------------------------- +bool AquaSalInstance::CheckYieldMutex() +{ + bool bRet = true; + + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() != + vos::OThread::getCurrentIdentifier() ) + { + bRet = false; + } + + return bRet; +} + +// ----------------------------------------------------------------------- + bool AquaSalInstance::isNSAppThread() const { return vos::OThread::getCurrentIdentifier() == maMainThread; diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index f33599fa086e..06af0358c52b 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" @@ -358,6 +360,8 @@ -(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app { + YIELD_GUARD; + SalData* pSalData = GetSalData(); #if 1 // currently do some really bad hack if( ! pSalData->maFrames.empty() ) @@ -416,11 +420,14 @@ #else // the clean version follows return pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ? NSTerminateCancel : NSTerminateNow; #endif + ImplImageTreeSingletonRef()->shutDown(); return NSTerminateNow; } -(void)systemColorsChanged: (NSNotification*) pNotification { + YIELD_GUARD; + const SalData* pSalData = GetSalData(); if( !pSalData->maFrames.empty() ) pSalData->maFrames.front()->CallCallback( SALEVENT_SETTINGSCHANGED, NULL ); @@ -428,6 +435,8 @@ -(void)screenParametersChanged: (NSNotification*) pNotification { + YIELD_GUARD; + SalData* pSalData = GetSalData(); std::list< AquaSalFrame* >::iterator it; for( it = pSalData->maFrames.begin(); it != pSalData->maFrames.end(); ++it ) diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx index e0a95a532bf8..01f989cbc1c1 100644 --- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx @@ -575,11 +575,19 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider(NSString* systemFlavor, Refe if (isByteSequenceType(data.getValueType())) { + /* + the HTMLFormatDataProvider prepends segment information to HTML + this is useful for exchange with MS Word (which brings this stuff from Windows) + but annoying for other applications. Since this extension is not a standard datatype + on the Mac, let us not provide but provide normal HTML + if ([systemFlavor caseInsensitiveCompare: NSHTMLPboardType] == NSOrderedSame) { dp = DataProviderPtr_t(new HTMLFormatDataProvider(data)); } - else if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame) + else + */ + if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame) { dp = DataProviderPtr_t(new BMPDataProvider(data, PICTImageFileType)); } diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index ce4370c57b9f..4530778c5775 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -578,12 +578,27 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) VCLToCocoa( aStateRect ); aStateRect = [NSWindow frameRectForContentRect: aStateRect styleMask: mnStyleMask]; - // relase and acquire mutex again since this call can block waiting for an internal lock + [mpWindow setFrame: aStateRect display: NO]; + if( pState->mnState == SAL_FRAMESTATE_MINIMIZED ) + [mpWindow miniaturize: NSApp]; + else if( [mpWindow isMiniaturized] ) + [mpWindow deminiaturize: NSApp]; + + + /* ZOOMED is not really maximized (actually it toggles between a user set size and + the program specified one), but comes closest since the default behavior is + "maximized" if the user did not intervene + */ + if( pState->mnState == SAL_FRAMESTATE_MAXIMIZED ) { - [mpWindow setFrame: aStateRect display: NO]; + if(! [mpWindow isZoomed]) + [mpWindow zoom: NSApp]; + } + else + { + if( [mpWindow isZoomed] ) + [mpWindow zoom: NSApp]; } - - // FIXME: HTH maximized state ? // get new geometry UpdateFrameGeometry(); @@ -641,8 +656,6 @@ BOOL AquaSalFrame::GetWindowState( SalFrameState* pState ) pState->mnWidth = long(aStateRect.size.width); pState->mnHeight = long(aStateRect.size.height); - // FIXME: HTH maximized state ? - if( [mpWindow isMiniaturized] ) pState->mnState = SAL_FRAMESTATE_MINIMIZED; else if( ! [mpWindow isZoomed] ) diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index ed3086d8506f..82102f2e7095 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -79,10 +79,14 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL; -(void)showPreferences: (id) sender { + YIELD_GUARD; + [self showDialog: SHOWDIALOG_ID_PREFERENCES]; } -(void)showAbout: (id) sender { + YIELD_GUARD; + [self showDialog: SHOWDIALOG_ID_ABOUT]; } @end @@ -203,11 +207,12 @@ static void initAppMenu() // ======================================================================= -SalMenu* AquaSalInstance::CreateMenu( BOOL bMenuBar ) +SalMenu* AquaSalInstance::CreateMenu( BOOL bMenuBar, Menu* pVCLMenu ) { initAppMenu(); AquaSalMenu *pAquaSalMenu = new AquaSalMenu( bMenuBar ); + pAquaSalMenu->mpVCLMenu = pVCLMenu; return pAquaSalMenu; } diff --git a/vcl/inc/vcl/arrange.hxx b/vcl/inc/vcl/arrange.hxx index 83568609f87b..f98197231be9 100644 --- a/vcl/inc/vcl/arrange.hxx +++ b/vcl/inc/vcl/arrange.hxx @@ -385,7 +385,12 @@ namespace vcl sal_uInt64 getMap( sal_uInt32 i_nX, sal_uInt32 i_nY ) { return static_cast< sal_uInt64 >(i_nX) | (static_cast< sal_uInt64>(i_nY) << 32 ); } - Size getOptimalSize( WindowSizeType, std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights ) const; + static void distributeExtraSize( std::vector<long>& io_rSizes, const std::vector<sal_Int32>& i_rPrios, long i_nExtraWidth ); + + Size getOptimalSize( WindowSizeType, + std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights, + std::vector<sal_Int32>& o_rColumnPrio, std::vector<sal_Int32>& o_rRowPrio + ) const; protected: virtual Element* getElement( size_t i_nIndex ) { return i_nIndex < m_aElements.size() ? &m_aElements[ i_nIndex ] : 0; } 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/outdev.hxx b/vcl/inc/vcl/outdev.hxx index f787df3692ce..12c4202af144 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -185,6 +185,9 @@ struct KerningPair #define TEXT_DRAW_MULTILINE ((USHORT)0x1000) #define TEXT_DRAW_WORDBREAK ((USHORT)0x2000) #define TEXT_DRAW_NEWSELLIPSIS ((USHORT)0x4000) +// in the long run we should make text style flags longer +// but at the moment we can get away with this 2 bit field for ellipsis style +#define TEXT_DRAW_CENTERELLIPSIS (TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_PATHELLIPSIS) #define TEXT_DRAW_WORDBREAK_HYPHENATION (((USHORT)0x8000) | TEXT_DRAW_WORDBREAK) @@ -1114,7 +1117,7 @@ public: /** Added return value to see if EPS could be painted directly. Theoreticaly, handing over a matrix would be needed to handle - painting rotated EPS files (e.g. contained mn Metafiles). This + painting rotated EPS files (e.g. contained in Metafiles). This would then need to be supported for Mac and PS printers, but that's too much for now, wrote #i107046# for this */ bool DrawEPS( const Point& rPt, const Size& rSz, diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index c389034d918f..810fbd353f8c 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -400,7 +400,7 @@ protected: PrinterController( const boost::shared_ptr<Printer>& ); public: enum NupOrderType - { LRTB, TBLR }; + { LRTB, TBLR, TBRL, RLTB }; struct MultiPageSetup { // all metrics in 100th mm diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index fdaf06c9854e..d53354c40b4a 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -59,6 +59,8 @@ namespace vcl VirtualDevice maPageVDev; rtl::OUString maReplacementString; rtl::OUString maToolTipString; + FixedLine maHorzDim; + FixedLine maVertDim; bool useHCColorReplacement() const; public: 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/salinst.hxx b/vcl/inc/vcl/salinst.hxx index 9b92bf95e3fe..71b820803473 100644 --- a/vcl/inc/vcl/salinst.hxx +++ b/vcl/inc/vcl/salinst.hxx @@ -60,6 +60,7 @@ struct SalItemParams; class SalSession; struct SystemGraphicsData; struct SystemWindowData; +class Menu; namespace vos { class IMutex; } @@ -133,6 +134,8 @@ public: virtual vos::IMutex* GetYieldMutex() = 0; virtual ULONG ReleaseYieldMutex() = 0; virtual void AcquireYieldMutex( ULONG nCount ) = 0; + // return true, if yield mutex is owned by this thread, else false + virtual bool CheckYieldMutex() = 0; // wait next event and dispatch // must returned by UserEvent (SalFrame::PostEvent) @@ -141,10 +144,10 @@ public: virtual bool AnyInput( USHORT nType ) = 0; // Menues - virtual SalMenu* CreateMenu( BOOL bMenuBar ) = 0; - virtual void DestroyMenu( SalMenu* pMenu) = 0; - virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ) = 0; - virtual void DestroyMenuItem( SalMenuItem* pItem ) = 0; + virtual SalMenu* CreateMenu( BOOL bMenuBar, Menu* pMenu ); + virtual void DestroyMenu( SalMenu* pMenu); + virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); + virtual void DestroyMenuItem( SalMenuItem* pItem ); // may return NULL to disable session management virtual SalSession* CreateSalSession() = 0; diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index 0d54a82a1937..a4ce806a7e8a 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -28,20 +28,19 @@ #ifndef _SV_SVDATA_HXX #define _SV_SVDATA_HXX -#ifndef _VOS_THREAD_HXX -#include <vos/thread.hxx> -#endif -#include <tools/string.hxx> -#include <tools/gen.hxx> -#include <tools/shl.hxx> -#include <tools/link.hxx> -#include <vcl/vclevent.hxx> -#include <vcl/sv.h> -#include <tools/color.hxx> -#include <tools/debug.hxx> -#include <vcl/dllapi.h> -#include <com/sun/star/uno/Reference.hxx> -#include <unotools/options.hxx> +#include "vos/thread.hxx" +#include "tools/string.hxx" +#include "tools/gen.hxx" +#include "tools/shl.hxx" +#include "tools/link.hxx" +#include "tools/fldunit.hxx" +#include "vcl/vclevent.hxx" +#include "vcl/sv.h" +#include "tools/color.hxx" +#include "tools/debug.hxx" +#include "vcl/dllapi.h" +#include "com/sun/star/uno/Reference.hxx" +#include "unotools/options.hxx" namespace com { namespace sun { @@ -247,6 +246,8 @@ struct ImplSVWinData // - ImplSVCtrlData - // ------------------ +typedef std::vector< std::pair< String, FieldUnit > > FieldUnitStringList; + struct ImplSVCtrlData { ImageList* mpCheckImgList; // ImageList for CheckBoxes @@ -270,6 +271,8 @@ struct ImplSVCtrlData ULONG mnLastRadioFColor; // Letzte FaceColor fuer RadioImage ULONG mnLastRadioWColor; // Letzte WindowColor fuer RadioImage ULONG mnLastRadioLColor; // Letzte LightColor fuer RadioImage + FieldUnitStringList* mpFieldUnitStrings; // list with field units + FieldUnitStringList* mpCleanUnitStrings; // same list but with some "fluff" like spaces removed }; @@ -318,8 +321,7 @@ struct ImplSVNWFData // checkbox bool mbScrollbarJumpPage; // true for "jump to here" behavior int mnStatusBarLowerRightOffset; // amount in pixel to avoid in the lower righthand corner - // used on the Mac where the system resizer paints over - // our window content + bool mbCanDrawWidgetAnySize; // set to true currently on gtk }; @@ -393,6 +395,10 @@ inline ImplSVData* ImplGetAppSVData() { return ImplGetSVData(); } bool ImplInitAccessBridge( BOOL bAllowCancel, BOOL &rCancelled ); +FieldUnitStringList* ImplGetFieldUnits(); +FieldUnitStringList* ImplGetCleanedFieldUnits(); + + // ----------------------------------------------------------------------- // ----------------- diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc index 059ed1524b7c..e915644aa8ec 100644 --- a/vcl/inc/vcl/svids.hrc +++ b/vcl/inc/vcl/svids.hrc @@ -122,8 +122,10 @@ #define SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT 1 #define SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE 2 -#define SV_PRINT_PRT_NUP_ORDER_LRTD 0 -#define SV_PRINT_PRT_NUP_ORDER_TDLR 1 +#define SV_PRINT_PRT_NUP_ORDER_LRTB 0 +#define SV_PRINT_PRT_NUP_ORDER_TBLR 1 +#define SV_PRINT_PRT_NUP_ORDER_TBRL 2 +#define SV_PRINT_PRT_NUP_ORDER_RLTB 3 #define SV_PRINT_TAB_JOB 2 #define SV_PRINT_PRINTERS_FL 1 @@ -212,7 +214,8 @@ #define SV_ACCESSERROR_JAVA_NOT_CONFIGURED 10507 #define SV_ACCESSERROR_JAVA_DISABLED 10508 #define SV_ACCESSERROR_TURNAROUND_MSG 10509 -#define SV_ACCESSERROR_LAST SV_ACCESSERROR_TURNAROUND_MSG +#define SV_ACCESSERROR_NO_FONTS 10510 +#define SV_ACCESSERROR_LAST SV_ACCESSERROR_NO_FONTS #define SV_SHORTCUT_HELP 10600 #define SV_SHORTCUT_CONTEXTHELP 10601 diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index 7c72f40d2767..d209becfb4ae 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -598,6 +598,7 @@ public: virtual void KeyUp( const KeyEvent& rKEvt ); virtual void PrePaint(); virtual void Paint( const Rectangle& rRect ); + virtual void PostPaint(); virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); virtual void Move(); virtual void Resize(); diff --git a/vcl/os2/inc/salinst.h b/vcl/os2/inc/salinst.h index 0948f605c286..7826a62e1f9b 100644 --- a/vcl/os2/inc/salinst.h +++ b/vcl/os2/inc/salinst.h @@ -85,12 +85,9 @@ public: virtual vos::IMutex* GetYieldMutex(); virtual ULONG ReleaseYieldMutex(); virtual void AcquireYieldMutex( ULONG nCount ); + virtual bool CheckYieldMutex(); virtual void Yield( bool, bool ); virtual bool AnyInput( USHORT nType ); - virtual SalMenu* CreateMenu( BOOL bMenuBar ); - virtual void DestroyMenu( SalMenu* ); - virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); - virtual void DestroyMenuItem( SalMenuItem* ); virtual SalSession* CreateSalSession(); virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); diff --git a/vcl/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx index b08a9769ccf4..df564f36ee0a 100644 --- a/vcl/os2/source/app/salinst.cxx +++ b/vcl/os2/source/app/salinst.cxx @@ -298,10 +298,9 @@ void ImplSalAcquireYieldMutex( ULONG nCount ) // ----------------------------------------------------------------------- -#ifdef DBG_UTIL - -void ImplDbgTestSolarMutex() +bool Os2SalInstance::CheckYieldMutex() { + bool bRet = true; SalData* pSalData = GetSalData(); ULONG nCurThreadId = GetCurrentThreadId(); if ( pSalData->mnAppThreadId != nCurThreadId ) @@ -311,7 +310,7 @@ void ImplDbgTestSolarMutex() SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; if ( pYieldMutex->mnThreadId != nCurThreadId ) { - DBG_ERROR( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" ); + bRet = false; } } } @@ -322,14 +321,13 @@ void ImplDbgTestSolarMutex() SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; if ( pYieldMutex->mnThreadId != nCurThreadId ) { - DBG_ERROR( "SolarMutex not locked in the main thread" ); + bRet = false; } } } + return bRet; } -#endif - // ======================================================================= void InitSalData() diff --git a/vcl/os2/source/window/makefile.mk b/vcl/os2/source/window/makefile.mk index f4a6ad0cb870..560d35880b21 100644 --- a/vcl/os2/source/window/makefile.mk +++ b/vcl/os2/source/window/makefile.mk @@ -40,7 +40,7 @@ CXXFILES__YD= salframe.cxx \ salobj.cxx SLOFILES= $(SLO)$/salframe.obj \ - $(SLO)$/salobj.obj $(SLO)$/salmenu.obj + $(SLO)$/salobj.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/os2/source/window/salmenu.cxx b/vcl/os2/source/window/salmenu.cxx deleted file mode 100644 index 339ab5dbfadb..000000000000 --- a/vcl/os2/source/window/salmenu.cxx +++ /dev/null @@ -1,132 +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. - * - ************************************************************************/ - -#define INCL_DOS -#define INCL_PM -#define INCL_WIN -#include <svpm.h> -#include <saldata.hxx> -#include <salinst.h> -#include <salmenu.h> - - -// ======================================================================= - -// Os2SalInst factory methods - -SalMenu* Os2SalInstance::CreateMenu( BOOL bMenuBar ) -{ - return NULL; // no support for native menues -} - -void Os2SalInstance::DestroyMenu( SalMenu* pSalMenu ) -{ - delete pSalMenu; -} - - -SalMenuItem* Os2SalInstance::CreateMenuItem( const SalItemParams* pItemData ) -{ - return NULL; // no support for native menues -} - -void Os2SalInstance::DestroyMenuItem( SalMenuItem* pSalMenuItem ) -{ - delete pSalMenuItem; -} - - -// ======================================================================= - - -/* - * Os2SalMenu - */ - - -Os2SalMenu::~Os2SalMenu() -{ -} - -BOOL Os2SalMenu::VisibleMenuBar() -{ - return FALSE; -} - -void Os2SalMenu::SetFrame( const SalFrame *pFrame ) -{ -} - -void Os2SalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) -{ -} - -void Os2SalMenu::RemoveItem( unsigned nPos ) -{ -} - -void Os2SalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) -{ -} - -void Os2SalMenu::CheckItem( unsigned nPos, BOOL bCheck ) -{ -} - -void Os2SalMenu::EnableItem( unsigned nPos, BOOL bEnable ) -{ -} - -void Os2SalMenu::SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) -{ -} - -void Os2SalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText ) -{ -} - -void Os2SalMenu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const XubString& rKeyName ) -{ -} - -void Os2SalMenu::GetSystemMenuData( SystemMenuData* pData ) -{ -} - -// ======================================================================= - -/* - * SalMenuItem - */ - - -Os2SalMenuItem::~Os2SalMenuItem() -{ -} - -// ------------------------------------------------------------------- - diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index bf6b36a7eaf7..13f888e3909c 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -77,6 +77,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/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index dd9a5b4a15ee..b48db1d6ee97 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -37,32 +37,33 @@ #include <cmath> #include <limits.h> -#include <vcl/svdata.hxx> -#include <svsys.h> +#include "vcl/svdata.hxx" +#include "svsys.h" #ifdef WNT #undef min #endif -#include <tools/debug.hxx> -#include <vcl/svdata.hxx> -#include <vcl/svapp.hxx> -#include <vcl/event.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/button.hxx> -#include <vcl/edit.hxx> -#include <vcl/fixed.hxx> -#include <vcl/group.hxx> -#include <vcl/field.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/sound.hxx> -#include <vcl/threadex.hxx> -#include <vcl/dbggui.hxx> -#include <com/sun/star/i18n/XCharacterClassification.hpp> - -#include <vcl/unohelp.hxx> -#include <vcl/unohelp2.hxx> -#include <vos/mutex.hxx> +#include "tools/debug.hxx" +#include "vcl/svdata.hxx" +#include "vcl/svapp.hxx" +#include "vcl/event.hxx" +#include "vcl/lstbox.hxx" +#include "vcl/button.hxx" +#include "vcl/edit.hxx" +#include "vcl/fixed.hxx" +#include "vcl/group.hxx" +#include "vcl/field.hxx" +#include "vcl/msgbox.hxx" +#include "vcl/wrkwin.hxx" +#include "vcl/sound.hxx" +#include "vcl/threadex.hxx" +#include "vcl/dbggui.hxx" +#include "com/sun/star/i18n/XCharacterClassification.hpp" + +#include "vcl/unohelp.hxx" +#include "vcl/unohelp2.hxx" +#include "vos/mutex.hxx" +#include "vcl/salinst.hxx" #include <map> #include <algorithm> @@ -1963,9 +1964,11 @@ void DbgPrintWindow( const char* pLine ) // ======================================================================= -#ifdef WNT -void ImplDbgTestSolarMutex(); -#endif +void ImplDbgTestSolarMutex() +{ + bool bCheck = ImplGetSVData()->mpDefInst->CheckYieldMutex(); + OSL_ENSURE( bCheck, "SolarMutex not locked" ); +} // ======================================================================= @@ -1973,9 +1976,7 @@ void DbgGUIInit() { DbgSetPrintMsgBox( DbgPrintMsgBox ); DbgSetPrintWindow( DbgPrintWindow ); -#ifdef WNT DbgSetTestSolarMutex( ImplDbgTestSolarMutex ); -#endif } // ----------------------------------------------------------------------- @@ -1984,9 +1985,7 @@ void DbgGUIDeInit() { DbgSetPrintMsgBox( NULL ); DbgSetPrintWindow( NULL ); -#ifdef WNT DbgSetTestSolarMutex( NULL ); -#endif DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin; if ( pDbgWindow ) diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 9a2404d36740..2a04389d8f44 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -74,6 +74,29 @@ void SalInstance::FillFontPathList( std::list< rtl::OString >& ) // do nothing } +SalMenu* SalInstance::CreateMenu( BOOL, Menu* ) +{ + // default: no native menus + return NULL; +} + +void SalInstance::DestroyMenu( SalMenu* pMenu ) +{ + (void)pMenu; + OSL_ENSURE( pMenu == 0, "DestroyMenu called with non-native menus" ); +} + +SalMenuItem* SalInstance::CreateMenuItem( const SalItemParams* ) +{ + return NULL; +} + +void SalInstance::DestroyMenuItem( SalMenuItem* pItem ) +{ + (void)pItem; + OSL_ENSURE( pItem == 0, "DestroyMenu called with non-native menus" ); +} + SalTimer::~SalTimer() { } diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index f8b0d1d3379f..03b0365cff63 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -27,47 +27,49 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" + #include <string.h> -#ifndef _SV_SVSYS_HXX -#include <svsys.h> -#endif -#include <vcl/salinst.hxx> -#include <vcl/salframe.hxx> - -#ifndef _VOS_MUTEX_HXX -#include <vos/mutex.hxx> -#endif - -#include <osl/process.h> -#include <osl/file.hxx> -#include <uno/current_context.hxx> -#include <cppuhelper/implbase1.hxx> -#include <tools/debug.hxx> -#include <unotools/fontcfg.hxx> -#include <vcl/configsettings.hxx> -#include <vcl/svdata.hxx> -#include <vcl/window.h> -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/unohelp.hxx> -#include <vcl/button.hxx> // for Button::GetStandardText -#include <vcl/dockwin.hxx> // for DockingManager -#include <vcl/salimestatus.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/awt/XExtendedToolkit.hpp> -#include <com/sun/star/java/JavaNotConfiguredException.hpp> -#include <com/sun/star/java/JavaVMCreationFailureException.hpp> -#include <com/sun/star/java/MissingJavaRuntimeException.hpp> -#include <com/sun/star/java/JavaDisabledException.hpp> - -#include <com/sun/star/lang/XComponent.hpp> +#include "rtl/instance.hxx" +#include "osl/process.h" +#include "osl/file.hxx" + +#include "svsys.h" + +#include "tools/debug.hxx" +#include "tools/resary.hxx" + +#include "vcl/salinst.hxx" +#include "vcl/salframe.hxx" +#include "vcl/configsettings.hxx" +#include "vcl/svdata.hxx" +#include "vcl/window.h" +#include "vcl/svapp.hxx" +#include "vcl/wrkwin.hxx" +#include "vcl/msgbox.hxx" +#include "vcl/unohelp.hxx" +#include "vcl/button.hxx" // for Button::GetStandardText +#include "vcl/dockwin.hxx" // for DockingManager +#include "vcl/salimestatus.hxx" +#include "vcl/salsys.hxx" +#include "vcl/svids.hrc" + +#include "unotools/fontcfg.hxx" + +#include "vos/mutex.hxx" + +#include "cppuhelper/implbase1.hxx" +#include "uno/current_context.hxx" + +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/awt/XExtendedToolkit.hpp" +#include "com/sun/star/java/JavaNotConfiguredException.hpp" +#include "com/sun/star/java/JavaVMCreationFailureException.hpp" +#include "com/sun/star/java/MissingJavaRuntimeException.hpp" +#include "com/sun/star/java/JavaDisabledException.hpp" #include <stdio.h> -#include <vcl/salsys.hxx> -#include <vcl/svids.hrc> -#include <rtl/instance.hxx> using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -112,7 +114,6 @@ void ImplInitSVData() // init global instance data memset( pImplSVData, 0, sizeof( ImplSVData ) ); pImplSVData->maHelpData.mbAutoHelpId = sal_True; - pImplSVData->maHelpData.mbAutoHelpId = sal_True; pImplSVData->maNWFData.maMenuBarHighlightTextColor = Color( COL_TRANSPARENT ); // find out whether we are running in the testtool @@ -163,6 +164,11 @@ void ImplDeInitSVData() delete pSVData->maAppData.mpMSFTempFileName; pSVData->maAppData.mpMSFTempFileName = NULL; } + + if( pSVData->maCtrlData.mpFieldUnitStrings ) + delete pSVData->maCtrlData.mpFieldUnitStrings, pSVData->maCtrlData.mpFieldUnitStrings = NULL; + if( pSVData->maCtrlData.mpCleanUnitStrings ) + delete pSVData->maCtrlData.mpCleanUnitStrings, pSVData->maCtrlData.mpCleanUnitStrings = NULL; } // ----------------------------------------------------------------------- @@ -240,6 +246,52 @@ ResId VclResId( sal_Int32 nId ) return ResId( nId, *pMgr ); } +FieldUnitStringList* ImplGetFieldUnits() +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->maCtrlData.mpFieldUnitStrings ) + { + ResMgr* pResMgr = ImplGetResMgr(); + if( pResMgr ) + { + ResStringArray aUnits( ResId (SV_FUNIT_STRINGS, *pResMgr) ); + sal_uInt32 nUnits = aUnits.Count(); + pSVData->maCtrlData.mpFieldUnitStrings = new FieldUnitStringList(); + pSVData->maCtrlData.mpFieldUnitStrings->reserve( nUnits ); + for( sal_uInt32 i = 0; i < nUnits; i++ ) + { + std::pair< String, FieldUnit > aElement( aUnits.GetString(i), static_cast<FieldUnit>(aUnits.GetValue(i)) ); + pSVData->maCtrlData.mpFieldUnitStrings->push_back( aElement ); + } + } + } + return pSVData->maCtrlData.mpFieldUnitStrings; +} + +FieldUnitStringList* ImplGetCleanedFieldUnits() +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->maCtrlData.mpCleanUnitStrings ) + { + FieldUnitStringList* pUnits = ImplGetFieldUnits(); + if( pUnits ) + { + size_t nUnits = pUnits->size(); + pSVData->maCtrlData.mpCleanUnitStrings = new FieldUnitStringList(); + pSVData->maCtrlData.mpCleanUnitStrings->reserve( nUnits ); + for( size_t i = 0; i < nUnits; i++ ) + { + String aUnit( (*pUnits)[i].first ); + aUnit.EraseAllChars( sal_Unicode( ' ' ) ); + aUnit.ToLowerAscii(); + std::pair< String, FieldUnit > aElement( aUnit, (*pUnits)[i].second ); + pSVData->maCtrlData.mpCleanUnitStrings->push_back( aElement ); + } + } + } + return pSVData->maCtrlData.mpCleanUnitStrings; +} + DockingManager* ImplGetDockingManager() { ImplSVData* pSVData = ImplGetSVData(); diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index c4debea79001..7cfdecbfdb00 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -62,6 +62,10 @@ extern Sequence< OUString > SAL_CALL FontIdentificator_getSupportedServiceNames( extern OUString SAL_CALL FontIdentificator_getImplementationName(); extern Reference< XInterface > SAL_CALL FontIdentificator_createInstance( const Reference< XMultiServiceFactory > & ); +extern Sequence< OUString > SAL_CALL StringMirror_getSupportedServiceNames(); +extern OUString SAL_CALL StringMirror_getImplementationName(); +extern Reference< XInterface > SAL_CALL StringMirror_createInstance( const Reference< XMultiServiceFactory > & ); + extern Sequence< OUString > SAL_CALL Clipboard_getSupportedServiceNames(); extern OUString SAL_CALL Clipboard_getImplementationName(); extern Reference< XSingleServiceFactory > SAL_CALL Clipboard_createFactory( const Reference< XMultiServiceFactory > & ); @@ -116,6 +120,12 @@ extern "C" { xMgr, vcl::FontIdentificator_getImplementationName(), vcl::FontIdentificator_createInstance, vcl::FontIdentificator_getSupportedServiceNames() ); } + else if( vcl::StringMirror_getImplementationName().equalsAscii( pImplementationName ) ) + { + xFactory = ::cppu::createSingleFactory( + xMgr, vcl::StringMirror_getImplementationName(), vcl::StringMirror_createInstance, + vcl::StringMirror_getSupportedServiceNames() ); + } else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) ) { xFactory = vcl::Clipboard_createFactory( xMgr ); diff --git a/vcl/source/components/makefile.mk b/vcl/source/components/makefile.mk index e30975dbc099..982687104c01 100644 --- a/vcl/source/components/makefile.mk +++ b/vcl/source/components/makefile.mk @@ -39,9 +39,10 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- -SLOFILES= $(SLO)$/display.obj \ - $(SLO)$/dtranscomp.obj \ - $(SLO)$/fontident.obj \ +SLOFILES= $(SLO)$/display.obj \ + $(SLO)$/dtranscomp.obj \ + $(SLO)$/fontident.obj \ + $(SLO)$/stringmirror.obj \ $(SLO)$/factory.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/source/components/stringmirror.cxx b/vcl/source/components/stringmirror.cxx new file mode 100644 index 000000000000..78806914a7c4 --- /dev/null +++ b/vcl/source/components/stringmirror.cxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * 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_vcl.hxx" + +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/util/XStringMapping.hpp" + +#include "cppuhelper/implbase2.hxx" +#include "rtl/ustrbuf.hxx" +#include "vcl/svapp.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::util; + +// ----------------------------------------------------------------------- + +namespace vcl +{ + +class StringMirror : public ::cppu::WeakAggImplHelper2< XStringMapping, XServiceInfo > +{ +public: + StringMirror() + {} + + virtual ~StringMirror() + {} + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const OUString& ) throw (RuntimeException); + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); + + // XStringMapping + virtual sal_Bool SAL_CALL mapStrings( Sequence< OUString >& io_rStrings ) throw (RuntimeException) + { + sal_Int32 nItems = io_rStrings.getLength(); + for( sal_Int32 n = 0; n < nItems; n++ ) + { + rtl::OUString& rStr( io_rStrings.getArray()[n] ); + + sal_Int32 nLen = rStr.getLength(); + rtl::OUStringBuffer aMirror( nLen ); + for(sal_Int32 i = nLen - 1; i >= 0; i--) + { + sal_Unicode cChar = rStr[ i ]; + aMirror.append(sal_Unicode(GetMirroredChar(cChar))); + } + rStr = aMirror.makeStringAndClear(); + } + return sal_True; + } +}; + +Sequence< OUString > StringMirror_getSupportedServiceNames() +{ + static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.StringMirror" ) ); + static Sequence< OUString > aServiceNames( &aServiceName, 1 ); + return aServiceNames; +} + +OUString StringMirror_getImplementationName() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "vcl::StringMirror" ) ); +} + +Reference< XInterface > SAL_CALL StringMirror_createInstance( const Reference< XMultiServiceFactory >& ) +{ + return static_cast< ::cppu::OWeakObject * >( new StringMirror ); +} + + +// XServiceInfo +OUString SAL_CALL StringMirror::getImplementationName() throw (RuntimeException) +{ + return StringMirror_getImplementationName(); +} + +sal_Bool SAL_CALL StringMirror::supportsService( const OUString& i_rServiceName ) throw (RuntimeException) +{ + Sequence< OUString > aSN( StringMirror_getSupportedServiceNames() ); + for( sal_Int32 nService = 0; nService < aSN.getLength(); nService++ ) + { + if( aSN[nService] == i_rServiceName ) + return sal_True; + } + return sal_False; +} + +Sequence< OUString > SAL_CALL StringMirror::getSupportedServiceNames() throw (RuntimeException) +{ + return StringMirror_getSupportedServiceNames(); +} + +} // namespace vcl diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index a692cbea0260..5091a4722845 100755 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1801,6 +1801,9 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) } break; + /* #i101255# disable autocomplete tab forward/backward + users expect tab/shif-tab to move the focus to other controls + not suddenly to cycle the autocompletion case KEY_TAB: { if ( !mbReadOnly && maAutocompleteHdl.IsSet() && @@ -1822,6 +1825,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) } } break; + */ default: { diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 6c2b06783984..4c4e3c870429 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -52,8 +52,6 @@ using namespace ::com::sun::star; -static ResStringArray *strAllUnits = NULL; - // ----------------------------------------------------------------------- #define FORMAT_NUMERIC 1 @@ -1131,34 +1129,37 @@ static XubString ImplMetricGetUnitText( const XubString& rStr ) // #104355# support localized mesaurements -static String ImplMetricToString( FieldUnit rUnit ) +static const String& ImplMetricToString( FieldUnit rUnit ) { - if( !strAllUnits ) + FieldUnitStringList* pList = ImplGetFieldUnits(); + if( pList ) { - ResMgr* pResMgr = ImplGetResMgr(); - strAllUnits = new ResStringArray( ResId (SV_FUNIT_STRINGS, *pResMgr) ); + // return unit's default string (ie, the first one ) + for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it ) + { + if ( it->second == rUnit ) + return it->first; + } } - // return unit's default string (ie, the first one ) - for( USHORT i=0; i < strAllUnits->Count(); i++ ) - if( (FieldUnit) strAllUnits->GetValue( i ) == rUnit ) - return strAllUnits->GetString( i ); - return String(); + return String::EmptyString(); } static FieldUnit ImplStringToMetric( const String &rMetricString ) { - if( !strAllUnits ) + FieldUnitStringList* pList = ImplGetCleanedFieldUnits(); + if( pList ) { - ResMgr* pResMgr = ImplGetResMgr(); - strAllUnits = new ResStringArray( ResId (SV_FUNIT_STRINGS, *pResMgr) ); + // return FieldUnit + String aStr( rMetricString ); + aStr.ToLowerAscii(); + aStr.EraseAllChars( sal_Unicode( ' ' ) ); + for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it ) + { + if ( it->first.Equals( aStr ) ) + return it->second; + } } - // return FieldUnit - String aStr( rMetricString ); - aStr.ToLowerAscii(); - for( USHORT i=0; i < strAllUnits->Count(); i++ ) - if ( strAllUnits->GetString( i ).Equals( aStr ) ) - return (FieldUnit) strAllUnits->GetValue( i ); return FUNIT_NONE; } diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 37406293d7cf..f73cf008a5e5 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -27,13 +27,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <vcl/decoview.hxx> -#include <vcl/event.hxx> -#include <vcl/fixed.hxx> -#include <vcl/controldata.hxx> -#include <vcl/window.h> +#include "vcl/decoview.hxx" +#include "vcl/event.hxx" +#include "vcl/fixed.hxx" +#include "vcl/controldata.hxx" +#include "vcl/window.h" -#include <tools/rc.h> +#include "tools/rc.h" // ======================================================================= @@ -501,7 +501,7 @@ void FixedLine::ImplDraw( bool bLayout ) String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; DecorationView aDecoView( this ); - if ( !aText.Len() || (nWinStyle & WB_VERT) ) + if ( !aText.Len() ) { if( !pVector ) { @@ -520,11 +520,34 @@ void FixedLine::ImplDraw( bool bLayout ) } } } + else if( (nWinStyle & WB_VERT) ) + { + long nWidth = GetTextWidth( aText ); + Push( PUSH_FONT ); + Font aFont( GetFont() ); + aFont.SetOrientation( 900 ); + SetFont( aFont ); + Point aStartPt( aOutSize.Width()/2, aOutSize.Height()-1 ); + if( (nWinStyle & WB_VCENTER) ) + aStartPt.Y() -= (aOutSize.Height() - nWidth)/2; + Point aTextPt( aStartPt ); + aTextPt.X() -= GetTextHeight()/2; + DrawText( aTextPt, aText, 0, STRING_LEN, pVector, pDisplayText ); + Pop(); + if( aOutSize.Height() - aStartPt.Y() > FIXEDLINE_TEXT_BORDER ) + aDecoView.DrawSeparator( Point( aStartPt.X(), aOutSize.Height()-1 ), + Point( aStartPt.X(), aStartPt.Y() + FIXEDLINE_TEXT_BORDER ) ); + if( aStartPt.Y() - nWidth - FIXEDLINE_TEXT_BORDER > 0 ) + aDecoView.DrawSeparator( Point( aStartPt.X(), aStartPt.Y() - nWidth - FIXEDLINE_TEXT_BORDER ), + Point( aStartPt.X(), 0 ) ); + } else { USHORT nStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS; Rectangle aRect( 0, 0, aOutSize.Width(), aOutSize.Height() ); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + if( (nWinStyle & WB_CENTER) ) + nStyle |= TEXT_DRAW_CENTER; if ( !IsEnabled() ) nStyle |= TEXT_DRAW_DISABLE; @@ -539,6 +562,8 @@ void FixedLine::ImplDraw( bool bLayout ) { long nTop = aRect.Top() + ((aRect.GetHeight()-1)/2); aDecoView.DrawSeparator( Point( aRect.Right()+FIXEDLINE_TEXT_BORDER, nTop ), Point( aOutSize.Width()-1, nTop ), false ); + if( aRect.Left() > FIXEDLINE_TEXT_BORDER ) + aDecoView.DrawSeparator( Point( 0, nTop ), Point( aRect.Left()-FIXEDLINE_TEXT_BORDER, nTop ), false ); } } } 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/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 754270e9012f..c51ac834f1b4 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -114,8 +114,9 @@ BOOL ImplDrawNativeSpinfield( Window *pWin, const SpinbuttonValue& rSpinbuttonVa Size aSize( pBorder->GetOutputSizePixel() ); // the size of the border window, i.e., the whole control Rectangle aBound, aContent; Rectangle aNatRgn( aPt, aSize ); - if( pBorder->GetNativeControlRegion(CTRL_SPINBOX, PART_ENTIRE_CONTROL, - aNatRgn, 0, rSpinbuttonValue, rtl::OUString(), aBound, aContent) ) + if( ! ImplGetSVData()->maNWFData.mbCanDrawWidgetAnySize && + pBorder->GetNativeControlRegion( CTRL_SPINBOX, PART_ENTIRE_CONTROL, + aNatRgn, 0, rSpinbuttonValue, rtl::OUString(), aBound, aContent) ) { aSize = aContent.GetSize(); } 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/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 8eb4dec3c92a..f4ea98484c33 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -27,62 +27,57 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <cstring> -#include <i18npool/mslangid.hxx> -#ifndef _SV_SVSYS_HXX -#include <svsys.h> -#endif -#include <vcl/salgdi.hxx> -#include <vcl/sallayout.hxx> -#include <rtl/tencinfo.h> -#include <tools/debug.hxx> -#include <vcl/svdata.hxx> -#include <vcl/metric.hxx> -#include <vcl/impfont.hxx> -#include <vcl/metaact.hxx> -#include <vcl/gdimtf.hxx> -#include <vcl/outdata.hxx> -#include <vcl/outfont.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/polygon/b2dpolypolygon.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <tools/poly.hxx> -#include <vcl/outdev.h> -#include <vcl/virdev.hxx> -#include <vcl/print.hxx> -#include <vcl/event.hxx> -#include <vcl/window.h> -#include <vcl/window.hxx> -#include <vcl/svapp.hxx> -#include <vcl/bmpacc.hxx> -#include <unotools/fontcvt.hxx> -#include <vcl/outdev.hxx> -#include <vcl/edit.hxx> -#include <unotools/fontcfg.hxx> -#include <vcl/sysdata.hxx> -#include <vcl/textlayout.hxx> -#ifndef _OSL_FILE_H -#include <osl/file.h> -#endif +#include "i18npool/mslangid.hxx" + +#include "svsys.h" +#include "vcl/salgdi.hxx" +#include "vcl/sallayout.hxx" +#include "rtl/tencinfo.h" +#include "tools/debug.hxx" +#include "vcl/svdata.hxx" +#include "vcl/metric.hxx" +#include "vcl/impfont.hxx" +#include "vcl/metaact.hxx" +#include "vcl/gdimtf.hxx" +#include "vcl/outdata.hxx" +#include "vcl/outfont.hxx" +#include "basegfx/polygon/b2dpolygon.hxx" +#include "basegfx/polygon/b2dpolypolygon.hxx" +#include "basegfx/matrix/b2dhommatrix.hxx" +#include "tools/poly.hxx" +#include "vcl/outdev.h" +#include "vcl/virdev.hxx" +#include "vcl/print.hxx" +#include "vcl/event.hxx" +#include "vcl/window.h" +#include "vcl/window.hxx" +#include "vcl/svapp.hxx" +#include "vcl/bmpacc.hxx" +#include "unotools/fontcvt.hxx" +#include "vcl/outdev.hxx" +#include "vcl/edit.hxx" +#include "unotools/fontcfg.hxx" +#include "vcl/sysdata.hxx" +#include "vcl/textlayout.hxx" +#include "vcl/svids.hrc" +#include "osl/file.h" #ifdef ENABLE_GRAPHITE -#include <vcl/graphite_features.hxx> +#include "vcl/graphite_features.hxx" #endif #ifdef USE_BUILTIN_RASTERIZER -#include <vcl/glyphcache.hxx> +#include "vcl/glyphcache.hxx" #endif -#include <vcl/unohelp.hxx> -#include <pdfwriter_impl.hxx> -#include <vcl/controllayout.hxx> -#include <rtl/logfile.hxx> +#include "vcl/unohelp.hxx" +#include "pdfwriter_impl.hxx" +#include "vcl/controllayout.hxx" +#include "rtl/logfile.hxx" -#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HDL_ -#include <com/sun/star/beans/PropertyValues.hdl> -#endif -#include <com/sun/star/i18n/XBreakIterator.hpp> -#include <com/sun/star/i18n/WordType.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> +#include "com/sun/star/beans/PropertyValues.hpp" +#include "com/sun/star/i18n/XBreakIterator.hpp" +#include "com/sun/star/i18n/WordType.hpp" +#include "com/sun/star/linguistic2/XLinguServiceManager.hpp" #if defined UNX #define GLYPH_FONT_HEIGHT 128 @@ -92,7 +87,7 @@ #define GLYPH_FONT_HEIGHT 256 #endif -#include <sal/alloca.h> +#include "sal/alloca.h" #include <cmath> #include <cstring> @@ -2927,6 +2922,18 @@ void OutputDevice::ImplInitFontList() const mpGraphics->GetDevFontList( mpFontList ); } } + if( meOutDevType == OUTDEV_WINDOW && ! mpFontList->Count() ) + { + String aError( RTL_CONSTASCII_USTRINGPARAM( "Application error: no fonts and no vcl resource found on your system" ) ); + ResMgr* pMgr = ImplGetResMgr(); + if( pMgr ) + { + String aResStr( ResId( SV_ACCESSERROR_NO_FONTS, *pMgr ) ); + if( aResStr.Len() ) + aError = aResStr; + } + Application::Abort( aError ); + } } // ======================================================================= @@ -6834,7 +6841,20 @@ String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, c if ( nIndex != STRING_LEN ) { - if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) + if( (nStyle & TEXT_DRAW_CENTERELLIPSIS) == TEXT_DRAW_CENTERELLIPSIS ) + { + String aTmpStr( aStr ); + xub_StrLen nEraseChars = 4; + while( nEraseChars < aStr.Len() && _rLayout.GetTextWidth( aTmpStr, 0, aTmpStr.Len() ) > nMaxWidth ) + { + aTmpStr = aStr; + xub_StrLen i = (aTmpStr.Len() - nEraseChars)/2; + aTmpStr.Erase( i, nEraseChars++ ); + aTmpStr.InsertAscii( "...", i ); + } + aStr = aTmpStr; + } + else if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) { aStr.Erase( nIndex ); if ( nIndex > 1 ) diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index d560b0b6e7cc..25ba80003fd7 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -404,9 +404,20 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic break; case META_LINE_ACTION: - aActionBounds = Rectangle( static_cast<const MetaLineAction&>(rAct).GetStartPoint(), - static_cast<const MetaLineAction&>(rAct).GetEndPoint() ); + { + const MetaLineAction& rMetaLineAction = static_cast<const MetaLineAction&>(rAct); + aActionBounds = Rectangle( rMetaLineAction.GetStartPoint(), rMetaLineAction.GetEndPoint() ); + const long nLineWidth(rMetaLineAction.GetLineInfo().GetWidth()); + if(nLineWidth) + { + const long nHalfLineWidth((nLineWidth + 1) / 2); + aActionBounds.Left() -= nHalfLineWidth; + aActionBounds.Top() -= nHalfLineWidth; + aActionBounds.Right() += nHalfLineWidth; + aActionBounds.Bottom() += nHalfLineWidth; + } break; + } case META_RECT_ACTION: aActionBounds = static_cast<const MetaRectAction&>(rAct).GetRect(); @@ -446,8 +457,20 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic break; case META_POLYLINE_ACTION: - aActionBounds = static_cast<const MetaPolyLineAction&>(rAct).GetPolygon().GetBoundRect(); + { + const MetaPolyLineAction& rMetaPolyLineAction = static_cast<const MetaPolyLineAction&>(rAct); + aActionBounds = rMetaPolyLineAction.GetPolygon().GetBoundRect(); + const long nLineWidth(rMetaPolyLineAction.GetLineInfo().GetWidth()); + if(nLineWidth) + { + const long nHalfLineWidth((nLineWidth + 1) / 2); + aActionBounds.Left() -= nHalfLineWidth; + aActionBounds.Top() -= nHalfLineWidth; + aActionBounds.Right() += nHalfLineWidth; + aActionBounds.Bottom() += nHalfLineWidth; + } break; + } case META_POLYGON_ACTION: aActionBounds = static_cast<const MetaPolygonAction&>(rAct).GetPolygon().GetBoundRect(); diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 9d8f3bf2f9a0..98eac5e982d3 100755 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -1031,6 +1031,14 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte nCellX = (nSubPage / rMPS.nRows); nCellY = (nSubPage % rMPS.nRows); break; + case PrinterController::RLTB: + nCellX = rMPS.nColumns - 1 - (nSubPage % rMPS.nColumns); + nCellY = (nSubPage / rMPS.nColumns); + break; + case PrinterController::TBRL: + nCellX = rMPS.nColumns - 1 - (nSubPage / rMPS.nRows); + nCellY = (nSubPage % rMPS.nRows); + break; } // scale the metafile down to a sub page size double fScaleX = double(aSubPageSize.Width())/double(aPageSize.aSize.Width()); diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 13ae6b0ead76..436ab40bdc5f 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -297,14 +297,16 @@ ModalDialog SV_DLG_PRINT { HelpID = "vcl:ListBox:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_ORDER_BOX"; Pos = MAP_APPFONT( 0, 0 ); - Size = MAP_APPFONT( 10, 20 ); + Size = MAP_APPFONT( 10, 50 ); DropDown = TRUE; Border = TRUE; CurPos = 0; StringList [en-US] = { - < "left to right, then down"; SV_PRINT_PRT_NUP_ORDER_LRTD; >; - < "top to bottom, then right"; SV_PRINT_PRT_NUP_ORDER_TDLR; >; + < "left to right, then down"; SV_PRINT_PRT_NUP_ORDER_LRTB; >; + < "top to bottom, then right"; SV_PRINT_PRT_NUP_ORDER_TBLR; >; + < "top to bottom, then left"; SV_PRINT_PRT_NUP_ORDER_TBRL; >; + < "right to left, then down"; SV_PRINT_PRT_NUP_ORDER_RLTB; >; }; HelpText [en-US] = "Select order in which pages are to be printed."; }; diff --git a/vcl/source/src/stdtext.src b/vcl/source/src/stdtext.src index 2c6574220a5f..1b95f7bb1d72 100644 --- a/vcl/source/src/stdtext.src +++ b/vcl/source/src/stdtext.src @@ -101,6 +101,11 @@ String SV_ACCESSERROR_TURNAROUND_MSG Text [ en-US ] = "The Java Access Bridge could not be started."; }; +String SV_ACCESSERROR_NO_FONTS +{ + Text [ en-US ] = "No fonts could be found on the system."; +}; + String SV_STDTEXT_ABOUT { Text [ en-US ] = "About %PRODUCTNAME"; diff --git a/vcl/source/window/arrange.cxx b/vcl/source/window/arrange.cxx index dad48235f8fb..9749299d4d6b 100644 --- a/vcl/source/window/arrange.cxx +++ b/vcl/source/window/arrange.cxx @@ -728,7 +728,10 @@ MatrixArranger::~MatrixArranger() { } -Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights ) const +Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, + std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights, + std::vector<sal_Int32>& o_rColumnPrio, std::vector<sal_Int32>& o_rRowPrio + ) const { Size aMatrixSize( 2*m_nOuterBorder, 2*m_nOuterBorder ); @@ -746,6 +749,8 @@ Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>& // now allocate row and column depth vectors o_rColumnWidths = std::vector< long >( nColumns, 0 ); o_rRowHeights = std::vector< long >( nRows, 0 ); + o_rColumnPrio = std::vector< sal_Int32 >( nColumns, 0 ); + o_rRowPrio = std::vector< sal_Int32 >( nRows, 0 ); // get sizes an allocate them into rows/columns for( std::vector< MatrixElement >::const_iterator it = m_aElements.begin(); @@ -756,6 +761,10 @@ Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>& o_rColumnWidths[ it->m_nX ] = aSize.Width(); if( aSize.Height() > o_rRowHeights[ it->m_nY ] ) o_rRowHeights[ it->m_nY ] = aSize.Height(); + if( it->m_nExpandPriority > o_rColumnPrio[ it->m_nX ] ) + o_rColumnPrio[ it->m_nX ] = it->m_nExpandPriority; + if( it->m_nExpandPriority > o_rRowPrio[ it->m_nY ] ) + o_rRowPrio[ it->m_nY ] = it->m_nExpandPriority; } // add up sizes @@ -775,9 +784,48 @@ Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>& Size MatrixArranger::getOptimalSize( WindowSizeType i_eType ) const { std::vector<long> aColumnWidths, aRowHeights; - return getOptimalSize( i_eType, aColumnWidths, aRowHeights ); + std::vector<sal_Int32> aColumnPrio, aRowPrio; + return getOptimalSize( i_eType, aColumnWidths, aRowHeights, aColumnPrio, aRowPrio ); } +void MatrixArranger::distributeExtraSize( std::vector<long>& io_rSizes, const std::vector<sal_Int32>& i_rPrios, long i_nExtraWidth ) +{ + if( ! io_rSizes.empty() && io_rSizes.size() == i_rPrios.size() ) // sanity check + { + // find all elements with the highest expand priority + size_t nElements = io_rSizes.size(); + std::vector< size_t > aIndices; + sal_Int32 nHighPrio = 0; + for( size_t i = 0; i < nElements; i++ ) + { + sal_Int32 nCurPrio = i_rPrios[ i ]; + if( nCurPrio > nHighPrio ) + { + aIndices.clear(); + nHighPrio = nCurPrio; + } + if( nCurPrio == nHighPrio ) + aIndices.push_back( i ); + } + + // distribute extra space evenly among collected elements + nElements = aIndices.size(); + if( nElements > 0 ) + { + long nDelta = i_nExtraWidth / nElements; + for( size_t i = 0; i < nElements; i++ ) + { + io_rSizes[ aIndices[i] ] += nDelta; + i_nExtraWidth -= nDelta; + } + // add the last pixels to the last row element + if( i_nExtraWidth > 0 && nElements > 0 ) + io_rSizes[aIndices.back()] += i_nExtraWidth; + } + } +} + + void MatrixArranger::resize() { // assure that we have at least one row and column @@ -786,19 +834,30 @@ void MatrixArranger::resize() // check if we can get optimal size, else fallback to minimal size std::vector<long> aColumnWidths, aRowHeights; - Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED, aColumnWidths, aRowHeights ) ); + std::vector<sal_Int32> aColumnPrio, aRowPrio; + Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED, aColumnWidths, aRowHeights, aColumnPrio, aRowPrio ) ); if( aOptSize.Height() > m_aManagedArea.GetHeight() || aOptSize.Width() > m_aManagedArea.GetWidth() ) { std::vector<long> aMinColumnWidths, aMinRowHeights; - getOptimalSize( WINDOWSIZE_MINIMUM, aMinColumnWidths, aMinRowHeights ); + getOptimalSize( WINDOWSIZE_MINIMUM, aMinColumnWidths, aMinRowHeights, aColumnPrio, aRowPrio ); if( aOptSize.Height() > m_aManagedArea.GetHeight() ) aRowHeights = aMinRowHeights; if( aOptSize.Width() > m_aManagedArea.GetWidth() ) aColumnWidths = aMinColumnWidths; } - // FIXME: distribute extra space available + // distribute extra space available + long nExtraSize = m_aManagedArea.GetWidth(); + for( size_t i = 0; i < aColumnWidths.size(); ++i ) + nExtraSize -= aColumnWidths[i] + m_nBorderX; + if( nExtraSize > 0 ) + distributeExtraSize( aColumnWidths, aColumnPrio, nExtraSize ); + nExtraSize = m_aManagedArea.GetHeight(); + for( size_t i = 0; i < aRowHeights.size(); ++i ) + nExtraSize -= aRowHeights[i] + m_nBorderY; + if( nExtraSize > 0 ) + distributeExtraSize( aRowHeights, aRowPrio, nExtraSize ); // prepare offsets std::vector<long> aColumnX( aColumnWidths.size() ); diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index b221d1f7d928..2ff7d0a687e7 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -1348,8 +1348,10 @@ void ImplSmallBorderWindowView::DrawWindow( USHORT nDrawFlags, OutputDevice*, co Rectangle aBoundingRgn( aPoint, Size( mnWidth, mnHeight ) ); Rectangle aContentRgn( aCtrlRegion ); - if(pWin->GetNativeControlRegion( aCtrlType, aCtrlPart, aCtrlRegion, - nState, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn )) + if( ! ImplGetSVData()->maNWFData.mbCanDrawWidgetAnySize && + pWin->GetNativeControlRegion( aCtrlType, aCtrlPart, aCtrlRegion, + nState, aControlValue, rtl::OUString(), + aBoundingRgn, aContentRgn )) { aCtrlRegion=aContentRgn; } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index b6f80588d776..52ad54957dd0 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -978,7 +978,7 @@ void Menu::ImplInit() mpLayoutData = NULL; mpFirstDel = NULL; // Dtor notification list // Native-support: returns NULL if not supported - mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu( bIsMenuBar ); + mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu( bIsMenuBar, this ); } Menu* Menu::ImplGetStartedFrom() const @@ -2484,6 +2484,16 @@ Size Menu::ImplCalcSize( Window* pWin ) if ( !bIsMenuBar ) { + // popup menus should not be wider than half the screen + // except on rather small screens + // TODO: move GetScreenNumber from SystemWindow to Window ? + // currently we rely on internal privileges + unsigned int nScreenNumber = pWin->ImplGetWindowImpl()->mpFrame->maGeometry.nScreenNumber; + Rectangle aDispRect( Application::GetScreenPosSizePixel( nScreenNumber ) ); + long nScreenWidth = aDispRect.GetWidth() >= 800 ? aDispRect.GetWidth() : 800; + if( nMaxWidth > nScreenWidth/2 ) + nMaxWidth = nScreenWidth/2; + USHORT gfxExtra = (USHORT) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text nCheckPos = (USHORT)nExtra; if (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) @@ -2577,6 +2587,26 @@ static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRec } } +static String getShortenedString( const String& i_rLong, Window* i_pWin, long i_nMaxWidth ) +{ + xub_StrLen nPos = STRING_NOTFOUND; + String aNonMnem( OutputDevice::GetNonMnemonicString( i_rLong, nPos ) ); + aNonMnem = i_pWin->GetEllipsisString( aNonMnem, i_nMaxWidth, TEXT_DRAW_CENTERELLIPSIS ); + // re-insert mnemonic + if( nPos != STRING_NOTFOUND ) + { + if( nPos < aNonMnem.Len() && i_rLong.GetChar(nPos+1) == aNonMnem.GetChar(nPos) ) + { + rtl::OUStringBuffer aBuf( i_rLong.Len() ); + aBuf.append( aNonMnem.GetBuffer(), nPos ); + aBuf.append( sal_Unicode('~') ); + aBuf.append( aNonMnem.GetBuffer()+nPos ); + aNonMnem = aBuf.makeStringAndClear(); + } + } + return aNonMnem; +} + void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* pThisItemOnly, BOOL bHighlighted, bool bLayout ) const { // Fuer Symbole: nFontHeight x nFontHeight @@ -2767,7 +2797,19 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* pWin->GetSettings().GetStyleSettings().GetMenuColor(); pWin->SetBackground( Wallpaper( aBg ) ); } - pWin->DrawCtrlText( aTmpPos, pData->aText, 0, pData->aText.Len(), nStyle, pVector, pDisplayText ); + // how much space is there for the text ? + long nMaxItemTextWidth = aOutSz.Width() - aTmpPos.X() - nExtra - nOuterSpace; + if( !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled() ) + { + XubString aAccText = pData->aAccelKey.GetName(); + nMaxItemTextWidth -= pWin->GetTextWidth( aAccText ) + 3*nExtra; + } + if( !bIsMenuBar && pData->pSubMenu ) + { + nMaxItemTextWidth -= nFontHeight - nExtra; + } + String aItemText( getShortenedString( pData->aText, pWin, nMaxItemTextWidth ) ); + pWin->DrawCtrlText( aTmpPos, aItemText, 0, aItemText.Len(), nStyle, pVector, pDisplayText ); if( bSetTmpBackground ) pWin->SetBackground(); } diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index f24ed500b7df..5e4e0d59ccc6 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -69,6 +69,8 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const Re , maOrigSize( 10, 10 ) , maPageVDev( *this ) , maToolTipString( String( VclResId( SV_PRINT_PRINTPREVIEW_TXT ) ) ) + , maHorzDim( this, WB_HORZ | WB_CENTER ) + , maVertDim( this, WB_VERT | WB_VCENTER ) { SetPaintTransparent( TRUE ); SetBackground(); @@ -76,6 +78,11 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const Re maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); else maPageVDev.SetBackground( Color( COL_WHITE ) ); + maHorzDim.Show(); + maVertDim.Show(); + + maHorzDim.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "2.0in" ) ) ); + maVertDim.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "2.0in" ) ) ); } PrintDialog::PrintPreviewWindow::~PrintPreviewWindow() @@ -162,9 +169,10 @@ void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDC void PrintDialog::PrintPreviewWindow::Resize() { Size aNewSize( GetSizePixel() ); + long nTextHeight = maHorzDim.GetTextHeight(); // leave small space for decoration - aNewSize.Width() -= 2; - aNewSize.Height() -= 2; + aNewSize.Width() -= nTextHeight + 2; + aNewSize.Height() -= nTextHeight + 2; Size aScaledSize; double fScale = 1.0; @@ -206,16 +214,28 @@ void PrintDialog::PrintPreviewWindow::Resize() } maPageVDev.SetOutputSizePixel( aScaledSize, FALSE ); + + // position dimension lines + Point aRef( nTextHeight + (aNewSize.Width() - maPreviewSize.Width())/2, + nTextHeight + (aNewSize.Height() - maPreviewSize.Height())/2 ); + maHorzDim.SetPosSizePixel( Point( aRef.X(), aRef.Y() - nTextHeight ), + Size( maPreviewSize.Width(), nTextHeight ) ); + maVertDim.SetPosSizePixel( Point( aRef.X() - nTextHeight, aRef.Y() ), + Size( nTextHeight, maPreviewSize.Height() ) ); + } void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) { + long nTextHeight = maHorzDim.GetTextHeight(); Size aSize( GetSizePixel() ); + aSize.Width() -= nTextHeight; + aSize.Height() -= nTextHeight; if( maReplacementString.getLength() != 0 ) { // replacement is active Push(); - Rectangle aTextRect( Point( 0, 0 ), aSize ); + Rectangle aTextRect( Point( nTextHeight, nTextHeight ), aSize ); DecorationView aVw( this ); aVw.DrawFrame( aTextRect, FRAME_DRAW_GROUP ); aTextRect.Left() += 2; @@ -233,8 +253,8 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) { GDIMetaFile aMtf( maMtf ); - Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2, - (aSize.Height() - maPreviewSize.Height()) / 2 ); + Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2 + nTextHeight, + (aSize.Height() - maPreviewSize.Height()) / 2 + nTextHeight ); Size aVDevSize( maPageVDev.GetOutputSizePixel() ); const Size aLogicSize( maPageVDev.PixelToLogic( aVDevSize, MapMode( MAP_100TH_MM ) ) ); @@ -294,13 +314,6 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi { rtl::OUStringBuffer aBuf( 256 ); aBuf.append( maToolTipString ); - #if OSL_DEBUG_LEVEL > 0 - aBuf.appendAscii( "\n---\nPageSize: " ); - aBuf.append( sal_Int32( i_rOrigSize.Width()/100) ); - aBuf.appendAscii( "mm x " ); - aBuf.append( sal_Int32( i_rOrigSize.Height()/100) ); - aBuf.appendAscii( "mm" ); - #endif SetQuickHelpText( aBuf.makeStringAndClear() ); maMtf = i_rNewPreview; if( useHCColorReplacement() ) @@ -312,6 +325,27 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi maReplacementString = i_rReplacement; maPageVDev.SetReferenceDevice( i_nDPIX, i_nDPIY ); maPageVDev.EnableOutput( TRUE ); + + // use correct measurements + const LocaleDataWrapper& rLocWrap( GetSettings().GetLocaleDataWrapper() ); + MapUnit eUnit = MAP_MM; + int nDigits = 0; + if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US ) + { + eUnit = MAP_100TH_INCH; + nDigits = 2; + } + Size aLogicPaperSize( LogicToLogic( i_rOrigSize, MapMode( MAP_100TH_MM ), MapMode( eUnit ) ) ); + String aNumText( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) ); + aBuf.append( aNumText ); + aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" ); + maHorzDim.SetText( aBuf.makeStringAndClear() ); + + aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits ); + aBuf.append( aNumText ); + aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" ); + maVertDim.SetText( aBuf.makeStringAndClear() ); + Resize(); Invalidate(); } @@ -364,12 +398,18 @@ void PrintDialog::ShowNupOrderWindow::Paint( const Rectangle& i_rRect ) int nX = 0, nY = 0; switch( mnOrderMode ) { - case SV_PRINT_PRT_NUP_ORDER_LRTD: + case SV_PRINT_PRT_NUP_ORDER_LRTB: nX = (i % mnColumns); nY = (i / mnColumns); break; - case SV_PRINT_PRT_NUP_ORDER_TDLR: + case SV_PRINT_PRT_NUP_ORDER_TBLR: nX = (i / mnRows); nY = (i % mnRows); break; + case SV_PRINT_PRT_NUP_ORDER_RLTB: + nX = mnColumns - 1 - (i % mnColumns); nY = (i / mnColumns); + break; + case SV_PRINT_PRT_NUP_ORDER_TBRL: + nX = mnColumns - 1 - (i / mnRows); nY = (i % mnRows); + break; } Size aTextSize( GetTextWidth( aPageText ), nTextHeight ); int nDeltaX = (aSubSize.Width() - aTextSize.Width()) / 2; @@ -2078,10 +2118,14 @@ void PrintDialog::updateNup() int nOrderMode = int(sal_IntPtr(maNUpPage.maNupOrderBox.GetEntryData( maNUpPage.maNupOrderBox.GetSelectEntryPos() ))); - if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_LRTD ) + if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_LRTB ) aMPS.nOrder = PrinterController::LRTB; - else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TDLR ) + else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TBLR ) aMPS.nOrder = PrinterController::TBLR; + else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_RLTB ) + aMPS.nOrder = PrinterController::RLTB; + else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TBRL ) + aMPS.nOrder = PrinterController::TBRL; int nOrientationMode = int(sal_IntPtr(maNUpPage.maNupOrientationBox.GetEntryData( maNUpPage.maNupOrientationBox.GetSelectEntryPos() ))); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index e5705c994f4f..77da205131ea 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -4862,6 +4862,12 @@ void Window::Paint( const Rectangle& rRect ) // ----------------------------------------------------------------------- +void Window::PostPaint() +{ +} + +// ----------------------------------------------------------------------- + void Window::Draw( OutputDevice*, const Point&, const Size&, ULONG ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -9364,7 +9370,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, if( bDark ) aSelectionFillCol = COL_BLACK; else - nPercent = bRoundEdges ? 90 : 80; // just checked (light) + nPercent = 80; // just checked (light) } else { @@ -9379,7 +9385,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, nPercent = 0; } else - nPercent = bRoundEdges ? 50 : 20; // selected, pressed or checked ( very dark ) + nPercent = bRoundEdges ? 40 : 20; // selected, pressed or checked ( very dark ) } else if( bChecked || highlight == 1 ) { @@ -9392,7 +9398,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, nPercent = 0; } else - nPercent = bRoundEdges ? 70 : 35; // selected, pressed or checked ( very dark ) + nPercent = bRoundEdges ? 60 : 35; // selected, pressed or checked ( very dark ) } else { @@ -9408,7 +9414,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, nPercent = 0; } else - nPercent = bRoundEdges ? 80 : 70; // selected ( dark ) + nPercent = 70; // selected ( dark ) } } diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 322530b881cc..f308822df147 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -217,11 +217,12 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) { gint nMonitors = gdk_screen_get_n_monitors(pScreen); m_aXineramaScreens = std::vector<Rectangle>(); + m_aXineramaScreenIndexMap = std::vector<int>(nMonitors); for (gint i = 0; i < nMonitors; ++i) { GdkRectangle dest; gdk_screen_get_monitor_geometry(pScreen, i, &dest); - addXineramaScreenUnique( dest.x, dest.y, dest.width, dest.height ); + m_aXineramaScreenIndexMap[i] = addXineramaScreenUnique( dest.x, dest.y, dest.width, dest.height ); } m_bXinerama = m_aXineramaScreens.size() > 1; if( ! m_aFrames.empty() ) @@ -235,6 +236,26 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) } } +extern "C" +{ + typedef gint(* screen_get_primary_monitor)(GdkScreen *screen); +} + +int GtkSalDisplay::GetDefaultMonitorNumber() const +{ + int n = 0; + GdkScreen* pScreen = gdk_display_get_screen( m_pGdkDisplay, m_nDefaultScreen ); +#if GTK_CHECK_VERSION(2,20,0) + n = m_aXineramaScreenIndexMap[gdk_screen_get_primary_monitor(pScreen)]; +#else + static screen_get_primary_monitor sym_gdk_screen_get_primary_monitor = + (screen_get_primary_monitor)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_primary_monitor" ); + if (sym_gdk_screen_get_primary_monitor) + n = m_aXineramaScreenIndexMap[sym_gdk_screen_get_primary_monitor( pScreen )]; +#endif + return n; +} + void GtkSalDisplay::initScreen( int nScreen ) const { if( nScreen < 0 || nScreen >= static_cast<int>(m_aScreens.size()) ) diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 447a970f6bcd..318f593ac6a3 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -411,6 +411,9 @@ void GtkData::initNWF( void ) // open first menu on F10 pSVData->maNWFData.mbOpenMenuOnF10 = true; + // omit GetNativeControl while painting (see brdwin.cxx) + pSVData->maNWFData.mbCanDrawWidgetAnySize = true; + int nScreens = GetX11SalData()->GetDisplay()->GetScreenCount(); gWidgetData = std::vector<NWFWidgetData>( nScreens ); for( int i = 0; i < nScreens; i++ ) diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx index 5c3be54f9ddc..fc788b2a0530 100644 --- a/vcl/unx/headless/svpinst.cxx +++ b/vcl/unx/headless/svpinst.cxx @@ -327,6 +327,19 @@ void SvpSalInstance::AcquireYieldMutex( ULONG nCount ) } } +bool SvpSalInstance::CheckYieldMutex() +{ + bool bRet = true; + + if ( m_aYieldMutex.GetThreadId() != + vos::OThread::getCurrentIdentifier() ) + { + bRet = false; + } + + return bRet; +} + void SvpSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) { // first, check for already queued events. @@ -419,24 +432,6 @@ bool SvpSalInstance::AnyInput( USHORT nType ) return false; } -SalMenu* SvpSalInstance::CreateMenu( BOOL ) -{ - return NULL; -} - -void SvpSalInstance::DestroyMenu( SalMenu* ) -{ -} - -SalMenuItem* SvpSalInstance::CreateMenuItem( const SalItemParams* ) -{ - return NULL; -} - -void SvpSalInstance::DestroyMenuItem( SalMenuItem* ) -{ -} - SalSession* SvpSalInstance::CreateSalSession() { return NULL; diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx index d931a2735ff9..02d5e3fa9494 100644 --- a/vcl/unx/headless/svpinst.hxx +++ b/vcl/unx/headless/svpinst.hxx @@ -176,6 +176,7 @@ public: virtual vos::IMutex* GetYieldMutex(); virtual ULONG ReleaseYieldMutex(); virtual void AcquireYieldMutex( ULONG nCount ); + virtual bool CheckYieldMutex(); // wait next event and dispatch // must returned by UserEvent (SalFrame::PostEvent) @@ -183,12 +184,6 @@ public: virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( USHORT nType ); - // Menues - virtual SalMenu* CreateMenu( BOOL bMenuBar ); - virtual void DestroyMenu( SalMenu* pMenu); - virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); - virtual void DestroyMenuItem( SalMenuItem* pItem ); - // may return NULL to disable session management virtual SalSession* CreateSalSession(); diff --git a/vcl/unx/inc/plugins/gtk/gtkdata.hxx b/vcl/unx/inc/plugins/gtk/gtkdata.hxx index d4dec957a6b3..b650cffbae8b 100644 --- a/vcl/unx/inc/plugins/gtk/gtkdata.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkdata.hxx @@ -59,6 +59,8 @@ class GtkSalDisplay : public SalDisplay GdkDisplay* m_pGdkDisplay; GdkCursor *m_aCursors[ POINTER_COUNT ]; bool m_bStartupCompleted; + std::vector< int > m_aXineramaScreenIndexMap; + GdkCursor* getFromXPM( const char *pBitmap, const char *pMask, int nWidth, int nHeight, int nXHot, int nYHot ); public: @@ -73,6 +75,8 @@ public: virtual long Dispatch( XEvent *pEvent ); virtual void initScreen( int nScreen ) const; + virtual int GetDefaultMonitorNumber() const; + static GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event, GdkEvent* event, gpointer data ); diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx index 3734cbec6ef7..99c9bea699d6 100644 --- a/vcl/unx/inc/saldisp.hxx +++ b/vcl/unx/inc/saldisp.hxx @@ -405,7 +405,7 @@ protected: int processRandREvent( XEvent* ); void doDestruct(); - void addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ); + int addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ); public: static SalDisplay *GetSalDisplay( Display* display ); static BOOL BestVisual( Display *pDisp, @@ -475,6 +475,7 @@ public: XLIB_Window GetDrawable( int nScreen ) const { return getDataForScreen( nScreen ).m_aRefWindow; } Display *GetDisplay() const { return pDisp_; } int GetDefaultScreenNumber() const { return m_nDefaultScreen; } + virtual int GetDefaultMonitorNumber() const { return 0; } const Size& GetScreenSize( int nScreen ) const { return getDataForScreen( nScreen ).m_aSize; } srv_vendor_t GetServerVendor() const { return meServerVendor; } void SetServerVendor() { meServerVendor = sal_GetServerVendor(pDisp_); } diff --git a/vcl/unx/inc/salinst.h b/vcl/unx/inc/salinst.h index 8f4719f098f0..133f0bf6037f 100644 --- a/vcl/unx/inc/salinst.h +++ b/vcl/unx/inc/salinst.h @@ -102,13 +102,10 @@ public: virtual vos::IMutex* GetYieldMutex(); virtual ULONG ReleaseYieldMutex(); virtual void AcquireYieldMutex( ULONG nCount ); + virtual bool CheckYieldMutex(); virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( USHORT nType ); - virtual SalMenu* CreateMenu( BOOL bMenuBar ); - virtual void DestroyMenu( SalMenu* pMenu); - virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); - virtual void DestroyMenuItem( SalMenuItem* pItem ); virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); void FillFontPathList( std::list< rtl::OString >& o_rFontPaths ); diff --git a/vcl/unx/inc/wmadaptor.hxx b/vcl/unx/inc/wmadaptor.hxx index cbedede2cc99..e8620db29c6f 100644 --- a/vcl/unx/inc/wmadaptor.hxx +++ b/vcl/unx/inc/wmadaptor.hxx @@ -165,6 +165,8 @@ protected: bool m_bLegacyPartialFullscreen; int m_nWinGravity; int m_nInitWinGravity; + bool m_bWMshouldSwitchWorkspace; + bool m_bWMshouldSwitchWorkspaceInit; WMAdaptor( SalDisplay * ) ; @@ -177,6 +179,7 @@ protected: */ virtual bool isValid() const; + bool getWMshouldSwitchWorkspace() const; public: virtual ~WMAdaptor(); @@ -214,8 +217,9 @@ public: /* * attemp to switch the desktop to a certain workarea + * if bConsiderWM is true, then on some WMs the call will not result in any action */ - void switchToWorkArea( int nWorkArea ) const; + void switchToWorkArea( int nWorkArea, bool bConsiderWM = true ) const; /* * sets window title diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index acf8c91ab5db..354c4d433d42 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -2592,7 +2592,7 @@ void SalDisplay::PrintInfo() const sal::static_int_cast< unsigned int >(GetVisual(m_nDefaultScreen).GetVisualId()) ); } -void SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ) +int SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ) { // see if any frame buffers are at the same coordinates // this can happen with weird configuration e.g. on @@ -2608,10 +2608,11 @@ void SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, l { m_aXineramaScreens[n].SetSize( Size( i_nWidth, i_nHeight ) ); } - return; + return (int)n; } } m_aXineramaScreens.push_back( Rectangle( Point( i_nX, i_nY ), Size( i_nWidth, i_nHeight ) ) ); + return (int)m_aXineramaScreens.size()-1; } void SalDisplay::InitXinerama() diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx index 49a9cceb8617..88af0b70ef7e 100644 --- a/vcl/unx/source/app/salinst.cxx +++ b/vcl/unx/source/app/salinst.cxx @@ -259,6 +259,24 @@ void X11SalInstance::AcquireYieldMutex( ULONG nCount ) } } +// ----------------------------------------------------------------------- + +bool X11SalInstance::CheckYieldMutex() +{ + bool bRet = true; + + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() != + vos::OThread::getCurrentIdentifier() ) + { + bRet = false; + } + + return bRet; +} + +// ----------------------------------------------------------------------- + void X11SalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) { GetX11SalData()->GetLib()->Yield( bWait, bHandleAllCurrentEvents ); } diff --git a/vcl/unx/source/app/salsys.cxx b/vcl/unx/source/app/salsys.cxx index 1ccb214df4ed..84c9dba32e40 100644 --- a/vcl/unx/source/app/salsys.cxx +++ b/vcl/unx/source/app/salsys.cxx @@ -71,7 +71,7 @@ bool X11SalSystem::IsMultiDisplay() unsigned int X11SalSystem::GetDefaultDisplayNumber() { SalDisplay* pSalDisp = GetX11SalData()->GetDisplay(); - return pSalDisp->GetDefaultScreenNumber(); + return pSalDisp->IsXinerama() ? pSalDisp->GetDefaultMonitorNumber() : pSalDisp->GetDefaultScreenNumber(); } Rectangle X11SalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx index aa2e4c84ef24..f816c5d1426e 100644 --- a/vcl/unx/source/app/wmadaptor.cxx +++ b/vcl/unx/source/app/wmadaptor.cxx @@ -31,21 +31,22 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> -#include <sal/alloca.h> -#include <wmadaptor.hxx> -#include <saldisp.hxx> -#include <saldata.hxx> -#include <salframe.h> -#include <vcl/salgdi.hxx> -#include <osl/thread.h> -#include <rtl/locale.h> -#include <osl/process.h> - -#include <tools/prex.h> +#include "sal/alloca.h" +#include "wmadaptor.hxx" +#include "saldisp.hxx" +#include "saldata.hxx" +#include "salframe.h" +#include "vcl/salgdi.hxx" +#include "osl/thread.h" +#include "rtl/locale.h" +#include "osl/process.h" +#include "vcl/configsettings.hxx" + +#include "tools/prex.h" #include <X11/X.h> #include <X11/Xatom.h> #include <X11/Xresource.h> -#include <tools/postx.h> +#include "tools/postx.h" #if OSL_DEBUG_LEVEL > 1 #include <stdio.h> @@ -238,7 +239,9 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) : m_bEnableAlwaysOnTopWorks( false ), m_bLegacyPartialFullscreen( false ), m_nWinGravity( StaticGravity ), - m_nInitWinGravity( StaticGravity ) + m_nInitWinGravity( StaticGravity ), + m_bWMshouldSwitchWorkspace( true ), + m_bWMshouldSwitchWorkspaceInit( false ) { Atom aRealType = None; int nFormat = 8; @@ -965,6 +968,30 @@ bool WMAdaptor::getNetWmName() return bNetWM; } +bool WMAdaptor::getWMshouldSwitchWorkspace() const +{ + if( ! m_bWMshouldSwitchWorkspaceInit ) + { + WMAdaptor * pWMA = const_cast<WMAdaptor*>(this); + + pWMA->m_bWMshouldSwitchWorkspace = true; + vcl::SettingsConfigItem* pItem = vcl::SettingsConfigItem::get(); + rtl::OUString aSetting( pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WM" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ShouldSwitchWorkspace" ) ) ) ); + if( aSetting.getLength() == 0 ) + { + if( m_aWMName.EqualsAscii( "awesome" ) ) + { + pWMA->m_bWMshouldSwitchWorkspace = false; + } + } + else + pWMA->m_bWMshouldSwitchWorkspace = aSetting.toBoolean(); + pWMA->m_bWMshouldSwitchWorkspaceInit = true; + } + return m_bWMshouldSwitchWorkspace; +} + /* * WMAdaptor::isValid() */ @@ -2338,8 +2365,11 @@ int WMAdaptor::getWindowWorkArea( XLIB_Window aWindow ) const * WMAdaptor::getCurrentWorkArea */ // fixme: multi screen case -void WMAdaptor::switchToWorkArea( int nWorkArea ) const +void WMAdaptor::switchToWorkArea( int nWorkArea, bool bConsiderWM ) const { + if( bConsiderWM && ! getWMshouldSwitchWorkspace() ) + return; + if( m_aWMAtoms[ NET_CURRENT_DESKTOP ] ) { XEvent aEvent; 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() diff --git a/vcl/unx/source/printer/printerinfomanager.cxx b/vcl/unx/source/printer/printerinfomanager.cxx index bd6ce761e989..af189b1b01b5 100644 --- a/vcl/unx/source/printer/printerinfomanager.cxx +++ b/vcl/unx/source/printer/printerinfomanager.cxx @@ -642,7 +642,7 @@ const PrinterInfo& PrinterInfoManager::getPrinterInfo( const OUString& rPrinter static PrinterInfo aEmptyInfo; ::std::hash_map< OUString, Printer, OUStringHash >::const_iterator it = m_aPrinters.find( rPrinter ); - DBG_ASSERT( it != m_aPrinters.end(), "Do not ask for info about nonexistant printers" ); + DBG_ASSERT( it != m_aPrinters.end(), "Do not ask for info about nonexistent printers" ); return it != m_aPrinters.end() ? it->second.m_aInfo : aEmptyInfo; } diff --git a/vcl/unx/source/printergfx/printerjob.cxx b/vcl/unx/source/printergfx/printerjob.cxx index 26a1d75f68c2..af2cf14b1a0c 100644 --- a/vcl/unx/source/printergfx/printerjob.cxx +++ b/vcl/unx/source/printergfx/printerjob.cxx @@ -496,6 +496,10 @@ PrinterJob::StartJob ( sal_Bool PrinterJob::EndJob () { + // no pages ? that really means no print job + if( maPageList.empty() ) + return sal_False; + // write document setup (done here because it // includes the accumulated fonts if( mpJobHeader ) diff --git a/vcl/unx/source/window/makefile.mk b/vcl/unx/source/window/makefile.mk index 808b712903f3..c5cd95ba6b1c 100644 --- a/vcl/unx/source/window/makefile.mk +++ b/vcl/unx/source/window/makefile.mk @@ -48,7 +48,7 @@ dummy: .ELSE # "$(GUIBASE)"!="unx" SLOFILES= \ - $(SLO)/FWS.obj $(SLO)/salframe.obj $(SLO)/salobj.obj $(SLO)/salmenu.obj + $(SLO)/FWS.obj $(SLO)/salframe.obj $(SLO)/salobj.obj .ENDIF # "$(GUIBASE)"!="unx" diff --git a/vcl/unx/source/window/salmenu.cxx b/vcl/unx/source/window/salmenu.cxx deleted file mode 100644 index 0739b6cd5352..000000000000 --- a/vcl/unx/source/window/salmenu.cxx +++ /dev/null @@ -1,132 +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_vcl.hxx" - - -#include <saldata.hxx> -#include <salinst.h> -#include <salmenu.h> - - -// ======================================================================= - -// X11SalInst factory methods - -SalMenu* X11SalInstance::CreateMenu( BOOL /*bMenuBar*/ ) -{ - return NULL; // no support for native menues -} - -void X11SalInstance::DestroyMenu( SalMenu* pSalMenu ) -{ - delete pSalMenu; -} - - -SalMenuItem* X11SalInstance::CreateMenuItem( const SalItemParams* ) -{ - return NULL; // no support for native menues -} - -void X11SalInstance::DestroyMenuItem( SalMenuItem* pSalMenuItem ) -{ - delete pSalMenuItem; -} - - -// ======================================================================= - - -/* - * X11SalMenu - */ - - -X11SalMenu::~X11SalMenu() -{ -} - -BOOL X11SalMenu::VisibleMenuBar() -{ - return FALSE; -} - -void X11SalMenu::SetFrame( const SalFrame* ) -{ -} - -void X11SalMenu::InsertItem( SalMenuItem*, unsigned ) -{ -} - -void X11SalMenu::RemoveItem( unsigned ) -{ -} - -void X11SalMenu::SetSubMenu( SalMenuItem*, SalMenu*, unsigned ) -{ -} - -void X11SalMenu::CheckItem( unsigned, BOOL ) -{ -} - -void X11SalMenu::EnableItem( unsigned, BOOL ) -{ -} - -void X11SalMenu::SetItemImage( unsigned, SalMenuItem*, const Image& ) -{ -} - -void X11SalMenu::SetItemText( unsigned, SalMenuItem*, const XubString& ) -{ -} - -void X11SalMenu::SetAccelerator( unsigned, SalMenuItem*, const KeyCode&, const XubString& ) -{ -} - -void X11SalMenu::GetSystemMenuData( SystemMenuData* ) -{ -} - -// ======================================================================= - -/* - * SalMenuItem - */ - - -X11SalMenuItem::~X11SalMenuItem() -{ -} - -// ------------------------------------------------------------------- - diff --git a/vcl/win/inc/salinst.h b/vcl/win/inc/salinst.h index f3005e3ad30b..1ab59f8f7f9f 100644..100755 --- a/vcl/win/inc/salinst.h +++ b/vcl/win/inc/salinst.h @@ -77,9 +77,11 @@ public: virtual vos::IMutex* GetYieldMutex(); virtual ULONG ReleaseYieldMutex(); virtual void AcquireYieldMutex( ULONG nCount ); + virtual bool CheckYieldMutex(); + virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( USHORT nType ); - virtual SalMenu* CreateMenu( BOOL bMenuBar ); + virtual SalMenu* CreateMenu( BOOL bMenuBar, Menu* ); virtual void DestroyMenu( SalMenu* ); virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); virtual void DestroyMenuItem( SalMenuItem* ); diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 97dbb5285cca..419723ee6442 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -323,10 +323,9 @@ void ImplSalAcquireYieldMutex( ULONG nCount ) // ----------------------------------------------------------------------- -#ifdef DBG_UTIL - -void ImplDbgTestSolarMutex() +bool WinSalInstance::CheckYieldMutex() { + bool bRet = true; SalData* pSalData = GetSalData(); DWORD nCurThreadId = GetCurrentThreadId(); if ( pSalData->mnAppThreadId != nCurThreadId ) @@ -336,7 +335,7 @@ void ImplDbgTestSolarMutex() SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; if ( pYieldMutex->mnThreadId != nCurThreadId ) { - DBG_ERROR( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" ); + bRet = false; } } } @@ -347,14 +346,13 @@ void ImplDbgTestSolarMutex() SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; if ( pYieldMutex->mnThreadId != nCurThreadId ) { - DBG_ERROR( "SolarMutex not locked in the main thread" ); + bRet = false; } } } + return bRet; } -#endif - // ======================================================================= void SalData::initKeyCodeMap() diff --git a/vcl/win/source/window/salmenu.cxx b/vcl/win/source/window/salmenu.cxx index 1eb75969ea38..47da911b012e 100644..100755 --- a/vcl/win/source/window/salmenu.cxx +++ b/vcl/win/source/window/salmenu.cxx @@ -59,7 +59,7 @@ BOOL SalData::IsKnownMenuHandle( HMENU hMenu ) // WinSalInst factory methods -SalMenu* WinSalInstance::CreateMenu( BOOL bMenuBar ) +SalMenu* WinSalInstance::CreateMenu( BOOL bMenuBar, Menu* ) { WinSalMenu *pSalMenu = new WinSalMenu(); |