private static bool Sync(Shape formatShape, Shape newShape) { ThreeDFormat source = formatShape.ThreeD; ThreeDFormat dest = newShape.ThreeD; try { // don't set type if type is TypeMixed, it throws an exception if (source.BevelTopType != MsoBevelType.msoBevelTypeMixed) { dest.BevelTopType = source.BevelTopType; // set depth & inset only if type is not none, // adjusting these 2 will automatically set type from None to Round if (source.BevelTopType != MsoBevelType.msoBevelNone) { // set the settings anyway, setting the type alone is insufficient dest.BevelTopDepth = source.BevelTopDepth; dest.BevelTopInset = source.BevelTopInset; } } return(true); } catch { return(false); } }
private static bool Sync(Shape formatShape, Shape newShape) { ThreeDFormat source = formatShape.ThreeD; ThreeDFormat dest = newShape.ThreeD; try { // setting Mixed throws an exception // the user is unable to set Mixed type manually // it seems to be reserved for shapes that have all 3d settings set to default // show Flat type instead, which looks very similar if (source.PresetMaterial == MsoPresetMaterial.msoPresetMaterialMixed) { dest.PresetMaterial = MsoPresetMaterial.msoMaterialFlat; } else { dest.PresetMaterial = source.PresetMaterial; } return(true); } catch { return(false); } }
private static bool Sync(Shape formatShape, Shape newShape) { ThreeDFormat source = formatShape.ThreeD; ThreeDFormat dest = newShape.ThreeD; try { // don't set type if type is TypeMixed, it throws an exception if (source.ExtrusionColorType != MsoExtrusionColorType.msoExtrusionColorTypeMixed) { dest.ExtrusionColorType = source.ExtrusionColorType; } if (source.ExtrusionColorType != MsoExtrusionColorType.msoExtrusionColorAutomatic) { // do not set SchemeColor & Brightness, setting them throws exceptions dest.ExtrusionColor.ObjectThemeColor = source.ExtrusionColor.ObjectThemeColor; dest.ExtrusionColor.RGB = source.ExtrusionColor.RGB; dest.ExtrusionColor.TintAndShade = source.ExtrusionColor.TintAndShade; } return(true); } catch { return(false); } }
private static bool Sync(Shape formatShape, Shape newShape) { ThreeDFormat source = formatShape.ThreeD; ThreeDFormat dest = newShape.ThreeD; try { if (HasErrorneousDepth(formatShape) && HasErrorneousDepth(newShape)) { // both have no 3d settings, do nothing // setting depth here changes the color of the shape slightly for unknown reasons // we cannot revert this change return(true); } float depth = source.Depth; if (HasErrorneousDepth(formatShape)) { // fresh shapes actually have 0 depth depth = 0f; } dest.Depth = depth; return(true); } catch { return(false); } }
private static bool Sync(Shape formatShape, Shape newShape) { ThreeDFormat source = formatShape.ThreeD; ThreeDFormat dest = newShape.ThreeD; try { // set lighting manually if type Mixed, setting type to Mixed throws an exception if (source.PresetLighting == MsoLightRigType.msoLightRigMixed) { dest.PresetLightingDirection = source.PresetLightingDirection; dest.PresetLightingSoftness = source.PresetLightingSoftness; } else { // set lighting preset if not type Mixed dest.PresetLighting = source.PresetLighting; } return(true); } catch (Exception e) { Logger.LogException(e, "Sync LightingEffectFormat"); return(false); } }
public override bool CanCopy(Shape formatShape) { ThreeDFormat threeD = formatShape.ThreeD; // equality check for floating point numbers return(Math.Abs(threeD.RotationX) > TOLERANCE || Math.Abs(threeD.RotationY) > TOLERANCE || Math.Abs(threeD.RotationZ) > TOLERANCE || Math.Abs(threeD.FieldOfView) > TOLERANCE || threeD.Perspective == MsoTriState.msoTrue); }
private static bool Sync(Shape formatShape, Shape newShape) { ThreeDFormat source = formatShape.ThreeD; ThreeDFormat dest = newShape.ThreeD; try { if (source.PresetThreeDFormat == MsoPresetThreeDFormat.msoPresetThreeDFormatMixed) { // skip setting PresetCamera if Mixed. setting it throws an error if (source.PresetCamera != MsoPresetCamera.msoPresetCameraMixed) { dest.SetPresetCamera(source.PresetCamera); } // set FieldOfView anyway, PresetCamera doesn't seem to set it dest.FieldOfView = source.FieldOfView; dest.RotationX = source.RotationX; dest.RotationZ = source.RotationZ; dest.RotationY = source.RotationY; // set perspective only if it is different, // setting the same perspective applies an unknown change to the lighting of the shape // this change is visible to the eye, but we cannot undo it if (dest.Perspective != source.Perspective) { dest.Perspective = source.Perspective; } } else { dest.SetThreeDFormat(source.PresetThreeDFormat); } // ThreeDFormat.Z must be between -4000 & 4000 exclusive. // when source.Z > 4000 or source.Z < - 4000, it actually means 0 float nearestZ = source.Z; nearestZ = nearestZ > 4000 ? 0f : nearestZ; nearestZ = nearestZ < -4000 ? 0f : nearestZ; dest.Z = nearestZ; dest.ProjectText = source.ProjectText; return(true); } catch (Exception e) { Logger.LogException(e, "Sync ThreeDRotationEffectFormat"); return(false); } }
private static bool Sync(Shape formatShape, Shape newShape) { ThreeDFormat source = formatShape.ThreeD; ThreeDFormat dest = newShape.ThreeD; try { dest.LightAngle = source.LightAngle; return(true); } catch { return(false); } }
private static bool Sync(Shape formatShape, Shape newShape) { ThreeDFormat source = formatShape.ThreeD; ThreeDFormat dest = newShape.ThreeD; try { dest.ContourWidth = source.ContourWidth; return(true); } catch { return(false); } }
private static bool Sync(Shape formatShape, Shape newShape) { ThreeDFormat source = formatShape.ThreeD; ThreeDFormat dest = newShape.ThreeD; try { dest.LightAngle = source.LightAngle; return(true); } catch (Exception e) { Logger.LogException(e, "Sync LightingAngleFormat"); return(false); } }
private static bool Sync(Shape formatShape, Shape newShape) { ThreeDFormat source = formatShape.ThreeD; ThreeDFormat dest = newShape.ThreeD; try { dest.ContourWidth = source.ContourWidth; return(true); } catch (Exception e) { Logger.LogException(e, "Sync ContourWidthFormat"); return(false); } }
private static bool Sync(Shape formatShape, Shape newShape) { ThreeDFormat source = formatShape.ThreeD; ThreeDFormat dest = newShape.ThreeD; try { // do not set SchemeColor, Brightness & ObjectThemeColor, setting them throws exceptions dest.ContourColor.RGB = source.ContourColor.RGB; dest.ContourColor.TintAndShade = source.ContourColor.TintAndShade; return(true); } catch { return(false); } }