Small tweaks for the export flow.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1752 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-04-04 15:23:45 +00:00
commit 33cabba52b
4 changed files with 34 additions and 35 deletions

View file

@ -110,16 +110,6 @@ namespace Greenshot.Destinations {
yield return new PowerpointDestination(presentationName);
}
}
/// <summary>
/// Helper method for adding the normal "empty" PowerpointDestination
/// </summary>
/// <returns></returns>
private IEnumerable<IDestination> AllDynamicDestinations() {
yield return new PowerpointDestination();
foreach (string presentationName in PowerpointExporter.GetPowerpointPresentations()) {
yield return new PowerpointDestination(presentationName);
}
}
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
string tmpFile = captureDetails.Filename;
@ -133,13 +123,20 @@ namespace Greenshot.Destinations {
if (presentationName != null) {
PowerpointExporter.ExportToPresentation(presentationName, tmpFile, imageSize, captureDetails.Title);
} else {
if (manuallyInitiated) {
PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails.Title);
} else {
ContextMenuStrip menu = PickerDestination.CreatePickerMenu(false, surface, captureDetails, AllDynamicDestinations());
PickerDestination.ShowMenuAtCursor(menu);
return false;
if (!manuallyInitiated) {
List<string> presentations = PowerpointExporter.GetPowerpointPresentations();
if (presentations.Count > 0) {
List<IDestination> destinations = new List<IDestination>();
destinations.Add(new PowerpointDestination());
foreach (string presentation in presentations) {
destinations.Add(new PowerpointDestination(presentation));
}
ContextMenuStrip menu = PickerDestination.CreatePickerMenu(false, surface, captureDetails, destinations);
PickerDestination.ShowMenuAtCursor(menu);
return false;
}
}
PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails.Title);
}
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, lang.GetFormattedString(LangKey.exported_to, Description));
surface.Modified = false;

View file

@ -112,17 +112,6 @@ namespace Greenshot.Destinations {
}
}
/// <summary>
/// Helper method for adding the normal "empty" WordDestination
/// </summary>
/// <returns></returns>
private IEnumerable<IDestination> AllDynamicDestinations() {
yield return new WordDestination();
foreach (string wordCaption in WordExporter.GetWordDocuments()) {
yield return new WordDestination(wordCaption);
}
}
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
string tmpFile = captureDetails.Filename;
if (tmpFile == null || surface.Modified) {
@ -133,13 +122,20 @@ namespace Greenshot.Destinations {
if (documentCaption != null) {
WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile);
} else {
if (manuallyInitiated) {
WordExporter.InsertIntoNewDocument(tmpFile);
} else {
ContextMenuStrip menu = PickerDestination.CreatePickerMenu(false, surface, captureDetails, AllDynamicDestinations());
PickerDestination.ShowMenuAtCursor(menu);
return false;
if (!manuallyInitiated) {
List<string> documents = WordExporter.GetWordDocuments();
if (documents.Count > 0) {
List<IDestination> destinations = new List<IDestination>();
destinations.Add(new WordDestination());
foreach (string document in documents) {
destinations.Add(new WordDestination(document));
}
ContextMenuStrip menu = PickerDestination.CreatePickerMenu(false, surface, captureDetails, destinations);
PickerDestination.ShowMenuAtCursor(menu);
return false;
}
}
WordExporter.InsertIntoNewDocument(tmpFile);
}
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, lang.GetFormattedString(LangKey.exported_to, Description));
surface.Modified = false;

View file

@ -111,9 +111,13 @@ namespace Greenshot.Interop.Office {
if (isLayoutPictureWithCaption) {
try {
// Using try/catch to make sure problems with the text range don't give an exception.
shape.TextFrame.TextRange.Text = title;
ITextFrame textFrame = shape.TextFrame;
if (textFrame.HasText == MsoTriState.msoTrue) {
textFrame.TextRange.Text = title;
}
shape.AlternativeText = title;
} catch (Exception ex) {
LOG.WarnFormat("Problem setting the title to a text-range: {0}", ex.Message);
LOG.Warn("Problem setting the title to a text-range", ex);
}
}
presentation.Application.ActiveWindow.View.GotoSlide(slide.SlideNumber);

View file

@ -88,10 +88,12 @@ namespace Greenshot.Interop.Office {
ITextFrame TextFrame { get; }
void ScaleWidth(float Factor, MsoTriState RelativeToOriginalSize, MsoScaleFrom fScale);
void ScaleHeight(float Factor, MsoTriState RelativeToOriginalSize, MsoScaleFrom fScale);
string AlternativeText { get; set; }
}
public interface ITextFrame : Common {
ITextRange TextRange { get; }
MsoTriState HasText { get; }
}
public interface ITextRange : Common {
string Text { get; set; }