add close option to findbar in Writer
Change-Id: Ie42da7ecc7f3cb59bb6f1fb798e72a6862eb1f67 Reviewed-on: https://gerrit.libreoffice.org/1557 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
BIN
icon-themes/galaxy/cmd/lc_exitsearch.png
Normal file
BIN
icon-themes/galaxy/cmd/lc_exitsearch.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@@ -396,6 +396,17 @@
|
||||
<value>com.sun.star.svx.DownSearchToolboxController</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="com.sun.star.svx.ExitFindbarToolboxController" oor:op="replace">
|
||||
<prop oor:name="Command">
|
||||
<value>.uno:ExitSearch</value>
|
||||
</prop>
|
||||
<prop oor:name="Module">
|
||||
<value/>
|
||||
</prop>
|
||||
<prop oor:name="Controller">
|
||||
<value>com.sun.star.svx.ExitFindbarToolboxController</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="com.sun.star.svx.UpSearchToolboxController" oor:op="replace">
|
||||
<prop oor:name="Command">
|
||||
<value>.uno:UpSearch</value>
|
||||
|
@@ -1471,6 +1471,14 @@
|
||||
<value>1</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name=".uno:ExitSearch" oor:op="replace">
|
||||
<prop oor:name="Label" oor:type="xs:string">
|
||||
<value xml:lang="en-US">Exit Search</value>
|
||||
</prop>
|
||||
<prop oor:name="Properties" oor:type="xs:int">
|
||||
<value>1</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="vnd.sun.star.findbar:FocusToFindbar" oor:op="replace">
|
||||
<prop oor:name="Label" oor:type="xs:string">
|
||||
<value xml:lang="en-US">~Find...</value>
|
||||
|
@@ -135,6 +135,48 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class ExitSearchToolboxController : public svt::ToolboxController,
|
||||
public css::lang::XServiceInfo
|
||||
{
|
||||
public:
|
||||
enum Type { EXIT };
|
||||
|
||||
ExitSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager, Type eType );
|
||||
~ExitSearchToolboxController();
|
||||
|
||||
// XInterface
|
||||
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException );
|
||||
virtual void SAL_CALL acquire() throw ();
|
||||
virtual void SAL_CALL release() throw ();
|
||||
|
||||
// XServiceInfo
|
||||
virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException );
|
||||
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException );
|
||||
virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException );
|
||||
|
||||
static ::rtl::OUString getImplementationName_Static( ) throw()
|
||||
{
|
||||
return ::rtl::OUString( "com.sun.star.svx.ExitFindbarToolboxController" );
|
||||
}
|
||||
|
||||
static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
|
||||
|
||||
// XComponent
|
||||
virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException );
|
||||
|
||||
// XInitialization
|
||||
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException);
|
||||
|
||||
// XToolbarController
|
||||
virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException );
|
||||
|
||||
// XStatusListener
|
||||
virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException );
|
||||
|
||||
private:
|
||||
Type meType;
|
||||
};
|
||||
|
||||
class UpDownSearchToolboxController : public svt::ToolboxController,
|
||||
public css::lang::XServiceInfo
|
||||
{
|
||||
@@ -231,6 +273,7 @@ private:
|
||||
css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
|
||||
css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
|
||||
css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
|
||||
css::uno::Reference< css::uno::XInterface > SAL_CALL ExitFindbarToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
|
||||
css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
|
||||
|
||||
}
|
||||
|
@@ -47,6 +47,7 @@ static const char COMMAND_EXECUTESEARCH[] = ".uno:ExecuteSearch";
|
||||
static const char COMMAND_FINDTEXT[] = ".uno:FindText";
|
||||
static const char COMMAND_DOWNSEARCH[] = ".uno:DownSearch";
|
||||
static const char COMMAND_UPSEARCH[] = ".uno:UpSearch";
|
||||
static const char COMMAND_EXITSEARCH[] = ".uno:ExitSearch";
|
||||
static const char COMMAND_APPENDSEARCHHISTORY[] = "AppendSearchHistory";
|
||||
|
||||
static const sal_Int32 REMEMBER_SIZE = 10;
|
||||
@@ -477,7 +478,7 @@ IMPL_LINK_NOARG(FindTextToolbarController, EditModifyHdl)
|
||||
UpDownSearchToolboxController::UpDownSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager, Type eType )
|
||||
: svt::ToolboxController( rServiceManager,
|
||||
css::uno::Reference< css::frame::XFrame >(),
|
||||
(eType == UP) ? rtl::OUString( COMMAND_UPSEARCH ): rtl::OUString( COMMAND_DOWNSEARCH ) ),
|
||||
(eType == UP) ? rtl::OUString( COMMAND_UPSEARCH ): rtl::OUString( COMMAND_DOWNSEARCH ) ),
|
||||
meType( eType )
|
||||
{
|
||||
}
|
||||
@@ -602,6 +603,120 @@ void SAL_CALL UpDownSearchToolboxController::statusChanged( const css::frame::Fe
|
||||
if ( m_bDisposed )
|
||||
return;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
// class ExitSearchToolboxController
|
||||
|
||||
ExitSearchToolboxController::ExitSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager, Type eType )
|
||||
: svt::ToolboxController( rServiceManager,
|
||||
css::uno::Reference< css::frame::XFrame >(),
|
||||
rtl::OUString( COMMAND_EXITSEARCH ) ),
|
||||
meType( eType )
|
||||
{
|
||||
}
|
||||
|
||||
ExitSearchToolboxController::~ExitSearchToolboxController()
|
||||
{
|
||||
}
|
||||
|
||||
// XInterface
|
||||
css::uno::Any SAL_CALL ExitSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException )
|
||||
{
|
||||
css::uno::Any a = ToolboxController::queryInterface( aType );
|
||||
if ( a.hasValue() )
|
||||
return a;
|
||||
|
||||
return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) );
|
||||
}
|
||||
|
||||
void SAL_CALL ExitSearchToolboxController::acquire() throw ()
|
||||
{
|
||||
ToolboxController::acquire();
|
||||
}
|
||||
|
||||
void SAL_CALL ExitSearchToolboxController::release() throw ()
|
||||
{
|
||||
ToolboxController::release();
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
::rtl::OUString SAL_CALL ExitSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException )
|
||||
{
|
||||
return getImplementationName_Static( );
|
||||
}
|
||||
|
||||
|
||||
sal_Bool SAL_CALL ExitSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException )
|
||||
{
|
||||
const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
|
||||
const ::rtl::OUString * pArray = aSNL.getConstArray();
|
||||
|
||||
for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
|
||||
if( pArray[i] == ServiceName )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
css::uno::Sequence< ::rtl::OUString > SAL_CALL ExitSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException )
|
||||
{
|
||||
return getSupportedServiceNames_Static();
|
||||
}
|
||||
|
||||
css::uno::Sequence< ::rtl::OUString > ExitSearchToolboxController::getSupportedServiceNames_Static() throw()
|
||||
{
|
||||
css::uno::Sequence< ::rtl::OUString > aSNS( 1 );
|
||||
aSNS.getArray()[0] = ::rtl::OUString("com.sun.star.frame.ToolbarController");
|
||||
return aSNS;
|
||||
}
|
||||
|
||||
// XComponent
|
||||
void SAL_CALL ExitSearchToolboxController::dispose() throw ( css::uno::RuntimeException )
|
||||
{
|
||||
SolarMutexGuard aSolarMutexGuard;
|
||||
|
||||
SearchToolbarControllersManager::createControllersManager().freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
|
||||
|
||||
svt::ToolboxController::dispose();
|
||||
}
|
||||
|
||||
// XInitialization
|
||||
void SAL_CALL ExitSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException )
|
||||
{
|
||||
svt::ToolboxController::initialize( aArguments );
|
||||
SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
|
||||
}
|
||||
|
||||
// XToolbarController
|
||||
void SAL_CALL ExitSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException )
|
||||
{
|
||||
Window *pFocusWindow = Application::GetFocusWindow();
|
||||
if ( pFocusWindow )
|
||||
pFocusWindow->GrabFocusToDocument();
|
||||
|
||||
// hide the findbar
|
||||
css::uno::Reference< css::beans::XPropertySet > xPropSet(m_xFrame, css::uno::UNO_QUERY);
|
||||
if (xPropSet.is())
|
||||
{
|
||||
css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
|
||||
css::uno::Any aValue = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) );
|
||||
aValue >>= xLayoutManager;
|
||||
if (xLayoutManager.is())
|
||||
{
|
||||
const ::rtl::OUString sResourceURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/findbar" ) );
|
||||
xLayoutManager->hideElement( sResourceURL );
|
||||
xLayoutManager->destroyElement( sResourceURL );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XStatusListener
|
||||
void SAL_CALL ExitSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException )
|
||||
{
|
||||
SolarMutexGuard aSolarMutexGuard;
|
||||
if ( m_bDisposed )
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
// class FindbarDispatcher
|
||||
@@ -749,7 +864,6 @@ void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -787,6 +901,12 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_c
|
||||
rSMgr, UpDownSearchToolboxController::UP ) );
|
||||
}
|
||||
|
||||
css::uno::Reference< css::uno::XInterface > SAL_CALL ExitFindbarToolboxController_createInstance(
|
||||
const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
|
||||
{
|
||||
return *new ExitSearchToolboxController( rSMgr, ExitSearchToolboxController::EXIT );
|
||||
}
|
||||
|
||||
css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance(
|
||||
const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
|
||||
{
|
||||
|
@@ -306,6 +306,13 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svx_component_getFactory (
|
||||
svx::UpSearchToolboxController_createInstance,
|
||||
svx::UpDownSearchToolboxController::getSupportedServiceNames_Static() );
|
||||
}
|
||||
else if ( svx::ExitSearchToolboxController::getImplementationName_Static().equalsAscii( pImplName ) )
|
||||
{
|
||||
xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
|
||||
svx::ExitSearchToolboxController::getImplementationName_Static(),
|
||||
svx::ExitFindbarToolboxController_createInstance,
|
||||
svx::ExitSearchToolboxController::getSupportedServiceNames_Static() );
|
||||
}
|
||||
else if ( svx::FindbarDispatcher::getImplementationName_Static().equalsAscii( pImplName ) )
|
||||
{
|
||||
xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
|
||||
|
@@ -64,4 +64,7 @@
|
||||
<implementation name="com.sun.star.svx.UpSearchToolboxController">
|
||||
<service name="com.sun.star.frame.ToolbarController"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.svx.ExitFindbarToolboxController">
|
||||
<service name="com.sun.star.frame.ToolbarController"/>
|
||||
</implementation>
|
||||
</component>
|
||||
|
@@ -21,6 +21,7 @@
|
||||
<toolbar:toolbaritem xlink:href=".uno:FindText"/>
|
||||
<toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
|
||||
<toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
|
||||
<toolbar:toolbaritem xlink:href=".uno:ExitSearch"/>
|
||||
<toolbar:toolbarseparator/>
|
||||
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
|
||||
</toolbar:toolbar>
|
||||
|
Reference in New Issue
Block a user