fwk: Use constructor feature for LangSelectionStatusbarController.
Change-Id: If7ce3d27f1cec8e55b65fc2d8c749f2e8bb33768
This commit is contained in:
parent
87051bb36a
commit
fb20f52279
@ -1,83 +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_FRAMEWORK_INC_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX
|
|
||||||
#define INCLUDED_FRAMEWORK_INC_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX
|
|
||||||
|
|
||||||
#include <macros/generic.hxx>
|
|
||||||
#include <macros/xinterface.hxx>
|
|
||||||
#include <macros/xtypeprovider.hxx>
|
|
||||||
#include <macros/xserviceinfo.hxx>
|
|
||||||
#include <stdtypes.h>
|
|
||||||
#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
|
|
||||||
#include <svtools/statusbarcontroller.hxx>
|
|
||||||
#include <rtl/ustring.hxx>
|
|
||||||
|
|
||||||
#include "helper/mischelper.hxx"
|
|
||||||
|
|
||||||
#include <set>
|
|
||||||
|
|
||||||
class SvtLanguageTable;
|
|
||||||
|
|
||||||
|
|
||||||
// component helper namespace
|
|
||||||
namespace framework {
|
|
||||||
|
|
||||||
class LangSelectionStatusbarController : public svt::StatusbarController
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit LangSelectionStatusbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
|
|
||||||
|
|
||||||
// XServiceInfo
|
|
||||||
DECLARE_XSERVICEINFO
|
|
||||||
|
|
||||||
// XInitialization
|
|
||||||
virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
|
|
||||||
|
|
||||||
// XStatusListener
|
|
||||||
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
|
|
||||||
|
|
||||||
// XStatusbarController
|
|
||||||
virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos,
|
|
||||||
::sal_Int32 nCommand,
|
|
||||||
::sal_Bool bMouseEvent,
|
|
||||||
const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException);
|
|
||||||
virtual void SAL_CALL click( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException);
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual ~LangSelectionStatusbarController() {}
|
|
||||||
LangSelectionStatusbarController(LangSelectionStatusbarController &); // not defined
|
|
||||||
void operator =(LangSelectionStatusbarController &); // not defined
|
|
||||||
|
|
||||||
|
|
||||||
sal_Bool m_bShowMenu; // if the menu is to be displayed or not (depending on the selected object/text)
|
|
||||||
sal_Int16 m_nScriptType; // the flags for the different script types available in the selection, LATIN = 0x0001, ASIAN = 0x0002, COMPLEX = 0x0004
|
|
||||||
OUString m_aCurLang; // the language of the current selection, "*" if there are more than one languages
|
|
||||||
OUString m_aKeyboardLang; // the keyboard language
|
|
||||||
OUString m_aGuessedTextLang; // the 'guessed' language for the selection, "" if none could be guessed
|
|
||||||
LanguageGuessingHelper m_aLangGuessHelper;
|
|
||||||
|
|
||||||
void LangMenu( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // framework namespace
|
|
||||||
|
|
||||||
#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -62,7 +62,6 @@
|
|||||||
#include <services/sessionlistener.hxx>
|
#include <services/sessionlistener.hxx>
|
||||||
#include <services/taskcreatorsrv.hxx>
|
#include <services/taskcreatorsrv.hxx>
|
||||||
|
|
||||||
#include <uielement/langselectionstatusbarcontroller.hxx>
|
|
||||||
#include <uiconfiguration/imagemanager.hxx>
|
#include <uiconfiguration/imagemanager.hxx>
|
||||||
#include <uifactory/windowcontentfactorymanager.hxx>
|
#include <uifactory/windowcontentfactorymanager.hxx>
|
||||||
#include <services/substitutepathvars.hxx>
|
#include <services/substitutepathvars.hxx>
|
||||||
@ -102,7 +101,6 @@ COMPONENTGETFACTORY ( fwk,
|
|||||||
IFFACTORY( ::framework::SessionListener ) else
|
IFFACTORY( ::framework::SessionListener ) else
|
||||||
IFFACTORY( ::framework::TaskCreatorService ) else
|
IFFACTORY( ::framework::TaskCreatorService ) else
|
||||||
IFFACTORY( ::framework::ImageManager ) else
|
IFFACTORY( ::framework::ImageManager ) else
|
||||||
IFFACTORY( ::framework::LangSelectionStatusbarController ) else
|
|
||||||
IFFACTORY( ::framework::WindowContentFactoryManager ) else
|
IFFACTORY( ::framework::WindowContentFactoryManager ) else
|
||||||
IFFACTORY( ::framework::SubstitutePathVariables ) else
|
IFFACTORY( ::framework::SubstitutePathVariables ) else
|
||||||
IFFACTORY( ::framework::PathSettings ) else
|
IFFACTORY( ::framework::PathSettings ) else
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <uielement/langselectionstatusbarcontroller.hxx>
|
|
||||||
#include <classes/fwkresid.hxx>
|
#include <classes/fwkresid.hxx>
|
||||||
#include <services.h>
|
#include <services.h>
|
||||||
#include <classes/resource.hrc>
|
#include <classes/resource.hrc>
|
||||||
@ -28,11 +27,12 @@
|
|||||||
#include <vcl/status.hxx>
|
#include <vcl/status.hxx>
|
||||||
#include <toolkit/helper/convert.hxx>
|
#include <toolkit/helper/convert.hxx>
|
||||||
|
|
||||||
#include <com/sun/star/frame/XPopupMenuController.hpp>
|
#include <cppuhelper/supportsservice.hxx>
|
||||||
#include <toolkit/helper/vclunohelper.hxx>
|
#include <toolkit/helper/vclunohelper.hxx>
|
||||||
#include <com/sun/star/awt/PopupMenu.hpp>
|
#include <com/sun/star/awt/PopupMenu.hpp>
|
||||||
#include <com/sun/star/awt/PopupMenuDirection.hpp>
|
#include <com/sun/star/awt/PopupMenuDirection.hpp>
|
||||||
#include <svtools/langtab.hxx>
|
#include <svtools/langtab.hxx>
|
||||||
|
#include <svtools/statusbarcontroller.hxx>
|
||||||
#include "sal/types.h"
|
#include "sal/types.h"
|
||||||
#include <com/sun/star/awt/MenuItemStyle.hpp>
|
#include <com/sun/star/awt/MenuItemStyle.hpp>
|
||||||
#include <com/sun/star/document/XDocumentLanguages.hpp>
|
#include <com/sun/star/document/XDocumentLanguages.hpp>
|
||||||
@ -49,36 +49,88 @@
|
|||||||
#include <tools/gen.hxx>
|
#include <tools/gen.hxx>
|
||||||
#include <com/sun/star/awt/Command.hpp>
|
#include <com/sun/star/awt/Command.hpp>
|
||||||
#include <svl/languageoptions.hxx>
|
#include <svl/languageoptions.hxx>
|
||||||
#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
|
|
||||||
|
|
||||||
#include "helper/mischelper.hxx"
|
#include "helper/mischelper.hxx"
|
||||||
|
|
||||||
#include <rtl/ustrbuf.hxx>
|
#include <rtl/ustrbuf.hxx>
|
||||||
|
#include <rtl/ref.hxx>
|
||||||
|
|
||||||
|
#include <macros/generic.hxx>
|
||||||
|
#include <macros/xinterface.hxx>
|
||||||
|
#include <macros/xtypeprovider.hxx>
|
||||||
|
#include <macros/xserviceinfo.hxx>
|
||||||
|
#include <stdtypes.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
using namespace ::cppu;
|
using namespace ::cppu;
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
using namespace ::com::sun::star::uno;
|
using namespace css::uno;
|
||||||
using namespace ::com::sun::star::lang;
|
using namespace css::lang;
|
||||||
using namespace ::com::sun::star::frame;
|
using namespace css::frame;
|
||||||
using namespace ::com::sun::star::i18n;
|
using namespace css::i18n;
|
||||||
using namespace ::com::sun::star::document;
|
using namespace css::document;
|
||||||
|
using namespace framework;
|
||||||
|
|
||||||
using ::rtl::OUStringBuffer;
|
class SvtLanguageTable;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
namespace framework
|
class LangSelectionStatusbarController : public svt::StatusbarController
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
explicit LangSelectionStatusbarController( const css::uno::Reference< css::uno::XComponentContext >& xContext );
|
||||||
|
|
||||||
DEFINE_XSERVICEINFO_MULTISERVICE_2 ( LangSelectionStatusbarController ,
|
// XServiceInfo
|
||||||
OWeakObject ,
|
virtual OUString SAL_CALL getImplementationName()
|
||||||
SERVICENAME_STATUSBARCONTROLLER ,
|
throw (css::uno::RuntimeException)
|
||||||
IMPLEMENTATIONNAME_LANGSELECTIONSTATUSBARCONTROLLER
|
{
|
||||||
)
|
return OUString("com.sun.star.comp.framework.LangSelectionStatusbarController");
|
||||||
|
}
|
||||||
|
|
||||||
DEFINE_INIT_SERVICE ( LangSelectionStatusbarController, {} )
|
virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
|
||||||
|
throw (css::uno::RuntimeException)
|
||||||
|
{
|
||||||
|
return ServiceName == "com.sun.star.frame.StatusbarController";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
|
||||||
|
throw (css::uno::RuntimeException)
|
||||||
|
{
|
||||||
|
css::uno::Sequence< OUString > aSeq(1);
|
||||||
|
aSeq[0] = OUString("com.sun.star.frame.StatusbarController");
|
||||||
|
return aSeq;
|
||||||
|
}
|
||||||
|
|
||||||
|
// XInitialization
|
||||||
|
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException);
|
||||||
|
|
||||||
|
// XStatusListener
|
||||||
|
virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException );
|
||||||
|
|
||||||
|
// XStatusbarController
|
||||||
|
virtual void SAL_CALL command( const css::awt::Point& aPos,
|
||||||
|
::sal_Int32 nCommand,
|
||||||
|
::sal_Bool bMouseEvent,
|
||||||
|
const css::uno::Any& aData ) throw (css::uno::RuntimeException);
|
||||||
|
virtual void SAL_CALL click( const css::awt::Point& aPos ) throw (css::uno::RuntimeException);
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual ~LangSelectionStatusbarController() {}
|
||||||
|
LangSelectionStatusbarController(LangSelectionStatusbarController &); // not defined
|
||||||
|
void operator =(LangSelectionStatusbarController &); // not defined
|
||||||
|
|
||||||
|
|
||||||
|
sal_Bool m_bShowMenu; // if the menu is to be displayed or not (depending on the selected object/text)
|
||||||
|
sal_Int16 m_nScriptType; // the flags for the different script types available in the selection, LATIN = 0x0001, ASIAN = 0x0002, COMPLEX = 0x0004
|
||||||
|
OUString m_aCurLang; // the language of the current selection, "*" if there are more than one languages
|
||||||
|
OUString m_aKeyboardLang; // the keyboard language
|
||||||
|
OUString m_aGuessedTextLang; // the 'guessed' language for the selection, "" if none could be guessed
|
||||||
|
LanguageGuessingHelper m_aLangGuessHelper;
|
||||||
|
|
||||||
|
void LangMenu( const css::awt::Point& aPos ) throw (css::uno::RuntimeException);
|
||||||
|
};
|
||||||
|
|
||||||
LangSelectionStatusbarController::LangSelectionStatusbarController( const uno::Reference< uno::XComponentContext >& xContext ) :
|
LangSelectionStatusbarController::LangSelectionStatusbarController( const uno::Reference< uno::XComponentContext >& xContext ) :
|
||||||
svt::StatusbarController( xContext, uno::Reference< frame::XFrame >(), OUString(), 0 ),
|
svt::StatusbarController( xContext, uno::Reference< frame::XFrame >(), OUString(), 0 ),
|
||||||
@ -88,8 +140,8 @@ LangSelectionStatusbarController::LangSelectionStatusbarController( const uno::R
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL LangSelectionStatusbarController::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
|
void SAL_CALL LangSelectionStatusbarController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
|
||||||
throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
|
throw (css::uno::Exception, css::uno::RuntimeException)
|
||||||
{
|
{
|
||||||
SolarMutexGuard aSolarMutexGuard;
|
SolarMutexGuard aSolarMutexGuard;
|
||||||
|
|
||||||
@ -102,8 +154,8 @@ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LangSelectionStatusbarController::LangMenu(
|
void LangSelectionStatusbarController::LangMenu(
|
||||||
const ::com::sun::star::awt::Point& aPos )
|
const css::awt::Point& aPos )
|
||||||
throw (::com::sun::star::uno::RuntimeException)
|
throw (css::uno::RuntimeException)
|
||||||
{
|
{
|
||||||
if (!m_bShowMenu)
|
if (!m_bShowMenu)
|
||||||
return;
|
return;
|
||||||
@ -237,11 +289,11 @@ throw (::com::sun::star::uno::RuntimeException)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL LangSelectionStatusbarController::command(
|
void SAL_CALL LangSelectionStatusbarController::command(
|
||||||
const ::com::sun::star::awt::Point& aPos,
|
const css::awt::Point& aPos,
|
||||||
::sal_Int32 nCommand,
|
::sal_Int32 nCommand,
|
||||||
::sal_Bool /*bMouseEvent*/,
|
::sal_Bool /*bMouseEvent*/,
|
||||||
const ::com::sun::star::uno::Any& /*aData*/ )
|
const css::uno::Any& /*aData*/ )
|
||||||
throw (::com::sun::star::uno::RuntimeException)
|
throw (css::uno::RuntimeException)
|
||||||
{
|
{
|
||||||
if ( nCommand & ::awt::Command::CONTEXTMENU )
|
if ( nCommand & ::awt::Command::CONTEXTMENU )
|
||||||
{
|
{
|
||||||
@ -250,8 +302,8 @@ throw (::com::sun::star::uno::RuntimeException)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL LangSelectionStatusbarController::click(
|
void SAL_CALL LangSelectionStatusbarController::click(
|
||||||
const ::com::sun::star::awt::Point& aPos )
|
const css::awt::Point& aPos )
|
||||||
throw (::com::sun::star::uno::RuntimeException)
|
throw (css::uno::RuntimeException)
|
||||||
{
|
{
|
||||||
LangMenu( aPos );
|
LangMenu( aPos );
|
||||||
}
|
}
|
||||||
@ -311,4 +363,14 @@ throw ( RuntimeException )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
|
||||||
|
com_sun_star_comp_framework_LangSelectionStatusbarController_get_implementation(
|
||||||
|
css::uno::XComponentContext *context,
|
||||||
|
css::uno::Sequence<css::uno::Any> const &)
|
||||||
|
{
|
||||||
|
rtl::Reference<LangSelectionStatusbarController> x(new LangSelectionStatusbarController(context));
|
||||||
|
x->acquire();
|
||||||
|
return static_cast<cppu::OWeakObject *>(x.get());
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@ -53,7 +53,8 @@
|
|||||||
<implementation name="com.sun.star.comp.framework.JobExecutor">
|
<implementation name="com.sun.star.comp.framework.JobExecutor">
|
||||||
<service name="com.sun.star.task.JobExecutor"/>
|
<service name="com.sun.star.task.JobExecutor"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
<implementation name="com.sun.star.comp.framework.LangSelectionStatusbarController">
|
<implementation name="com.sun.star.comp.framework.LangSelectionStatusbarController"
|
||||||
|
constructor="com_sun_star_comp_framework_LangSelectionStatusbarController_get_implementation">
|
||||||
<service name="com.sun.star.frame.StatusbarController"/>
|
<service name="com.sun.star.frame.StatusbarController"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
<implementation name="com.sun.star.comp.framework.LayoutManager">
|
<implementation name="com.sun.star.comp.framework.LayoutManager">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user