Defines | Typedefs | Enumerations | Functions

ut_units.h File Reference

#include "ut_types.h"

Go to the source code of this file.

Defines

#define UT_PAPER_UNITS_PER_INCH   100
#define UT_LAYOUT_RESOLUTION   1440
#define UT_INT_MAX   2147483647

Typedefs

typedef enum _ut_dimension UT_Dimension

Enumerations

enum  _ut_dimension {
  DIM_IN, DIM_CM, DIM_MM, DIM_PI,
  DIM_PT, DIM_PX, DIM_PERCENT, DIM_STAR,
  DIM_none
}

Functions

ABI_EXPORT double UT_convertToInches (const char *s)
ABI_EXPORT double UT_convertDimToInches (double f, UT_Dimension dim)
ABI_EXPORT double UT_convertDimensions (double f, UT_Dimension from, UT_Dimension to)
ABI_EXPORT double UT_convertToPoints (const char *s)
ABI_EXPORT double UT_convertToDimension (const char *s, UT_Dimension dim)
ABI_EXPORT UT_sint32 UT_convertToLogicalUnits (const char *s)
ABI_EXPORT UT_sint32 UT_convertSizeToLayoutUnits (double Value, UT_Dimension dim)
ABI_EXPORT double UT_convertDimensionless (const char *sz)
ABI_EXPORT double UT_convertInchesToDimension (double inches, UT_Dimension dim)
ABI_EXPORT UT_sint32 UT_paperUnits (const char *sz)
ABI_EXPORT double UT_inchesFromPaperUnits (UT_sint32 iPaperUnits)
ABI_EXPORT UT_sint32 UT_paperUnitsFromInches (double dInches)
ABI_EXPORT const char * UT_incrementDimString (const char *dimString, double inc)
ABI_EXPORT const char * UT_multiplyDimString (const char *dimString, double mult)
ABI_EXPORT UT_Dimension UT_determineDimension (const char *sz, UT_Dimension fallback=DIM_IN)
ABI_EXPORT const char * UT_dimensionName (UT_Dimension dim)
ABI_EXPORT const char * UT_convertInchesToDimensionString (UT_Dimension, double valueInInches, const char *szPrecision=NULL)
ABI_EXPORT const char * UT_formatDimensionString (UT_Dimension, double value, const char *szPrecision=NULL)
ABI_EXPORT const char * UT_reformatDimensionString (UT_Dimension dim, const char *sz, const char *szPrecision=NULL)
ABI_EXPORT const char * UT_convertToDimensionlessString (double value, const char *szPrecision=NULL)
ABI_EXPORT const char * UT_formatDimensionedValue (double value, const char *szUnits, const char *szPrecision=NULL)
ABI_EXPORT bool UT_hasDimensionComponent (const char *sz)
ABI_EXPORT bool UT_isValidDimensionString (const char *sz, size_t max_length=0)
ABI_EXPORT UT_uint32 UT_getDimensionPrecisicion (UT_Dimension dim)
ABI_EXPORT double UT_getDimensionResolution (UT_Dimension dim)
ABI_EXPORT double UT_convertFraction (const char *sz)

Define Documentation

#define UT_INT_MAX   2147483647
#define UT_LAYOUT_RESOLUTION   1440
#define UT_PAPER_UNITS_PER_INCH   100

Typedef Documentation


Enumeration Type Documentation

Enumerator:
DIM_IN 
DIM_CM 
DIM_MM 
DIM_PI 
DIM_PT 
DIM_PX 
DIM_PERCENT 
DIM_STAR 
DIM_none 

Function Documentation

ABI_EXPORT double UT_convertDimensionless ( const char *  sz  ) 

References UT_return_val_if_fail.

Referenced by _css_length(), AP_Dialog_Tab::_doSpin(), AP_Dialog_Paragraph::_doSpin(), OXMLi_ListenerState::_EighthPointsToPoints(), OXMLi_ListenerState::_EmusToInches(), AP_Win32Dialog_Lists::_getDisplayedData(), fl_TableLayout::_lookupMarginProperties(), fl_BlockLayout::_lookupMarginProperties(), fl_CellLayout::_lookupProperties(), fl_TableLayout::_lookupProperties(), fl_DocSectionLayout::_lookupProperties(), fl_BlockLayout::_lookupProperties(), AP_Win32Dialog_Lists::_onDeltaPos(), AP_Dialog_Paragraph::_syncControls(), OXMLi_ListenerState::_TwipsToInches(), OXMLi_ListenerState::_TwipsToPoints(), IE_Exp_RTF::_write_parafmt(), IE_Exp_RTF::_write_style_fmt(), OXML_Document::applyPageProps(), IE_Exp_OpenXML::computeFontSize(), IE_Exp_OpenXML::convertToLines(), IE_Imp_XSL_FO::createImage(), IE_Imp_WML::createImage(), AP_Dialog_Styles::event_paraPreviewUpdated(), ODe_Style_Style::TableProps::fetchAttributesFromAbiProps(), AP_Dialog_Paragraph::getDialogData(), PP_PropertyTypeSize::PP_PropertyTypeSize(), s_border_properties(), s_border_properties_cell(), s_props_append(), fp_PageSize::Set(), IE_Exp_OpenXML::setColumns(), AP_Dialog_Paragraph::setDialogData(), AP_Preview_Paragraph_Block::setFormat(), OXMLi_ListenerState_Theme::startElement(), OXMLi_ListenerState_Common::startElement(), ODi_Style_PageLayout::startElement(), IE_Imp_XHTML::startElement(), UT_convertFraction(), UT_convertToDimension(), UT_convertToInches(), UT_convertToPoints(), UT_incrementDimString(), UT_multiplyDimString(), and UT_reformatDimensionString().

ABI_EXPORT double UT_convertDimensions ( double  f,
UT_Dimension  from,
UT_Dimension  to 
)
ABI_EXPORT double UT_convertDimToInches ( double  f,
UT_Dimension  dim 
)
ABI_EXPORT double UT_convertFraction ( const char *  pszFrac  ) 

Convert a percentage to a double precision fractional value

References dim, DIM_PERCENT, UT_convertDimensionless(), and UT_determineDimension().

Referenced by fl_FrameLayout::_lookupProperties().

ABI_EXPORT double UT_convertInchesToDimension ( double  inches,
UT_Dimension  dim 
)
ABI_EXPORT const char* UT_convertInchesToDimensionString ( UT_Dimension  ,
double  valueInInches,
const char *  szPrecision = NULL 
)
ABI_EXPORT UT_sint32 UT_convertSizeToLayoutUnits ( double  Value,
UT_Dimension  dim 
)
ABI_EXPORT double UT_convertToDimension ( const char *  s,
UT_Dimension  dim 
)
ABI_EXPORT const char* UT_convertToDimensionlessString ( double  value,
const char *  szPrecision = NULL 
)
ABI_EXPORT double UT_convertToInches ( const char *  s  ) 

References dim, UT_convertDimensionless(), UT_convertDimToInches(), and UT_determineDimension().

Referenced by _convertBorderThickness(), _css_length(), AP_Dialog_Tab::_doSpin(), AP_Dialog_Paragraph::_doSpin(), IE_Exp_HTML_Listener::_fillColWidthsVector(), AP_Dialog_Border_Shading::_findClosestOffset(), AP_Dialog_FormatTable::_findClosestThickness(), AP_Dialog_Border_Shading::_findClosestThickness(), s_RTF_ListenerWriteDoc::_getColumnWidthInches(), s_RTF_ListenerWriteDoc::_newRow(), s_RTF_ListenerWriteDoc::_openFrame(), ODe_Frame_Listener::_openODTextbox(), IE_Exp_HTML_Listener::_openSection(), AP_Dialog_Tab::_populateWindowData(), s_RTF_ListenerWriteDoc::_rtf_open_section(), s_RTF_ListenerWriteDoc::_writeImageInRTF(), AP_Dialog_Border_Shading::AP_Dialog_Border_Shading(), AP_Dialog_FormatTable::AP_Dialog_FormatTable(), AP_UnixDialog_FormatFrame::AP_UnixDialog_FormatFrame(), AP_Win32Dialog_FormatFrame::AP_Win32Dialog_FormatFrame(), AP_Win32Dialog_FormatTable::AP_Win32Dialog_FormatTable(), IE_Imp_RTF::ApplyParagraphAttributes(), FV_View::cmdCharDelete(), PD_Document::convertPercentToInches(), IE_Exp_OpenXML::convertToPositiveEmus(), fl_BlockLayout::doclistener_insertBlock(), AP_Dialog_Lists::fillDialogFromBlock(), AP_Dialog_Lists::fillDialogFromVector(), AP_Dialog_Columns::getMaxHeightPercent(), getPropertySize(), AP_Dialog_Columns::getSpaceAfterPercent(), XAP_Dialog_Image::incrementHeight(), AP_Dialog_Columns::incrementMaxHeight(), AP_Dialog_Columns::incrementSpaceAfter(), XAP_Dialog_Image::incrementWidth(), ODe_Text_Listener::insertPositionedImage(), Text_Listener::populateStrux(), FV_View::processSelectedBlocks(), XAP_UnixDialog_Image::runModal(), s_border_properties(), s_doFormatImageDlg(), s_getPageMargins(), FV_View::setBlockIndents(), AP_UnixDialog_FormatFrame::setBorderThicknessInGUI(), XAP_Dialog_Image::setHeight(), AP_Dialog_Columns::setMaxHeight(), AP_Dialog_Columns::setSpaceAfter(), AP_Dialog_Columns::setViewAndDoc(), XAP_Dialog_Image::setWidth(), ODi_TextContent_ListenerState::startElement(), IE_Imp_XHTML::startElement(), fl_BlockLayout::StartList(), fl_BlockLayout::StopListInBlock(), UT_convertToDimension(), UT_convertToLogicalUnits(), UT_paperUnits(), UT_reformatDimensionString(), and ie_imp_table::writeTablePropsInDoc().

ABI_EXPORT UT_sint32 UT_convertToLogicalUnits ( const char *  s  ) 
ABI_EXPORT double UT_convertToPoints ( const char *  s  ) 
ABI_EXPORT UT_Dimension UT_determineDimension ( const char *  sz,
UT_Dimension  fallback = DIM_IN 
)

References UT_ASSERT_NOT_REACHED, and UT_DEBUGMSG.

Referenced by _convertBorderThickness(), AP_Dialog_Columns::_convertToPreferredUnits(), _css_length(), AP_Dialog_Tab::_doSpin(), AP_Dialog_Paragraph::_doSpin(), ODi_Frame_ListenerState::_getFrameProperties(), ODi_Style_Style::_isValidDimensionString(), fl_CellLayout::_lookupProperties(), fl_TableLayout::_lookupProperties(), fl_DocSectionLayout::_lookupProperties(), ODi_TextContent_ListenerState::_openAbiSection(), AP_Dialog_Tab::_populateWindowData(), AP_Dialog_Options::_populateWindowData(), AP_TopRuler::_prefsListener(), AP_LeftRuler::_prefsListener(), AP_Dialog_Paragraph::_syncControls(), AP_Dialog_InsertTable::AP_Dialog_InsertTable(), AP_Dialog_Paragraph::AP_Dialog_Paragraph(), AP_LeftRuler::AP_LeftRuler(), AP_TopRuler::AP_TopRuler(), ODi_Style_Style::buildAbiPropsAttrString(), IE_Imp_XSL_FO::createImage(), Defun1(), XAP_UnixDialog_Image::doHeightEntry(), AP_UnixDialog_Columns::doMaxHeightEntry(), AP_CocoaDialog_Columns::doMaxHeightEntry, AP_UnixDialog_Columns::doSpaceAfterEntry(), AP_CocoaDialog_Columns::doSpaceAfterEntry, XAP_UnixDialog_Image::doWidthEntry(), ODe_Style_Style::TableProps::fetchAttributesFromAbiProps(), AP_Dialog_Paragraph::getDialogData(), XAP_Dialog_Image::getIncrement(), AP_Dialog_FormatTOC::getIncrement(), AP_Dialog_Columns::getIncrement(), XAP_Dialog_Image::incrementHeight(), AP_Dialog_Columns::incrementMaxHeight(), AP_Dialog_Columns::incrementSpaceAfter(), XAP_Dialog_Image::incrementWidth(), OO_StylesWriter::map(), AP_UnixDialog_Tab::onDefaultTabFocusOut(), AP_UnixDialog_Tab::onPositionFocusOut(), OO_Style::parse(), PP_PropertyTypeSize::PP_PropertyTypeSize(), AP_CocoaDialog_Columns::runModal, s_border_properties(), s_border_properties_cell(), s_doFormatImageDlg(), s_props_append(), FV_View::setBlockIndents(), XAP_Dialog_Image::setHeight(), AP_Dialog_Columns::setMaxHeight(), AP_Dialog_Columns::setSpaceAfter(), XAP_Dialog_Image::setWidth(), IE_Imp_XHTML::startElement(), UT_convertFraction(), UT_convertToDimension(), UT_convertToInches(), UT_convertToPoints(), UT_incrementDimString(), UT_multiplyDimString(), and UT_reformatDimensionString().

ABI_EXPORT const char* UT_dimensionName ( UT_Dimension  dim  ) 
ABI_EXPORT const char* UT_formatDimensionedValue ( double  value,
const char *  szUnits,
const char *  szPrecision = NULL 
)
ABI_EXPORT const char* UT_formatDimensionString ( UT_Dimension  dim,
double  value,
const char *  szPrecision 
)
ABI_EXPORT UT_uint32 UT_getDimensionPrecisicion ( UT_Dimension  dim  ) 

Returns the user visible precisition (number of decimal digits) for a certain dimension.

References DIM_CM, DIM_IN, DIM_MM, DIM_PI, DIM_PT, DIM_PX, UT_ASSERT, and UT_NOT_IMPLEMENTED.

Referenced by AP_UnixDialog_Tab::_constructWindow().

ABI_EXPORT double UT_getDimensionResolution ( UT_Dimension  dim  ) 

Returns the user visible resolution for a certain dimension.

References DIM_CM, DIM_IN, DIM_MM, DIM_PERCENT, DIM_PI, DIM_PT, DIM_PX, UT_ASSERT, and UT_NOT_IMPLEMENTED.

ABI_EXPORT bool UT_hasDimensionComponent ( const char *  sz  ) 
ABI_EXPORT double UT_inchesFromPaperUnits ( UT_sint32  iPaperUnits  ) 

Converts paper units into inches. quantity of paper units

Returns:
corresponding quantity of inches

This function uses the UT_PAPER_UNITS_PER_INCH constant to convert paper units into inches.

Paper units are a relatively low-resolution measurement (say 1/100 inch) but are suitable for specifying margins, etc. -- stuff relative to the actual paper.

See also:
UT_paperUnits
UT_paperUnitsFromInches

Referenced by AP_Dialog_Paragraph::setMaxWidth().

ABI_EXPORT const char* UT_incrementDimString ( const char *  dimString,
double  inc 
)

This method increments a dimenstioned string by the amount given.

Parameters:
const char * dimString - string to be incremented.
amount of increment.

References dim, UT_convertDimensionless(), UT_determineDimension(), and UT_formatDimensionString().

Referenced by XAP_Dialog_Image::incrementHeight(), AP_Dialog_FormatTOC::incrementIndent(), AP_Dialog_Columns::incrementMaxHeight(), AP_Dialog_Columns::incrementSpaceAfter(), and XAP_Dialog_Image::incrementWidth().

ABI_EXPORT bool UT_isValidDimensionString ( const char *  sz,
size_t  max_length = 0 
)
ABI_EXPORT const char* UT_multiplyDimString ( const char *  dimString,
double  mult 
)

This method multiplys a dimenstioned string by the amount given.

Parameters:
const char * dimString - string to be incremented.
amount to be multiplied.

References dim, UT_convertDimensionless(), UT_determineDimension(), and UT_formatDimensionString().

ABI_EXPORT UT_sint32 UT_paperUnits ( const char *  sz  ) 

References UT_convertToInches().

ABI_EXPORT UT_sint32 UT_paperUnitsFromInches ( double  dInches  ) 

Converts inches into paper units. quantity of inches

Returns:
corresponding quantity of paper units

This function uses the UT_PAPER_UNITS_PER_INCH constant to convert paper units into inches. Unlike UT_paperUnits, this function does not require a string as input.

Paper units are a relatively low-resolution measurement (say 1/100 inch) but are suitable for specifying margins, etc. -- stuff relative to the actual paper.

See also:
UT_paperUnits
UT_paperUnitsFromInches
ABI_EXPORT const char* UT_reformatDimensionString ( UT_Dimension  dim,
const char *  sz,
const char *  szPrecision = NULL 
)