diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-04-09 12:22:06 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-04-09 13:01:27 -0400 |
commit | 0ce9083428d8181a30de1d11d511382ce101c543 (patch) | |
tree | c3122eb6ca62f24c0ddb6d4b6931568899beee09 /sfx2 | |
parent | 63724f0ab38390d2483f7ceb28d4baf29171f330 (diff) |
String cleanup inside SfxFilter.
Change-Id: I647b9e4de54fdcfadcf17ac7e161b245f3dea546
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/docfilt.hxx | 64 | ||||
-rw-r--r-- | sfx2/source/bastyp/fltfnc.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/dialog/filedlghelper.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/docfilt.cxx | 60 | ||||
-rw-r--r-- | sfx2/source/doc/objcont.cxx | 2 |
5 files changed, 70 insertions, 62 deletions
diff --git a/sfx2/inc/sfx2/docfilt.hxx b/sfx2/inc/sfx2/docfilt.hxx index 18ccfc80f389..8400e5a6b16e 100644 --- a/sfx2/inc/sfx2/docfilt.hxx +++ b/sfx2/inc/sfx2/docfilt.hxx @@ -42,30 +42,32 @@ class SFX2_DLLPUBLIC SfxFilter friend class SfxFilterContainer; WildCard aWildCard; - sal_uIntPtr lFormat; - String aTypeName; - OUString aUserData; + + OUString aTypeName; + OUString aUserData; + OUString aServiceName; + OUString aMimeType; + OUString aFilterName; + OUString aPattern; + OUString aUIName; + OUString aDefaultTemplate; + SfxFilterFlags nFormatType; - sal_uInt16 nDocIcon; - OUString aServiceName; - OUString aMimeType; - String aFilterName; - String aPattern; sal_uIntPtr nVersion; - String aUIName; - String aDefaultTemplate; + sal_uIntPtr lFormat; + sal_uInt16 nDocIcon; public: - SfxFilter( const String &rName, - const String &rWildCard, - SfxFilterFlags nFormatType, - sal_uInt32 lFormat, - const String &rTypeName, - sal_uInt16 nDocIcon, - const String &rMimeType, - const String &rUserData, - const String& rServiceName ); - ~SfxFilter(); + SfxFilter( const OUString &rName, + const OUString &rWildCard, + SfxFilterFlags nFormatType, + sal_uInt32 lFormat, + const OUString &rTypeName, + sal_uInt16 nDocIcon, + const OUString &rMimeType, + const OUString &rUserData, + const OUString& rServiceName ); + ~SfxFilter(); bool IsAllowedAsTemplate() const { return nFormatType & SFX_FILTER_TEMPLATE; } bool IsOwnFormat() const { return nFormatType & SFX_FILTER_OWN; } @@ -75,26 +77,26 @@ public: bool CanExport() const { return nFormatType & SFX_FILTER_EXPORT; } bool IsInternal() const { return nFormatType & SFX_FILTER_INTERNAL; } SfxFilterFlags GetFilterFlags() const { return nFormatType; } - const String& GetFilterName() const { return aFilterName; } + const OUString& GetFilterName() const { return aFilterName; } const OUString& GetMimeType() const { return aMimeType; } - const String& GetName() const { return aFilterName; } + const OUString& GetName() const { return aFilterName; } const WildCard& GetWildcard() const { return aWildCard; } - const String& GetRealTypeName() const { return aTypeName; } + const OUString& GetRealTypeName() const { return aTypeName; } sal_uIntPtr GetFormat() const { return lFormat; } - const String& GetTypeName() const { return aTypeName; } - const String& GetUIName() const { return aUIName; } + const OUString& GetTypeName() const { return aTypeName; } + const OUString& GetUIName() const { return aUIName; } sal_uInt16 GetDocIconId() const { return nDocIcon; } const OUString& GetUserData() const { return aUserData; } - const String& GetDefaultTemplate() const { return aDefaultTemplate; } + const OUString& GetDefaultTemplate() const { return aDefaultTemplate; } void SetDefaultTemplate( const String& rStr ) { aDefaultTemplate = rStr; } - sal_Bool UsesStorage() const { return GetFormat() != 0; } - void SetURLPattern( const String& rStr ) { aPattern = rStr; aPattern.ToLowerAscii(); } - String GetURLPattern() const { return aPattern; } + bool UsesStorage() const { return GetFormat() != 0; } + void SetURLPattern( const OUString& rStr ); + OUString GetURLPattern() const { return aPattern; } void SetUIName( const String& rName ) { aUIName = rName; } void SetVersion( sal_uIntPtr nVersionP ) { nVersion = nVersionP; } sal_uIntPtr GetVersion() const { return nVersion; } - String GetSuffixes() const; - String GetDefaultExtension() const; + OUString GetSuffixes() const; + OUString GetDefaultExtension() const; const OUString& GetServiceName() const { return aServiceName; } static const SfxFilter* GetDefaultFilter( const String& rName ); diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 83181bebf346..78b3607dadba 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -809,7 +809,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4FilterName( const String& rName, Sf { const SfxFilter* pFilter = (*pFilterArr)[i]; SfxFilterFlags nFlags = pFilter->GetFilterFlags(); - if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetFilterName().CompareIgnoreCaseToAscii( aName ) == COMPARE_EQUAL ) + if ((nFlags & nMust) == nMust && !(nFlags & nDont) && pFilter->GetFilterName().equalsIgnoreAsciiCase(aName)) return pFilter; } } @@ -826,7 +826,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4FilterName( const String& rName, Sf { const SfxFilter* pFilter = (*pList)[i]; SfxFilterFlags nFlags = pFilter->GetFilterFlags(); - if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetFilterName().CompareIgnoreCaseToAscii( aName ) == COMPARE_EQUAL ) + if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetFilterName().equalsIgnoreAsciiCase(aName)) return pFilter; } diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index ee8da3dc9b8f..88fd6aa5f4f9 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1636,7 +1636,7 @@ void FileDialogHelper_Impl::getRealFilter( String& _rFilter ) const { const SfxFilter* pFilter = mpMatcher->GetFilter4UIName( _rFilter, m_nMustFlags, m_nDontFlags ); - _rFilter = pFilter ? pFilter->GetFilterName() : _rFilter.Erase(); + _rFilter = pFilter ? String(pFilter->GetFilterName()) : _rFilter.Erase(); } } diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index a6ed5aa6f84b..ce95b9b46300 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -40,67 +40,73 @@ using namespace ::com::sun::star; DBG_NAME(SfxFilter) -SfxFilter::SfxFilter( const String &rName, - const String &rWildCard, - SfxFilterFlags nType, - sal_uInt32 lFmt, - const String &rTypNm, - sal_uInt16 nIcon, - const String &rMimeType, - const String &rUsrDat, - const String &rServiceName ): +SfxFilter::SfxFilter( const OUString &rName, + const OUString &rWildCard, + SfxFilterFlags nType, + sal_uInt32 lFmt, + const OUString &rTypNm, + sal_uInt16 nIcon, + const OUString &rMimeType, + const OUString &rUsrDat, + const OUString &rServiceName ): aWildCard(rWildCard, ';'), - lFormat(lFmt), aTypeName(rTypNm), aUserData(rUsrDat), + aServiceName(rServiceName), + aMimeType(rMimeType), + aFilterName(rName), + aUIName(aFilterName), nFormatType(nType), - nDocIcon(nIcon), - aServiceName( rServiceName ), - aMimeType( rMimeType ), - aFilterName( rName ) + nVersion(SOFFICE_FILEFORMAT_50), + lFormat(lFmt), + nDocIcon(nIcon) { - String aExts = GetWildcard().getGlob(); - String aShort, aLong; - String aRet; + OUString aExts = GetWildcard().getGlob(); + OUString aShort, aLong; + OUString aRet; sal_uInt16 nMaxLength = USHRT_MAX; OUString aTest; sal_uInt16 nPos = 0; - while( ( aRet = aExts.GetToken( nPos++, ';' ) ).Len() ) + while (!(aRet = aExts.getToken(nPos++, ';')).isEmpty() ) { aTest = aRet; aTest = aTest.replaceFirst( "*." , "" ); if( aTest.getLength() <= nMaxLength ) { - if( aShort.Len() ) aShort += ';'; + if (!aShort.isEmpty()) + aShort += ";"; aShort += aRet; } else { - if( aLong.Len() ) aLong += ';'; + if (!aLong.isEmpty()) + aLong += ";"; aLong += aRet; } } - if( aShort.Len() && aLong.Len() ) + if (!aShort.isEmpty() && !aLong.isEmpty()) { - aShort += ';'; + aShort += ";"; aShort += aLong; } aWildCard.setGlob(aShort); - - nVersion = SOFFICE_FILEFORMAT_50; - aUIName = aFilterName; } SfxFilter::~SfxFilter() { } -String SfxFilter::GetDefaultExtension() const +OUString SfxFilter::GetDefaultExtension() const { return comphelper::string::getToken(GetWildcard().getGlob(), 0, ';'); } -String SfxFilter::GetSuffixes() const +void SfxFilter::SetURLPattern( const OUString& rStr ) +{ + aPattern = rStr.toAsciiLowerCase(); +} + +OUString SfxFilter::GetSuffixes() const { String aRet = GetWildcard().getGlob(); while( aRet.SearchAndReplaceAscii( "*.", String() ) != STRING_NOTFOUND ) ; diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index e6722b7f9af1..a03879c4ddbe 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -807,7 +807,7 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) sal_Bool SfxObjectShell::IsHelpDocument() const { const SfxFilter* pFilter = GetMedium()->GetFilter(); - return ( pFilter && pFilter->GetFilterName().CompareToAscii("writer_web_HTML_help") == COMPARE_EQUAL ); + return (pFilter && pFilter->GetFilterName() == "writer_web_HTML_help"); } void SfxObjectShell::ResetFromTemplate( const String& rTemplateName, const String& rFileName ) |