tdf#118314 Code clean up on imestatuswindow

Change-Id: I8bc5a73a91f28fcfd22ef716e9cf87d53997b1ad
Reviewed-on: https://gerrit.libreoffice.org/77337
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: László Németh <nemeth@numbertext.org>
This commit is contained in:
Szabolcs Toth
2019-08-12 10:58:40 +02:00
committed by László Németh
parent e8b3df5b9b
commit 5bfa8b8d5e
35 changed files with 13 additions and 1179 deletions

View File

@@ -159,8 +159,7 @@ public:
&& pVarDecl->isThisDeclarationADefinition())
{
auto const name(pVarDecl->getName());
if ( name == "g_pI18NStatusInstance" // I18NStatus::free()
|| name == "s_pPreviousView" // not an owning pointer
if ( name == "s_pPreviousView" // not an owning pointer
|| name == "s_pDefCollapsed" // SvImpLBox::~SvImpLBox()
|| name == "s_pDefExpanded" // SvImpLBox::~SvImpLBox()
|| name == "g_pDDSource" // SvTreeListBox::dispose()

View File

@@ -10414,8 +10414,6 @@ vcl/inc/salframe.hxx:72
enum SalFrameStyleFlags NOSHADOW
vcl/inc/salptype.hxx:32
enum JobSetFlags ALL
vcl/inc/svdata.hxx:134
enum ImplSVAppData::ImeStatusWindowMode ImeStatusWindowMode_UNKNOWN
vcl/inc/unx/desktops.hxx:29
enum DesktopType DESKTOP_UNKNOWN
vcl/inc/unx/i18n_cb.hxx:67

View File

@@ -211,7 +211,6 @@ class SvxSearchItem;
#define SID_INTERACTIONHANDLER (SID_SFX_START + 1675)
#define SID_OPENHYPERLINK (SID_SFX_START + 1676)
#define SID_CONTENT (SID_SFX_START + 1679)
#define SID_SHOW_IME_STATUS_WINDOW (SID_SFX_START + 1680)
#define SID_VIEWONLY (SID_SFX_START + 1682)
#define SID_REPAIRPACKAGE (SID_SFX_START + 1683)
#define SID_MINIMIZED (SID_SFX_START + 1687)

View File

@@ -1253,48 +1253,6 @@ public:
///@}
/** @name IME Status Window Control
*/
///@{
/** Determine application can toggle the IME status window on and off.
@attention Must only be called with the Solar mutex locked.
@return true if any IME status window can be toggled on and off
externally.
@see ShowImeStatusWindow, GetShowImeStatusWindowDefault,
GetShowImeStatusWindowDefault
*/
static bool CanToggleImeStatusWindow();
/** Toggle any IME status window on and off.
This only works if CanToggleImeStatusWindow returns true (otherwise,
any calls of this method are ignored).
@remark Can be called without the Solar mutex locked.
@param bShow If true, then show the IME status window
@see GetShowImeStatusWindowDefault, CanToggleImeStatusWindow,
GetShowImeStatusWindow
*/
static void ShowImeStatusWindow(bool bShow);
/** Determines if the IME status window should be turned of by default.
@return true if any IME status window should be turned on by default
(this decision can be locale dependent, for example).
@see ShowImeStatusWindow, GetShowImeStatusWindowDefault,
CanToggleImeStatusWindow
*/
static bool GetShowImeStatusWindowDefault();
///@}
/** Get the desktop environment the process is currently running in
@returns String representing the desktop environment

View File

@@ -98,7 +98,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/appl/fwkhelper \
sfx2/source/appl/helpdispatch \
sfx2/source/appl/helpinterceptor \
sfx2/source/appl/imestatuswindow \
sfx2/source/appl/impldde \
sfx2/source/appl/linkmgr2 \
sfx2/source/appl/linksrc \

View File

@@ -111,11 +111,6 @@ interface Application
ExecMethod = MiscExec_Impl ;
StateMethod = MiscState_Impl ;
]
SID_SHOW_IME_STATUS_WINDOW
[
ExecMethod = MiscExec_Impl ;
StateMethod = MiscState_Impl ;
]
SID_SEND_FEEDBACK
[
ExecMethod = MiscExec_Impl ;

View File

@@ -4867,25 +4867,6 @@ SfxImageItem ImageOrientation SID_IMAGE_ORIENTATION
GroupId = SfxGroupId::View;
]
SfxBoolItem ShowImeStatusWindow SID_SHOW_IME_STATUS_WINDOW
[
AutoUpdate = FALSE,
FastCall = FALSE,
ReadOnlyDoc = TRUE,
Toggle = FALSE,
Container = TRUE,
RecordAbsolute = FALSE,
RecordPerSet;
AccelConfig = FALSE,
MenuConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = SfxGroupId::View;
]
SfxVoidItem SendFeedback SID_SEND_FEEDBACK
()
[

View File

@@ -66,7 +66,6 @@
#include <openflag.hxx>
#include <sfx2/module.hxx>
#include <sfx2/event.hxx>
#include "imestatuswindow.hxx"
#include <workwin.hxx>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/tbxctrl.hxx>
@@ -174,8 +173,6 @@ SfxApplication::SfxApplication()
if (!utl::ConfigManager::IsFuzzing())
SvtViewOptions::AcquireOptions();
pImpl->m_xImeStatusWindow->init();
SAL_INFO( "sfx.appl", "{ initialize DDE" );
bool bOk = InitializeDde();

View File

@@ -41,7 +41,6 @@
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/unoctitm.hxx>
#include <objshimp.hxx>
#include "imestatuswindow.hxx"
#include <appbaslib.hxx>
#include <childwinimpl.hxx>
#include <svl/svdde.hxx>
@@ -94,7 +93,6 @@ SfxAppData_Impl::SfxAppData_Impl()
, pProgress(nullptr)
, nDocModalMode(0)
, nRescheduleLocks(0)
, m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow(comphelper::getProcessComponentContext()))
, pTbxCtrlFac(nullptr)
, pStbCtrlFac(nullptr)
, pViewFrames(nullptr)

View File

@@ -118,7 +118,6 @@
#include <sfx2/module.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfxpicklist.hxx>
#include "imestatuswindow.hxx"
#include <sfx2/sfxdlg.hxx>
#include <sfx2/sfxsids.hrc>
#include <sorgitm.hxx>
@@ -703,21 +702,6 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
break;
#endif
case SID_SHOW_IME_STATUS_WINDOW:
if (sfx2::appl::ImeStatusWindow::canToggle())
{
const SfxBoolItem * pItem = rReq.GetArg<SfxBoolItem>(SID_SHOW_IME_STATUS_WINDOW);
bool bShow = pItem == nullptr
? !pImpl->m_xImeStatusWindow->isShowing()
: pItem->GetValue();
pImpl->m_xImeStatusWindow->show(bShow);
if (pItem == nullptr)
rReq.AppendItem(SfxBoolItem(SID_SHOW_IME_STATUS_WINDOW,
bShow));
}
bDone = true;
break;
case SID_ZOOM_50_PERCENT:
case SID_ZOOM_75_PERCENT:
case SID_ZOOM_100_PERCENT:
@@ -1150,16 +1134,6 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
break;
}
case SID_SHOW_IME_STATUS_WINDOW:
if (sfx2::appl::ImeStatusWindow::canToggle())
rSet.Put(SfxBoolItem(
SID_SHOW_IME_STATUS_WINDOW,
pImpl->m_xImeStatusWindow->
isShowing()));
else
rSet.DisableItem(SID_SHOW_IME_STATUS_WINDOW);
break;
case SID_TEMPLATE_MANAGER:
{
SvtMiscOptions aMiscOptions;

View File

@@ -1,229 +0,0 @@
/* -*- 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 "imestatuswindow.hxx"
#include <sfx2/app.hxx>
#include <sfx2/sfxsids.hrc>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/util/XChangesBatch.hpp>
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <vcl/svapp.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/weakref.hxx>
//TO-Do, merge into framework/inc/helpers/mischelpers.hxx and deliver
class WeakPropertyChangeListener : public ::cppu::WeakImplHelper<css::beans::XPropertyChangeListener>
{
private:
css::uno::WeakReference<css::beans::XPropertyChangeListener> mxOwner;
public:
explicit WeakPropertyChangeListener(css::uno::Reference<css::beans::XPropertyChangeListener> const & xOwner)
: mxOwner(xOwner)
{
}
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &rEvent ) override
{
css::uno::Reference<css::beans::XPropertyChangeListener> xOwner(mxOwner.get(),
css::uno::UNO_QUERY);
if (xOwner.is())
xOwner->propertyChange(rEvent);
}
// lang.XEventListener
virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent) override
{
css::uno::Reference<css::beans::XPropertyChangeListener> xOwner(mxOwner.get(),
css::uno::UNO_QUERY);
if (xOwner.is())
xOwner->disposing(rEvent);
}
};
using sfx2::appl::ImeStatusWindow;
ImeStatusWindow::ImeStatusWindow(
css::uno::Reference< css::uno::XComponentContext > const & rxContext):
m_xContext(rxContext),
m_bDisposed(false)
{}
void ImeStatusWindow::init()
{
if (!Application::CanToggleImeStatusWindow())
return;
try
{
bool bShow;
if (getConfig()->getPropertyValue("ShowStatusWindow") >>= bShow)
Application::ShowImeStatusWindow(bShow);
}
catch (css::uno::Exception &)
{
OSL_FAIL("com.sun.star.uno.Exception");
// Degrade gracefully and use the VCL-supplied default if no
// configuration is available.
}
}
bool ImeStatusWindow::isShowing()
{
try
{
bool bShow(false);
if (getConfig()->getPropertyValue("ShowStatusWindow") >>= bShow)
return bShow;
}
catch (css::uno::Exception &)
{
OSL_FAIL("com.sun.star.uno.Exception");
// Degrade gracefully and use the VCL-supplied default if no
// configuration is available.
}
return Application::GetShowImeStatusWindowDefault();
}
void ImeStatusWindow::show(bool bShow)
{
try
{
css::uno::Reference< css::beans::XPropertySet > xConfig(getConfig());
xConfig->setPropertyValue(
"ShowStatusWindow",
css::uno::makeAny(bShow));
css::uno::Reference< css::util::XChangesBatch > xCommit(
xConfig, css::uno::UNO_QUERY);
// Degrade gracefully by not saving the settings permanently:
if (xCommit.is())
xCommit->commitChanges();
// Alternatively, setting the VCL status could be done even if updating
// the configuration failed:
Application::ShowImeStatusWindow(bShow);
}
catch (css::uno::Exception &)
{
OSL_FAIL("com.sun.star.uno.Exception");
}
}
bool ImeStatusWindow::canToggle()
{
return Application::CanToggleImeStatusWindow();
}
ImeStatusWindow::~ImeStatusWindow()
{
if (m_xConfig.is() && m_xConfigListener.is())
// We should never get here, but just in case...
try
{
m_xConfig->removePropertyChangeListener(
"ShowStatusWindow",
m_xConfigListener);
}
catch (css::uno::Exception &)
{
OSL_FAIL("com.sun.star.uno.RuntimeException");
}
}
void SAL_CALL ImeStatusWindow::disposing(css::lang::EventObject const & )
{
osl::MutexGuard aGuard(m_aMutex);
m_xConfig = nullptr;
m_bDisposed = true;
}
void SAL_CALL
ImeStatusWindow::propertyChange(css::beans::PropertyChangeEvent const & )
{
SolarMutexGuard aGuard;
SfxApplication* pApp = SfxApplication::Get();
if (pApp)
pApp->Invalidate(SID_SHOW_IME_STATUS_WINDOW);
}
css::uno::Reference< css::beans::XPropertySet > ImeStatusWindow::getConfig()
{
css::uno::Reference< css::beans::XPropertySet > xConfig;
bool bAdd = false;
{
osl::MutexGuard aGuard(m_aMutex);
if (!m_xConfig.is())
{
if (m_bDisposed)
throw css::lang::DisposedException();
if (!m_xContext.is())
throw css::uno::RuntimeException(
"null comphelper::getProcessServiceFactory",
nullptr);
css::uno::Reference< css::lang::XMultiServiceFactory > xProvider =
css::configuration::theDefaultProvider::get( m_xContext );
css::beans::PropertyValue aArg(
"nodepath", -1,
css::uno::makeAny(
OUString(
"/org.openoffice.Office.Common/I18N/InputMethod")),
css::beans::PropertyState_DIRECT_VALUE);
css::uno::Sequence< css::uno::Any > aArgs(1);
aArgs[0] <<= aArg;
m_xConfig.set(
xProvider->createInstanceWithArguments(
"com.sun.star.configuration.ConfigurationUpdateAccess",
aArgs),
css::uno::UNO_QUERY_THROW);
bAdd = true;
}
xConfig = m_xConfig;
}
if (bAdd)
{
// Exceptions here could be handled individually, to support graceful
// degradation (no update notification mechanism in this case---but also
// no dispose notifications):
m_xConfigListener = new WeakPropertyChangeListener(this);
xConfig->addPropertyChangeListener(
"ShowStatusWindow",
m_xConfigListener);
}
return xConfig;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1,119 +0,0 @@
/* -*- 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_SFX2_SOURCE_APPL_IMESTATUSWINDOW_HXX
#define INCLUDED_SFX2_SOURCE_APPL_IMESTATUSWINDOW_HXX
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <cppuhelper/implbase.hxx>
#include <osl/mutex.hxx>
namespace com { namespace sun { namespace star {
namespace beans { class XPropertySet; }
namespace lang { class XMultiServiceFactory; }
namespace uno { class XComponentContext; }
} } }
namespace sfx2 { namespace appl {
// The MS compiler needs this typedef work-around to accept the using
// declarations within ImeStatusWindow:
typedef cppu::WeakImplHelper< css::beans::XPropertyChangeListener > ImeStatusWindow_Impl;
/** Control the behavior of any (platform-dependent) IME status windows.
The decision of whether a status window shall be displayed or not can be
stored permanently in the configuration (under key
org.openoffice.office.Common/I18N/InputMethod/ShowStatusWindow; if that
entry is nil, VCL is asked for a default).
*/
class ImeStatusWindow: private ImeStatusWindow_Impl
{
public:
explicit ImeStatusWindow( css::uno::Reference< css::uno::XComponentContext > const& rxContext );
/** Set up VCL according to the configuration.
Is it not strictly required that this method is called exactly once
(though that will be the typical use).
Must only be called with the Solar mutex locked.
*/
void init();
/** Return true if the status window is toggled on.
This is only meaningful when canToggle returns true.
Can be called without the Solar mutex locked.
*/
bool isShowing();
/** Toggle the status window on or off.
This only works if canToggle returns true (otherwise, any calls of this
method are ignored).
Must only be called with the Solar mutex locked.
*/
void show(bool bShow);
/** Return true if the status window can be toggled on and off externally.
Must only be called with the Solar mutex locked.
*/
static bool canToggle();
using ImeStatusWindow_Impl::acquire;
using ImeStatusWindow_Impl::release;
using ImeStatusWindow_Impl::operator new;
using ImeStatusWindow_Impl::operator delete;
private:
ImeStatusWindow(ImeStatusWindow const &) = delete;
void operator =(const ImeStatusWindow&) = delete;
virtual ~ImeStatusWindow() override;
virtual void SAL_CALL
disposing(css::lang::EventObject const & rSource) override;
virtual void SAL_CALL
propertyChange(css::beans::PropertyChangeEvent const & rEvent) override;
css::uno::Reference< css::beans::XPropertySet >
getConfig();
css::uno::Reference< css::uno::XComponentContext >
m_xContext;
osl::Mutex m_aMutex;
css::uno::Reference< css::beans::XPropertySet >
m_xConfig;
css::uno::Reference< css::beans::XPropertyChangeListener >
m_xConfigListener;
bool m_bDisposed;
};
} }
#endif // INCLUDED_SFX2_SOURCE_APPL_IMESTATUSWINDOW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -58,7 +58,6 @@ class SfxBasicManagerHolder;
class SfxBasicManagerCreationListener;
namespace sfx2 {
namespace appl { class ImeStatusWindow; }
namespace sidebar { class Theme; }
}
@@ -101,8 +100,6 @@ public:
sal_uInt16 nDocModalMode; // counts documents in modal mode
sal_uInt16 nRescheduleLocks;
rtl::Reference< sfx2::appl::ImeStatusWindow > m_xImeStatusWindow;
SfxTbxCtrlFactArr_Impl* pTbxCtrlFac;
SfxStbCtrlFactArr_Impl* pStbCtrlFac;
SfxViewFrameArr_Impl* pViewFrames;

View File

@@ -12629,8 +12629,6 @@ sfx2/source/appl/helpdispatch.cxx
sfx2/source/appl/helpdispatch.hxx
sfx2/source/appl/helpinterceptor.cxx
sfx2/source/appl/helpinterceptor.hxx
sfx2/source/appl/imestatuswindow.cxx
sfx2/source/appl/imestatuswindow.hxx
sfx2/source/appl/impldde.cxx
sfx2/source/appl/impldde.hxx
sfx2/source/appl/linkmgr2.cxx
@@ -17360,7 +17358,6 @@ vcl/inc/salframe.hxx
vcl/inc/salgdi.hxx
vcl/inc/salgdiimpl.hxx
vcl/inc/salgeom.hxx
vcl/inc/salimestatus.hxx
vcl/inc/salinst.hxx
vcl/inc/sallayout.hxx
vcl/inc/salmenu.hxx
@@ -17419,7 +17416,6 @@ vcl/inc/unx/i18n_cb.hxx
vcl/inc/unx/i18n_ic.hxx
vcl/inc/unx/i18n_im.hxx
vcl/inc/unx/i18n_keysym.hxx
vcl/inc/unx/i18n_status.hxx
vcl/inc/unx/i18n_xkb.hxx
vcl/inc/unx/nativewindowhandleprovider.hxx
vcl/inc/unx/pixmap.hxx
@@ -18039,7 +18035,6 @@ vcl/unx/generic/app/i18n_cb.cxx
vcl/unx/generic/app/i18n_ic.cxx
vcl/unx/generic/app/i18n_im.cxx
vcl/unx/generic/app/i18n_keysym.cxx
vcl/unx/generic/app/i18n_status.cxx
vcl/unx/generic/app/i18n_xkb.cxx
vcl/unx/generic/app/keysymnames.cxx
vcl/unx/generic/app/randrwrapper.cxx

View File

@@ -72,7 +72,6 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\
vcl/unx/generic/app/i18n_ic \
vcl/unx/generic/app/i18n_im \
vcl/unx/generic/app/i18n_keysym \
vcl/unx/generic/app/i18n_status \
vcl/unx/generic/app/i18n_xkb \
vcl/unx/generic/app/keysymnames \
vcl/unx/generic/app/randrwrapper \

View File

@@ -251,7 +251,6 @@
#include <salframe.hxx>
#include <salgdi.hxx>
#include <salgdiimpl.hxx>
#include <salimestatus.hxx>
#include <sallayout.hxx>
#include <salmenu.hxx>
#include <salobj.hxx>

View File

@@ -1,39 +0,0 @@
/* -*- 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_INC_SALIMESTATUS_HXX
#define INCLUDED_VCL_INC_SALIMESTATUS_HXX
#include <vcl/dllapi.h>
class VCL_PLUGIN_PUBLIC SalI18NImeStatus
{
public:
SalI18NImeStatus() {}
virtual ~SalI18NImeStatus();
// asks whether there is a status window available
// to toggle into menubar
virtual bool canToggle() { return false; }
virtual void toggle() {}
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -65,7 +65,6 @@ class SalInfoPrinter;
class SalPrinter;
class SalTimer;
class ImplPrnQueueList;
class SalI18NImeStatus;
class SalSystem;
class SalBitmap;
struct SalItemParams;
@@ -128,9 +127,6 @@ public:
// SalTimer
virtual SalTimer* CreateSalTimer() = 0;
// interface to ime status window, only used by the X11 backend
virtual std::unique_ptr<SalI18NImeStatus>
CreateI18NImeStatus();
// SalSystem
virtual SalSystem* CreateSalSystem() = 0;
// SalBitmap

View File

@@ -84,7 +84,6 @@ class UnoWrapperBase;
class GraphicConverter;
class ImplWheelWindow;
class SalTimer;
class SalI18NImeStatus;
class DockingManager;
class VclEventListeners2;
class SalData;
@@ -129,12 +128,6 @@ typedef std::pair<VclPtr<vcl::Window>, ImplPostEventData *> ImplPostEventPair;
struct ImplSVAppData
{
~ImplSVAppData();
enum ImeStatusWindowMode
{
ImeStatusWindowMode_UNKNOWN,
ImeStatusWindowMode_HIDE,
ImeStatusWindowMode_SHOW
};
std::unique_ptr<AllSettings> mpSettings; // Application settings
LocaleConfigurationListener* mpCfgListener = nullptr;
@@ -160,13 +153,6 @@ struct ImplSVAppData
DialogCancelMode meDialogCancel = DialogCancelMode::Off; // true: All Dialog::Execute() calls will be terminated immediately with return false
bool mbRenderToBitmaps = false; // set via svp / headless plugin
/** Controls whether showing any IME status window is toggled on or off.
Only meaningful if showing IME status windows can be toggled on and off
externally (see Application::CanToggleImeStatusWindow).
*/
ImeStatusWindowMode meShowImeStatusWindow = ImeStatusWindowMode_UNKNOWN;
SvFileStream* mpEventTestInput = nullptr;
Idle* mpEventTestingIdle = nullptr;
int mnEventTestLimit = 0;
@@ -356,7 +342,6 @@ struct ImplSVData
Application* mpApp = nullptr; // pApp
VclPtr<WorkWindow> mpDefaultWin; // Default-Window
bool mbDeInit = false; // Is VCL deinitializing
std::unique_ptr<SalI18NImeStatus> mpImeStatus; // interface to ime status window, only used by the X11 backend
std::unique_ptr<SalSystem> mpSalSystem; // SalSystem interface
int mnFontUpdatesLockCount = 0; // avoid repeated font updates
bool mbFontUpdatesPending = false; // need to update font data after unlock

View File

@@ -205,9 +205,6 @@ public:
virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override;
virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override;
virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow ) override;
#if !GTK_CHECK_VERSION(3,0,0)
virtual std::unique_ptr<SalI18NImeStatus> CreateI18NImeStatus() override;
#endif
virtual SalSystem* CreateSalSystem() override;
virtual SalInfoPrinter* CreateInfoPrinter(SalPrinterQueueInfo* pPrinterQueueInfo, ImplJobSetup* pJobSetup) override;
virtual std::unique_ptr<SalPrinter> CreatePrinter( SalInfoPrinter* pInfoPrinter ) override;

View File

@@ -62,7 +62,7 @@ public:
void ExtendEventMask( ::Window aFocusWindow );
void SetICFocus( SalFrame* pFocusFrame );
void UnsetICFocus( SalFrame const * pFrame );
void UnsetICFocus();
void HandleDestroyIM();
void EndExtTextInput();
@@ -70,7 +70,7 @@ public:
int UpdateSpotLocation();
void Map( SalFrame *pFrame );
void Unmap( SalFrame const * pFrame );
void Unmap();
SalI18N_InputContext( SalFrame *aFrame );
~SalI18N_InputContext();

View File

@@ -1,89 +0,0 @@
/* -*- 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_INC_UNX_I18N_STATUS_HXX
#define INCLUDED_VCL_INC_UNX_I18N_STATUS_HXX
#include <rtl/ustring.hxx>
#include <salimestatus.hxx>
#include <vcl/vclptr.hxx>
class SalFrame;
class WorkWindow;
class ListBox;
class FixedText;
class PushButton;
class SalI18N_InputContext;
namespace vcl
{
class StatusWindow;
class X11ImeStatus : public SalI18NImeStatus
{
public:
X11ImeStatus() {}
virtual ~X11ImeStatus() override;
virtual bool canToggle() override;
virtual void toggle() override;
};
class I18NStatus
{
private:
SalFrame* m_pParent;
VclPtr<StatusWindow> m_pStatusWindow;
OUString const m_aCurrentIM;
I18NStatus();
~I18NStatus();
static bool getStatusWindowMode();
public:
static I18NStatus& get();
static bool exists();
static void free();
void setParent( SalFrame* pParent );
SalFrame* getParent() const { return m_pParent; }
SalFrame* getStatusFrame() const;
void setStatusText( const OUString& rText );
enum ShowReason { focus, presentation, contextmap };
void show( bool bShow, ShowReason eReason );
// External Control:
/** Toggle the status window on or off.
This only works if canToggleStatusWindow returns true (otherwise, any
calls of this method are ignored).
*/
void toggleStatusWindow();
};
} // namespace
#endif // INCLUDED_VCL_INC_UNX_I18N_STATUS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -67,7 +67,6 @@ public:
virtual GenPspGraphics *CreatePrintGraphics() override;
virtual SalTimer* CreateSalTimer() override;
virtual std::unique_ptr<SalI18NImeStatus> CreateI18NImeStatus() override;
virtual SalSystem* CreateSalSystem() override;
virtual std::shared_ptr<SalBitmap> CreateSalBitmap() override;
virtual std::unique_ptr<SalSession> CreateSalSession() override;

View File

@@ -59,7 +59,6 @@
#include <osx/runinmain.hxx>
#include <print.h>
#include <salimestatus.hxx>
#include <comphelper/processfactory.hxx>

View File

@@ -24,7 +24,6 @@
#include <salvd.hxx>
#include <salprn.hxx>
#include <saltimer.hxx>
#include <salimestatus.hxx>
#include <salsession.hxx>
#include <salsys.hxx>
#include <salbmp.hxx>
@@ -144,11 +143,6 @@ bool SalInstance::CallEventCallback( void const * pEvent, int nBytes )
return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes );
}
std::unique_ptr<SalI18NImeStatus> SalInstance::CreateI18NImeStatus()
{
return std::unique_ptr<SalI18NImeStatus>(new SalI18NImeStatus);
}
SalTimer::~SalTimer() COVERITY_NOEXCEPT_FALSE
{
}
@@ -168,10 +162,6 @@ SalBitmap::~SalBitmap()
DropScaledCache();
}
SalI18NImeStatus::~SalI18NImeStatus()
{
}
SalSystem::~SalSystem()
{
}

View File

@@ -55,7 +55,6 @@
#include <salframe.hxx>
#include <salsys.hxx>
#include <svdata.hxx>
#include <salimestatus.hxx>
#include <displayconnectiondispatch.hxx>
#include <window.h>
#include <accmgr.hxx>
@@ -1553,34 +1552,6 @@ void Application::ShowNativeErrorBox(const OUString& sTitle ,
}
}
bool Application::CanToggleImeStatusWindow()
{
ImplSVData* pSVData = ImplGetSVData();
if( ! pSVData->mpImeStatus )
pSVData->mpImeStatus = pSVData->mpDefInst->CreateI18NImeStatus();
return pSVData->mpImeStatus->canToggle();
}
void Application::ShowImeStatusWindow(bool bShow)
{
ImplGetSVData()->maAppData.meShowImeStatusWindow = bShow
? ImplSVAppData::ImeStatusWindowMode_SHOW
: ImplSVAppData::ImeStatusWindowMode_HIDE;
ImplSVData* pSVData = ImplGetSVData();
if( ! pSVData->mpImeStatus )
pSVData->mpImeStatus = pSVData->mpDefInst->CreateI18NImeStatus();
pSVData->mpImeStatus->toggle();
}
bool Application::GetShowImeStatusWindowDefault()
{
rtl_TextEncodingInfo aInfo;
aInfo.StructSize = sizeof aInfo;
return rtl_getTextEncodingInfo(osl_getThreadTextEncoding(), &aInfo)
&& aInfo.MaximumCharSize > 1;
}
const OUString& Application::GetDesktopEnvironment()
{
if (IsHeadlessModeEnabled())

View File

@@ -40,7 +40,6 @@
#include <salinst.hxx>
#include <salgdi.hxx>
#include <svdata.hxx>
#include <salimestatus.hxx>
#include <salsys.hxx>
#include <units.hrc>
#include <print.h>

View File

@@ -73,7 +73,6 @@
#include <print.h>
#include <salsys.hxx>
#include <saltimer.hxx>
#include <salimestatus.hxx>
#include <displayconnectiondispatch.hxx>
#include <config_features.h>
@@ -424,9 +423,6 @@ void DeInitVCL()
vcl::DeleteOnDeinitBase::ImplDeleteOnDeInit();
// give ime status a chance to destroy its own windows
pSVData->mpImeStatus.reset();
#if OSL_DEBUG_LEVEL > 0
OStringBuffer aBuf( 256 );
aBuf.append( "DeInitVCL: some top Windows are still alive\n" );

View File

@@ -31,7 +31,6 @@
#include <unx/salunx.h>
#include <unx/XIM.h>
#include <unx/i18n_cb.hxx>
#include <unx/i18n_status.hxx>
#include <unx/i18n_ic.hxx>
#include <unx/i18n_im.hxx>
#include <salframe.hxx>
@@ -498,7 +497,6 @@ StatusDrawCallback (XIC, XPointer, XIMStatusDrawCallbackStruct *call_data)
if( nLength )
aText = OUString( pMBString, nLength, osl_getThreadTextEncoding() );
}
vcl::I18NStatus::get().setStatusText( aText );
}
#if OSL_DEBUG_LEVEL > 1
else

View File

@@ -29,7 +29,6 @@
#include <unx/XIM.h>
#include <unx/i18n_ic.hxx>
#include <unx/i18n_im.hxx>
#include <unx/i18n_status.hxx>
#include <unx/salframe.h>
#include <unx/saldisp.hxx>
@@ -361,16 +360,9 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) :
// unmap it the hard way
void
SalI18N_InputContext::Unmap( SalFrame const * pFrame )
SalI18N_InputContext::Unmap()
{
if ( maContext != nullptr )
{
I18NStatus& rStatus( I18NStatus::get() );
if( rStatus.getParent() == pFrame )
rStatus.show( false, I18NStatus::contextmap );
}
UnsetICFocus( pFrame );
UnsetICFocus();
maClientData.pFrame = nullptr;
}
@@ -379,11 +371,8 @@ SalI18N_InputContext::Map( SalFrame *pFrame )
{
if( mbUseable )
{
I18NStatus& rStatus(I18NStatus::get() );
rStatus.setParent( pFrame );
if( pFrame )
{
rStatus.show( true, I18NStatus::contextmap );
if ( maContext == nullptr )
{
SalI18N_InputMethod *pInputMethod;
@@ -548,8 +537,6 @@ SalI18N_InputContext::UpdateSpotLocation()
XSetICValues(maContext, XNPreeditAttributes, preedit_attr, nullptr);
XFree(preedit_attr);
I18NStatus::get().show( true, I18NStatus::contextmap );
return 0;
}
@@ -560,7 +547,6 @@ SalI18N_InputContext::UpdateSpotLocation()
void
SalI18N_InputContext::SetICFocus( SalFrame* pFocusFrame )
{
I18NStatus::get().setParent( pFocusFrame );
if ( mbUseable && (maContext != nullptr) )
{
maClientData.pFrame = pFocusFrame;
@@ -586,11 +572,8 @@ SalI18N_InputContext::SetICFocus( SalFrame* pFocusFrame )
}
void
SalI18N_InputContext::UnsetICFocus( SalFrame const * pFrame )
SalI18N_InputContext::UnsetICFocus()
{
I18NStatus& rStatus( I18NStatus::get() );
if( rStatus.getParent() == pFrame )
rStatus.setParent( nullptr );
if ( mbUseable && (maContext != nullptr) )
{

View File

@@ -35,7 +35,6 @@
#include <unx/salunx.h>
#include <unx/saldisp.hxx>
#include <unx/i18n_im.hxx>
#include <unx/i18n_status.hxx>
#include <osl/thread.h>
#include <osl/process.h>
@@ -249,7 +248,6 @@ SalI18N_InputMethod::SalI18N_InputMethod( )
SalI18N_InputMethod::~SalI18N_InputMethod()
{
vcl::I18NStatus::free();
if ( mpStyles != nullptr )
XFree( mpStyles );
if ( maMethod != nullptr )

View File

@@ -1,439 +0,0 @@
/* -*- 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 .
*/
#if OSL_DEBUG_LEVEL > 1
#include <stdio.h>
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <unx/XIM.h>
#include <unx/salunx.h>
#include <unx/i18n_status.hxx>
#include <unx/i18n_ic.hxx>
#include <unx/saldisp.hxx>
#include <unx/salframe.h>
#include <unx/salinst.h>
#include <vcl/wrkwin.hxx>
#include <vcl/fixed.hxx>
#include <vcl/menubtn.hxx>
#include <vcl/menu.hxx>
#include <vcl/svapp.hxx>
#include <vcl/sysdata.hxx>
#include <svdata.hxx>
using namespace vcl;
namespace vcl {
class StatusWindow : public WorkWindow
{
protected:
explicit StatusWindow( WinBits nWinBits );
public:
virtual void setPosition( SalFrame* );
virtual void setText( const OUString & ) = 0;
virtual void show( bool bShow, I18NStatus::ShowReason eReason ) = 0;
virtual void toggle( bool bOn ) = 0;
};
}
StatusWindow::StatusWindow( WinBits nWinBits ) :
WorkWindow( nullptr, nWinBits )
{
}
void StatusWindow::setPosition( SalFrame* )
{
}
namespace vcl {
class XIMStatusWindow : public StatusWindow
{
VclPtr<FixedText> m_aStatusText;
SalFrame* m_pLastParent;
Size m_aWindowSize;
bool m_bAnchoredAtRight;
// true if the right edge (instead of the left edge) should stay at a
// fixed position when re-sizing the window
// for delayed showing
bool m_bDelayedShow;
ImplSVEvent * m_nDelayedEvent;
// for toggling
bool m_bOn;
Point updatePosition();
void layout();
bool checkLastParent() const;
DECL_LINK( DelayedShowHdl, void*, void );
public:
explicit XIMStatusWindow( bool bOn );
virtual ~XIMStatusWindow() override;
virtual void setPosition( SalFrame* ) override;
virtual void setText( const OUString & ) override;
virtual void show( bool bShow, I18NStatus::ShowReason eReason ) override;
virtual void toggle( bool bOn ) override;
virtual void dispose() override;
// override WorkWindow::DataChanged
virtual void DataChanged( const DataChangedEvent& rEvt ) override;
};
}
XIMStatusWindow::XIMStatusWindow( bool bOn ) :
StatusWindow( WB_BORDER | WB_SYSTEMFLOATWIN | WB_TOOLTIPWIN ),
m_aStatusText(VclPtr<FixedText>::Create(this, 0)),
m_pLastParent( nullptr ),
m_bAnchoredAtRight( false ),
m_bDelayedShow( false ),
m_nDelayedEvent( nullptr ),
m_bOn( bOn )
{
layout();
}
XIMStatusWindow::~XIMStatusWindow()
{
disposeOnce();
}
void XIMStatusWindow::dispose()
{
if( m_nDelayedEvent )
Application::RemoveUserEvent( m_nDelayedEvent );
m_aStatusText.disposeAndClear();
StatusWindow::dispose();
}
void XIMStatusWindow::toggle( bool bOn )
{
m_bOn = bOn;
show( bOn, I18NStatus::contextmap );
}
void XIMStatusWindow::layout()
{
m_aWindowSize.setWidth( m_aStatusText->GetTextWidth( m_aStatusText->GetText() )+8 );
Font aFont( m_aStatusText->GetFont() );
m_aWindowSize.setHeight( aFont.GetFontHeight()+10 );
m_aWindowSize = LogicToPixel( m_aWindowSize );
Size aControlSize( m_aWindowSize );
aControlSize.AdjustWidth( -4 );
aControlSize.AdjustHeight( -4 );
m_aStatusText->SetPosSizePixel( Point( 1, 1 ), aControlSize );
m_aStatusText->SetFont( aFont );
m_aStatusText->Show();
if (m_bAnchoredAtRight && IsVisible())
{
SalFrame* pFrame = static_cast<SalFrame*>(GetSystemData()->pSalFrame);
long nDelta = pFrame->maGeometry.nWidth - m_aWindowSize.Width();
pFrame->SetPosSize( pFrame->maGeometry.nX + nDelta,
pFrame->maGeometry.nY,
m_aWindowSize.Width(),
m_aWindowSize.Height(),
SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y | SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT );
}
else
SetOutputSizePixel( m_aWindowSize );
}
bool XIMStatusWindow::checkLastParent() const
{
if( m_pLastParent )
{
auto rFrameList = vcl_sal::getSalDisplay(GetGenericUnixSalData())->getFrames();
auto it = rFrameList.find( m_pLastParent );
return it != rFrameList.end();
}
return false;
}
void XIMStatusWindow::DataChanged( const DataChangedEvent& )
{
m_aStatusText->SetSettings( GetSettings() );
layout();
}
Point XIMStatusWindow::updatePosition()
{
Point aRet;
if( checkLastParent() )
{
const SystemEnvData* pParentEnvData = m_pLastParent->GetSystemData();
SalExtTextInputPosEvent aPosEvent;
m_pLastParent->CallCallback( SalEvent::ExtTextInputPos, static_cast<void*>(&aPosEvent) );
int x, y;
::Window aChild;
XTranslateCoordinates( static_cast<Display*>(pParentEnvData->pDisplay),
static_cast<::Window>(pParentEnvData->aShellWindow),
vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetRootWindow( vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetDefaultXScreen() ),
0, 0,
&x, &y,
&aChild );
// TODO: Currently, place the status window to the (physical) left of
// the cursor iff in vertical mode (assuming that the columns in
// vertical mode are always written from right to left, this causes the
// status window to keep out of the text already written). This
// heuristic would break if there is ever a vertical mode in which the
// columns are written from left to right. Also, more elaborate
// positioning for (both horizontal and vertical) left-to-right and
// right-to-left text would be possible.
bool bLeft = aPosEvent.mbVertical;
// true if status window is to the left of the cursor
int const nGap = 4; // between cursor and status window
if (aPosEvent.mbVertical)
{
aRet.setX( x + aPosEvent.mnX + (bLeft
? -m_aWindowSize.Width() - nGap
: aPosEvent.mnHeight + nGap) );
aRet.setY( y + aPosEvent.mnY );
}
else
{
aRet.setX( x + aPosEvent.mnX + (bLeft ? -m_aWindowSize.Width() : 0) );
aRet.setY( y + aPosEvent.mnY+aPosEvent.mnHeight + nGap );
}
m_bAnchoredAtRight = bLeft;
}
return aRet;
}
void XIMStatusWindow::setPosition( SalFrame* pParent )
{
if( pParent )
{
if( pParent != m_pLastParent )
{
setText( OUString() );
m_pLastParent = pParent;
Show( false, ShowFlags::NoActivate );
}
if( IsVisible() )
{
const SystemEnvData* pEnvData = GetSystemData();
SalFrame* pStatusFrame = static_cast<SalFrame*>(pEnvData->pSalFrame);
Point aPoint = updatePosition();
pStatusFrame->SetPosSize( aPoint.X(), aPoint.Y(), m_aWindowSize.Width(), m_aWindowSize.Height(), SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y | SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT );
}
}
}
IMPL_LINK_NOARG(XIMStatusWindow, DelayedShowHdl, void*, void)
{
m_nDelayedEvent = nullptr;
const SystemEnvData* pData = GetSystemData();
SalFrame* pStatusFrame = static_cast<SalFrame*>(pData->pSalFrame);
if( m_bDelayedShow )
{
Size aControlSize( m_aWindowSize.Width()-4, m_aWindowSize.Height()-4 );
m_aStatusText->SetPosSizePixel( Point( 1, 1 ), aControlSize );
Point aPoint = updatePosition();
pStatusFrame->SetPosSize( aPoint.X(), aPoint.Y(), m_aWindowSize.Width(), m_aWindowSize.Height(), SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y | SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT );
}
Show( m_bDelayedShow && m_bOn, ShowFlags::NoActivate );
if( m_bDelayedShow )
{
XRaiseWindow( static_cast<Display*>(pData->pDisplay),
static_cast<::Window>(pData->aShellWindow) );
}
}
void XIMStatusWindow::show( bool bShow, I18NStatus::ShowReason )
{
if( bShow && m_aStatusText->GetText().isEmpty() )
bShow = false;
m_bDelayedShow = bShow;
if( ! m_nDelayedEvent )
m_nDelayedEvent = Application::PostUserEvent( LINK( this, XIMStatusWindow, DelayedShowHdl ), nullptr, true );
}
void XIMStatusWindow::setText( const OUString& rText )
{
m_aStatusText->SetText( rText );
m_aWindowSize.setWidth( m_aStatusText->GetTextWidth( rText )+8 );
}
/*
* I18NStatus
*/
static I18NStatus* g_pI18NStatusInstance = nullptr;
I18NStatus& I18NStatus::get()
{
if (!g_pI18NStatusInstance)
g_pI18NStatusInstance = new I18NStatus();
return *g_pI18NStatusInstance;
}
bool I18NStatus::exists()
{
return g_pI18NStatusInstance != nullptr;
}
void I18NStatus::free()
{
if (g_pI18NStatusInstance)
{
delete g_pI18NStatusInstance;
g_pI18NStatusInstance = nullptr;
}
}
I18NStatus::I18NStatus() :
m_pParent( nullptr ),
m_pStatusWindow( nullptr )
{
}
I18NStatus::~I18NStatus()
{
m_pStatusWindow.disposeAndClear();
if( g_pI18NStatusInstance == this )
g_pI18NStatusInstance = nullptr;
}
void I18NStatus::setParent( SalFrame* pParent )
{
m_pParent = pParent;
if( ! m_pStatusWindow )
{
m_pStatusWindow = VclPtr<XIMStatusWindow>::Create( getStatusWindowMode() );
setStatusText( m_aCurrentIM );
}
m_pStatusWindow->setPosition( m_pParent );
}
void I18NStatus::show( bool bShow, ShowReason eReason )
{
if( m_pStatusWindow )
{
m_pStatusWindow->setPosition( m_pParent );
m_pStatusWindow->show( bShow, eReason );
}
}
void I18NStatus::setStatusText( const OUString& rText )
{
if( m_pStatusWindow )
{
/*
* #93614# convert fullwidth ASCII forms to ascii
*/
int nChars = rText.getLength();
rtl_uString *pStr = rtl_uString_alloc(nChars);
sal_Unicode *pBuffer = pStr->buffer;
for( int i = 0; i < nChars; i++ )
{
if( rText[i] >=0xff00 && rText[i] <= 0xff5f )
pBuffer[i] = (rText[i] & 0xff) + 0x20;
else
pBuffer[i] = rText[i];
}
OUString aText(pStr, SAL_NO_ACQUIRE);
m_pStatusWindow->setText( aText );
m_pStatusWindow->setPosition( m_pParent );
bool bVisible = true;
if( m_pParent )
{
long w, h;
m_pParent->GetClientSize( w, h );
if( w == 0 || h == 0 )
{
bVisible = false;
}
}
m_pStatusWindow->show( bVisible, contextmap );
}
}
SalFrame* I18NStatus::getStatusFrame() const
{
SalFrame* pRet = nullptr;
if( m_pStatusWindow )
{
const SystemEnvData* pData = m_pStatusWindow->GetSystemData();
pRet = static_cast<SalFrame*>(pData->pSalFrame);
}
return pRet;
}
void I18NStatus::toggleStatusWindow()
{
if (m_pStatusWindow != nullptr)
m_pStatusWindow->toggle(getStatusWindowMode());
}
bool I18NStatus::getStatusWindowMode()
{
switch (ImplGetSVData()->maAppData.meShowImeStatusWindow)
{
default: // ImplSVAppData::ImeStatusWindowMode_UNKNOWN
return Application::GetShowImeStatusWindowDefault();
case ImplSVAppData::ImeStatusWindowMode_HIDE:
return false;
case ImplSVAppData::ImeStatusWindowMode_SHOW:
return true;
}
}
/*
* X11ImeStatus
*/
X11ImeStatus::~X11ImeStatus()
{
vcl::I18NStatus::free();
}
bool X11ImeStatus::canToggle()
{
return true;
}
void X11ImeStatus::toggle()
{
vcl::I18NStatus::get().toggleStatusWindow();
}
std::unique_ptr<SalI18NImeStatus> X11SalInstance::CreateI18NImeStatus()
{
return std::unique_ptr<SalI18NImeStatus>(new X11ImeStatus());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -54,7 +54,6 @@
#include <unx/salbmp.h>
#include <unx/i18n_ic.hxx>
#include <unx/i18n_keysym.hxx>
#include <unx/i18n_status.hxx>
#include <unx/x11/xlimits.hxx>
#include <opengl/zone.hxx>
@@ -915,8 +914,8 @@ X11SalFrame::~X11SalFrame()
if( mpInputContext )
{
mpInputContext->UnsetICFocus( this );
mpInputContext->Unmap( this );
mpInputContext->UnsetICFocus();
mpInputContext->Unmap();
mpInputContext.reset();
}
@@ -948,19 +947,6 @@ X11SalFrame::~X11SalFrame()
}
XDestroyWindow( GetXDisplay(), mhWindow );
/*
* check if there is only the status frame left
* if so, free it
*/
auto &rFrames = GetDisplay()->getFrames();
if( ! rFrames.empty() && vcl::I18NStatus::exists() )
{
SalFrame* pStatusFrame = vcl::I18NStatus::get().getStatusFrame();
auto sit = rFrames.begin();
if( pStatusFrame && *sit == pStatusFrame && ++sit == rFrames.end() )
vcl::I18NStatus::free();
}
}
void X11SalFrame::SetExtendedFrameStyle( SalExtStyle nStyle )
@@ -1373,7 +1359,7 @@ void X11SalFrame::Show( bool bVisible, bool bNoActivate )
else
{
if( getInputContext() )
getInputContext()->Unmap( this );
getInputContext()->Unmap();
if( ! IsChildWindow() )
{
@@ -2228,8 +2214,6 @@ void X11SalFrame::StartPresentation( bool bStart )
mhWindow,
GetXDisplay() );
vcl::I18NStatus::get().show( !bStart, vcl::I18NStatus::presentation );
if( ! bStart && hPresentationWindow != None )
doReparentPresentationDialogues( GetDisplay() );
hPresentationWindow = (bStart && IsOverrideRedirect() ) ? GetWindow() : None;
@@ -2337,7 +2321,7 @@ void X11SalFrame::SetInputContext( SalInputContext* pContext )
if (!(pContext->mnOptions & InputContextFlags::Text))
{
if( mpInputContext )
mpInputContext->Unmap( this );
mpInputContext->Unmap();
return;
}
@@ -2346,8 +2330,6 @@ void X11SalFrame::SetInputContext( SalInputContext* pContext )
if (mpInputContext == nullptr)
{
vcl::I18NStatus& rStatus( vcl::I18NStatus::get() );
rStatus.setParent( this );
mpInputContext.reset( new SalI18N_InputContext( this ) );
if (mpInputContext->UseContext())
{
@@ -2457,8 +2439,8 @@ void X11SalFrame::createNewWindow( ::Window aNewParent, SalX11Screen nXScreen )
updateGraphics(true);
if( mpInputContext )
{
mpInputContext->UnsetICFocus( this );
mpInputContext->Unmap( this );
mpInputContext->UnsetICFocus();
mpInputContext->Unmap();
}
if( GetWindow() == hPresentationWindow )
{
@@ -3324,15 +3306,6 @@ bool X11SalFrame::HandleFocusEvent( XFocusChangeEvent const *pEvent )
{
if( FocusIn == pEvent->type )
mpInputContext->SetICFocus( this );
else
{
/*
* do not unset the IC focus here because would kill
* a lookup choice windows that might have the focus now
* mpInputContext->UnsetICFocus( this );
*/
vcl::I18NStatus::get().show( false, vcl::I18NStatus::focus );
}
}
if ( pEvent->mode == NotifyNormal || pEvent->mode == NotifyWhileGrabbed ||
@@ -3945,17 +3918,6 @@ bool X11SalFrame::Dispatch( XEvent *pEvent )
CallCallback( SalEvent::Resize, nullptr );
bool bSetFocus = m_bSetFocusOnMap;
/* another workaround for sawfish: if a transient window for the same parent is shown
* sawfish does not set the focus to it. Applies only for click to focus mode.
*/
if( ! (nStyle_ & SalFrameStyleFlags::FLOAT ) && mbInShow && GetDisplay()->getWMAdaptor()->getWindowManagerName() == "Sawfish" )
{
// don't set the focus into the IME status window
// since this will lead to a parent loss of focus, close status,
// reget focus, open status, .... flicker loop
if ( vcl::I18NStatus::get().getStatusFrame() != this )
bSetFocus = true;
}
/*
* sometimes a message box/dialogue is brought up when a frame is not mapped
@@ -3999,7 +3961,7 @@ bool X11SalFrame::Dispatch( XEvent *pEvent )
bViewable_ = false;
nRet = true;
if ( mpInputContext != nullptr )
mpInputContext->Unmap( this );
mpInputContext->Unmap();
CallCallback( SalEvent::Resize, nullptr );
}
break;

View File

@@ -31,7 +31,6 @@
#include <unx/gtk/gtksalmenu.hxx>
#include <headless/svpvd.hxx>
#include <headless/svpbmp.hxx>
#include <salimestatus.hxx>
#include <vcl/inputtypes.hxx>
#include <unx/genpspgraphics.h>
#include <rtl/strbuf.hxx>
@@ -233,16 +232,6 @@ SalObject* GtkInstance::CreateObject( SalFrame* pParent, SystemWindowData* pWind
return new GtkSalObject( static_cast<GtkSalFrame*>(pParent), bShow );
}
#if !GTK_CHECK_VERSION(3,0,0)
std::unique_ptr<SalI18NImeStatus> GtkInstance::CreateI18NImeStatus()
{
//we want the default SalInstance::CreateI18NImeStatus returns the no-op
//stub here, not the X11Instance::CreateI18NImeStatus which the gtk2
//one would use otherwise
return SalInstance::CreateI18NImeStatus();
}
#endif
extern "C"
{
typedef void*(* getDefaultFnc)();

View File

@@ -47,7 +47,6 @@
#include <win/salbmp.h>
#include <win/winlayout.hxx>
#include <salimestatus.hxx>
#include <salsys.hxx>
#include <desktop/crashreport.hxx>