示例#1
0
void AP_Dialog_FormatFrame::setCurFrameProps(void)
{
	XAP_Frame * frame = m_pApp->getLastFocussedFrame();
	if (!frame) {
		if (m_bSensitive) {
			m_bSensitive = false;
			setAllSensitivities();
		}
		return;
	}

	FV_View * pView = static_cast<FV_View *>(frame->getCurrentView());
	if (!pView) {
		if (m_bSensitive) {
			m_bSensitive = false;
			setAllSensitivities();
		}
		return;
	}

	PT_DocPosition pos = pView->getPoint();

	if (/* m_bSettingsChanged || */ m_iOldPos == pos) {
		// comparing the actual cell pos would be even better; but who cares :)
		return;
	}
	m_iOldPos = pos;

	if (!pView->isInFrame(pos)) {
		if (m_bSensitive) {
			m_bSensitive = false;
			setAllSensitivities();
		}
		return;
	}

	m_bLineToggled = false;

	m_borderLineStyleRight  = LS_NORMAL;
	m_borderLineStyleLeft   = LS_NORMAL;
	m_borderLineStyleTop    = LS_NORMAL;
	m_borderLineStyleBottom = LS_NORMAL;

	UT_RGBColor black(0,0,0);
	UT_RGBColor white(255,255,255);

	m_borderColor = black;

	m_borderColorRight  = black;
	m_borderColorLeft   = black;
	m_borderColorTop    = black;
	m_borderColorBottom = black;

	m_borderThicknessRight  = 1.0f;
	m_borderThicknessLeft   = 1.0f;
	m_borderThicknessTop    = 1.0f;
	m_borderThicknessBottom = 1.0f;

	m_sBorderThickness = "1.00pt",
 
	m_sBorderThicknessRight  = "1.00pt";
	m_sBorderThicknessLeft   = "1.00pt";
	m_sBorderThicknessTop    = "1.00pt";
	m_sBorderThicknessBottom = "1.00pt";

	m_backgroundColor = white;

	m_bSetWrapping = false;

	m_iFramePositionTo = FL_FRAME_POSITIONED_TO_BLOCK;

	PD_Document * pDoc = pView->getDocument();

	PL_StruxDocHandle sdh;

	m_bSensitive = false;

	if (pDoc->getStruxOfTypeFromPosition(pos, PTX_SectionFrame, &sdh))
		if (PT_AttrPropIndex api = pDoc->getAPIFromSDH(sdh)) {
			const PP_AttrProp * pAP = 0;
			if (pDoc->getAttrProp(api, &pAP))
				if (pAP) {
					m_bSensitive = true;

#define REPLACE_CELL_PROPERTY(X) \
	do { \
		const gchar * prop = 0; \
		if (pAP->getProperty(X, prop)) \
			m_vecProps.addOrReplaceProp(X, prop); \
		else \
			m_vecProps.removeProp(X); \
	} while (0)

					REPLACE_CELL_PROPERTY("right-style");
					REPLACE_CELL_PROPERTY("left-style");
					REPLACE_CELL_PROPERTY("top-style");
					REPLACE_CELL_PROPERTY("bot-style");

					REPLACE_CELL_PROPERTY("right-thickness");
					REPLACE_CELL_PROPERTY("left-thickness");
					REPLACE_CELL_PROPERTY("top-thickness");
					REPLACE_CELL_PROPERTY("bot-thickness");

					REPLACE_CELL_PROPERTY("right-color");
					REPLACE_CELL_PROPERTY("left-color");
					REPLACE_CELL_PROPERTY("top-color");
					REPLACE_CELL_PROPERTY("bot-color");

					REPLACE_CELL_PROPERTY("background-color");

					REPLACE_CELL_PROPERTY("wrap-mode");
					REPLACE_CELL_PROPERTY("position-to");
				}
		}
	if (!m_bSensitive) {
		setAllSensitivities();
		return;
	}

	if(pView->isImageAtStrux(m_iOldPos,PTX_SectionFrame))
	{
		if(true /* pView->isInFrame(pView->getPoint()) */)
		{
			fl_BlockLayout * pBL = pView->getCurrentBlock();
			fl_FrameLayout * pFrame = static_cast<fl_FrameLayout *>(pBL->myContainingLayout());
			if(pFrame->getContainerType() != FL_CONTAINER_FRAME)
			{
				UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
				DELETEP(m_pGraphic);
				DELETEP(m_pImage);
				m_sImagePath.clear();
			}
			else
			{
				FG_Graphic * pFG = FG_GraphicRaster::createFromStrux(pFrame);
				if(pFG)
				{
					DELETEP(m_pGraphic);
					DELETEP(m_pImage);
					m_sImagePath.clear();
					m_pGraphic = pFG;
					m_sImagePath = pFG->getDataId();

					GR_Graphics * pG = m_pFormatFramePreview->getGraphics();
                    m_pImage = _makeImageForRaster(m_sImagePath, pG, m_pGraphic);
				}
			}
		}
		else
		{
			DELETEP(m_pGraphic);
			DELETEP(m_pImage);
			m_sImagePath.clear();
		}
	}
	else
	{
		DELETEP(m_pGraphic);
		DELETEP(m_pImage);
		m_sImagePath.clear();
	}

	UT_String bstmp = UT_String_sprintf("%d", FS_FILL);
	m_vecProps.addOrReplaceProp("bg-style", bstmp.c_str()); // FIXME ??
		
	const gchar * pszStyle = 0;
	m_vecProps.getProp("background-color", pszStyle);
	if (pszStyle) {
		m_backgroundColor.setColor(pszStyle);
	}

	/* update border properties
	 */
	long linestyle;

	pszStyle = 0;
	m_vecProps.getProp("right-style", pszStyle);
	if (pszStyle) {
		linestyle = LS_NORMAL;
		sscanf(pszStyle, "%ld", &linestyle);
		m_borderLineStyleRight = linestyle;
	}
	pszStyle = 0;
	m_vecProps.getProp("left-style", pszStyle);
	if (pszStyle) {
		linestyle = LS_NORMAL;
		sscanf(pszStyle, "%ld", &linestyle);
		m_borderLineStyleLeft = linestyle;
	}
	pszStyle = 0;
	m_vecProps.getProp("top-style", pszStyle);
	if (pszStyle) {
		linestyle = LS_NORMAL;
		sscanf(pszStyle, "%ld", &linestyle);
		m_borderLineStyleTop = linestyle;
	}
	pszStyle = 0;
	m_vecProps.getProp("bot-style", pszStyle);
	if (pszStyle) {
		linestyle = LS_NORMAL;
		sscanf(pszStyle, "%ld", &linestyle);
		m_borderLineStyleBottom = linestyle;
	}

	pszStyle = 0;
	m_vecProps.getProp("right-color", pszStyle);
	if (pszStyle) {
		m_borderColorRight.setColor(pszStyle);
	}
	pszStyle = 0;
	m_vecProps.getProp("left-color", pszStyle);
	if (pszStyle) {
		m_borderColorLeft.setColor(pszStyle);
	}
	pszStyle = 0;
	m_vecProps.getProp("top-color", pszStyle);
	if (pszStyle) {
		m_borderColorTop.setColor(pszStyle);
	}
	pszStyle = 0;
	m_vecProps.getProp("bot-color", pszStyle);
	if (pszStyle) {
		m_borderColorBottom.setColor(pszStyle);
	}

	UT_UTF8String thickness;

	pszStyle = 0;
	m_vecProps.getProp("right-thickness", pszStyle);
	if (pszStyle) {
		thickness = pszStyle;
		setBorderThicknessRight(thickness);
	}
	pszStyle = 0;
	m_vecProps.getProp("left-thickness", pszStyle);
	if (pszStyle) {
		thickness = pszStyle;
		setBorderThicknessLeft(thickness);
	}
	pszStyle = 0;
	m_vecProps.getProp("top-thickness", pszStyle);
	if (pszStyle) {
		thickness = pszStyle;
		setBorderThicknessTop(thickness);
	}
	pszStyle = 0;
	m_vecProps.getProp("bot-thickness", pszStyle);
	if (pszStyle) {
		thickness = pszStyle;
		setBorderThicknessBottom(thickness);
	}

	/* update wrap properties
	 */
	pszStyle = 0;
	m_vecProps.getProp("wrap-mode", pszStyle);
	if (pszStyle) {
		if (strcmp (pszStyle, "wrapped-both") == 0) {
			m_bSetWrapping = true;
		}
	}

	/* update position properties
	 */
	pszStyle = 0;
	m_vecProps.getProp("position-to", pszStyle);
	if (pszStyle) {
		if (strcmp (pszStyle, "block-above-text") == 0) {
			m_iFramePositionTo = FL_FRAME_POSITIONED_TO_BLOCK;
		}
		else if (strcmp (pszStyle, "column-above-text") == 0) {
			m_iFramePositionTo = FL_FRAME_POSITIONED_TO_COLUMN;
		}
		else if (strcmp (pszStyle, "page-above-text") == 0) {
			m_iFramePositionTo = FL_FRAME_POSITIONED_TO_PAGE;
		}
	}

	/* draw the preview with the changed properties
	 */
	if(m_pFormatFramePreview) {
		m_pFormatFramePreview->draw();
	}

	m_bSettingsChanged = false;
	setActiveFrame(frame); // this is just to trigger the subclass to update the dialog
}
void AP_FormatTable_preview::draw(const UT_Rect *clip)
{
    UT_UNUSED(clip);
    GR_Painter painter(m_gc);

    UT_sint32 iWidth = m_gc->tlu (getWindowWidth());
    UT_sint32 iHeight = m_gc->tlu (getWindowHeight());
    UT_Rect pageRect(m_gc->tlu(7), m_gc->tlu(7), iWidth - m_gc->tlu(14), iHeight - m_gc->tlu(14));

    painter.fillRect(GR_Graphics::CLR3D_Background, 0, 0, iWidth, iHeight);
    painter.clearArea(pageRect.left, pageRect.top, pageRect.width, pageRect.height);


    UT_RGBColor tmpCol;

    UT_RGBColor black(0, 0, 0);
    m_gc->setLineWidth(m_gc->tlu(1));

    int border = m_gc->tlu(20);
    int cornerLength = m_gc->tlu(5);

//
//  Draw the cell background
//

    const gchar * pszBGCol = NULL;
    if(m_pFormatTable->getImage())
    {
        GR_Image * pImg = m_pFormatTable->getImage();
        FG_Graphic * pFG = m_pFormatTable->getGraphic();
        const char * szName = pFG->getDataId();
        const UT_ByteBuf * pBB = pFG->getBuffer();
        if(pFG->getType() == FGT_Raster)
        {
            pImg = static_cast<GR_Image *>(
                       m_gc->createNewImage( szName,
                                             pBB, pFG->getMimeType(),
                                             pageRect.width - 2*border,
                                             pageRect.height - 2*border,
                                             GR_Image::GRT_Raster));
        }
        else
        {
            pImg = static_cast<GR_Image *>(
                       m_gc->createNewImage( szName,
                                             pBB, pFG->getMimeType(),
                                             pageRect.width - 2*border,
                                             pageRect.height - 2*border,
                                             GR_Image::GRT_Vector));
        }

        UT_Rect rec(pageRect.left + border, pageRect.top + border,
                    pageRect.width - 2*border, pageRect.height - 2*border);
        painter.drawImage(pImg,pageRect.left + border, pageRect.top + border);
        delete pImg;
    }
    else
    {
        m_pFormatTable->getPropVector().getProp(static_cast<const gchar *>("background-color"), pszBGCol);
        if (pszBGCol && *pszBGCol)
        {
            UT_parseColor(pszBGCol, tmpCol);
            painter.fillRect(tmpCol, pageRect.left + border, pageRect.top + border, pageRect.width - 2*border, pageRect.height - 2*border);
        }
    }

//
//  Draw the cell corners
//

    m_gc->setColor(UT_RGBColor(127,127,127));

    // top left corner
    painter.drawLine(pageRect.left + border - cornerLength, pageRect.top + border,
                     pageRect.left + border, pageRect.top + border);
    painter.drawLine(pageRect.left + border, pageRect.top + border  - cornerLength,
                     pageRect.left + border, pageRect.top + border);

    // top right corner
    painter.drawLine(pageRect.left + pageRect.width - border + cornerLength, pageRect.top + border,
                     pageRect.left + pageRect.width - border, pageRect.top + border);
    painter.drawLine(pageRect.left + pageRect.width - border, pageRect.top + border - cornerLength,
                     pageRect.left + pageRect.width - border, pageRect.top + border);

    // bottom left corner
    painter.drawLine(pageRect.left + border - cornerLength, pageRect.top + pageRect.height - border,
                     pageRect.left + border, pageRect.top + pageRect.height - border);
    painter.drawLine(pageRect.left + border, pageRect.top + pageRect.height - border + cornerLength,
                     pageRect.left + border, pageRect.top + pageRect.height - border);

    // bottom right corner
    painter.drawLine(pageRect.left + pageRect.width - border + cornerLength, pageRect.top + pageRect.height - border,
                     pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border);
    painter.drawLine(pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border + cornerLength,
                     pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border);

//
//  Draw the cell borders
//

    // top border
    if (m_pFormatTable->getTopToggled())
    {
        const gchar * pszTopColor = NULL;
        m_pFormatTable->getPropVector().getProp("top-color", pszTopColor);
        if (pszTopColor)
        {
            UT_parseColor(pszTopColor, tmpCol);
            m_gc->setColor(tmpCol);
        }
        else
            m_gc->setColor(black);
        const gchar * pszTopThickness = NULL;
        m_pFormatTable->getPropVector().getProp("top-thickness", pszTopThickness);
        if(pszTopThickness)
        {
            UT_sint32 iTopThickness = UT_convertToLogicalUnits(pszTopThickness);
            m_gc->setLineWidth(iTopThickness);
        }
        else
        {
            m_gc->setLineWidth(m_gc->tlu(1));
        }

        painter.drawLine(pageRect.left + border, pageRect.top + border,
                         pageRect.left + pageRect.width - border, pageRect.top + border);
    }

    // left border
    if (m_pFormatTable->getLeftToggled())
    {
        const gchar * pszLeftColor = NULL;
        m_pFormatTable->getPropVector().getProp("left-color", pszLeftColor);
        if (pszLeftColor)
        {
            UT_parseColor(pszLeftColor, tmpCol);
            m_gc->setColor(tmpCol);
        }
        else
            m_gc->setColor(black);
        const gchar * pszLeftThickness = NULL;
        m_pFormatTable->getPropVector().getProp("left-thickness", pszLeftThickness);
        if(pszLeftThickness)
        {
            UT_sint32 iLeftThickness = UT_convertToLogicalUnits(pszLeftThickness);
            m_gc->setLineWidth(iLeftThickness);
        }
        else
        {
            m_gc->setLineWidth(m_gc->tlu(1));
        }
        painter.drawLine(pageRect.left + border, pageRect.top + border,
                         pageRect.left + border, pageRect.top + pageRect.height - border);
    }

    // right border
    if (m_pFormatTable->getRightToggled())
    {
        const gchar * pszRightColor = NULL;
        m_pFormatTable->getPropVector().getProp("right-color", pszRightColor);
        if (pszRightColor)
        {
            UT_parseColor(pszRightColor, tmpCol);
            m_gc->setColor(tmpCol);
        }
        else
            m_gc->setColor(black);
        const gchar * pszRightThickness = NULL;
        m_pFormatTable->getPropVector().getProp("right-thickness", pszRightThickness);
        if(pszRightThickness)
        {
            UT_sint32 iRightThickness = UT_convertToLogicalUnits(pszRightThickness);
            m_gc->setLineWidth(iRightThickness);
        }
        else
        {
            m_gc->setLineWidth(m_gc->tlu(1));
        }
        painter.drawLine(pageRect.left + pageRect.width - border, pageRect.top + border,
                         pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border);
    }

    // bottom border
    if (m_pFormatTable->getBottomToggled())
    {
        const gchar * pszBottomColor = NULL;
        m_pFormatTable->getPropVector().getProp("bot-color", pszBottomColor);
        if (pszBottomColor)
        {
            UT_parseColor(pszBottomColor, tmpCol);
            m_gc->setColor(tmpCol);
        }
        else
            m_gc->setColor(black);
        const gchar * pszBotThickness = NULL;
        m_pFormatTable->getPropVector().getProp("bot-thickness", pszBotThickness);
        if(pszBotThickness)
        {
            UT_sint32 iBotThickness = UT_convertToLogicalUnits(pszBotThickness);
            m_gc->setLineWidth(iBotThickness);
        }
        else
        {
            m_gc->setLineWidth(m_gc->tlu(1));
        }
        painter.drawLine(pageRect.left + border, pageRect.top + pageRect.height - border,
                         pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border);
    }
}
示例#3
0
void AP_FormatFrame_preview::draw(void)
{
	GR_Painter painter(m_gc);
	
	UT_sint32 iWidth = m_gc->tlu (getWindowWidth());
	UT_sint32 iHeight = m_gc->tlu (getWindowHeight());
	UT_Rect pageRect(m_gc->tlu(7), m_gc->tlu(7), iWidth - m_gc->tlu(14), iHeight - m_gc->tlu(14));	
	
	painter.fillRect(GR_Graphics::CLR3D_Background, 0, 0, iWidth, iHeight);
	painter.clearArea(pageRect.left, pageRect.top, pageRect.width, pageRect.height);	
	
	
	UT_RGBColor tmpCol;
	
	UT_RGBColor black(0, 0, 0);
	m_gc->setLineWidth(m_gc->tlu(1));
	
	int border = m_gc->tlu(20);
	int cornerLength = m_gc->tlu(5);

//
//  Draw the cell background
//
	
	const gchar * pszBGCol = NULL;
	if(m_pFormatFrame->getImage())
	{
		GR_Image * pImg = m_pFormatFrame->getImage();
		FG_Graphic * pFG = m_pFormatFrame->getGraphic();
		const char * szName = pFG->getDataId();
        const UT_ByteBuf * pBB = static_cast<FG_GraphicRaster *>(pFG)->getBuffer();
		if(pFG->getType() == FGT_Raster)
		{
			pImg = static_cast<GR_Image *>(
				m_gc->createNewImage( szName,
									pBB, pFG->getMimeType(),
									pageRect.width - 2*border,
									pageRect.height - 2*border,
									GR_Image::GRT_Raster));
		}
		else
		{
			pImg = static_cast<GR_Image *>(
				m_gc->createNewImage( szName,
                                      pBB, pFG->getMimeType(),
									pageRect.width - 2*border,
									pageRect.height - 2*border,
									GR_Image::GRT_Vector));
		}

		UT_Rect rec(pageRect.left + border, pageRect.top + border, 
					pageRect.width - 2*border, pageRect.height - 2*border);
		painter.drawImage(pImg,pageRect.left + border, pageRect.top + border);
		delete pImg;
	}
	else
	{
		m_pFormatFrame->getPropVector().getProp(static_cast<const gchar *>("background-color"), pszBGCol);
		if (pszBGCol && *pszBGCol)
		{
			UT_parseColor(pszBGCol, tmpCol);
			painter.fillRect(tmpCol, pageRect.left + border, pageRect.top + border, pageRect.width - 2*border, pageRect.height - 2*border);
		}
	}

//
//  Draw the cell corners
//
	
	m_gc->setColor(UT_RGBColor(127,127,127));
	
	// top left corner
	painter.drawLine(pageRect.left + border - cornerLength, pageRect.top + border,
				   pageRect.left + border, pageRect.top + border);
	painter.drawLine(pageRect.left + border, pageRect.top + border  - cornerLength,
				   pageRect.left + border, pageRect.top + border);

	// top right corner
	painter.drawLine(pageRect.left + pageRect.width - border + cornerLength, pageRect.top + border,
				   pageRect.left + pageRect.width - border, pageRect.top + border);
	painter.drawLine(pageRect.left + pageRect.width - border, pageRect.top + border - cornerLength,
				   pageRect.left + pageRect.width - border, pageRect.top + border);

	// bottom left corner
	painter.drawLine(pageRect.left + border - cornerLength, pageRect.top + pageRect.height - border,
				   pageRect.left + border, pageRect.top + pageRect.height - border);
	painter.drawLine(pageRect.left + border, pageRect.top + pageRect.height - border + cornerLength,
				   pageRect.left + border, pageRect.top + pageRect.height - border);

	// bottom right corner
	painter.drawLine(pageRect.left + pageRect.width - border + cornerLength, pageRect.top + pageRect.height - border,
				   pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border);
	painter.drawLine(pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border + cornerLength,
				   pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border);

//
//  Draw the cell borders
//
	// right border
	if (m_pFormatFrame->getRightToggled())
	{
		UT_sint32 linestyle = m_pFormatFrame->borderLineStyleRight();
		if (linestyle == LS_DOTTED)
			m_gc->setLineProperties(1, GR_Graphics::JOIN_MITER, GR_Graphics::CAP_BUTT, GR_Graphics::LINE_DOTTED);
		else if (linestyle == LS_DASHED)
			m_gc->setLineProperties(1, GR_Graphics::JOIN_MITER, GR_Graphics::CAP_BUTT, GR_Graphics::LINE_ON_OFF_DASH);
		else
			m_gc->setLineProperties(1, GR_Graphics::JOIN_MITER, GR_Graphics::CAP_BUTT, GR_Graphics::LINE_SOLID);

		m_gc->setColor(m_pFormatFrame->borderColorRight());

		UT_sint32 iRightThickness = UT_convertToLogicalUnits(m_pFormatFrame->getBorderThicknessRight().utf8_str());
		m_gc->setLineWidth(iRightThickness);

		painter.drawLine(pageRect.left + pageRect.width - border, pageRect.top + border,
						 pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border);
	}

	// left border
	if (m_pFormatFrame->getLeftToggled())
	{
		UT_sint32 linestyle = m_pFormatFrame->borderLineStyleLeft();
		if (linestyle == LS_DOTTED)
			m_gc->setLineProperties(1, GR_Graphics::JOIN_MITER, GR_Graphics::CAP_BUTT, GR_Graphics::LINE_DOTTED);
		else if (linestyle == LS_DASHED)
			m_gc->setLineProperties(1, GR_Graphics::JOIN_MITER, GR_Graphics::CAP_BUTT, GR_Graphics::LINE_ON_OFF_DASH);
		else
			m_gc->setLineProperties(1, GR_Graphics::JOIN_MITER, GR_Graphics::CAP_BUTT, GR_Graphics::LINE_SOLID);

		m_gc->setColor(m_pFormatFrame->borderColorLeft());

		UT_sint32 iLeftThickness = UT_convertToLogicalUnits(m_pFormatFrame->getBorderThicknessLeft().utf8_str());
		m_gc->setLineWidth(iLeftThickness);

		painter.drawLine(pageRect.left + border, pageRect.top + border,
						 pageRect.left + border, pageRect.top + pageRect.height - border);
	}

	// top border
	if (m_pFormatFrame->getTopToggled())
	{
		UT_sint32 linestyle = m_pFormatFrame->borderLineStyleTop();
		if (linestyle == LS_DOTTED)
			m_gc->setLineProperties(1, GR_Graphics::JOIN_MITER, GR_Graphics::CAP_BUTT, GR_Graphics::LINE_DOTTED);
		else if (linestyle == LS_DASHED)
			m_gc->setLineProperties(1, GR_Graphics::JOIN_MITER, GR_Graphics::CAP_BUTT, GR_Graphics::LINE_ON_OFF_DASH);
		else
			m_gc->setLineProperties(1, GR_Graphics::JOIN_MITER, GR_Graphics::CAP_BUTT, GR_Graphics::LINE_SOLID);

		m_gc->setColor(m_pFormatFrame->borderColorTop());		
		UT_sint32 iTopThickness = UT_convertToLogicalUnits(m_pFormatFrame->getBorderThicknessTop().utf8_str());
		m_gc->setLineWidth(iTopThickness);

		painter.drawLine(pageRect.left + border, pageRect.top + border,
						 pageRect.left + pageRect.width - border, pageRect.top + border);
	}

	// bottom border
	if (m_pFormatFrame->getBottomToggled())
	{
		UT_sint32 linestyle = m_pFormatFrame->borderLineStyleBottom();
		if (linestyle == LS_DOTTED)
			m_gc->setLineProperties(1, GR_Graphics::JOIN_MITER, GR_Graphics::CAP_BUTT, GR_Graphics::LINE_DOTTED);
		else if (linestyle == LS_DASHED)
			m_gc->setLineProperties(1, GR_Graphics::JOIN_MITER, GR_Graphics::CAP_BUTT, GR_Graphics::LINE_ON_OFF_DASH);
		else
			m_gc->setLineProperties(1, GR_Graphics::JOIN_MITER, GR_Graphics::CAP_BUTT, GR_Graphics::LINE_SOLID);

		m_gc->setColor(m_pFormatFrame->borderColorBottom());

		UT_sint32 iBottomThickness = UT_convertToLogicalUnits(m_pFormatFrame->getBorderThicknessBottom().utf8_str());
		m_gc->setLineWidth(iBottomThickness);

		painter.drawLine(pageRect.left + border, pageRect.top + pageRect.height - border,
						 pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border);
	}
}
void AP_Dialog_FormatTable::setCurCellProps(void)
{
    XAP_Frame *frame = XAP_App::getApp()->getLastFocussedFrame();
    if (frame) {
        FV_View * pView = static_cast<FV_View *>(frame->getCurrentView());

        if (m_bSettingsChanged ||
                m_iOldPos == pView->getPoint()) // comparing the actual cell pos would be even better; but who cares :)
            return;

        m_iOldPos = pView->getPoint();

        /*
         * update the border colors
         */

        gchar * color = NULL;

        if (pView->getCellProperty("left-color", color))
            m_vecProps.addOrReplaceProp("left-color", color);
        else
            m_vecProps.removeProp("left-color");

        if (pView->getCellProperty("right-color", color))
            m_vecProps.addOrReplaceProp("right-color", color);
        else
            m_vecProps.removeProp("right-color");

        if (pView->getCellProperty("top-color", color))
            m_vecProps.addOrReplaceProp("top-color", color);
        else
            m_vecProps.removeProp("top-color");

        if (pView->getCellProperty("bot-color", color))
            m_vecProps.addOrReplaceProp("bot-color", color);
        else
            m_vecProps.removeProp("bot-color");

        /*
         * update the background color
         */

        UT_RGBColor clr;
        gchar * bgColor = NULL;
        if (pView->getCellProperty("background-color", bgColor))
        {
            m_vecProps.addOrReplaceProp("background-color", bgColor);
            clr.setColor(bgColor);
            setBackgroundColorInGUI(clr);
        }
        else
        {
            m_vecProps.removeProp("background-color");
            setBackgroundColorInGUI(UT_RGBColor(255,255,255)); // No color == white for now - MARCM
        }


        if(pView->isImageAtStrux(m_iOldPos,PTX_SectionCell))
        {
            if(pView->isInTable())
            {
                fl_BlockLayout * pBL = pView->getCurrentBlock();
                fl_CellLayout * pCell = static_cast<fl_CellLayout *>(pBL->myContainingLayout());
                if(pCell->getContainerType() != FL_CONTAINER_CELL)
                {
                    UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
                    DELETEP(m_pGraphic);
                    DELETEP(m_pImage);
                    m_sImagePath.clear();
                }
                else
                {
                    FG_Graphic * pFG = FG_GraphicRaster::createFromStrux(pCell);
                    if(pFG)
                    {
                        DELETEP(m_pGraphic);
                        DELETEP(m_pImage);
                        m_sImagePath.clear();
                        m_pGraphic = pFG;
                        m_sImagePath = pFG->getDataId();
                        GR_Graphics * pG = m_pFormatTablePreview->getGraphics();
                        const UT_ByteBuf * pBB = pFG->getBuffer();
                        if(m_pGraphic->getType() == FGT_Raster)
                        {
                            m_pImage = static_cast<GR_Image *>(
                                           pG->createNewImage( m_sImagePath.c_str(),
                                                               pBB, pFG->getMimeType(),
                                                               pFG->getWidth(),
                                                               pFG->getHeight(),
                                                               GR_Image::GRT_Raster));
                        }
                        else
                        {
                            m_pImage = static_cast<GR_Image *>(
                                           pG->createNewImage( m_sImagePath.c_str(),
                                                               pBB, pFG->getMimeType(),
                                                               m_pFormatTablePreview->getWindowWidth()-2,
                                                               m_pFormatTablePreview->getWindowHeight()-2,
                                                               GR_Image::GRT_Vector));
                        }
                    }
                }
            }
            else
            {
                DELETEP(m_pGraphic);
                DELETEP(m_pImage);
                m_sImagePath.clear();
            }
        }
        else
        {
            DELETEP(m_pGraphic);
            DELETEP(m_pImage);
            m_sImagePath.clear();
        }

        UT_String bstmp = UT_String_sprintf("%d", FS_FILL);
        m_vecProps.addOrReplaceProp("bg-style", bstmp.c_str());

        // draw the preview with the changed properties
        if(m_pFormatTablePreview)
            m_pFormatTablePreview->queueDraw();
    }
}