context: using System;
  using System.Diagnostics.CodeAnalysis;
  using System.Drawing;
  using System.Windows.Forms;
  
  namespace WeifenLuo.WinFormsUI.Docking
  {
      public sealed class DockPanelExtender
      {
          private readonly DockPanel m_dockPanel;
          private IDockOutlineFactory m_DockOutlineFactory;
          private IPaneIndicatorFactory m_PaneIndicatorFactory;
          private IPanelIndicatorFactory m_PanelIndicatorFactory;
          private IAutoHideStripFactory m_autoHideStripFactory;
          private IAutoHideWindowFactory m_autoHideWindowFactory;
          private IDockPaneCaptionFactory m_dockPaneCaptionFactory;
  
          private IDockPaneFactory m_dockPaneFactory;
  
          private IDockPaneSplitterControlFactory m_dockPaneSplitterControlFactory;
          private IDockPaneStripFactory m_dockPaneStripFactory;
          private IDockWindowFactory m_dockWindowFactory;
  
          private IDockWindowSplitterControlFactory m_dockWindowSplitterControlFactory;
  
          private IFloatWindowFactory m_floatWindowFactory;
  
          internal DockPanelExtender(DockPanel dockPanel)
          {
              m_dockPanel = dockPanel;
          }
  
          private DockPanel DockPanel
          {
              get { return m_dockPanel; }
          }
  
          public IDockPaneFactory DockPaneFactory
          {
              get
              {
                  if (m_dockPaneFactory == null)
                      m_dockPaneFactory = new DefaultDockPaneFactory();
  
                  return m_dockPaneFactory;
              }
              set
              {
                  if (DockPanel.Panes.Count > 0)
                      throw new InvalidOperationException();
  
                  m_dockPaneFactory = value;
              }
          }
  
          public IDockPaneSplitterControlFactory DockPaneSplitterControlFactory
          {
              get
              {
                  return m_dockPaneSplitterControlFactory ??
                         (m_dockPaneSplitterControlFactory = new DefaultDockPaneSplitterControlFactory());
              }
  
              set
              {
                  if (DockPanel.Panes.Count > 0)
                  {
                      throw new InvalidOperationException();
                  }
  
                  m_dockPaneSplitterControlFactory = value;
              }
          }
  
          public IDockWindowSplitterControlFactory DockWindowSplitterControlFactory
          {
              get
              {
                  return m_dockWindowSplitterControlFactory ??
                         (m_dockWindowSplitterControlFactory = new DefaultDockWindowSplitterControlFactory());
              }
  
              set
              {
                  m_dockWindowSplitterControlFactory = value;
                  DockPanel.ReloadDockWindows();
              }
          }
  
          public IFloatWindowFactory FloatWindowFactory
          {
              get
              {
                  if (m_floatWindowFactory == null)
                      m_floatWindowFactory = new DefaultFloatWindowFactory();
  
                  return m_floatWindowFactory;
              }
              set
              {
                  if (DockPanel.FloatWindows.Count > 0)
                      throw new InvalidOperationException();
  
                  m_floatWindowFactory = value;
              }
          }
  
          public IDockWindowFactory DockWindowFactory
          {
              get { return m_dockWindowFactory ?? (m_dockWindowFactory = new DefaultDockWindowFactory()); }
              set
              {
                  m_dockWindowFactory = value;
                  DockPanel.ReloadDockWindows();
              }
          }
  
          public IDockPaneCaptionFactory DockPaneCaptionFactory
          {
              get
              {
                  if (m_dockPaneCaptionFactory == null)
                      m_dockPaneCaptionFactory = new DefaultDockPaneCaptionFactory();
  
                  return m_dockPaneCaptionFactory;
              }
              set
              {
                  if (DockPanel.Panes.Count > 0)
                      throw new InvalidOperationException();
  
                  m_dockPaneCaptionFactory = value;
              }
          }
  
          public IDockPaneStripFactory DockPaneStripFactory
          {
              get
              {
                  if (m_dockPaneStripFactory == null)
                      m_dockPaneStripFactory = new DefaultDockPaneStripFactory();
  
                  return m_dockPaneStripFactory;
              }
              set
              {
                  if (DockPanel.Contents.Count > 0)
                      throw new InvalidOperationException();
  
                  m_dockPaneStripFactory = value;
              }
          }
  
          public IAutoHideStripFactory AutoHideStripFactory
          {
              get
              {
                  if (m_autoHideStripFactory == null)
                      m_autoHideStripFactory = new DefaultAutoHideStripFactory();
  
                  return m_autoHideStripFactory;
              }
              set
              {
                  if (DockPanel.Contents.Count > 0)
                      throw new InvalidOperationException();
  
                  if (m_autoHideStripFactory == value)
                      return;
  
                  m_autoHideStripFactory = value;
                  DockPanel.ResetAutoHideStripControl();
              }
          }
  
          public IAutoHideWindowFactory AutoHideWindowFactory
          {
              get { return m_autoHideWindowFactory ?? (m_autoHideWindowFactory = new DefaultAutoHideWindowFactory()); }
              set
              {
                  if (DockPanel.Contents.Count > 0)
                  {
                      throw new InvalidOperationException();
                  }
  
                  if (m_autoHideWindowFactory == value)
                  {
                      return;
                  }
  
                  m_autoHideWindowFactory = value;
                  DockPanel.ResetAutoHideStripWindow();
              }
          }
  
          public IPaneIndicatorFactory PaneIndicatorFactory
          {
              get { return m_PaneIndicatorFactory ?? (m_PaneIndicatorFactory = new DefaultPaneIndicatorFactory()); }
              set { m_PaneIndicatorFactory = value; }
          }
  
          public IPanelIndicatorFactory PanelIndicatorFactory
          {
              get { return m_PanelIndicatorFactory ?? (m_PanelIndicatorFactory = new DefaultPanelIndicatorFactory()); }
  
gt:             set { m_PanelIndicatorFactory = value; }