[Libreoffice-commits] core.git: 2 commits - comphelper/source framework/source include/comphelper

Michael Stahl mstahl at redhat.com
Fri Sep 11 13:34:36 PDT 2015


 comphelper/source/property/propertysetinfo.cxx        |   18 ++++
 framework/source/fwi/uielement/constitemcontainer.cxx |   74 ------------------
 include/comphelper/propertysetinfo.hxx                |    1 
 include/comphelper/seqstream.hxx                      |    6 +
 4 files changed, 27 insertions(+), 72 deletions(-)

New commits:
commit 013f84d06f7ad76d72b863170891589c3504508c
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Sep 11 22:29:32 2015 +0200

    comphelper: another WeakImplHelper duplicate
    
    Change-Id: I8b5fad24857f434cab351bbbae42c4b09bc6613a

diff --git a/include/comphelper/seqstream.hxx b/include/comphelper/seqstream.hxx
index a1982ab..3ac6617 100644
--- a/include/comphelper/seqstream.hxx
+++ b/include/comphelper/seqstream.hxx
@@ -73,7 +73,11 @@ public:
 private:
     inline sal_Int32 avail();
 };
-typedef ::cppu::WeakImplHelper< ::com::sun::star::io::XOutputStream > OSequenceOutputStream_Base;
+
+// don't export to avoid duplicate WeakImplHelper definitions with MSVC
+class SAL_DLLPUBLIC_TEMPLATE OSequenceOutputStream_Base
+    : public ::cppu::WeakImplHelper< ::com::sun::star::io::XOutputStream >
+{};
 
 class COMPHELPER_DLLPUBLIC OSequenceOutputStream : public OSequenceOutputStream_Base
 {
commit 03be785efe589dda77cad28782fbf51ab4049f46
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Sep 11 22:26:44 2015 +0200

    framework: yet another WeakImplHelper<XPropertySetInfo> dupcliate
    
    There's a very similar comphelper::PropertySetInfo, unfortunately with
    an additional mnMemberId on its properties, so convert a little...
    
    Change-Id: I2a5fc0bb0ff6d680d546192b9d09afee6348f218

diff --git a/comphelper/source/property/propertysetinfo.cxx b/comphelper/source/property/propertysetinfo.cxx
index 4791b3c..90985f2 100644
--- a/comphelper/source/property/propertysetinfo.cxx
+++ b/comphelper/source/property/propertysetinfo.cxx
@@ -143,6 +143,24 @@ PropertySetInfo::PropertySetInfo( PropertyMapEntry const * pMap ) throw()
     mpMap->add( pMap );
 }
 
+PropertySetInfo::PropertySetInfo(uno::Sequence<beans::Property> const& rProps) throw()
+    : mpMap(new PropertyMapImpl)
+{
+    PropertyMapEntry * pEntries(new PropertyMapEntry[rProps.getLength() + 1]);
+    PropertyMapEntry * pEntry(&pEntries[0]);
+    for (auto const& it : rProps)
+    {
+        pEntry->maName = it.Name;
+        pEntry->mnHandle = it.Handle;
+        pEntry->maType = it.Type;
+        pEntry->mnAttributes = it.Attributes;
+        pEntry->mnMemberId = 0;
+        ++pEntry;
+    }
+    pEntry->maName = OUString();
+    mpMap->add(pEntries);
+}
+
 PropertySetInfo::~PropertySetInfo() throw()
 {
     delete mpMap;
diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx b/framework/source/fwi/uielement/constitemcontainer.cxx
index cea61f6..d2a4b07 100644
--- a/framework/source/fwi/uielement/constitemcontainer.cxx
+++ b/framework/source/fwi/uielement/constitemcontainer.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 
 #include <cppuhelper/implbase.hxx>
+#include <comphelper/propertysetinfo.hxx>
 #include <comphelper/servicehelper.hxx>
 
 using namespace cppu;
@@ -41,76 +42,6 @@ const char PROPNAME_UINAME[]    = "UIName";
 namespace framework
 {
 
-/**
- * The class which implements the PropertySetInfo interface.
- */
-extern "C"
-{
-static int SAL_CALL compare_OUString_Property_Impl( const void *arg1, const void *arg2 )
-{
-   return static_cast<OUString const *>(arg1)->compareTo( static_cast<Property const *>(arg2)->Name );
-}
-}
-
-class OPropertySetHelperInfo_Impl
-    : public WeakImplHelper< ::com::sun::star::beans::XPropertySetInfo >
-{
-    Sequence < Property > aInfos;
-
-public:
-    OPropertySetHelperInfo_Impl( IPropertyArrayHelper & rHelper_ );
-
-    // XPropertySetInfo-Methoden
-    virtual Sequence< Property > SAL_CALL getProperties() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual Property SAL_CALL getPropertyByName(const OUString& PropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& PropertyName) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-};
-
-/**
- * Create an object that implements XPropertySetInfo IPropertyArrayHelper.
- */
-OPropertySetHelperInfo_Impl::OPropertySetHelperInfo_Impl(
-    IPropertyArrayHelper & rHelper_ )
-    :aInfos( rHelper_.getProperties() )
-{
-}
-
-/**
- * Return the sequence of properties, which are provided through the constructor.
- */
-Sequence< Property > OPropertySetHelperInfo_Impl::getProperties() throw(::com::sun::star::uno::RuntimeException, std::exception)
-{
-    return aInfos;
-}
-
-/**
- * Return the sequence of properties, which are provided through the constructor.
- */
-Property OPropertySetHelperInfo_Impl::getPropertyByName( const OUString & PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception)
-{
-    Property * pR;
-    pR = static_cast<Property *>(bsearch( &PropertyName, aInfos.getConstArray(), aInfos.getLength(),
-                              sizeof( Property ),
-                              compare_OUString_Property_Impl ));
-    if( !pR ) {
-        throw UnknownPropertyException();
-    }
-
-    return *pR;
-}
-
-/**
- * Return the sequence of properties, which are provided through the constructor.
- */
-sal_Bool OPropertySetHelperInfo_Impl::hasPropertyByName( const OUString & PropertyName ) throw(::com::sun::star::uno::RuntimeException, std::exception)
-{
-    Property * pR;
-    pR = static_cast<Property *>(bsearch( &PropertyName, aInfos.getConstArray(), aInfos.getLength(),
-                              sizeof( Property ),
-                              compare_OUString_Property_Impl ));
-    return pR != NULL;
-}
-
 ConstItemContainer::ConstItemContainer()
 {
 }
@@ -409,7 +340,8 @@ const com::sun::star::uno::Sequence< com::sun::star::beans::Property > ConstItem
 Reference < XPropertySetInfo > ConstItemContainer::createPropertySetInfo(
     IPropertyArrayHelper & rProperties )
 {
-    return static_cast< XPropertySetInfo * >( new OPropertySetHelperInfo_Impl( rProperties ) );
+    return static_cast<XPropertySetInfo *>(
+            new ::comphelper::PropertySetInfo(rProperties.getProperties()));
 }
 
 } // namespace framework
diff --git a/include/comphelper/propertysetinfo.hxx b/include/comphelper/propertysetinfo.hxx
index e554282..e81a43e 100644
--- a/include/comphelper/propertysetinfo.hxx
+++ b/include/comphelper/propertysetinfo.hxx
@@ -54,6 +54,7 @@ private:
 public:
     PropertySetInfo() throw();
     PropertySetInfo( PropertyMapEntry const * pMap ) throw();
+    PropertySetInfo(css::uno::Sequence<css::beans::Property> const &) throw();
     virtual ~PropertySetInfo() throw();
 
     /** returns a stl map with all PropertyMapEntry pointer.<p>


More information about the Libreoffice-commits mailing list