summaryrefslogtreecommitdiff
path: root/basctl/source/basicide
diff options
context:
space:
mode:
authorAndreas Bregas <ab@openoffice.org>2002-11-06 15:52:23 +0000
committerAndreas Bregas <ab@openoffice.org>2002-11-06 15:52:23 +0000
commitf7865c7659de7a217c895cf395c7795fb3e30a44 (patch)
tree46b00f7f135d17d655f0f54fcfcf73f9d0e87a25 /basctl/source/basicide
parentbcb3f833e57225e2816a348ecac0b70dad2747a1 (diff)
#104198# Macro dialog: Set sellection to Basic of active document
Diffstat (limited to 'basctl/source/basicide')
-rw-r--r--basctl/source/basicide/macrodlg.cxx41
1 files changed, 39 insertions, 2 deletions
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index 33a92d3d099f..a464e958ca8f 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: macrodlg.cxx,v $
*
- * $Revision: 1.22 $
+ * $Revision: 1.23 $
*
- * last change: $Author: ab $ $Date: 2002-11-01 12:12:45 $
+ * last change: $Author: ab $ $Date: 2002-11-06 16:52:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -149,6 +149,8 @@ MacroChooser::MacroChooser( Window* pParnt, BOOL bScanBasics ) :
aNewModButton.Hide(); // default
aMacrosSaveInTxt.Hide(); // default
+ aMacrosInTxt.SetStyle( WB_NOMULTILINE | WB_PATHELLIPSIS );
+
aMacroNameEdit.SetModifyHdl( LINK( this, MacroChooser, EditModifyHdl ) );
aBasicBox.SetSelectHdl( LINK( this, MacroChooser, BasicSelectHdl ) );
@@ -325,6 +327,41 @@ short __EXPORT MacroChooser::Execute()
}
}
+ // #104198 Check if "wrong" document is active
+ SvLBoxEntry* pSelectedEntry = aBasicBox.GetCurEntry();
+ SbxItem aSbxItem = aBasicBox.GetSbxItem( pSelectedEntry );
+ SfxObjectShell* pSelectedShell = aSbxItem.GetShell();
+
+ // App Basic is always ok, so only check if shell was found
+ if( pSelectedShell )
+ {
+ SfxObjectShell* pCurShell = SfxObjectShell::Current();
+ if( pCurShell != pSelectedShell )
+ {
+ // Search for the right entry
+ ULONG nRootPos = 0;
+ SvLBoxEntry* pRootEntry = aBasicBox.GetEntry( nRootPos );
+ while( pRootEntry )
+ {
+ SbxItem aCmpSbxItem = aBasicBox.GetSbxItem( pRootEntry );
+ SfxObjectShell* pCmpShell = aCmpSbxItem.GetShell();
+ if( pCmpShell == pCurShell )
+ {
+ SvLBoxEntry* pEntry = pRootEntry;
+ SvLBoxEntry* pLastValid = pEntry;
+ while ( pEntry )
+ {
+ pLastValid = pEntry;
+ pEntry = aBasicBox.FirstChild( pEntry );
+ }
+ if( pLastValid )
+ aBasicBox.SetCurEntry( pLastValid );
+ }
+ pRootEntry = aBasicBox.GetEntry( ++nRootPos );
+ }
+ }
+ }
+
CheckButtons();
UpdateFields();