svl/inc/svl/svdde.hxx | 2 svl/source/svdde/ddeimp.hxx | 6 -- unusedcode.easy | 9 ---- xmloff/inc/xmloff/XMLFontAutoStylePool.hxx | 5 +- xmloff/inc/xmloff/XMLTextListAutoStylePool.hxx | 5 +- xmloff/source/style/XMLFontAutoStylePool.cxx | 22 +--------- xmloff/source/style/impastp1.cxx | 34 +--------------- xmloff/source/style/impastp2.cxx | 2 xmloff/source/style/impastp3.cxx | 2 xmloff/source/style/impastp4.cxx | 13 ++---- xmloff/source/style/impastpl.hxx | 11 ----- xmloff/source/style/xmlstyle.cxx | 50 ++++++++++-------------- xmloff/source/text/XMLTextListAutoStylePool.cxx | 26 +----------- 13 files changed, 49 insertions(+), 138 deletions(-)
New commits: commit 7e579295c8c07998d7e077fa7e1db24745726e5f Author: Caolán McNamara <caol...@redhat.com> Date: Wed Aug 1 10:56:00 2012 +0100 convert SvXMLAutoStylePoolNamesP_Impl to a std::set Change-Id: I839edf8d0e941f78f6f6f9e6a9117f76587a5f39 diff --git a/unusedcode.easy b/unusedcode.easy index 14faca2..5e27520 100755 --- a/unusedcode.easy +++ b/unusedcode.easy @@ -29,16 +29,11 @@ String::CreateFromAscii(char const*) String::CreateFromAscii(char const*, unsigned short) String::String(unsigned short const*) String::String(unsigned short const*, unsigned short) -SvXMLAutoStylePoolNamesP_Impl::GetPos(rtl::OUString const*) const -SvXMLAutoStylePoolNamesP_Impl::Remove(rtl::OUString*) SvXMLAutoStylePoolParentsP_Impl::GetPos(SvXMLAutoStylePoolParentP_Impl const*) const SvXMLAutoStylePoolParentsP_Impl::Remove(SvXMLAutoStylePoolParentP_Impl*) -SvXMLStyleIndices_Impl::GetPos(SvXMLStyleIndex_Impl const*) const -SvXMLStyleIndices_Impl::Remove(SvXMLStyleIndex_Impl*) SvtSlideSorterBarOptions::AddListenerLink(Link const&) SvtSlideSorterBarOptions::RemoveListenerLink(Link const&) SvxPositionSizeTabPage::GetRect() -SwSortElements::Remove(unsigned short, unsigned short) SwXMLTableColumnsSortByWidth_Impl::GetPos(SwXMLTableColumn_Impl const*) const SwXMLTableColumnsSortByWidth_Impl::Remove(SwXMLTableColumn_Impl*) TempFile::IsValid() const @@ -62,12 +57,8 @@ X11SalGraphics::SetMask(int&, int&, unsigned int&, unsigned int&, int&, int&, un X509Certificate_NssImpl::getImplementation(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>) XMLFamilyDataList_Impl::GetPos(XMLFamilyData_Impl const*) const XMLFamilyDataList_Impl::Remove(XMLFamilyData_Impl*) -XMLFontAutoStylePoolNames_Impl::GetPos(rtl::OUString const*) const -XMLFontAutoStylePoolNames_Impl::Remove(rtl::OUString*) XMLFontAutoStylePool_Impl::GetPos(XMLFontAutoStylePoolEntry_Impl const*) const XMLFontAutoStylePool_Impl::Remove(XMLFontAutoStylePoolEntry_Impl*) -XMLTextListAutoStylePoolNames_Impl::GetPos(rtl::OUString const*) const -XMLTextListAutoStylePoolNames_Impl::Remove(rtl::OUString*) XMLTextListAutoStylePool_Impl::GetPos(XMLTextListAutoStylePoolEntry_Impl const*) const XMLTextListAutoStylePool_Impl::Remove(XMLTextListAutoStylePoolEntry_Impl*) XclExpColorScale::XclExpColorScale(XclExpRoot const&, ScColorScaleFormat const&) diff --git a/xmloff/inc/xmloff/XMLFontAutoStylePool.hxx b/xmloff/inc/xmloff/XMLFontAutoStylePool.hxx index f96e533..4fd666b 100644 --- a/xmloff/inc/xmloff/XMLFontAutoStylePool.hxx +++ b/xmloff/inc/xmloff/XMLFontAutoStylePool.hxx @@ -24,9 +24,10 @@ #include "xmloff/dllapi.h" #include <rtl/ustring.hxx> #include <xmloff/uniref.hxx> +#include <set> class XMLFontAutoStylePool_Impl; -class XMLFontAutoStylePoolNames_Impl; +typedef std::set<rtl::OUString> XMLFontAutoStylePoolNames_Impl; class SvXMLExport; class XMLOFF_DLLPUBLIC XMLFontAutoStylePool : public UniRefBase @@ -34,7 +35,7 @@ class XMLOFF_DLLPUBLIC XMLFontAutoStylePool : public UniRefBase SvXMLExport& rExport; XMLFontAutoStylePool_Impl *pPool; - XMLFontAutoStylePoolNames_Impl *pNames; + XMLFontAutoStylePoolNames_Impl m_aNames; sal_uInt32 nName; protected: diff --git a/xmloff/inc/xmloff/XMLTextListAutoStylePool.hxx b/xmloff/inc/xmloff/XMLTextListAutoStylePool.hxx index 8c39819..ff84c3a 100644 --- a/xmloff/inc/xmloff/XMLTextListAutoStylePool.hxx +++ b/xmloff/inc/xmloff/XMLTextListAutoStylePool.hxx @@ -34,6 +34,7 @@ #include "sal/types.h" #include <rtl/ustring.hxx> #include <com/sun/star/ucb/XAnyCompare.hpp> +#include <set> namespace com { namespace sun { namespace star { namespace container { class XIndexReplace; } } } } @@ -41,7 +42,7 @@ namespace rtl { class OUString; } class XMLTextListAutoStylePool_Impl; -class XMLTextListAutoStylePoolNames_Impl; +typedef std::set<rtl::OUString> XMLTextListAutoStylePoolNames_Impl; class XMLTextListAutoStylePoolEntry_Impl; class SvXMLExport; @@ -52,7 +53,7 @@ class XMLOFF_DLLPUBLIC XMLTextListAutoStylePool ::rtl::OUString sPrefix; XMLTextListAutoStylePool_Impl *pPool; - XMLTextListAutoStylePoolNames_Impl *pNames; + XMLTextListAutoStylePoolNames_Impl m_aNames; sal_uInt32 nName; /** this is an optional NumRule compare component for applications where diff --git a/xmloff/source/style/XMLFontAutoStylePool.cxx b/xmloff/source/style/XMLFontAutoStylePool.cxx index a242375..f6bada3 100644 --- a/xmloff/source/style/XMLFontAutoStylePool.cxx +++ b/xmloff/source/style/XMLFontAutoStylePool.cxx @@ -42,18 +42,6 @@ using ::rtl::OUStringBuffer; using namespace ::com::sun::star::uno; using namespace ::xmloff::token; -int XMLFontAutoStylePoolNameCmp_Impl( const OUString& r1, - const OUString& r2 ) -{ - return (int)r1.compareTo( r2 ); -} - -DECLARE_CONTAINER_SORT_DEL( XMLFontAutoStylePoolNames_Impl, - OUString ) -IMPL_CONTAINER_SORT( XMLFontAutoStylePoolNames_Impl, - OUString, - XMLFontAutoStylePoolNameCmp_Impl ) - class XMLFontAutoStylePoolEntry_Impl { OUString sName; @@ -148,15 +136,13 @@ IMPL_CONTAINER_SORT( XMLFontAutoStylePool_Impl, XMLFontAutoStylePool::XMLFontAutoStylePool( SvXMLExport& rExp ) : rExport( rExp ), - pPool( new XMLFontAutoStylePool_Impl( 5, 5 ) ), - pNames( new XMLFontAutoStylePoolNames_Impl( 5, 5 ) ) + pPool( new XMLFontAutoStylePool_Impl( 5, 5 ) ) { } XMLFontAutoStylePool::~XMLFontAutoStylePool() { delete pPool; - delete pNames; } OUString XMLFontAutoStylePool::Add( @@ -191,12 +177,12 @@ OUString XMLFontAutoStylePool::Add( if( sName.isEmpty() ) sName = OUString::valueOf( sal_Unicode( 'F' ) ); - if( pNames->Seek_Entry( &sName, 0 ) ) + if( m_aNames.find(sName) != m_aNames.end() ) { sal_Int32 nCount = 1; OUString sPrefix( sName ); sName += OUString::valueOf( nCount ); - while( pNames->Seek_Entry( &sName, 0 ) ) + while( m_aNames.find(sName) != m_aNames.end() ) { sName = sPrefix; sName += OUString::valueOf( ++nCount ); @@ -207,7 +193,7 @@ OUString XMLFontAutoStylePool::Add( new XMLFontAutoStylePoolEntry_Impl( sName, rFamilyName, rStyleName, nFamily, nPitch, eEnc ); pPool->Insert( pEntry ); - pNames->Insert( new OUString( sName ) ); + m_aNames.insert(sName); } return sPoolName; diff --git a/xmloff/source/style/impastp1.cxx b/xmloff/source/style/impastp1.cxx index ec98e9c..4eeffef 100644 --- a/xmloff/source/style/impastp1.cxx +++ b/xmloff/source/style/impastp1.cxx @@ -52,13 +52,13 @@ XMLFamilyData_Impl::XMLFamilyData_Impl( { mpParentList = new SvXMLAutoStylePoolParentsP_Impl( 5, 5 ); - mpNameList = new SvXMLAutoStylePoolNamesP_Impl( 5, 5 ); + mpNameList = new SvXMLAutoStylePoolNamesP_Impl; } XMLFamilyData_Impl::~XMLFamilyData_Impl() { - if( mpParentList ) delete mpParentList; - if( mpNameList ) delete mpNameList; + delete mpParentList; + delete mpNameList; DBG_ASSERT( !pCache || !pCache->size(), "auto style pool cache is not empty!" ); if( pCache ) { @@ -71,8 +71,7 @@ XMLFamilyData_Impl::~XMLFamilyData_Impl() void XMLFamilyData_Impl::ClearEntries() { - if( mpParentList ) - delete mpParentList; + delete mpParentList; mpParentList = new SvXMLAutoStylePoolParentsP_Impl( 5, 5 ); DBG_ASSERT( !pCache || !pCache->size(), "auto style pool cache is not empty!" ); if( pCache ) @@ -105,29 +104,4 @@ int XMLFamilyDataSort_Impl( const XMLFamilyData_Impl& r1, const XMLFamilyData_Im IMPL_CONTAINER_SORT( XMLFamilyDataList_Impl, XMLFamilyData_Impl, XMLFamilyDataSort_Impl ) -//############################################################################# -// -// Sorted list of OUString - elements -// - -/////////////////////////////////////////////////////////////////////////////// -// -// Sort-function for OUString-list -// - -int SvXMLAutoStylePoolNamesPCmp_Impl( const OUString& r1, - const OUString& r2 ) -{ - return (int)r1.compareTo( r2 ); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Implementation of sorted OUString-list -// - -IMPL_CONTAINER_SORT( SvXMLAutoStylePoolNamesP_Impl, - OUString, - SvXMLAutoStylePoolNamesPCmp_Impl ) - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/style/impastp2.cxx b/xmloff/source/style/impastp2.cxx index 882619d..b5d3c94 100644 --- a/xmloff/source/style/impastp2.cxx +++ b/xmloff/source/style/impastp2.cxx @@ -58,7 +58,7 @@ SvXMLAutoStylePoolPropertiesP_Impl::SvXMLAutoStylePoolPropertiesP_Impl( XMLFamil sBuffer.append( OUString::valueOf( (sal_Int32)pFamilyData->mnName ) ); msName = sBuffer.makeStringAndClear(); } - while( pFamilyData->mpNameList->Seek_Entry( &msName, 0 ) ); + while( pFamilyData->mpNameList->find(msName) != pFamilyData->mpNameList->end() ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/style/impastp3.cxx b/xmloff/source/style/impastp3.cxx index d02d3f9..20b1cf0 100644 --- a/xmloff/source/style/impastp3.cxx +++ b/xmloff/source/style/impastp3.cxx @@ -123,7 +123,7 @@ sal_Bool SvXMLAutoStylePoolParentP_Impl::AddNamed( XMLFamilyData_Impl* pFamilyDa } } - if( !pFamilyData->mpNameList->Seek_Entry( &rName, 0 ) ) + if(pFamilyData->mpNameList->find(rName) == pFamilyData->mpNameList->end()) { SvXMLAutoStylePoolPropertiesP_Impl* pProperties = new SvXMLAutoStylePoolPropertiesP_Impl( pFamilyData, rProperties ); diff --git a/xmloff/source/style/impastp4.cxx b/xmloff/source/style/impastp4.cxx index 389c80b..47793ec 100644 --- a/xmloff/source/style/impastp4.cxx +++ b/xmloff/source/style/impastp4.cxx @@ -136,11 +136,7 @@ void SvXMLAutoStylePoolP_Impl::RegisterName( sal_Int32 nFamily, const OUString& DBG_ASSERT( pNames, "SvXMLAutoStylePool_Impl::RegisterName: unknown family" ); if( pNames ) - { - OUString *pName = new OUString( rName ); - if( !pNames->Insert( pName ) ) - delete pName; - } + pNames->insert(rName); } /////////////////////////////////////////////////////////////////////////////// @@ -164,11 +160,12 @@ void SvXMLAutoStylePoolP_Impl::GetRegisteredNames( // iterate over names SvXMLAutoStylePoolNamesP_Impl* pNames = pFamily->mpNameList; - sal_uInt32 nNames = ( pNames != NULL ) ? pNames->Count() : 0; - for( sal_uInt32 j = 0; j < nNames; j++ ) + if (!pNames) + continue; + for (SvXMLAutoStylePoolNamesP_Impl::const_iterator aI = pNames->begin(); aI != pNames->end(); ++aI) { aFamilies.push_back( pFamily->mnFamily ); - aNames.push_back( *pNames->GetObject( j ) ); + aNames.push_back( *aI ); } } diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx index 3392bc9..659211f 100644 --- a/xmloff/source/style/impastpl.hxx +++ b/xmloff/source/style/impastpl.hxx @@ -32,6 +32,7 @@ #include <sal/types.h> #include <svl/cntnrsrt.hxx> #include <rtl/ustring.hxx> +#include <set> #include <vector> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/xml/sax/XAttributeList.hpp> @@ -41,7 +42,7 @@ class SvXMLAutoStylePoolP; class SvXMLAutoStylePoolParentsP_Impl; -class SvXMLAutoStylePoolNamesP_Impl; +typedef std::set<rtl::OUString> SvXMLAutoStylePoolNamesP_Impl; class SvXMLExportPropertyMapper; class SvXMLExport; @@ -92,14 +93,6 @@ DECLARE_CONTAINER_SORT( XMLFamilyDataList_Impl, XMLFamilyData_Impl ) /////////////////////////////////////////////////////////////////////////////// // -// -// - -DECLARE_CONTAINER_SORT_DEL( SvXMLAutoStylePoolNamesP_Impl, - ::rtl::OUString ) - -/////////////////////////////////////////////////////////////////////////////// -// // Properties of a pool // diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index d99469d..f881dec 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -63,6 +63,7 @@ #include "PageMasterImportContext.hxx" #include "PageMasterImportPropMapper.hxx" +#include <set> #include <vector> using ::rtl::OUString; @@ -243,29 +244,29 @@ public: const SvXMLStyleContext *GetStyle() const { return pStyle; } }; -int SvXMLStyleIndexCmp_Impl( const SvXMLStyleIndex_Impl& r1, - const SvXMLStyleIndex_Impl& r2 ) +struct SvXMLStyleIndexCmp_Impl { - int nRet; - if( (sal_uInt16)r1.GetFamily() < (sal_uInt16)r2.GetFamily() ) - nRet = -1; - else if( (sal_uInt16)r1.GetFamily() > (sal_uInt16)r2.GetFamily() ) - nRet = 1; - else - nRet = (int)r1.GetName().compareTo( r2.GetName() ); + bool operator()(const SvXMLStyleIndex_Impl& r1, const SvXMLStyleIndex_Impl& r2) + { + sal_Int32 nRet; - return nRet; -} + if( (sal_uInt16)r1.GetFamily() < (sal_uInt16)r2.GetFamily() ) + nRet = -1; + else if( (sal_uInt16)r1.GetFamily() > (sal_uInt16)r2.GetFamily() ) + nRet = 1; + else + nRet = r1.GetName().compareTo( r2.GetName() ); + + return nRet < 0; + } +}; // --------------------------------------------------------------------- typedef SvXMLStyleContext *SvXMLStyleContextPtr; typedef vector< SvXMLStyleContextPtr > SvXMLStyleContexts_Impl; -DECLARE_CONTAINER_SORT_DEL( SvXMLStyleIndices_Impl, SvXMLStyleIndex_Impl ) -IMPL_CONTAINER_SORT( SvXMLStyleIndices_Impl, SvXMLStyleIndex_Impl, - SvXMLStyleIndexCmp_Impl ) - +typedef std::set<SvXMLStyleIndex_Impl, SvXMLStyleIndexCmp_Impl> SvXMLStyleIndices_Impl; class SvXMLStylesContext_Impl { @@ -357,17 +358,8 @@ const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext( "Performance warning: sdbcx::Index created multiple times" ); #endif ((SvXMLStylesContext_Impl *)this)->pIndices = - new SvXMLStyleIndices_Impl( - sal::static_int_cast< sal_uInt16 >( aStyles.size() ), 5 ); - for( size_t i = 0; i < aStyles.size(); i++ ) - { - SvXMLStyleIndex_Impl* pStyleIndex = new SvXMLStyleIndex_Impl( aStyles[ i ] ); - if (!pIndices->Insert( pStyleIndex )) - { - OSL_FAIL("Here is a double Style"); - delete pStyleIndex; - } - } + new SvXMLStyleIndices_Impl( aStyles.begin(), aStyles.end() ); + SAL_WARN_IF(pIndices->size() != aStyles.size(), "xmloff", "Here is a duplicate Style"); #ifdef DBG_UTIL ((SvXMLStylesContext_Impl *)this)->nIndexCreated++; #endif @@ -376,9 +368,9 @@ const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext( if( pIndices ) { SvXMLStyleIndex_Impl aIndex( nFamily, rName ); - sal_uLong nPos = 0; - if( pIndices->Seek_Entry( &aIndex, &nPos ) ) - pStyle = pIndices->GetObject( nPos )->GetStyle(); + SvXMLStyleIndices_Impl::iterator aFind = pIndices->find(aIndex); + if( aFind != pIndices->end() ) + pStyle = aFind->GetStyle(); } else { diff --git a/xmloff/source/text/XMLTextListAutoStylePool.cxx b/xmloff/source/text/XMLTextListAutoStylePool.cxx index 8becfb7..acf9044 100644 --- a/xmloff/source/text/XMLTextListAutoStylePool.cxx +++ b/xmloff/source/text/XMLTextListAutoStylePool.cxx @@ -46,18 +46,6 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::style; -int XMLTextListAutoStylePoolNameCmp_Impl( const OUString& r1, - const OUString& r2 ) -{ - return (int)r1.compareTo( r2 ); -} - -DECLARE_CONTAINER_SORT_DEL( XMLTextListAutoStylePoolNames_Impl, - OUString ) -IMPL_CONTAINER_SORT( XMLTextListAutoStylePoolNames_Impl, - OUString, - XMLTextListAutoStylePoolNameCmp_Impl ) - class XMLTextListAutoStylePoolEntry_Impl { OUString sName; @@ -132,7 +120,7 @@ XMLTextListAutoStylePoolEntry_Impl::XMLTextListAutoStylePoolEntry_Impl( sBuffer.append( (sal_Int32)rName ); sName = sBuffer.makeStringAndClear(); } - while( rNames.Seek_Entry( &sName, 0 ) ); + while (rNames.find(sName) != rNames.end()); } int XMLTextListAutoStylePoolEntryCmp_Impl( @@ -169,7 +157,6 @@ XMLTextListAutoStylePool::XMLTextListAutoStylePool( SvXMLExport& rExp ) : rExport( rExp ), sPrefix( RTL_CONSTASCII_USTRINGPARAM("L") ), pPool( new XMLTextListAutoStylePool_Impl( 5, 5 ) ), - pNames( new XMLTextListAutoStylePoolNames_Impl( 5, 5 ) ), nName( 0 ) { Reference<ucb::XAnyCompareFactory> xCompareFac( rExp.GetModel(), uno::UNO_QUERY ); @@ -189,18 +176,11 @@ XMLTextListAutoStylePool::~XMLTextListAutoStylePool() while ( nCount-- ) delete pPool->Remove(nCount); delete pPool; - - nCount = pNames->Count(); - while ( nCount-- ) - delete pNames->Remove(nCount); - delete pNames; } void XMLTextListAutoStylePool::RegisterName( const OUString& rName ) { - OUString *pName = new OUString( rName ); - if( !pNames->Insert( pName ) ) - delete pName; + m_aNames.insert(rName); } sal_uInt32 XMLTextListAutoStylePool::Find( XMLTextListAutoStylePoolEntry_Impl* pEntry ) const @@ -244,7 +224,7 @@ OUString XMLTextListAutoStylePool::Add( { XMLTextListAutoStylePoolEntry_Impl *pEntry = new XMLTextListAutoStylePoolEntry_Impl( pPool->Count(), - rNumRules, *pNames, sPrefix, + rNumRules, m_aNames, sPrefix, nName ); pPool->Insert( pEntry ); sName = pEntry->GetName(); commit 3515019f8aabebc6f0037fa2e8f4a271b64e3845 Author: Caolán McNamara <caol...@redhat.com> Date: Tue Jul 31 21:39:57 2012 +0100 include svl/svdde.hxx Change-Id: Ib8696dad1905cbcd12d6c3dd42720eea3f883c6f diff --git a/svl/inc/svl/svdde.hxx b/svl/inc/svl/svdde.hxx index 825e899..0895a81 100644 --- a/svl/inc/svl/svdde.hxx +++ b/svl/inc/svl/svdde.hxx @@ -44,7 +44,7 @@ struct DdeImp; class DdeItemImp; struct Conversation; -class DdeServices : public ::std::vector< DdeService* > {}; +typedef ::std::vector< DdeService* > DdeServices; typedef ::std::vector< long > DdeFormats; typedef ::std::vector< Conversation* > ConvList; diff --git a/svl/source/svdde/ddeimp.hxx b/svl/source/svdde/ddeimp.hxx index 0800463..99e2ec2 100644 --- a/svl/source/svdde/ddeimp.hxx +++ b/svl/source/svdde/ddeimp.hxx @@ -26,12 +26,9 @@ #include <tools/string.hxx> #include <tools/shl.hxx> #include <boost/noncopyable.hpp> +#include <svl/svdde.hxx> #include <vector> -class DdeService; -class DdeTopic; -class DdeItem; - // ---------------- // - Conversation - // ---------------- @@ -112,7 +109,6 @@ struct DdeDataImp }; class DdeConnection; -class DdeServices; class DdeInstData : private boost::noncopyable {
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits