• Mike Kaganski's avatar
    tdf#112118: DOCX: properly import/export border distance · fb959e58
    Mike Kaganski yazdı
    https://wiki.openoffice.org/wiki/Writer/MSInteroperability/PageBorder
    discusses implementation differences between ODF model and MS formats
    wrt dealing with page margins and distances to borders.
    
    This patch corrects import from DOCX, so that the border distance and
    width doesn't add to the margin size imported from file anymore. It
    takes care to preserve size from page edge to text (the most important
    size that affects document layout). When borders go outside of range
    valid for ODF, the margin is set to keep text area intact, and the
    border is placed as close to intended position as possible.
    
    Export code now also properly handles border width. Also, an improved
    heuristic implemented to better export cases unsupported by Word, so
    that the result would look closer to ODF original. We still write
    correct sizes to OOXML, so that when reopened by LO, the borders will
    be in correct places; but as Word cannot handle sizes more than 31 pt,
    it will show borders shifted.
    
    This prevents from adding border widths and distances to page margins
    at each opening of DOCX, saving back the changed value, increasing
    the margins each time.
    
    Change-Id: Ia978ab119dd661949d6c321aea91397f28d205b0
    Reviewed-on: https://gerrit.libreoffice.org/51267Tested-by: 's avatarJenkins <ci@libreoffice.org>
    Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
    fb959e58
PageBordersHandler.hxx 2.01 KB