Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Documents / TextEditorParagraphs.cs / 1 / TextEditorParagraphs.cs
//---------------------------------------------------------------------------- // // File: TextEditorParagraphs.cs // // Copyright (C) Microsoft Corporation. All rights reserved. // // Description: A component of TextEditor supporting paragraph formating commands // //--------------------------------------------------------------------------- namespace System.Windows.Documents { using MS.Internal; using System.Globalization; using System.Threading; using System.ComponentModel; using System.Text; using System.Collections; // ArrayList using System.Runtime.InteropServices; using System.Windows.Threading; using System.Windows.Input; using System.Windows.Controls; // ScrollChangedEventArgs using System.Windows.Controls.Primitives; // CharacterCasing, TextBoxBase using System.Windows.Media; using System.Windows.Markup; using MS.Utility; using MS.Win32; using MS.Internal.Documents; using MS.Internal.Commands; // CommandHelpers ////// Text editing service for controls. /// internal static class TextEditorParagraphs { //----------------------------------------------------- // // Class Internal Methods // //----------------------------------------------------- #region Class Internal Methods // Registers all text editing command handlers for a given control type internal static void _RegisterClassHandlers(Type controlType, bool acceptsRichContent, bool registerEventListeners) { if (acceptsRichContent) { // Editing Commands: Paragraph Editing // ----------------------------------- CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignLeft , new ExecutedRoutedEventHandler(OnAlignLeft) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyAlignLeft), SR.Get(SRID.KeyAlignLeftDisplayString)) ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignCenter , new ExecutedRoutedEventHandler(OnAlignCenter) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyAlignCenter), SR.Get(SRID.KeyAlignCenterDisplayString)) ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignRight , new ExecutedRoutedEventHandler(OnAlignRight) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyAlignRight), SR.Get(SRID.KeyAlignRightDisplayString)) ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignJustify , new ExecutedRoutedEventHandler(OnAlignJustify) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyAlignJustify), SR.Get(SRID.KeyAlignJustifyDisplayString)) ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplySingleSpace , new ExecutedRoutedEventHandler(OnApplySingleSpace) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyApplySingleSpace), SR.Get(SRID.KeyApplySingleSpaceDisplayString)) ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyOneAndAHalfSpace , new ExecutedRoutedEventHandler(OnApplyOneAndAHalfSpace) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyApplyOneAndAHalfSpace), SR.Get(SRID.KeyApplyOneAndAHalfSpaceDisplayString)) ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyDoubleSpace , new ExecutedRoutedEventHandler(OnApplyDoubleSpace) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyApplyDoubleSpace), SR.Get(SRID.KeyApplyDoubleSpaceDisplayString)) ); } CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyParagraphFlowDirectionLTR, new ExecutedRoutedEventHandler(OnApplyParagraphFlowDirectionLTR), new CanExecuteRoutedEventHandler(OnQueryStatusNYI)); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyParagraphFlowDirectionRTL, new ExecutedRoutedEventHandler(OnApplyParagraphFlowDirectionRTL), new CanExecuteRoutedEventHandler(OnQueryStatusNYI)); } #endregion Class Internal Methods //------------------------------------------------------ // // Private Methods // //----------------------------------------------------- #region Private Methods ////// AlignLeft command event handler. /// private static void OnAlignLeft(object sender, ExecutedRoutedEventArgs e) { TextEditor This = TextEditor._GetTextEditor(sender); if (This == null) { return; } TextEditorCharacters._OnApplyProperty(This, Block.TextAlignmentProperty, TextAlignment.Left, /*applyToParagraphs*/true); } ////// AlignCenter command event handler. /// private static void OnAlignCenter(object sender, ExecutedRoutedEventArgs e) { TextEditor This = TextEditor._GetTextEditor(sender); if (This == null) { return; } TextEditorCharacters._OnApplyProperty(This, Block.TextAlignmentProperty, TextAlignment.Center, /*applyToParagraphs*/true); } ////// AlignRight command event handler. /// private static void OnAlignRight(object sender, ExecutedRoutedEventArgs e) { TextEditor This = TextEditor._GetTextEditor(sender); if (This == null) { return; } TextEditorCharacters._OnApplyProperty(This, Block.TextAlignmentProperty, TextAlignment.Right, /*applyToParagraphs*/true); } ////// AlignJustify command event handler. /// private static void OnAlignJustify(object sender, ExecutedRoutedEventArgs e) { TextEditor This = TextEditor._GetTextEditor(sender); if (This == null) { return; } TextEditorCharacters._OnApplyProperty(This, Block.TextAlignmentProperty, TextAlignment.Justify, /*applyToParagraphs*/true); } private static void OnApplySingleSpace(object sender, ExecutedRoutedEventArgs e) { // } private static void OnApplyOneAndAHalfSpace(object sender, ExecutedRoutedEventArgs e) { // } private static void OnApplyDoubleSpace(object sender, ExecutedRoutedEventArgs e) { // } ////// OnApplyParagraphFlowDirectionLTR command event handler. /// private static void OnApplyParagraphFlowDirectionLTR(object sender, ExecutedRoutedEventArgs e) { TextEditor This = TextEditor._GetTextEditor(sender); TextEditorCharacters._OnApplyProperty(This, FrameworkElement.FlowDirectionProperty, FlowDirection.LeftToRight, /*applyToParagraphs*/true); } ////// OnApplyParagraphFlowDirectionRTL command event handler. /// private static void OnApplyParagraphFlowDirectionRTL(object sender, ExecutedRoutedEventArgs e) { TextEditor This = TextEditor._GetTextEditor(sender); TextEditorCharacters._OnApplyProperty(This, FrameworkElement.FlowDirectionProperty, FlowDirection.RightToLeft, /*applyToParagraphs*/true); } // ---------------------------------------------------------- // // Misceleneous Commands // // ---------------------------------------------------------- #region Misceleneous Commands ////// StartInputCorrection command QueryStatus handler /// private static void OnQueryStatusNYI(object sender, CanExecuteRoutedEventArgs e) { TextEditor This = TextEditor._GetTextEditor(sender); if (This == null) { return; } e.CanExecute = true; } #endregion Misceleneous Commands #endregion Private methods } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConfigXmlText.cs
- DataGridViewDataErrorEventArgs.cs
- xamlnodes.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- EntityType.cs
- EventBuilder.cs
- DataObjectMethodAttribute.cs
- ObjectCacheSettings.cs
- HMACRIPEMD160.cs
- CompositeActivityValidator.cs
- GridViewHeaderRowPresenter.cs
- ArraySegment.cs
- IntegerValidator.cs
- ContourSegment.cs
- StrokeNodeOperations.cs
- TransformerInfo.cs
- Underline.cs
- VBIdentifierTrimConverter.cs
- Update.cs
- SymbolTable.cs
- DocumentDesigner.cs
- StringConcat.cs
- HttpPostedFile.cs
- SymbolMethod.cs
- FontSizeConverter.cs
- WrapPanel.cs
- SymmetricCryptoHandle.cs
- DESCryptoServiceProvider.cs
- ToolStripItemRenderEventArgs.cs
- Composition.cs
- EntityCollection.cs
- DesignerMetadata.cs
- DataContractSet.cs
- TemplateEditingVerb.cs
- _ChunkParse.cs
- ISO2022Encoding.cs
- RoleService.cs
- ISAPIRuntime.cs
- BaseValidatorDesigner.cs
- ImageField.cs
- ProjectionPath.cs
- MeshGeometry3D.cs
- MulticastIPAddressInformationCollection.cs
- BindStream.cs
- SizeConverter.cs
- XmlCountingReader.cs
- WebHttpSecurityElement.cs
- GridViewPageEventArgs.cs
- ClipboardProcessor.cs
- ToolStripRenderEventArgs.cs
- ReadOnlyDictionary.cs
- XmlHelper.cs
- DesignerFrame.cs
- ADConnectionHelper.cs
- Perspective.cs
- PinnedBufferMemoryStream.cs
- StateMachine.cs
- MembershipUser.cs
- HostDesigntimeLicenseContext.cs
- CodeActivityMetadata.cs
- Wizard.cs
- SeverityFilter.cs
- TextRangeEditTables.cs
- SmiMetaDataProperty.cs
- XmlSerializer.cs
- CircleHotSpot.cs
- DefaultValueTypeConverter.cs
- MultiTouchSystemGestureLogic.cs
- DateTime.cs
- StylusPointPropertyId.cs
- BinaryMethodMessage.cs
- WindowsSecurityToken.cs
- TemplateBindingExpression.cs
- EntityDataSourceMemberPath.cs
- RuleSet.cs
- safelink.cs
- M3DUtil.cs
- UnsafeNativeMethodsPenimc.cs
- ImageMapEventArgs.cs
- ListViewDeleteEventArgs.cs
- DoubleAnimationClockResource.cs
- BitStack.cs
- MbpInfo.cs
- SqlDataSourceSummaryPanel.cs
- EntityContainer.cs
- AnimatedTypeHelpers.cs
- ADMembershipUser.cs
- Delegate.cs
- CqlBlock.cs
- Html32TextWriter.cs
- TdsEnums.cs
- AppDomainProtocolHandler.cs
- StoryFragments.cs
- PenThreadPool.cs
- ContainerVisual.cs
- Propagator.ExtentPlaceholderCreator.cs
- DataGridColumnStyleMappingNameEditor.cs
- OdbcCommandBuilder.cs
- QueryGeneratorBase.cs
- HostDesigntimeLicenseContext.cs