[Libreoffice-commits] core.git: 2 commits - framework/source vcl/inc vcl/win

Fridrich Å trba fridrich.strba at bluewin.ch
Sun Jul 28 16:36:08 PDT 2013


 framework/source/helper/titlebarupdate.cxx |   20 ++++-----
 vcl/inc/win/saldata.hxx                    |    1 
 vcl/win/source/app/salinst.cxx             |   64 ++++++++++++++++++++++++++++-
 vcl/win/source/window/salframe.cxx         |    3 -
 4 files changed, 75 insertions(+), 13 deletions(-)

New commits:
commit d798d26bc4b7572ed10d6baf5aef7382269d7da5
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Mon Jul 29 01:35:35 2013 +0200

    Remove some occurrences of RTL_CONSTASCII_STRINGPARAM and equalsAsciiL
    
    Change-Id: I7acc31f819be6552344073fa032085d01622fca3

diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx
index c62d48b..c85c4b6 100644
--- a/framework/source/helper/titlebarupdate.cxx
+++ b/framework/source/helper/titlebarupdate.cxx
@@ -155,10 +155,10 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr
         OUString aModuleId = xModuleManager->identify(xFrame);
         OUString sDesktopName;
 #if !defined(MACOSX)
-        if ( aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument")) ||
-             aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.GlobalDocument")) ||
-             aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.WebDocument")) ||
-             aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.xforms.XMLFormDocument")) )
+        if ( aModuleId == "com.sun.star.text.TextDocument" ||
+             aModuleId == "com.sun.star.text.GlobalDocument" ||
+             aModuleId == "com.sun.star.text.WebDocument" ||
+             aModuleId == "com.sun.star.xforms.XMLFormDocument" )
             sDesktopName = OUString("Writer");
         else if ( aModuleId == "com.sun.star.sheet.SpreadsheetDocument" )
             sDesktopName = OUString("Calc");
@@ -168,12 +168,12 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr
             sDesktopName = OUString("Draw");
         else if ( aModuleId == "com.sun.star.formula.FormulaProperties" )
             sDesktopName = OUString("Math");
-        else if ( aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sdb.DatabaseDocument")) ||
-                  aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sdb.OfficeDatabaseDocument")) ||
-                  aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sdb.RelationDesign")) ||
-                  aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sdb.QueryDesign")) ||
-                  aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sdb.TableDesign")) ||
-                  aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sdb.DataSourceBrowser")) )
+        else if ( aModuleId == "com.sun.star.sdb.DatabaseDocument" ||
+                  aModuleId == "com.sun.star.sdb.OfficeDatabaseDocument" ||
+                  aModuleId == "com.sun.star.sdb.RelationDesign" ||
+                  aModuleId == "com.sun.star.sdb.QueryDesign" ||
+                  aModuleId == "com.sun.star.sdb.TableDesign" ||
+                  aModuleId == "com.sun.star.sdb.DataSourceBrowser" )
             sDesktopName = OUString("Base");
         else
             sDesktopName = OUString("Startcenter");
commit e62fec4075e55fd62a3f0d25b230498e5705dd26
Author: Jesús Corrius <jcorrius at gmail.com>
Date:   Mon Jul 29 01:26:24 2013 +0200

    Use the Win7 semantics of SHAddToRecentDocs when possible
    
    Change-Id: I7cf0dfaec408800f3c682b3ef56799818b805881

diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index fdf2faf..ea60b69 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -136,6 +136,7 @@ struct SalShlData
     UINT                    mnWheelScrollChars;     // WheelScrollChars
     UINT                    mnWheelMsgId;           // Wheel-Message-Id fuer W95
     BOOL                    mbWXP;                  // Windows XP
+    BOOL                    mbW7;                   // Windows 7
     OSVERSIONINFO           maVersionInfo;
 };
 
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index da0ad46..4401bb7 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -493,6 +493,7 @@ SalInstance* CreateSalInstance()
 
     // determine the windows version
     aSalShlData.mbWXP        = 0;
+    aSalShlData.mbW7         = 0;
     memset( &aSalShlData.maVersionInfo, 0, sizeof(aSalShlData.maVersionInfo) );
     aSalShlData.maVersionInfo.dwOSVersionInfoSize = sizeof( aSalShlData.maVersionInfo );
     if ( GetVersionEx( &aSalShlData.maVersionInfo ) )
@@ -501,6 +502,10 @@ SalInstance* CreateSalInstance()
         if ( aSalShlData.maVersionInfo.dwMajorVersion > 5 ||
            ( aSalShlData.maVersionInfo.dwMajorVersion == 5 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) )
             aSalShlData.mbWXP = 1;
+    // Windows 7 ?
+    if ( aSalShlData.maVersionInfo.dwMajorVersion > 6 ||
+       ( aSalShlData.maVersionInfo.dwMajorVersion == 6 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) )
+        aSalShlData.mbW7 = 1;
     }
 
     pSalData->mnAppThreadId = GetCurrentThreadId();
@@ -1030,7 +1035,7 @@ void* WinSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturn
       @param aFileUrl
                 The file url of the document.
 */
-void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUString& /*rMimeType*/, const OUString& /* rDocumentService */)
+void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUString& /*rMimeType*/, const OUString& rDocumentService)
 {
     OUString system_path;
     osl::FileBase::RC rc = osl::FileBase::getSystemPathFromFileURL(rFileUrl, system_path);
@@ -1038,7 +1043,64 @@ void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUS
     OSL_ENSURE(osl::FileBase::E_None == rc, "Invalid file url");
 
     if (osl::FileBase::E_None == rc)
+    {
+        if ( aSalShlData.mbW7 )
+        {
+            typedef HRESULT ( WINAPI *SHCREATEITEMFROMPARSINGNAME )( PCWSTR, IBindCtx*, REFIID, void **ppv );
+            SHCREATEITEMFROMPARSINGNAME pSHCreateItemFromParsingName =
+                                        ( SHCREATEITEMFROMPARSINGNAME )GetProcAddress(
+                                        GetModuleHandleW (L"shell32.dll"), "SHCreateItemFromParsingName" );
+
+            if( pSHCreateItemFromParsingName )
+            {
+                IShellItem* pShellItem = NULL;
+
+                HRESULT hr = pSHCreateItemFromParsingName ( system_path.getStr(), NULL, IID_PPV_ARGS(&pShellItem) );
+
+                if ( SUCCEEDED(hr) && pShellItem )
+                {
+                    OUString sApplicationName;
+
+                    if ( rDocumentService == "com.sun.star.text.TextDocument" ||
+                         rDocumentService == "com.sun.star.text.GlobalDocument" ||
+                         rDocumentService == "com.sun.star.text.WebDocument" ||
+                         rDocumentService == "com.sun.star.xforms.XMLFormDocument" )
+                        sApplicationName = "Writer";
+                    else if ( rDocumentService == "com.sun.star.sheet.SpreadsheetDocument" ||
+                         rDocumentService == "com.sun.star.chart2.ChartDocument" )
+                        sApplicationName = "Calc";
+                    else if ( rDocumentService == "com.sun.star.presentation.PresentationDocument" )
+                        sApplicationName = "Impress";
+                    else if ( rDocumentService == "com.sun.star.drawing.DrawingDocument" )
+                        sApplicationName = "Draw";
+                    else if ( rDocumentService == "com.sun.star.formula.FormulaProperties" )
+                        sApplicationName = "Math";
+                    else if ( rDocumentService == "com.sun.star.sdb.DatabaseDocument" ||
+                         rDocumentService == "com.sun.star.sdb.OfficeDatabaseDocument" ||
+                         rDocumentService == "com.sun.star.sdb.RelationDesign" ||
+                         rDocumentService == "com.sun.star.sdb.QueryDesign" ||
+                         rDocumentService == "com.sun.star.sdb.TableDesign" ||
+                         rDocumentService == "com.sun.star.sdb.DataSourceBrowser" )
+                        sApplicationName = "Base";
+
+                    if ( !sApplicationName.isEmpty() )
+                    {
+                        OUString sApplicationID("TheDocumentFoundation.LibreOffice.");
+                        sApplicationID += sApplicationName;
+
+                        SHARDAPPIDINFO info;
+                        info.psi = pShellItem;
+                        info.pszAppID = sApplicationID.getStr();
+
+                        SHAddToRecentDocs ( SHARD_APPIDINFO, &info );
+                        return;
+                    }
+                }
+            }
+        }
+        // For whatever reason, we could not use the SHARD_APPIDNFO semantics
         SHAddToRecentDocs(SHARD_PATHW, system_path.getStr());
+    }
 }
 
 // -----------------------------------------------------------------------
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 63454c2..91a34a9 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -1905,7 +1905,7 @@ void WinSalFrame::SetScreenNumber( unsigned int nNewScreen )
 
 void WinSalFrame::SetApplicationID( const OUString &rApplicationID )
 {
-    if( aSalShlData.maVersionInfo.dwMajorVersion >= 6 )
+    if ( aSalShlData.mbW7 )
     {
         // http://msdn.microsoft.com/en-us/library/windows/desktop/dd378430(v=vs.85).aspx
         // A window's properties must be removed before the window is closed.
@@ -1915,7 +1915,6 @@ void WinSalFrame::SetApplicationID( const OUString &rApplicationID )
         pSHGetPropertyStoreForWindow = ( SHGETPROPERTYSTOREFORWINDOW )GetProcAddress(
                                        GetModuleHandleW (L"shell32.dll"), "SHGetPropertyStoreForWindow" );
 
-        // A mere presence of the symbol means we are at least on Windows 7 or Windows Server 2008 R2
         if( pSHGetPropertyStoreForWindow )
         {
             IPropertyStore *pps;


More information about the Libreoffice-commits mailing list