[Libreoffice-commits] .: basctl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 7 02:13:22 PDT 2012


 basctl/source/basicide/baside2.cxx  |    4 +++
 basctl/source/basicide/baside3.cxx  |   41 +++++++++++++++++++++----------
 basctl/source/basicide/basides1.cxx |   17 +------------
 basctl/source/basicide/iderdll.cxx  |    2 -
 basctl/source/basicide/layout.hxx   |    1 
 basctl/source/dlged/dlged.cxx       |   20 +++++----------
 basctl/source/dlged/propbrw.cxx     |   47 ++++++------------------------------
 basctl/source/inc/baside3.hxx       |   11 ++++++--
 basctl/source/inc/dlged.hxx         |    7 +++--
 basctl/source/inc/propbrw.hxx       |   30 ++++------------------
 10 files changed, 71 insertions(+), 109 deletions(-)

New commits:
commit 7d5911e40855ac6234590e008927c9b819084ad0
Author: Uray M. János <uray.janos at gmail.com>
Date:   Fri Aug 31 12:44:47 2012 +0200

    Basic IDE: Docking property browser under object catalog
    
    Now the property browser can be docked in the same way as all other
    dialogs in the Basic IDE and the Dialog Editor.
    The property browser (PropBrw, for which PropertyBrowser would be a
    better and easier-to-remember name IMO) is derived from
    basctl::DockingWindow instead of SfxDockingWindow. PropBrwMgr was
    removed (it seemed to be only a wrapper), and PropBrw is now a data
    member of DialogWindowLayout (aPropertyBrowser).
    
    Change-Id: I06737a5cbc985888432630714cb919d1bbbcbb49
    Reviewed-on: https://gerrit.libreoffice.org/518
    Reviewed-by: Noel Power <noel.power at suse.com>
    Tested-by: Noel Power <noel.power at suse.com>

diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index d0726d4..49a88f7 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -1533,6 +1533,10 @@ void ModulWindowLayout::GetState (SfxItemSet &rSet, unsigned nWhich)
 {
     switch (nWhich)
     {
+        case SID_SHOW_PROPERTYBROWSER:
+            rSet.Put(SfxVisibilityItem(nWhich, false));
+            break;
+
         case SID_BASICIDE_CHOOSEMACRO:
             rSet.Put(SfxVisibilityItem(nWhich, true));
             break;
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 6bfe6e4..3f87967 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -86,7 +86,7 @@ DialogWindow::DialogWindow (
 {
     InitSettings( true, true, true );
 
-    pEditor = new DlgEditor( rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
+    pEditor = new DlgEditor(rDocument.isDocument() ? rDocument.getDocument() : Reference<frame::XModel>(), rLayout.aPropertyBrowser);
     pEditor->SetWindow( this );
     pEditor->SetDialog( xDialogModel );
 
@@ -683,20 +683,12 @@ bool DialogWindow::RenameDialog( const ::rtl::OUString& rNewName )
 
 void DialogWindow::DisableBrowser()
 {
-    Shell* pShell = GetShell();
-    SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : 0;
-    SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow(SID_SHOW_PROPERTYBROWSER) : 0;
-    if( pChildWin )
-        ((PropBrw*)(pChildWin->GetWindow()))->Update( NULL );
+    rLayout.aPropertyBrowser.Update(0);
 }
 
 void DialogWindow::UpdateBrowser()
 {
-    Shell* pShell = GetShell();
-    SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : 0;
-    SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow(SID_SHOW_PROPERTYBROWSER) : 0;
-    if( pChildWin )
-        ((PropBrw*)(pChildWin->GetWindow()))->Update( pShell );
+    rLayout.aPropertyBrowser.Update(GetShell());
 }
 
 static ::rtl::OUString aResourceResolverPropName( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ));
@@ -1440,7 +1432,8 @@ ItemType DialogWindow::GetType () const
 DialogWindowLayout::DialogWindowLayout (Window* pParent, ObjectCatalog& rObjectCatalog_) :
     Layout(pParent),
     pChild(0),
-    rObjectCatalog(rObjectCatalog_)
+    rObjectCatalog(rObjectCatalog_),
+    aPropertyBrowser(*this)
 { }
 
 void DialogWindowLayout::Activating (BaseWindow& rChild)
@@ -1450,6 +1443,7 @@ void DialogWindowLayout::Activating (BaseWindow& rChild)
     rObjectCatalog.SetLayoutWindow(this);
     rObjectCatalog.UpdateEntries();
     rObjectCatalog.Show();
+    aPropertyBrowser.Show();
     Layout::Activating(rChild);
 }
 
@@ -1457,13 +1451,33 @@ void DialogWindowLayout::Deactivating ()
 {
     Layout::Deactivating();
     rObjectCatalog.Hide();
+    aPropertyBrowser.Hide();
     pChild = 0;
 }
 
+void DialogWindowLayout::ExecuteGlobal (SfxRequest& rReq)
+{
+    switch (rReq.GetSlot())
+    {
+        case SID_SHOW_PROPERTYBROWSER:
+            // toggling property browser
+            aPropertyBrowser.Show(!aPropertyBrowser.IsVisible());
+            ArrangeWindows();
+            // refresh the button state
+            if (SfxBindings* pBindings = GetBindingsPtr())
+                pBindings->Invalidate(SID_SHOW_PROPERTYBROWSER);
+            break;
+    }
+}
+
 void DialogWindowLayout::GetState (SfxItemSet& rSet, unsigned nWhich)
 {
     switch (nWhich)
     {
+        case SID_SHOW_PROPERTYBROWSER:
+            rSet.Put(SfxBoolItem(nWhich, aPropertyBrowser.IsVisible()));
+            break;
+
         case SID_BASICIDE_CHOOSEMACRO:
             rSet.Put(SfxVisibilityItem(nWhich, false));
             break;
@@ -1472,7 +1486,8 @@ void DialogWindowLayout::GetState (SfxItemSet& rSet, unsigned nWhich)
 
 void DialogWindowLayout::OnFirstSize (int const nWidth, int const nHeight)
 {
-    AddToLeft(&rObjectCatalog, Size(nWidth * 0.2, nHeight));
+    AddToLeft(&rObjectCatalog,   Size(nWidth * 0.25, nHeight * 0.35));
+    AddToLeft(&aPropertyBrowser, Size(nWidth * 0.25, nHeight * 0.65));
 }
 
 
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index e36eaf3..7244f09 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -560,12 +560,6 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
             pTabBar->MakeVisible( pTabBar->GetCurPageId() );
         }
         break;
-        case SID_SHOW_PROPERTYBROWSER:
-        {
-            GetViewFrame()->ChildWindowExecute( rReq );
-            rReq.Done();
-        }
-        break;
         case SID_BASICIDE_SHOWWINDOW:
         {
             ::std::auto_ptr< ScriptDocument > pDocument;
@@ -694,6 +688,8 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
         break;
 
         default:
+            if (pLayout)
+                pLayout->ExecuteGlobal(rReq);
             if (pCurWin)
                 pCurWin->ExecuteGlobal(rReq);
             break;
@@ -908,15 +904,6 @@ void Shell::GetState(SfxItemSet &rSet)
                     GetViewFrame()->GetSlotState( nWh, NULL, &rSet );
             }
             break;
-            case SID_SHOW_PROPERTYBROWSER:
-            {
-                if ( GetViewFrame()->KnowsChildWindow( nWh ) )
-                    rSet.Put( SfxBoolItem( nWh, GetViewFrame()->HasChildWindow( nWh ) ) );
-                else
-                    rSet.DisableItem( nWh );
-            }
-            break;
-
             case SID_BASICIDE_CURRENT_LANG:
             {
                 if( (pCurWin && pCurWin->IsReadOnly()) || GetCurLibName().isEmpty() )
diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx
index 75b5c31..1923141 100644
--- a/basctl/source/basicide/iderdll.cxx
+++ b/basctl/source/basicide/iderdll.cxx
@@ -142,8 +142,6 @@ Dll::Dll () :
     DocShell::RegisterInterface( pMod );
     Shell::RegisterFactory( SVX_INTERFACE_BASIDE_VIEWSH );
     Shell::RegisterInterface( pMod );
-
-    PropBrwMgr::RegisterChildWindow();
 }
 
 ExtraData* Dll::GetExtraData ()
diff --git a/basctl/source/basicide/layout.hxx b/basctl/source/basicide/layout.hxx
index 6adaeeb..9f56321 100644
--- a/basctl/source/basicide/layout.hxx
+++ b/basctl/source/basicide/layout.hxx
@@ -49,6 +49,7 @@ public:
 
     virtual void Activating (BaseWindow&);
     virtual void Deactivating ();
+    virtual void ExecuteGlobal (SfxRequest&) { }
     virtual void GetState (SfxItemSet&, unsigned nWhich) = 0;
     virtual void UpdateDebug (bool bBasicStopped ) = 0;
 
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 857ac1d..67e6d65 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -174,7 +174,10 @@ bool DlgEditor::RemarkDialog()
 }
 
 
-DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel )
+DlgEditor::DlgEditor (
+    com::sun::star::uno::Reference<com::sun::star::frame::XModel> const& xModel,
+    PropBrw& rPropertyBrowser_
+)
     :pHScroll(NULL)
     ,pVScroll(NULL)
     ,pDlgEdModel(NULL)
@@ -187,6 +190,7 @@ DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::
     ,pObjFac(NULL)
     ,pWindow(NULL)
     ,pFunc(NULL)
+    ,rPropertyBrowser(rPropertyBrowser_)
     ,eMode( DlgEditor::SELECT )
     ,eActObj( OBJ_DLG_PUSHBUTTON )
     ,bFirstDraw(false)
@@ -608,14 +612,7 @@ IMPL_LINK_NOARG(DlgEditor, PaintTimeout)
 
 IMPL_LINK_NOARG(DlgEditor, MarkTimeout)
 {
-    Shell* pShell = GetShell();
-    SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : NULL;
-    SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SHOW_PROPERTYBROWSER ) : NULL;
-    if ( !pChildWin )
-        return 0L;
-
-    ((PropBrw*)(pChildWin->GetWindow()))->Update(pShell);
-
+    rPropertyBrowser.Update(GetShell());
     return 1;
 }
 
@@ -1128,10 +1125,7 @@ bool DlgEditor::IsPasteAllowed()
 
 void DlgEditor::ShowProperties()
 {
-    Shell* pShell = GetShell();
-    SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : NULL;
-    if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_PROPERTYBROWSER ) )
-        pViewFrame->ToggleChildWindow( SID_SHOW_PROPERTYBROWSER );
+    rPropertyBrowser.Show(!rPropertyBrowser.IsVisible());
 }
 
 
diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx
index 40695f3..c3bd5d2 100644
--- a/basctl/source/dlged/propbrw.cxx
+++ b/basctl/source/dlged/propbrw.cxx
@@ -18,10 +18,10 @@
  */
 
 
+#include "propbrw.hxx"
 #include "basidesh.hxx"
 #include "dlgedobj.hxx"
 #include "iderid.hxx"
-#include "propbrw.hxx"
 
 #include "dlgresid.hrc"
 #include <svx/svxids.hrc>
@@ -48,28 +48,6 @@ using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::container;
 using namespace ::comphelper;
 
-SFX_IMPL_FLOATINGWINDOW(PropBrwMgr, SID_SHOW_PROPERTYBROWSER)
-
-PropBrwMgr::PropBrwMgr( Window* _pParent, sal_uInt16 nId,
-                        SfxBindings *pBindings, SfxChildWinInfo* pInfo)
-              :SfxChildWindow( _pParent, nId )
-{
-    // set current selection
-    SfxViewShell* pShell = SfxViewShell::Current();
-    pWindow = new PropBrw(
-        ::comphelper::getProcessServiceFactory(),
-        pBindings,
-        this,
-        _pParent,
-        pShell ? pShell->GetCurrentDocument() : Reference< XModel >()
-        );
-
-    eChildAlignment = SFX_ALIGN_NOALIGNMENT;
-    ((SfxDockingWindow*)pWindow)->Initialize( pInfo );
-
-    ((PropBrw*)pWindow)->Update( pShell );
-}
-
 
 void PropBrw::Update( const SfxViewShell* pShell )
 {
@@ -101,13 +79,12 @@ const long WIN_BORDER = 2;
 DBG_NAME(PropBrw)
 
 
-PropBrw::PropBrw( const Reference< XMultiServiceFactory >& _xORB, SfxBindings* _pBindings, PropBrwMgr* _pMgr, Window* _pParent,
-            const Reference< XModel >& _rxContextDocument )
-    :SfxDockingWindow( _pBindings, _pMgr, _pParent, WinBits( WB_DOCKABLE | WB_STDMODELESS | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE ) )
-    ,m_bInitialStateChange(true)
-    ,m_xORB(_xORB)
-    ,m_xContextDocument( _rxContextDocument )
-    ,pView( NULL )
+PropBrw::PropBrw (Layout& rLayout):
+    DockingWindow(&rLayout),
+    m_bInitialStateChange(true),
+    m_xORB(comphelper::getProcessServiceFactory()),
+    m_xContextDocument(SfxViewShell::Current() ? SfxViewShell::Current()->GetCurrentDocument() : Reference<XModel>()),
+    pView(0)
 {
     DBG_CTOR(PropBrw,NULL);
 
@@ -260,7 +237,7 @@ sal_Bool PropBrw::Close()
     if( IsRollUp() )
         RollDown();
 
-    return SfxDockingWindow::Close();
+    return DockingWindow::Close();
 }
 
 
@@ -450,15 +427,9 @@ void PropBrw::implSetNewObject( const Reference< XPropertySet >& _rxObject )
 }
 
 
-void PropBrw::FillInfo( SfxChildWinInfo& rInfo ) const
-{
-    rInfo.bVisible = false;
-}
-
-
 void PropBrw::Resize()
 {
-    SfxDockingWindow::Resize();
+    DockingWindow::Resize();
 
     // adjust size
     Size aSize_ = GetOutputSizePixel();
diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx
index feb679d..6f4d86e 100644
--- a/basctl/source/inc/baside3.hxx
+++ b/basctl/source/inc/baside3.hxx
@@ -21,7 +21,9 @@
 #define BASCTL_BASIDE3_HXX
 
 #include "../basicide/layout.hxx"
-#include <bastypes.hxx>
+#include "bastypes.hxx"
+#include "propbrw.hxx"
+
 #include <svl/undo.hxx>
 #include <vcl/dialog.hxx>
 #include <vcl/button.hxx>
@@ -126,6 +128,7 @@ public:
     // Layout:
     virtual void Activating (BaseWindow&);
     virtual void Deactivating ();
+    virtual void ExecuteGlobal (SfxRequest&);
     virtual void GetState (SfxItemSet&, unsigned nWhich);
     virtual void UpdateDebug (bool){};
 protected:
@@ -137,7 +140,11 @@ private:
     DialogWindow* pChild;
     // dockable windows
     ObjectCatalog& rObjectCatalog;
-    // TODO property browser
+    // property browser
+    PropBrw aPropertyBrowser;
+
+private:
+    friend class DialogWindow;
 };
 
 
diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx
index a8e8fc3..9f52cd4 100644
--- a/basctl/source/inc/dlged.hxx
+++ b/basctl/source/inc/dlged.hxx
@@ -40,6 +40,8 @@ class Window;
 namespace basctl
 {
 
+class PropBrw;
+
 #define DLGED_PAGE_WIDTH_MIN    1280
 #define DLGED_PAGE_HEIGHT_MIN   1024
 
@@ -102,7 +104,7 @@ private:
 
     void Print( Printer* pPrinter, const ::rtl::OUString& rTitle );
 
-protected:
+private:
     ScrollBar*          pHScroll;
     ScrollBar*          pVScroll;
     DlgEdModel*         pDlgEdModel;
@@ -117,6 +119,7 @@ protected:
     DlgEdFactory*       pObjFac;
     Window*             pWindow;
     DlgEdFunc*          pFunc;
+    PropBrw&            rPropertyBrowser;
     Mode                eMode;
     sal_uInt16          eActObj;
     bool                bFirstDraw;
@@ -133,7 +136,7 @@ protected:
 
     DlgEditor(); // not implemented
 public:
-    DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
+    DlgEditor (com::sun::star::uno::Reference<com::sun::star::frame::XModel> const& xModel, PropBrw&);
     ~DlgEditor();
 
     void            SetWindow( Window* pWindow );
diff --git a/basctl/source/inc/propbrw.hxx b/basctl/source/inc/propbrw.hxx
index ccf2a9a..a3bbad9 100644
--- a/basctl/source/inc/propbrw.hxx
+++ b/basctl/source/inc/propbrw.hxx
@@ -22,33 +22,21 @@
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <comphelper/stl_types.hxx>
-#include <sfx2/basedlgs.hxx>
-#include <sfx2/dockwin.hxx>
 #include <svl/lstner.hxx>
+#include <svl/brdcst.hxx>
 #include <svx/svdmark.hxx>
+#include "bastypes.hxx"
 
 class SfxBindings;
 class SdrView;
+class SfxViewShell;
 
 namespace basctl
 {
 
-//============================================================================
-// PropBrwMgr
-//============================================================================
+class Layout;
 
-class PropBrwMgr : public SfxChildWindow
-{
-public:
-    PropBrwMgr(Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo);
-    SFX_DECL_CHILDWINDOW(PropBrwMgr);
-};
-
-//============================================================================
-// PropBrw
-//============================================================================
-
-class PropBrw : public SfxDockingWindow , public SfxListener, public SfxBroadcaster
+class PropBrw : public DockingWindow, public SfxListener, public SfxBroadcaster
 {
 private:
     bool        m_bInitialStateChange;
@@ -67,7 +55,6 @@ private:
 protected:
     SdrView*        pView;
     virtual void Resize();
-    virtual void FillInfo( SfxChildWinInfo& rInfo ) const;
     virtual sal_Bool Close();
 
     DECLARE_STL_VECTOR(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>, InterfaceArray);
@@ -84,12 +71,7 @@ protected:
         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject);
 
 public:
-    PropBrw( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB,
-             SfxBindings *pBindings,
-             PropBrwMgr* pMgr,
-             Window* pParent,
-             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument
-    );
+    explicit PropBrw (Layout&);
     virtual ~PropBrw();
     using Window::Update;
     // note: changing the Context document to an instance other than the one given in the ctor is not supported


More information about the Libreoffice-commits mailing list