[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - 3 commits - framework/source
Maxim Monastirsky
momonasmon at gmail.com
Tue Dec 1 10:39:36 PST 2015
framework/source/uielement/saveasmenucontroller.cxx | 82 ++++----------------
1 file changed, 19 insertions(+), 63 deletions(-)
New commits:
commit 91582427dbeccd35bd147ce1a5818f1e15709f13
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Dec 1 00:48:55 2015 +0200
Save Remote File isn't supported in all modules
so don't add it there to the save dropdown.
Change-Id: Iee604cc15616080266f7192ac451f04830ba1bb8
(cherry picked from commit 5a3b930b30149fbcaac246726a0f547527161429)
diff --git a/framework/source/uielement/saveasmenucontroller.cxx b/framework/source/uielement/saveasmenucontroller.cxx
index 1d8936e..5512371 100644
--- a/framework/source/uielement/saveasmenucontroller.cxx
+++ b/framework/source/uielement/saveasmenucontroller.cxx
@@ -83,7 +83,19 @@ void SaveAsMenuController::impl_setPopupMenu()
if ( pVCLPopupMenu )
{
pVCLPopupMenu->InsertItem( ".uno:SaveAs", m_xFrame );
- pVCLPopupMenu->InsertItem( ".uno:SaveAsRemote", m_xFrame );
+
+ // Add Save Remote File command only where it's supported.
+ css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY );
+ if ( xDispatchProvider.is() )
+ {
+ css::util::URL aTargetURL;
+ aTargetURL.Complete = ".uno:SaveAsRemote";
+ m_xURLTransformer->parseStrict( aTargetURL );
+
+ css::uno::Reference< css::frame::XDispatch > xDispatch( xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ) );
+ if ( xDispatch.is() )
+ pVCLPopupMenu->InsertItem( aTargetURL.Complete, m_xFrame );
+ }
}
}
commit f58e7753643b30acd252c996760e9597a7228f1b
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Nov 29 23:11:53 2015 +0200
Unnecessary cast
Change-Id: I7e9cd165311494d3b2a8386dcaf2f3840449395a
(cherry picked from commit 1ad3acc828b112a96cfce7166bcc973ea2747f0f)
diff --git a/framework/source/uielement/saveasmenucontroller.cxx b/framework/source/uielement/saveasmenucontroller.cxx
index 7d066a1..1d8936e 100644
--- a/framework/source/uielement/saveasmenucontroller.cxx
+++ b/framework/source/uielement/saveasmenucontroller.cxx
@@ -78,7 +78,7 @@ void SaveAsMenuController::impl_setPopupMenu()
SolarMutexGuard aSolarMutexGuard;
if ( pPopupMenu )
- pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
+ pVCLPopupMenu = pPopupMenu->GetMenu();
if ( pVCLPopupMenu )
{
commit 2ea4a33f9c3c41937056522540e9ee4b80d28e39
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Nov 29 23:05:03 2015 +0200
SaveAsMenuController cleanup
Change-Id: Ib4a838619092b47b4eb5304e8d63ab6d7ee8d1c4
(cherry picked from commit ae3f19564f33039260544a0c28dc99c23ed6f348)
diff --git a/framework/source/uielement/saveasmenucontroller.cxx b/framework/source/uielement/saveasmenucontroller.cxx
index 3df48db..7d066a1 100644
--- a/framework/source/uielement/saveasmenucontroller.cxx
+++ b/framework/source/uielement/saveasmenucontroller.cxx
@@ -17,33 +17,19 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <classes/resource.hrc>
-#include <classes/fwkresid.hxx>
-
#include <cppuhelper/supportsservice.hxx>
-#include <osl/file.hxx>
-#include <osl/mutex.hxx>
-#include <rtl/ref.hxx>
#include <svtools/popupmenucontrollerbase.hxx>
-#include <tools/urlobj.hxx>
-#include <unotools/historyoptions.hxx>
#include <vcl/menu.hxx>
#include <vcl/svapp.hxx>
using namespace css;
using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
using namespace com::sun::star::frame;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::util;
-using namespace framework;
namespace {
class SaveAsMenuController : public svt::PopupMenuControllerBase
{
- using svt::PopupMenuControllerBase::disposing;
-
public:
SaveAsMenuController( const uno::Reference< uno::XComponentContext >& xContext );
virtual ~SaveAsMenuController();
@@ -71,23 +57,12 @@ public:
// XStatusListener
virtual void SAL_CALL statusChanged( const frame::FeatureStateEvent& Event ) throw ( uno::RuntimeException, std::exception ) override;
- // XMenuListener
- virtual void SAL_CALL itemActivated( const awt::MenuEvent& rEvent ) throw (uno::RuntimeException, std::exception) override;
-
- // XEventListener
- virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( uno::RuntimeException, std::exception ) override;
-
private:
virtual void impl_setPopupMenu() override;
-
- void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu >& rPopupMenu );
-
- bool m_bDisabled : 1;
};
SaveAsMenuController::SaveAsMenuController( const uno::Reference< uno::XComponentContext >& xContext ) :
- svt::PopupMenuControllerBase( xContext ),
- m_bDisabled( false )
+ svt::PopupMenuControllerBase( xContext )
{
}
@@ -95,15 +70,13 @@ SaveAsMenuController::~SaveAsMenuController()
{
}
-// private function
-void SaveAsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopupMenu )
+void SaveAsMenuController::impl_setPopupMenu()
{
- VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(VCLXMenu::GetImplementation( rPopupMenu ));
- PopupMenu* pVCLPopupMenu = nullptr;
+ VCLXMenu* pPopupMenu = VCLXMenu::GetImplementation( m_xPopupMenu );
+ Menu* pVCLPopupMenu = nullptr;
SolarMutexGuard aSolarMutexGuard;
- resetPopupMenu( rPopupMenu );
if ( pPopupMenu )
pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
@@ -114,38 +87,9 @@ void SaveAsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPo
}
}
-// XEventListener
-void SAL_CALL SaveAsMenuController::disposing( const EventObject& ) throw ( RuntimeException, std::exception )
-{
- Reference< css::awt::XMenuListener > xHolder(static_cast<OWeakObject *>(this), UNO_QUERY );
-
- osl::MutexGuard aLock( m_aMutex );
- m_xFrame.clear();
- m_xDispatch.clear();
-
- if ( m_xPopupMenu.is() )
- m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY ));
- m_xPopupMenu.clear();
-}
-
// XStatusListener
-void SAL_CALL SaveAsMenuController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException, std::exception )
-{
- osl::MutexGuard aLock( m_aMutex );
- m_bDisabled = !Event.IsEnabled;
-}
-
-void SAL_CALL SaveAsMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException, std::exception)
-{
- osl::MutexGuard aLock( m_aMutex );
- impl_setPopupMenu();
-}
-
-// XPopupMenuController
-void SaveAsMenuController::impl_setPopupMenu()
+void SAL_CALL SaveAsMenuController::statusChanged( const FeatureStateEvent& /*Event*/ ) throw ( RuntimeException, std::exception )
{
- if ( m_xPopupMenu.is() )
- fillPopupMenu( m_xPopupMenu );
}
}
More information about the Libreoffice-commits
mailing list