diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-27 22:15:08 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-29 09:56:06 +0100 |
commit | 65302eb1bed16db8f06cbb048d03ba6d644b3fb6 (patch) | |
tree | 2e7c3241b4c607fd074133b70c5abfb2e77c54d9 | |
parent | fa19c5ec0844456a485cb7eb4a64f9d9c6d678bf (diff) |
ByteString->rtl::OString and destupid-api a bit
-rw-r--r-- | sfx2/source/bastyp/fltfnc.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/dialog/filtergrouping.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/doc/docfilt.cxx | 7 | ||||
-rw-r--r-- | svtools/source/dialogs/filedlg2.cxx | 15 | ||||
-rwxr-xr-x | sw/source/ui/app/docsh2.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmdocselectpage.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmoutputpage.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/misc/glossary.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/uiview/srcview.cxx | 2 | ||||
-rw-r--r-- | tools/inc/tools/wldcrd.hxx | 38 | ||||
-rw-r--r-- | tools/source/fsys/wldcrd.cxx | 6 |
11 files changed, 46 insertions, 47 deletions
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index ced3dd807717..3ab7ea6ca7b3 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -712,7 +712,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4Extension( const String& rExt, SfxF SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) ) { - String sWildCard = ToUpper_Impl( pFilter->GetWildcard().GetWildCard() ); + String sWildCard = ToUpper_Impl( pFilter->GetWildcard().getGlob() ); String sExt = ToUpper_Impl( rExt ); if (!sExt.Len()) diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index 4f8ca6c43af2..bc2672f4ce94 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -41,6 +41,7 @@ #include <unotools/confignode.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/sequenceashashmap.hxx> +#include <comphelper/string.hxx> #include <tools/wldcrd.hxx> #include <tools/diagnose_ex.h> @@ -631,7 +632,7 @@ namespace sfx2 for ( const SfxFilter* pFilter = _rFilterMatcher.First(); pFilter; pFilter = _rFilterMatcher.Next() ) { sFilterName = pFilter->GetFilterName(); - sFilterWildcard = pFilter->GetWildcard().GetWildCard(); + sFilterWildcard = pFilter->GetWildcard().getGlob(); AppendWildcardToDescriptor aExtendWildcard( sFilterWildcard ); DBG_ASSERT( sFilterWildcard.Len(), "sfx2::lcl_GroupAndClassify: invalid wildcard of this filter!" ); @@ -964,7 +965,8 @@ namespace sfx2 const SfxFilter* pDefaultFilter = SfxFilterContainer::GetDefaultFilter_Impl(_rFactory); // Only use one extension (#i32434#) // (and always the first if there are more than one) - sExtension = pDefaultFilter->GetWildcard().GetWildCard().GetToken( 0, ';' ); + using comphelper::string::getToken; + sExtension = getToken(pDefaultFilter->GetWildcard().getGlob(), 0, ';'); sUIName = addExtension( pDefaultFilter->GetUIName(), sExtension, sal_False, _rFileDlgImpl ); try { @@ -988,7 +990,7 @@ namespace sfx2 // Only use one extension (#i32434#) // (and always the first if there are more than one) - sExtension = pFilter->GetWildcard().GetWildCard().GetToken( 0, ';' ); + sExtension = getToken(pFilter->GetWildcard().getGlob(), 0, ';'); sUIName = addExtension( pFilter->GetUIName(), sExtension, sal_False, _rFileDlgImpl ); try { @@ -1045,7 +1047,7 @@ namespace sfx2 { sTypeName = pFilter->GetTypeName(); sUIName = pFilter->GetUIName(); - sExtensions = pFilter->GetWildcard().GetWildCard(); + sExtensions = pFilter->GetWildcard().getGlob(); ExportFilter aExportFilter( sUIName, sExtensions ); String aExt = sExtensions; diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index 3b82bb5bec59..b8a8274740c6 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -38,6 +38,7 @@ #include <string> #include <sot/exchange.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -72,7 +73,7 @@ SfxFilter::SfxFilter( const String &rName, aMimeType( rMimeType ), aFilterName( rName ) { - String aExts = GetWildcard()(); + String aExts = GetWildcard().getGlob(); String aShort, aLong; String aRet; sal_uInt16 nMaxLength = USHRT_MAX; @@ -110,12 +111,12 @@ SfxFilter::~SfxFilter() String SfxFilter::GetDefaultExtension() const { - return GetWildcard()().GetToken( 0, ';' ); + return comphelper::string::getToken(GetWildcard().getGlob(), 0, ';'); } String SfxFilter::GetSuffixes() const { - String aRet = GetWildcard()(); + String aRet = GetWildcard().getGlob(); while( aRet.SearchAndReplaceAscii( "*.", String() ) != STRING_NOTFOUND ) ; while( aRet.SearchAndReplace( ';', ',' ) != STRING_NOTFOUND ) ; return aRet; diff --git a/svtools/source/dialogs/filedlg2.cxx b/svtools/source/dialogs/filedlg2.cxx index b8cf2d8a81bf..7323ce91e428 100644 --- a/svtools/source/dialogs/filedlg2.cxx +++ b/svtools/source/dialogs/filedlg2.cxx @@ -911,7 +911,7 @@ IMPL_LINK( ImpFileDialog, DblClickHdl, ListBox *, pBox ) aMask = WildCard( aFilterListMask, ';' ); } - pEdit->SetText( aMask() ); + pEdit->SetText( aMask.getGlob() ); UpdateEntries( sal_False ); GetFileDialog()->FilterSelect(); } @@ -947,7 +947,7 @@ IMPL_LINK( ImpFileDialog, ClickHdl, Button*, pBtn ) } // Neue Maske und neues Verzeichnis setzen, und Listboxen updaten - pEdit->SetText( aMask() ); + pEdit->SetText( aMask.getGlob() ); aFile.SetCWD( sal_True ); UpdateEntries( sal_True ); @@ -1003,7 +1003,7 @@ void ImpFileDialog::UpdateEntries( const sal_Bool bWithDirs ) // TempMask, weil Vergleich case-sensitiv sal_Bool bMatchCase = sal_False; //aCurrent.IsCaseSensitive(); - UniString aWildCard( aMask.GetWildCard() ); + UniString aWildCard( aMask.getGlob() ); if ( !bMatchCase ) aWildCard.ToLowerAscii(); WildCard aTmpMask( aWildCard, ';' ); @@ -1019,7 +1019,7 @@ void ImpFileDialog::UpdateEntries( const sal_Bool bWithDirs ) if( aName.Len() && ( ( ( aName.GetChar(0) != '.' ) || - ( ( aName.GetChar(0) == '.' ) && ( aMask.GetWildCard() ).GetChar(0) == '.' ) ) + ( ( aName.GetChar(0) == '.' ) && aMask.getGlob()[0] == '.' ) ) && rEntry.Exists() ) ) { FileStat aFileStat( rEntry ); @@ -1151,10 +1151,7 @@ void ImpFileDialog::SetPath( UniString const & rPath ) // Neue Maske und neues Verzeichnis setzen, und Listboxen updaten if( pDirList ) - { - UniString aWildCard( aMask.GetWildCard() ); - pEdit->SetText( aWildCard ); - } + pEdit->SetText( aMask.getGlob() ); else pEdit->SetText( rPath ); } @@ -1242,7 +1239,7 @@ void ImpFileDialog::PreExecute() // Neue Maske setzen if( pEdit->GetText().Len() == 0 ) - pEdit->SetText( aMask() ); + pEdit->SetText( aMask.getGlob() ); ImpPathDialog::PreExecute(); diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 3101b11f893b..9ae96955dee5 100755 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -812,7 +812,7 @@ void SwDocShell::Execute(SfxRequest& rReq) ( pFlt->GetUserData().EqualsAscii("CXML") || pFlt->GetUserData().EqualsAscii("CXMLV") ) ) { - const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard(); + const String sWild = pFlt->GetWildcard().getGlob(); xFltMgr->appendFilter( pFlt->GetUIName(), sWild ); } pFlt = aIter.Next(); @@ -825,7 +825,7 @@ void SwDocShell::Execute(SfxRequest& rReq) // make sure the default file format is also available if(bWeb) { - const String sWild = ((WildCard&)pOwnFlt->GetWildcard()).GetWildCard(); + const String sWild = pOwnFlt->GetWildcard().getGlob(); xFltMgr->appendFilter( pOwnFlt->GetUIName(), sWild ); } @@ -1244,7 +1244,7 @@ void SwDocShell::Execute(SfxRequest& rReq) if( pFlt ) { uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); - const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard(); + const String sWild = pFlt->GetWildcard().getGlob(); xFltMgr->appendFilter( pFlt->GetUIName(), sWild ); try { diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx index 1fcfbaa61035..3a15860da151 100644 --- a/sw/source/ui/dbui/mmdocselectpage.cxx +++ b/sw/source/ui/dbui/mmdocselectpage.cxx @@ -158,7 +158,7 @@ IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, PushButton*, pButton) { if( pFlt && pFlt->IsAllowedAsTemplate() ) { - const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard(); + const String sWild = pFlt->GetWildcard().getGlob(); xFltMgr->appendFilter( pFlt->GetUIName(), sWild ); // #i40125 diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 41b4dc5554c7..1c6917b1d568 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -79,6 +79,7 @@ #include <sfx2/app.hxx> #include <statstr.hrc> #include <unomid.h> +#include <comphelper/string.hxx> using namespace svt; using namespace ::com::sun::star; @@ -778,7 +779,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) String sExtension = aURL.getExtension(); if(!sExtension.Len()) { - sExtension = pSfxFlt->GetWildcard()().GetToken(1, '.'); + sExtension = comphelper::string::getToken(pSfxFlt->GetWildcard().getGlob(), 1, '.'); sPath += '.'; sPath += sExtension; } diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 75901c0df0c0..683c3bbee8b4 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -632,7 +632,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) if( pFilter->GetUserData() == sWW8 ) { xFltMgr->appendFilter( pFilter->GetUIName(), - ((WildCard&)pFilter->GetWildcard()).GetWildCard() ); + pFilter->GetWildcard().getGlob() ); xFltMgr->setCurrentFilter( pFilter->GetUIName() ) ; } diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 542c436e7202..afad29712d83 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -322,7 +322,7 @@ void SwSrcView::Execute(SfxRequest& rReq) // filter found -> use its uiname and wildcard const String& rUIName = pFilter->GetUIName(); const WildCard& rCard = pFilter->GetWildcard(); - xFltMgr->appendFilter( rUIName, rCard() ); + xFltMgr->appendFilter( rUIName, rCard.getGlob() ); xFltMgr->setCurrentFilter( rUIName ) ; } else diff --git a/tools/inc/tools/wldcrd.hxx b/tools/inc/tools/wldcrd.hxx index c1c6a33fcaa0..3be67481c623 100644 --- a/tools/inc/tools/wldcrd.hxx +++ b/tools/inc/tools/wldcrd.hxx @@ -40,18 +40,28 @@ class TOOLS_DLLPUBLIC WildCard { private: - ByteString aWildString; - char cSepSymbol; + rtl::OString aWildString; + char cSepSymbol; sal_uInt16 ImpMatch( const char *pWild, const char *pStr ) const; public: - WildCard(); - WildCard( const String& rWildCards, - const char cSeparator = '\0' ); + WildCard() + : aWildString('*') + , cSepSymbol('\0') + { + } - const String GetWildCard() const { return UniString( aWildString, osl_getThreadTextEncoding()); } - const String operator ()() const { return UniString( aWildString, osl_getThreadTextEncoding()); } + WildCard(const rtl::OUString& rWildCard, const char cSeparator = '\0') + : aWildString(rtl::OUStringToOString(rWildCard, osl_getThreadTextEncoding())) + , cSepSymbol(cSeparator) + { + } + + const rtl::OUString getGlob() const + { + return rtl::OStringToOUString(aWildString, osl_getThreadTextEncoding()); + } sal_Bool Matches( const String& rStr ) const; @@ -64,21 +74,9 @@ public: WildCard& operator =( const WildCard& rWildCard ); }; -inline WildCard::WildCard() : - aWildString( '*' ) -{ - cSepSymbol = '\0'; -} - -inline WildCard::WildCard( const String& rWildCard, const char cSeparator ) : - aWildString( rWildCard, osl_getThreadTextEncoding()) -{ - cSepSymbol = cSeparator; -} - inline WildCard& WildCard::operator=( const String& rString ) { - aWildString = ByteString(rString, osl_getThreadTextEncoding()); + aWildString = rtl::OUStringToOString(rString, osl_getThreadTextEncoding()); return *this; } diff --git a/tools/source/fsys/wldcrd.cxx b/tools/source/fsys/wldcrd.cxx index acc1ce9a2071..9071924d1316 100644 --- a/tools/source/fsys/wldcrd.cxx +++ b/tools/source/fsys/wldcrd.cxx @@ -113,7 +113,7 @@ sal_uInt16 WildCard::ImpMatch( const char *pWild, const char *pStr ) const sal_Bool WildCard::Matches( const String& rString ) const { ByteString aTmpWild = aWildString; - ByteString aString(rString, osl_getThreadTextEncoding()); + rtl::OString aString(rtl::OUStringToOString(rString, osl_getThreadTextEncoding())); sal_uInt16 nSepPos; @@ -122,14 +122,14 @@ sal_Bool WildCard::Matches( const String& rString ) const while ( (nSepPos = aTmpWild.Search( cSepSymbol )) != STRING_NOTFOUND ) { // alle getrennten WildCard's pruefen - if ( ImpMatch( aTmpWild.Copy( 0, nSepPos ).GetBuffer(), aString.GetBuffer() ) ) + if ( ImpMatch( aTmpWild.Copy( 0, nSepPos ).GetBuffer(), aString.getStr() ) ) return sal_True; aTmpWild.Erase( 0, nSepPos + 1 ); // Trennsymbol entfernen } // und noch den hinter dem letzen Trennsymbol bzw. den einzigen } - if ( ImpMatch( aTmpWild.GetBuffer(), aString.GetBuffer() ) ) + if ( ImpMatch( aTmpWild.GetBuffer(), aString.getStr() ) ) return sal_True; else return sal_False; |