• Armin Le Grand's avatar
    Refactor calc non-linear ViewToDevice transform · d464d505
    Armin Le Grand yazdı
    This change solves the non-linear World-To-View trans-
    formation that calc uses due to it's screen rendering
    as good as currently possible (AFAIK).
    Calcv view  is layouted on pixel base (due to better
    homogen distances and full pixel lines between cells),
    but this leads to having a non-linear transformation
    between discrete units (pixels, view) and model coordinates
    (World). In principle, each cell has it's own (so called)
    ViewTransformation -> the position on screen depends on
    the mappings of all cells top/left from it. This is
    obvioulsly non-linear and can sometimes be seen by
    producing 'offset' errors when many cells (small and thin)
    are shown in low zoom stages.
    No better solution for this comes to mind easily. The
    extremes are - on the one hand AntiAliasing the whole
    calc edit view and accept 'unsharp/AAed' lines - on the
    other hand what we have now.
    Maybe a future solution could find a mapping that gets
    close to linear mapping for the full view. On the long
    run this state is hard to keep correct. Even with this
    extended solution the mapping of SdrObjects spawning
    mutiple cells is assumed 'linear' in that area - which
    is in reality currently not the case (!)
    Note: This is only true for the screen visualization,
    print and/or PDF export do not do that pixel-based
    layouting.
    Note2: This mechanism is general in DrawingLayer (look
    for '.*GridOffset.*'. If it is deactivated by providing
    no offsets, the result is the unchanged, linear mapping.
    
    First step: Add interfaces to get a possible GridOffset
    at ViewObjectContact. There it belongs, we have a view-
    dependent offset per object and view. Add mechanisms to
    create on-demand and reach back to the view (aka calc's
    derivation of it).
    
    Second step: Implement the on-demand creation, adapt to
    use it in ViewObjectContact::getPrimitive2DSequence, add
    stuff to reset on zoom change, disable temporarily old
    mechanism -> paint already works. Need to adapt the
    places from old mechanism where the GridOffset was used,
    but no longer the geometry creations.
    
    Third step: Isolated and disabled old mechanism (by
    already removing SetGridOffset). Marked all places that
    possibly need change with '//Z' tag. Main work now will
    be to adapt in the SdrView implementations in svx to know
    about having a SdrObject-dependent ViewTransformation
    at all (currently not known, was hard-coded at some places
    from the old code, ViewTransformation set as MapMode at
    a target OutputDevice, not member at SdrView at all...).
    
    Fourth step: Adapt the Handles and OverlayObjects to
    use an evtl. existing GridOffset. The mechanism is that
    the SdrHdl(s) can be seen as 'Model-Objects', these get
    converted to OverlayObjects in the ::CreateB2dIAObject()
    implementations, for all SdrMarkView and SdrPageView,
    so this is the place where the ObjectContact is known
    (the SdrPageWindow *is* a ObjectContact) and the view-
    dependent GridOffset can be calculated per SdrObject.
    I modified OverlayObject to be able to work with a
    set Offset that embeds the created visualization using
    this additionally.
    Handles get now correctly set and have a working HitTest
    (due to that already using the primitives). Some inter-
    action stuff already working, some will need more
    adaption. We simply have no concept for this stuff...
    Refactored to not get dependencies to SdrObject in
    ObjectContact.
    
    Fifth Step: Make HitTest work by adding the View-And-
    Object dependent GridOffset in the View when HitTest
    is triggered. This is in SdrMarkView::CheckSingleSdrObjectHit
    where pObj->GetCurrentBoundRect() is used that gets the
    view-independent form. To make HitTest work, add a possible
    GridOffset.
    Since this will be necessary more often in SdrView hierarchy,
    added a tooling method (getPossibleGridOffsetForSdrObject)
    at that level after checking that at that level will be
    reachable at all potential spots.
    Inside that method the correct ObjectContact will be identified
    and the object-specific offset requested there.
    
    Sixth Step: Adaptions and started some cleanups. Still some
    adaptions needed:
    - After creation of new object, need to relocate from
      used GridOffset setting to WorldCoordinates
    - Interactions, e.g. start with dragging handles or full
      object/points
    
    Seventh Step: React on EndCreateObj. Here, the created
    SdrObject is in model coordinates and needs to be adapted
    to evtl. GridOffset. This is 'tricky' due to calculating
    the possible offset based on new coordinates 'close'
    to the target position, but may be in the wrong cell.
    Nonetheless this is the best we can do here.
    Last (hopefully) missing are now all interaction
    viszualizations. They already work and are applied
    correctly, but wrong visualized.
    Have taken the time to unify adding OverlayObjects for
    selection visualization to OverlayManager, see
    handleNewOverlayObject. This does all needed when adding
    OverlayObjects in one place where the GridOffset can
    also be handled. It makles things more safe - not possible
    to forget one of the three steps for others.
    
    Eighth Step: Do the same unification for creating the
    OverlayGeometry, also rename methods to make usage more
    clear. We now have
      SdrHdl::insertNewlyCreatedOverlayObjectForSdrHdl
      SdrDragMethod::insertNewlyCreatedOverlayObjectForSdrDragMethod
    which can do the needed GridOffset changes centralized.
    Needed to get a ObjectContact for this at SdrDragMethod,
    so adapted ::CreateOverlayGeometry implementations
    accordingly. Missing is now the implementation in
    insertNewlyCreatedOverlayObjectForSdrDragMethod to add
    the GridOffset - if used. This has no SdrObject at this
    time, so we will need a fallback to do the same using a
    Range (Rectangle). The stuff doing this for SdrObject
    already has a fallback and is based on using the Rectangle
    from the SdrObject anyways, so this will be possible.
    
    Ninth Step: Cleanup of old stuff (no more //Z), adapted
    some usages of OverlayObject creations to use
    getViewIndependentPrimitive2DContainer instead of the
    view dependent parts so that offset applied to
    drag-overlays is correct and not already added. Adapted
    insertNewlyCreatedOverlayObjectForSdrDragMethod to use
    calculateGridOffsetForB2DRange. Use now that instead of
    SdrObject-based approach in calc - is more generic.
    Getting closer, but still not complete - there is an
    error with dragging the grepped handle somehow - the
    offset for drag is somehow wrong.
    
    Tenth Step: Corrected that offset error. Of course at
    interaction start and progress (move) the coordinates
    are in GrifOffset coordinates and need to be corrected
    to Model coordinates. Done that at ::BegDragObj and
    ::MovDragObj, works well.
    Of course there are exceptions for the crop-handles, so
    needed to add setting the correct parameters at SdrHdl
    when these got created, then all works as expected.
    
    The strategy is to *not* change the model data itself
    in any way, instead do all changes/adaptions in the
    view-only code. This has minimal impact and is needed
    due to having a 1:n relationship between model and
    views anyways.
    There are two directions: All visualizations are adapted
    to take the GridOffset into account (SdrObjects, overlay,
    handles, InteractionObjects, ...). In the other direction
    input like MousePosition is in principle in calc EditView
    in 'GridOffset'-coordinates and needs to be mapped back
    before usage.
    
    Change-Id: I2ecdd409def96a7248a26a65a22e59eb962880a0
    Reviewed-on: https://gerrit.libreoffice.org/64057
    Tested-by: Jenkins
    Reviewed-by: 's avatarArmin Le Grand <Armin.Le.Grand@cib.de>
    d464d505
Adı
Son kayıt (commit)
Son güncelleme
..
inc Loading commit data...
qa Loading commit data...
res/xml Loading commit data...
sdi Loading commit data...
source Loading commit data...
uiconfig/scalc Loading commit data...
util Loading commit data...
workben Loading commit data...
AllLangMoTarget_sc.mk Loading commit data...
CppunitTest_sc_addin_functions_test.mk Loading commit data...
CppunitTest_sc_anchor_test.mk Loading commit data...
CppunitTest_sc_annotationobj.mk Loading commit data...
CppunitTest_sc_annotationshapeobj.mk Loading commit data...
CppunitTest_sc_annotationsobj.mk Loading commit data...
CppunitTest_sc_arealinkobj.mk Loading commit data...
CppunitTest_sc_arealinksobj.mk Loading commit data...
CppunitTest_sc_array_functions_test.mk Loading commit data...
CppunitTest_sc_autoformatobj.mk Loading commit data...
CppunitTest_sc_bugfix_test.mk Loading commit data...
CppunitTest_sc_cache_test.mk Loading commit data...
CppunitTest_sc_cellcursorobj.mk Loading commit data...
CppunitTest_sc_cellformatsenumeration.mk Loading commit data...
CppunitTest_sc_cellobj.mk Loading commit data...
CppunitTest_sc_cellrangeobj.mk Loading commit data...
CppunitTest_sc_cellrangesobj.mk Loading commit data...
CppunitTest_sc_cellsenumeration.mk Loading commit data...
CppunitTest_sc_chart2dataprovider.mk Loading commit data...
CppunitTest_sc_chart_regression_test.mk Loading commit data...
CppunitTest_sc_check_data_pilot_field.mk Loading commit data...
CppunitTest_sc_check_data_pilot_table.mk Loading commit data...
CppunitTest_sc_check_xcell_ranges_query.mk Loading commit data...
CppunitTest_sc_cond_format_merge.mk Loading commit data...
CppunitTest_sc_consolidationdescriptorobj.mk Loading commit data...
CppunitTest_sc_copypaste.mk Loading commit data...
CppunitTest_sc_core.mk Loading commit data...
CppunitTest_sc_database_functions_test.mk Loading commit data...
CppunitTest_sc_databaserangeobj.mk Loading commit data...
CppunitTest_sc_databaserangesobj.mk Loading commit data...
CppunitTest_sc_datapilotfieldobj.mk Loading commit data...
CppunitTest_sc_datapilotitemobj.mk Loading commit data...
CppunitTest_sc_datapilottableobj.mk Loading commit data...
CppunitTest_sc_datapilottablesobj.mk Loading commit data...
CppunitTest_sc_dataprovider.mk Loading commit data...
CppunitTest_sc_datatransformation.mk Loading commit data...
CppunitTest_sc_datetime_functions_test.mk Loading commit data...
CppunitTest_sc_ddelinkobj.mk Loading commit data...
CppunitTest_sc_documentconfigurationobj.mk Loading commit data...
CppunitTest_sc_editfieldobj_cell.mk Loading commit data...
CppunitTest_sc_editfieldobj_header.mk Loading commit data...
CppunitTest_sc_filterdescriptorbaseobj.mk Loading commit data...
CppunitTest_sc_filters_test.mk Loading commit data...
CppunitTest_sc_financial_functions_test.mk Loading commit data...
CppunitTest_sc_functiondescriptionobj.mk Loading commit data...
CppunitTest_sc_functionlistobj.mk Loading commit data...
CppunitTest_sc_functions_test_old.mk Loading commit data...
CppunitTest_sc_headerfootercontentobj.mk Loading commit data...
CppunitTest_sc_html_export_test.mk Loading commit data...
CppunitTest_sc_importdescriptorbaseobj.mk Loading commit data...
CppunitTest_sc_indexenumeration_cellannotationsenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_cellarealinksenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_databaserangesenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_datapilotfieldsenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_datapilotitemsenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_datapilottablesenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_ddelinksenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_functiondescriptionenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_labelrangesenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_namedrangesenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_scenariosenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_sheetcellrangesenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_sheetlinksenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_spreadsheetsenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_spreadsheetviewpanesenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_subtotalfieldsenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_tableautoformatenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_tablechartsenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_tablecolumnsenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_tableconditionalentryenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_tablerowsenumeration.mk Loading commit data...
CppunitTest_sc_indexenumeration_textfieldenumeration.mk Loading commit data...
CppunitTest_sc_information_functions_test.mk Loading commit data...
CppunitTest_sc_labelrangeobj.mk Loading commit data...
CppunitTest_sc_labelrangesobj.mk Loading commit data...
CppunitTest_sc_logical_functions_test.mk Loading commit data...
CppunitTest_sc_macros_test.mk Loading commit data...
CppunitTest_sc_mark_test.mk Loading commit data...
CppunitTest_sc_mathematical_functions_test.mk Loading commit data...
CppunitTest_sc_modelobj.mk Loading commit data...
CppunitTest_sc_namedrangeobj.mk Loading commit data...
CppunitTest_sc_namedrangesobj.mk Loading commit data...
CppunitTest_sc_new_cond_format_api.mk Loading commit data...
CppunitTest_sc_opencl_test.mk Loading commit data...
CppunitTest_sc_outlineobj.mk Loading commit data...
CppunitTest_sc_parallelism.mk Loading commit data...
CppunitTest_sc_perfobj.mk Loading commit data...
CppunitTest_sc_pivottable_filters_test.mk Loading commit data...
CppunitTest_sc_range_test.mk Loading commit data...
CppunitTest_sc_rangelst_test.mk Loading commit data...
CppunitTest_sc_recentfunctionsobj.mk Loading commit data...
CppunitTest_sc_recordchanges.mk Loading commit data...
CppunitTest_sc_scenariosobj.mk Loading commit data...
CppunitTest_sc_screenshots.mk Loading commit data...
CppunitTest_sc_shapeobj.mk Loading commit data...
CppunitTest_sc_sheetlinkobj.mk Loading commit data...
CppunitTest_sc_sortdescriptorbaseobj.mk Loading commit data...
CppunitTest_sc_spreadsheet_functions_test.mk Loading commit data...
CppunitTest_sc_spreadsheetsettings.mk Loading commit data...
CppunitTest_sc_spreadsheetsettingsobj.mk Loading commit data...
CppunitTest_sc_statistical_functions_test.mk Loading commit data...
CppunitTest_sc_styleloaderobj.mk Loading commit data...
CppunitTest_sc_subsequent_export_test.mk Loading commit data...
CppunitTest_sc_subsequent_filters_test.mk Loading commit data...
CppunitTest_sc_subtotaldescriptorbaseobj.mk Loading commit data...
CppunitTest_sc_subtotalfieldobj.mk Loading commit data...
CppunitTest_sc_tableconditionalentryobj.mk Loading commit data...
CppunitTest_sc_tableconditionalformatobj.mk Loading commit data...
CppunitTest_sc_tablesheetobj.mk Loading commit data...
CppunitTest_sc_tablesheetsobj.mk Loading commit data...
CppunitTest_sc_tablevalidationobj.mk Loading commit data...
CppunitTest_sc_tabviewobj.mk Loading commit data...
CppunitTest_sc_text_functions_test.mk Loading commit data...
CppunitTest_sc_tiledrendering.mk Loading commit data...
CppunitTest_sc_ucalc.mk Loading commit data...
CppunitTest_sc_uniquecellformatsenumeration.mk Loading commit data...
CppunitTest_sc_viewpaneobj.mk Loading commit data...
IwyuFilter_sc.yaml Loading commit data...
JunitTest_sc_complex.mk Loading commit data...
JunitTest_sc_unoapi_1.mk Loading commit data...
JunitTest_sc_unoapi_2.mk Loading commit data...
JunitTest_sc_unoapi_3.mk Loading commit data...
JunitTest_sc_unoapi_4.mk Loading commit data...
JunitTest_sc_unoapi_6.mk Loading commit data...
JunitTest_sc_unoapi_7.mk Loading commit data...
Library_sc.mk Loading commit data...
Library_scd.mk Loading commit data...
Library_scfilt.mk Loading commit data...
Library_scqahelper.mk Loading commit data...
Library_scui.mk Loading commit data...
Library_vbaobj.mk Loading commit data...
Makefile Loading commit data...
Module_sc.mk Loading commit data...
Package_opencl.mk Loading commit data...
Package_res_xml.mk Loading commit data...
PythonTest_sc_python.mk Loading commit data...
README Loading commit data...
TODO.performance Loading commit data...
UIConfig_scalc.mk Loading commit data...
UITest_autofilter.mk Loading commit data...
UITest_calc_tests.mk Loading commit data...
UITest_calc_tests2.mk Loading commit data...
UITest_calc_tests3.mk Loading commit data...
UITest_calc_tests4.mk Loading commit data...
UITest_calc_tests6.mk Loading commit data...
UITest_conditional_format.mk Loading commit data...
UITest_goalSeek.mk Loading commit data...
UITest_hideShowSheet.mk Loading commit data...
UITest_hide_cols.mk Loading commit data...
UITest_inputLine.mk Loading commit data...
UITest_key_f4.mk Loading commit data...
UITest_options.mk Loading commit data...
UITest_protect.mk Loading commit data...
UITest_range_name.mk Loading commit data...
UITest_search_replace.mk Loading commit data...
UITest_signatureLine.mk Loading commit data...
UITest_solver.mk Loading commit data...
UITest_statistics.mk Loading commit data...
UITest_textCase.mk Loading commit data...
UITest_validity.mk Loading commit data...
common_unoapi_tests.mk Loading commit data...