[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - basic/source vcl/aqua vcl/headless vcl/inc vcl/Library_vcl.mk vcl/Package_inc.mk vcl/source vcl/unx vcl/win

Thomas Arnhold thomas at arnhold.org
Thu Apr 4 01:36:26 PDT 2013


 basic/source/runtime/methods.cxx    |    2 +
 vcl/Library_vcl.mk                  |    1 
 vcl/Package_inc.mk                  |    1 
 vcl/aqua/source/window/salframe.cxx |    7 ++++++
 vcl/headless/svpframe.cxx           |    4 +++
 vcl/inc/aqua/salframe.h             |    1 
 vcl/inc/headless/svpframe.hxx       |    7 +++---
 vcl/inc/salframe.hxx                |    2 +
 vcl/inc/unx/gtk/gtkframe.hxx        |    2 +
 vcl/inc/unx/saldisp.hxx             |    2 +
 vcl/inc/unx/salframe.h              |    1 
 vcl/inc/vcl/sound.hxx               |   39 +++++++++++++++++++++++++++++++++++
 vcl/inc/win/salframe.h              |    1 
 vcl/source/app/sound.cxx            |   40 ++++++++++++++++++++++++++++++++++++
 vcl/unx/generic/app/saldisp.cxx     |    6 +++++
 vcl/unx/generic/window/salframe.cxx |    6 +++++
 vcl/unx/gtk/window/gtkframe.cxx     |    5 ++++
 vcl/win/source/window/salframe.cxx  |    8 +++++++
 18 files changed, 132 insertions(+), 3 deletions(-)

New commits:
commit b2ace6a294e2ce2171e3911a6f8a2ed7d8de4812
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Sat Mar 30 14:55:24 2013 +0100

    fdo#58807 bring Beep() for basic back
    
    The functionality was removed by fdo#48549.
    
    This partially reverts
    
    0f6101cfef4c2e45d9f1f1b3a61ef94799e4526b
    0bdf6fc7c71c4c49e6d6f83d56ac953272ad16d5
    85cb9084533605657aca0394afe4516058a8e4ef
    
    I changed the behavior to always beep, because only the basic macro
    function is using Beep(). Looks like the Beep macro function didn't
    even work correctly before the removal, because the default was to
    not beep for most platforms. So I set the volume from disable (0)
    to 50% for XBell().
    
    Reviewed-on: https://gerrit.libreoffice.org/3124
    Reviewed-by: Thorsten Behrens <tbehrens at suse.com>
    Tested-by: Thorsten Behrens <tbehrens at suse.com>
    (cherry picked from commit 47664d3f2e12649d324b031ca6ffd5589fe3d197)
    
    Conflicts:
    	vcl/inc/headless/svpframe.hxx
    
    Change-Id: I663ffb7af75d2fd6d2c1f94073e4412d9744de4a
    Reviewed-on: https://gerrit.libreoffice.org/3185
    Tested-by: Thomas Arnhold <thomas at arnhold.org>
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index e09f447..858f844 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -22,6 +22,7 @@
 #include <osl/process.h>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/sound.hxx>
 #include <tools/wintypes.hxx>
 #include <vcl/msgbox.hxx>
 #include <basic/sbx.hxx>
@@ -4215,6 +4216,7 @@ RTLFUNC(Beep)
         StarBASIC::Error( SbERR_BAD_ARGUMENT );
         return;
     }
+    Sound::Beep();
 }
 
 RTLFUNC(Load)
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index a05e39b..8f12d2c 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -117,6 +117,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/app/session \
     vcl/source/app/settings \
     vcl/source/app/solarmutex \
+    vcl/source/app/sound \
     vcl/source/app/stdtext \
     vcl/source/app/svapp \
     vcl/source/app/svdata \
diff --git a/vcl/Package_inc.mk b/vcl/Package_inc.mk
index 53a7326..48d996d 100644
--- a/vcl/Package_inc.mk
+++ b/vcl/Package_inc.mk
@@ -126,6 +126,7 @@ $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/seleng.hxx,vcl/seleng.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/settings.hxx,vcl/settings.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/slider.hxx,vcl/slider.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/solarmutex.hxx,vcl/solarmutex.hxx))
+$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/sound.hxx,vcl/sound.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/spinfld.hxx,vcl/spinfld.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/spin.h,vcl/spin.h))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/spin.hxx,vcl/spin.hxx))
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index d2e616c..12cbb91 100644
--- a/vcl/aqua/source/window/salframe.cxx
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -1339,6 +1339,13 @@ const SystemEnvData* AquaSalFrame::GetSystemData() const
 
 // -----------------------------------------------------------------------
 
+void AquaSalFrame::Beep()
+{
+    NSBeep();
+}
+
+// -----------------------------------------------------------------------
+
 void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags)
 {
     if ( !mpWindow )
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index 0d4e466..5827d51 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -419,6 +419,10 @@ void SvpSalFrame::UpdateSettings( AllSettings& )
 {
 }
 
+void SvpSalFrame::Beep()
+{
+}
+
 const SystemEnvData* SvpSalFrame::GetSystemData() const
 {
     return &m_aSystemChildData;
diff --git a/vcl/inc/aqua/salframe.h b/vcl/inc/aqua/salframe.h
index e6dcde3..39d9496 100644
--- a/vcl/inc/aqua/salframe.h
+++ b/vcl/inc/aqua/salframe.h
@@ -138,6 +138,7 @@ public:
     virtual sal_Bool                MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode );
     virtual LanguageType        GetInputLanguage();
     virtual void                UpdateSettings( AllSettings& rSettings );
+    virtual void                Beep();
     virtual const SystemEnvData*    GetSystemData() const;
     virtual SalPointerState     GetPointerState();
     virtual SalIndicatorState   GetIndicatorState();
diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx
index c48d602..887e182 100644
--- a/vcl/inc/headless/svpframe.hxx
+++ b/vcl/inc/headless/svpframe.hxx
@@ -102,11 +102,12 @@ public:
     virtual void                Sync();
     virtual void                SetInputContext( SalInputContext* pContext );
     virtual void                EndExtTextInput( sal_uInt16 nFlags );
-    virtual rtl::OUString              GetKeyName( sal_uInt16 nKeyCode );
-    virtual sal_Bool                MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode );
+    virtual rtl::OUString       GetKeyName( sal_uInt16 nKeyCode );
+    virtual sal_Bool            MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode );
     virtual LanguageType        GetInputLanguage();
     virtual void                UpdateSettings( AllSettings& rSettings );
-    virtual const SystemEnvData*    GetSystemData() const;
+    virtual void                Beep();
+    virtual const SystemEnvData* GetSystemData() const;
     virtual SalPointerState     GetPointerState();
     virtual SalIndicatorState   GetIndicatorState();
     virtual void                SimulateKeyPress( sal_uInt16 nKeyCode );
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index 63096e0..afc8420 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -205,6 +205,8 @@ public:
 
     virtual void                UpdateSettings( AllSettings& rSettings ) = 0;
 
+    virtual void                Beep() = 0;
+
     // returns system data (most prominent: window handle)
     virtual const SystemEnvData*    GetSystemData() const = 0;
 
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index a33a558..45bee2d 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -402,6 +402,8 @@ public:
 
     virtual void                UpdateSettings( AllSettings& rSettings );
 
+    virtual void                Beep();
+
     // returns system data (most prominent: window handle)
     virtual const SystemEnvData*    GetSystemData() const;
 
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index d5e6240..711c735 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -316,6 +316,8 @@ public:
     void            DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) const;
 #endif
 
+    void            Beep() const;
+
     void            ModifierMapping();
     void            SimulateKeyPress( sal_uInt16 nKeyCode );
     sal_uInt16          GetIndicatorState() const;
diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
index c6a8cc3..75a37c1 100644
--- a/vcl/inc/unx/salframe.h
+++ b/vcl/inc/unx/salframe.h
@@ -241,6 +241,7 @@ public:
     virtual sal_Bool                MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode );
     virtual LanguageType        GetInputLanguage();
     virtual void                UpdateSettings( AllSettings& rSettings );
+    virtual void                Beep();
     virtual const SystemEnvData*    GetSystemData() const;
     virtual SalPointerState     GetPointerState();
     virtual SalIndicatorState   GetIndicatorState();
diff --git a/vcl/inc/vcl/sound.hxx b/vcl/inc/vcl/sound.hxx
new file mode 100644
index 0000000..7be53a0
--- /dev/null
+++ b/vcl/inc/vcl/sound.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SV_SOUND_HXX
+#define _SV_SOUND_HXX
+
+#include <vcl/dllapi.h>
+
+class Window;
+
+// ---------
+// - Sound -
+// ---------
+
+class VCL_DLLPUBLIC Sound
+{
+public:
+    static void         Beep( Window* pWindow = NULL );
+};
+
+#endif // _SV_SOUND_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h
index 54e10bd..2a62219 100644
--- a/vcl/inc/win/salframe.h
+++ b/vcl/inc/win/salframe.h
@@ -121,6 +121,7 @@ public:
     virtual sal_Bool                MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode );
     virtual LanguageType        GetInputLanguage();
     virtual void                UpdateSettings( AllSettings& rSettings );
+    virtual void                Beep();
     virtual const SystemEnvData*    GetSystemData() const;
     virtual SalPointerState     GetPointerState();
     virtual SalIndicatorState   GetIndicatorState();
diff --git a/vcl/source/app/sound.cxx b/vcl/source/app/sound.cxx
new file mode 100644
index 0000000..308f37f
--- /dev/null
+++ b/vcl/source/app/sound.cxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/sound.hxx>
+
+#include <salframe.hxx>
+#include <svdata.hxx>
+
+void Sound::Beep( Window* pWindow )
+{
+    // #i91990#
+    if ( Application::IsHeadlessModeEnabled() )
+        return;
+
+    if ( !pWindow )
+        pWindow = ImplGetDefaultWindow();
+
+    pWindow->ImplGetFrame()->Beep();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 725bd19..c6719da 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -664,6 +664,12 @@ void SalX11Display::SetupInput( SalI18N_InputMethod *pInputMethod )
     SetKbdExtension( pKbdExtension );
 }
 
+// Sound
+void SalDisplay::Beep() const
+{
+    XBell( pDisp_, 100 );
+}
+
 // Keyboard
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 67ce56e..455c57a 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -2586,6 +2586,12 @@ bool X11SalFrame::SetPluginParent( SystemParentData* pNewParent )
     return true;
 }
 
+// Sound
+void X11SalFrame::Beep()
+{
+    GetDisplay()->Beep();
+}
+
 // Event Handling
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 static sal_uInt16 sal_GetCode( int state )
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 398ece4..03f8c59 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -2673,6 +2673,11 @@ void GtkSalFrame::UpdateSettings( AllSettings& rSettings )
         ReleaseGraphics( pGraphics );
 }
 
+void GtkSalFrame::Beep()
+{
+    gdk_display_beep( getGdkDisplay() );
+}
+
 const SystemEnvData* GtkSalFrame::GetSystemData() const
 {
     return &m_aSystemData;
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 411d87a..1138ebd 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2955,6 +2955,14 @@ const SystemEnvData* WinSalFrame::GetSystemData() const
 
 // -----------------------------------------------------------------------
 
+void WinSalFrame::Beep()
+{
+    // a simple beep
+    MessageBeep( 0 );
+}
+
+// -----------------------------------------------------------------------
+
 SalFrame::SalPointerState WinSalFrame::GetPointerState()
 {
     SalPointerState aState;


More information about the Libreoffice-commits mailing list