summaryrefslogtreecommitdiff
path: root/comphelper/inc
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2010-11-08 16:01:31 +0100
committerVladimir Glazunov <vg@openoffice.org>2010-11-08 16:01:31 +0100
commit1fe0c12d3a8ebca78ca1786e4933cf40caa5cf44 (patch)
tree1309dc0282e68969e11adea4c19c696c95caaf7c /comphelper/inc
parent2213c84419b3621abf3bfa66994d5534bf64ca4f (diff)
parent9a6a8627c6b9ae98b5773d9791c75582cf1dc043 (diff)
CWS-TOOLING: integrate CWS dba34a
Diffstat (limited to 'comphelper/inc')
-rw-r--r--comphelper/inc/comphelper/namedvaluecollection.hxx12
-rw-r--r--comphelper/inc/comphelper/optionalvalue.hxx187
-rw-r--r--comphelper/inc/comphelper/property.hxx8
-rw-r--r--comphelper/inc/comphelper/querydeep.hxx484
-rw-r--r--comphelper/inc/comphelper/scopeguard.hxx16
-rw-r--r--comphelper/inc/comphelper/servicedecl.hxx4
6 files changed, 34 insertions, 677 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 )