Skip to content

Commit cd03edb

Browse files
authored
Merge branch 'next' into FailingTests
2 parents 18dcb0b + 4f82001 commit cd03edb

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

RetailCoder.VBE/Inspections/ImplicitActiveSheetReferenceInspection.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
3636
}
3737

3838
var matches = BuiltInDeclarations.Where(item =>
39-
Targets.Contains(item.IdentifierName)).ToList();
39+
Targets.Contains(item.IdentifierName) &&
40+
item.ParentScope == "EXCEL.EXE;Excel._Global" &&
41+
item.AsTypeName == "Range").ToList();
4042

4143
var issues = matches.Where(item => item.References.Any())
4244
.SelectMany(declaration => declaration.References);

Rubberduck.Parsing/Symbols/ClassModuleDeclaration.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,19 @@ public bool IsGlobalClassModule
104104
attributeIsGlobalClassModule = value.Single() == "True";
105105
}
106106
_isGlobal = attributeIsGlobalClassModule;
107+
108+
if (!_isGlobal.Value)
109+
{
110+
foreach (var type in Subtypes)
111+
{
112+
if (type is ClassModuleDeclaration && ((ClassModuleDeclaration) type).IsGlobalClassModule)
113+
{
114+
_isGlobal = true;
115+
break;
116+
}
117+
}
118+
}
119+
107120
return _isGlobal.Value;
108121
}
109122
}

Rubberduck.Parsing/Symbols/ReferencedDeclarationsCollector.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ public List<Declaration> GetDeclarationsForReference(Reference reference)
207207
attributes.AddPredeclaredIdTypeAttribute();
208208
}
209209

210+
if (typeAttributes.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FAPPOBJECT))
211+
{
212+
attributes.AddGlobalClassAttribute();
213+
}
214+
210215
Declaration moduleDeclaration;
211216
switch (typeDeclarationType)
212217
{

Rubberduck.Parsing/VBA/Attributes.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,10 @@ public void AddPredeclaredIdTypeAttribute()
3939
{
4040
Add("VB_PredeclaredId", new[] {"True"});
4141
}
42+
43+
public void AddGlobalClassAttribute()
44+
{
45+
Add("VB_GlobalNamespace", new[] {"True"});
46+
}
4247
}
4348
}

Rubberduck.VBEEditor/NativeMethods.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,9 @@ internal static string GetWindowTextByHwnd(IntPtr windowHandle)
8484
/// <param name="parentWindowHandle"> Handle of the parent window. </param>
8585
internal static void ActivateWindow(IntPtr windowHandle, IntPtr parentWindowHandle)
8686
{
87-
const int WM_MOUSEACTIVATE = 0x21;
88-
const int HTCAPTION = 2;
89-
const int WM_LBUTTONDOWN = 0x201;
87+
const int WM_MDIACTIVATE = 0x0222;
9088

91-
SendMessage(windowHandle, WM_MOUSEACTIVATE, parentWindowHandle, new IntPtr(HTCAPTION + WM_LBUTTONDOWN * 0x10000));
89+
SendMessage(parentWindowHandle, WM_MDIACTIVATE, windowHandle, IntPtr.Zero);
9290
}
9391

9492
internal static void EnumChildWindows(IntPtr parentWindowHandle, EnumChildWindowsDelegate callBackEnumWindows)

0 commit comments

Comments
 (0)