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 | |
parent | 34578b7c2706d2cca95eeb266aeb0498078bb55a (diff) |
Hide Navigation toolbar until needed
Hide Navigation toolbar until there is something to navigate.
3 files changed, 33 insertions, 4 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu index e0a10859a683..465244a85cac 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu @@ -660,7 +660,7 @@ <value>true</value> </prop> <prop oor:name="Visible" oor:type="xs:boolean"> - <value>true</value> + <value>false</value> </prop> <prop oor:name="UIName" oor:type="xs:string"> <value xml:lang="en-US">Navigation</value> @@ -669,7 +669,7 @@ <value>false</value> </prop> <prop oor:name="ContextSensitive" oor:type="xs:boolean"> - <value>false</value> + <value>true</value> </prop> </node> </node> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu index 455b97e4f2ab..3bf5e2fde68a 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu @@ -666,7 +666,7 @@ <value>true</value> </prop> <prop oor:name="Visible" oor:type="xs:boolean"> - <value>true</value> + <value>false</value> </prop> <prop oor:name="UIName" oor:type="xs:string"> <value xml:lang="en-US">Navigation</value> @@ -675,7 +675,7 @@ <value>false</value> </prop> <prop oor:name="ContextSensitive" oor:type="xs:boolean"> - <value>false</value> + <value>true</value> </prop> </node> </node> 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: */ |