Skip to content

Commit 947ec8c

Browse files
committed
Merge pull request #119 from rubberduck-vba/next
sync with main repo
2 parents b995366 + ccd6225 commit 947ec8c

File tree

10 files changed

+77
-10
lines changed

10 files changed

+77
-10
lines changed

RetailCoder.VBE/Common/ClipboardWriter.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
using System.Text;
66
using System.Threading.Tasks;
77
using System.Windows;
8+
using System.Windows.Media.Imaging;
89

910
namespace Rubberduck.Common
1011
{
1112
public interface IClipboardWriter
1213
{
1314
void Write(string text);
15+
void AppendImage(BitmapSource image);
1416
void AppendString(string formatName, string data);
1517
void AppendStream(string formatName, MemoryStream stream);
1618
void Flush();
@@ -26,6 +28,16 @@ public void Write(string text)
2628
this.Flush();
2729
}
2830

31+
public void AppendImage(BitmapSource image)
32+
{
33+
if (_data == null)
34+
{
35+
_data = new DataObject();
36+
}
37+
_data.SetImage(image);
38+
}
39+
40+
2941
public void AppendString(string formatName, string data)
3042
{
3143
if (_data == null)

RetailCoder.VBE/Navigation/CodeExplorer/CodeExplorerViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using System.Collections.ObjectModel;
44
using System.Linq;
55
using System.Windows.Input;
6+
using System.Windows.Media;
7+
using System.Windows.Media.Imaging;
68
using Microsoft.Vbe.Interop;
79
using Rubberduck.Navigation.Folders;
810
using Rubberduck.Parsing.Annotations;

RetailCoder.VBE/UI/CodeExplorer/CodeExplorerControl.xaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,8 @@
703703
</Button>
704704

705705
<Separator />
706-
707-
<Button Command="{Binding CopyResultsCommand}">
706+
707+
<Button Command="{Binding CopyResultsCommand}" CommandParameter="{Binding ElementName=ProjectTree}">
708708
<Image Height="16" Source="../../Resources/document-copy.png" />
709709
<Button.ToolTip>
710710
<TextBlock Text="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=CodeExplorer_CopyToolTip}" />
@@ -714,11 +714,14 @@
714714
</ToolBar>
715715
</ToolBarTray>
716716

717-
<TreeView Grid.Row="1" Background="White"
717+
<TreeView x:Name="ProjectTree"
718+
Grid.Row="1"
719+
Background="White"
718720
ItemContainerStyle="{StaticResource ShinyTreeView}"
719721
HorizontalContentAlignment="Stretch"
720722
MouseDoubleClick="TreeView_OnMouseDoubleClick"
721-
Style="{StaticResource CodeExplorerTreeViewStyle}" BorderThickness="0,1">
723+
Style="{StaticResource CodeExplorerTreeViewStyle}" BorderThickness="0,1"
724+
VirtualizingPanel.IsVirtualizing="False">
722725
<i:Interaction.Behaviors>
723726
<controls:BindableSelectedItemBehavior SelectedItem="{Binding SelectedItem, Mode=TwoWay}" />
724727
</i:Interaction.Behaviors>

RetailCoder.VBE/UI/Command/AddTestModuleCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public override bool CanExecute(object parameter)
3232
}
3333

3434
// Outlook requires test methods to be located in [ThisOutlookSession] class.
35-
return app.ApplicationName != "Outlook";
35+
//return app.ApplicationName != "Outlook";
36+
return true;
3637
}
3738

3839
public override void Execute(object parameter)

Rubberduck.Parsing/Symbols/ReferencedDeclarationsCollector.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private string GetTypeName(ITypeInfo info)
144144
string helpFile;
145145
info.GetDocumentation(-1, out typeName, out docString, out helpContext, out helpFile);
146146

147-
return typeName;
147+
return typeName.Equals("LONG_PTR") ? "LongPtr" : typeName; //Quickfix for http://chat.stackexchange.com/transcript/message/30119269#30119269
148148
}
149149

150150
public List<Declaration> GetDeclarationsForReference(Reference reference)
@@ -350,6 +350,12 @@ private Declaration CreateMemberDeclaration(FUNCDESC memberDescriptor, TYPEKIND
350350
var funcValueType = (VarEnum)memberDescriptor.elemdescFunc.tdesc.vt;
351351
var memberDeclarationType = GetDeclarationType(memberName, memberDescriptor, funcValueType, typeKind, parentImplFlags);
352352

353+
if (((FUNCFLAGS)memberDescriptor.wFuncFlags).HasFlag(FUNCFLAGS.FUNCFLAG_FRESTRICTED) &&
354+
IgnoredInterfaceMembers.Contains(memberName)) // Ignore IDispatch and IUnknown members - quick-and-dirty for beta
355+
{
356+
return null;
357+
}
358+
353359
var asTypeName = new ComParameter(string.Empty, false);
354360
if (memberDeclarationType != DeclarationType.Procedure)
355361
{
@@ -587,8 +593,7 @@ private DeclarationType GetDeclarationType(string memberName, FUNCDESC funcDesc,
587593
memberType = DeclarationType.PropertySet;
588594
}
589595
else if ((parentImplTypeFlags.HasFlag(IMPLTYPEFLAGS.IMPLTYPEFLAG_FSOURCE) ||
590-
((FUNCFLAGS)funcDesc.wFuncFlags).HasFlag(FUNCFLAGS.FUNCFLAG_FSOURCE)) &&
591-
!IgnoredInterfaceMembers.Contains(memberName)) // quick-and-dirty for beta
596+
((FUNCFLAGS)funcDesc.wFuncFlags).HasFlag(FUNCFLAGS.FUNCFLAG_FSOURCE)))
592597
{
593598
memberType = DeclarationType.Event;
594599
}

Rubberduck.VBEEditor/Extensions/VbeExtensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ public static IHostApplication HostApplication(this VBE vbe)
6666
return new PowerPointApp();
6767
case "Microsoft Outlook":
6868
return new OutlookApp();
69+
case "Microsoft Project":
70+
return new ProjectApp();
6971
case "Microsoft Publisher":
7072
return new PublisherApp();
7173
case "Microsoft Visio":
@@ -94,6 +96,8 @@ public static IHostApplication HostApplication(this VBE vbe)
9496
return new PowerPointApp();
9597
case "Outlook":
9698
return new OutlookApp();
99+
case "MSProject":
100+
return new ProjectApp();
97101
case "Publisher":
98102
return new PublisherApp();
99103
case "Visio":

Rubberduck.VBEEditor/Rubberduck.VBEditor.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
<EmbedInteropTypes>True</EmbedInteropTypes>
4343
<HintPath>..\libs\Microsoft.Office.Interop.Excel.dll</HintPath>
4444
</Reference>
45+
<Reference Include="Microsoft.Office.Interop.MSProject, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
46+
<SpecificVersion>False</SpecificVersion>
47+
<EmbedInteropTypes>True</EmbedInteropTypes>
48+
<HintPath>..\libs\Microsoft.Office.Interop.MSProject.dll</HintPath>
49+
</Reference>
4550
<Reference Include="Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
4651
<SpecificVersion>False</SpecificVersion>
4752
<EmbedInteropTypes>True</EmbedInteropTypes>
@@ -114,6 +119,7 @@
114119
</Compile>
115120
<Compile Include="VBEHost\AccessApp.cs" />
116121
<Compile Include="VBEHost\CorelDRAWApp.cs" />
122+
<Compile Include="VBEHost\ProjectApp.cs" />
117123
<Compile Include="VBEHost\ExcelApp.cs" />
118124
<Compile Include="VBEHost\FallbackApp.cs" />
119125
<Compile Include="VBEHost\HostApplicationBase.cs" />

Rubberduck.VBEEditor/VBEHost/OutlookApp.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Runtime.InteropServices;
3-
//using Microsoft.Office.Interop.Outlook;
3+
using Microsoft.Office.Core;
4+
using Microsoft.Office.Interop.Outlook;
45

56
namespace Rubberduck.VBEditor.VBEHost
67
{
@@ -23,7 +24,18 @@ public override void Run(QualifiedMemberName qualifiedMemberName)
2324
//taskitem.Subject = "Rubberduck";
2425
//taskitem.Body = qualifiedMemberName.MemberName;
2526

26-
throw new NotImplementedException();
27+
try
28+
{
29+
var app = Application;
30+
var exp = app.ActiveExplorer();
31+
CommandBar cb = exp.CommandBars.Add("RubberduckCallbackProxy", Temporary: true);
32+
CommandBarControl btn = cb.Controls.Add(MsoControlType.msoControlButton, 1);
33+
btn.OnAction = qualifiedMemberName.ToString();
34+
btn.Execute();
35+
cb.Delete();
36+
}
37+
catch {
38+
}
2739
}
2840
}
2941
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Microsoft.Vbe.Interop;
2+
3+
namespace Rubberduck.VBEditor.VBEHost
4+
{
5+
public class ProjectApp : HostApplicationBase<Microsoft.Office.Interop.MSProject.Application>
6+
{
7+
public ProjectApp() : base("MSProject") { }
8+
public ProjectApp(VBE vbe) : base(vbe, "MSProject") { }
9+
10+
public override void Run(QualifiedMemberName qualifiedMemberName)
11+
{
12+
var call = GenerateMethodCall(qualifiedMemberName);
13+
Application.Macro(call);
14+
}
15+
16+
protected virtual string GenerateMethodCall(QualifiedMemberName qualifiedMemberName)
17+
{
18+
var moduleName = qualifiedMemberName.QualifiedModuleName.Component.Name;
19+
return string.Concat(moduleName, ".", qualifiedMemberName.MemberName);
20+
}
21+
}
22+
}
763 KB
Binary file not shown.

0 commit comments

Comments
 (0)