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@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
parent
5c093e7e15
commit
2863247598
6 changed files with 63 additions and 20 deletions
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
|
43
include/vcl/specialchars.hxx
Normal file
43
include/vcl/specialchars.hxx
Normal file
|
@ -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: */
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue