• Caolán McNamara's avatar
    Related: tdf#93135 adjust the ui to reflect the text fit options entanglement · 8d51397b
    Caolán McNamara yazdı
    We have two major groups of text fitting options in draw/impress
    
    ones that apply only to custom shapes
     * Word wrap text in shape
     * Resize shape to fit text
    
    those that apply to other elements, e.g. text boxes, legacy rectangles and lines
     * Fit width to text
     * Fit height to text
     * Fit to frame
     * Adjust to contour
    
    Of the second group, only "fit to frame" is always available. Text boxes
    have "Fit width to text" and "Fit height to text", while stuff like legacy
    rectangles and lines etc have "Adjust to contour" instead.
    
    A fun issue is that (currently anyway) the bit for "resize shape to
    fit text" in custom shapes and the bit for "fit height to text" in text boxes
    is the same bit, SDRATTR_TEXT_AUTOGROWHEIGHT.
    
    So before this change in all circumstances the same collection of checkboxes
    for all settings was visible. With context used to enable or disable which
    ones could be set according to the type of shape it was. Simultaneously there
    is logic to enable/disable checkboxes depending on if other checkboxes that
    control contradictionary options were checked/unchecked. e.g. "Fit to frame"
    disabled if "fit height to text" is enabled. So its not apparently why some
    can be enabled and some disabled by clicking about the place in the shared
    collection.
    
    In this commit we split the sizing options into their two families, one frame and
    column for each of "custom shapes" and "everything else". When adjusting
    a single selected object we use context to determine which column to show
    or hide. When editing multiple objects or the underlying graphic styles we show
    both columns. When editing a presentation style we show just the text box
    column. (The use of HasText in the original code is a concern, cause it doesn't
    make sense to me, using it like that means that in the original dialog
    format->text on an empty text box from F2 shows the contour option, but after
    entering text and then format->text it shows a set of different text box sizing
    options, so that's dropped here)
    
    Because (currently) the same SDRATTR_TEXT_AUTOGROWHEIGHT bit it used for two
    apparently different things then we visually toggle on all things that use that
    bit in multi-column mode when its togged on, i.e. on editing a style visually
    both "fit height to text" and "resize shape to fix text" are kept in sync when
    you toggle one or the other. We don't disable the "resize shape to fit text"
    checkbox (unlike the fit height to text checkbox which controls the same bit)
    if "fit to frame" and "adjust to contour" are set, and give it additional
    powers to unset those if clicked.
    
    This hopefully makes the ui describe the way things actually are.
    
    Because this SDRATTR_TEXT_AUTOGROWHEIGHT is currently sort of doing two purposes
    selecting a freshly drawn custom rectangle and using format->default formatting
    will cause it to change properties because the underlying
    SDRATTR_TEXT_AUTOGROWHEIGHT bit is cleared.
    
    The way things should probably be I guess is that there should be a
    SDRATTR_TEXT_AUTOGROWSIZE property (which used to exist but wasn't hooked up to
    anything) just for custom shapes which overrides the old family of options if
    set.
    
    Change-Id: I49241c90d919eeb5caa8775beab57746d5c6df04
    8d51397b
textattr.cxx 25 KB