GSoC progress for week #5.

Get rid of Writer-Images

  • Bug: tdf#34438 (Image-Group) - [feature request, FORMATTING] group selection does not work with raster images.

Last week I shared a blog post of my research on this bug here and this week I posted a comment about my 2-week research on the bug page of tdf#34438 here, and Regina Henschel replied with a comment here (thanks for the reply):

[…] So from my point of view we should get rid of Writer-images. But that is a long way. […] So to get rid of Writer-images it would be necessary to implement the services, which are provided by Writer-images for Draw-images too …

So, the last decision is: get rid of writer-images. Convert them into drawing objects, but also implement the writer-images’ services/attributes to drawing-images.

Prevent jump to top of the comment view / Writer-comments

In Writer, there are 3 issues about comment section:

  • comment section scrolls to top of its view when clicking inside a comment view.

  • clicking inside a comment view, scrolls the view to old cursor location automatically (if old cursor out of the visible area).

  • comment section scrolls automatically to the old selected text (if it’s out of visible area) when clicking inside the Writer canvas view.

comment-multi-selection.png

Another annoying issue: multi-selection (after a certain changes in the code)

Technical Details

  • Fix for “autoscroll to old cursor location”
void SwAnnotationWin::ActivatePostIt()
{
    /*...*/

    // prevent autoscroll to the old cursor location
    // when cursor out of visible area
    GetOutlinerView()->ShowCursor(false);

    /*...*/
}

GetOutlinerView()->ShowCursor(); has a default value true if no argument passed in. I realized that this line causes the autoscroll to the old cursor location, and setting it to false solved the issue.

  • Fix for “jumping to the top of comment view”
bool SwAnnotationWin::SetActiveSidebarWin()
{
    if (mrMgr.GetActiveSidebarWin() == this)
        return false;
    const bool bLockView = mrView.GetWrtShell().IsViewLocked();
    mrView.GetWrtShell().LockView( true );
    mrMgr.SetActiveSidebarWin(this);

    // don't understand why we set `bLockView` here?
    mrView.GetWrtShell().LockView( bLockView );
    
    return true;
}

Just remove unnecessary const bool bLockView = mrView.GetWrtShell().IsViewLocked(); line, set .LockView( bLockView ); to .LockView( true ); because we activating SetActiveSidebarWin here, it should be true and this fixes the jumping to the top of comment view issue with:

void SwAnnotationWin::UnsetActiveSidebarWin()
{
    if (mrMgr.GetActiveSidebarWin() != this)
        return;
    mrView.GetWrtShell().LockView( true );
    mrMgr.SetActiveSidebarWin(nullptr);
    mrView.GetWrtShell().LockView( false ); // set false
}
  • Fix for “scrolling automatically to the old selected text”

Steps to reproduce: (in comments section)

- select text (2-3 words for example)
- scroll selected text to unvisible area (up or down)
- click into the writer document canvas

Result: comment writing area scrolls to unvisible selected text(s) (it becomes visible)

Expected result: don’t scroll to the selected area, just make it unmarked.

void EditView::SetSelection( const ESelection& rESel )
{
    /*...*/

    pImpEditView->DrawSelectionXOR();
    pImpEditView->SetEditSelection( aNewSelection );
    pImpEditView->DrawSelectionXOR();
    bool bGotoCursor = pImpEditView->DoAutoScroll();

    ShowCursor( bGotoCursor );
}

ShowCursor( bGotoCursor ); causes the jumping when deactivating the comment canvas (when clicking into writer document canvas).

Just made it to:

    if (HasSelection())
        ShowCursor( bGotoCursor );

and it’s solved.

  • When typing, current view have to jump to typing location

After the certain changes in the code, I realized that the writer document canvas doesn’t jump to typing location. After a long process of debugging in the code base, found that comment section LockView doesn’t set to false:

void SidebarTextControl::LoseFocus()
{
    // write the visible text back into the SwField
    mrSidebarWin.UpdateData();

    WeldEditView::LoseFocus();
    if ( !mrSidebarWin.IsMouseOver() )
    {
        Invalidate();
    }

    // I just added this line here and set it to false.
    mrSidebarWin.LockView(false);
}

Before the mrSidebarWin.LockView();, I created a new method in sw/source/uibase/docvw/AnnotationWin2.cxx to have access LockView():

void SwAnnotationWin::LockView(bool bLock)
{
    mrView.GetWrtShell().LockView( bLock );
}

***

Summary of week #5

Next Week TO-DO

  • Work on tdf#51665: Support diagonal borders in TABLEs
  • Update the UI for diagonal borders