diff options
author | Tomcsik Bence <tomcsikbence@gmail.com> | 2012-03-11 21:40:02 +0100 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-03-11 21:49:13 +0100 |
commit | 0e8eb19a53338c83dab7fe19e2f23bcaecd52077 (patch) | |
tree | d316dfd8f51a5368375139fc6a478c9ea6cdb86a /basctl | |
parent | Add a virtual destrcutor to value to prevent memory leak in RTFValue (diff) | |
download | core-0e8eb19a53338c83dab7fe19e2f23bcaecd52077.tar.gz core-0e8eb19a53338c83dab7fe19e2f23bcaecd52077.zip |
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.
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/inc/basidesh.hrc | 3 | ||||
-rw-r--r-- | basctl/source/basicide/baside2.cxx | 31 | ||||
-rw-r--r-- | basctl/source/basicide/baside2.hxx | 6 | ||||
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 23 | ||||
-rw-r--r-- | basctl/source/basicide/basides1.cxx | 30 | ||||
-rw-r--r-- | basctl/source/basicide/basidesh.cxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/bastypes.cxx | 8 | ||||
-rw-r--r-- | basctl/source/basicide/objdlg.cxx | 9 | ||||
-rw-r--r-- | basctl/source/basicide/objdlg.hxx | 4 | ||||
-rw-r--r-- | basctl/source/basicide/objdlg.src | 3 | ||||
-rw-r--r-- | basctl/source/inc/basidesh.hxx | 2 | ||||
-rw-r--r-- | basctl/source/inc/bastypes.hxx | 1 |
12 files changed, 103 insertions, 19 deletions
diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc index 9e5ccb2b9398..dc1b43250357 100644 --- a/basctl/inc/basidesh.hrc +++ b/basctl/inc/basidesh.hrc @@ -31,6 +31,9 @@ #include <svx/svxids.hrc> #endif +// Width of Object Catalog pane in pixels +#define OBJCAT_PANE_WIDTH 240 + // Resource-ID's... #ifndef _SVX_NOIDERESIDS diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 7adc866ca490..ce6a14043078 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -33,6 +33,7 @@ #include "brkdlg.hxx" #include "iderdll.hxx" #include "iderdll2.hxx" +#include "objdlg.hxx" #include "baside2.hrc" @@ -1388,6 +1389,11 @@ void ModulWindow::SetLineNumberDisplay(bool b) aXEditorWindow.SetLineNumberDisplay(b); } +void ModulWindow::SetObjectCatalogDisplay(bool b) +{ + aXEditorWindow.SetObjectCatalogDisplay(b); +} + sal_Bool ModulWindow::IsPasteAllowed() { sal_Bool bPaste = sal_False; @@ -1420,6 +1426,7 @@ ModulWindowLayout::ModulWindowLayout( Window* pParent ) : aHSplitter( this, WinBits( WB_HSCROLL ) ), aWatchWindow( this ), aStackWindow( this ), + aObjectCatalog( this ), bVSplitted(sal_False), bHSplitted(sal_False), m_pModulWindow(0), @@ -1434,6 +1441,7 @@ ModulWindowLayout::ModulWindowLayout( Window* pParent ) : aWatchWindow.Show(); aStackWindow.Show(); + aObjectCatalog.Show(); Color aColor(GetSettings().GetStyleSettings().GetFieldTextColor()); m_aSyntaxColors[TT_UNKNOWN] = aColor; @@ -1506,12 +1514,13 @@ void ModulWindowLayout::ArrangeWindows() nVSplitPos = ( nVSplitPos < nMinPos ) ? 0 : ( aSz.Height() - SPLIT_HEIGHT ); Size aXEWSz; - aXEWSz.Width() = aSz.Width(); + aXEWSz.Width() = aSz.Width() - OBJCAT_PANE_WIDTH; + aXEWSz.Height() = nVSplitPos + 1; if ( m_pModulWindow ) { 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() ) ) ); @@ -1536,6 +1545,11 @@ void ModulWindowLayout::ArrangeWindows() if ( !aStackWindow.IsFloatingMode() ) 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() ) aHSplitter.Hide(); else @@ -1592,6 +1606,15 @@ sal_Bool ModulWindowLayout::IsToBeDocked( DockingWindow* pDockingWindow, const P 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; } @@ -1606,6 +1629,10 @@ void ModulWindowLayout::DockaWindow( DockingWindow* pDockingWindow ) { ArrangeWindows(); } + else if ( pDockingWindow == &aObjectCatalog ) + { + ArrangeWindows(); + } #if OSL_DEBUG_LEVEL > 0 else OSL_FAIL( "Wer will sich denn hier andocken ?" ); diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 0be4bb76d2b5..5dbc4be5dec6 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -54,6 +54,7 @@ class SvxSearchItem; #include "breakpoint.hxx" #include "linenumberwindow.hxx" +#include "objdlg.hxx" DBG_NAMEEX( ModulWindow ) @@ -291,6 +292,7 @@ private: EditorWindow aEdtWindow; ScrollBar aEWVScrollBar; bool bLineNumberDisplay; + bool bObjectCatalogDisplay; virtual void DataChanged(DataChangedEvent const & rDCEvt); @@ -307,6 +309,7 @@ public: ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; } void SetLineNumberDisplay(bool b); + void SetObjectCatalogDisplay(bool b); }; @@ -368,6 +371,7 @@ public: virtual sal_Bool IsReadOnly(); void SetLineNumberDisplay(bool); + void SetObjectCatalogDisplay(bool); StarBASIC* GetBasic() { XModule(); return xBasic; } @@ -437,6 +441,7 @@ private: WatchWindow aWatchWindow; StackWindow aStackWindow; + ObjectCatalog aObjectCatalog; sal_Bool bVSplitted; sal_Bool bHSplitted; @@ -474,6 +479,7 @@ public: WatchWindow& GetWatchWindow() { return aWatchWindow; } StackWindow& GetStackWindow() { return aStackWindow; } + ObjectCatalog& GetObjectCatalog() { return aObjectCatalog; } Image getImage(sal_uInt16 nId) const; diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index b7e394c91cb3..67c2a75e9fda 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1658,7 +1658,8 @@ ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) : aLineNumberWindow( this, pParent ), aEdtWindow( this ), aEWVScrollBar( this, WB_VSCROLL | WB_DRAG ), - bLineNumberDisplay(false) + bLineNumberDisplay(false), + bObjectCatalogDisplay(true) { aEdtWindow.SetModulWindow( pParent ); aBrkWindow.SetModulWindow( pParent ); @@ -1681,23 +1682,24 @@ void ComplexEditorWindow::Resize() long nSBWidth = aEWVScrollBar.GetSizePixel().Width(); Size aBrkSz(nBrkWidth, aSz.Height()); - aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz ); Size aLnSz(aLineNumberWindow.GetWidth(), aSz.Height()); - aLineNumberWindow.SetPosSizePixel(Point(DWBORDER+aBrkSz.Width() - 1, DWBORDER), aLnSz); 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()); - aEdtWindow.SetPosSizePixel( Point( DWBORDER+aBrkSz.Width()+aLnSz.Width()-1, DWBORDER ), aEWSz ); + aEdtWindow.SetPosSizePixel( Point( DWBORDER + aBrkSz.Width() + aLnSz.Width() - 1, DWBORDER ), aEWSz ); } 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); } - 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 ) @@ -1734,15 +1736,18 @@ void ComplexEditorWindow::DataChanged(DataChangedEvent const & rDCEvt) void ComplexEditorWindow::SetLineNumberDisplay(bool b) { - if(b == bLineNumberDisplay) - return; + bLineNumberDisplay = b; + Resize(); if(b) aLineNumberWindow.Show(); else aLineNumberWindow.Hide(); +} - bLineNumberDisplay = b; +void ComplexEditorWindow::SetObjectCatalogDisplay(bool b) +{ + bObjectCatalogDisplay = b; Resize(); } diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 8ca700ba37bb..96f662ba0c56 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -432,10 +432,22 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) break; case SID_BASICIDE_OBJCAT: { - if ( pObjectCatalog ) - ShowObjectDialog( sal_False, sal_True ); + if ( bObjectCatalogDisplay ) + { + 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 - 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; case SID_BASICIDE_NAMECHANGEDONTAB: @@ -870,6 +882,18 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) break; case SID_BASICIDE_CHOOSEMACRO: 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_CREATEMACRO: case SID_BASICIDE_EDITMACRO: diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 8458625a9324..5aaf09cc4d22 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -206,6 +206,8 @@ void BasicIDEShell::Init() pObjectCatalog = 0; bCreatingWindow = sal_False; + bObjectCatalogDisplay = sal_True; + pTabBar = new BasicIDETabBar( &GetViewFrame()->GetWindow() ); pTabBar->SetSplitHdl( LINK( this, BasicIDEShell, TabBarSplitHdl ) ); bTabBarSplitted = sal_False; diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 7cffc4b2cea7..f7221f43f40d 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -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 ) { diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx index 14355bffa4d0..7e598de46754 100644 --- a/basctl/source/basicide/objdlg.cxx +++ b/basctl/source/basicide/objdlg.cxx @@ -44,7 +44,7 @@ #include <vcl/sound.hxx> ObjectCatalog::ObjectCatalog( Window * pParent ) - :FloatingWindow( pParent, IDEResId( RID_BASICIDE_OBJCAT ) ) + :BasicDockingWindow( pParent, IDEResId( RID_BASICIDE_OBJCAT ) ) ,aMacroTreeList( this, IDEResId( RID_TLB_MACROS ) ) ,aToolBox(this, IDEResId(RID_TB_TOOLBOX)) ,aMacroDescr( this, IDEResId( RID_FT_MACRODESCR ) ) @@ -96,6 +96,13 @@ ObjectCatalog::~ObjectCatalog() 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() { BasicIDEGlobals::GetExtraData()->SetObjectCatalogPos( GetPosPixel() ); diff --git a/basctl/source/basicide/objdlg.hxx b/basctl/source/basicide/objdlg.hxx index df77a64e360c..47e46518bbba 100644 --- a/basctl/source/basicide/objdlg.hxx +++ b/basctl/source/basicide/objdlg.hxx @@ -52,7 +52,7 @@ private: ImageList m_aImagesNormal; }; -class ObjectCatalog : public FloatingWindow +class ObjectCatalog : public BasicDockingWindow { private: BasicTreeListBox aMacroTreeList; @@ -68,6 +68,7 @@ protected: virtual void Move(); virtual sal_Bool Close(); virtual void Resize(); + virtual void Paint( const Rectangle& rRect ); public: ObjectCatalog( Window * pParent ); @@ -75,7 +76,6 @@ public: void UpdateEntries(); void SetCurrentEntry( BasicEntryDescriptor& rDesc ); - void SetCancelHdl( const Link& rLink ) { aCancelHdl = rLink; } }; diff --git a/basctl/source/basicide/objdlg.src b/basctl/source/basicide/objdlg.src index 845f49126257..03f740770b10 100644 --- a/basctl/source/basicide/objdlg.src +++ b/basctl/source/basicide/objdlg.src @@ -30,7 +30,7 @@ #define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }; -FloatingWindow RID_BASICIDE_OBJCAT +DockingWindow RID_BASICIDE_OBJCAT { HelpID = "basctl:FloatingWindow:RID_BASICIDE_OBJCAT"; OutputSize = TRUE ; @@ -43,6 +43,7 @@ FloatingWindow RID_BASICIDE_OBJCAT Zoomable = TRUE ; Hide = TRUE ; ClipChildren = TRUE ; + Border = TRUE ; Control RID_TLB_MACROS { HelpId = HID_BASICIDE_OBJECTCAT ; diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index 2978eed81849..2162b7a21164 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -100,6 +100,8 @@ friend class LocalizationMgr; friend class ContainerListenerImpl; ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener; + sal_Bool bObjectCatalogDisplay; + #if _SOLAR__PRIVATE void Init(); void InitTabBar(); diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx index ac298cf19e59..2c1207b3a39c 100644 --- a/basctl/source/inc/bastypes.hxx +++ b/basctl/source/inc/bastypes.hxx @@ -78,6 +78,7 @@ protected: public: BasicDockingWindow( Window* pParent ); + BasicDockingWindow( Window* pParent, const ResId& rResId ); }; // helper class for sorting TabBar |