Skip to content

Commit

Permalink
Adds Unit Test support for MS Project, adds basic bitmap copy of Code…
Browse files Browse the repository at this point in the history
… Explorer treeview (#1701)

* Adds RTF and XML Spreadsheet data formats

Still need to RTF-escape content values
Temporary Fix in InspectionResultBase, for instances of unsaved filename
boom.

* XML Spreadsheet builds from XMLWriter instead of StringBuilder

Adds ColumnInfos helper classes, for specifying and formatting column
titles, not yet fully implemented.

* Improves Clipboard export formatter

Adds a DocumentName property to QualifiedModuleName, adds DocumentName
to column output.

* adds notes and placeholder for Outllook's Application.Run alternative

not implemented - need to write to events in the ThisOutlookSession
before this will work.

* Adds columns to inspection results, and adds column titles

changes to Column alignment, font weights, colspans

* improvements to InspectionResults Clipboard

Refines DocumentName of QualifiedModule

* Adds DisplayName and Title for Projects and Components

ProjectDisplayName eg. `Book1`
ProjectTitle eg. `VBA Project (Book1)
ComponentDisplayName eg. `Home`
ComponentTitle eg. `shtHome (Home)`

* corrects ComponentTitle behaviour

still needs testing across multiple hosts.

* removes temporary comments

* adds DisplayName to extra QualifiedModuleName constructor

was out of Sync with Next, so had to add these fields to the newly
discovered ctor.

* Adds Unit Test support for Visio, clipboard formats for Test Explorer

Adds Start and End Times for Unit Test results (only viewable in
Clipboard exports)
Title and Headings aren't yet localized.
No plain-text clipboard export format yet

* Adjusts treeview border to correct jagged edge of Code Explorer window

sought and received @Hosch250 approval

* Adds Copy button to Code Explorer, allows copy of *all* User Declarations

WIP...

* Fixes GetDisplayName

Adds extra method for projects that have documents without a
document-component (eg. PowerPoint)

* Adds experimental Bitmap WPF copy

element is clipped if there is overflow... See
http://stackoverflow.com/questions/37572471/how-to-copy-a-frameworkelement-including-the-overflowed-content

* Adds Unit Testing for MSProject

Application.Run() does exist but doesn't seem to work, so using
Application.Macro() instead.

* Adds MS Project Application.Macro method
  • Loading branch information
ThunderFrame authored and retailcoder committed Jun 5, 2016
1 parent 1d5a7af commit b96664e
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 4 deletions.
12 changes: 12 additions & 0 deletions RetailCoder.VBE/Common/ClipboardWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;

namespace Rubberduck.Common
{
public interface IClipboardWriter
{
void Write(string text);
void AppendImage(BitmapSource image);
void AppendString(string formatName, string data);
void AppendStream(string formatName, MemoryStream stream);
void Flush();
Expand All @@ -26,6 +28,16 @@ public void Write(string text)
this.Flush();
}

public void AppendImage(BitmapSource image)
{
if (_data == null)
{
_data = new DataObject();
}
_data.SetImage(image);
}


public void AppendString(string formatName, string data)
{
if (_data == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Microsoft.Vbe.Interop;
using Rubberduck.Navigation.Folders;
using Rubberduck.Parsing.Annotations;
Expand Down
11 changes: 7 additions & 4 deletions RetailCoder.VBE/UI/CodeExplorer/CodeExplorerControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,8 @@
</Button>

<Separator />
<Button Command="{Binding CopyResultsCommand}">

<Button Command="{Binding CopyResultsCommand}" CommandParameter="{Binding ElementName=ProjectTree}">
<Image Height="16" Source="../../Resources/document-copy.png" />
<Button.ToolTip>
<TextBlock Text="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=CodeExplorer_CopyToolTip}" />
Expand All @@ -714,11 +714,14 @@
</ToolBar>
</ToolBarTray>

<TreeView Grid.Row="1" Background="White"
<TreeView x:Name="ProjectTree"
Grid.Row="1"
Background="White"
ItemContainerStyle="{StaticResource ShinyTreeView}"
HorizontalContentAlignment="Stretch"
MouseDoubleClick="TreeView_OnMouseDoubleClick"
Style="{StaticResource CodeExplorerTreeViewStyle}" BorderThickness="0,1">
Style="{StaticResource CodeExplorerTreeViewStyle}" BorderThickness="0,1"
VirtualizingPanel.IsVirtualizing="False">
<i:Interaction.Behaviors>
<controls:BindableSelectedItemBehavior SelectedItem="{Binding SelectedItem, Mode=TwoWay}" />
</i:Interaction.Behaviors>
Expand Down
4 changes: 4 additions & 0 deletions Rubberduck.VBEEditor/Extensions/VbeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public static IHostApplication HostApplication(this VBE vbe)
return new PowerPointApp();
case "Microsoft Outlook":
return new OutlookApp();
case "Microsoft Project":
return new ProjectApp();
case "Microsoft Publisher":
return new PublisherApp();
case "Microsoft Visio":
Expand Down Expand Up @@ -94,6 +96,8 @@ public static IHostApplication HostApplication(this VBE vbe)
return new PowerPointApp();
case "Outlook":
return new OutlookApp();
case "MSProject":
return new ProjectApp();
case "Publisher":
return new PublisherApp();
case "Visio":
Expand Down
6 changes: 6 additions & 0 deletions Rubberduck.VBEEditor/Rubberduck.VBEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
<EmbedInteropTypes>True</EmbedInteropTypes>
<HintPath>..\libs\Microsoft.Office.Interop.Excel.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.Interop.MSProject, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>True</EmbedInteropTypes>
<HintPath>..\libs\Microsoft.Office.Interop.MSProject.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.Interop.Outlook, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>True</EmbedInteropTypes>
Expand Down Expand Up @@ -114,6 +119,7 @@
</Compile>
<Compile Include="VBEHost\AccessApp.cs" />
<Compile Include="VBEHost\CorelDRAWApp.cs" />
<Compile Include="VBEHost\ProjectApp.cs" />
<Compile Include="VBEHost\ExcelApp.cs" />
<Compile Include="VBEHost\FallbackApp.cs" />
<Compile Include="VBEHost\HostApplicationBase.cs" />
Expand Down
22 changes: 22 additions & 0 deletions Rubberduck.VBEEditor/VBEHost/ProjectApp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Microsoft.Vbe.Interop;

namespace Rubberduck.VBEditor.VBEHost
{
public class ProjectApp : HostApplicationBase<Microsoft.Office.Interop.MSProject.Application>
{
public ProjectApp() : base("MSProject") { }
public ProjectApp(VBE vbe) : base(vbe, "MSProject") { }

public override void Run(QualifiedMemberName qualifiedMemberName)
{
var call = GenerateMethodCall(qualifiedMemberName);
Application.Macro(call);
}

protected virtual string GenerateMethodCall(QualifiedMemberName qualifiedMemberName)
{
var moduleName = qualifiedMemberName.QualifiedModuleName.Component.Name;
return string.Concat(moduleName, ".", qualifiedMemberName.MemberName);
}
}
}
Binary file added libs/Microsoft.Office.Interop.MSProject.dll
Binary file not shown.

0 comments on commit b96664e

Please sign in to comment.