summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorAugust Sodora <augsod@gmail.com>2012-01-13 23:48:59 -0500
committerAugust Sodora <augsod@gmail.com>2012-01-13 23:48:59 -0500
commit169f3b47c0ad339c6983de2e19d94627c9e567d3 (patch)
tree46604d6dbf7588b420390ae720d67411d161680b /sw
parentfdb6e4171c7ab9620b739e1a1c3cbba51ba81544 (diff)
SvStringsDtor->boost::ptr_vector
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/doc.hxx12
-rw-r--r--sw/source/core/doc/poolfmt.cxx17
2 files changed, 18 insertions, 11 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 47b55ec1fa37..edf59c301851 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -88,6 +88,7 @@ class SwList;
#include <memory>
#include <boost/scoped_ptr.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
namespace editeng { class SvxBorderLine; }
@@ -288,7 +289,7 @@ class SW_DLLPUBLIC SwDoc :
SwDBData aDBData; // database descriptor
::com::sun::star::uno::Sequence <sal_Int8 > aRedlinePasswd;
String sTOIAutoMarkURL; // ::com::sun::star::util::URL of table of index AutoMark file
- SvStringsDtor aPatternNms; // Array for names of document-templates
+ boost::ptr_vector< boost::nullable<String> > aPatternNms; // Array for names of document-templates
com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
xXForms; // container with XForms models
mutable com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > m_xGCIterator;
@@ -1300,7 +1301,14 @@ public:
sal_uInt16 SetDocPattern( const String& rPatternName );
// Return name of document template. Can be 0!
- String* GetDocPattern( sal_uInt16 nPos ) const { return aPatternNms[nPos]; }
+ const String* GetDocPattern( sal_uInt16 nPos ) const
+ {
+ if(nPos >= aPatternNms.size())
+ return NULL;
+ if(boost::is_null(aPatternNms.begin() + nPos))
+ return NULL;
+ return &(aPatternNms[nPos]);
+ }
// Delete all unreferenced field types.
void GCFieldTypes(); // impl. in docfld.cxx
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 25fae855febe..6b5868ac7e37 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -2125,21 +2125,20 @@ sal_uInt16 SwDoc::SetDocPattern( const String& rPatternName )
{
OSL_ENSURE( rPatternName.Len(), "no Document Template name" );
- sal_uInt16 nNewPos = aPatternNms.Count();
- for( sal_uInt16 n = 0; n < aPatternNms.Count(); ++n )
- if( !aPatternNms[n] )
+ size_t nNewPos = aPatternNms.size();
+ for(size_t n = 0; n < aPatternNms.size(); ++n)
+ if( boost::is_null(aPatternNms.begin() + n) )
{
- if( nNewPos == aPatternNms.Count() )
+ if( nNewPos == aPatternNms.size() )
nNewPos = n;
}
- else if( rPatternName == *aPatternNms[n] )
+ else if( rPatternName == aPatternNms[n] )
return n;
- if( nNewPos < aPatternNms.Count() )
- aPatternNms.Remove( nNewPos ); // Free space again
+ if( nNewPos < aPatternNms.size() )
+ aPatternNms.erase(aPatternNms.begin() + nNewPos); // Free space again
- String* pNewNm = new String( rPatternName );
- aPatternNms.Insert( pNewNm, nNewPos );
+ aPatternNms.insert(aPatternNms.begin() + nNewPos, new String(rPatternName));
SetModified();
return nNewPos;
}