Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / 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) { CanExecuteRoutedEventHandler onQueryStatusNYI = new CanExecuteRoutedEventHandler(OnQueryStatusNYI); if (acceptsRichContent) { // Editing Commands: Paragraph Editing // ----------------------------------- CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignLeft , new ExecutedRoutedEventHandler(OnAlignLeft) , onQueryStatusNYI, SRID.KeyAlignLeft, SRID.KeyAlignLeftDisplayString ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignCenter , new ExecutedRoutedEventHandler(OnAlignCenter) , onQueryStatusNYI, SRID.KeyAlignCenter, SRID.KeyAlignCenterDisplayString ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignRight , new ExecutedRoutedEventHandler(OnAlignRight) , onQueryStatusNYI, SRID.KeyAlignRight, SRID.KeyAlignRightDisplayString ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignJustify , new ExecutedRoutedEventHandler(OnAlignJustify) , onQueryStatusNYI, SRID.KeyAlignJustify, SRID.KeyAlignJustifyDisplayString ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplySingleSpace , new ExecutedRoutedEventHandler(OnApplySingleSpace) , onQueryStatusNYI, SRID.KeyApplySingleSpace, SRID.KeyApplySingleSpaceDisplayString ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyOneAndAHalfSpace , new ExecutedRoutedEventHandler(OnApplyOneAndAHalfSpace) , onQueryStatusNYI, SRID.KeyApplyOneAndAHalfSpace, SRID.KeyApplyOneAndAHalfSpaceDisplayString ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyDoubleSpace , new ExecutedRoutedEventHandler(OnApplyDoubleSpace) , onQueryStatusNYI, SRID.KeyApplyDoubleSpace, SRID.KeyApplyDoubleSpaceDisplayString ); } CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyParagraphFlowDirectionLTR, new ExecutedRoutedEventHandler(OnApplyParagraphFlowDirectionLTR), onQueryStatusNYI); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyParagraphFlowDirectionRTL, new ExecutedRoutedEventHandler(OnApplyParagraphFlowDirectionRTL), 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. //---------------------------------------------------------------------------- // // 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) { CanExecuteRoutedEventHandler onQueryStatusNYI = new CanExecuteRoutedEventHandler(OnQueryStatusNYI); if (acceptsRichContent) { // Editing Commands: Paragraph Editing // ----------------------------------- CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignLeft , new ExecutedRoutedEventHandler(OnAlignLeft) , onQueryStatusNYI, SRID.KeyAlignLeft, SRID.KeyAlignLeftDisplayString ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignCenter , new ExecutedRoutedEventHandler(OnAlignCenter) , onQueryStatusNYI, SRID.KeyAlignCenter, SRID.KeyAlignCenterDisplayString ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignRight , new ExecutedRoutedEventHandler(OnAlignRight) , onQueryStatusNYI, SRID.KeyAlignRight, SRID.KeyAlignRightDisplayString ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignJustify , new ExecutedRoutedEventHandler(OnAlignJustify) , onQueryStatusNYI, SRID.KeyAlignJustify, SRID.KeyAlignJustifyDisplayString ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplySingleSpace , new ExecutedRoutedEventHandler(OnApplySingleSpace) , onQueryStatusNYI, SRID.KeyApplySingleSpace, SRID.KeyApplySingleSpaceDisplayString ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyOneAndAHalfSpace , new ExecutedRoutedEventHandler(OnApplyOneAndAHalfSpace) , onQueryStatusNYI, SRID.KeyApplyOneAndAHalfSpace, SRID.KeyApplyOneAndAHalfSpaceDisplayString ); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyDoubleSpace , new ExecutedRoutedEventHandler(OnApplyDoubleSpace) , onQueryStatusNYI, SRID.KeyApplyDoubleSpace, SRID.KeyApplyDoubleSpaceDisplayString ); } CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyParagraphFlowDirectionLTR, new ExecutedRoutedEventHandler(OnApplyParagraphFlowDirectionLTR), onQueryStatusNYI); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyParagraphFlowDirectionRTL, new ExecutedRoutedEventHandler(OnApplyParagraphFlowDirectionRTL), 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
- PeerInvitationResponse.cs
- ExpressionReplacer.cs
- UnsafeCollabNativeMethods.cs
- EdmSchemaAttribute.cs
- MarshalByValueComponent.cs
- OpenFileDialog.cs
- PcmConverter.cs
- WebBrowserNavigatingEventHandler.cs
- WebHttpBindingElement.cs
- CriticalFinalizerObject.cs
- BitmapMetadataEnumerator.cs
- configsystem.cs
- StrokeFIndices.cs
- Debug.cs
- DescendantBaseQuery.cs
- XmlSchemaSequence.cs
- GridViewDeleteEventArgs.cs
- NetStream.cs
- SByteConverter.cs
- CodeMethodInvokeExpression.cs
- Helpers.cs
- ListenerConnectionDemuxer.cs
- Perspective.cs
- WebEventCodes.cs
- XamlPointCollectionSerializer.cs
- FixedTextBuilder.cs
- OneOfTypeConst.cs
- AdornerLayer.cs
- NGCSerializerAsync.cs
- ListViewDataItem.cs
- WebPartEditorCancelVerb.cs
- ObjectKeyFrameCollection.cs
- LocalizableAttribute.cs
- ChannelPool.cs
- StrongNameHelpers.cs
- ExtractedStateEntry.cs
- BigInt.cs
- MultiView.cs
- WorkflowDebuggerSteppingAttribute.cs
- ObjectViewEntityCollectionData.cs
- TracedNativeMethods.cs
- CultureInfo.cs
- CommonDialog.cs
- Rectangle.cs
- FileAuthorizationModule.cs
- ReflectionHelper.cs
- TextLineResult.cs
- OutputCacheSection.cs
- TraceSection.cs
- IncrementalReadDecoders.cs
- DecoderFallbackWithFailureFlag.cs
- PlaceHolder.cs
- XmlAnyElementAttribute.cs
- ProcessHostServerConfig.cs
- QueryStringParameter.cs
- ExpressionPrinter.cs
- RequiredAttributeAttribute.cs
- TextCompositionEventArgs.cs
- ByteStream.cs
- AsyncPostBackErrorEventArgs.cs
- FilterEventArgs.cs
- Configuration.cs
- BuildProvidersCompiler.cs
- CriticalFinalizerObject.cs
- SystemColors.cs
- ReadOnlyPermissionSet.cs
- ListItemConverter.cs
- AtomServiceDocumentSerializer.cs
- VectorKeyFrameCollection.cs
- ExeContext.cs
- HttpListener.cs
- DataGridViewColumnHeaderCell.cs
- CharEnumerator.cs
- ZipPackagePart.cs
- UnsafeNativeMethodsMilCoreApi.cs
- HandlerWithFactory.cs
- PermissionSetEnumerator.cs
- AggregationMinMaxHelpers.cs
- UnsafeNativeMethods.cs
- TransferMode.cs
- storagemappingitemcollection.viewdictionary.cs
- safex509handles.cs
- Exception.cs
- BinaryObjectInfo.cs
- NamedPermissionSet.cs
- MobileDeviceCapabilitiesSectionHandler.cs
- ClusterSafeNativeMethods.cs
- BaseCollection.cs
- TransportChannelListener.cs
- CodeTypeMemberCollection.cs
- CommentEmitter.cs
- SafeHGlobalHandleCritical.cs
- ITreeGenerator.cs
- TerminatorSinks.cs
- NativeActivityMetadata.cs
- ObjectStateManager.cs
- CodeIterationStatement.cs
- TiffBitmapEncoder.cs
- DragAssistanceManager.cs
- SvcMapFile.cs