Object Catalog pane in Basic IDE

Object Catalog was a floating window. It has been converted to a fixed
pane on the right hand side of the editor window. While it is a
BasicDockingWindow, at the moment it is not possible to undock, move,
or resize it. Also, the Object Catalog toolbar button does not show
the visibility status of the pane, ideally it should look pressed, when
the Object Catalog pane is visible. Another missing feature is that
the Object Catalog pane cannot be switched on together with the
dialog editor.
This commit is contained in:
Tomcsik Bence
2012-03-11 21:40:02 +01:00
committed by Andras Timar
parent f32fe9f501
commit 0e8eb19a53
12 changed files with 103 additions and 19 deletions

View File

@@ -31,6 +31,9 @@
#include <svx/svxids.hrc> #include <svx/svxids.hrc>
#endif #endif
// Width of Object Catalog pane in pixels
#define OBJCAT_PANE_WIDTH 240
// Resource-ID's... // Resource-ID's...
#ifndef _SVX_NOIDERESIDS #ifndef _SVX_NOIDERESIDS

View File

@@ -33,6 +33,7 @@
#include "brkdlg.hxx" #include "brkdlg.hxx"
#include "iderdll.hxx" #include "iderdll.hxx"
#include "iderdll2.hxx" #include "iderdll2.hxx"
#include "objdlg.hxx"
#include "baside2.hrc" #include "baside2.hrc"
@@ -1388,6 +1389,11 @@ void ModulWindow::SetLineNumberDisplay(bool b)
aXEditorWindow.SetLineNumberDisplay(b); aXEditorWindow.SetLineNumberDisplay(b);
} }
void ModulWindow::SetObjectCatalogDisplay(bool b)
{
aXEditorWindow.SetObjectCatalogDisplay(b);
}
sal_Bool ModulWindow::IsPasteAllowed() sal_Bool ModulWindow::IsPasteAllowed()
{ {
sal_Bool bPaste = sal_False; sal_Bool bPaste = sal_False;
@@ -1420,6 +1426,7 @@ ModulWindowLayout::ModulWindowLayout( Window* pParent ) :
aHSplitter( this, WinBits( WB_HSCROLL ) ), aHSplitter( this, WinBits( WB_HSCROLL ) ),
aWatchWindow( this ), aWatchWindow( this ),
aStackWindow( this ), aStackWindow( this ),
aObjectCatalog( this ),
bVSplitted(sal_False), bVSplitted(sal_False),
bHSplitted(sal_False), bHSplitted(sal_False),
m_pModulWindow(0), m_pModulWindow(0),
@@ -1434,6 +1441,7 @@ ModulWindowLayout::ModulWindowLayout( Window* pParent ) :
aWatchWindow.Show(); aWatchWindow.Show();
aStackWindow.Show(); aStackWindow.Show();
aObjectCatalog.Show();
Color aColor(GetSettings().GetStyleSettings().GetFieldTextColor()); Color aColor(GetSettings().GetStyleSettings().GetFieldTextColor());
m_aSyntaxColors[TT_UNKNOWN] = aColor; m_aSyntaxColors[TT_UNKNOWN] = aColor;
@@ -1506,12 +1514,13 @@ void ModulWindowLayout::ArrangeWindows()
nVSplitPos = ( nVSplitPos < nMinPos ) ? 0 : ( aSz.Height() - SPLIT_HEIGHT ); nVSplitPos = ( nVSplitPos < nMinPos ) ? 0 : ( aSz.Height() - SPLIT_HEIGHT );
Size aXEWSz; Size aXEWSz;
aXEWSz.Width() = aSz.Width(); aXEWSz.Width() = aSz.Width() - OBJCAT_PANE_WIDTH;
aXEWSz.Height() = nVSplitPos + 1; aXEWSz.Height() = nVSplitPos + 1;
if ( m_pModulWindow ) if ( m_pModulWindow )
{ {
DBG_CHKOBJ( m_pModulWindow, ModulWindow, 0 ); DBG_CHKOBJ( m_pModulWindow, ModulWindow, 0 );
m_pModulWindow->SetPosSizePixel( Point( 0, 0 ), aXEWSz ); m_pModulWindow->SetPosSizePixel( Point( OBJCAT_PANE_WIDTH, 0 ), aXEWSz );
} }
aVSplitter.SetDragRectPixel( Rectangle( Point( 0, 0 ), Size( aSz.Width(), aSz.Height() ) ) ); aVSplitter.SetDragRectPixel( Rectangle( Point( 0, 0 ), Size( aSz.Width(), aSz.Height() ) ) );
@@ -1536,6 +1545,11 @@ void ModulWindowLayout::ArrangeWindows()
if ( !aStackWindow.IsFloatingMode() ) if ( !aStackWindow.IsFloatingMode() )
aStackWindow.SetPosSizePixel( aSWPos, aSWSz ); aStackWindow.SetPosSizePixel( aSWPos, aSWSz );
Size aOCSz( OBJCAT_PANE_WIDTH, aSz.Height() - aSWSz.Height() - 3 );
Point aOCPos( 0, 0 );
if ( !aObjectCatalog.IsFloatingMode() )
aObjectCatalog.SetPosSizePixel( aOCPos, aOCSz );
if ( aStackWindow.IsFloatingMode() && aWatchWindow.IsFloatingMode() ) if ( aStackWindow.IsFloatingMode() && aWatchWindow.IsFloatingMode() )
aHSplitter.Hide(); aHSplitter.Hide();
else else
@@ -1592,6 +1606,15 @@ sal_Bool ModulWindowLayout::IsToBeDocked( DockingWindow* pDockingWindow, const P
return sal_True; return sal_True;
} }
} }
if ( pDockingWindow == &aObjectCatalog )
{
if ( ( aPosInMe.Y() > nVSplitPos ) && ( aPosInMe.X() > nHSplitPos ) )
{
rRect.SetSize( Size( aSz.Width() - nHSplitPos, aSz.Height() - nVSplitPos ) );
rRect.SetPos( OutputToScreenPixel( Point( nHSplitPos, nVSplitPos ) ) );
return sal_True;
}
}
} }
return sal_False; return sal_False;
} }
@@ -1606,6 +1629,10 @@ void ModulWindowLayout::DockaWindow( DockingWindow* pDockingWindow )
{ {
ArrangeWindows(); ArrangeWindows();
} }
else if ( pDockingWindow == &aObjectCatalog )
{
ArrangeWindows();
}
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
else else
OSL_FAIL( "Wer will sich denn hier andocken ?" ); OSL_FAIL( "Wer will sich denn hier andocken ?" );

View File

@@ -54,6 +54,7 @@ class SvxSearchItem;
#include "breakpoint.hxx" #include "breakpoint.hxx"
#include "linenumberwindow.hxx" #include "linenumberwindow.hxx"
#include "objdlg.hxx"
DBG_NAMEEX( ModulWindow ) DBG_NAMEEX( ModulWindow )
@@ -291,6 +292,7 @@ private:
EditorWindow aEdtWindow; EditorWindow aEdtWindow;
ScrollBar aEWVScrollBar; ScrollBar aEWVScrollBar;
bool bLineNumberDisplay; bool bLineNumberDisplay;
bool bObjectCatalogDisplay;
virtual void DataChanged(DataChangedEvent const & rDCEvt); virtual void DataChanged(DataChangedEvent const & rDCEvt);
@@ -307,6 +309,7 @@ public:
ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; } ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; }
void SetLineNumberDisplay(bool b); void SetLineNumberDisplay(bool b);
void SetObjectCatalogDisplay(bool b);
}; };
@@ -368,6 +371,7 @@ public:
virtual sal_Bool IsReadOnly(); virtual sal_Bool IsReadOnly();
void SetLineNumberDisplay(bool); void SetLineNumberDisplay(bool);
void SetObjectCatalogDisplay(bool);
StarBASIC* GetBasic() { XModule(); return xBasic; } StarBASIC* GetBasic() { XModule(); return xBasic; }
@@ -437,6 +441,7 @@ private:
WatchWindow aWatchWindow; WatchWindow aWatchWindow;
StackWindow aStackWindow; StackWindow aStackWindow;
ObjectCatalog aObjectCatalog;
sal_Bool bVSplitted; sal_Bool bVSplitted;
sal_Bool bHSplitted; sal_Bool bHSplitted;
@@ -474,6 +479,7 @@ public:
WatchWindow& GetWatchWindow() { return aWatchWindow; } WatchWindow& GetWatchWindow() { return aWatchWindow; }
StackWindow& GetStackWindow() { return aStackWindow; } StackWindow& GetStackWindow() { return aStackWindow; }
ObjectCatalog& GetObjectCatalog() { return aObjectCatalog; }
Image getImage(sal_uInt16 nId) const; Image getImage(sal_uInt16 nId) const;

View File

@@ -1658,7 +1658,8 @@ ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
aLineNumberWindow( this, pParent ), aLineNumberWindow( this, pParent ),
aEdtWindow( this ), aEdtWindow( this ),
aEWVScrollBar( this, WB_VSCROLL | WB_DRAG ), aEWVScrollBar( this, WB_VSCROLL | WB_DRAG ),
bLineNumberDisplay(false) bLineNumberDisplay(false),
bObjectCatalogDisplay(true)
{ {
aEdtWindow.SetModulWindow( pParent ); aEdtWindow.SetModulWindow( pParent );
aBrkWindow.SetModulWindow( pParent ); aBrkWindow.SetModulWindow( pParent );
@@ -1681,23 +1682,24 @@ void ComplexEditorWindow::Resize()
long nSBWidth = aEWVScrollBar.GetSizePixel().Width(); long nSBWidth = aEWVScrollBar.GetSizePixel().Width();
Size aBrkSz(nBrkWidth, aSz.Height()); Size aBrkSz(nBrkWidth, aSz.Height());
aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
Size aLnSz(aLineNumberWindow.GetWidth(), aSz.Height()); Size aLnSz(aLineNumberWindow.GetWidth(), aSz.Height());
aLineNumberWindow.SetPosSizePixel(Point(DWBORDER+aBrkSz.Width() - 1, DWBORDER), aLnSz);
if(bLineNumberDisplay) if(bLineNumberDisplay)
{ {
aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
aLineNumberWindow.SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aLnSz);
Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow.GetWidth() - nSBWidth + 2, aSz.Height()); Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow.GetWidth() - nSBWidth + 2, aSz.Height());
aEdtWindow.SetPosSizePixel( Point( DWBORDER+aBrkSz.Width()+aLnSz.Width()-1, DWBORDER ), aEWSz ); aEdtWindow.SetPosSizePixel( Point( DWBORDER + aBrkSz.Width() + aLnSz.Width() - 1, DWBORDER ), aEWSz );
} }
else else
{ {
Size aEWSz(aSz.Width() - nBrkWidth - nSBWidth + 1, aSz.Height()); aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
Size aEWSz(aSz.Width() - nBrkWidth - nSBWidth + 2, aSz.Height());
aEdtWindow.SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aEWSz); aEdtWindow.SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aEWSz);
} }
aEWVScrollBar.SetPosSizePixel( Point( aOutSz.Width()-DWBORDER-nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) ); aEWVScrollBar.SetPosSizePixel( Point( aOutSz.Width() - DWBORDER - nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) );
} }
IMPL_LINK( ComplexEditorWindow, ScrollHdl, ScrollBar *, pCurScrollBar ) IMPL_LINK( ComplexEditorWindow, ScrollHdl, ScrollBar *, pCurScrollBar )
@@ -1734,15 +1736,18 @@ void ComplexEditorWindow::DataChanged(DataChangedEvent const & rDCEvt)
void ComplexEditorWindow::SetLineNumberDisplay(bool b) void ComplexEditorWindow::SetLineNumberDisplay(bool b)
{ {
if(b == bLineNumberDisplay) bLineNumberDisplay = b;
return; Resize();
if(b) if(b)
aLineNumberWindow.Show(); aLineNumberWindow.Show();
else else
aLineNumberWindow.Hide(); aLineNumberWindow.Hide();
}
bLineNumberDisplay = b; void ComplexEditorWindow::SetObjectCatalogDisplay(bool b)
{
bObjectCatalogDisplay = b;
Resize(); Resize();
} }

View File

@@ -432,10 +432,22 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
break; break;
case SID_BASICIDE_OBJCAT: case SID_BASICIDE_OBJCAT:
{ {
if ( pObjectCatalog ) if ( bObjectCatalogDisplay )
ShowObjectDialog( sal_False, sal_True ); {
pModulLayout->GetObjectCatalog().Hide();
dynamic_cast<ModulWindow*>(pCurWin)->SetPosPixel( Point( 0, 0 ) );
dynamic_cast<ModulWindow*>(pCurWin)->SetSizePixel( Size( pCurWin->GetSizePixel().Width() + OBJCAT_PANE_WIDTH, pCurWin->GetSizePixel().Height() ) );
dynamic_cast<ModulWindow*>(pCurWin)->SetObjectCatalogDisplay( false );
bObjectCatalogDisplay = sal_False;
}
else else
ShowObjectDialog( sal_True, sal_True ); {
pModulLayout->GetObjectCatalog().Show();
dynamic_cast<ModulWindow*>(pCurWin)->SetPosPixel( Point( OBJCAT_PANE_WIDTH, 0 ) );
dynamic_cast<ModulWindow*>(pCurWin)->SetSizePixel( Size( pCurWin->GetSizePixel().Width() - OBJCAT_PANE_WIDTH, pCurWin->GetSizePixel().Height() ) );
dynamic_cast<ModulWindow*>(pCurWin)->SetObjectCatalogDisplay( true );
bObjectCatalogDisplay = sal_True;
}
} }
break; break;
case SID_BASICIDE_NAMECHANGEDONTAB: case SID_BASICIDE_NAMECHANGEDONTAB:
@@ -870,6 +882,18 @@ void BasicIDEShell::GetState(SfxItemSet &rSet)
break; break;
case SID_BASICIDE_CHOOSEMACRO: case SID_BASICIDE_CHOOSEMACRO:
case SID_BASICIDE_OBJCAT: case SID_BASICIDE_OBJCAT:
{
// FIXME: hide Object Catalog icon from the toolbar,
// when window type is not macro editor.
if( pCurWin && !pCurWin->IsA( TYPE( ModulWindow ) ) )
{
rSet.DisableItem( nWh );
rSet.Put(SfxVisibilityItem(nWh, sal_False));
}
else
rSet.Put(SfxVisibilityItem(nWh, sal_True));
}
break;
case SID_BASICIDE_SHOWSBX: case SID_BASICIDE_SHOWSBX:
case SID_BASICIDE_CREATEMACRO: case SID_BASICIDE_CREATEMACRO:
case SID_BASICIDE_EDITMACRO: case SID_BASICIDE_EDITMACRO:

View File

@@ -206,6 +206,8 @@ void BasicIDEShell::Init()
pObjectCatalog = 0; pObjectCatalog = 0;
bCreatingWindow = sal_False; bCreatingWindow = sal_False;
bObjectCatalogDisplay = sal_True;
pTabBar = new BasicIDETabBar( &GetViewFrame()->GetWindow() ); pTabBar = new BasicIDETabBar( &GetViewFrame()->GetWindow() );
pTabBar->SetSplitHdl( LINK( this, BasicIDEShell, TabBarSplitHdl ) ); pTabBar->SetSplitHdl( LINK( this, BasicIDEShell, TabBarSplitHdl ) );
bTabBarSplitted = sal_False; bTabBarSplitted = sal_False;

View File

@@ -263,7 +263,13 @@ BasicDockingWindow::BasicDockingWindow( Window* pParent ) :
{ {
} }
BasicDockingWindow::BasicDockingWindow( Window* pParent, const ResId& rResId ) :
DockingWindow( pParent, rResId )
{
SetStyle( WB_BORDER | WB_3DLOOK | WB_DOCKABLE | WB_MOVEABLE |
WB_SIZEABLE | WB_ROLLABLE |
WB_DOCKABLE | WB_CLIPCHILDREN );
}
sal_Bool BasicDockingWindow::Docking( const Point& rPos, Rectangle& rRect ) sal_Bool BasicDockingWindow::Docking( const Point& rPos, Rectangle& rRect )
{ {

View File

@@ -44,7 +44,7 @@
#include <vcl/sound.hxx> #include <vcl/sound.hxx>
ObjectCatalog::ObjectCatalog( Window * pParent ) ObjectCatalog::ObjectCatalog( Window * pParent )
:FloatingWindow( pParent, IDEResId( RID_BASICIDE_OBJCAT ) ) :BasicDockingWindow( pParent, IDEResId( RID_BASICIDE_OBJCAT ) )
,aMacroTreeList( this, IDEResId( RID_TLB_MACROS ) ) ,aMacroTreeList( this, IDEResId( RID_TLB_MACROS ) )
,aToolBox(this, IDEResId(RID_TB_TOOLBOX)) ,aToolBox(this, IDEResId(RID_TB_TOOLBOX))
,aMacroDescr( this, IDEResId( RID_FT_MACRODESCR ) ) ,aMacroDescr( this, IDEResId( RID_FT_MACRODESCR ) )
@@ -96,6 +96,13 @@ ObjectCatalog::~ObjectCatalog()
GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this ); GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
} }
void ObjectCatalog::Paint( const Rectangle& )
{
String sOC = GetText();
long nPos = GetSizePixel().Width()/2-GetTextWidth(sOC)/2;
DrawText( Point( nPos, 10 ), String( sOC ) );
}
void ObjectCatalog::Move() void ObjectCatalog::Move()
{ {
BasicIDEGlobals::GetExtraData()->SetObjectCatalogPos( GetPosPixel() ); BasicIDEGlobals::GetExtraData()->SetObjectCatalogPos( GetPosPixel() );

View File

@@ -52,7 +52,7 @@ private:
ImageList m_aImagesNormal; ImageList m_aImagesNormal;
}; };
class ObjectCatalog : public FloatingWindow class ObjectCatalog : public BasicDockingWindow
{ {
private: private:
BasicTreeListBox aMacroTreeList; BasicTreeListBox aMacroTreeList;
@@ -68,6 +68,7 @@ protected:
virtual void Move(); virtual void Move();
virtual sal_Bool Close(); virtual sal_Bool Close();
virtual void Resize(); virtual void Resize();
virtual void Paint( const Rectangle& rRect );
public: public:
ObjectCatalog( Window * pParent ); ObjectCatalog( Window * pParent );
@@ -75,7 +76,6 @@ public:
void UpdateEntries(); void UpdateEntries();
void SetCurrentEntry( BasicEntryDescriptor& rDesc ); void SetCurrentEntry( BasicEntryDescriptor& rDesc );
void SetCancelHdl( const Link& rLink ) { aCancelHdl = rLink; } void SetCancelHdl( const Link& rLink ) { aCancelHdl = rLink; }
}; };

View File

@@ -30,7 +30,7 @@
#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }; #define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; };
FloatingWindow RID_BASICIDE_OBJCAT DockingWindow RID_BASICIDE_OBJCAT
{ {
HelpID = "basctl:FloatingWindow:RID_BASICIDE_OBJCAT"; HelpID = "basctl:FloatingWindow:RID_BASICIDE_OBJCAT";
OutputSize = TRUE ; OutputSize = TRUE ;
@@ -43,6 +43,7 @@ FloatingWindow RID_BASICIDE_OBJCAT
Zoomable = TRUE ; Zoomable = TRUE ;
Hide = TRUE ; Hide = TRUE ;
ClipChildren = TRUE ; ClipChildren = TRUE ;
Border = TRUE ;
Control RID_TLB_MACROS Control RID_TLB_MACROS
{ {
HelpId = HID_BASICIDE_OBJECTCAT ; HelpId = HID_BASICIDE_OBJECTCAT ;

View File

@@ -100,6 +100,8 @@ friend class LocalizationMgr;
friend class ContainerListenerImpl; friend class ContainerListenerImpl;
::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener; ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener;
sal_Bool bObjectCatalogDisplay;
#if _SOLAR__PRIVATE #if _SOLAR__PRIVATE
void Init(); void Init();
void InitTabBar(); void InitTabBar();

View File

@@ -78,6 +78,7 @@ protected:
public: public:
BasicDockingWindow( Window* pParent ); BasicDockingWindow( Window* pParent );
BasicDockingWindow( Window* pParent, const ResId& rResId );
}; };
// helper class for sorting TabBar // helper class for sorting TabBar