[Libreoffice-commits] .: sw/source xmloff/source

Caolán McNamara caolan at kemper.freedesktop.org
Tue Nov 8 07:00:39 PST 2011


 sw/source/filter/html/css1atr.cxx |   11 ++++-------
 sw/source/filter/html/htmlatr.cxx |   10 +++++-----
 sw/source/filter/html/htmlfly.cxx |    2 +-
 sw/source/filter/html/htmlftn.cxx |    2 +-
 sw/source/filter/html/htmlnum.cxx |    4 ++--
 sw/source/filter/html/wrthtml.cxx |   18 ++++++------------
 sw/source/filter/html/wrthtml.hxx |    8 ++++----
 sw/source/ui/chrdlg/pardlg.cxx    |    8 ++++----
 sw/source/ui/fmtui/tmpdlg.cxx     |    8 ++++----
 sw/source/ui/misc/redlndlg.cxx    |   21 ++++++++++-----------
 sw/source/ui/uiview/view2.cxx     |   18 +++++++++---------
 xmloff/source/style/styleexp.cxx  |   16 +++++++---------
 12 files changed, 57 insertions(+), 69 deletions(-)

New commits:
commit e494bd26e5415dd0926bcef7c51ab99a4322730f
Author: Daisuke Nishino <niboshi000 at gmail.com>
Date:   Tue Nov 8 03:05:41 2011 +0900

    Removed some SvStringsSortDtor

diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 157a106..69efd26 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -1763,15 +1763,12 @@ static Writer& OutCSS1_SwFmt( Writer& rWrt, const SwFmt& rFmt,
                       bCheckForPseudo ) )
     {
         if( bCharFmt )
-            rHTMLWrt.aScriptTextStyles.Insert( new String( rFmt.GetName() ) );
+            rHTMLWrt.aScriptTextStyles.insert( rFmt.GetName() );
         else
         {
             if( nPoolFmtId==RES_POOLCOLL_TEXT )
-                rHTMLWrt.aScriptParaStyles.Insert
-                    (new String( pDoc->GetTxtCollFromPool
-                                 ( RES_POOLCOLL_STANDARD, false )->GetName()
-                                 ) );
-            rHTMLWrt.aScriptParaStyles.Insert( new String( rFmt.GetName() ) );
+                rHTMLWrt.aScriptParaStyles.insert( pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false )->GetName() );
+            rHTMLWrt.aScriptParaStyles.insert( rFmt.GetName() );
         }
         bHasScriptDependencies = sal_True;
     }
@@ -1950,7 +1947,7 @@ static Writer& OutCSS1_SwFtnInfo( Writer& rWrt, const SwEndNoteInfo& rInfo,
             aSelector.AppendAscii( bEndNote ? OOO_STRING_SVTOOLS_HTML_sdendnote_sym
                                         : OOO_STRING_SVTOOLS_HTML_sdfootnote_sym );
             if( OutCSS1Rule( rHTMLWrt, aSelector, aItemSet, sal_True, sal_False ))
-                rHTMLWrt.aScriptTextStyles.Insert( new String( pSymCharFmt->GetName() ) );
+                rHTMLWrt.aScriptTextStyles.insert( pSymCharFmt->GetName() );
         }
     }
 
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 7b796a5..c7d2847 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -651,7 +651,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt,
                                       !rHWrt.IsHTMLMode(HTMLMODE_DROPCAPS) );
         rHWrt.aTxtCollInfos.C40_PTR_INSERT( SwHTMLFmtInfo, pFmtInfo );
         String aName( rFmt.GetName() );
-        if( rHWrt.aScriptParaStyles.Seek_Entry( &aName ) )
+        if( 0 != rHWrt.aScriptParaStyles.count( aName ) )
             ((SwHTMLFmtInfo *)pFmtInfo)->bScriptDependent = sal_True;
     }
 
@@ -1251,7 +1251,7 @@ class HTMLEndPosLst
     SwDoc *pDoc;            // das aktuelle Dokument
     SwDoc* pTemplate;       // die HTML-Vorlage (oder 0)
     const Color* pDfltColor;// die Default-Vordergrund-Farbe
-    SvStringsSortDtor& rScriptTxtStyles;    //
+    std::set<String>& rScriptTxtStyles;    //
 
     sal_uLong nHTMLMode;
     sal_Bool bOutStyles : 1;    // werden Styles exportiert
@@ -1302,7 +1302,7 @@ public:
 
     HTMLEndPosLst( SwDoc *pDoc, SwDoc* pTemplate, const Color* pDfltColor,
                    sal_Bool bOutStyles, sal_uLong nHTMLMode,
-                   const String& rText, SvStringsSortDtor& rStyles );
+                   const String& rText, std::set<String>& rStyles );
     ~HTMLEndPosLst();
 
     // Ein Attribut einfuegen
@@ -1763,7 +1763,7 @@ const SwHTMLFmtInfo *HTMLEndPosLst::GetFmtInfo( const SwFmt& rFmt,
                                       bOutStyles );
         rFmtInfos.C40_PTR_INSERT( SwHTMLFmtInfo, pFmtInfo );
         String aName( rFmt.GetName() );
-        if( rScriptTxtStyles.Seek_Entry( &aName ) )
+        if( 0 != rScriptTxtStyles.count( aName ) )
             ((SwHTMLFmtInfo *)pFmtInfo)->bScriptDependent = sal_True;
     }
 
@@ -1773,7 +1773,7 @@ const SwHTMLFmtInfo *HTMLEndPosLst::GetFmtInfo( const SwFmt& rFmt,
 HTMLEndPosLst::HTMLEndPosLst( SwDoc *pD, SwDoc* pTempl,
                               const Color* pDfltCol, sal_Bool bStyles,
                               sal_uLong nMode, const String& rText,
-                              SvStringsSortDtor& rStyles ):
+                              std::set<String>& rStyles ):
     pDoc( pD ),
     pTemplate( pTempl ),
     pDfltColor( pDfltCol ),
diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx
index 1f59846..b07e98f 100644
--- a/sw/source/filter/html/htmlfly.cxx
+++ b/sw/source/filter/html/htmlfly.cxx
@@ -1822,7 +1822,7 @@ void SwHTMLWriter::AddLinkTarget( const String& rURL )
             aURL.Erase( nPos, 2 );
             aURL.SetChar( nPos-1, cMarkSeperator );
         }
-        aImplicitMarks.Insert( new String( aURL ) );
+        aImplicitMarks.insert( aURL );
     }
     else if( sCmp.EqualsAscii( pMarkToOutline ) )
     {
diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx
index a11200a..6512f98 100644
--- a/sw/source/filter/html/htmlftn.cxx
+++ b/sw/source/filter/html/htmlftn.cxx
@@ -467,7 +467,7 @@ void SwHTMLWriter::OutFootEndNoteSym( const SwFmtFtn& rFmtFtn,
     }
 
     const SwCharFmt *pSymCharFmt = pInfo->GetCharFmt( *pDoc );
-    if( pSymCharFmt && aScriptTextStyles.Seek_Entry( (String *)&pSymCharFmt->GetName() ) )
+    if( pSymCharFmt && 0 != aScriptTextStyles.count( pSymCharFmt->GetName() ) )
     {
         switch( nScript )
         {
diff --git a/sw/source/filter/html/htmlnum.cxx b/sw/source/filter/html/htmlnum.cxx
index fda8d3b..334cfba 100644
--- a/sw/source/filter/html/htmlnum.cxx
+++ b/sw/source/filter/html/htmlnum.cxx
@@ -729,7 +729,7 @@ Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt,
     if( !bSameRule && rInfo.GetDepth() )
     {
         String aName( rInfo.GetNumRule()->GetName() );
-        if( rWrt.aNumRuleNames.Seek_Entry( &aName ) )
+        if( 0 != rWrt.aNumRuleNames.count( aName ) )
         {
             // The rule has been applied before
             sal_Int16 eType = rInfo.GetNumRule()
@@ -787,7 +787,7 @@ Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt,
         }
         else
         {
-            rWrt.aNumRuleNames.Insert( new String( aName ) );
+            rWrt.aNumRuleNames.insert( aName );
         }
     }
 
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 96c4401..d4d9f4e 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -396,20 +396,16 @@ sal_uLong SwHTMLWriter::WriteStream()
     if( aImgMapNames.Count() )
         aImgMapNames.DeleteAndDestroy( sal_uInt16(0), aImgMapNames.Count() );
 
-    if( aImplicitMarks.Count() )
-        aImplicitMarks.DeleteAndDestroy( sal_uInt16(0), aImplicitMarks.Count() );
+    aImplicitMarks.clear();
 
     aOutlineMarks.clear();
 
     aOutlineMarkPoss.clear();
 
-    if( aNumRuleNames.Count() )
-        aNumRuleNames.DeleteAndDestroy( sal_uInt16(0), aNumRuleNames.Count() );
+    aNumRuleNames.clear();
 
-    if( aScriptParaStyles.Count() )
-        aScriptParaStyles.DeleteAndDestroy( sal_uInt16(0), aScriptParaStyles.Count() );
-    if( aScriptTextStyles.Count() )
-        aScriptTextStyles.DeleteAndDestroy( sal_uInt16(0), aScriptTextStyles.Count() );
+    aScriptParaStyles.clear();
+    aScriptTextStyles.clear();
 
     delete pDfltColor;
     pDfltColor = 0;
@@ -1077,17 +1073,15 @@ void SwHTMLWriter::OutBookmarks()
 void SwHTMLWriter::OutImplicitMark( const String& rMark,
                                     const sal_Char *pMarkType )
 {
-    if( rMark.Len() && aImplicitMarks.Count() )
+    if( rMark.Len() && !aImplicitMarks.empty() )
     {
         String sMark( rMark );
         sMark.Append( cMarkSeperator );
         sMark.AppendAscii( pMarkType );
-        sal_uInt16 nPos;
-        if( aImplicitMarks.Seek_Entry( &sMark, &nPos ) )
+        if( 0 != aImplicitMarks.erase( sMark ) )
         {
             sMark.SearchAndReplaceAll( '?', '_' );  // '?' causes problems in IE/Netscape 5
             OutAnchor( sMark );
-            aImplicitMarks.DeleteAndDestroy( nPos, 1 );
         }
     }
 }
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index a493c21..5f9753e 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -227,10 +227,10 @@ public:
 #endif
 
     SvStringsDtor aImgMapNames;     // geschriebene Image Maps
-    SvStringsSortDtor aImplicitMarks;// implizite Stprungmarken
-    SvStringsSortDtor aNumRuleNames;// Names of exported num rules
-    SvStringsSortDtor aScriptParaStyles;// script dependent para styles
-    SvStringsSortDtor aScriptTextStyles;// script dependent text styles
+    std::set<String> aImplicitMarks;// implizite Stprungmarken
+    std::set<String> aNumRuleNames;// Names of exported num rules
+    std::set<String> aScriptParaStyles;// script dependent para styles
+    std::set<String> aScriptTextStyles;// script dependent text styles
     boost::ptr_vector<String> aOutlineMarks;
     std::vector<sal_uInt32> aOutlineMarkPoss;
     HTMLControls aHTMLControls;     // die zu schreibenden ::com::sun::star::form::Forms
diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx
index 07a5b77..febd7b3 100644
--- a/sw/source/ui/chrdlg/pardlg.cxx
+++ b/sw/source/ui/chrdlg/pardlg.cxx
@@ -246,14 +246,14 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
         SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool();
         pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
         const SfxStyleSheetBase* pBase = pPool->First();
-        SvStringsSortDtor aNames;
+        std::set<String> aNames;
         while(pBase)
         {
-            aNames.Insert(new String(pBase->GetName()));
+            aNames.insert(pBase->GetName());
             pBase = pPool->Next();
         }
-        for(sal_uInt16 i = 0; i < aNames.Count(); i++)
-            rBox.InsertEntry(*aNames.GetObject(i));
+        for(std::set<String>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
+            rBox.InsertEntry(*it);
     }
 
 }
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index 5f88ae7..649b76e 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -445,14 +445,14 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
                 SfxStyleSheetBasePool* pPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
                 pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
                 const SfxStyleSheetBase* pBase = pPool->First();
-                SvStringsSortDtor aNames;
+                std::set<String> aNames;
                 while(pBase)
                 {
-                    aNames.Insert(new String(pBase->GetName()));
+                    aNames.insert(pBase->GetName());
                     pBase = pPool->Next();
                 }
-                for(sal_uInt16 i = 0; i < aNames.Count(); i++)
-                    rBox.InsertEntry(*aNames.GetObject(i));
+                for(std::set<String>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
+                    rBox.InsertEntry(*it);
         }
         break;
         case TP_PARA_ALIGN:
diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx
index eda3ede..7273324 100644
--- a/sw/source/ui/misc/redlndlg.cxx
+++ b/sw/source/ui/misc/redlndlg.cxx
@@ -300,7 +300,7 @@ void SwRedlineAcceptDlg::InitAuthors()
     SvxTPFilter *pFilterPage = aTabPagesCTRL.GetFilterPage();
 
     String sAuthor;
-    SvStringsSortDtor aStrings;
+    std::vector<String> aStrings;
     String sOldAuthor(pFilterPage->GetSelectedAuthor());
     pFilterPage->ClearAuthors();
 
@@ -320,23 +320,22 @@ void SwRedlineAcceptDlg::InitAuthors()
         if( bOnlyFormatedRedlines && nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType() )
             bOnlyFormatedRedlines = sal_False;
 
-        String *pAuthor = new String(rRedln.GetAuthorString());
-        if (!aStrings.Insert(pAuthor))
-            delete pAuthor;
+        aStrings.push_back(rRedln.GetAuthorString());
 
         for (sal_uInt16 nStack = 1; nStack < rRedln.GetStackCount(); nStack++)
         {
-            pAuthor = new String(rRedln.GetAuthorString(nStack));
-            if (!aStrings.Insert(pAuthor))
-                delete pAuthor;
+            aStrings.push_back(rRedln.GetAuthorString(nStack));
         }
     }
 
-    for (i = 0; i < aStrings.Count(); i++)
-        pFilterPage->InsertAuthor(*aStrings[i]);
+    std::sort(aStrings.begin(), aStrings.end());
+    aStrings.erase(std::unique(aStrings.begin(), aStrings.end()), aStrings.end());
 
-    if (pFilterPage->SelectAuthor(sOldAuthor) == LISTBOX_ENTRY_NOTFOUND && aStrings.Count())
-        pFilterPage->SelectAuthor(*aStrings[0]);
+    for (i = 0; i < aStrings.size(); i++)
+        pFilterPage->InsertAuthor(aStrings[i]);
+
+    if (pFilterPage->SelectAuthor(sOldAuthor) == LISTBOX_ENTRY_NOTFOUND && !aStrings.empty())
+        pFilterPage->SelectAuthor(aStrings[0]);
 
     sal_Bool bEnable = pTable->GetEntryCount() != 0 && !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength();
     sal_Bool bSel = pTable->FirstSelected() != 0;
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index afc6093..8c04deb 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -273,7 +273,7 @@ sal_Bool SwView::InsertGraphicDlg( SfxRequest& rReq )
         xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False);
     }
 
-    SvStringsSortDtor aFormats;
+    std::vector<String> aFormats;
     SwDoc* pDoc = pDocShell->GetDoc();
     const sal_uInt16 nArrLen = pDoc->GetFrmFmts()->Count();
     sal_uInt16 i;
@@ -282,8 +282,7 @@ sal_Bool SwView::InsertGraphicDlg( SfxRequest& rReq )
         SwFrmFmt* pFmt = (*pDoc->GetFrmFmts())[ i ];
         if(pFmt->IsDefault() || pFmt->IsAuto())
             continue;
-        String *pFormat = new String(pFmt->GetName());
-        aFormats.Insert(pFormat);
+        aFormats.push_back(pFmt->GetName());
     }
 
     // pool formats
@@ -291,18 +290,19 @@ sal_Bool SwView::InsertGraphicDlg( SfxRequest& rReq )
     const SvStringsDtor& rFrmPoolArr = SwStyleNameMapper::GetFrmFmtUINameArray();
     for( i = 0; i < rFrmPoolArr.Count(); i++ )
     {
-        String *pFormat = new String(*rFrmPoolArr[i]);
-        if (!aFormats.Insert(pFormat))
-            delete pFormat;
+        aFormats.push_back(*rFrmPoolArr[i]);
     }
 
-    Sequence<OUString> aListBoxEntries(aFormats.Count());
+    std::sort(aFormats.begin(), aFormats.end());
+    aFormats.erase(std::unique(aFormats.begin(), aFormats.end()), aFormats.end());
+
+    Sequence<OUString> aListBoxEntries(aFormats.size());
     OUString* pEntries = aListBoxEntries.getArray();
     sal_Int16 nSelect = 0;
     String sGraphicFormat = SW_RESSTR(STR_POOLFRM_GRAPHIC);
-    for(i = 0; i < aFormats.Count(); ++i)
+    for( i = 0; i < aFormats.size(); i++ )
     {
-        pEntries[i] = *aFormats[i];
+        pEntries[i] = aFormats[i];
         if(pEntries[i].equals(sGraphicFormat))
             nSelect = i;
     }
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
index 4c63750..76bbc16 100644
--- a/xmloff/source/style/styleexp.cxx
+++ b/xmloff/source/style/styleexp.cxx
@@ -53,6 +53,8 @@
 #include <xmloff/styleexp.hxx>
 #include <xmloff/xmlexp.hxx>
 #include <xmloff/XMLEventExport.hxx>
+#include <set>
+#include <boost/scoped_ptr.hpp>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -409,7 +411,7 @@ void XMLStyleExport::exportStyleFamily(
        // If next styles are supported and used styles should be exported only,
     // the next style may be unused but has to be exported, too. In this case
     // the names of all exported styles are remembered.
-    SvStringsSortDtor *pExportedStyles = 0;
+    boost::scoped_ptr<std::set<String> > pExportedStyles(0);
     sal_Bool bFirstStyle = sal_True;
 
     const uno::Sequence< ::rtl::OUString> aSeq = xStyles->getElementNames();
@@ -447,16 +449,14 @@ void XMLStyleExport::exportStyleFamily(
                         xPropSet->getPropertySetInfo();
 
                     if( xPropSetInfo->hasPropertyByName( sFollowStyle ) )
-                        pExportedStyles = new SvStringsSortDtor;
+                        pExportedStyles.reset(new std::set<String>());
                     bFirstStyle = sal_False;
                 }
 
                 if( pExportedStyles && bExported )
                 {
                     // If next styles are supported, remember this style's name.
-                    String *pTmp = new String( xStyle->getName() );
-                    if( !pExportedStyles->Insert( pTmp ) )
-                        delete pTmp;
+                    pExportedStyles->insert( xStyle->getName() );
                 }
             }
 
@@ -507,19 +507,17 @@ void XMLStyleExport::exportStyleFamily(
                 // if the next style hasn't been exported by now, export it now
                 // and remember its name.
                 if( xStyle->getName() != sNextName &&
-                    !pExportedStyles->Seek_Entry( &sTmp ) )
+                    0 == pExportedStyles->count( sTmp ) )
                 {
                     xStyleCont->getByName( sNextName ) >>= xStyle;
                     DBG_ASSERT( xStyle.is(), "Style not found for export!" );
 
                     if( xStyle.is() && exportStyle( xStyle, rXMLFamily, rPropMapper, xStyles,pPrefix ) )
-                        pExportedStyles->Insert( new String( sTmp ) );
+                        pExportedStyles->insert( sTmp );
                 }
             }
         }
     }
-
-    delete pExportedStyles;
 }
 
 


More information about the Libreoffice-commits mailing list