tdf#101072 mpParent isn't SdNavigatorWin
Change-Id: Ibfb60302ce14f0a3492bf4d9311fb5e598f25719
Reviewed-on: https://gerrit.libreoffice.org/63567
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index bf0169a1..6e573c8 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -96,7 +96,7 @@
// set focus to listbox, otherwise it is in the toolbox which is only useful
// for keyboard navigation
maTlbObjects->GrabFocus();
maTlbObjects->SetSdNavigatorWinFlag(true);
maTlbObjects->SetSdNavigator(this);
// DragTypeListBox
maLbDocs->SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) );
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index c2e3ce5..5f462ef 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -194,8 +194,6 @@
SdPageObjsTLB::SdPageObjsTLB( vcl::Window* pParentWin, WinBits nStyle )
: SvTreeListBox ( pParentWin, nStyle )
, bisInSdNavigatorWin ( false )
, mpParent ( pParentWin )
, mpDoc ( nullptr )
, mpBookmarkDoc ( nullptr )
, mpMedium ( nullptr )
@@ -226,6 +224,11 @@
m_pAccel = ::svt::AcceleratorExecute::createAcceleratorHelper();
}
void SdPageObjsTLB::SetSdNavigator(SdNavigatorWin* pNavigator)
{
mpNavigator = pNavigator;
}
void SdPageObjsTLB::SetViewFrame( SfxViewFrame* pViewFrame )
{
mpFrame = pViewFrame;
@@ -247,7 +250,7 @@
else
// no document was created from mpMedium, so this object is still the owner of it
delete mpMedium;
mpParent.clear();
mpNavigator.clear();
mpDropNavWin.clear();
m_pAccel.reset();
SvTreeListBox::dispose();
@@ -947,7 +950,7 @@
}
else if (rKEvt.GetKeyCode().GetCode() == KEY_SPACE)
{
if(bisInSdNavigatorWin)
if (mpNavigator)
{
SvTreeListEntry* pNewEntry = GetCurEntry();
if (!pNewEntry)
@@ -988,7 +991,7 @@
if (pEntry != nullptr
&& pNavWin !=nullptr
&& pNavWin == mpParent
&& pNavWin == mpNavigator
&& pNavWin->GetNavigatorDragType() != NAVIGATOR_DRAGTYPE_NONE )
{
// Mark only the children of the page under the mouse as drop
@@ -1189,13 +1192,13 @@
pNavWin = pWnd ? static_cast<SdNavigatorWin*>(pWnd->GetContextWindow(SD_MOD())) : nullptr;
}
if( pNavWin && ( pNavWin == mpParent ) )
if( pNavWin && ( pNavWin == mpNavigator ) )
{
TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
OUString aFile;
if( aDataHelper.GetString( SotClipboardFormatId::SIMPLE_FILE, aFile ) &&
static_cast<SdNavigatorWin*>(mpParent.get())->InsertFile( aFile ) )
mpNavigator->InsertFile( aFile ) )
{
nRet = rEvt.mnAction;
}
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
index 20e0a41..5636a02 100644
--- a/sd/source/ui/inc/sdtreelb.hxx
+++ b/sd/source/ui/inc/sdtreelb.hxx
@@ -58,9 +58,6 @@
{
static bool SAL_DLLPRIVATE bIsInDrag; ///< static, in the case the navigator is deleted in ExecuteDrag
// set contenttree in SdNavigatorWin
bool bisInSdNavigatorWin;
::std::unique_ptr< ::svt::AcceleratorExecute> m_pAccel;
public:
@@ -119,7 +116,7 @@
private:
VclPtr<vcl::Window> mpParent;
VclPtr<SdNavigatorWin> mpNavigator;
const SdDrawDocument* mpDoc;
SdDrawDocument* mpBookmarkDoc;
SfxMedium* mpMedium;
@@ -210,7 +207,7 @@
OUString GetSelectedEntry();
//Mark Current Entry
void SetSdNavigatorWinFlag(bool isInSdNavigatorWin){bisInSdNavigatorWin =isInSdNavigatorWin;};
void SetSdNavigator(SdNavigatorWin* pNavigator);
void Clear();
void SetSaveTreeItemStateFlag(bool bState){mbSaveTreeItemState = bState;}