void XAP_UnixDialog_Image::runModal(XAP_Frame * pFrame)
{
	// build the dialog
	GtkWidget * cf = _constructWindow();
	UT_return_if_fail(cf);	
	
	setHeightEntry();
	setWidthEntry();
	double height = UT_convertToInches(getHeightString());
	double width = UT_convertToInches(getWidthString());
	
	if((height > 0.0001) && (width > 0.0001))
		m_dHeightWidth = height/width;
	else
	{
		m_dHeightWidth = 0.0;
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_wAspectCheck), FALSE);
	}	  
	
	setWrappingGUI();
	setPositionToGUI();
	wrappingChanged();

	switch ( abiRunModalDialog ( GTK_DIALOG(cf), pFrame, this, BUTTON_CANCEL, false ) )
    {
    case GTK_RESPONSE_OK:
		event_Ok (); break;
    default:
		event_Cancel (); break;
    }

	abiDestroyWidget (cf);
}
Ejemplo n.º 2
0
static void _css_length (const char *str,GR_Graphics* pG,
			 UT_sint32 *iDisplayLength,UT_sint32 *iLayoutLength)
{
   	UT_sint32 dim = UT_determineDimension(static_cast<const char*>(str), DIM_PX);

   	if (dim != DIM_PX && dim != DIM_none)
	{
		if (pG == 0)
		{
			*iDisplayLength = static_cast<UT_sint32>((UT_convertToInches(str) * 72.0) + 0.05);
		}
		else
		{
			*iDisplayLength = UT_convertToLogicalUnits(str);
		}
		*iLayoutLength = UT_convertToLogicalUnits(str);
	}
	else
	{
		double iImageLength = UT_convertDimensionless(str);

		double fScale = pG ? (pG->getResolution() / 72.0) : 1;
		*iDisplayLength = static_cast<UT_sint32>(iImageLength * fScale);

		fScale = 1440.0 / 72.0;
		*iLayoutLength = static_cast<UT_sint32>(iImageLength * fScale);
	}
}
AP_Win32Dialog_FormatFrame::AP_Win32Dialog_FormatFrame(XAP_DialogFactory * pDlgFactory,
										             XAP_Dialog_Id id)
	: AP_Dialog_FormatFrame(pDlgFactory,id),
	m_hBitmapBottom(NULL),	
	m_hBitmapTop(NULL), 
	m_hBitmapRight(NULL),
	m_hBitmapLeft(NULL),
	m_pPreviewWidget(NULL)
{
	UT_sint32 i = 0;
	for(i=0; i < FORMAT_FRAME_NUMTHICKNESS ;i++)
		m_dThickness[i] = UT_convertToInches(sThickness[i]);	 
}   
Ejemplo n.º 4
0
UT_sint32 UT_paperUnits(const char * sz)
{
    // convert string in form "8.5in" into "paper" units.
    // paper units are a relatively low-resolution (say
    // 1/100 inch) but are suitable for specifying margins,
    // etc. -- stuff relative to the actual paper.

    if (!sz || !*sz)
        return 0;

    double dInches = UT_convertToInches(sz);
    double dResolution = UT_PAPER_UNITS_PER_INCH;

    return static_cast<UT_sint32>(dInches * dResolution);
}
Ejemplo n.º 5
0
double UT_convertToDimension(const char* s, UT_Dimension dim)
{
    double d;

    // if needed, switch unit systems and round off

    if (UT_determineDimension(s, dim) != dim)
    {
        double dInches = UT_convertToInches(s);
        d = UT_convertInchesToDimension(dInches, dim);
    }
    else
    {
        d = UT_convertDimensionless(s);
    }

    return d;
}
Ejemplo n.º 6
0
guint AP_Dialog_FormatTable::_findClosestThickness(const char *sthickness) const
{
    double thickness = UT_convertToInches(sthickness);
    guint i =0;
    guint closest = 0;
    double dClose = 100000000.;
    for(i=0; i<FORMAT_TABLE_NUMTHICKNESS; i++)
    {
        double diff = thickness - m_dThickness[i];
        if(diff < 0)
            diff = -diff;
        if(diff < dClose)
        {
            closest = i;
            dClose = diff;
        }
    }
    return closest;
}
Ejemplo n.º 7
0
AP_Dialog_FormatTable::AP_Dialog_FormatTable(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id)
    : XAP_Dialog_Modeless(pDlgFactory,id, "interface/dialogformattable"),
      m_borderColor(0,0,0),
      m_lineStyle(LS_NORMAL),
      m_bgFillStyle(NULL),

      m_answer(a_OK),
      m_pFormatTablePreview(NULL),
      m_bSettingsChanged(false),
      m_pAutoUpdaterMC(NULL),
      m_borderToggled(false),
      m_ApplyTo(FORMAT_TABLE_SELECTION),
      m_bDestroy_says_stopupdating(false),
      m_bAutoUpdate_happening_now(false),
      m_iOldPos(0),
      m_sImagePath(""),
      m_iGraphicType(0),
      m_pImage(NULL),
      m_pGraphic(NULL)
{
    //
    // These are hardwired into the GUI.
    //
    const char * sThickness[FORMAT_TABLE_NUMTHICKNESS] = {"0.25pt","0.5pt",
                                                          "0.75pt","1.0pt",
                                                          "1.5pt","2.25pt","3pt",
                                                          "4.5pt","6.0pt"
                                                         };
    UT_sint32 i = 0;
    for(i=0; i< FORMAT_TABLE_NUMTHICKNESS ; i++)
    {
        m_dThickness[i] = UT_convertToInches(sThickness[i]);
    }

    if(m_vecProps.getItemCount() > 0)
        m_vecProps.clear();

    if(m_vecPropsAdjRight.getItemCount() > 0)
        m_vecPropsAdjRight.clear();

    if(m_vecPropsAdjBottom.getItemCount() > 0)
        m_vecPropsAdjBottom.clear();
}
void AP_UnixDialog_FormatFrame::setBorderThicknessInGUI(UT_UTF8String & sThick)
{
	double thickness = UT_convertToInches(sThick.utf8_str());
	guint i =0;
	guint closest = 0;
	double dClose = 100000000.;
	for(i=0; i<FORMAT_FRAME_NUMTHICKNESS; i++)
	{
		double diff = thickness - m_dThickness[i];
		if(diff < 0)
			diff = -diff;
		if(diff < dClose)
		{
			closest = i;
			dClose = diff;
		}
	}
	XAP_GtkSignalBlocker b(G_OBJECT(m_wBorderThickness),m_iBorderThicknessConnect);
	gtk_combo_box_set_active(GTK_COMBO_BOX(m_wBorderThickness), closest);
}
Ejemplo n.º 9
0
const char * UT_reformatDimensionString(UT_Dimension dim, const char *sz, const char * szPrecision)
{
    UT_ASSERT(sz);  // this function segfaults if it gets a null
    if (!sz)	// if we really need to give it a null, we make it = 0in
    {
        sz = "0.0in";
        UT_DEBUGMSG(("UT_reformatDimensionString just made the assumption null = 0.0in\n"));
    }
    double d = UT_convertDimensionless(sz);

    // if needed, switch unit systems and round off
    UT_Dimension dimOld = UT_determineDimension(sz, dim);

    if (dimOld != dim)
    {
        double dInches = UT_convertToInches(sz);
        d = UT_convertInchesToDimension(dInches, dim);
    }

    return UT_formatDimensionString(dim, d, szPrecision);
}
Ejemplo n.º 10
0
static bool _convertBorderThickness(const char* szIncoming, UT_UTF8String& sConverted)
{
    UT_return_val_if_fail(szIncoming && *szIncoming, false);

    double d = 0.0f;
    UT_Dimension units = UT_determineDimension (szIncoming, DIM_none);

    if (units == DIM_none) {
        // no (valid) dimension specified, we'll assume inches
        d = UT_convertToInches(szIncoming);
        d = UT_convertInchesToDimension(d, DIM_PT);

    } else {
        d = UT_convertToPoints(szIncoming);
    }

    UT_LocaleTransactor t(LC_NUMERIC, "C");
    sConverted = UT_UTF8String_sprintf("%.2fpt", d);

    return true;
}
AP_UnixDialog_FormatFrame::AP_UnixDialog_FormatFrame(XAP_DialogFactory * pDlgFactory,
										             XAP_Dialog_Id id)
	: AP_Dialog_FormatFrame(pDlgFactory,id)
{
	m_windowMain = NULL;
	m_wPreviewArea = NULL;
	m_pPreviewWidget = NULL;
	m_wApplyButton = NULL;
	m_wBorderColorButton = NULL;
	m_wLineLeft = NULL;
	m_wLineRight = NULL;
	m_wLineTop = NULL;
	m_wLineBottom = NULL;
	m_wSetImageButton = NULL;
	m_wSelectImageButton = NULL;
	m_wNoImageButton = NULL;
	m_wBorderThickness = NULL;
	m_iBorderThicknessConnect = 0;
	m_wWrapButton = NULL;
	m_wPosParagraph =  NULL;
	m_wPosColumn = NULL;
	m_wPosPage = NULL;
//
// These are hardwired into the GUI.
//
	const char * sThickness[FORMAT_FRAME_NUMTHICKNESS] ={"0.25pt","0.5pt",
													   "0.75pt","1.0pt",
													   "1.5pt","2.25pt","3pt",
													   "4.5pt","6.0pt"};
	UT_sint32 i = 0;
	for(i=0; i< FORMAT_FRAME_NUMTHICKNESS ;i++)
	{
		m_dThickness[i] = UT_convertToInches(sThickness[i]);
	}

}
Ejemplo n.º 12
0
UT_sint32 UT_convertToLogicalUnits(const char* s)
{
    return static_cast<UT_sint32>(UT_convertToInches(s) * UT_LAYOUT_RESOLUTION);
}
Ejemplo n.º 13
0
void ODe_Frame_Listener::_openODTextbox(const PP_AttrProp& rAP,
                                        ODe_ListenerAction& /*rAction*/) 
{
    UT_UTF8String output;
    UT_UTF8String str;
    bool ok;
    const gchar* pValue = NULL;
    ODe_Style_Style* pStyle;
    
    pStyle = new ODe_Style_Style();
    pStyle->setFamily("graphic");
    pStyle->fetchAttributesFromAbiFrame(rAP);
    
    // Abi frames have no padding
    // (no margin between frame borders and its content)
    pStyle->setPadding("0cm");
    
    // Abi frames are aways positioned from its top-left corner.
    pStyle->setHorizontalPos("from-left");
    pStyle->setVerticalPos("from-top");
    
    // For OOo to recognize a textbox as being a textbox, it will
    // need to have the parent style name "Frame". I can't find it
    // in the ODF spec, but without it OOo considers the textbox to
    // be a generic drawing object (check the Navigator window in OOo).
    pStyle->setParentStyleName("Frame");
    // Make sure an (empty) Frame style exists, for completeness sake
	// (OOo doesn't seem to care if it exists or not).
    if (!m_rStyles.getGraphicsStyle("Frame")) {
        ODe_Style_Style* pFrameStyle = new ODe_Style_Style();
		pFrameStyle->setStyleName("Frame");
		pFrameStyle->setFamily("graphic");
        m_rStyles.addGraphicsStyle(pFrameStyle);
    }

	m_rAutomatiStyles.storeGraphicStyle(pStyle);

    ////
    // Write <draw:frame>
    
    _printSpacesOffset(output);
    output += "<draw:frame";

    UT_UTF8String_sprintf(str, "Frame%u", m_rAuxiliaryData.m_frameCount+1);
    ODe_writeAttribute(output, "draw:name", str);
    m_rAuxiliaryData.m_frameCount++;
    
    ODe_writeAttribute(output, "draw:style-name", pStyle->getName());

    UT_UTF8String_sprintf(str, "%u", m_zIndex);
    ODe_writeAttribute(output, "draw:z-index", str);


    ok = rAP.getProperty("position-to", pValue);

    if (pValue && !strcmp(pValue, "block-above-text")) {

        ODe_writeAttribute(output, "text:anchor-type", "paragraph");

        ok = rAP.getProperty("xpos", pValue);
        UT_ASSERT(ok && pValue != NULL);
        ODe_writeAttribute(output, "svg:x", pValue);

        ok = rAP.getProperty("ypos", pValue);
        UT_ASSERT(ok && pValue != NULL);
        ODe_writeAttribute(output, "svg:y", pValue);
    } else {
        // Everything else (column and page) will be treated as page
        // anchored.
        
        ODe_writeAttribute(output, "text:anchor-type", "page");

	if(pValue && !strcmp(pValue, "column-above-text"))
	{
	  //
	  // Get the most recent page style so we can do the arithmetic
	  // Won't work for x in multi-columned docs
	  //
	    UT_uint32 numPStyles =  m_rAutomatiStyles.getSectionStylesCount();
	    UT_UTF8String stylePName;
	    UT_UTF8String_sprintf(stylePName, "PLayout%d", numPStyles + 1);
	    ODe_Style_PageLayout * pPageL = m_rAutomatiStyles.getPageLayout(stylePName.utf8_str());

	    ok = rAP.getProperty("frame-col-xpos", pValue);
	    UT_ASSERT(ok && pValue != NULL);
	    double xCol =  UT_convertToInches(pValue);
	    const gchar* pSVal= pPageL->getPageMarginLeft();
	    double xPageL = UT_convertToInches(pSVal);
	    double xTot = xPageL + xCol;
	    pValue = UT_convertInchesToDimensionString(DIM_IN,xTot,"4");
	    ODe_writeAttribute(output, "svg:x", pValue);
        
	    ok = rAP.getProperty("frame-col-ypos", pValue);
	    UT_ASSERT(ok && pValue != NULL);
	    double yCol =  UT_convertToInches(pValue);
	    pSVal= pPageL->getPageMarginTop();
	    double yPageL = UT_convertToInches(pSVal);
	    double yTot = yPageL + yCol;
	    pValue = UT_convertInchesToDimensionString(DIM_IN,yTot,"4");
	    ODe_writeAttribute(output, "svg:y", pValue);	  
	}
	else
	{
	    ok = rAP.getProperty("frame-page-xpos", pValue);
	    UT_ASSERT(ok && pValue != NULL);
	    ODe_writeAttribute(output, "svg:x", pValue);
        
	    ok = rAP.getProperty("frame-page-ypos", pValue);
	    UT_ASSERT(ok && pValue != NULL);
	    ODe_writeAttribute(output, "svg:y", pValue);
	}
    }
    
    
    ok = rAP.getProperty("frame-width", pValue);
    if (ok && pValue != NULL) {
        ODe_writeAttribute(output, "svg:width", pValue);
    }
    
    output += ">\n";
    
    ODe_writeUTF8String(m_pTextOutput, output);
    m_spacesOffset++;
    
    ////
    // Write <draw:text-box>
    
    output.clear();
    _printSpacesOffset(output);
    output += "<draw:text-box";
    
    ok = rAP.getProperty("frame-height", pValue);
    if (ok && pValue != NULL) {
        ODe_writeAttribute(output, "fo:min-height", pValue);
    }
    
    output += ">\n";
    
    ODe_writeUTF8String(m_pTextOutput, output);
    m_spacesOffset++;
}
Ejemplo n.º 14
0
/*!
 * This method reads all the List info from the document at the curent point
 * and loads it into the dialog member variables.
 */
void AP_Dialog_Lists::fillDialogFromBlock(void)
{
	UT_GenericVector<const gchar*> va,vp;

	if (getBlock()->getPreviousList() != NULL)
	{
		m_previousListExistsAtPoint = true;
	}
	else
	{
		m_previousListExistsAtPoint = false;
	}
	getBlock()->getListAttributesVector( &va);
	getBlock()->getListPropertyVector( &vp);

//
// First get the fold level.
//
	const PP_AttrProp * pAP = NULL;
	getBlock()->getAP(pAP);
	const gchar *pszTEXTFOLDED = NULL;
	if(!pAP || !pAP->getProperty("text-folded",pszTEXTFOLDED))
	{
		m_iCurrentLevel = 0;
	}
	else
	{
		m_iCurrentLevel = atoi(pszTEXTFOLDED);
	}
	setFoldLevelInGUI();
	//
	// First do properties.
	//
	UT_sint32 i;
	if(vp.getItemCount() > 0)
	{
		i = findVecItem(&vp,"start-value");
		if(i >= 0)
		{
			m_iStartValue = atoi(vp.getNthItem(i+1));
		}
		else
		{
			m_iStartValue = 1;
		}

		i = findVecItem(&vp,"margin-left");
		if(i>=0)
		{
			m_fAlign = (float)UT_convertToInches(vp.getNthItem(i+1));
		}
		else
		{
			m_fAlign = (float)LIST_DEFAULT_INDENT;
		}

		i = findVecItem(&vp,"text-indent");
		if(i >= 0)
		{
			m_fIndent = (float)UT_convertToInches(vp.getNthItem(i+1));
		}
		else
		{
			m_fIndent = (float)-LIST_DEFAULT_INDENT_LABEL;
		}

//
// OK for list-delim it is better to use what is in fl_AutoNum first then the
// the paraprops then the defaults. The value for fl_AutoNum is what ends up in
// the users doc.
//
		i = findVecItem(&vp,"list-delim");
		if(getAutoNum())
		{
			m_pszDelim = getAutoNum()->getDelim();
		}
		else if(i >=0 )
		{
			m_pszDelim = vp.getNthItem(i+1);
		}
		else
		{
			m_pszDelim = "%L";
		}


//
// OK for list-delim it is better to use what is in fl_AutoNum first then the
// the paraprops then the defaults. The value for fl_AutoNum is what ends up in
// the users doc.
//
		i = findVecItem(&vp,"list-decimal");
		if(getAutoNum())
		{
			m_pszDecimal = getAutoNum()->getDecimal();
		}
		else if( i>= 0)
		{
			m_pszDecimal = vp.getNthItem(i+1);
		}
		else
		{
			m_pszDecimal = ".";
		}

		i = findVecItem(&vp,"field-font");
		if( i>= 0)
		{
			m_pszFont = vp.getNthItem(i+1);
		}
		else
		{
			m_pszFont = "NULL";
		}
		i = findVecItem(&vp,"list-style");
		if( i>= 0)
		{
			m_DocListType = getBlock()->getListTypeFromStyle(vp.getNthItem(i+1));
		}
		else
		{
			m_DocListType = NUMBERED_LIST;
		}
	}
	//
	// Now Do the Attributes first
	//
	if(va.getItemCount()>0)
	{
//  		i = findVecItem(&va,PT_STYLE_ATTRIBUTE_NAME);
//  		if( i>= 0)
//  		{
//  			m_DocListType = getBlock()->getListTypeFromStyle( (const gchar *) va.getNthItem(i+1));
//  		}
//  		else
//  		{
//  			m_DocListType = NUMBERED_LIST;
//  		}

		i = findVecItem(&va,"level");
		if( i>= 0)
		{
			m_iLevel = atoi(va.getNthItem(i+1));
		}
		else
		{
			m_iLevel = 1;
		}
	}
	if(getAutoNum() != NULL)
	{
		m_iID = getAutoNum()->getID();
		m_DocListType = getAutoNum()->getType();
	    m_pszDecimal = getAutoNum()->getDecimal();
	}
	else
	{
		m_iID = 0;
		m_DocListType = NOT_A_LIST;
	}
}
Ejemplo n.º 15
0
/*!
 * The vector vp contains all the properties we need to fill our dialog variables.
 * Fill our variables from this vector.
 * This is used by the Modal dialog and is filled from the styles dialog.
 */
void AP_Dialog_Lists::fillDialogFromVector( UT_GenericVector<const gchar*> * vp)
{
	UT_sint32 i;
	if(vp->getItemCount() > 0)
	{
		i = findVecItem(vp,"start-value");
		if(i >= 0)
		{
			m_iStartValue = atoi(vp->getNthItem(i+1));
		}
		else
		{
			m_iStartValue = 1;
		}

		i = findVecItem(vp,"margin-left");
		if(i>=0)
		{
			m_fAlign = (float)UT_convertToInches(vp->getNthItem(i+1));
		}
		else
		{
			m_fAlign = (float)LIST_DEFAULT_INDENT;
		}

		i = findVecItem(vp,"text-indent");
		if(i >= 0)
		{
			m_fIndent = (float)UT_convertToInches(vp->getNthItem(i+1));
		}
		else
		{
			m_fIndent = (float)-LIST_DEFAULT_INDENT_LABEL;
		}

		i = findVecItem(vp,"list-delim");
		if( i>= 0)
		{
			m_pszDelim = vp->getNthItem(i+1);
		}
		else
		{
			m_pszDelim = "%L";
		}
		i = findVecItem(vp,"list-decimal");
		if( i>= 0)
		{
			m_pszDecimal = vp->getNthItem(i+1);
		}
		else
		{
			m_pszDecimal = ".";
		}

		i = findVecItem(vp,"field-font");
		if( i>= 0)
		{
			m_pszFont = vp->getNthItem(i+1);
		}
		else
		{
			m_pszFont = "NULL";
		}
		i = findVecItem(vp,"list-style");
		if( i>= 0)
		{
			m_DocListType = getBlock()->getListTypeFromStyle(vp->getNthItem(i+1));
			m_NewListType = m_DocListType;
		}
		else
		{
			m_DocListType = NOT_A_LIST;
			m_NewListType = m_DocListType;
		}
	}
}
void AP_Dialog_Paragraph::_doSpin(tControl edit, UT_sint32 amt)
{
	UT_ASSERT_HARMLESS(amt); // zero makes no sense

	// get current value from member
	const gchar* szOld = _getSpinItemValue(edit);
	double d = UT_convertDimensionless(szOld);

	// figure out which dimension and units to spin in
	UT_Dimension dimSpin = m_dim;
	double dSpinUnit = SPIN_INCR_PT;
	double dMin = 0.0;
	bool bMin = false;

	switch (edit)
	{
	case id_SPIN_SPECIAL_INDENT:
		dMin = 0.0;
		bMin = true;
		// fall through
	case id_SPIN_LEFT_INDENT:
	case id_SPIN_RIGHT_INDENT:
		dimSpin = m_dim;
		switch (dimSpin)
		{
		case DIM_IN:	dSpinUnit = SPIN_INCR_IN;	break;
		case DIM_CM:	dSpinUnit = SPIN_INCR_CM;	break;
		case DIM_PI:	dSpinUnit = SPIN_INCR_PI;	break;
		case DIM_PT:	dSpinUnit = SPIN_INCR_PT;	break;
		default:
			UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
			break;
		}
		break;

	case id_SPIN_BEFORE_SPACING:
	case id_SPIN_AFTER_SPACING:
		dimSpin = DIM_PT;
		dSpinUnit = 6.0;
		dMin = 0.0;
		bMin = true;
		break;

	case id_SPIN_SPECIAL_SPACING:
		switch(_getMenuItemValue(id_MENU_SPECIAL_SPACING))
		{
		case spacing_SINGLE:
		case spacing_ONEANDHALF:
		case spacing_DOUBLE:
			_setMenuItemValue(id_MENU_SPECIAL_SPACING, spacing_MULTIPLE);
			// fall through
		case spacing_MULTIPLE:
			dimSpin = DIM_none;
			dSpinUnit = 0.1;
			dMin = 0.5;
			bMin = true;
			break;

		case spacing_EXACTLY:
			dMin = 1;
			// fall through
		case spacing_ATLEAST:
			dimSpin = DIM_PT;
			dSpinUnit = SPIN_INCR_PT;
			bMin = true;
			break;

		default:
			UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
			break;
		}
		break;

	default:
		UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
		break;
	}

	// figure out spin precision, too
	const char * szPrecision = ".1";
	if ((dimSpin == DIM_PT) ||
		(dimSpin == DIM_PI))
		szPrecision = ".0";



	// if needed, switch unit systems and round off
	UT_Dimension dimOld = UT_determineDimension(szOld, dimSpin);

	if (dimOld != dimSpin)
	{
		double dInches = UT_convertToInches(szOld);
		d = UT_convertInchesToDimension(dInches, dimSpin);
	}

	// value is now in desired units, so change it
	d += (dSpinUnit * amt);
	if (bMin)
	{
		// some spinners clamp at bottom of range
		if (d < dMin)
			d = dMin;
	}
	const gchar* szNew = UT_formatDimensionString(dimSpin, d, szPrecision);

	_setSpinItemValue(edit, szNew);
}
bool Text_Listener::populateStrux(PL_StruxDocHandle /*sdh*/,
									   const PX_ChangeRecord * pcr,
									   PL_StruxFmtHandle * psfh)
{
	UT_return_val_if_fail(pcr->getType() == PX_ChangeRecord::PXT_InsertStrux, false);
	const PX_ChangeRecord_Strux * pcrx = static_cast<const PX_ChangeRecord_Strux *>(pcr);
	*psfh = 0;							// we don't need it.

	switch (pcrx->getStruxType())
	{
	case PTX_SectionEndnote:
	case PTX_SectionHdrFtr:
	case PTX_Section:
		{
			_closeBlock();
			PT_AttrPropIndex api = pcr->getIndexAP();
			const PP_AttrProp * pAP = NULL;
			bool bHaveProp = m_pDocument->getAttrProp (api, &pAP);

			if (bHaveProp && pAP)
			{
				const gchar *szValue = NULL;
				if(pAP->getProperty("dom-dir", szValue))
				{
					if(!g_ascii_strcasecmp("rtl",szValue))
					{
						m_eSectionDir = DO_RTL;
					}
					else
					{
						m_eSectionDir = DO_LTR;
					}
				}
				else
				{
					m_eSectionDir = DO_UNSET;
				}
				
			}
			return true;
		}

	case PTX_Block:
		{
			_closeBlock();
			m_bInBlock = true;

			const gchar * szValue = NULL;

			PT_AttrPropIndex api = pcr->getIndexAP();
			const PP_AttrProp * pAP = NULL;
			bool bHaveProp = m_pDocument->getAttrProp (api, &pAP);

			m_bBreakExtra = false;

			if (bHaveProp && pAP)
			{
				szValue = PP_evalProperty ("margin-top", 0, pAP, 0, m_pDocument, true);
				if(szValue)
				{
					double inches = UT_convertToInches(szValue);
					if (!m_bFirstWrite && (inches > 0.01))
						m_pie->write(static_cast<const char *>(m_mbLineBreak),m_iLineBreakLen);
				}
				szValue = PP_evalProperty ("margin-bottom", 0, pAP, 0, m_pDocument, true);
				if(szValue)
				{
					double inches = UT_convertToInches(szValue);
					if (inches > 0.01)
						m_bBreakExtra = true;
				}
			}

			// in 16-bit encodings we sometimes have to issue LRM or
			// RLM to indicate the dominant direction of the block
			// (the actual insertion will be done in the subsequent
			// call to _outputData(), since most often the marker is
			// unnecessary
			if(m_bUnicode)
			{
				if (bHaveProp && pAP)
				{
					szValue = NULL;
					if(pAP->getProperty("dom-dir", szValue))
					{
						if(!g_ascii_strcasecmp("rtl",szValue))
						{
							m_eDirMarkerPending = DO_RTL;
						}
						else
						{
							m_eDirMarkerPending = DO_LTR;
						}
					}
					else if(m_eSectionDir != DO_UNSET)
					{
						m_eDirMarkerPending = m_eSectionDir;
					}
					else
					{
						m_eDirMarkerPending = m_eDocDir;
					}
				}
			}
			
			return true;
		}

		// Be nice about these until we figure out what to do with 'em
	case PTX_SectionTable:
	case PTX_SectionCell:
	case PTX_EndTable:
	case PTX_EndCell:
	case PTX_EndFrame:
	case PTX_EndMarginnote:
	case PTX_EndFootnote:
	case PTX_SectionFrame:
	case PTX_SectionMarginnote:
	case PTX_SectionFootnote:
	case PTX_EndEndnote:
	case PTX_SectionTOC:
	case PTX_EndTOC:
	case PTX_SectionAnnotation:
	case PTX_EndAnnotation:
	    return true ;

	default:
		UT_ASSERT_HARMLESS(UT_TODO);
		return true;
	}
}