[Libreoffice-commits] core.git: 2 commits - sfx2/source vcl/source

Caolán McNamara caolanm at redhat.com
Fri Feb 24 10:20:00 UTC 2017


 sfx2/source/view/lokhelper.cxx    |   22 +++++++++++++++++-----
 vcl/source/outdev/outdevstate.cxx |    1 -
 2 files changed, 17 insertions(+), 6 deletions(-)

New commits:
commit 91242645788f4a5806dfc2a8cf4918acda9ca9a6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 24 10:03:02 2017 +0000

    coverity#1399161 the explicit Font::SetLanguage is unnecessary here
    
    the new language is set from the font this is a copy of, and has
    already been copied in the copy ctor
    
    Change-Id: I7c0f1bab56aefc7b4e7e66660a16596fcfa48c2d

diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index cf2ef0d..2681744 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -466,7 +466,6 @@ void OutputDevice::SetFont( const vcl::Font& rNewFont )
 {
 
     vcl::Font aFont( rNewFont );
-    aFont.SetLanguage(rNewFont.GetLanguage());
     if ( mnDrawMode & (DrawModeFlags::BlackText | DrawModeFlags::WhiteText | DrawModeFlags::GrayText | DrawModeFlags::GhostedText | DrawModeFlags::SettingsText |
                        DrawModeFlags::BlackFill | DrawModeFlags::WhiteFill | DrawModeFlags::GrayFill | DrawModeFlags::NoFill |
                        DrawModeFlags::GhostedFill | DrawModeFlags::SettingsFill ) )
commit 30847af56329975a8b6afc5c59991aae8f868d2e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 24 09:36:00 2017 +0000

    don't have to create SfxApplication if it doesn't already exist
    
    Change-Id: I3ade4e2c2513f334217a85c676ada93c5ed683ff

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 43e0c1f..73e29f3 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -37,8 +37,12 @@ int SfxLokHelper::createView()
 
 void SfxLokHelper::destroyView(int nId)
 {
+    SfxApplication* pApp = SfxApplication::Get();
+    if (!pApp)
+        return;
+
     unsigned nViewShellId = nId;
-    SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
+    SfxViewShellArr_Impl& rViewArr = pApp->GetViewShells_Impl();
 
     for (SfxViewShell* pViewShell : rViewArr)
     {
@@ -54,8 +58,12 @@ void SfxLokHelper::destroyView(int nId)
 
 void SfxLokHelper::setView(int nId)
 {
+    SfxApplication* pApp = SfxApplication::Get();
+    if (!pApp)
+        return;
+
     unsigned nViewShellId = nId;
-    SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
+    SfxViewShellArr_Impl& rViewArr = pApp->GetViewShells_Impl();
 
     for (SfxViewShell* pViewShell : rViewArr)
     {
@@ -90,13 +98,17 @@ int SfxLokHelper::getView(SfxViewShell* pViewShell)
 
 std::size_t SfxLokHelper::getViewsCount()
 {
-    SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
-    return rViewArr.size();
+    SfxApplication* pApp = SfxApplication::Get();
+    return !pApp ? 0 : pApp->GetViewShells_Impl().size();
 }
 
 bool SfxLokHelper::getViewIds(int* pArray, size_t nSize)
 {
-    SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
+    SfxApplication* pApp = SfxApplication::Get();
+    if (!pApp)
+        return false;
+
+    SfxViewShellArr_Impl& rViewArr = pApp->GetViewShells_Impl();
     if (rViewArr.size() > nSize)
         return false;
 


More information about the Libreoffice-commits mailing list