summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-03-03 20:20:40 +0100
committerJan Holesovsky <kendy@noe.suse.cz>2011-03-03 23:19:45 +0100
commitd70944362d399911552a627b2e6e6f854e8874e6 (patch)
tree0a78a45aed894f99edb532f6cdab9dd129ae710f /svx/source
parentf6b2932ec8af740c9d96df6d43e92fa438d571e0 (diff)
findbar: Show the find bar on Ctrl-f, hide on Escape.
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx26
1 files changed, 24 insertions, 2 deletions
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index e660646aee31..e43e9e131282 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -139,6 +139,21 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt )
{
nRet = 1;
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 );
+ }
+ }
}
if ( KEY_RETURN == nCode )
@@ -804,10 +819,17 @@ void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css
if (!xLayoutManager.is())
return;
- const ::rtl::OUString sResourceURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/findbar" ));
+ const ::rtl::OUString sResourceURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/findbar" ) );
css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL);
if (!xUIElement.is())
- return;
+ {
+ // show the findbar if necessary
+ xLayoutManager->createElement( sResourceURL );
+ xLayoutManager->showElement( sResourceURL );
+ xUIElement = xLayoutManager->getElement( sResourceURL );
+ if ( !xUIElement.is() )
+ return;
+ }
css::uno::Reference< css::awt::XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY);
Window* pWindow = VCLUnoHelper::GetWindow( xWindow );