diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index a3b3ceb..7a572d8 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -50,6 +50,7 @@ #include "migration.hxx" #include +#include #include #include #include @@ -139,8 +140,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -3153,6 +3156,54 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) if( pD ) pD->doShutdown(); } +#ifdef MACOSX + else if( rAppEvent.GetEvent() == "TOGGLEFULLSCREEN" ) + { + SfxViewFrame *pTop = SfxViewFrame::Current()->GetTopViewFrame(); + if ( pTop ) + { + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame().GetSystemWindow(); + if ( pWork ) + { + com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( + SfxViewFrame::Current()->GetFrame().GetFrameInterface(), + com::sun::star::uno::UNO_QUERY); + + Reference< ::com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); + Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; + if ( xPropSet.is() ) + { + try + { + Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); + aValue >>= xLayoutManager; + } + catch ( css::uno::Exception& ) + { + } + } + sal_Bool bNewFullScreenMode = rAppEvent.GetData().EqualsAscii( "ENTER" ); + if ( bNewFullScreenMode != !pWork->IsFullScreenMode() ) + { + Reference< ::com::sun::star::beans::XPropertySet > xLMPropSet( xLayoutManager, UNO_QUERY ); + if ( xLMPropSet.is() ) + { + try + { + xLMPropSet->setPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HideCurrentUI" )), + makeAny( bNewFullScreenMode )); + } + catch ( ::com::sun::star::beans::UnknownPropertyException& ) + { + } + } + pWork->SetMenuBarMode( bNewFullScreenMode ? MENUBAR_MODE_HIDE : MENUBAR_MODE_NORMAL ); + } + } + } + } +#endif } void Desktop::OpenSplashScreen()