[Libreoffice-commits] .: 2 commits - sfx2/inc sfx2/source

Takeshi Abe tabe at kemper.freedesktop.org
Mon Nov 14 15:34:33 PST 2011


 sfx2/inc/sfx2/docfilt.hxx        |    4 ++--
 sfx2/inc/sfx2/fcontnr.hxx        |    2 +-
 sfx2/source/appl/appinit.cxx     |    7 -------
 sfx2/source/appl/appmain.cxx     |   19 -------------------
 sfx2/source/appl/sfxpicklist.cxx |   36 ++++++++++++++++++------------------
 sfx2/source/bastyp/fltfnc.cxx    |    4 ++--
 sfx2/source/doc/objstor.cxx      |    2 +-
 sfx2/source/inc/sfxpicklist.hxx  |   13 ++++++-------
 8 files changed, 30 insertions(+), 57 deletions(-)

New commits:
commit 12df49396e6bcb07bafc95255a8526caac96e60a
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Mon Nov 14 18:32:07 2011 +0900

    replaced String in SfxPickList with rtl::OUString

diff --git a/sfx2/inc/sfx2/docfilt.hxx b/sfx2/inc/sfx2/docfilt.hxx
index a951239..1da1dea 100644
--- a/sfx2/inc/sfx2/docfilt.hxx
+++ b/sfx2/inc/sfx2/docfilt.hxx
@@ -57,7 +57,7 @@ friend class SfxFilterContainer;
     SfxFilterFlags  nFormatType;
     sal_uInt16          nDocIcon;
     String          aServiceName;
-    String          aMimeType;
+    ::rtl::OUString aMimeType;
     String          aFilterName;
     String          aPattern;
     sal_uIntPtr           nVersion;
@@ -85,7 +85,7 @@ public:
     bool IsInternal() const { return nFormatType & SFX_FILTER_INTERNAL; }
     SfxFilterFlags  GetFilterFlags() const  { return nFormatType; }
     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 WildCard& GetWildcard() const { return aWildCard; }
     const String&   GetRealTypeName() const { return aTypeName; }
diff --git a/sfx2/inc/sfx2/fcontnr.hxx b/sfx2/inc/sfx2/fcontnr.hxx
index a6187a6..f6c1d01 100644
--- a/sfx2/inc/sfx2/fcontnr.hxx
+++ b/sfx2/inc/sfx2/fcontnr.hxx
@@ -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               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*    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;
diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx
index c3332d9..d80a80c 100644
--- a/sfx2/source/appl/sfxpicklist.cxx
+++ b/sfx2/source/appl/sfxpicklist.cxx
@@ -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 )
     {
-        aPickEntry += '~';
-        aPickEntry += String::CreateFromInt32( nNo + 1 );
+        aPickEntry.append('~');
+        aPickEntry.append(::rtl::OUString::valueOf(static_cast<sal_Int32>(nNo + 1)));
     }
     else if ( nNo == 9 )
-        aPickEntry += DEFINE_CONST_UNICODE("1~0");
+        aPickEntry.appendAscii("1~0");
     else
-        aPickEntry += String::CreateFromInt32( nNo + 1 );
-    aPickEntry += DEFINE_CONST_UNICODE(": ");
+        aPickEntry.append(::rtl::OUString::valueOf(static_cast<sal_Int32>(nNo + 1)));
+    aPickEntry.appendAscii(": ");
 
     INetURLObject   aURL( aURLString );
     rtl::OUString   aTipHelpText;
-    rtl::OUString   aAccessibleName( aPickEntry );
+    rtl::OUString   aAccessibleName = aPickEntry.toString();
 
     if ( aURL.GetProtocol() == INET_PROT_FILE )
     {
         // Do handle file URL differently => convert it to a system
         // 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 aCompactedSystemPath;
@@ -116,28 +116,28 @@ void SfxPickList::CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, cons
         aAccessibleName += aSystemPath;
         oslFileError nError = osl_abbreviateSystemPath( aSystemPath.pData, &aCompactedSystemPath.pData, 46, NULL );
         if ( !nError )
-            aPickEntry += String( aCompactedSystemPath );
+            aPickEntry.append( aCompactedSystemPath );
         else
-            aPickEntry += aFileSystemPath;
+            aPickEntry.append( aFileSystemPath );
 
-        if ( aPickEntry.Len() > 50 )
+        if ( aPickEntry.getLength() > 50 )
         {
-            aPickEntry.Erase( 47 );
-            aPickEntry += DEFINE_CONST_UNICODE("...");
+            aPickEntry.setLength( 47 );
+            aPickEntry.appendAscii("...");
         }
     }
     else
     {
         // Use INetURLObject to abbreviate all other URLs
-        String  aShortURL;
+        ::rtl::OUString aShortURL;
         aShortURL = aURL.getAbbreviated( m_xStringLength, 46, INetURLObject::DECODE_UNAMBIGUOUS );
-        aPickEntry += aShortURL;
+        aPickEntry.append(aShortURL);
         aTipHelpText = aURLString;
         aAccessibleName += aURLString;
     }
 
     // Set menu item text, tip help and accessible name
-    pMenu->SetItemText( nItemId, aPickEntry );
+    pMenu->SetItemText( nItemId, aPickEntry.toString() );
     pMenu->SetTipHelpText( nItemId, aTipHelpText );
     pMenu->SetAccessibleName( nItemId, aAccessibleName );
 }
@@ -425,7 +425,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint )
                 pDocSh->Get_Impl()->bWaitingForPicklist = sal_False;
 
                 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;
         }
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 2d34778..36c4b13 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -649,7 +649,7 @@ const SfxFilter* SfxFilterMatcher::GetFilterForProps( const com::sun::star::uno:
     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 )
     {
@@ -666,7 +666,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4Mime( const String& rMediaType,SfxF
 
     com::sun::star::uno::Sequence < com::sun::star::beans::NamedValue > aSeq(1);
     aSeq[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType"));
-    aSeq[0].Value <<= ::rtl::OUString( rMediaType );
+    aSeq[0].Value <<= rMediaType;
     return GetFilterForProps( aSeq, nMust, nDont );
 }
 
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 49f4b21..abbb343 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2091,7 +2091,7 @@ void SfxObjectShell::AddToRecentlyUsedList()
     {
         const SfxFilter* pOrgFilter = pMedium->GetOrigFilter();
         Application::AddToRecentDocumentList( aUrl.GetURLNoPass( INetURLObject::NO_DECODE ),
-                                              (pOrgFilter) ? pOrgFilter->GetMimeType() : String() );
+                                              (pOrgFilter) ? pOrgFilter->GetMimeType() : ::rtl::OUString() );
     }
 }
 
diff --git a/sfx2/source/inc/sfxpicklist.hxx b/sfx2/source/inc/sfxpicklist.hxx
index 80a7f87..987e78a 100644
--- a/sfx2/source/inc/sfxpicklist.hxx
+++ b/sfx2/source/inc/sfxpicklist.hxx
@@ -30,7 +30,6 @@
 #define _SFX_PICKLIST_HXX_
 
 #include <osl/mutex.hxx>
-#include <tools/string.hxx>
 #include <vcl/menu.hxx>
 #include <svl/lstner.hxx>
 #include <com/sun/star/util/XStringWidth.hpp>
@@ -43,13 +42,13 @@ class SfxPickList : public SfxListener
 {
     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 ) {}
 
-        String      aName;
-        String      aFilter;
-        String      aTitle;
-        String      aOptions;
+        ::rtl::OUString aName;
+        ::rtl::OUString aFilter;
+        ::rtl::OUString aTitle;
+        ::rtl::OUString aOptions;
     };
 
     std::vector< PickListEntry* >   m_aPicklistVector;
@@ -59,7 +58,7 @@ class SfxPickList : public SfxListener
                             SfxPickList( sal_uInt32 nMenuSize );
                             ~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 );
     void                    CreatePickListEntries();
     void                    RemovePickListEntries();
commit 41ff6e79cead74ebe1a766020a07dce9125dd4ff
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Mon Nov 14 11:20:09 2011 +0900

    removed unused code

diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 6c5f7d5..5d97a99 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -81,10 +81,6 @@
 #include "sfxpicklist.hxx"
 #include <tools/svlibrary.hxx>
 
-#ifdef UNX
-#define stricmp(a,b) strcmp(a,b)
-#endif
-
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::frame;
 using namespace ::com::sun::star::lang;
@@ -184,9 +180,6 @@ Sequence< ::rtl::OUString > SAL_CALL SfxTerminateListener_Impl::getSupportedServ
 
 //====================================================================
 
-#define DOSTRING( x )                       #x
-#define STRING( x )                         DOSTRING( x )
-
 typedef bool ( *PFunc_getSpecialCharsForEdit)( Window* i_pParent, const Font& i_rFont, String& o_rOutString );
 
 //====================================================================
diff --git a/sfx2/source/appl/appmain.cxx b/sfx2/source/appl/appmain.cxx
index c249a3a..7c0b6fc 100644
--- a/sfx2/source/appl/appmain.cxx
+++ b/sfx2/source/appl/appmain.cxx
@@ -61,13 +61,6 @@
 #include <sfx2/docfile.hxx>
 #include "workwin.hxx"
 
-#ifdef UNX
-#define stricmp(a,b) strcmp(a,b)
-#endif
-
-
-//===================================================================
-
 DBG_NAME(SfxAppMainNewMenu)
 DBG_NAME(SfxAppMainBmkMenu)
 DBG_NAME(SfxAppMainWizMenu)
@@ -76,18 +69,6 @@ DBG_NAME(SfxAppMainCHAOSReg)
 
 //===================================================================
 
-#define SFX_TEMPNAMEBASE_DIR    "soffice.tmp"
-#define SFX_KEY_TEMPNAMEBASE    "Temp-Dir"
-
-//===================================================================
-
-static SfxItemInfo const aItemInfos[] =
-{
-    { 0, 0 }
-};
-
-//===================================================================
-
 TYPEINIT2(SfxApplication,SfxShell,SfxBroadcaster);
 
 //--------------------------------------------------------------------


More information about the Libreoffice-commits mailing list