void CBCGPRibbonConstructor::ConstructElement (CBCGPBaseRibbonElement& element, const CBCGPRibbonInfo::XElement& info) const
{
	if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Main) == 0 &&
		element.IsKindOf (RUNTIME_CLASS (CBCGPRibbonMainButton)))
	{
		ConstructBaseElement (element, info);

		const CBCGPRibbonInfo::XElementButtonMain& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonMain&)info;

		CBCGPRibbonMainButton* pElement = (CBCGPRibbonMainButton*)&element;
		ASSERT_VALID (pElement);

		const_cast<CBCGPToolBarImages&>(infoElement.m_Image.m_Image).CopyTo (pElement->m_Image);
		const_cast<CBCGPToolBarImages&>(infoElement.m_ImageScenic.m_Image).CopyTo (pElement->m_ImageScenic);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Launch) == 0 &&
			 element.IsKindOf (RUNTIME_CLASS (CBCGPRibbonLaunchButton)))
	{
		ConstructBaseElement (element, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szGroup) == 0 &&
			 element.IsKindOf (RUNTIME_CLASS (CBCGPRibbonButtonsGroup)))
	{
		const CBCGPRibbonInfo::XElementGroup& infoElement = 
			(const CBCGPRibbonInfo::XElementGroup&)info;

		CBCGPRibbonButtonsGroup* pElement = (CBCGPRibbonButtonsGroup*)&element;
		ASSERT_VALID (pElement);

		const_cast<CBCGPToolBarImages&>(infoElement.m_Images.m_Image).CopyTo (pElement->m_Images);

		for (int i = 0; i < infoElement.m_arButtons.GetSize (); i++)
		{
			CBCGPBaseRibbonElement* pButton = CreateElement 
				(*(const CBCGPRibbonInfo::XElement*)infoElement.m_arButtons[i]);

			if (pButton != NULL)
			{
				ASSERT_VALID (pButton);
				pElement->AddButton (pButton);
			}
		}
	}
	else
	{
		ASSERT (FALSE);
	}
}
CBCGPGaugeImpl* CBCGPDashboardConstructor::CreateElement (const CBCGPGaugeInfo::XElement& info) const
{
    CBCGPGaugeImpl* pElement = NULL;

    if (info.GetElementName ().Compare (CBCGPGaugeInfo::s_szCircularGauge) == 0)
    {
        const CBCGPGaugeInfo::XElementCircular& infoElement =
            (const CBCGPGaugeInfo::XElementCircular&)info;

        CBCGPCircularGaugeImpl* pNewElement = new CBCGPCircularGaugeImpl;

        pElement = pNewElement;

        ConstructBaseElement (*pElement, info);

        pNewElement->SetColors (infoElement.m_Colors);
        pNewElement->SetCapSize (infoElement.m_dblCapSize);
        pNewElement->EnableShapeByTicksArea (infoElement.m_bShapeByTicksArea);

        int i = 0;
        for (i = 0; i < infoElement.m_arScales.GetSize (); i++)
        {
            const CBCGPGaugeInfo::XCircularScale* pScaleInfo =
                (const CBCGPGaugeInfo::XCircularScale*)infoElement.m_arScales[i];

            int index = 0;
            if (i != 0)
            {
                index = pNewElement->AddScale ();
            }

            pNewElement->SetRange (pScaleInfo->m_dblStart, pScaleInfo->m_dblFinish, index);
            pNewElement->SetStep (pScaleInfo->m_dblStep, index);
            pNewElement->SetTextLabelFormat (pScaleInfo->m_strLabelFormat, index);
            pNewElement->SetTickMarkSize (pScaleInfo->m_dblMinorTickMarkSize, FALSE, index);
            pNewElement->SetTickMarkSize (pScaleInfo->m_dblMajorTickMarkSize, TRUE, index);
            pNewElement->SetMajorTickMarkStep (pScaleInfo->m_dblMajorTickMarkStep, index);
            pNewElement->SetScaleFillBrush (pScaleInfo->m_brFill, index);
            pNewElement->SetScaleOutlineBrush (pScaleInfo->m_brOutline, index);
            pNewElement->SetScaleTextBrush (pScaleInfo->m_brText, index);
            pNewElement->SetScaleTickMarkBrush (pScaleInfo->m_brTickMarkMinor, FALSE, index);
            pNewElement->SetScaleTickMarkBrush (pScaleInfo->m_brTickMarkMajor, TRUE, index);
            pNewElement->SetTicksAreaAngles (pScaleInfo->m_dblStartAngle, pScaleInfo->m_dblFinishAngle, index);
            pNewElement->SetScaleOffsetFromBorder (pScaleInfo->m_dblOffsetFromBorder, index);
        }

        for (i = 0; i < infoElement.m_arPointers.GetSize (); i++)
        {
            const CBCGPGaugeInfo::XCircularPointer* pPointerInfo =
                (const CBCGPGaugeInfo::XCircularPointer*)infoElement.m_arPointers[i];

            int index = 0;
            if (i != 0)
            {
                index = pNewElement->AddPointer (pPointerInfo->m_dblSize, pPointerInfo->m_nScale, pPointerInfo->m_brFill,
                                                 pPointerInfo->m_brOutline, FALSE);
            }

            pNewElement->SetValue (pPointerInfo->m_dblValue, index, 0, FALSE);
        }

        for (i = 0; i < infoElement.m_arRanges.GetSize (); i++)
        {
            const CBCGPGaugeInfo::XCircularColoredRange* pRangeInfo =
                (const CBCGPGaugeInfo::XCircularColoredRange*)infoElement.m_arRanges[i];

            pNewElement->AddColoredRange (pRangeInfo->m_dblStartValue, pRangeInfo->m_dblFinishValue, pRangeInfo->m_brFill,
                                          pRangeInfo->m_brOutline, pRangeInfo->m_nScale, pRangeInfo->m_dblStartWidth, pRangeInfo->m_dblFinishWidth,
                                          pRangeInfo->m_dblOffsetFromBorder, pRangeInfo->m_brTextLabel, pRangeInfo->m_brTickMark, FALSE);
        }
    }
    else if (info.GetElementName ().Compare (CBCGPGaugeInfo::s_szNumericInd) == 0)
    {
        const CBCGPGaugeInfo::XElementNumeric& infoElement =
            (const CBCGPGaugeInfo::XElementNumeric&)info;

        CBCGPNumericIndicatorImpl* pNewElement = new CBCGPNumericIndicatorImpl;

        pElement = pNewElement;

        ConstructBaseElement (*pElement, info);
        pNewElement->SetValue (info.m_dblValue);

        pNewElement->SetColors (infoElement.m_Colors);
        pNewElement->SetStyle (infoElement.m_Style);
        pNewElement->SetDigits (infoElement.m_nDigits);
        pNewElement->SetDecimals (infoElement.m_nDecimals);
        pNewElement->SetSeparatorWidth (infoElement.m_nSeparatorWidth);
        pNewElement->SetDrawDecimalPoint (infoElement.m_bDrawDecimalPoint);
        pNewElement->SetDrawLeadingZeros (infoElement.m_bDrawLeadingZeros);
    }
    else if (info.GetElementName ().Compare (CBCGPGaugeInfo::s_szColorInd) == 0)
    {
        const CBCGPGaugeInfo::XElementColor& infoElement =
            (const CBCGPGaugeInfo::XElementColor&)info;

        CBCGPColorIndicatorImpl* pNewElement = new CBCGPColorIndicatorImpl;

        pElement = pNewElement;

        ConstructBaseElement (*pElement, info);

        pNewElement->SetColors (infoElement.m_Colors);
        pNewElement->SetStyle (infoElement.m_Style);
    }

    return pElement;
}
CBCGPBaseRibbonElement* CBCGPRibbonConstructor::CreateElement (const CBCGPRibbonInfo::XElement& info) const
{
	CBCGPBaseRibbonElement* pElement = NULL;

	int i = 0;

	if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Main) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonMain& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonMain&)info;

		CBCGPRibbonMainButton* pNewElement = new CBCGPRibbonMainButton;

		if (infoElement.m_Image.m_Image.GetImageWell () != NULL)
		{
			pNewElement->SetImage (infoElement.m_Image.m_Image.GetImageWell ());
		}
		if (infoElement.m_ImageScenic.m_Image.GetImageWell () != NULL)
		{
			pNewElement->SetScenicImage (infoElement.m_ImageScenic.m_Image.GetImageWell ());
		}

		pElement = pNewElement;

		ConstructElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Launch) == 0)
	{
		CBCGPRibbonLaunchButton* pNewElement = new CBCGPRibbonLaunchButton;
		pElement = pNewElement;

		ConstructElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szGroup) == 0)
	{
		CBCGPRibbonButtonsGroup* pNewElement = new CBCGPRibbonButtonsGroup;
		pElement = pNewElement;

		ConstructElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szLabel) == 0)
	{
		const CBCGPRibbonInfo::XElementLabel& infoElement = 
			(const CBCGPRibbonInfo::XElementLabel&)info;

		CBCGPRibbonLabel* pNewElement = 
			new CBCGPRibbonLabel (infoElement.m_strText, infoElement.m_bIsAlwaysLarge);
		pElement = pNewElement;
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szComboBox_Font) == 0)
	{
		const CBCGPRibbonInfo::XElementFontComboBox& infoElement = 
			(const CBCGPRibbonInfo::XElementFontComboBox&)info;

		CBCGPRibbonFontComboBox* pNewElement = 
			new CBCGPRibbonFontComboBox (infoElement.m_ID.m_Value, 
										infoElement.m_nFontType, 
										infoElement.m_nCharSet, 
										infoElement.m_nPitchAndFamily,
										infoElement.m_nWidth);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		if (infoElement.m_nWidthFloaty > 0)
		{
			pNewElement->SetWidth (infoElement.m_nWidthFloaty, TRUE);
		}

		pNewElement->SetTextAlign (infoElement.m_nTextAlign);
		pNewElement->SetPrompt(infoElement.m_strSearchPrompt);

		((CBCGPRibbonFontComboBox*)pNewElement)->m_bHasEditBox = infoElement.m_bHasEditBox;
		pNewElement->EnableDropDownListResize (infoElement.m_bResizeDropDownList);

		if (infoElement.m_bHasEditBox)
		{
			pNewElement->EnableAutoComplete (infoElement.m_bAutoComplete);
		}
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szComboBox) == 0)
	{
		const CBCGPRibbonInfo::XElementComboBox& infoElement = 
			(const CBCGPRibbonInfo::XElementComboBox&)info;

		CBCGPRibbonComboBox* pNewElement = 
			new CBCGPRibbonComboBox (infoElement.m_ID.m_Value, 
									infoElement.m_bCalculatorMode || infoElement.m_bHasEditBox,
									infoElement.m_nWidth,
									infoElement.m_strText,
									infoElement.m_nSmallImageIndex,
									infoElement.m_sortOrder);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		if (infoElement.m_nWidthFloaty > 0)
		{
			pNewElement->SetWidth (infoElement.m_nWidthFloaty, TRUE);
		}

		pNewElement->SetTextAlign (infoElement.m_nTextAlign);
		pNewElement->SetPrompt(infoElement.m_strSearchPrompt);

		if (infoElement.m_bCalculatorMode)
		{
			pNewElement->EnableCalculator (TRUE, NULL, &infoElement.m_lstCalculatorExt);
		}
		else
		{
			pNewElement->EnableDropDownListResize (infoElement.m_bResizeDropDownList);
			if (infoElement.m_bHasEditBox)
			{
				pNewElement->EnableAutoComplete (infoElement.m_bAutoComplete);
			}

			if (infoElement.m_bSearchMode)
			{
				pNewElement->EnableSearchMode (TRUE, infoElement.m_strSearchPrompt);
			}

			for (i = 0; i < infoElement.m_arItems.GetSize (); i++)
			{
				pNewElement->AddItem (infoElement.m_arItems[i]);
			}
		}
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szEdit) == 0)
	{
		const CBCGPRibbonInfo::XElementEdit& infoElement = 
			(const CBCGPRibbonInfo::XElementEdit&)info;

		CBCGPRibbonEdit* pNewElement = 
			new CBCGPRibbonEdit (infoElement.m_ID.m_Value, 
								infoElement.m_nWidth,
								infoElement.m_strText,
								infoElement.m_nSmallImageIndex);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		if (infoElement.m_nWidthFloaty > 0)
		{
			pNewElement->SetWidth (infoElement.m_nWidthFloaty, TRUE);
		}

		pNewElement->SetTextAlign (infoElement.m_nTextAlign);
		pNewElement->SetPrompt(infoElement.m_strSearchPrompt);

		CString strValue (infoElement.m_strValue);
		if (infoElement.m_bSearchMode)
		{
			pNewElement->EnableSearchMode (TRUE, infoElement.m_strSearchPrompt);
		}
		else if (infoElement.m_bHasSpinButtons)
		{
			pNewElement->EnableSpinButtons (infoElement.m_nMin, infoElement.m_nMax);
			if (strValue.IsEmpty ())
			{
				strValue.Format (_T("%d"), infoElement.m_nMin);
			}
		}

		BOOL bDontNotify = pNewElement->m_bDontNotify;
		pNewElement->m_bDontNotify = TRUE;
		pNewElement->SetEditText (strValue);
		pNewElement->m_bDontNotify = bDontNotify;
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Undo) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonUndo& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonUndo&)info;

		CBCGPRibbonUndoButton* pNewElement = 
			new CBCGPRibbonUndoButton (infoElement.m_ID.m_Value,
										infoElement.m_strText,
										infoElement.m_nSmallImageIndex,
										infoElement.m_nLargeImageIndex);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info, FALSE);

		pNewElement->SetButtonMode (infoElement.m_bIsButtonMode);
		pNewElement->EnableMenuResize (infoElement.m_bEnableMenuResize, infoElement.m_bMenuResizeVertical);
		pNewElement->SetDrawDisabledItems(infoElement.m_bDrawDisabledItems);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Color) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonColor& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonColor&)info;

		CBCGPRibbonColorButton* pNewElement = 
			new CBCGPRibbonColorButton (infoElement.m_ID.m_Value,
										infoElement.m_strText,
										infoElement.m_bSimpleButtonLook,
										infoElement.m_nSmallImageIndex,
										infoElement.m_nLargeImageIndex,
										infoElement.m_clrColor);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		pNewElement->EnableAutomaticButton (infoElement.m_strAutomaticBtnLabel.IsEmpty () ? NULL : (LPCTSTR)infoElement.m_strAutomaticBtnLabel, 
			infoElement.m_clrAutomaticBtnColor, !infoElement.m_strAutomaticBtnLabel.IsEmpty (), infoElement.m_strAutomaticBtnToolTip, 
			infoElement.m_bAutomaticBtnOnTop, infoElement.m_bAutomaticBtnBorder);

		pNewElement->EnableOtherButton (infoElement.m_strOtherBtnLabel.IsEmpty () ? NULL : (LPCTSTR)infoElement.m_strOtherBtnLabel, 
										infoElement.m_strOtherBtnToolTip);

		pNewElement->SetColorBoxSize (infoElement.m_sizeIcon);
		pNewElement->SetButtonMode (infoElement.m_bIsButtonMode);
		pNewElement->EnableMenuResize (infoElement.m_bEnableMenuResize, infoElement.m_bMenuResizeVertical);
		pNewElement->SetDrawDisabledItems(infoElement.m_bDrawDisabledItems);
		pNewElement->SetIconsInRow (infoElement.m_nIconsInRow);

		if (infoElement.m_arGroups.GetSize () == 0)
		{
			if (!infoElement.m_bIsButtonMode)
			{
				pNewElement->AddGroup (_T(""), (int)pNewElement->m_Colors.GetSize ());
				pNewElement->m_bHasGroups = TRUE;
			}
		}
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Palette) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonPalette& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonPalette&)info;

		CBCGPRibbonPaletteButton* pNewElement = 
			new CBCGPRibbonPaletteButton (infoElement.m_ID.m_Value,
										infoElement.m_strText,
										infoElement.m_nSmallImageIndex,
										infoElement.m_nLargeImageIndex);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		pNewElement->SetButtonMode (infoElement.m_bIsButtonMode);
		pNewElement->EnableMenuResize (infoElement.m_bEnableMenuResize, infoElement.m_bMenuResizeVertical);
		pNewElement->SetDrawDisabledItems(infoElement.m_bDrawDisabledItems);
		pNewElement->SetIconsInRow (infoElement.m_nIconsInRow);

		pNewElement->Clear ();
		int nCount = (int)infoElement.m_arGroups.GetSize ();
		if (nCount > 0)
		{
			BOOL bIsOwnerDraw = pNewElement->m_bIsOwnerDraw;
			pNewElement->m_bIsOwnerDraw = TRUE;
			for (int i = 0; i < nCount; i++)
			{
				pNewElement->AddGroup (infoElement.m_arGroups[i]->m_strName, infoElement.m_arGroups[i]->m_nItems);
			}
			pNewElement->m_bIsOwnerDraw = bIsOwnerDraw;
		}

		const_cast<CBCGPToolBarImages&>(infoElement.m_Images.m_Image).CopyTo (pNewElement->m_imagesPalette);
		pNewElement->m_nIcons = pNewElement->m_imagesPalette.GetCount ();
		pNewElement->CreateIcons ();
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Hyperlink) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonHyperlink& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonHyperlink&)info;

		CBCGPRibbonHyperlink* pNewElement = 
			new CBCGPRibbonHyperlink (infoElement.m_ID.m_Value, infoElement.m_strText, infoElement.m_strLink);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Radio) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonRadio& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonRadio&)info;

		CBCGPRibbonRadioButton* pNewElement = 
			new CBCGPRibbonRadioButton (infoElement.m_ID.m_Value, infoElement.m_strText);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Check) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonCheck& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonCheck&)info;

		CBCGPRibbonCheckBox* pNewElement = 
			new CBCGPRibbonCheckBox (infoElement.m_ID.m_Value, infoElement.m_strText);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szStatusPane) == 0)
	{
		const CBCGPRibbonInfo::XElementStatusPane& infoElement = 
			(const CBCGPRibbonInfo::XElementStatusPane&)info;

		CBCGPRibbonStatusBarPane* pNewElement = 
			new CBCGPRibbonStatusBarPane (infoElement.m_ID.m_Value,
											infoElement.m_strText,
											infoElement.m_bIsStatic);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		if (!infoElement.m_strAlmostLargeText.IsEmpty())
		{
			pNewElement->SetAlmostLargeText (infoElement.m_strAlmostLargeText);
		}
		pNewElement->SetTextAlign (infoElement.m_nTextAlign);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_MainPanel) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonMainPanel& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonMainPanel&)info;

		CBCGPRibbonMainPanelButton* pNewElement = 
			new CBCGPRibbonMainPanelButton (infoElement.m_ID.m_Value,
									infoElement.m_strText,
									infoElement.m_nSmallImageIndex);

		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Command) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonCommand& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonCommand&)info;

		CBCGPRibbonButton* pNewElement = 
			new CBCGPRibbonButton (infoElement.m_ID.m_Value,
									infoElement.m_strText,
									infoElement.m_bIsMenu ? -1 : infoElement.m_nSmallImageIndex);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info, FALSE);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton) == 0)
	{
		const CBCGPRibbonInfo::XElementButton& infoElement = 
			(const CBCGPRibbonInfo::XElementButton&)info;

		CBCGPRibbonButton* pNewElement = 
			new CBCGPRibbonButton (infoElement.m_ID.m_Value,
									infoElement.m_strText,
									infoElement.m_nSmallImageIndex,
									infoElement.m_nLargeImageIndex,
									infoElement.m_bIsAlwaysShowDescription);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szSlider) == 0)
	{
		const CBCGPRibbonInfo::XElementSlider& infoElement = 
			(const CBCGPRibbonInfo::XElementSlider&)info;

		CBCGPRibbonSlider* pNewElement = 
			new CBCGPRibbonSlider (infoElement.m_ID.m_Value,
									infoElement.m_nWidth,
									infoElement.m_dwStyle);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		pNewElement->SetZoomButtons (infoElement.m_bZoomButtons);
		pNewElement->SetRange (infoElement.m_nMin, infoElement.m_nMax);
		pNewElement->SetPos (infoElement.m_nPos, FALSE);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szProgress) == 0)
	{
		const CBCGPRibbonInfo::XElementProgressBar& infoElement = 
			(const CBCGPRibbonInfo::XElementProgressBar&)info;

		CBCGPRibbonProgressBar* pNewElement = 
			new CBCGPRibbonProgressBar (infoElement.m_ID.m_Value,
										infoElement.m_nWidth,
										infoElement.m_nHeight,
										infoElement.m_bVertical);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		pNewElement->SetRange (infoElement.m_nMin, infoElement.m_nMax);
		pNewElement->SetPos (infoElement.m_nPos, FALSE);
		pNewElement->SetInfiniteMode (infoElement.m_bInfinite);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szSeparator) == 0)
	{
		const CBCGPRibbonInfo::XElementSeparator& infoElement = 
			(const CBCGPRibbonInfo::XElementSeparator&)info;

		CBCGPRibbonSeparator* pSeparator = 
			new CBCGPRibbonSeparator (infoElement.m_bIsHoriz);

		pElement = pSeparator;
	}

	return pElement;
}