diff options
author | Tim Hardeck <thardeck@suse.com> | 2011-11-15 20:42:00 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2011-11-16 10:04:49 +0000 |
commit | c269a684f12c331a5d90a36e50a6275b072886f8 (patch) | |
tree | 2439cbd029385163c7e2ae6a66e869b6fd02cd1c /sw | |
parent | 34578b7c2706d2cca95eeb266aeb0498078bb55a (diff) |
Hide Navigation toolbar until needed
Hide Navigation toolbar until there is something to navigate.
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/wrtsh/navmgr.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sw/source/ui/wrtsh/navmgr.cxx b/sw/source/ui/wrtsh/navmgr.cxx index 2ef5b17d5ef4..f465463f212d 100644 --- a/sw/source/ui/wrtsh/navmgr.cxx +++ b/sw/source/ui/wrtsh/navmgr.cxx @@ -35,6 +35,10 @@ #include <cmdid.h> #include <view.hxx> +#include <com/sun/star/frame/XLayoutManager.hpp> + +namespace css = ::com::sun::star; + /** * If SMART is defined, the navigation history has recency with temporal ordering enhancement, * as described on http://zing.ncsl.nist.gov/hfweb/proceedings/greenberg/ @@ -219,6 +223,31 @@ bool SwNavigationMgr::addEntry(const SwPosition& rPos) { _pMyShell->GetView().GetViewFrame()->GetBindings().Invalidate(FN_NAVIGATION_BACK); if (bForwardWasEnabled) _pMyShell->GetView().GetViewFrame()->GetBindings().Invalidate(FN_NAVIGATION_FORWARD); + + /* show the Navigation toolbar */ + css::uno::Reference< css::frame::XFrame > xFrame = _pMyShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); + if (xFrame.is()) + { + css::uno::Reference< css::beans::XPropertySet > xPropSet(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/navigationobjectbar" ) ); + css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL); + if (!xUIElement.is()) + { + xLayoutManager->createElement( sResourceURL ); + xLayoutManager->showElement( sResourceURL ); + } + } + } + } + return bRet; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |