Kaydet (Commit) ec4769a8 authored tarafından Caolán McNamara's avatar Caolán McNamara

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: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst c79653e3
...@@ -201,8 +201,6 @@ SdPageObjsTLB::SdPageObjsTLB( vcl::Window* pParentWin, WinBits nStyle ) ...@@ -201,8 +201,6 @@ SdPageObjsTLB::SdPageObjsTLB( vcl::Window* pParentWin, WinBits nStyle )
, maImgOle ( BitmapEx(BMP_OLE) ) , maImgOle ( BitmapEx(BMP_OLE) )
, maImgGraphic ( BitmapEx(BMP_GRAPHIC) ) , maImgGraphic ( BitmapEx(BMP_GRAPHIC) )
, mbLinkableSelected ( false ) , mbLinkableSelected ( false )
, mpDropNavWin ( nullptr )
, mpFrame ( nullptr )
, mbSaveTreeItemState ( false ) , mbSaveTreeItemState ( false )
, mbShowAllShapes ( false ) , mbShowAllShapes ( false )
, mbShowAllPages ( false ) , mbShowAllPages ( false )
...@@ -231,7 +229,6 @@ void SdPageObjsTLB::SetSdNavigator(SdNavigatorWin* pNavigator) ...@@ -231,7 +229,6 @@ void SdPageObjsTLB::SetSdNavigator(SdNavigatorWin* pNavigator)
void SdPageObjsTLB::SetViewFrame( SfxViewFrame* pViewFrame ) void SdPageObjsTLB::SetViewFrame( SfxViewFrame* pViewFrame )
{ {
mpFrame = pViewFrame;
sd::ViewShellBase* pBase = sd::ViewShellBase::GetViewShellBase(pViewFrame); sd::ViewShellBase* pBase = sd::ViewShellBase::GetViewShellBase(pViewFrame);
const css::uno::Reference< css::frame::XFrame > xFrame = pBase->GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(); const css::uno::Reference< css::frame::XFrame > xFrame = pBase->GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface();
m_pAccel->init(::comphelper::getProcessComponentContext(), xFrame); m_pAccel->init(::comphelper::getProcessComponentContext(), xFrame);
...@@ -251,7 +248,6 @@ void SdPageObjsTLB::dispose() ...@@ -251,7 +248,6 @@ void SdPageObjsTLB::dispose()
// no document was created from mpMedium, so this object is still the owner of it // no document was created from mpMedium, so this object is still the owner of it
delete mpMedium; delete mpMedium;
mpNavigator.clear(); mpNavigator.clear();
mpDropNavWin.clear();
m_pAccel.reset(); m_pAccel.reset();
SvTreeListBox::dispose(); SvTreeListBox::dispose();
} }
...@@ -980,19 +976,9 @@ void SdPageObjsTLB::MouseButtonDown(const MouseEvent& rMEvt) ...@@ -980,19 +976,9 @@ void SdPageObjsTLB::MouseButtonDown(const MouseEvent& rMEvt)
*/ */
void SdPageObjsTLB::StartDrag( sal_Int8, const Point& rPosPixel) void SdPageObjsTLB::StartDrag( sal_Int8, const Point& rPosPixel)
{ {
SdNavigatorWin* pNavWin = nullptr;
SvTreeListEntry* pEntry = GetEntry(rPosPixel); SvTreeListEntry* pEntry = GetEntry(rPosPixel);
if (mpFrame->HasChildWindow(SID_NAVIGATOR)) if (pEntry && mpNavigator && mpNavigator->GetNavigatorDragType() != NAVIGATOR_DRAGTYPE_NONE)
{
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 )
{ {
// Mark only the children of the page under the mouse as drop // Mark only the children of the page under the mouse as drop
// targets. This prevents moving shapes from one page to another. // targets. This prevents moving shapes from one page to another.
...@@ -1033,14 +1019,11 @@ void SdPageObjsTLB::StartDrag( sal_Int8, const Point& rPosPixel) ...@@ -1033,14 +1019,11 @@ void SdPageObjsTLB::StartDrag( sal_Int8, const Point& rPosPixel)
*/ */
void SdPageObjsTLB::DoDrag() void SdPageObjsTLB::DoDrag()
{ {
SfxChildWindow* pWnd = mpFrame->HasChildWindow(SID_NAVIGATOR) ? mpFrame->GetChildWindow(SID_NAVIGATOR) : nullptr; if (mpNavigator)
mpDropNavWin = pWnd ? static_cast<SdNavigatorWin*>(pWnd->GetContextWindow(SD_MOD())) : nullptr;
if( mpDropNavWin )
{ {
::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh(); ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
OUString aURL = INetURLObject( pDocShell->GetMedium()->GetPhysicalName(), INetProtocol::File ).GetMainURL( INetURLObject::DecodeMechanism::NONE ); OUString aURL = INetURLObject( pDocShell->GetMedium()->GetPhysicalName(), INetProtocol::File ).GetMainURL( INetURLObject::DecodeMechanism::NONE );
NavigatorDragType eDragType = mpDropNavWin->GetNavigatorDragType(); NavigatorDragType eDragType = mpNavigator->GetNavigatorDragType();
aURL += "#" + GetSelectedEntry(); aURL += "#" + GetSelectedEntry();
...@@ -1114,18 +1097,12 @@ void SdPageObjsTLB::DoDrag() ...@@ -1114,18 +1097,12 @@ void SdPageObjsTLB::DoDrag()
void SdPageObjsTLB::OnDragFinished() void SdPageObjsTLB::OnDragFinished()
{ {
if( mpFrame->HasChildWindow( SID_NAVIGATOR ) ) if (mpNavigator)
{ {
SfxChildWindow* pWnd = mpFrame->GetChildWindow(SID_NAVIGATOR); MouseEvent aMEvt(mpNavigator->GetPointerPosPixel());
SdNavigatorWin* pNewNavWin = pWnd ? static_cast<SdNavigatorWin*>(pWnd->GetContextWindow(SD_MOD())) : nullptr; SvTreeListBox::MouseButtonUp(aMEvt);
if (mpDropNavWin == pNewNavWin)
{
MouseEvent aMEvt( mpDropNavWin->GetPointerPosPixel() );
SvTreeListBox::MouseButtonUp( aMEvt );
}
} }
mpDropNavWin = nullptr;
bIsInDrag = false; bIsInDrag = false;
} }
...@@ -1183,16 +1160,7 @@ sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt ) ...@@ -1183,16 +1160,7 @@ sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt )
{ {
if( !bIsInDrag ) if( !bIsInDrag )
{ {
SdNavigatorWin* pNavWin = nullptr; if (mpNavigator)
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 ) )
{ {
TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable ); TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
OUString aFile; OUString aFile;
......
...@@ -126,8 +126,6 @@ private: ...@@ -126,8 +126,6 @@ private:
bool mbLinkableSelected; bool mbLinkableSelected;
OUString maDocName; OUString maDocName;
::sd::DrawDocShellRef mxBookmarkDocShRef; ///< for the loading of bookmarks ::sd::DrawDocShellRef mxBookmarkDocShRef; ///< for the loading of bookmarks
VclPtr<SdNavigatorWin> mpDropNavWin;
SfxViewFrame* mpFrame;
std::vector<OUString> maTreeItem; std::vector<OUString> maTreeItem;
bool mbSaveTreeItemState; bool mbSaveTreeItemState;
OUString maSelectionEntryText; OUString maSelectionEntryText;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment