Kaydet (Commit) 12df4939 authored tarafından Takeshi Abe's avatar Takeshi Abe

replaced String in SfxPickList with rtl::OUString

üst 41ff6e79
...@@ -57,7 +57,7 @@ friend class SfxFilterContainer; ...@@ -57,7 +57,7 @@ friend class SfxFilterContainer;
SfxFilterFlags nFormatType; SfxFilterFlags nFormatType;
sal_uInt16 nDocIcon; sal_uInt16 nDocIcon;
String aServiceName; String aServiceName;
String aMimeType; ::rtl::OUString aMimeType;
String aFilterName; String aFilterName;
String aPattern; String aPattern;
sal_uIntPtr nVersion; sal_uIntPtr nVersion;
...@@ -85,7 +85,7 @@ public: ...@@ -85,7 +85,7 @@ public:
bool IsInternal() const { return nFormatType & SFX_FILTER_INTERNAL; } bool IsInternal() const { return nFormatType & SFX_FILTER_INTERNAL; }
SfxFilterFlags GetFilterFlags() const { return nFormatType; } SfxFilterFlags GetFilterFlags() const { return nFormatType; }
const String& GetFilterName() const { return aFilterName; } const String& GetFilterName() const { return aFilterName; }
const String& GetMimeType() const { return aMimeType; } const ::rtl::OUString& GetMimeType() const { return aMimeType; }
const String& GetName() const { return aFilterName; } const String& GetName() const { return aFilterName; }
const WildCard& GetWildcard() const { return aWildCard; } const WildCard& GetWildcard() const { return aWildCard; }
const String& GetRealTypeName() const { return aTypeName; } const String& GetRealTypeName() const { return aTypeName; }
......
...@@ -140,7 +140,7 @@ public: ...@@ -140,7 +140,7 @@ public:
sal_uInt32 GuessFilterControlDefaultUI( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED, sal_Bool bDefUI = sal_True ) const; sal_uInt32 GuessFilterControlDefaultUI( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED, sal_Bool bDefUI = sal_True ) const;
sal_uInt32 DetectFilter( SfxMedium& rMedium, const SfxFilter **, sal_Bool bPlugIn, sal_Bool bAPI = sal_False ) const; sal_uInt32 DetectFilter( SfxMedium& rMedium, const SfxFilter **, sal_Bool bPlugIn, sal_Bool bAPI = sal_False ) const;
const SfxFilter* GetFilter4Mime( const String& rMime, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED) const; const SfxFilter* GetFilter4Mime( const ::rtl::OUString& rMime, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED) const;
const SfxFilter* GetFilter4ClipBoardId( sal_uInt32 nId, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; const SfxFilter* GetFilter4ClipBoardId( sal_uInt32 nId, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
const SfxFilter* GetFilter4EA( const String& rEA, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; const SfxFilter* GetFilter4EA( const String& rEA, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
const SfxFilter* GetFilter4Extension( const String& rExt, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; const SfxFilter* GetFilter4Extension( const String& rExt, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
......
...@@ -84,30 +84,30 @@ class StringLength : public ::cppu::WeakImplHelper1< XStringWidth > ...@@ -84,30 +84,30 @@ class StringLength : public ::cppu::WeakImplHelper1< XStringWidth >
} }
}; };
void SfxPickList::CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, const String& aURLString, sal_uInt32 nNo ) void SfxPickList::CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, const ::rtl::OUString& aURLString, sal_uInt32 nNo )
{ {
String aPickEntry; ::rtl::OUStringBuffer aPickEntry;
if ( nNo < 9 ) if ( nNo < 9 )
{ {
aPickEntry += '~'; aPickEntry.append('~');
aPickEntry += String::CreateFromInt32( nNo + 1 ); aPickEntry.append(::rtl::OUString::valueOf(static_cast<sal_Int32>(nNo + 1)));
} }
else if ( nNo == 9 ) else if ( nNo == 9 )
aPickEntry += DEFINE_CONST_UNICODE("1~0"); aPickEntry.appendAscii("1~0");
else else
aPickEntry += String::CreateFromInt32( nNo + 1 ); aPickEntry.append(::rtl::OUString::valueOf(static_cast<sal_Int32>(nNo + 1)));
aPickEntry += DEFINE_CONST_UNICODE(": "); aPickEntry.appendAscii(": ");
INetURLObject aURL( aURLString ); INetURLObject aURL( aURLString );
rtl::OUString aTipHelpText; rtl::OUString aTipHelpText;
rtl::OUString aAccessibleName( aPickEntry ); rtl::OUString aAccessibleName = aPickEntry.toString();
if ( aURL.GetProtocol() == INET_PROT_FILE ) if ( aURL.GetProtocol() == INET_PROT_FILE )
{ {
// Do handle file URL differently => convert it to a system // Do handle file URL differently => convert it to a system
// path and abbreviate it with a special function: // path and abbreviate it with a special function:
String aFileSystemPath( aURL.getFSysPath( INetURLObject::FSYS_DETECT ) ); ::rtl::OUString aFileSystemPath( aURL.getFSysPath( INetURLObject::FSYS_DETECT ) );
::rtl::OUString aSystemPath( aFileSystemPath ); ::rtl::OUString aSystemPath( aFileSystemPath );
::rtl::OUString aCompactedSystemPath; ::rtl::OUString aCompactedSystemPath;
...@@ -116,28 +116,28 @@ void SfxPickList::CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, cons ...@@ -116,28 +116,28 @@ void SfxPickList::CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, cons
aAccessibleName += aSystemPath; aAccessibleName += aSystemPath;
oslFileError nError = osl_abbreviateSystemPath( aSystemPath.pData, &aCompactedSystemPath.pData, 46, NULL ); oslFileError nError = osl_abbreviateSystemPath( aSystemPath.pData, &aCompactedSystemPath.pData, 46, NULL );
if ( !nError ) if ( !nError )
aPickEntry += String( aCompactedSystemPath ); aPickEntry.append( aCompactedSystemPath );
else else
aPickEntry += aFileSystemPath; aPickEntry.append( aFileSystemPath );
if ( aPickEntry.Len() > 50 ) if ( aPickEntry.getLength() > 50 )
{ {
aPickEntry.Erase( 47 ); aPickEntry.setLength( 47 );
aPickEntry += DEFINE_CONST_UNICODE("..."); aPickEntry.appendAscii("...");
} }
} }
else else
{ {
// Use INetURLObject to abbreviate all other URLs // Use INetURLObject to abbreviate all other URLs
String aShortURL; ::rtl::OUString aShortURL;
aShortURL = aURL.getAbbreviated( m_xStringLength, 46, INetURLObject::DECODE_UNAMBIGUOUS ); aShortURL = aURL.getAbbreviated( m_xStringLength, 46, INetURLObject::DECODE_UNAMBIGUOUS );
aPickEntry += aShortURL; aPickEntry.append(aShortURL);
aTipHelpText = aURLString; aTipHelpText = aURLString;
aAccessibleName += aURLString; aAccessibleName += aURLString;
} }
// Set menu item text, tip help and accessible name // Set menu item text, tip help and accessible name
pMenu->SetItemText( nItemId, aPickEntry ); pMenu->SetItemText( nItemId, aPickEntry.toString() );
pMenu->SetTipHelpText( nItemId, aTipHelpText ); pMenu->SetTipHelpText( nItemId, aTipHelpText );
pMenu->SetAccessibleName( nItemId, aAccessibleName ); pMenu->SetAccessibleName( nItemId, aAccessibleName );
} }
...@@ -425,7 +425,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) ...@@ -425,7 +425,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint )
pDocSh->Get_Impl()->bWaitingForPicklist = sal_False; pDocSh->Get_Impl()->bWaitingForPicklist = sal_False;
if ( aURL.GetProtocol() == INET_PROT_FILE ) if ( aURL.GetProtocol() == INET_PROT_FILE )
Application::AddToRecentDocumentList( aURL.GetURLNoPass( INetURLObject::NO_DECODE ), (pFilter) ? pFilter->GetMimeType() : String() ); Application::AddToRecentDocumentList( aURL.GetURLNoPass( INetURLObject::NO_DECODE ), (pFilter) ? pFilter->GetMimeType() : ::rtl::OUString() );
} }
break; break;
} }
......
...@@ -649,7 +649,7 @@ const SfxFilter* SfxFilterMatcher::GetFilterForProps( const com::sun::star::uno: ...@@ -649,7 +649,7 @@ const SfxFilter* SfxFilterMatcher::GetFilterForProps( const com::sun::star::uno:
return 0; return 0;
} }
const SfxFilter* SfxFilterMatcher::GetFilter4Mime( const String& rMediaType,SfxFilterFlags nMust, SfxFilterFlags nDont ) const const SfxFilter* SfxFilterMatcher::GetFilter4Mime( const ::rtl::OUString& rMediaType, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
{ {
if ( m_rImpl.pList ) if ( m_rImpl.pList )
{ {
...@@ -666,7 +666,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4Mime( const String& rMediaType,SfxF ...@@ -666,7 +666,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4Mime( const String& rMediaType,SfxF
com::sun::star::uno::Sequence < com::sun::star::beans::NamedValue > aSeq(1); com::sun::star::uno::Sequence < com::sun::star::beans::NamedValue > aSeq(1);
aSeq[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")); aSeq[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType"));
aSeq[0].Value <<= ::rtl::OUString( rMediaType ); aSeq[0].Value <<= rMediaType;
return GetFilterForProps( aSeq, nMust, nDont ); return GetFilterForProps( aSeq, nMust, nDont );
} }
......
...@@ -2091,7 +2091,7 @@ void SfxObjectShell::AddToRecentlyUsedList() ...@@ -2091,7 +2091,7 @@ void SfxObjectShell::AddToRecentlyUsedList()
{ {
const SfxFilter* pOrgFilter = pMedium->GetOrigFilter(); const SfxFilter* pOrgFilter = pMedium->GetOrigFilter();
Application::AddToRecentDocumentList( aUrl.GetURLNoPass( INetURLObject::NO_DECODE ), Application::AddToRecentDocumentList( aUrl.GetURLNoPass( INetURLObject::NO_DECODE ),
(pOrgFilter) ? pOrgFilter->GetMimeType() : String() ); (pOrgFilter) ? pOrgFilter->GetMimeType() : ::rtl::OUString() );
} }
} }
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#define _SFX_PICKLIST_HXX_ #define _SFX_PICKLIST_HXX_
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <tools/string.hxx>
#include <vcl/menu.hxx> #include <vcl/menu.hxx>
#include <svl/lstner.hxx> #include <svl/lstner.hxx>
#include <com/sun/star/util/XStringWidth.hpp> #include <com/sun/star/util/XStringWidth.hpp>
...@@ -43,13 +42,13 @@ class SfxPickList : public SfxListener ...@@ -43,13 +42,13 @@ class SfxPickList : public SfxListener
{ {
struct PickListEntry struct PickListEntry
{ {
PickListEntry( const String& _aName, const String& _aFilter, const String& _aTitle ) : PickListEntry( const ::rtl::OUString& _aName, const ::rtl::OUString& _aFilter, const ::rtl::OUString& _aTitle ) :
aName( _aName ), aFilter( _aFilter ), aTitle( _aTitle ) {} aName( _aName ), aFilter( _aFilter ), aTitle( _aTitle ) {}
String aName; ::rtl::OUString aName;
String aFilter; ::rtl::OUString aFilter;
String aTitle; ::rtl::OUString aTitle;
String aOptions; ::rtl::OUString aOptions;
}; };
std::vector< PickListEntry* > m_aPicklistVector; std::vector< PickListEntry* > m_aPicklistVector;
...@@ -59,7 +58,7 @@ class SfxPickList : public SfxListener ...@@ -59,7 +58,7 @@ class SfxPickList : public SfxListener
SfxPickList( sal_uInt32 nMenuSize ); SfxPickList( sal_uInt32 nMenuSize );
~SfxPickList(); ~SfxPickList();
void CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, const String& aURL, sal_uInt32 nNo ); void CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, const ::rtl::OUString& aURL, sal_uInt32 nNo );
PickListEntry* GetPickListEntry( sal_uInt32 nIndex ); PickListEntry* GetPickListEntry( sal_uInt32 nIndex );
void CreatePickListEntries(); void CreatePickListEntries();
void RemovePickListEntries(); void RemovePickListEntries();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment