[Libreoffice-commits] core.git: sd/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 19 15:28:15 UTC 2018


 sd/source/ui/dlg/sdtreelb.cxx |   46 ++++++------------------------------------
 sd/source/ui/inc/sdtreelb.hxx |    2 -
 2 files changed, 7 insertions(+), 41 deletions(-)

New commits:
commit ec4769a82f8a35495c1f2dfdd79023d29c263b90
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Nov 19 13:01:10 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Nov 19 16:27:51 2018 +0100

    tdf#101072 let the sidebar navigator drag and drop too
    
    Change-Id: I748f4e753b7ae7e1229df012e6b4a42fe7e1f97c
    Reviewed-on: https://gerrit.libreoffice.org/63568
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 5f462ef08a82..f3ff7edbec0c 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -201,8 +201,6 @@ SdPageObjsTLB::SdPageObjsTLB( vcl::Window* pParentWin, WinBits nStyle )
 ,   maImgOle            ( BitmapEx(BMP_OLE) )
 ,   maImgGraphic        ( BitmapEx(BMP_GRAPHIC) )
 ,   mbLinkableSelected  ( false )
-,   mpDropNavWin        ( nullptr )
-,   mpFrame             ( nullptr )
 ,   mbSaveTreeItemState ( false )
 ,   mbShowAllShapes     ( false )
 ,   mbShowAllPages      ( false )
@@ -231,7 +229,6 @@ void SdPageObjsTLB::SetSdNavigator(SdNavigatorWin* pNavigator)
 
 void SdPageObjsTLB::SetViewFrame( SfxViewFrame* pViewFrame )
 {
-    mpFrame = pViewFrame;
     sd::ViewShellBase* pBase = sd::ViewShellBase::GetViewShellBase(pViewFrame);
     const css::uno::Reference< css::frame::XFrame > xFrame = pBase->GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface();
     m_pAccel->init(::comphelper::getProcessComponentContext(), xFrame);
@@ -251,7 +248,6 @@ void SdPageObjsTLB::dispose()
         // no document was created from mpMedium, so this object is still the owner of it
         delete mpMedium;
     mpNavigator.clear();
-    mpDropNavWin.clear();
     m_pAccel.reset();
     SvTreeListBox::dispose();
 }
@@ -980,19 +976,9 @@ void SdPageObjsTLB::MouseButtonDown(const MouseEvent& rMEvt)
  */
 void SdPageObjsTLB::StartDrag( sal_Int8, const Point& rPosPixel)
 {
-    SdNavigatorWin* pNavWin = nullptr;
     SvTreeListEntry* pEntry = GetEntry(rPosPixel);
 
-    if (mpFrame->HasChildWindow(SID_NAVIGATOR))
-    {
-        SfxChildWindow* pWnd = mpFrame->GetChildWindow(SID_NAVIGATOR);
-        pNavWin = pWnd ? static_cast<SdNavigatorWin*>(pWnd->GetContextWindow(SD_MOD())) : nullptr;
-    }
-
-    if (pEntry != nullptr
-        && pNavWin !=nullptr
-        && pNavWin == mpNavigator
-        && pNavWin->GetNavigatorDragType() != NAVIGATOR_DRAGTYPE_NONE )
+    if (pEntry && mpNavigator && mpNavigator->GetNavigatorDragType() != NAVIGATOR_DRAGTYPE_NONE)
     {
         // Mark only the children of the page under the mouse as drop
         // targets.  This prevents moving shapes from one page to another.
@@ -1033,14 +1019,11 @@ void SdPageObjsTLB::StartDrag( sal_Int8, const Point& rPosPixel)
  */
 void SdPageObjsTLB::DoDrag()
 {
-    SfxChildWindow* pWnd = mpFrame->HasChildWindow(SID_NAVIGATOR) ? mpFrame->GetChildWindow(SID_NAVIGATOR) : nullptr;
-    mpDropNavWin = pWnd ? static_cast<SdNavigatorWin*>(pWnd->GetContextWindow(SD_MOD())) : nullptr;
-
-    if( mpDropNavWin )
+    if (mpNavigator)
     {
         ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
         OUString aURL = INetURLObject( pDocShell->GetMedium()->GetPhysicalName(), INetProtocol::File ).GetMainURL( INetURLObject::DecodeMechanism::NONE );
-        NavigatorDragType   eDragType = mpDropNavWin->GetNavigatorDragType();
+        NavigatorDragType   eDragType = mpNavigator->GetNavigatorDragType();
 
         aURL += "#" + GetSelectedEntry();
 
@@ -1114,18 +1097,12 @@ void SdPageObjsTLB::DoDrag()
 
 void SdPageObjsTLB::OnDragFinished()
 {
-    if( mpFrame->HasChildWindow( SID_NAVIGATOR ) )
+    if (mpNavigator)
     {
-        SfxChildWindow* pWnd = mpFrame->GetChildWindow(SID_NAVIGATOR);
-        SdNavigatorWin* pNewNavWin = pWnd ? static_cast<SdNavigatorWin*>(pWnd->GetContextWindow(SD_MOD())) : nullptr;
-        if (mpDropNavWin == pNewNavWin)
-        {
-            MouseEvent aMEvt( mpDropNavWin->GetPointerPosPixel() );
-            SvTreeListBox::MouseButtonUp( aMEvt );
-        }
+        MouseEvent aMEvt(mpNavigator->GetPointerPosPixel());
+        SvTreeListBox::MouseButtonUp(aMEvt);
     }
 
-    mpDropNavWin = nullptr;
     bIsInDrag = false;
 }
 
@@ -1183,16 +1160,7 @@ sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt )
     {
         if( !bIsInDrag )
         {
-            SdNavigatorWin* pNavWin = nullptr;
-            sal_uInt16          nId = SID_NAVIGATOR;
-
-            if (mpFrame->HasChildWindow(nId))
-            {
-                SfxChildWindow* pWnd = mpFrame->GetChildWindow(nId);
-                pNavWin = pWnd ? static_cast<SdNavigatorWin*>(pWnd->GetContextWindow(SD_MOD())) : nullptr;
-            }
-
-            if( pNavWin && ( pNavWin == mpNavigator ) )
+            if (mpNavigator)
             {
                 TransferableDataHelper  aDataHelper( rEvt.maDropEvent.Transferable );
                 OUString                aFile;
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
index 5636a0227abd..cea96d1a839d 100644
--- a/sd/source/ui/inc/sdtreelb.hxx
+++ b/sd/source/ui/inc/sdtreelb.hxx
@@ -126,8 +126,6 @@ private:
     bool                    mbLinkableSelected;
     OUString                maDocName;
     ::sd::DrawDocShellRef   mxBookmarkDocShRef; ///< for the loading of bookmarks
-    VclPtr<SdNavigatorWin>  mpDropNavWin;
-    SfxViewFrame*           mpFrame;
     std::vector<OUString>   maTreeItem;
     bool                    mbSaveTreeItemState;
     OUString                maSelectionEntryText;


More information about the Libreoffice-commits mailing list