summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorThomas Benisch <tbe@openoffice.org>2001-11-12 21:39:49 +0000
committerThomas Benisch <tbe@openoffice.org>2001-11-12 21:39:49 +0000
commitc29c7a86c8cb18d0e0602cddb3f24373e2424098 (patch)
tree46def78b2cd4a79b59d0b2b0209dd92cf16e2200 /basctl
parentf27135e6f0e410170875eefa1b08f486da7117f4 (diff)
#92173# Reimplement Basic password protection UI in Basic IDE
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/baside2.cxx81
-rw-r--r--basctl/source/basicide/baside2.hxx7
-rw-r--r--basctl/source/basicide/baside2b.cxx8
-rw-r--r--basctl/source/basicide/baside3.cxx163
-rw-r--r--basctl/source/basicide/basides1.cxx4
-rw-r--r--basctl/source/basicide/basidesh.cxx5
-rw-r--r--basctl/source/basicide/bastypes.cxx42
-rw-r--r--basctl/source/basicide/macrodlg.cxx34
-rw-r--r--basctl/source/basicide/moduldlg.cxx144
-rw-r--r--basctl/source/dlged/dlged.cxx25
-rw-r--r--basctl/source/dlged/dlgedfunc.cxx8
-rw-r--r--basctl/source/inc/dlged.hxx8
12 files changed, 410 insertions, 119 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 52471b658d64..2677f04d141f 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: baside2.cxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: tbe $ $Date: 2001-11-09 15:41:40 $
+ * last change: $Author: tbe $ $Date: 2001-11-12 22:33:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1047,8 +1047,11 @@ void __EXPORT ModulWindow::ExecuteCommand( SfxRequest& rReq )
break;
case SID_CUT:
{
- GetEditView()->Cut();
- BasicIDE::GetBindings().Invalidate( SID_DOC_MODIFIED );
+ if ( !IsReadOnly() )
+ {
+ GetEditView()->Cut();
+ BasicIDE::GetBindings().Invalidate( SID_DOC_MODIFIED );
+ }
}
break;
case SID_COPY:
@@ -1058,8 +1061,11 @@ void __EXPORT ModulWindow::ExecuteCommand( SfxRequest& rReq )
break;
case SID_PASTE:
{
- GetEditView()->Paste();
- BasicIDE::GetBindings().Invalidate( SID_DOC_MODIFIED );
+ if ( !IsReadOnly() )
+ {
+ GetEditView()->Paste();
+ BasicIDE::GetBindings().Invalidate( SID_DOC_MODIFIED );
+ }
}
break;
case SID_BASICIDE_BRKPNTSCHANGED:
@@ -1081,29 +1087,28 @@ void __EXPORT ModulWindow::GetState( SfxItemSet &rSet )
switch ( nWh )
{
// allgemeine Items:
-// case SID_CUT:
- case SID_COPY:
+ case SID_CUT:
{
-// if ( !GetEditView() || !GetEditView()->HasSelection() )
-// rSet.DisableItem( nWh );
+ if ( !GetEditView() || !GetEditView()->HasSelection() )
+ rSet.DisableItem( nWh );
+
+ if ( IsReadOnly() )
+ rSet.DisableItem( nWh );
}
break;
- case SID_DELETE:
+ case SID_COPY:
{
- ;
+ if ( !GetEditView() || !GetEditView()->HasSelection() )
+ rSet.DisableItem( nWh );
}
break;
- case SID_CUT:
case SID_PASTE:
{
- // disable slots for readonly libraries
- SfxObjectShell* pShell = GetShell();
- ::rtl::OUString aOULibName( GetLibName() );
- Reference< script::XLibraryContainer2 > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) )
- {
+ if ( !IsPasteAllowed() )
+ rSet.DisableItem( nWh );
+
+ if ( IsReadOnly() )
rSet.DisableItem( nWh );
- }
}
break;
case SID_BASICIDE_STAT_POS:
@@ -1341,6 +1346,42 @@ void ModulWindow::SetReadOnly( BOOL b )
GetEditView()->SetReadOnly( b );
}
+BOOL ModulWindow::IsReadOnly()
+{
+ BOOL bReadOnly = FALSE;
+
+ if ( GetEditView() )
+ bReadOnly = GetEditView()->IsReadOnly();
+
+ return bReadOnly;
+}
+
+BOOL ModulWindow::IsPasteAllowed()
+{
+ BOOL bPaste = FALSE;
+
+ // get clipboard
+ Reference< datatransfer::clipboard::XClipboard > xClipboard = GetClipboard();
+ if ( xClipboard.is() )
+ {
+ // get clipboard content
+ const sal_uInt32 nRef = Application::ReleaseSolarMutex();
+ Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents();
+ Application::AcquireSolarMutex( nRef );
+ if ( xTransf.is() )
+ {
+ datatransfer::DataFlavor aFlavor;
+ SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor );
+ if ( xTransf->isDataFlavorSupported( aFlavor ) )
+ {
+ bPaste = TRUE;
+ }
+ }
+ }
+
+ return bPaste;
+}
+
ModulWindowLayout::ModulWindowLayout( Window* pParent ) :
Window( pParent, WB_CLIPCHILDREN ),
aWatchWindow( this ),
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 146bf69ec6bc..999ef32e6270 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: baside2.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: tbe $ $Date: 2001-09-25 09:08:45 $
+ * last change: $Author: tbe $ $Date: 2001-11-12 22:33:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -403,7 +403,7 @@ public:
virtual String CreateSbxDescription();
virtual BOOL AllowUndo();
virtual void SetReadOnly( BOOL bReadOnly );
-
+ virtual BOOL IsReadOnly();
SbModule* GetSbModule() { return xModule; }
void SetSbModule( SbModule* pModule ) { xModule = pModule; }
@@ -433,6 +433,7 @@ public:
BasicStatus& GetBasicStatus() { return aStatus; }
virtual BOOL IsModified();
+ virtual BOOL IsPasteAllowed();
void FrameWindowMoved();
void ShowCursor( BOOL bOn );
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 4cb81a33a7ee..22f1e35edbc4 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: baside2b.cxx,v $
*
- * $Revision: 1.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: tbe $ $Date: 2001-11-09 11:29:59 $
+ * last change: $Author: tbe $ $Date: 2001-11-12 22:33:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -770,11 +770,11 @@ void EditorWindow::CreateEditEngine()
Reference< script::XLibraryContainer2 > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) )
{
- pEditView->SetReadOnly( TRUE );
+ pModulWindow->SetReadOnly( TRUE );
}
if ( pShell && pShell->IsReadOnly() )
- pEditView->SetReadOnly( TRUE );
+ pModulWindow->SetReadOnly( TRUE );
}
void EditorWindow::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 5c9e97c1c045..00cd5c9bd72d 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: baside3.cxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: tbe $ $Date: 2001-10-17 10:12:29 $
+ * last change: $Author: tbe $ $Date: 2001-11-12 22:33:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -110,6 +110,10 @@
#ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_
#include <xmlscript/xmldlg_imexp.hxx>
#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XLIBRYARYCONTAINER2_HPP_
+#include <com/sun/star/script/XLibraryContainer2.hpp>
+#endif
+
using namespace comphelper;
using namespace ::com::sun::star;
@@ -140,6 +144,21 @@ DialogWindow::DialogWindow( Window* pParent, StarBASIC* pBasic,
LINK(this, DialogWindow, NotifyUndoActionHdl));
SetHelpId( HID_BASICIDE_DIALOGWINDOW );
+
+ // new
+
+ // set readonly mode for readonly libraries
+ ::rtl::OUString aOULibName( aLibName );
+ Reference< script::XLibraryContainer2 > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pShell ), UNO_QUERY );
+ if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) )
+ {
+ SetReadOnly( TRUE );
+ }
+
+ if ( pShell && pShell->IsReadOnly() )
+ SetReadOnly( TRUE );
+
+ // end of new
}
DialogWindow::DialogWindow( DialogWindow* pOrgWin ) :
@@ -298,18 +317,30 @@ void __EXPORT DialogWindow::GetState( SfxItemSet& rSet )
{
case SID_PASTE:
{
- if ( !pEditor->IsPasteAllowed() )
+ if ( !IsPasteAllowed() )
+ rSet.DisableItem( nWh );
+
+ if ( IsReadOnly() )
rSet.DisableItem( nWh );
}
break;
- case SID_CUT:
case SID_COPY:
+ {
+ // any object selected?
+ if ( !pEditor->GetView()->HasMarkedObj() )
+ rSet.DisableItem( nWh );
+ }
+ break;
+ case SID_CUT:
case SID_DELETE:
case SID_BACKSPACE:
{
// any object selected?
if ( !pEditor->GetView()->HasMarkedObj() )
rSet.DisableItem( nWh );
+
+ if ( IsReadOnly() )
+ rSet.DisableItem( nWh );
}
break;
case SID_REDO:
@@ -335,47 +366,54 @@ void __EXPORT DialogWindow::GetState( SfxItemSet& rSet )
case SID_CHOOSE_CONTROLS:
{
- SfxAllEnumItem aItem( SID_CHOOSE_CONTROLS );
- if( GetEditor()->GetMode() == DLGED_SELECT )
- aItem.SetValue( SVX_SNAP_SELECT );
+ if ( IsReadOnly() )
+ {
+ rSet.DisableItem( nWh );
+ }
else
{
- USHORT nObj;
- switch( pEditor->GetInsertObj() )
+ SfxAllEnumItem aItem( SID_CHOOSE_CONTROLS );
+ if ( GetEditor()->GetMode() == DLGED_SELECT )
+ aItem.SetValue( SVX_SNAP_SELECT );
+ else
{
- case OBJ_DLG_PUSHBUTTON: nObj = SVX_SNAP_PUSHBUTTON; break;
- case OBJ_DLG_RADIOBUTTON: nObj = SVX_SNAP_RADIOBUTTON; break;
- case OBJ_DLG_CHECKBOX: nObj = SVX_SNAP_CHECKBOX; break;
- case OBJ_DLG_LISTBOX: nObj = SVX_SNAP_LISTBOX; break;
- case OBJ_DLG_COMBOBOX: nObj = SVX_SNAP_COMBOBOX; break;
- case OBJ_DLG_GROUPBOX: nObj = SVX_SNAP_GROUPBOX; break;
- case OBJ_DLG_EDIT: nObj = SVX_SNAP_EDIT; break;
- case OBJ_DLG_FIXEDTEXT: nObj = SVX_SNAP_FIXEDTEXT; break;
- case OBJ_DLG_IMAGECONTROL: nObj = SVX_SNAP_IMAGECONTROL; break;
- case OBJ_DLG_PROGRESSBAR: nObj = SVX_SNAP_PROGRESSBAR; break;
- case OBJ_DLG_HSCROLLBAR: nObj = SVX_SNAP_HSCROLLBAR; break;
- case OBJ_DLG_VSCROLLBAR: nObj = SVX_SNAP_VSCROLLBAR; break;
- case OBJ_DLG_HFIXEDLINE: nObj = SVX_SNAP_HFIXEDLINE; break;
- case OBJ_DLG_VFIXEDLINE: nObj = SVX_SNAP_VFIXEDLINE; break;
- case OBJ_DLG_DATEFIELD: nObj = SVX_SNAP_DATEFIELD; break;
- case OBJ_DLG_TIMEFIELD: nObj = SVX_SNAP_TIMEFIELD; break;
- case OBJ_DLG_NUMERICFIELD: nObj = SVX_SNAP_NUMERICFIELD; break;
- case OBJ_DLG_CURRENCYFIELD: nObj = SVX_SNAP_CURRENCYFIELD; break;
- case OBJ_DLG_FORMATTEDFIELD: nObj = SVX_SNAP_FORMATTEDFIELD; break;
- case OBJ_DLG_PATTERNFIELD: nObj = SVX_SNAP_PATTERNFIELD; break;
- case OBJ_DLG_FILECONTROL: nObj = SVX_SNAP_FILECONTROL; break;
- default: nObj = 0;
- }
+ USHORT nObj;
+ switch( pEditor->GetInsertObj() )
+ {
+ case OBJ_DLG_PUSHBUTTON: nObj = SVX_SNAP_PUSHBUTTON; break;
+ case OBJ_DLG_RADIOBUTTON: nObj = SVX_SNAP_RADIOBUTTON; break;
+ case OBJ_DLG_CHECKBOX: nObj = SVX_SNAP_CHECKBOX; break;
+ case OBJ_DLG_LISTBOX: nObj = SVX_SNAP_LISTBOX; break;
+ case OBJ_DLG_COMBOBOX: nObj = SVX_SNAP_COMBOBOX; break;
+ case OBJ_DLG_GROUPBOX: nObj = SVX_SNAP_GROUPBOX; break;
+ case OBJ_DLG_EDIT: nObj = SVX_SNAP_EDIT; break;
+ case OBJ_DLG_FIXEDTEXT: nObj = SVX_SNAP_FIXEDTEXT; break;
+ case OBJ_DLG_IMAGECONTROL: nObj = SVX_SNAP_IMAGECONTROL; break;
+ case OBJ_DLG_PROGRESSBAR: nObj = SVX_SNAP_PROGRESSBAR; break;
+ case OBJ_DLG_HSCROLLBAR: nObj = SVX_SNAP_HSCROLLBAR; break;
+ case OBJ_DLG_VSCROLLBAR: nObj = SVX_SNAP_VSCROLLBAR; break;
+ case OBJ_DLG_HFIXEDLINE: nObj = SVX_SNAP_HFIXEDLINE; break;
+ case OBJ_DLG_VFIXEDLINE: nObj = SVX_SNAP_VFIXEDLINE; break;
+ case OBJ_DLG_DATEFIELD: nObj = SVX_SNAP_DATEFIELD; break;
+ case OBJ_DLG_TIMEFIELD: nObj = SVX_SNAP_TIMEFIELD; break;
+ case OBJ_DLG_NUMERICFIELD: nObj = SVX_SNAP_NUMERICFIELD; break;
+ case OBJ_DLG_CURRENCYFIELD: nObj = SVX_SNAP_CURRENCYFIELD; break;
+ case OBJ_DLG_FORMATTEDFIELD: nObj = SVX_SNAP_FORMATTEDFIELD; break;
+ case OBJ_DLG_PATTERNFIELD: nObj = SVX_SNAP_PATTERNFIELD; break;
+ case OBJ_DLG_FILECONTROL: nObj = SVX_SNAP_FILECONTROL; break;
+ default: nObj = 0;
+ }
#ifdef DBG_UTIL
- if( !nObj )
- {
- DBG_WARNING( "SID_CHOOSE_CONTROLS: Unbekannt!" );
- }
+ if( !nObj )
+ {
+ DBG_WARNING( "SID_CHOOSE_CONTROLS: Unbekannt!" );
+ }
#endif
- aItem.SetValue( nObj );
- }
+ aItem.SetValue( nObj );
+ }
- rSet.Put( aItem );
+ rSet.Put( aItem );
+ }
}
break;
}
@@ -389,22 +427,31 @@ void __EXPORT DialogWindow::ExecuteCommand( SfxRequest& rReq )
switch ( rReq.GetSlot() )
{
case SID_CUT:
- GetEditor()->Cut();
- BasicIDE::GetBindings().Invalidate( SID_DOC_MODIFIED );
+ if ( !IsReadOnly() )
+ {
+ GetEditor()->Cut();
+ BasicIDE::GetBindings().Invalidate( SID_DOC_MODIFIED );
+ }
break;
case SID_DELETE:
#ifdef MAC
case SID_BACKSPACE:
#endif
- GetEditor()->Delete();
- BasicIDE::GetBindings().Invalidate( SID_DOC_MODIFIED );
+ if ( !IsReadOnly() )
+ {
+ GetEditor()->Delete();
+ BasicIDE::GetBindings().Invalidate( SID_DOC_MODIFIED );
+ }
break;
case SID_COPY:
GetEditor()->Copy();
break;
case SID_PASTE:
- GetEditor()->Paste();
- BasicIDE::GetBindings().Invalidate( SID_DOC_MODIFIED );
+ if ( !IsReadOnly() )
+ {
+ GetEditor()->Paste();
+ BasicIDE::GetBindings().Invalidate( SID_DOC_MODIFIED );
+ }
break;
case SID_CHOOSE_CONTROLS:
{
@@ -636,6 +683,32 @@ String DialogWindow::GetTitle()
return GetName();
}
+void DialogWindow::SetReadOnly( BOOL b )
+{
+ if ( pEditor )
+ {
+ if ( b )
+ pEditor->SetMode( DLGED_READONLY );
+ else
+ pEditor->SetMode( DLGED_SELECT );
+ }
+}
+
+BOOL DialogWindow::IsReadOnly()
+{
+ BOOL bReadOnly = FALSE;
+
+ if ( pEditor && pEditor->GetMode() == DLGED_READONLY )
+ bReadOnly = TRUE;
+
+ return bReadOnly;
+}
+
+BOOL DialogWindow::IsPasteAllowed()
+{
+ return pEditor ? pEditor->IsPasteAllowed() : FALSE;
+}
+
void DialogWindow::StoreData()
{
if ( IsModified() )
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 3cb00de5b2d8..06d75607ada9 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: basides1.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: tbe $ $Date: 2001-11-02 13:45:09 $
+ * last change: $Author: tbe $ $Date: 2001-11-12 22:35:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 32659b880033..7555be49d41c 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: basidesh.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: tbe $ $Date: 2001-11-02 13:45:09 $
+ * last change: $Author: tbe $ $Date: 2001-11-12 22:35:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -381,6 +381,7 @@ IMPL_LINK( BasicIDEShell, TabBarHdl, TabBar *, pCurTabBar )
IDEBaseWindow* pWin = aIDEWindowTable.Get( nCurId );
DBG_ASSERT( pWin, "Eintrag in TabBar passt zu keinem Fenster!" );
SetCurWindow( pWin );
+ ((BasicIDETabBar*)pCurTabBar)->SetCurrentLib( pWin->GetBasic() );
return 0;
}
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 3d5804d65097..f632ceb8963e 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: bastypes.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: tbe $ $Date: 2001-11-02 13:45:09 $
+ * last change: $Author: tbe $ $Date: 2001-11-12 22:35:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,6 +86,9 @@
#include <sfx2/passwd.hxx>
#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XLIBRYARYCONTAINER2_HPP_
+#include <com/sun/star/script/XLibraryContainer2.hpp>
+#endif
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINERPASSWORD_HPP_
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#endif
@@ -247,6 +250,11 @@ void IDEBaseWindow::SetReadOnly( BOOL )
{
}
+BOOL IDEBaseWindow::IsReadOnly()
+{
+ return FALSE;
+}
+
void __EXPORT IDEBaseWindow::BasicStarted()
{
}
@@ -260,6 +268,11 @@ BOOL __EXPORT IDEBaseWindow::IsModified()
return TRUE;
}
+BOOL __EXPORT IDEBaseWindow::IsPasteAllowed()
+{
+ return FALSE;
+}
+
Window* __EXPORT IDEBaseWindow::GetLayoutWindow()
{
return this;
@@ -583,6 +596,29 @@ void __EXPORT BasicIDETabBar::Command( const CommandEvent& rCEvt )
aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
aPopup.EnableItem( SID_BASICIDE_HIDECURPAGE, FALSE );
}
+
+ if ( pCurrentLib )
+ {
+ BasicManager* pBasMgr = BasicIDE::FindBasicManager( pCurrentLib );
+ if ( pBasMgr )
+ {
+ SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
+ ::rtl::OUString aOULibName( pCurrentLib->GetName() );
+ Reference< script::XLibraryContainer2 > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
+ Reference< script::XLibraryContainer2 > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pShell ), UNO_QUERY );
+ if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
+ ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) )
+ {
+ aPopup.EnableItem( aPopup.GetItemId( 0 ), FALSE );
+ //aPopup.EnableItem( SID_BASICIDE_NEWMODULE, FALSE );
+ //aPopup.EnableItem( SID_BASICIDE_NEWDIALOG, FALSE );
+ aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, FALSE );
+ aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
+ //aPopup.RemoveDisabledEntries();
+ }
+ }
+ }
+
BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
@@ -590,7 +626,9 @@ void __EXPORT BasicIDETabBar::Command( const CommandEvent& rCEvt )
{
pDispatcher->Execute( aPopup.Execute( this, aPos ) );
}
+
}
+
/*
else if ( ( rCEvt.GetCommand() == COMMAND_STARTDRAG ) && pCurrentLib && !IsInEditMode() )
{
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index 74d2cd9c9312..8cba99547de2 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: macrodlg.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: tbe $ $Date: 2001-10-24 17:00:15 $
+ * last change: $Author: tbe $ $Date: 2001-11-12 22:37:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -87,6 +87,9 @@
#include <sfx2/minfitem.hxx>
#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XLIBRYARYCONTAINER2_HPP_
+#include <com/sun/star/script/XLibraryContainer2.hpp>
+#endif
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -499,6 +502,31 @@ void MacroChooser::CheckButtons()
SbxVariable* pVar = aBasicBox.FindVariable( pCurEntry );
SbMethod* pMethod = GetMacro();
+ // check, if corresponding libraries are readonly
+ BOOL bReadOnly = FALSE;
+ USHORT nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0;
+ if ( nDepth == 1 || nDepth == 2 )
+ {
+ SvLBoxEntry* pLibEntry = 0;
+ if ( nDepth == 1 )
+ pLibEntry = pCurEntry;
+ else if ( nDepth == 2)
+ pLibEntry = aBasicBox.GetParent( pCurEntry );
+ BasicManager* pBasMgr = BasicIDE::FindBasicManager( aBasicBox.GetEntryText( aBasicBox.GetParent( pLibEntry ) ) );
+ if ( pBasMgr )
+ {
+ SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
+ ::rtl::OUString aOULibName( aBasicBox.GetEntryText( pLibEntry ) );
+ Reference< script::XLibraryContainer2 > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
+ Reference< script::XLibraryContainer2 > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pShell ), UNO_QUERY );
+ if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
+ ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) )
+ {
+ bReadOnly = TRUE;
+ }
+ }
+ }
+
// Run...
BOOL bEnable = pMethod ? TRUE : FALSE;
if ( ( nMode != MACROCHOOSER_CHOOSEONLY ) && StarBASIC::IsRunning() )
@@ -518,7 +546,7 @@ void MacroChooser::CheckButtons()
// aNewDelButton....
EnableButton( aNewDelButton,
- !StarBASIC::IsRunning() && ( nMode == MACROCHOOSER_ALL ) && !aBasicBox.IsEntryProtected( aBasicBox.GetCurEntry() ) );
+ !StarBASIC::IsRunning() && ( nMode == MACROCHOOSER_ALL ) && !aBasicBox.IsEntryProtected( aBasicBox.GetCurEntry() ) && !bReadOnly );
BOOL bPrev = bNewDelIsDel;
bNewDelIsDel = pMethod ? TRUE : FALSE;
if ( ( bPrev != bNewDelIsDel ) && ( nMode != MACROCHOOSER_CHOOSEONLY ) )
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index c6add77b2f6e..4daac44e73ee 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: moduldlg.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: tbe $ $Date: 2001-11-02 13:45:10 $
+ * last change: $Author: tbe $ $Date: 2001-11-12 22:37:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,6 +77,9 @@
#ifndef _COM_SUN_STAR_IO_XINPUTSTREAMPROVIDER_HXX_
#include <com/sun/star/io/XInputStreamProvider.hpp>
#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XLIBRYARYCONTAINER2_HPP_
+#include <com/sun/star/script/XLibraryContainer2.hpp>
+#endif
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINERPASSWORD_HPP_
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#endif
@@ -102,9 +105,33 @@ ExtBasicTreeListBox::~ExtBasicTreeListBox()
BOOL __EXPORT ExtBasicTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& )
{
- DBG_ASSERT( pEntry, "Kein Eintrag?" );
- USHORT nDepth = GetModel()->GetDepth( pEntry );
- return nDepth == 2 ? TRUE : FALSE;
+ BOOL bRet = FALSE;
+
+ if ( pEntry )
+ {
+ USHORT nDepth = GetModel()->GetDepth( pEntry );
+
+ if ( nDepth == 2 )
+ {
+ SvLBoxEntry* pLibEntry = GetParent( pEntry );
+ BasicManager* pBasMgr = BasicIDE::FindBasicManager( GetEntryText( GetParent( pLibEntry ) ) );
+ if ( pBasMgr )
+ {
+ SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
+ ::rtl::OUString aOULibName( GetEntryText( pLibEntry ) );
+ Reference< script::XLibraryContainer2 > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
+ Reference< script::XLibraryContainer2 > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pShell ), UNO_QUERY );
+ if ( !( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
+ ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) ) )
+ {
+ // allow editing only for libraries, which are not readonly
+ bRet = TRUE;
+ }
+ }
+ }
+ }
+
+ return bRet;
}
BOOL __EXPORT ExtBasicTreeListBox::EditedEntry( SvLBoxEntry* pEntry, const String& rNewText )
@@ -167,8 +194,35 @@ BOOL __EXPORT ExtBasicTreeListBox::EditedEntry( SvLBoxEntry* pEntry, const Strin
DragDropMode __EXPORT ExtBasicTreeListBox::NotifyStartDrag( TransferDataContainer& rData, SvLBoxEntry* pEntry )
{
- USHORT nDepth = pEntry ? GetModel()->GetDepth( pEntry ) : 0;
- return nDepth == 2 ? GetDragDropMode() : 0;
+ DragDropMode nMode = SV_DRAGDROP_NONE;
+
+ if ( pEntry )
+ {
+ USHORT nDepth = GetModel()->GetDepth( pEntry );
+
+ if ( nDepth == 2 )
+ {
+ nMode = SV_DRAGDROP_CTRL_COPY;
+
+ SvLBoxEntry* pLibEntry = GetParent( pEntry );
+ BasicManager* pBasMgr = BasicIDE::FindBasicManager( GetEntryText( GetParent( pLibEntry ) ) );
+ if ( pBasMgr )
+ {
+ SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
+ ::rtl::OUString aOULibName( GetEntryText( pLibEntry ) );
+ Reference< script::XLibraryContainer2 > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
+ Reference< script::XLibraryContainer2 > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pShell ), UNO_QUERY );
+ if ( !( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
+ ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) ) )
+ {
+ // allow MOVE mode only for libraries, which are not readonly
+ nMode |= SV_DRAGDROP_CTRL_MOVE;
+ }
+ }
+ }
+ }
+
+ return nMode;
}
@@ -185,33 +239,46 @@ BOOL __EXPORT ExtBasicTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry )
else if ( ( nDepth == 2 ) && ( GetParent( pEntry ) == GetParent( pSelected ) ) )
bValid = FALSE;
- // don't drop on a library, which is not loaded or password protected
- if ( bValid && ( nDepth == 1 ) )
+ // don't drop on a library, which is not loaded, readonly or password protected
+ if ( bValid && ( nDepth == 1 || nDepth == 2) )
{
- String aLibName = GetEntryText( pEntry );
- String aBasMgrName = GetEntryText( GetParent( pEntry ) );
- BasicManager* pBasMgr = BasicIDE::FindBasicManager( aBasMgrName );
+ SvLBoxEntry* pLibEntry = 0;
+ if ( nDepth == 1 )
+ pLibEntry = pEntry;
+ else if ( nDepth == 2 )
+ pLibEntry = GetParent( pEntry );
+
+ BasicManager* pBasMgr = BasicIDE::FindBasicManager( GetEntryText( GetParent( pLibEntry ) ) );
if ( pBasMgr )
{
SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
- ::rtl::OUString aOULibName( aLibName );
+ ::rtl::OUString aOULibName( GetEntryText( pLibEntry ) );
- // check if module library is loaded and password protected
- Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
+ // check if module library is not loaded, readonly or password protected
+ Reference< script::XLibraryContainer2 > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
{
if ( !xModLibContainer->isLibraryLoaded( aOULibName ) )
bValid = FALSE;
+ if ( xModLibContainer->isLibraryReadOnly( aOULibName ) )
+ bValid = FALSE;
+
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
bValid = FALSE;
}
- // check if dialog library is loaded
- Reference< script::XLibraryContainer > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pShell ), UNO_QUERY );
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
- bValid = FALSE;
+ // check if dialog library is not loaded or readonly
+ Reference< script::XLibraryContainer2 > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pShell ), UNO_QUERY );
+ if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) )
+ {
+ if ( !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
+ bValid = FALSE;
+
+ if ( xDlgLibContainer->isLibraryReadOnly( aOULibName ) )
+ bValid = FALSE;
+ }
}
else
bValid = FALSE;
@@ -583,6 +650,7 @@ void __EXPORT ObjectPage::DeactivatePage()
void ObjectPage::CheckButtons()
{
+ BOOL bReadOnly = FALSE;
BOOL bEnableNew = FALSE;
// String aEditText( aEdit.GetText() );
@@ -591,11 +659,47 @@ void ObjectPage::CheckButtons()
SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
USHORT nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0;
+ // enable/disable edit button
if ( nDepth == 2 )
aEditButton.Enable();
else
aEditButton.Disable();
+ // check, if corresponding libraries are readonly
+ if ( nDepth == 1 || nDepth == 2 )
+ {
+ SvLBoxEntry* pLibEntry = 0;
+ if ( nDepth == 1 )
+ pLibEntry = pCurEntry;
+ else if ( nDepth == 2)
+ pLibEntry = aBasicBox.GetParent( pCurEntry );
+ BasicManager* pBasMgr = BasicIDE::FindBasicManager( aBasicBox.GetEntryText( aBasicBox.GetParent( pLibEntry ) ) );
+ if ( pBasMgr )
+ {
+ SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
+ ::rtl::OUString aOULibName( aBasicBox.GetEntryText( pLibEntry ) );
+ Reference< script::XLibraryContainer2 > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
+ Reference< script::XLibraryContainer2 > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pShell ), UNO_QUERY );
+ if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
+ ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) )
+ {
+ bReadOnly = TRUE;
+ }
+ }
+ }
+
+ // enable/disable new module/dialog buttons
+ if ( bReadOnly )
+ {
+ aNewModButton.Disable();
+ aNewDlgButton.Disable();
+ }
+ else
+ {
+ aNewModButton.Enable();
+ aNewDlgButton.Enable();
+ }
+
SvLBoxEntry* pEntry = pCurEntry;
while ( pEntry && ( ((BasicEntry*)pEntry->GetUserData())->GetType() != OBJTYPE_LIB ) )
pEntry = aBasicBox.GetParent( pEntry );
@@ -628,7 +732,7 @@ void ObjectPage::CheckButtons()
if ( pCurEntry )
{
BYTE nType = ((BasicEntry*)pCurEntry->GetUserData())->GetType();
- if ( ( nType == OBJTYPE_OBJECT ) || ( nType == OBJTYPE_MODULE ) )
+ if ( !bReadOnly && ( ( nType == OBJTYPE_OBJECT ) || ( nType == OBJTYPE_MODULE ) ) )
aDelButton.Enable();
else
aDelButton.Disable();
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 16e8bd94d6d3..2d04f361d691 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dlged.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: tbe $ $Date: 2001-10-17 10:14:13 $
+ * last change: $Author: tbe $ $Date: 2001-11-12 22:38:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -538,20 +538,25 @@ IMPL_LINK( DlgEditor, PaintTimeout, Timer *, EMPTYARG )
void DlgEditor::SetMode( DlgEdMode eNewMode )
{
- if( eMode != eNewMode )
+ if ( eMode != eNewMode )
{
- if( pFunc )
+ if ( pFunc )
delete pFunc;
}
eMode = eNewMode;
- if( eMode == DLGED_INSERT )
+ if ( eMode == DLGED_INSERT )
pFunc = new DlgEdFuncInsert( this );
else
pFunc = new DlgEdFuncSelect( this );
- if( eMode == DLGED_TEST )
+ if ( eMode == DLGED_TEST )
ShowDialog();
+
+ if ( eMode == DLGED_READONLY )
+ pSdrModel->SetReadOnly( TRUE );
+ else
+ pSdrModel->SetReadOnly( FALSE );
}
//----------------------------------------------------------------------------
@@ -838,9 +843,9 @@ void DlgEditor::Delete()
//----------------------------------------------------------------------------
-BOOL DlgEditor::IsPasteAllowed() const
+BOOL DlgEditor::IsPasteAllowed()
{
- BOOL bIsPasteAllowed = FALSE;
+ BOOL bPaste = FALSE;
// get clipboard
Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard();
@@ -854,12 +859,12 @@ BOOL DlgEditor::IsPasteAllowed() const
{
if ( xTransf->isDataFlavorSupported( m_ClipboardDataFlavors[0] ) )
{
- bIsPasteAllowed = TRUE;
+ bPaste = TRUE;
}
}
}
- return bIsPasteAllowed;
+ return bPaste;
}
//----------------------------------------------------------------------------
diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx
index f450cb92c2ff..37ab1ffe918c 100644
--- a/basctl/source/dlged/dlgedfunc.cxx
+++ b/basctl/source/dlged/dlgedfunc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dlgedfunc.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: tbe $ $Date: 2001-10-17 10:14:13 $
+ * last change: $Author: tbe $ $Date: 2001-11-12 22:38:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -248,7 +248,7 @@ BOOL DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt )
else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 )
{
// if object was hit, show property browser
- if ( pView->IsMarkedHit(aPos, nHitLog) )
+ if ( pView->IsMarkedHit(aPos, nHitLog) && pParent->GetMode() != DLGED_READONLY )
pParent->ShowProperties();
}
@@ -405,7 +405,7 @@ BOOL DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt )
else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 )
{
// if object was hit, show property browser
- if ( pView->IsMarkedHit(aMDPos, nHitLog) )
+ if ( pView->IsMarkedHit(aMDPos, nHitLog) && pParent->GetMode() != DLGED_READONLY )
pParent->ShowProperties();
}
diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx
index 5745a2d0981e..02490c7acc78 100644
--- a/basctl/source/inc/dlged.hxx
+++ b/basctl/source/inc/dlged.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dlged.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: tbe $ $Date: 2001-10-17 10:17:18 $
+ * last change: $Author: tbe $ $Date: 2001-11-12 22:39:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,7 +82,7 @@
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#endif
-enum DlgEdMode { DLGED_INSERT, DLGED_SELECT, DLGED_TEST };
+enum DlgEdMode { DLGED_INSERT, DLGED_SELECT, DLGED_TEST, DLGED_READONLY };
//============================================================================
// DlgEditor
@@ -179,7 +179,7 @@ public:
void Copy();
void Paste();
void Delete();
- BOOL IsPasteAllowed() const;
+ BOOL IsPasteAllowed();
void ShowProperties();