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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 14 16:35:22 UTC 2020


 cui/source/dialogs/SpellDialog.cxx |    6 ++---
 include/vcl/edit.hxx               |    5 ----
 include/vcl/specialchars.hxx       |   43 +++++++++++++++++++++++++++++++++++++
 sfx2/source/appl/appinit.cxx       |    4 +--
 vcl/source/control/edit.cxx        |   16 ++++++++-----
 vcl/source/edit/vclmedit.cxx       |    9 ++++---
 6 files changed, 63 insertions(+), 20 deletions(-)

New commits:
commit 2863247598b8d85e9a284575e9b657f360d21c4d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 14 15:08:03 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 14 17:34:47 2020 +0100

    move [G|S]etGetSpecialCharsFunction into its own header
    
    so the whole of edit.hxx doesn't need to be included just to set that
    detail
    
    Change-Id: I467add023ca59c1ffdccbafb21843cb153ba6a40
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86769
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 44bca8f89a5b..fd47ab92d728 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -40,7 +40,7 @@
 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
 #include <sfx2/app.hxx>
-#include <vcl/edit.hxx>
+#include <vcl/specialchars.hxx>
 #include <vcl/event.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/texteng.hxx>
@@ -1501,9 +1501,9 @@ IMPL_LINK(SentenceEditWindow_Impl, ToolbarHdl, const OString&, rCurItemId, void)
     }
     else if (rCurItemId == "insert")
     {
-        if (Edit::GetGetSpecialCharsFunction())
+        if (vcl::GetGetSpecialCharsFunction())
         {
-            OUString aChars = Edit::GetGetSpecialCharsFunction()(GetDrawingArea(), m_xEditEngine->GetStandardFont(0));
+            OUString aChars = vcl::GetGetSpecialCharsFunction()(GetDrawingArea(), m_xEditEngine->GetStandardFont(0));
             if (!aChars.isEmpty())
             {
                 ESelection aCurrentSelection(m_xEditView->GetSelection());
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 2606eb27b9d0..a5f12d44f7b0 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -50,8 +50,6 @@ struct Impl_IMEInfos;
 
 #define EDIT_NOLIMIT                SAL_MAX_INT32
 
-typedef OUString (*FncGetSpecialChars)( weld::Widget* pWin, const vcl::Font& rFont );
-
 class Timer;
 
 class VCL_DLLPUBLIC Edit : public Control, public vcl::unohelper::DragAndDropClient
@@ -238,9 +236,6 @@ public:
     // shows a warning box saying "text too long, truncated"
     static void         ShowTruncationWarning(weld::Widget* pParent);
 
-    static void                 SetGetSpecialCharsFunction( FncGetSpecialChars fn );
-    static FncGetSpecialChars   GetGetSpecialCharsFunction();
-
     VclPtr<PopupMenu>           CreatePopupMenu();
 
     virtual OUString GetSurroundingText() const override;
diff --git a/include/vcl/specialchars.hxx b/include/vcl/specialchars.hxx
new file mode 100644
index 000000000000..d310a92a6e0d
--- /dev/null
+++ b/include/vcl/specialchars.hxx
@@ -0,0 +1,43 @@
+/* -*- 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 INCLUDED_VCL_SPECIAL_CHARS_HXX
+#define INCLUDED_VCL_SPECIAL_CHARS_HXX
+
+namespace vcl
+{
+class Font;
+}
+
+namespace weld
+{
+class Widget;
+}
+
+typedef OUString (*FncGetSpecialChars)(weld::Widget* pWin, const vcl::Font& rFont);
+
+namespace vcl
+{
+void VCL_DLLPUBLIC SetGetSpecialCharsFunction(FncGetSpecialChars fn);
+FncGetSpecialChars VCL_DLLPUBLIC GetGetSpecialCharsFunction();
+};
+
+#endif // INCLUDED_VCL_SPECIAL_CHARS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 5ae244d8e049..472a72e56223 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -36,7 +36,7 @@
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/supportsservice.hxx>
 
-#include <vcl/edit.hxx>
+#include <vcl/specialchars.hxx>
 #include <vcl/help.hxx>
 #include <vcl/svapp.hxx>
 
@@ -238,7 +238,7 @@ void SfxApplication::Initialize_Impl()
     {
         SolarMutexGuard aGuard;
         // Set special characters callback on vcl edit control
-        Edit::SetGetSpecialCharsFunction(&SfxGetSpecialCharsForEdit);
+        vcl::SetGetSpecialCharsFunction(&SfxGetSpecialCharsForEdit);
     }
 }
 
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 34b92941a587..72c09a1e522a 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -22,6 +22,7 @@
 #include <vcl/menu.hxx>
 #include <vcl/edit.hxx>
 #include <vcl/weld.hxx>
+#include <vcl/specialchars.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/uitest/uiobject.hxx>
@@ -2697,14 +2698,17 @@ sal_Int32 Edit::GetMaxVisChars() const
     return nCharWidth ? nOutWidth/nCharWidth : 0;
 }
 
-void Edit::SetGetSpecialCharsFunction( FncGetSpecialChars fn )
+namespace vcl
 {
-    pImplFncGetSpecialChars = fn;
-}
+    void SetGetSpecialCharsFunction( FncGetSpecialChars fn )
+    {
+        pImplFncGetSpecialChars = fn;
+    }
 
-FncGetSpecialChars Edit::GetGetSpecialCharsFunction()
-{
-    return pImplFncGetSpecialChars;
+    FncGetSpecialChars GetGetSpecialCharsFunction()
+    {
+        return pImplFncGetSpecialChars;
+    }
 }
 
 VclPtr<PopupMenu> Edit::CreatePopupMenu()
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index e21d5c4c8f57..d69b3a64ea81 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -23,6 +23,7 @@
 #include <vcl/builder.hxx>
 #include <vcl/decoview.hxx>
 #include <vcl/event.hxx>
+#include <vcl/specialchars.hxx>
 #include <vcl/timer.hxx>
 #include <vcl/vclmedit.hxx>
 #include <vcl/xtextedt.hxx>
@@ -710,11 +711,11 @@ void TextWindow::KeyInput( const KeyEvent& rKEvent )
     }
     else if ( (nCode == KEY_S) && rKEvent.GetKeyCode().IsShift() && rKEvent.GetKeyCode().IsMod1() )
     {
-        if ( Edit::GetGetSpecialCharsFunction() )
+        if ( vcl::GetGetSpecialCharsFunction() )
         {
             // to maintain the selection
             mbActivePopup = true;
-            OUString aChars = Edit::GetGetSpecialCharsFunction()(GetFrameWeld(), GetFont());
+            OUString aChars = vcl::GetGetSpecialCharsFunction()(GetFrameWeld(), GetFont());
             if (!aChars.isEmpty())
             {
                 mpExtTextView->InsertText( aChars );
@@ -782,7 +783,7 @@ void TextWindow::Command( const CommandEvent& rCEvt )
         pPopup->EnableItem(pPopup->GetItemId("paste"), bEnablePaste);
         pPopup->EnableItem(pPopup->GetItemId("specialchar"), bEnableSpecialChar);
         pPopup->EnableItem(pPopup->GetItemId("undo"), bEnableUndo);
-        pPopup->ShowItem(pPopup->GetItemId("specialchar"), !Edit::GetGetSpecialCharsFunction());
+        pPopup->ShowItem(pPopup->GetItemId("specialchar"), !vcl::GetGetSpecialCharsFunction());
 
         mbActivePopup = true;
         Point aPos = rCEvt.GetMousePosPixel();
@@ -828,7 +829,7 @@ void TextWindow::Command( const CommandEvent& rCEvt )
         }
         else if (sCommand == "specialchar")
         {
-            OUString aChars = Edit::GetGetSpecialCharsFunction()(GetFrameWeld(), GetFont());
+            OUString aChars = vcl::GetGetSpecialCharsFunction()(GetFrameWeld(), GetFont());
             if (!aChars.isEmpty())
             {
                 mpExtTextView->InsertText( aChars );


More information about the Libreoffice-commits mailing list