protected virtual void OnSelectedContentItemsChanged(SelectedContentItemsChangedArgs args)
 {
     lock (m_selectedContentItemsChangedLock)
     {
         if (m_selectedContentItemsChanged != null)
         {
             m_selectedContentItemsChanged(this, args);
         }
     }
 }
		private void updateOfficeCleaningProperties(SelectedContentItemsChangedArgs args)
		{
			bool SkipOfficeCleaning = MasterSkipCleaningSelected;

			foreach (UIContentItem contentItem in args.SelectedContentItems)
			{
				if (Dialogs.Utilities.MapActionToActionType(contentItem.ActionName.ToLowerInvariant()) == "CLEAN")
				{
					IActionProperty removeCommentsProperty = contentItem.GetClientActionProperty(PropertyNames.Comments);
					if (removeCommentsProperty != null)
						removeCommentsProperty.Value = !SkipOfficeCleaning;

					IActionProperty removeTrackChangesProperty = contentItem.GetClientActionProperty(PropertyNames.TrackChanges);
					if (removeTrackChangesProperty != null)
						removeTrackChangesProperty.Value = !SkipOfficeCleaning;
				}
			}
		}
		public virtual void MasterSkipCleaningContentSelectionHandler(object sender, SelectedContentItemsChangedArgs args)
		{
			try
			{
				m_selectedContentItemsChanged = true;
				MasterSkipCleaningEnabled = false;
				MasterSkipCleaningSelected = false;
				SetMasterSkipCleaningCheckState();
			}
			finally
			{
				m_selectedContentItemsChanged = false;
			}
		}
		public virtual void PdfHiddenDataOptionsContentSelectionHandler(object sender, SelectedContentItemsChangedArgs args)
		{
			try
			{
				m_pdfHiddenDataArgs = args;
				m_selectedContentItemsChanged = true;
				SkipPdfCleaningEnabled = false;
				skipPdfCleaningCheckBox.CheckState = CheckState.Unchecked;

				if (args.SelectedContentItems.Length == 0)
				{
					return;
				}
				
				
				bool firstClean = true;

				foreach (UIContentItem contentItem in args.SelectedContentItems)
				{
					if (Dialogs.Utilities.MapActionToActionType(contentItem.ActionName.ToLowerInvariant()) == "PDFCLEAN")
					{
						ConfigurePdfCleanOptions(contentItem, ref firstClean);
						continue;
					}
				}
			}
			finally
			{
				m_selectedContentItemsChanged = false;
			}
		}
		public virtual void OfficeHiddenDataOptionsContentSelectionHandler(object sender, SelectedContentItemsChangedArgs args)
		{
			try
			{
				m_officeHiddenDataArgs = args;
				m_selectedContentItemsChanged = true;
				RemoveCommentsEnabled = false;
				RemoveTrackChangesEnabled = false;
				SkipOfficeCleaningEnabled = false;
				removeCommentsCheckBox.CheckState = CheckState.Unchecked;
				removeTrackChangesCheckBox.CheckState = CheckState.Unchecked;
				skipOfficeCleaningCheckBox.CheckState = CheckState.Unchecked;

				if (args.SelectedContentItems.Length == 0)
				{
					return;
				}

				TriState tsWord = TriState.Undefined;
				TriState tsExcel = TriState.Undefined;
				TriState tsPpt = TriState.Undefined;
				TriState tsDefault = TriState.Undefined;
				bool firstClean = true;
				
				foreach (UIContentItem contentItem in args.SelectedContentItems)
				{
					if (Dialogs.Utilities.MapActionToActionType(contentItem.ActionName.ToLowerInvariant()) == "CLEAN")
					{
						ConfigureOfficeCleanOptions(contentItem, ref tsWord, ref tsExcel, ref tsPpt, ref tsDefault, ref firstClean);
						continue;
					}
				}

				SetRemoveTrackChangesEnabled(tsWord, tsExcel, tsPpt, tsDefault);
			}
			finally
			{
				m_selectedContentItemsChanged = false;
			}
		}
		public virtual void ConvertToPdfContentSelectionHandler(object sender, SelectedContentItemsChangedArgs args)
		{
			try
			{
				m_selectedContentItemsChanged = true;
				PDFOptionsEnabled = false;
				convertToPDFCheckBox.CheckState = CheckState.Unchecked;

				if (args.SelectedContentItems.Length == 0)
				{
					return;
				}

				bool firstPdf = true;
				foreach (UIContentItem contentItem in args.SelectedContentItems)
				{
					if (Dialogs.Utilities.MapActionToActionType(contentItem.ActionName.ToLowerInvariant()) != "PDF")
					{
						continue;
					}
					IActionProperty executeProperty = contentItem.GetClientActionProperty(PropertyNames.Execute);
					if (executeProperty == null)
					{
						continue;
					}
					// Convert to PDF
					bool execute = Convert.ToBoolean(executeProperty.Value, CultureInfo.InvariantCulture);
					SetCheckBoxCheckState(convertToPDFCheckBox, execute, firstPdf);
					PDFOptionsEnabled = executeProperty.Override;
					firstPdf = false;
				}
			}
			finally
			{
				m_selectedContentItemsChanged = false;
			}
		}
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public virtual void SelectedContentItemsChangedHandler(object sender, SelectedContentItemsChangedArgs args)
        {
            try
            {
                m_actionPropertyAssign = true;
				if (args.SelectedContentItems.Length == 0)
				{
					return;
				}
				UIContentItem[] validItems = Array.FindAll(args.SelectedContentItems, item => m_contentItems.Contains(item));
				if (validItems == null)
				{
					return;
				}

                m_applyToAll = args.AllSelected;

                clientActionControlContainerPanel.SuspendLayout();

                ResetActionControls();

                bool applyAction = false;
                bool oneFalse = false;
                bool valid = false;
                foreach (UIContentItem contentItem in validItems)
                {
                    ClientActionControl control = contentItem.ClientActionControl;
					if (control == null)
					{
						continue;
					}
                    IActionPropertySet propertySet;
					if (m_singleton || control.ActionProperties == null)
					{
						propertySet = contentItem.ActionPropertySet;
					}
					else
					{
						propertySet = control.ActionProperties;
					}

                    TrySetApplyToAll(propertySet, m_applyToAll);

                    bool execute = TryGetExecute(propertySet, false);
					if (execute)
					{
						applyAction = true;
					}
					else
					{
						oneFalse = true;
					}

                    MergePropertySets(propertySet, m_applyToAllActionPropertySet, !valid);
                    valid = true;

					if (m_applyToAll)
					{
						continue;
					}
                    CheckBox checkBox = executePanel.Controls[contentItem.Id] as CheckBox;
					if (checkBox == null)
					{
						continue;
					}
                    checkBox.Visible = true;
                    checkBox.Checked = execute;

                    // NB: Assigning to control.ActionProperties has the side-effect of
                    // resetting the display of the control's UI elements (for PDFUserControl, at least).
                    // For some reason, we need to set Visible = true BEFORE assigning the properties,
                    // or the PDFUserControl disappears. This is horrible. RNP 2009-11-05
                    control.Visible = true;
                    control.ActionProperties = propertySet;
					control.Enabled = execute;
                    break;                        
                }

                // Do NOT attempt any apply to all setup if the handler is not valid.
                if (valid)
                {
                    SetupSelectAllControl(applyAction, oneFalse);
                }


                clientActionControlContainerPanel.ResumeLayout();
            }
            finally
            {
                m_actionPropertyAssign = false;
            }
        }