[Libreoffice-commits] core.git: 3 commits - framework/inc framework/source include/sfx2 sc/sdi sc/source sfx2/sdi sfx2/source sw/sdi sw/source

Jan Holesovsky kendy at suse.cz
Tue Apr 30 01:34:04 PDT 2013


 framework/inc/uielement/recentfilesmenucontroller.hxx    |    1 
 framework/source/uielement/recentfilesmenucontroller.cxx |    2 
 include/sfx2/tbxctrl.hxx                                 |   30 ++++----
 sc/sdi/scalc.sdi                                         |    3 
 sc/source/ui/app/scdll.cxx                               |    2 
 sfx2/sdi/sfx.sdi                                         |    3 
 sfx2/source/appl/appreg.cxx                              |    1 
 sfx2/source/toolbox/tbxitem.cxx                          |   56 +++++++++++++++
 sw/sdi/swriter.sdi                                       |    3 
 sw/source/ui/app/swmodule.cxx                            |    2 
 10 files changed, 85 insertions(+), 18 deletions(-)

New commits:
commit f60424b29622033ae02491bda328c304ae1bc05d
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Tue Apr 30 10:31:00 2013 +0200

    bnc#816516: Implement easy access to the recent documents.
    
    This adds a dropdown to the 'Open' toolbar tool.
    
    Change-Id: I5b4aa99476e721c1479152b46bbc79cc0b095318

diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
index 6c12947..e50527f 100644
--- a/include/sfx2/tbxctrl.hxx
+++ b/include/sfx2/tbxctrl.hxx
@@ -162,7 +162,7 @@ public:
 
 #define SFX_DECL_TOOLBOX_CONTROL() \
         static SfxToolBoxControl* CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ); \
-        static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL)
+        static void SFX2_DLLPUBLIC RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL)
 
 /*  For special ToolBox controls, such as a font selection box or toolbox
     tear-off floating windows, an appropriate Item-Subclass of SfxTooBoxControl
@@ -351,6 +351,23 @@ private:
     sal_Bool                m_bShowMenuImages;
 };
 
+/** Toolbox that implements recent files menu for the Open file toolbar button.
+
+To use that, the appropriate Sfx*Item (like Open, OpenFromCalc, or
+OpenFromWriter) has to have SlotType = SfxStringItem, and the appropriate
+module initialization has to call RegisterControl().
+*/
+class SfxRecentFilesToolBoxControl : public SfxToolBoxControl
+{
+public:
+    SFX_DECL_TOOLBOX_CONTROL();
+    SfxRecentFilesToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox );
+    virtual ~SfxRecentFilesToolBoxControl();
+
+protected:
+    virtual SfxPopupWindow* CreatePopupWindow();
+};
+
 class SfxReloadToolBoxControl_Impl : public SfxToolBoxControl
 {
     protected:
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 7ab61a1..2780301 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -8333,6 +8333,9 @@ SfxVoidItem OpenFromCalc SID_OPEN_CALC
     RecordPerSet;
     Synchron;
 
+    /* status: */
+    SlotType = SfxStringItem
+
     /* config: */
     AccelConfig = TRUE,
     MenuConfig = TRUE,
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 3220463..9ed0e3a 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -172,6 +172,8 @@ void ScDLL::Init()
     ScMediaShell        ::RegisterInterface(pMod);
     ScPageBreakShell    ::RegisterInterface(pMod);
 
+    SfxRecentFilesToolBoxControl::RegisterControl(SID_OPEN_CALC, pMod);
+
     //  eigene Controller
     ScTbxInsertCtrl     ::RegisterControl(SID_TBXCTL_INSERT, pMod);
     ScTbxInsertCtrl     ::RegisterControl(SID_TBXCTL_INSCELLS, pMod);
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 0fe9cdc..ad70c3a 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -4358,6 +4358,9 @@ SfxObjectItem Open SID_OPENDOC
     RecordPerSet;
     Asynchron;
 
+    /* status: */
+    SlotType = SfxStringItem
+
     /* config: */
     AccelConfig = TRUE,
     MenuConfig = TRUE,
diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx
index 0c54aa8..f3e7365 100644
--- a/sfx2/source/appl/appreg.cxx
+++ b/sfx2/source/appl/appreg.cxx
@@ -64,6 +64,7 @@ void SfxApplication::Registrations_Impl()
     SfxURLToolBoxControl_Impl::RegisterControl(SID_OPENURL);
     SfxAppToolBoxControl_Impl::RegisterControl( SID_NEWDOCDIRECT );
     SfxAppToolBoxControl_Impl::RegisterControl( SID_AUTOPILOTMENU );
+    SfxRecentFilesToolBoxControl::RegisterControl( SID_OPENDOC );
 };
 
 //--------------------------------------------------------------------
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index a9e786f..8085dcc 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -25,7 +25,9 @@
 #include <string>           // prevent conflict with STL includes
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/awt/XPopupMenu.hpp>
 #include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
 #include <com/sun/star/util/URL.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <com/sun/star/util/XURLTransformer.hpp>
@@ -38,6 +40,7 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
 #include <com/sun/star/frame/status/ItemStatus.hpp>
 #include <com/sun/star/frame/status/ItemState.hpp>
 #include <com/sun/star/ui/XUIElementFactory.hpp>
@@ -92,6 +95,7 @@
 #include "virtmenu.hxx"
 #include "sfx2/imagemgr.hxx"
 
+using namespace ::com::sun::star;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::frame;
 using namespace ::com::sun::star::frame::status;
@@ -105,6 +109,7 @@ using namespace ::com::sun::star::ui;
 
 SFX_IMPL_TOOLBOX_CONTROL_ARG(SfxToolBoxControl, SfxStringItem, sal_True);
 SFX_IMPL_TOOLBOX_CONTROL(SfxAppToolBoxControl_Impl, SfxStringItem);
+SFX_IMPL_TOOLBOX_CONTROL(SfxRecentFilesToolBoxControl, SfxStringItem);
 
 static Window* GetTopMostParentSystemWindow( Window* pWindow )
 {
@@ -1741,4 +1746,55 @@ void SfxAppToolBoxControl_Impl::Click( )
 {
 }
 
+//--------------------------------------------------------------------
+
+SfxRecentFilesToolBoxControl::SfxRecentFilesToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox )
+    : SfxToolBoxControl( nSlotId, nId, rBox )
+{
+    rBox.SetItemBits( nId, rBox.GetItemBits( nId ) | TIB_DROPDOWN);
+}
+
+SfxRecentFilesToolBoxControl::~SfxRecentFilesToolBoxControl()
+{
+}
+
+SfxPopupWindow* SfxRecentFilesToolBoxControl::CreatePopupWindow()
+{
+    ToolBox& rBox = GetToolBox();
+    sal_uInt16 nItemId = GetId();
+    ::Rectangle aRect( rBox.GetItemRect( nItemId ) );
+
+    Sequence< Any > aArgs( 2 );
+    PropertyValue aPropValue;
+
+    aPropValue.Name = "CommandURL";
+    aPropValue.Value <<= OUString( ".uno:RecentFileList" );
+    aArgs[0] <<= aPropValue;
+
+    aPropValue.Name = "Frame";
+    aPropValue.Value <<= m_xFrame;
+    aArgs[1] <<= aPropValue;
+
+    uno::Reference< frame::XPopupMenuController > xPopupController( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                "com.sun.star.comp.framework.RecentFilesMenuController", aArgs, m_xContext ), UNO_QUERY );
+
+    uno::Reference< awt::XPopupMenu > xPopupMenu( m_xContext->getServiceManager()->createInstanceWithContext(
+                "com.sun.star.awt.PopupMenu", m_xContext ), uno::UNO_QUERY );
+
+    if ( xPopupController.is() && xPopupMenu.is() )
+    {
+        xPopupController->setPopupMenu( xPopupMenu );
+
+        rBox.SetItemDown( nItemId, sal_True );
+        Reference< awt::XWindowPeer > xPeer( getParent(), uno::UNO_QUERY );
+
+        if ( xPeer.is() )
+            xPopupMenu->execute( xPeer, VCLUnoHelper::ConvertToAWTRect( aRect ), 0 );
+
+        rBox.SetItemDown( nItemId, sal_False );
+    }
+
+    return 0;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 28ffe24..7601a52 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -10401,6 +10401,9 @@ SfxVoidItem OpenFromWriter FN_OPEN_FILE
     RecordPerSet;
     Synchron;
 
+    /* status: */
+    SlotType = SfxStringItem
+
     /* config: */
     AccelConfig = TRUE,
     MenuConfig = TRUE,
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
index dc820bb..7161248 100644
--- a/sw/source/ui/app/swmodule.cxx
+++ b/sw/source/ui/app/swmodule.cxx
@@ -292,6 +292,8 @@ void SwDLL::RegisterInterfaces()
 void SwDLL::RegisterControls()
 {
     SwModule* pMod = SW_MOD();
+
+    SfxRecentFilesToolBoxControl::RegisterControl( FN_OPEN_FILE, pMod );
     SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
     SvxTbxCtlAlign::RegisterControl(SID_OBJECT_ALIGN, pMod );
     SwTbxAnchor::RegisterControl(FN_TOOL_ANCHOR, pMod );
commit f486c562816fc59dc4d341d0a32a65b1e65eeb92
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Apr 29 16:39:20 2013 +0200

    Recent files: aPassword is unused.
    
    Change-Id: I44f032a6b943ad02b0d43e78b4e79275d6d2adfb

diff --git a/framework/inc/uielement/recentfilesmenucontroller.hxx b/framework/inc/uielement/recentfilesmenucontroller.hxx
index afad956..d23e1db 100644
--- a/framework/inc/uielement/recentfilesmenucontroller.hxx
+++ b/framework/inc/uielement/recentfilesmenucontroller.hxx
@@ -68,7 +68,6 @@ namespace framework
             {
                 OUString aURL;
                 OUString aTitle;
-                OUString aPassword;
             };
 
             void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx
index 5e09180..3d8d9c9 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -117,8 +117,6 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >
                         a >>= aRecentFile.aURL;
                     else if ( rPickListEntry[j].Name == HISTORY_PROPERTYNAME_TITLE )
                         a >>= aRecentFile.aTitle;
-                    else if ( rPickListEntry[j].Name == HISTORY_PROPERTYNAME_PASSWORD )
-                        a >>= aRecentFile.aPassword;
                 }
 
                 m_aRecentFilesItems.push_back( aRecentFile );
commit a4b1200bd89af55141a82101cf968663ee94ec16
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Apr 29 13:03:49 2013 +0200

    Kill unused SfxHistoryToolBoxControl_Impl.
    
    Change-Id: I03655bb502d6480d8f7f3f1adef17d8f635b8ed9

diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
index 56047d1..6c12947 100644
--- a/include/sfx2/tbxctrl.hxx
+++ b/include/sfx2/tbxctrl.hxx
@@ -347,25 +347,8 @@ protected:
 private:
     String                  aLastURL;
     PopupMenu*              pMenu;
-    sal_uIntPtr                   m_nSymbolsStyle;
-    sal_Bool                    m_bShowMenuImages;
-};
-
-class SfxHistoryToolBoxControl_Impl : public SfxToolBoxControl
-{
-    Timer                   aTimer;
-
-private:
-                            DECL_LINK( Timeout, Timer * );
-
-protected:
-    virtual void            Click( );
-    using SfxToolBoxControl::Select;
-    virtual void            Select( sal_Bool );
-
-public:
-                            SFX_DECL_TOOLBOX_CONTROL();
-                            SfxHistoryToolBoxControl_Impl( sal_uInt16 nId, ToolBox& rBox );
+    sal_uIntPtr             m_nSymbolsStyle;
+    sal_Bool                m_bShowMenuImages;
 };
 
 class SfxReloadToolBoxControl_Impl : public SfxToolBoxControl


More information about the Libreoffice-commits mailing list