Kaydet (Commit) e8352a90 authored tarafından Andrzej J.R. Hunt's avatar Andrzej J.R. Hunt Kaydeden (comit) Jan Holesovsky

fdo#64451 Add "Find All" to the Find bar.

Change-Id: I7a5f2881d2aa77f2d5c6c302c8eac1162b194bcf
Reviewed-on: https://gerrit.libreoffice.org/4016Reviewed-by: 's avatarJan Holesovsky <kendy@suse.cz>
Tested-by: 's avatarJan Holesovsky <kendy@suse.cz>
üst 3f923bf9
......@@ -22,6 +22,7 @@
<toolbar:toolbaritem xlink:href=".uno:FindText"/>
<toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
<toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
<toolbar:toolbaritem xlink:href=".uno:FindAll"/>
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
......
......@@ -440,6 +440,17 @@
<value>com.sun.star.svx.MatchCaseToolboxController</value>
</prop>
</node>
<node oor:name="com.sun.star.svx.FindAllToolboxController" oor:op="replace">
<prop oor:name="Command">
<value>.uno:FindAll</value>
</prop>
<prop oor:name="Module">
<value/>
</prop>
<prop oor:name="Controller">
<value>com.sun.star.svx.FindAllToolboxController</value>
</prop>
</node>
<node oor:name="c4" oor:op="replace" install:module="reportbuilder">
<prop oor:name="Command">
<value>.uno:FontColor</value>
......
......@@ -1483,6 +1483,11 @@
<value xml:lang="en-US">Match Case</value>
</prop>
</node>
<node oor:name=".uno:FindAll" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Find All</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>
......
......@@ -23,6 +23,7 @@
<toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
<toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbaritem xlink:href=".uno:FindAll"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
</toolbar:toolbar>
......@@ -22,6 +22,7 @@
<toolbar:toolbaritem xlink:href=".uno:FindText"/>
<toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
<toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
<toolbar:toolbaritem xlink:href=".uno:FindAll"/>
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
......
......@@ -22,6 +22,7 @@
<toolbar:toolbaritem xlink:href=".uno:FindText"/>
<toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
<toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
<toolbar:toolbaritem xlink:href=".uno:FindAll"/>
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
......
......@@ -257,6 +257,43 @@ private:
CheckBox* m_pMatchCaseControl;
};
class FindAllToolboxController : public svt::ToolboxController,
public css::lang::XServiceInfo
{
public:
FindAllToolboxController( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
~FindAllToolboxController();
// 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 OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException );
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException );
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException );
static OUString getImplementationName_Static( ) throw()
{
return OUString( "com.sun.star.svx.FindAllToolboxController" );
}
static css::uno::Sequence< 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 );
};
// protocol handler for "vnd.sun.star.findbar:*" URLs
// The dispatch object will be used for shortcut commands for findbar
class FindbarDispatcher : public css::lang::XServiceInfo,
......@@ -310,6 +347,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_c
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 MatchCaseToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
css::uno::Reference< css::uno::XInterface > SAL_CALL FindAllToolboxController_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 );
......
......@@ -31,6 +31,7 @@
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <svl/srchitem.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/svapp.hxx>
......@@ -40,6 +41,7 @@
namespace svx
{
static const char SEARCHITEM_COMMAND[] = "SearchItem.Command";
static const char SEARCHITEM_SEARCHSTRING[] = "SearchItem.SearchString";
static const char SEARCHITEM_SEARCHBACKWARD[] = "SearchItem.Backward";
static const char SEARCHITEM_SEARCHFLAGS[] = "SearchItem.SearchFlags";
......@@ -58,7 +60,8 @@ static const sal_Int32 REMEMBER_SIZE = 10;
void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
const css::uno::Reference< css::frame::XFrame >& xFrame,
const ToolBox* pToolBox,
const sal_Bool aSearchBackwards = false )
const sal_Bool aSearchBackwards = false,
const sal_Bool aFindAll = false )
{
css::uno::Reference< css::util::XURLTransformer > xURLTransformer( css::util::URLTransformer::create( rxContext ) );
css::util::URL aURL;
......@@ -87,7 +90,7 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
}
}
css::uno::Sequence< css::beans::PropertyValue > lArgs(4);
css::uno::Sequence< css::beans::PropertyValue > lArgs(5);
lArgs[0].Name = OUString(SEARCHITEM_SEARCHSTRING);
lArgs[0].Value <<= sFindText;
lArgs[1].Name = OUString(SEARCHITEM_SEARCHBACKWARD);
......@@ -97,6 +100,9 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
lArgs[3].Name = OUString(SEARCHITEM_TRANSLITERATEFLAGS);
lArgs[3].Value <<= (sal_Int32)(!aMatchCase ?
com::sun::star::i18n::TransliterationModules_IGNORE_CASE : 0);
lArgs[4].Name = OUString(SEARCHITEM_COMMAND);
lArgs[4].Value <<= (sal_Int16)(aFindAll ?
SVX_SEARCHCMD_FIND_ALL : SVX_SEARCHCMD_FIND );
css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY);
if ( xDispatchProvider.is() )
......@@ -725,6 +731,109 @@ void SAL_CALL MatchCaseToolboxController::statusChanged( const css::frame::Featu
return;
}
//-----------------------------------------------------------------------------------------------------------
// class FindAllToolboxController
FindAllToolboxController::FindAllToolboxController( const css::uno::Reference< css::uno::XComponentContext > & rxContext )
: svt::ToolboxController( rxContext,
css::uno::Reference< css::frame::XFrame >(),
OUString( COMMAND_EXITSEARCH ) )
{
}
FindAllToolboxController::~FindAllToolboxController()
{
}
// XInterface
css::uno::Any SAL_CALL FindAllToolboxController::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 FindAllToolboxController::acquire() throw ()
{
ToolboxController::acquire();
}
void SAL_CALL FindAllToolboxController::release() throw ()
{
ToolboxController::release();
}
// XServiceInfo
OUString SAL_CALL FindAllToolboxController::getImplementationName() throw( css::uno::RuntimeException )
{
return getImplementationName_Static( );
}
sal_Bool SAL_CALL FindAllToolboxController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException )
{
const css::uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
const OUString * pArray = aSNL.getConstArray();
for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
if( pArray[i] == ServiceName )
return true;
return false;
}
css::uno::Sequence< OUString > SAL_CALL FindAllToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException )
{
return getSupportedServiceNames_Static();
}
css::uno::Sequence< OUString > FindAllToolboxController::getSupportedServiceNames_Static() throw()
{
css::uno::Sequence< OUString > aSNS( 1 );
aSNS.getArray()[0] = OUString("com.sun.star.frame.ToolbarController");
return aSNS;
}
// XComponent
void SAL_CALL FindAllToolboxController::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 FindAllToolboxController::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 FindAllToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException )
{
if ( m_bDisposed )
throw css::lang::DisposedException();
Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
ToolBox* pToolBox = (ToolBox*)pWindow;
impl_executeSearch(m_xContext, m_xFrame, pToolBox, false, true);
}
// XStatusListener
void SAL_CALL FindAllToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException )
{
SolarMutexGuard aSolarMutexGuard;
if ( m_bDisposed )
return;
}
//-----------------------------------------------------------------------------------------------------------
// class ExitSearchToolboxController
......@@ -1028,6 +1137,13 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL MatchCaseToolboxController_
new MatchCaseToolboxController( comphelper::getComponentContext(rSMgr) ) );
}
css::uno::Reference< css::uno::XInterface > SAL_CALL FindAllToolboxController_createInstance(
const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
{
return static_cast< cppu::OWeakObject * >(
new FindAllToolboxController( comphelper::getComponentContext(rSMgr) ) );
}
css::uno::Reference< css::uno::XInterface > SAL_CALL ExitFindbarToolboxController_createInstance(
const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
{
......
......@@ -315,6 +315,13 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svx_component_getFactory (
svx::MatchCaseToolboxController_createInstance,
svx::MatchCaseToolboxController::getSupportedServiceNames_Static() );
}
else if ( svx::FindAllToolboxController::getImplementationName_Static().equalsAscii( pImplName ) )
{
xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
svx::FindAllToolboxController::getImplementationName_Static(),
svx::FindAllToolboxController_createInstance,
svx::FindAllToolboxController::getSupportedServiceNames_Static() );
}
else if ( svx::ExitSearchToolboxController::getImplementationName_Static().equalsAscii( pImplName ) )
{
xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
......
......@@ -61,6 +61,9 @@
<implementation name="com.sun.star.svx.MatchCaseToolboxController">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
<implementation name="com.sun.star.svx.FindAllToolboxController">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
<implementation name="com.sun.star.svx.FontHeightToolBoxController">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
......
......@@ -22,6 +22,7 @@
<toolbar:toolbaritem xlink:href=".uno:FindText"/>
<toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
<toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
<toolbar:toolbaritem xlink:href=".uno:FindAll"/>
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
......
......@@ -22,6 +22,7 @@
<toolbar:toolbaritem xlink:href=".uno:FindText"/>
<toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
<toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
<toolbar:toolbaritem xlink:href=".uno:FindAll"/>
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
......
......@@ -22,6 +22,7 @@
<toolbar:toolbaritem xlink:href=".uno:FindText"/>
<toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
<toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
<toolbar:toolbaritem xlink:href=".uno:FindAll"/>
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
......
......@@ -22,6 +22,7 @@
<toolbar:toolbaritem xlink:href=".uno:FindText"/>
<toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
<toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
<toolbar:toolbaritem xlink:href=".uno:FindAll"/>
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment