tdf#117063 Modify tree list double click behavior in the navigator

Change-Id: I369a7a2075aabd3574bdda39dac74e2b132f6923
Reviewed-on: https://gerrit.libreoffice.org/53074
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Heiko Tietze <tietze.heiko@gmail.com>
diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx
index 9907e43..ac58f62 100644
--- a/include/svtools/treelistbox.hxx
+++ b/include/svtools/treelistbox.hxx
@@ -647,7 +647,7 @@ public:

    void            SetSublistOpenWithReturn();      // open/close sublist with return/enter
    void            SetSublistOpenWithLeftRight();   // open/close sublist with cursor left/right
    void            SetSublistDontOpenWithDoubleClick(); // do not open/close sublist with mouse double click on entry
    void            SetSublistDontOpenWithDoubleClick( bool bDontOpen ); // set mouse double click open/close sublist behavior

    void            EnableInplaceEditing( bool bEnable );
    // Edits the Entry's first StringItem, 0 == Cursor
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 49ac834..63ddcdb 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -427,7 +427,8 @@ void SvTreeListBox::DeselectHdl()

bool SvTreeListBox::DoubleClickHdl()
{
    return !aDoubleClickHdl.IsSet() || aDoubleClickHdl.Call(this);
    aDoubleClickHdl.Call( this );
    return true;
}


@@ -1433,9 +1434,9 @@ void SvTreeListBox::SetSublistOpenWithLeftRight()
    pImpl->bSubLstOpLR = true;
}

void SvTreeListBox::SetSublistDontOpenWithDoubleClick()
void SvTreeListBox::SetSublistDontOpenWithDoubleClick(bool bDontOpen)
{
    pImpl->bSubLstOpDblClick = false;
    pImpl->bSubLstOpDblClick = !bDontOpen;
}

void SvTreeListBox::Resize()
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 4fe7191..06bb5ad 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -858,7 +858,6 @@ SwContentTree::SwContentTree(vcl::Window* pParent, SwNavigationPI* pDialog)
    , m_bViewHasChanged(false)
    , m_bIsKeySpace(false)
{
    SetSublistDontOpenWithDoubleClick();
    SetHelpId(HID_NAVIGATOR_TREELIST);

    SetNodeDefaultImages();
@@ -2705,7 +2704,15 @@ void SwContentTree::MouseButtonDown( const MouseEvent& rMEvt )
    if( !pEntry && rMEvt.IsLeft() && rMEvt.IsMod1() && (rMEvt.GetClicks() % 2) == 0)
        Control::MouseButtonDown( rMEvt );
    else
    {
        if( pEntry && (rMEvt.GetClicks() % 2) == 0)
        {
            SwContent* pCnt = static_cast<SwContent*>(pEntry->GetUserData());
            const ContentTypeId nActType = pCnt->GetParent()->GetType();
            SetSublistDontOpenWithDoubleClick( nActType == ContentTypeId::OUTLINE );
        }
        SvTreeListBox::MouseButtonDown( rMEvt );
    }
}

// Update immediately