writerfilter/source/rtftok/rtfdocumentimpl.cxx        |   64 +++++++++---------
 writerfilter/source/rtftok/rtfreferenceproperties.cxx |    4 -
 writerfilter/source/rtftok/rtfsdrimport.cxx           |    4 -
 writerfilter/source/rtftok/rtfsprm.cxx                |    5 -
 writerfilter/source/rtftok/rtfsprm.hxx                |   10 ++
 5 files changed, 44 insertions(+), 43 deletions(-)

New commits:
commit 8201c8a5f680947c2e855504be321afb1e5bc06a
Author: Caolán McNamara <caol...@redhat.com>
Date:   Wed May 30 15:39:01 2012 +0200

    don't overload operator-> and just forward specific methods, take two
    
    Change-Id: If66b0a5f1b0444d8f0a6dfed1b518a0033d61d2e

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 528a8b6..9f2e0f6 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -117,8 +117,8 @@ static bool lcl_eraseNestedAttribute(RTFSprms& rSprms, Id 
nParent, Id nId)
 static RTFSprms& lcl_getLastAttributes(RTFSprms& rSprms, Id nId)
 {
     RTFValue::Pointer_t p = rSprms.find(nId);
-    if (p.get() && p->getSprms()->size())
-        return p->getSprms()->back().second->getAttributes();
+    if (p.get() && p->getSprms().size())
+        return p->getSprms().back().second->getAttributes();
     else
     {
         SAL_WARN("writerfilter", "trying to set property when no type is 
defined");
@@ -713,7 +713,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
     RTFValue::Pointer_t pExtentValue(new RTFValue(aExtentAttributes));
     // docpr sprm
     RTFSprms aDocprAttributes;
-    for (RTFSprms::Iterator_t i = 
m_aStates.top().aCharacterAttributes->begin(); i != 
m_aStates.top().aCharacterAttributes->end(); ++i)
+    for (RTFSprms::Iterator_t i = 
m_aStates.top().aCharacterAttributes.begin(); i != 
m_aStates.top().aCharacterAttributes.end(); ++i)
         if (i->first == NS_ooxml::LN_CT_NonVisualDrawingProps_name || i->first 
== NS_ooxml::LN_CT_NonVisualDrawingProps_descr)
             aDocprAttributes.set(i->first, i->second);
     RTFValue::Pointer_t pDocprValue(new RTFValue(aDocprAttributes));
@@ -732,14 +732,14 @@ int RTFDocumentImpl::resolvePict(bool bInline)
     {
         // wrap sprm
         RTFSprms aAnchorWrapAttributes;
-        for (RTFSprms::Iterator_t i = 
m_aStates.top().aCharacterAttributes->begin(); i != 
m_aStates.top().aCharacterAttributes->end(); ++i)
+        for (RTFSprms::Iterator_t i = 
m_aStates.top().aCharacterAttributes.begin(); i != 
m_aStates.top().aCharacterAttributes.end(); ++i)
             if (i->first == NS_ooxml::LN_CT_WrapSquare_wrapText)
                 aAnchorWrapAttributes.set(i->first, i->second);
         RTFValue::Pointer_t pAnchorWrapValue(new 
RTFValue(aAnchorWrapAttributes));
         RTFSprms aAnchorAttributes;
         RTFSprms aAnchorSprms;
         aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue);
-        if (aAnchorWrapAttributes->size())
+        if (aAnchorWrapAttributes.size())
             aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare, 
pAnchorWrapValue);
         aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_docPr, pDocprValue);
         aAnchorSprms.set(NS_ooxml::LN_graphic_graphic, pGraphicValue);
@@ -1231,8 +1231,8 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword 
nKeyword)
                 resolveSubstream(m_nGroupStartPos - 1, nId, aCustomMark);
                 if (bCustomMark)
                 {
-                    m_aStates.top().aCharacterAttributes->clear();
-                    m_aStates.top().aCharacterSprms->clear();
+                    m_aStates.top().aCharacterAttributes.clear();
+                    m_aStates.top().aCharacterSprms.clear();
                     RTFValue::Pointer_t pValue(new RTFValue(1));
                     
m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows,
 pValue);
                     text(aCustomMark);
@@ -2472,7 +2472,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
                 
m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_pos, pIntValue);
                 RTFValue::Pointer_t pValue(new 
RTFValue(m_aStates.top().aTabAttributes));
                 lcl_putNestedSprm(m_aStates.top().aParagraphSprms, 
NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue);
-                m_aStates.top().aTabAttributes->clear();
+                m_aStates.top().aTabAttributes.clear();
             }
             break;
         case RTF_ILVL:
@@ -3008,45 +3008,45 @@ int RTFDocumentImpl::pushState()
 RTFSprms RTFDocumentImpl::mergeSprms()
 {
     RTFSprms aSprms;
-    for (RTFSprms::Iterator_t i = m_aStates.top().aTableSprms->begin();
-            i != m_aStates.top().aTableSprms->end(); ++i)
+    for (RTFSprms::Iterator_t i = m_aStates.top().aTableSprms.begin();
+            i != m_aStates.top().aTableSprms.end(); ++i)
         aSprms.set(i->first, i->second);
-    for (RTFSprms::Iterator_t i = m_aStates.top().aCharacterSprms->begin();
-            i != m_aStates.top().aCharacterSprms->end(); ++i)
+    for (RTFSprms::Iterator_t i = m_aStates.top().aCharacterSprms.begin();
+            i != m_aStates.top().aCharacterSprms.end(); ++i)
         aSprms.set(i->first, i->second);
-    for (RTFSprms::Iterator_t i = m_aStates.top().aParagraphSprms->begin();
-            i != m_aStates.top().aParagraphSprms->end(); ++i)
+    for (RTFSprms::Iterator_t i = m_aStates.top().aParagraphSprms.begin();
+            i != m_aStates.top().aParagraphSprms.end(); ++i)
         aSprms.set(i->first, i->second);
     return aSprms;
 }
 
 void RTFDocumentImpl::resetSprms()
 {
-    m_aStates.top().aTableSprms->clear();
-    m_aStates.top().aCharacterSprms->clear();
-    m_aStates.top().aParagraphSprms->clear();
+    m_aStates.top().aTableSprms.clear();
+    m_aStates.top().aCharacterSprms.clear();
+    m_aStates.top().aParagraphSprms.clear();
 }
 
 RTFSprms RTFDocumentImpl::mergeAttributes()
 {
     RTFSprms aAttributes;
-    for (RTFSprms::Iterator_t i = m_aStates.top().aTableAttributes->begin();
-            i != m_aStates.top().aTableAttributes->end(); ++i)
+    for (RTFSprms::Iterator_t i = m_aStates.top().aTableAttributes.begin();
+            i != m_aStates.top().aTableAttributes.end(); ++i)
         aAttributes.set(i->first, i->second);
-    for (RTFSprms::Iterator_t i = 
m_aStates.top().aCharacterAttributes->begin();
-            i != m_aStates.top().aCharacterAttributes->end(); ++i)
+    for (RTFSprms::Iterator_t i = m_aStates.top().aCharacterAttributes.begin();
+            i != m_aStates.top().aCharacterAttributes.end(); ++i)
         aAttributes.set(i->first, i->second);
-    for (RTFSprms::Iterator_t i = 
m_aStates.top().aParagraphAttributes->begin();
-            i != m_aStates.top().aParagraphAttributes->end(); ++i)
+    for (RTFSprms::Iterator_t i = m_aStates.top().aParagraphAttributes.begin();
+            i != m_aStates.top().aParagraphAttributes.end(); ++i)
         aAttributes.set(i->first, i->second);
     return aAttributes;
 }
 
 void RTFDocumentImpl::resetAttributes()
 {
-    m_aStates.top().aTableAttributes->clear();
-    m_aStates.top().aCharacterAttributes->clear();
-    m_aStates.top().aParagraphAttributes->clear();
+    m_aStates.top().aTableAttributes.clear();
+    m_aStates.top().aCharacterAttributes.clear();
+    m_aStates.top().aParagraphAttributes.clear();
 }
 
 int RTFDocumentImpl::popState()
@@ -3087,12 +3087,12 @@ int RTFDocumentImpl::popState()
     }
     else if (aState.nDestinationState == DESTINATION_LISTENTRY)
     {
-        for (RTFSprms::Iterator_t i = aState.aListLevelEntries->begin(); i != 
aState.aListLevelEntries->end(); ++i)
+        for (RTFSprms::Iterator_t i = aState.aListLevelEntries.begin(); i != 
aState.aListLevelEntries.end(); ++i)
             aState.aTableSprms.set(i->first, i->second, false);
     }
     else if (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION)
     {
-        if (m_aFormfieldAttributes->size() || m_aFormfieldSprms->size())
+        if (m_aFormfieldAttributes.size() || m_aFormfieldSprms.size())
         {
             RTFValue::Pointer_t pValue(new RTFValue(m_aFormfieldAttributes, 
m_aFormfieldSprms));
             RTFSprms aFFAttributes;
@@ -3100,8 +3100,8 @@ int RTFDocumentImpl::popState()
             aFFSprms.set(NS_ooxml::LN_ffdata, pValue);
             writerfilter::Reference<Properties>::Pointer_t const 
pProperties(new RTFReferenceProperties(aFFAttributes, aFFSprms));
             Mapper().props(pProperties);
-            m_aFormfieldAttributes->clear();
-            m_aFormfieldSprms->clear();
+            m_aFormfieldAttributes.clear();
+            m_aFormfieldSprms.clear();
         }
         if (!m_bEq)
             singleChar(0x14);
@@ -3334,8 +3334,8 @@ int RTFDocumentImpl::popState()
         Mapper().startShape(xShape);
         Mapper().props(pProperties);
         Mapper().endShape();
-        m_aObjectAttributes->clear();
-        m_aObjectSprms->clear();
+        m_aObjectAttributes.clear();
+        m_aObjectSprms.clear();
         m_bObject = false;
     }
     else if (m_aStates.top().nDestinationState == DESTINATION_ANNOTATIONDATE)
diff --git a/writerfilter/source/rtftok/rtfreferenceproperties.cxx 
b/writerfilter/source/rtftok/rtfreferenceproperties.cxx
index a28a96c..03cd0e9 100644
--- a/writerfilter/source/rtftok/rtfreferenceproperties.cxx
+++ b/writerfilter/source/rtftok/rtfreferenceproperties.cxx
@@ -48,9 +48,9 @@ RTFReferenceProperties::~RTFReferenceProperties()
 
 void RTFReferenceProperties::resolve(Properties& rHandler)
 {
-    for (RTFSprms::Iterator_t i = m_aAttributes->begin(); i != 
m_aAttributes->end(); ++i)
+    for (RTFSprms::Iterator_t i = m_aAttributes.begin(); i != 
m_aAttributes.end(); ++i)
         rHandler.attribute(i->first, *i->second.get());
-    for (RTFSprms::Iterator_t i = m_aSprms->begin(); i != m_aSprms->end(); ++i)
+    for (RTFSprms::Iterator_t i = m_aSprms.begin(); i != m_aSprms.end(); ++i)
     {
         RTFSprm aSprm(i->first, i->second);
         rHandler.sprm(aSprm);
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 4fc0453..ab4118c 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -107,12 +107,12 @@ void RTFSdrImport::resolve(RTFShape& rShape)
         else if ( i->first == "wzName" )
         {
             RTFValue::Pointer_t pValue(new RTFValue(i->second));
-            
m_rImport.getState().aCharacterAttributes->push_back(make_pair(NS_ooxml::LN_CT_NonVisualDrawingProps_name,
 pValue));
+            
m_rImport.getState().aCharacterAttributes.set(NS_ooxml::LN_CT_NonVisualDrawingProps_name,
 pValue);
         }
         else if ( i->first == "wzDescription" )
         {
             RTFValue::Pointer_t pValue(new RTFValue(i->second));
-            
m_rImport.getState().aCharacterAttributes->push_back(make_pair(NS_ooxml::LN_CT_NonVisualDrawingProps_descr,
 pValue));
+            
m_rImport.getState().aCharacterAttributes.set(NS_ooxml::LN_CT_NonVisualDrawingProps_descr,
 pValue);
         }
         else if ( i->first == "pib" )
         {
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx 
b/writerfilter/source/rtftok/rtfsprm.cxx
index 3a17927..fb61d29 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -148,11 +148,6 @@ RTFSprms& RTFSprms::operator=(const RTFSprms& rOther)
     return *this;
 }
 
-std::vector< std::pair<Id, RTFValue::Pointer_t> >* RTFSprms::operator->()
-{
-    return &m_aSprms;
-}
-
 void RTFSprms::swap(RTFSprms& rOther)
 {
     m_aSprms.swap(rOther.m_aSprms);
diff --git a/writerfilter/source/rtftok/rtfsprm.hxx 
b/writerfilter/source/rtftok/rtfsprm.hxx
index f4bd462..df223fc 100644
--- a/writerfilter/source/rtftok/rtfsprm.hxx
+++ b/writerfilter/source/rtftok/rtfsprm.hxx
@@ -38,16 +38,22 @@ namespace writerfilter {
         {
             public:
                 typedef ::boost::shared_ptr<RTFSprms> Pointer_t;
-                typedef std::vector< std::pair<Id, RTFValue::Pointer_t> 
>::iterator Iterator_t;
+                typedef std::pair<Id, RTFValue::Pointer_t> Entry_t;
+                typedef std::vector<Entry_t>::iterator Iterator_t;
                 RTFSprms();
                 RTFSprms(const RTFSprms& rSprms);
                 RTFSprms& operator=(const RTFSprms& rOther);
-                std::vector< std::pair<Id, RTFValue::Pointer_t> >* 
operator->();
                 RTFValue::Pointer_t find(Id nKeyword);
                 /// Does the same as ->push_back(), except that it can 
overwrite existing entries.
                 void set(Id nKeyword, RTFValue::Pointer_t pValue, bool 
bOverwrite = true);
                 bool erase(Id nKeyword);
                 void swap(RTFSprms& rOther);
+                size_t size() const { return m_aSprms.size(); }
+                bool empty() const { return m_aSprms.empty(); }
+                Entry_t& back() { return m_aSprms.back(); }
+                Iterator_t begin() { return m_aSprms.begin(); }
+                Iterator_t end() { return m_aSprms.end(); }
+                void clear() { return m_aSprms.clear(); }
             private:
                 std::vector< std::pair<Id, RTFValue::Pointer_t> > m_aSprms;
         };
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to