Startcenter: Refresh RecentDocsView when select 'Clear list' menu option
Change-Id: I9cbe647563699b9b610661003084d2cd16093f9a
This commit is contained in:
@@ -281,7 +281,12 @@ void SAL_CALL RecentFilesMenuController::itemSelected( const css::awt::MenuEvent
|
|||||||
OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
|
OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||||
|
|
||||||
if ( aCommand.startsWith( CMD_CLEAR_LIST ) )
|
if ( aCommand.startsWith( CMD_CLEAR_LIST ) )
|
||||||
|
{
|
||||||
SvtHistoryOptions().Clear( ePICKLIST );
|
SvtHistoryOptions().Clear( ePICKLIST );
|
||||||
|
dispatchCommand(
|
||||||
|
"vnd.org.libreoffice.recentdocs:ClearRecentFileList",
|
||||||
|
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >() );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
executeEntry( rEvent.MenuId-1 );
|
executeEntry( rEvent.MenuId-1 );
|
||||||
}
|
}
|
||||||
|
@@ -70,5 +70,10 @@
|
|||||||
<value>vnd.com.sun.star.comp.PresentationMinimizer:*</value>
|
<value>vnd.com.sun.star.comp.PresentationMinimizer:*</value>
|
||||||
</prop>
|
</prop>
|
||||||
</node>
|
</node>
|
||||||
|
<node oor:name="com.sun.star.comp.sfx2.BackingComp" oor:op="replace" install:module="start">
|
||||||
|
<prop oor:name="Protocols">
|
||||||
|
<value>vnd.org.libreoffice.recentdocs:*</value>
|
||||||
|
</prop>
|
||||||
|
</node>
|
||||||
</node>
|
</node>
|
||||||
</oor:component-data>
|
</oor:component-data>
|
||||||
|
@@ -30,6 +30,8 @@
|
|||||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||||
|
|
||||||
#include <com/sun/star/frame/XFrame.hpp>
|
#include <com/sun/star/frame/XFrame.hpp>
|
||||||
|
#include <com/sun/star/frame/XDispatch.hpp>
|
||||||
|
#include <com/sun/star/frame/XDispatchProvider.hpp>
|
||||||
|
|
||||||
#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
|
#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
|
||||||
#include <com/sun/star/lang/XEventListener.hpp>
|
#include <com/sun/star/lang/XEventListener.hpp>
|
||||||
@@ -57,6 +59,8 @@ class BackingComp : public css::lang::XTypeProvider
|
|||||||
, public css::lang::XInitialization
|
, public css::lang::XInitialization
|
||||||
, public css::frame::XController // => XComponent
|
, public css::frame::XController // => XComponent
|
||||||
, public css::awt::XKeyListener // => XEventListener
|
, public css::awt::XKeyListener // => XEventListener
|
||||||
|
, public css::frame::XDispatchProvider
|
||||||
|
, public css::frame::XDispatch
|
||||||
, public ::cppu::OWeakObject
|
, public ::cppu::OWeakObject
|
||||||
{
|
{
|
||||||
//______________________________________
|
//______________________________________
|
||||||
@@ -119,6 +123,15 @@ class BackingComp : public css::lang::XTypeProvider
|
|||||||
virtual void SAL_CALL addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException);
|
virtual void SAL_CALL addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException);
|
||||||
virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException);
|
virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException);
|
||||||
|
|
||||||
|
// XDispatchProvider
|
||||||
|
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL, const OUString& sTargetFrameName , sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException );
|
||||||
|
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions ) throw( css::uno::RuntimeException );
|
||||||
|
|
||||||
|
// XDispatch
|
||||||
|
virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException );
|
||||||
|
virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException );
|
||||||
|
virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException );
|
||||||
|
|
||||||
//______________________________________
|
//______________________________________
|
||||||
// helper
|
// helper
|
||||||
|
|
||||||
|
@@ -102,7 +102,9 @@ css::uno::Any SAL_CALL BackingComp::queryInterface( /*IN*/ const css::uno::Type&
|
|||||||
static_cast< css::frame::XController* >(this),
|
static_cast< css::frame::XController* >(this),
|
||||||
static_cast< css::lang::XComponent* >(this),
|
static_cast< css::lang::XComponent* >(this),
|
||||||
static_cast< css::lang::XEventListener* >(this),
|
static_cast< css::lang::XEventListener* >(this),
|
||||||
static_cast< css::awt::XKeyListener* >(static_cast< css::lang::XEventListener* >(this)));
|
static_cast< css::awt::XKeyListener* >(static_cast< css::lang::XEventListener* >(this)),
|
||||||
|
static_cast< css::frame::XDispatchProvider* >(this),
|
||||||
|
static_cast< css::frame::XDispatch* >(this) );
|
||||||
|
|
||||||
// then look for supported window interfaces
|
// then look for supported window interfaces
|
||||||
// Note: They exist only, if this instance was initialized
|
// Note: They exist only, if this instance was initialized
|
||||||
@@ -183,6 +185,8 @@ css::uno::Sequence< css::uno::Type > SAL_CALL BackingComp::getTypes()
|
|||||||
::getCppuType((const ::com::sun::star::uno::Reference< css::lang::XServiceInfo >*)NULL ),
|
::getCppuType((const ::com::sun::star::uno::Reference< css::lang::XServiceInfo >*)NULL ),
|
||||||
::getCppuType((const ::com::sun::star::uno::Reference< css::frame::XController >*)NULL ),
|
::getCppuType((const ::com::sun::star::uno::Reference< css::frame::XController >*)NULL ),
|
||||||
::getCppuType((const ::com::sun::star::uno::Reference< css::lang::XComponent >*)NULL ),
|
::getCppuType((const ::com::sun::star::uno::Reference< css::lang::XComponent >*)NULL ),
|
||||||
|
::getCppuType((const ::com::sun::star::uno::Reference< css::frame::XDispatchProvider >*)NULL ),
|
||||||
|
::getCppuType((const ::com::sun::star::uno::Reference< css::frame::XDispatch >*)NULL ),
|
||||||
lWindowTypes);
|
lWindowTypes);
|
||||||
|
|
||||||
pTypeCollection = &aTypeCollection;
|
pTypeCollection = &aTypeCollection;
|
||||||
@@ -261,7 +265,8 @@ sal_Bool SAL_CALL BackingComp::supportsService( /*IN*/ const OUString& sServiceN
|
|||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
sServiceName.equals("com.sun.star.frame.StartModule") ||
|
sServiceName.equals("com.sun.star.frame.StartModule") ||
|
||||||
sServiceName.equals(SERVICENAME_FRAMECONTROLLER)
|
sServiceName.equals(SERVICENAME_FRAMECONTROLLER) ||
|
||||||
|
sServiceName.equals("com.sun.star.frame.ProtocolHandler")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,8 +322,9 @@ OUString BackingComp::impl_getStaticImplementationName()
|
|||||||
|
|
||||||
css::uno::Sequence< OUString > BackingComp::impl_getStaticSupportedServiceNames()
|
css::uno::Sequence< OUString > BackingComp::impl_getStaticSupportedServiceNames()
|
||||||
{
|
{
|
||||||
css::uno::Sequence< OUString > lNames(1);
|
css::uno::Sequence< OUString > lNames(2);
|
||||||
lNames[0] = "com.sun.star.frame.StartModule";
|
lNames[0] = "com.sun.star.frame.StartModule";
|
||||||
|
lNames[1] = "com.sun.star.frame.ProtocolHandler";
|
||||||
return lNames;
|
return lNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -800,4 +806,46 @@ void SAL_CALL BackingComp::keyReleased( /*IN*/ const css::awt::KeyEvent& )
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XDispatchProvider
|
||||||
|
css::uno::Reference< css::frame::XDispatch > SAL_CALL BackingComp::queryDispatch( const css::util::URL& aURL, const OUString& /*sTargetFrameName*/, sal_Int32 /*nSearchFlags*/ ) throw( css::uno::RuntimeException )
|
||||||
|
{
|
||||||
|
css::uno::Reference< css::frame::XDispatch > xDispatch;
|
||||||
|
if ( aURL.Protocol == "vnd.org.libreoffice.recentdocs:" )
|
||||||
|
xDispatch = this;
|
||||||
|
|
||||||
|
return xDispatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
css::uno::Sequence < css::uno::Reference< css::frame::XDispatch > > SAL_CALL BackingComp::queryDispatches( const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescripts ) throw( css::uno::RuntimeException )
|
||||||
|
{
|
||||||
|
sal_Int32 nCount = seqDescripts.getLength();
|
||||||
|
css::uno::Sequence < css::uno::Reference < XDispatch > > lDispatcher( nCount );
|
||||||
|
|
||||||
|
for( sal_Int32 i=0; i<nCount; ++i )
|
||||||
|
lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL, seqDescripts[i].FrameName, seqDescripts[i].SearchFlags );
|
||||||
|
|
||||||
|
return lDispatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
// XDispatch
|
||||||
|
void SAL_CALL BackingComp::dispatch( const css::util::URL& aURL, const css::uno::Sequence < css::beans::PropertyValue >& /*lArgs*/ ) throw( css::uno::RuntimeException )
|
||||||
|
{
|
||||||
|
// vnd.org.libreoffice.recentdocs:ClearRecentFileList - clear recent files
|
||||||
|
if ( aURL.Path == "ClearRecentFileList" )
|
||||||
|
{
|
||||||
|
Window* pWindow = VCLUnoHelper::GetWindow(m_xWindow);
|
||||||
|
BackingWindow* pBack = dynamic_cast<BackingWindow*>(pWindow );
|
||||||
|
if( pBack )
|
||||||
|
pBack->clearRecentFileList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SAL_CALL BackingComp::addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SAL_CALL BackingComp::removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -547,4 +547,9 @@ Size BackingWindow::GetOptimalSize() const
|
|||||||
return Window::GetOptimalSize();
|
return Window::GetOptimalSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BackingWindow::clearRecentFileList()
|
||||||
|
{
|
||||||
|
mpAllRecentThumbnails->Clear();
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab:*/
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab:*/
|
||||||
|
@@ -112,6 +112,8 @@ public:
|
|||||||
virtual Size GetOptimalSize() const;
|
virtual Size GetOptimalSize() const;
|
||||||
|
|
||||||
void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame );
|
void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame );
|
||||||
|
|
||||||
|
void clearRecentFileList();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
prefix="sfx" xmlns="http://openoffice.org/2010/uno-components">
|
prefix="sfx" xmlns="http://openoffice.org/2010/uno-components">
|
||||||
<implementation name="com.sun.star.comp.sfx2.BackingComp">
|
<implementation name="com.sun.star.comp.sfx2.BackingComp">
|
||||||
<service name="com.sun.star.frame.StartModule"/>
|
<service name="com.sun.star.frame.StartModule"/>
|
||||||
|
<service name="com.sun.star.frame.ProtocolHandler"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
<implementation name="SfxDocumentMetaData">
|
<implementation name="SfxDocumentMetaData">
|
||||||
<service name="com.sun.star.document.DocumentProperties"/>
|
<service name="com.sun.star.document.DocumentProperties"/>
|
||||||
|
Reference in New Issue
Block a user