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

Caolán McNamara caolanm at redhat.com
Fri Mar 11 09:46:41 UTC 2016


 comphelper/source/xml/attributelist.cxx |   18 +++++++++++++++---
 include/comphelper/attributelist.hxx    |   10 ++++++++--
 2 files changed, 23 insertions(+), 5 deletions(-)

New commits:
commit 66fee51115a2174bde47c3af01a7d1fdcf1ef602
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 11 09:45:39 2016 +0000

    Resolves: tdf#98418 AttributeList must support XCloneable
    
    regression from
    
    commit 8998768a34751d35403678a81464a26835b2230e
    Date:   Sat Feb 6 18:38:32 2016 +0100
    
    Change-Id: I217fb66621505b77b6102954c07ef513e2d4b25e

diff --git a/comphelper/source/xml/attributelist.cxx b/comphelper/source/xml/attributelist.cxx
index f196b48..cefede8 100644
--- a/comphelper/source/xml/attributelist.cxx
+++ b/comphelper/source/xml/attributelist.cxx
@@ -100,15 +100,20 @@ OUString SAL_CALL AttributeList::getValueByName(const OUString& sName) throw( cs
     return OUString();
 }
 
-
 AttributeList::AttributeList()
+    : m_pImpl(new AttributeList_Impl)
+{
+}
+
+AttributeList::AttributeList(const AttributeList &r)
+    : cppu::WeakImplHelper<XAttributeList, XCloneable>()
+    , m_pImpl(new AttributeList_Impl)
 {
-    m_pImpl = new AttributeList_Impl;
+    *m_pImpl = *(r.m_pImpl);
 }
 
 AttributeList::~AttributeList()
 {
-    delete m_pImpl;
 }
 
 void AttributeList::AddAttribute(const OUString &sName,
@@ -122,6 +127,13 @@ void AttributeList::Clear()
     m_pImpl->vecAttribute.clear();
 }
 
+css::uno::Reference< css::util::XCloneable > AttributeList::createClone() throw (css::uno::RuntimeException, std::exception)
+
+{
+    AttributeList *p = new AttributeList( *this );
+    return css::uno::Reference< css::util::XCloneable > ( static_cast<css::util::XCloneable *>(p) );
+}
+
 } // namespace comphelper
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/attributelist.hxx b/include/comphelper/attributelist.hxx
index 18aaa50..9a6f535 100644
--- a/include/comphelper/attributelist.hxx
+++ b/include/comphelper/attributelist.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_COMPHELPER_ATTRIBUTELIST_HXX
 #define INCLUDED_COMPHELPER_ATTRIBUTELIST_HXX
 
+#include <com/sun/star/util/XCloneable.hpp>
 #include <com/sun/star/xml/sax/XAttributeList.hpp>
 #include <cppuhelper/implbase.hxx>
 #include <comphelper/comphelperdllapi.h>
@@ -31,11 +32,13 @@ namespace comphelper
 struct AttributeList_Impl;
 
 class COMPHELPER_DLLPUBLIC AttributeList :
-    public ::cppu::WeakImplHelper<css::xml::sax::XAttributeList>
+    public ::cppu::WeakImplHelper<css::xml::sax::XAttributeList, css::util::XCloneable>
 {
-    AttributeList_Impl *m_pImpl;
+    std::unique_ptr<AttributeList_Impl> m_pImpl;
 public:
     AttributeList();
+    AttributeList(const AttributeList &r);
+
     virtual ~AttributeList();
 
     // methods that are not contained in any interface
@@ -56,6 +59,9 @@ public:
     virtual OUString SAL_CALL getValueByName(const OUString& aName)
         throw( css::uno::RuntimeException, std::exception ) override;
 
+    // css::util::XCloneable
+    virtual css::uno::Reference< XCloneable > SAL_CALL
+        createClone()   throw(css::uno::RuntimeException, std::exception) override;
 };
 
 } // namespace comphelper


More information about the Libreoffice-commits mailing list