DefaultPaperSize

From Apache OpenOffice Wiki
Revision as of 10:39, 31 July 2008 by Caolan (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Default Paper Size on Linux

In OpenOffice.org VCL has a concept of a default paper size for a printer, and most applications then have a parallel concept of a default paper size for documents.

The VCL default paper size can be seen in the UI in file->printer settings->properties->paper size The Application default paper size can be seen in the UI in e.g. writer from format->page

The VCL paper size doesn't matter greatly as its overridden by most OpenOffice.org applications, only simple applications like Math have no page style to override it.

VCL Default Paper Size

On Linux this default paper size is determined in psprint/source/printer/printerinfomanager.cxx as PrinterInfoManager::initSystemDefaultPaper the algorithm is

  • ask paperconf if it exists
    • paperconf checks $PAPERSIZE as "Letter" vs "A4", falling back to the contents of the file at $PAPERCONF, falling back to the contents of /etc/papersize, falling back to a default of "Letter"
  • otherwise check LC_PAPER and use mapping one
  • otherwise check osl_getProcessLocale and use mapping one
    • osl_getProcessLocale ends up in sal/osl/unx/nlsupport.c taking the value of LC_CTYPE

mapping one

All locales are A4 except for: en_US, en_CA, fr_CA, en

Application Default Paper Size

The default paper size is derived effectively from DefaultLocale by SvxPaperInfo::GetDefaultSvxPaper in svx/source/items/paperinf.cxx using mapping two. DefaultLocale is set during first-start from

  • getLangFromEnvironment in i18npool/source/isolang/inunx.cxx
    • LC_ALL, LC_CTYPE, LANG

mapping two

All locales are A4 except for: en_US, en_CA, fr_CA, es_MX, es_VE

GTK

For comparison gtk has gtk_paper_size_get_default which takes this from the locale as well, using mapping three.

  • LC_PAPER, LC_MESSAGES

mapping three

All locales are A4 except for: en_US, en_CA, es_PR, es_US

Summary

Mapping locales to page size is done inconsistently. In OOo we should at least have one place that does it, not two. And reconcile the locales that have Letter as an appropriate default. We should also agree that when taking a locale setting to use to look up a default paper size that we try LC_PAPER first, and then decide what we take as the next one.

paperconf own default of using Letter as a final fallback sucks as most people use A4, ideally paperconf could be convinced to use an agreed mapping from the locale in the absence of a deliberate setting

Personal tools