diff options
author | Jim Raykowski <raykowj@gmail.com> | 2023-12-28 15:13:52 -0900 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2024-01-28 21:46:57 +0100 |
commit | 95d1e7f0873a2bbb9ab4b0aa171fec29d36c3f55 (patch) | |
tree | dfb659866e46a62e3a43f526511ab210d6733660 /sw/source/uibase/utlui | |
parent | 8dc4a2e40b1afe26b6ae4649628eb8aa064e8823 (diff) |
tdf#36310 Insert cross reference from Navigator by DnD
This enhancement provides the ability to insert cross-references by
drag and drop from the Navigator. It replaces the 'drag mode' way of
inserting a hyperlink, section link, and section copy with a popup
menu on drop that shows insert-as kinds available for the dragged
content type.
There is an oddity with X11 that on drop the mouse pointer does not
change from a drag pointer to a menu item select pointer for
approximately 5 seconds and during that time the popup menu items
can't be selected.
Change-Id: Id72cbdbd81106fc0e70784fcba7f1dd3a43ad81e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161575
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source/uibase/utlui')
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 254 | ||||
-rw-r--r-- | sw/source/uibase/utlui/navicfg.cxx | 42 | ||||
-rw-r--r-- | sw/source/uibase/utlui/navipi.cxx | 61 |
3 files changed, 163 insertions, 194 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 86e94f754841..2c5cb7f406eb 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -123,6 +123,8 @@ #include <svl/fstathelper.hxx> +#include <expfld.hxx> + #define CTYPE_CNT 0 #define CTYPE_CTT 1 @@ -1058,22 +1060,18 @@ namespace { enum STR_CONTEXT_IDX { IDX_STR_OUTLINE_LEVEL = 0, - IDX_STR_DRAGMODE = 1, - IDX_STR_HYPERLINK = 2, - IDX_STR_LINK_REGION = 3, - IDX_STR_COPY_REGION = 4, - IDX_STR_DISPLAY = 5, - IDX_STR_ACTIVE_VIEW = 6, - IDX_STR_HIDDEN = 7, - IDX_STR_ACTIVE = 8, - IDX_STR_INACTIVE = 9, - IDX_STR_EDIT_ENTRY = 10, - IDX_STR_DELETE_ENTRY = 11, - IDX_STR_SEND_OUTLINE_TO_CLIPBOARD_ENTRY = 12, - IDX_STR_OUTLINE_TRACKING = 13, - IDX_STR_OUTLINE_TRACKING_DEFAULT = 14, - IDX_STR_OUTLINE_TRACKING_FOCUS = 15, - IDX_STR_OUTLINE_TRACKING_OFF = 16 + IDX_STR_DISPLAY = 1, + IDX_STR_ACTIVE_VIEW = 2, + IDX_STR_HIDDEN = 3, + IDX_STR_ACTIVE = 4, + IDX_STR_INACTIVE = 5, + IDX_STR_EDIT_ENTRY = 6, + IDX_STR_DELETE_ENTRY = 7, + IDX_STR_SEND_OUTLINE_TO_CLIPBOARD_ENTRY = 8, + IDX_STR_OUTLINE_TRACKING = 9, + IDX_STR_OUTLINE_TRACKING_DEFAULT = 10, + IDX_STR_OUTLINE_TRACKING_FOCUS = 11, + IDX_STR_OUTLINE_TRACKING_OFF = 12 }; } @@ -1081,10 +1079,6 @@ enum STR_CONTEXT_IDX const TranslateId STR_CONTEXT_ARY[] = { STR_OUTLINE_LEVEL, - STR_DRAGMODE, - STR_HYPERLINK, - STR_LINK_REGION, - STR_COPY_REGION, STR_DISPLAY, STR_ACTIVE_VIEW, STR_HIDDEN, @@ -1238,12 +1232,6 @@ IMPL_LINK(SwContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool) return true; // disallow } - rtl::Reference<TransferDataContainer> xContainer = new TransferDataContainer; - sal_Int8 nDragMode = DND_ACTION_COPYMOVE | DND_ACTION_LINK; - - if (FillTransferData(*xContainer, nDragMode)) - bDisallow = false; - if (m_bIsRoot && m_nRootType == ContentTypeId::OUTLINE) { // Only move drag entry and continuous selected siblings: @@ -1267,11 +1255,16 @@ IMPL_LINK(SwContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool) m_aDndOutlinesSelected.push_back(m_xTreeView->make_iterator(xEntry.get())); } while (m_xTreeView->iter_next_sibling(*xEntry) && m_xTreeView->is_selected(*xEntry)); + } + + rtl::Reference<TransferDataContainer> xContainer = new TransferDataContainer; + + if (FillTransferData(*xContainer)) + { bDisallow = false; + m_xTreeView->enable_drag_source(xContainer, DND_ACTION_COPY); } - if (!bDisallow) - m_xTreeView->enable_drag_source(xContainer, nDragMode); return bDisallow; } @@ -1638,15 +1631,6 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) } xSubPop1->set_active(OUString::number(100 + m_nOutlineLevel), true); - // Add entries to the Drag Mode submenu - for (int i=0; i < 3; ++i) - { - sId = OUString::number(i + 201); - xSubPop2->append_radio(sId, m_aContextStrings[IDX_STR_HYPERLINK + i]); - xSubPop2->set_item_help_id(sId, HID_NAV_DRAG_MODE); - } - xSubPop2->set_active(OUString::number(201 + static_cast<int>(GetParentWindow()->GetRegionDropMode())), true); - // Insert the list of the open files in the Display submenu { sal_uInt16 nId = 301; @@ -3033,10 +3017,8 @@ void SwContentTree::clear() m_xTreeView->thaw(); } -bool SwContentTree::FillTransferData( TransferDataContainer& rTransfer, - sal_Int8& rDragMode ) +bool SwContentTree::FillTransferData(TransferDataContainer& rTransfer) { - bool bRet = false; SwWrtShell* pWrtShell = GetWrtShell(); OSL_ENSURE(pWrtShell, "no Shell!"); @@ -3044,15 +3026,18 @@ bool SwContentTree::FillTransferData( TransferDataContainer& rTransfer, bool bEntry = m_xTreeView->get_cursor(xEntry.get()); if (!bEntry || lcl_IsContentType(*xEntry, *m_xTreeView) || !pWrtShell) return false; - OUString sEntry; assert(dynamic_cast<SwContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry)))); SwContent* pCnt = weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry)); - const ContentTypeId nActType = pCnt->GetParent()->GetType(); + OUString sEntry; OUString sUrl; - bool bOutline = false; + OUString sCrossRef; + bool bUrl = true; + bool bCrossRef = true; OUString sOutlineText; - switch( nActType ) + + const ContentTypeId eActType = pCnt->GetParent()->GetType(); + switch (eActType) { case ContentTypeId::OUTLINE: { @@ -3081,62 +3066,67 @@ bool SwContentTree::FillTransferData( TransferDataContainer& rTransfer, sEntry += pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(nPos, pWrtShell->GetLayout(), false); sOutlineText = pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(nPos, pWrtShell->GetLayout()); m_bIsOutlineMoveable = static_cast<SwOutlineContent*>(pCnt)->IsMoveable(); - bOutline = true; } } break; + case ContentTypeId::BOOKMARK: + sEntry = m_xTreeView->get_text(*xEntry); + break; + case ContentTypeId::TABLE: + case ContentTypeId::FRAME: + case ContentTypeId::REGION: + bCrossRef = false; + sEntry = m_xTreeView->get_text(*xEntry); + break; + // content types that cannot be inserted, as URL, section, or reference case ContentTypeId::POSTIT: case ContentTypeId::INDEX: - case ContentTypeId::REFERENCE : + return false; + // content types than can only be inserted as a cross-reference + case ContentTypeId::REFERENCE: case ContentTypeId::TEXTFIELD: case ContentTypeId::FOOTNOTE: case ContentTypeId::ENDNOTE: - // cannot be inserted, neither as URL nor as section + bUrl = false; + sEntry = m_xTreeView->get_text(*xEntry); break; + // content types tha can only be inserted as a hyperlink case ContentTypeId::URLFIELD: sUrl = static_cast<SwURLFieldContent*>(pCnt)->GetURL(); [[fallthrough]]; case ContentTypeId::OLE: case ContentTypeId::GRAPHIC: - if(GetParentWindow()->GetRegionDropMode() != RegionMode::NONE) - break; - else - rDragMode &= ~( DND_ACTION_MOVE | DND_ACTION_LINK ); - [[fallthrough]]; - default: + case ContentTypeId::DRAWOBJECT: + bCrossRef = false; sEntry = m_xTreeView->get_text(*xEntry); + break; + default: + return false; } if(!sEntry.isEmpty()) { const SwDocShell* pDocShell = pWrtShell->GetView().GetDocShell(); - if(sUrl.isEmpty()) + if (bUrl && sUrl.isEmpty()) { if(pDocShell->HasName()) { SfxMedium* pMedium = pDocShell->GetMedium(); sUrl = pMedium->GetURLObject().GetURLNoMark(); - // only if a primarily link shall be integrated. - bRet = true; } - else if ( nActType == ContentTypeId::REGION || nActType == ContentTypeId::BOOKMARK ) - { - // For field and bookmarks a link is also allowed - // without a filename into its own document. - bRet = true; - } - else if (State::CONSTANT == m_eState && - ( !::GetActiveView() || - m_pActiveShell != ::GetActiveView()->GetWrtShellPtr())) + else if (State::CONSTANT == m_eState + && (!::GetActiveView() + || m_pActiveShell != ::GetActiveView()->GetWrtShellPtr())) { // Urls of inactive views cannot dragged without // file names, also. - bRet = false; + return false; } - else + else if (eActType != ContentTypeId::REGION && eActType != ContentTypeId::BOOKMARK) { - bRet = GetParentWindow()->GetRegionDropMode() == RegionMode::NONE; - rDragMode = DND_ACTION_MOVE; + // For sections and bookmarks a link is also allowed + // without a filename into its own document. + return false; } const OUString& rToken = pCnt->GetParent()->GetTypeToken(); @@ -3146,32 +3136,93 @@ bool SwContentTree::FillTransferData( TransferDataContainer& rTransfer, sUrl += OUStringChar(cMarkSeparator) + rToken; } } - else - bRet = true; - if( bRet ) + if (bCrossRef) { - // In Outlines of heading text must match - // the real number into the description. - if(bOutline) - sEntry = sOutlineText; + if (eActType == ContentTypeId::TEXTFIELD) + { + SwTextFieldContent* pTextFieldContent = static_cast<SwTextFieldContent*>(pCnt); + const SwFormatField* pFormatField = pTextFieldContent->GetFormatField(); + const SwField* pField = pFormatField->GetField(); + if (SwFieldTypesEnum::Sequence != pField->GetTypeId()) + return false; + + OUString sVal = pField->ExpandField(true, m_pActiveShell->GetLayout()); + sal_uInt32 nSeqNo = sVal.toUInt32(); + if (nSeqNo > 0) + { + --nSeqNo; + sVal = OUString::number(nSeqNo); + } + else + return false; + + const OUString& rsFieldTypeName = pField->GetTyp()->GetName(); + sCrossRef = OUString::number(static_cast<int>(REFERENCESUBTYPE::REF_SEQUENCEFLD)) + + u"|" + rsFieldTypeName + u"|" + sVal; + } + else if (eActType == ContentTypeId::REFERENCE) { - NaviContentBookmark aBmk( sUrl, sEntry, - GetParentWindow()->GetRegionDropMode(), - pDocShell); - aBmk.Copy( rTransfer ); + sCrossRef = OUString::number(static_cast<int>(REFERENCESUBTYPE::REF_SETREFATTR)) + + u"|" + sEntry; } + else if (eActType == ContentTypeId::BOOKMARK) + { + sCrossRef = OUString::number(static_cast<int>(REFERENCESUBTYPE::REF_BOOKMARK)) + + u"|" + sEntry; + } + else if (eActType == ContentTypeId::FOOTNOTE || eActType == ContentTypeId::ENDNOTE) + { + SeqFieldLstElem aElem(sEntry, 0); + SwSeqFieldList aArr; + size_t nIdx = 0; + OUString sVal; + + if (m_pActiveShell->GetSeqFootnoteList(aArr, eActType == ContentTypeId::ENDNOTE) + && aArr.SeekEntry(aElem, &nIdx)) + sVal = OUString::number(aArr[nIdx].nSeqNo); + else + return false; - // An INetBookmark must a be delivered to foreign DocShells - if( pDocShell->HasName() ) + REFERENCESUBTYPE eReferenceSubType = + eActType == ContentTypeId::FOOTNOTE ? REFERENCESUBTYPE::REF_FOOTNOTE : + REFERENCESUBTYPE::REF_ENDNOTE; + + sCrossRef = OUString::number(static_cast<int>(eReferenceSubType)) + u"|" + + sEntry + u"|" + sVal; + } + else if (eActType == ContentTypeId::OUTLINE) { - INetBookmark aBkmk( sUrl, sEntry ); - rTransfer.CopyINetBookmark( aBkmk ); + sEntry = sOutlineText; + const SwOutlineNodes::size_type nPos = + static_cast<SwOutlineContent*>(pCnt)->GetOutlinePos(); + const SwTextNode* pTextNode = + pWrtShell->GetNodes().GetOutLineNds()[nPos]->GetTextNode(); + sw::mark::IMark const * const pMark = + pWrtShell->getIDocumentMarkAccess()->getMarkForTextNode( + *pTextNode, IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK); + // REFERENCESUBTYPE_OUTLINE is changed to REFERENCESUBTYPE::BOOKMARK in + // SwWrtShell::NavigatorPaste. It is used to differentiate between a + // headings reference and a regular bookmark reference to show different + // options in the reference mark type popup menu. + sCrossRef = OUString::number(static_cast<int>(REFERENCESUBTYPE::REF_OUTLINE)) + + u"|" + pMark->GetName(); } } + + NaviContentBookmark aBmk(sUrl, sCrossRef, sEntry, pDocShell); + aBmk.Copy(rTransfer); + + // An INetBookmark must a be delivered to foreign DocShells + if (bUrl && pDocShell->HasName()) + { + INetBookmark aBkmk( sUrl, sEntry ); + rTransfer.CopyINetBookmark( aBkmk ); + } } - return bRet; + + return true; } void SwContentTree::ToggleToRoot() @@ -5086,11 +5137,6 @@ void SwContentTree::ExecuteContextMenuAction(const OUString& rSelectedPopupEntry if(m_nOutlineLevel != nSelectedPopupEntry ) SetOutlineLevel(static_cast<sal_Int8>(nSelectedPopupEntry)); break; - case 201: - case 202: - case 203: - GetParentWindow()->SetRegionDropMode(static_cast<RegionMode>(nSelectedPopupEntry - 201)); - break; case 401: case 402: EditEntry(*xFirst, nSelectedPopupEntry == 401 ? EditEntryMode::RMV_IDX : EditEntryMode::UPD_IDX); @@ -5932,32 +5978,26 @@ void SwContentTree::GotoContent(const SwContent* pCnt) } } -// Now even the matching text::Bookmark -NaviContentBookmark::NaviContentBookmark() - : - m_nDocSh(0), - m_nDefaultDrag( RegionMode::NONE ) +NaviContentBookmark::NaviContentBookmark() : + m_nDocSh(0) { } -NaviContentBookmark::NaviContentBookmark( OUString aUrl, - OUString aDesc, - RegionMode nDragType, - const SwDocShell* pDocSh ) : - m_aUrl(std::move( aUrl )), +NaviContentBookmark::NaviContentBookmark(OUString sURL, OUString sCrossRef, OUString aDesc, + const SwDocShell* pDocSh) : + m_sURL(std::move(sURL)), + m_sCrossRef(std::move(sCrossRef)), m_aDescription(std::move(aDesc)), - m_nDocSh(reinterpret_cast<sal_IntPtr>(pDocSh)), - m_nDefaultDrag( nDragType ) + m_nDocSh(reinterpret_cast<sal_IntPtr>(pDocSh)) { } void NaviContentBookmark::Copy( TransferDataContainer& rData ) const { rtl_TextEncoding eSysCSet = osl_getThreadTextEncoding(); - - OString sStrBuf(OUStringToOString(m_aUrl, eSysCSet) + OStringChar(NAVI_BOOKMARK_DELIM) + + OString sStrBuf(OUStringToOString(m_sURL, eSysCSet) + OStringChar(NAVI_BOOKMARK_DELIM) + + OUStringToOString(m_sCrossRef, eSysCSet) + OStringChar(NAVI_BOOKMARK_DELIM) + OUStringToOString(m_aDescription, eSysCSet) + OStringChar(NAVI_BOOKMARK_DELIM) + - OString::number(static_cast<int>(m_nDefaultDrag)) + OStringChar(NAVI_BOOKMARK_DELIM) + OString::number(m_nDocSh)); rData.CopyByteString(SotClipboardFormatId::SONLK, sStrBuf); } @@ -5969,9 +6009,9 @@ bool NaviContentBookmark::Paste( const TransferableDataHelper& rData, const OUSt if( bRet ) { sal_Int32 nPos = 0; - m_aUrl = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos ); + m_sURL = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos ); + m_sCrossRef = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos); m_aDescription = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos ); - m_nDefaultDrag= static_cast<RegionMode>( o3tl::toInt32(o3tl::getToken(sStr, 0, NAVI_BOOKMARK_DELIM, nPos )) ); m_nDocSh = o3tl::toInt32(o3tl::getToken(sStr, 0, NAVI_BOOKMARK_DELIM, nPos )); if (!rsDesc.isEmpty()) m_aDescription = rsDesc; diff --git a/sw/source/uibase/utlui/navicfg.cxx b/sw/source/uibase/utlui/navicfg.cxx index dfda8827292f..7f913946c34c 100644 --- a/sw/source/uibase/utlui/navicfg.cxx +++ b/sw/source/uibase/utlui/navicfg.cxx @@ -55,7 +55,6 @@ Sequence<OUString> SwNavigationConfig::GetPropertyNames() OUString("RootType"), OUString("SelectedPosition"), OUString("OutlineLevel"), - OUString("InsertMode"), OUString("ActiveBlock"), OUString("ShowListBox"), OUString("GlobalDocMode"), @@ -83,7 +82,6 @@ SwNavigationConfig::SwNavigationConfig() : m_nRootType(ContentTypeId::UNKNOWN), m_nSelectedPos(0), m_nOutlineLevel(MAXLEVEL), - m_nRegionMode(RegionMode::NONE), m_nActiveBlock(0), m_bIsSmall(false), m_bIsGlobalActive(true), @@ -128,26 +126,19 @@ void SwNavigationConfig::Load() } case 1: pValues[nProp] >>= m_nSelectedPos; break; case 2: pValues[nProp] >>= m_nOutlineLevel; break; - case 3: - { - sal_Int32 nTmp; - if (pValues[nProp] >>= nTmp) - m_nRegionMode = static_cast<RegionMode>(nTmp); - break; - } - case 4: pValues[nProp] >>= m_nActiveBlock; break; - case 5: m_bIsSmall = *o3tl::doAccess<bool>(pValues[nProp]); break; - case 6: m_bIsGlobalActive = *o3tl::doAccess<bool>(pValues[nProp]); break; - case 7: pValues[nProp] >>= m_nOutlineTracking; break; - case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: - case 17: case 18: case 19: case 20: case 21: + case 3: pValues[nProp] >>= m_nActiveBlock; break; + case 4: m_bIsSmall = *o3tl::doAccess<bool>(pValues[nProp]); break; + case 5: m_bIsGlobalActive = *o3tl::doAccess<bool>(pValues[nProp]); break; + case 6: pValues[nProp] >>= m_nOutlineTracking; break; + case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: + case 16: case 17: case 18: case 19: case 20: { mContentTypeTrack[mPropNameToContentTypeId[aNames[nProp]]] = *o3tl::doAccess<bool>(pValues[nProp]); break; } - case 22: m_bIsNavigateOnSelect = *o3tl::doAccess<bool>(pValues[nProp]); break; - case 23: pValues[nProp] >>= m_nSortAlphabeticallyBlock; break; + case 21: m_bIsNavigateOnSelect = *o3tl::doAccess<bool>(pValues[nProp]); break; + case 22: pValues[nProp] >>= m_nSortAlphabeticallyBlock; break; } } } @@ -170,19 +161,18 @@ void SwNavigationConfig::ImplCommit() case 0: pValues[nProp] <<= static_cast<sal_Int32>(m_nRootType); break; case 1: pValues[nProp] <<= m_nSelectedPos; break; case 2: pValues[nProp] <<= m_nOutlineLevel; break; - case 3: pValues[nProp] <<= static_cast<sal_uInt16>(m_nRegionMode); break; - case 4: pValues[nProp] <<= m_nActiveBlock; break; - case 5: pValues[nProp] <<= m_bIsSmall; break; - case 6: pValues[nProp] <<= m_bIsGlobalActive; break; - case 7: pValues[nProp] <<= m_nOutlineTracking; break; - case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: - case 17: case 18: case 19: case 20: case 21: + case 3: pValues[nProp] <<= m_nActiveBlock; break; + case 4: pValues[nProp] <<= m_bIsSmall; break; + case 5: pValues[nProp] <<= m_bIsGlobalActive; break; + case 6: pValues[nProp] <<= m_nOutlineTracking; break; + case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: + case 16: case 17: case 18: case 19: case 20: { pValues[nProp] <<= mContentTypeTrack[mPropNameToContentTypeId[aNames[nProp]]]; break; } - case 22: pValues[nProp] <<= m_bIsNavigateOnSelect; break; - case 23: pValues[nProp] <<= m_nSortAlphabeticallyBlock; break; + case 21: pValues[nProp] <<= m_bIsNavigateOnSelect; break; + case 22: pValues[nProp] <<= m_nSortAlphabeticallyBlock; break; } } PutProperties(aNames, aValues); diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index c3929875becc..dd3899039a2a 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -345,38 +345,6 @@ IMPL_LINK(SwNavigationPI, ToolBoxClickHdl, const OUString&, rCommand, void) m_xGlobalTree->TbxMenuHdl(rCommand, *m_xInsertMenu); } -IMPL_LINK(SwNavigationPI, ToolBox6DropdownClickHdl, const OUString&, rCommand, void) -{ - if (!m_xContent6ToolBox->get_menu_item_active(rCommand)) - return; - - if (rCommand != "dragmode") - return; - - switch (m_nRegionMode) - { - case RegionMode::NONE: - m_xDragModeMenu->set_active("hyperlink", true); - break; - case RegionMode::LINK: - m_xDragModeMenu->set_active("link", true); - break; - case RegionMode::EMBEDDED: - m_xDragModeMenu->set_active("copy", true); - break; - } -} - -IMPL_LINK(SwNavigationPI, DropModeMenuSelectHdl, const OUString&, rIdent, void) -{ - if (rIdent == "hyperlink") - SetRegionDropMode(RegionMode::NONE); - else if (rIdent == "link") - SetRegionDropMode(RegionMode::LINK); - else if (rIdent == "copy") - SetRegionDropMode(RegionMode::EMBEDDED); -} - IMPL_LINK(SwNavigationPI, GlobalMenuSelectHdl, const OUString&, rIdent, void) { m_xGlobalTree->ExecuteContextMenuAction(rIdent); @@ -534,7 +502,6 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, , m_xContent2Dispatch(new ToolbarUnoDispatcher(*m_xContent2ToolBox, *m_xBuilder, rxFrame)) , m_xContent3Dispatch(new ToolbarUnoDispatcher(*m_xContent3ToolBox, *m_xBuilder, rxFrame)) , m_xHeadingsMenu(m_xBuilder->weld_menu("headingsmenu")) - , m_xDragModeMenu(m_xBuilder->weld_menu("dragmodemenu")) , m_xUpdateMenu(m_xBuilder->weld_menu("updatemenu")) , m_xInsertMenu(m_xBuilder->weld_menu("insertmenu")) , m_xGlobalToolBox(m_xBuilder->weld_toolbar("global")) @@ -552,7 +519,6 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, , m_pCreateView(nullptr) , m_pConfig(SW_MOD()->GetNavigationConfig()) , m_rBindings(*_pBindings) - , m_nRegionMode(RegionMode::NONE) , m_bIsZoomedIn(false) , m_bGlobalMode(false) { @@ -628,8 +594,6 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, bool bFloatingNavigator = ParentIsFloatingWindow(m_xNavigatorDlg); - SetRegionDropMode(m_pConfig->GetRegionMode()); - m_xContentTree->ShowTree(); m_xContent6ToolBox->set_item_active("listbox", true); m_xContent6ToolBox->set_item_sensitive("listbox", bFloatingNavigator); @@ -648,9 +612,6 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xContent5ToolBox->set_item_menu("headings", m_xHeadingsMenu.get()); m_xHeadingsMenu->connect_activate(LINK(this, SwNavigationPI, HeadingsMenuSelectHdl)); m_xContent5ToolBox->connect_menu_toggled(LINK(this, SwNavigationPI, ToolBox5DropdownClickHdl)); - m_xContent6ToolBox->set_item_menu("dragmode", m_xDragModeMenu.get()); - m_xDragModeMenu->connect_activate(LINK(this, SwNavigationPI, DropModeMenuSelectHdl)); - m_xContent6ToolBox->connect_menu_toggled(LINK(this, SwNavigationPI, ToolBox6DropdownClickHdl)); m_xGlobalToolBox->set_item_menu("update", m_xUpdateMenu.get()); m_xUpdateMenu->connect_activate(LINK(this, SwNavigationPI, GlobalMenuSelectHdl)); m_xGlobalToolBox->set_item_menu("insert", m_xInsertMenu.get()); @@ -744,7 +705,6 @@ SwNavigationPI::~SwNavigationPI() m_xGlobalToolBox.reset(); m_xEdit.reset(); m_xHeadingsMenu.reset(); - m_xDragModeMenu.reset(); m_xUpdateMenu.reset(); m_xInsertMenu.reset(); m_xContent2Dispatch.reset(); @@ -1048,27 +1008,6 @@ sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt ) return nRet; } -void SwNavigationPI::SetRegionDropMode(RegionMode nNewMode) -{ - m_nRegionMode = nNewMode; - m_pConfig->SetRegionMode( m_nRegionMode ); - - OUString sImageId; - switch (nNewMode) - { - case RegionMode::NONE: - sImageId = RID_BMP_DROP_REGION; - break; - case RegionMode::LINK: - sImageId = RID_BMP_DROP_LINK; - break; - case RegionMode::EMBEDDED: - sImageId = RID_BMP_DROP_COPY; - break; - } - m_xContent6ToolBox->set_item_icon_name("dragmode", sImageId); -} - void SwNavigationPI::ToggleTree() { if (comphelper::LibreOfficeKit::isActive()) |