44#include <com/sun/star/form/FormComponentType.hpp>
45#include <com/sun/star/sdb/CommandType.hpp>
46#include <com/sun/star/beans/PropertyAttribute.hpp>
47#include <com/sun/star/script/XEventAttacherManager.hpp>
48#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
49#include <com/sun/star/datatransfer/XTransferable.hpp>
50#include <com/sun/star/uno/XComponentContext.hpp>
53#include <svx/strings.hrc>
55#include <svx/svxids.hrc>
56#include <bitmaps.hlst>
61 #define EXPLORER_SYNC_DELAY 200
84 OSL_ENSURE( _pPage,
"collectShapeModelMapping: invalid arg!" );
92 FmFormObj* pFormObject = FmFormObj::GetFormObject( pSdrObject );
96 Reference< XInterface > xNormalizedModel( pFormObject->GetUnoControlModel(), UNO_QUERY );
99 ::std::pair< MapModelToShape::iterator, bool > aPos =
100 _rMapping.emplace( xNormalizedModel, pSdrObject );
101 DBG_ASSERT( aPos.second,
"collectShapeModelMapping: model was already existent!" );
107 : DropTargetHelper(rTreeView.get_widget().get_drop_target())
108 , m_rTreeView(rTreeView)
132 :m_xTreeView(
std::move(xTreeView))
133 ,m_aDropTargetHelper(*this)
134 ,m_aSynchronizeTimer(
"svx NavigatorTree m_aSynchronizeTimer")
136 ,m_sdiState(SDI_DIRTY)
139 ,m_nControlsSelected(0)
140 ,m_nHiddenControls(0)
141 ,m_bDragDataDirty(false)
142 ,m_bPrevSelectionMixed(false)
143 ,m_bRootSelected(false)
144 ,m_bInitialUpdate(true)
145 ,m_bKeyboardCut( false )
151 m_xTreeView->set_selection_mode(SelectionMode::Multiple);
175 DBG_ASSERT(
GetNavModel() !=
nullptr,
"NavigatorTree::~NavigatorTree : unexpected : no ExplorerModel");
198 if ((pOldShell != pFormShell) || (pOldPage != pNewPage))
221 std::unique_ptr<weld::TreeIter> xSibling(
m_xTreeView->make_iterator(xFirst.get()));
243 [
this](
const auto& rEntry) {
244 FmEntryData* pCurrent = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rEntry));
245 return !IsHiddenControl( pCurrent );
252 if ( _pHasNonHidden )
253 *_pHasNonHidden = bHasNonHidden;
260 bool bHasNonHidden =
false;
277 Reference< XInterface >* pArray = seqIFaces.getArray();
280 *pArray = weld::fromId<FmEntryData*>(
m_xTreeView->get_id(*rpEntry))->GetElement();
293 rUnsetDragIcon =
false;
301 rExchange.setDragging(
true);
308 bool bHandled =
false;
309 switch( rEvt.GetCommand() )
311 case CommandEventId::ContextMenu:
315 if (rEvt.IsMouseEvent())
317 ptWhere = rEvt.GetMousePosPixel();
318 std::unique_ptr<weld::TreeIter> xClickedOn(m_xTreeView->make_iterator());
319 if (!m_xTreeView->get_dest_row_at_pos(ptWhere, xClickedOn.get(),
false))
321 if (!m_xTreeView->is_selected(*xClickedOn))
323 m_xTreeView->unselect_all();
324 m_xTreeView->select(*xClickedOn);
325 m_xTreeView->set_cursor(*xClickedOn);
330 if (m_arrCurrentSelection.empty())
333 std::unique_ptr<weld::TreeIter> xCurrent(m_xTreeView->make_iterator());
334 if (!m_xTreeView->get_cursor(xCurrent.get()))
336 ptWhere = m_xTreeView->get_row_area(*xCurrent).Center();
340 CollectSelectionData(SDI_ALL);
343 if ( (m_arrCurrentSelection.size() > 1) && m_bRootSelected )
345 const std::unique_ptr<weld::TreeIter>& rIter = *m_arrCurrentSelection.begin();
346 m_xTreeView->set_cursor(*rIter);
347 m_xTreeView->unselect(*m_xRootEntry);
349 bool bSingleSelection = (m_arrCurrentSelection.size() == 1);
352 DBG_ASSERT( (!m_arrCurrentSelection.empty()) || m_bRootSelected,
"no entries selected" );
358 FmFormShell* pFormShell = GetNavModel()->GetFormShell();
360 if( pFormShell && pFormModel )
363 std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu(
"menu"));
364 std::unique_ptr<weld::Menu> xSubMenuNew(xBuilder->weld_menu(
"submenu"));
367 bool bShowNew = bSingleSelection && (m_nFormsSelected || m_bRootSelected);
369 xContextMenu->remove(
"new");
372 bool bShowForm = bSingleSelection && (m_nFormsSelected || m_bRootSelected);
374 xSubMenuNew->append(
"form",
SvxResId(RID_STR_FORM), RID_SVXBMP_FORM);
377 bool bShowHidden = bSingleSelection && m_nFormsSelected;
379 xSubMenuNew->append(
"hidden",
SvxResId(RID_STR_HIDDEN), RID_SVXBMP_HIDDEN);
383 xContextMenu->remove(
"delete");
386 bool bShowCut = !m_bRootSelected && implAllowExchange(
DND_ACTION_MOVE);
388 xContextMenu->remove(
"cut");
389 bool bShowCopy = !m_bRootSelected && implAllowExchange(
DND_ACTION_COPY);
391 xContextMenu->remove(
"copy");
392 if (!implAcceptPaste())
393 xContextMenu->remove(
"paste");
396 bool bShowTabOrder = bSingleSelection && m_nFormsSelected;
398 xContextMenu->remove(
"taborder");
400 bool bShowProps =
true;
403 if (pFormShell->
GetImpl()->isEnhancedForm_Lock() && !m_nControlsSelected)
406 if (pFormShell->
GetImpl()->IsPropBrwOpen_Lock())
410 if (bShowProps && !pFormShell->
GetImpl()->IsPropBrwOpen_Lock())
412 (m_nControlsSelected && !m_nFormsSelected) || (!m_nControlsSelected && m_nFormsSelected);
415 xContextMenu->remove(
"props");
418 bool bShowRename = bSingleSelection && !m_bRootSelected;
420 xContextMenu->remove(
"rename");
422 if (!m_bRootSelected)
425 xContextMenu->remove(
"designmode");
427 xContextMenu->remove(
"controlfocus");
430 std::unique_ptr<weld::Menu> xConversionMenu(xBuilder->weld_menu(
"changemenu"));
433 if (!m_bRootSelected && !m_nFormsSelected && (m_nControlsSelected == 1))
435 FmXFormShell::GetConversionMenu_Lock(*xConversionMenu);
436#if OSL_DEBUG_LEVEL > 0
437 const std::unique_ptr<weld::TreeIter>& rIter = *m_arrCurrentSelection.begin();
438 FmControlData* pCurrent = weld::fromId<FmControlData*>(m_xTreeView->get_id(*rIter));
440 "NavigatorTree::Command: inconsistency between the navigator selection, and the selection as the shell knows it!" );
443 pFormShell->
GetImpl()->checkControlConversionSlotsForCurrentSelection_Lock(*xConversionMenu);
446 xContextMenu->remove(
"change");
455 OUString sIdent = xContextMenu->popup_at_rect(m_xTreeView.get(),
tools::Rectangle(ptWhere,
::Size(1, 1)));
456 if (sIdent ==
"form")
459 OUString aUndoStr =
SvxResId(RID_STR_UNDO_CONTAINER_INSERT).replaceAll(
"#",
aStr);
464 const std::unique_ptr<weld::TreeIter>& rIter = *m_arrCurrentSelection.begin();
468 else if (sIdent ==
"hidden")
471 OUString aUndoStr =
SvxResId(RID_STR_UNDO_CONTAINER_INSERT).replaceAll(
"#",
aStr);
475 const std::unique_ptr<weld::TreeIter>& rIter = *m_arrCurrentSelection.begin();
479 else if (sIdent ==
"cut")
481 else if (sIdent ==
"copy")
483 else if (sIdent ==
"paste")
485 else if (sIdent ==
"delete")
487 else if (sIdent ==
"taborder")
490 const std::unique_ptr<weld::TreeIter>& rSelectedForm = *m_arrCurrentSelection.begin();
491 DBG_ASSERT( IsFormEntry(*rSelectedForm),
"NavigatorTree::Command: This entry must be a FormEntry." );
493 FmFormData* pFormData = weld::fromId<FmFormData*>(m_xTreeView->get_id(*rSelectedForm));
494 const Reference< XForm >& xForm( pFormData->
GetFormIface());
496 Reference< XTabControllerModel > xTabController(xForm, UNO_QUERY);
497 if( !xTabController.is() )
499 GetNavModel()->GetFormShell()->GetImpl()->ExecuteTabOrderDialog_Lock(xTabController);
501 else if (sIdent ==
"props")
502 ShowSelectionProperties(
true);
503 else if (sIdent ==
"rename")
506 const std::unique_ptr<weld::TreeIter>& rIter = *m_arrCurrentSelection.begin();
507 m_xTreeView->start_editing(*rIter);
510 else if (sIdent ==
"designmode")
515 else if (sIdent ==
"controlfocus")
520 else if (FmXFormShell::isControlConversionSlot(sIdent))
522 const std::unique_ptr<weld::TreeIter>& rIter = *m_arrCurrentSelection.begin();
523 FmControlData* pCurrent = weld::fromId<FmControlData*>(m_xTreeView->get_id(*rIter));
525 ShowSelectionProperties();
539 std::unique_ptr<weld::TreeIter> xRet;
560 FmEntryData* pEntryData = pRemovedHint->GetEntryData();
565 FmEntryData* pEntryData = pInsertedHint->GetEntryData();
566 sal_uInt32 nRelPos = pInsertedHint->GetRelPos();
567 Insert( pEntryData, nRelPos );
581 std::unique_ptr<weld::TreeIter> xEntry =
FindEntry(pNameChangedHint->GetEntryData());
582 m_xTreeView->set_text(*xEntry, pNameChangedHint->GetNewName());
592 OUString sText(
SvxResId(RID_STR_FORMS));
594 m_xTreeView->insert(
nullptr, -1, &sText,
nullptr,
nullptr,
nullptr,
604 if (pSelectHint->IsMixedSelection())
615 std::unique_ptr<weld::TreeIter> xNewEntry(
m_xTreeView->make_iterator());
621 nullptr,
nullptr,
false, xNewEntry.get());
626 nullptr,
nullptr,
false, xNewEntry.get());
638 size_t nChildCount = pChildList->
size();
639 for(
size_t i = 0;
i < nChildCount;
i++ )
654 std::unique_ptr<weld::TreeIter> xEntry =
FindEntry(pEntryData);
671 auto nExpectedSelectionCount =
m_xTreeView->count_selected_rows();
676 if (nExpectedSelectionCount !=
m_xTreeView->count_selected_rows())
686 return !pEntryData ||
dynamic_cast<const FmFormData*
>( pEntryData) !=
nullptr;
692 return dynamic_cast<const FmControlData*
>( pEntryData) !=
nullptr;
697 auto nSelectedEntries =
m_xTreeView->count_selected_rows();
698 if (nSelectedEntries != 1)
706 std::unique_ptr<weld::TreeIter> xSelected(
m_xTreeView->make_iterator());
722 if (!bHasDefControlFormat && !bHasControlPathFormat && !bHasHiddenControlsFormat)
727 if ( bHasHiddenControlsFormat )
750 "NavigatorTree::implAcceptDataTransfer: here only with source=dest!" );
756 if ( bForeignCollection )
761 DBG_ASSERT( !bHasHiddenControlsFormat,
"NavigatorTree::implAcceptDataTransfer: still hidden controls format!" );
772 if (!bHasControlPathFormat)
785 DBG_ASSERT(!rDropped.empty(),
"NavigatorTree::implAcceptDataTransfer: no entries !");
800 std::unique_ptr<weld::TreeIter> xLoop(
m_xTreeView->make_iterator(_pTargetEntry));
803 arrDropAncestors.emplace(
m_xTreeView->make_iterator(xLoop.get()));
807 for (
const auto& rCurrent : rDropped)
813 std::unique_ptr<weld::TreeIter> xCurrentParent(
m_xTreeView->make_iterator(rCurrent.get()));
817 if (
m_xTreeView->iter_compare(*_pTargetEntry, *xCurrentParent) == 0)
821 if (
m_xTreeView->iter_compare(*rCurrent, *_pTargetEntry) == 0)
825 if (bDropTargetIsComponent)
831 auto aIter = std::find_if(arrDropAncestors.begin(), arrDropAncestors.end(),
832 [
this, &rCurrent](
const auto& rElem) {
833 return m_xTreeView->iter_compare(*rElem, *rCurrent) == 0;
836 if ( aIter != arrDropAncestors.end() )
852 std::unique_ptr<weld::TreeIter> xDropTarget(
m_xTreeView->make_iterator());
854 if (!
m_xTreeView->get_dest_row_at_pos(aDropPos, xDropTarget.get(),
false))
861 std::unique_ptr<weld::TreeIter> xDrop(
m_xTreeView->make_iterator());
863 if (!
m_xTreeView->get_dest_row_at_pos(_rDropPos, xDrop.get(),
false))
884 DBG_ASSERT(!bForeignCollection || bHasHiddenControlsFormat,
"NavigatorTree::implExecuteDataTransfer: invalid format (AcceptDrop shouldn't have let this pass) !");
885 DBG_ASSERT(bForeignCollection || !
m_bDragDataDirty,
"NavigatorTree::implExecuteDataTransfer: invalid state (shell changed since last exchange resync) !");
893 DBG_ASSERT( bHasHiddenControlsFormat,
"NavigatorTree::implExecuteDataTransfer: copy allowed for hidden controls only!" );
896 "NavigatorTree::implExecuteDataTransfer: should not be here!" );
900 DBG_ASSERT(bHasHiddenControlsFormat,
"NavigatorTree::implExecuteDataTransfer: only copying of hidden controls is supported !");
907 const Sequence< Reference< XInterface > >& aControls = _rData.
hiddenControls();
908 sal_Int32
nCount = aControls.getLength();
909 const Reference< XInterface >* pControls = aControls.getConstArray();
918 OUString aUndoStr =
SvxResId(RID_STR_UNDO_CONTAINER_INSERT).replaceAll(
"#",
aStr);
927 Reference< XPropertySet > xNewPropSet( pNewControlData->
GetPropertySet() );
930 Reference< XPropertySet > xCurrent(pControls[
i], UNO_QUERY);
931#if (OSL_DEBUG_LEVEL > 0)
933 sal_Int16 nClassId = ::comphelper::getINT16(xCurrent->getPropertyValue(
FM_PROP_CLASSID));
934 OSL_ENSURE(nClassId == FormComponentType::HIDDENCONTROL,
"NavigatorTree::implExecuteDataTransfer: invalid control in drop list !");
938 Reference< XPropertySetInfo > xPropInfo( xCurrent->getPropertySetInfo());
939 const Sequence< Property> seqAllCurrentProps = xPropInfo->getProperties();
940 for (
Property const & currentProp : seqAllCurrentProps)
942 if (((currentProp.Attributes & PropertyAttribute::READONLY) == 0) && (currentProp.Name !=
FM_PROP_NAME))
945 xNewPropSet->setPropertyValue(currentProp.Name, xCurrent->getPropertyValue(currentProp.Name));
949 std::unique_ptr<weld::TreeIter> xToSelect =
FindEntry(pNewControlData);
969 bool bDropTargetIsForm =
IsFormEntry(*_pTargetEntry);
970 FmFormData* pTargetData = bDropTargetIsForm ? weld::fromId<FmFormData*>(
m_xTreeView->get_id(*_pTargetEntry)) :
nullptr;
976 DBG_ASSERT(!rDropped.empty(),
"NavigatorTree::implExecuteDataTransfer: no entries!");
980 for (
const auto& rEntry : rDropped)
981 aDropped.emplace(
m_xTreeView->make_iterator(rEntry.get()));
994 OUString strUndoDescription(
SvxResId(RID_STR_UNDO_CONTAINER_REPLACE));
995 pFormModel->
BegUndo(strUndoDescription);
1003 for ( ListBoxEntrySet::const_iterator dropped = aDropped.begin();
1004 dropped != aDropped.end();
1008 bool bFirstEntry = aDropped.begin() == dropped;
1011 const auto& rCurrent = *dropped;
1012 DBG_ASSERT(rCurrent,
"NavigatorTree::implExecuteDataTransfer: invalid entry");
1013 DBG_ASSERT(
m_xTreeView->get_iter_depth(*rCurrent) != 0,
"NavigatorTree::implExecuteDataTransfer: invalid entry");
1018 Reference< XChild > xCurrentChild = pCurrentUserData->
GetChildIFace();
1019 Reference< XIndexContainer > xContainer(xCurrentChild->getParent(), UNO_QUERY);
1022 DBG_ASSERT(pCurrentParentUserData ==
nullptr ||
dynamic_cast<const FmFormData*
>(pCurrentUserData->
GetParent()) !=
nullptr,
"NavigatorTree::implExecuteDataTransfer: invalid parent");
1025 if (pCurrentParentUserData)
1034 if ( bUndo &&
GetNavModel()->m_pPropChangeList->CanUndo())
1037 xContainer, xCurrentChild,
nIndex));
1039 else if( !
GetNavModel()->m_pPropChangeList->CanUndo() )
1045 Reference< XEventAttacherManager > xManager(xContainer, UNO_QUERY);
1046 Sequence< ScriptEventDescriptor > aEvts;
1048 if (xManager.is() &&
nIndex >= 0)
1049 aEvts = xManager->getScriptEvents(
nIndex);
1050 xContainer->removeByIndex(
nIndex);
1055 Remove(pCurrentUserData);
1059 xContainer.set(pTargetData->
GetElement(), UNO_QUERY);
1064 nIndex = xContainer->getCount();
1067 if ( bUndo &&
GetNavModel()->m_pPropChangeList->CanUndo())
1069 xContainer, xCurrentChild,
nIndex));
1075 xContainer->insertByIndex(
nIndex,
1076 Any( Reference< XFormComponent >( xCurrentChild, UNO_QUERY ) ) );
1080 xContainer->insertByIndex(
nIndex,
1081 Any( Reference< XForm >( xCurrentChild, UNO_QUERY ) ) );
1084 if (aEvts.hasElements())
1086 xManager.set(xContainer, UNO_QUERY);
1088 xManager->registerScriptEvents(
nIndex, aEvts);
1094 pCurrentUserData->
SetParent(pTargetData);
1103 std::unique_ptr<weld::TreeIter> xNew =
Insert( pCurrentUserData,
nIndex );
1104 if (bFirstEntry && xNew)
1147 std::unique_ptr<weld::TreeIter> xSelected(
m_xTreeView->make_iterator());
1160 Reference< XClipboard > xClipboard(
m_xTreeView->get_clipboard());
1161 Reference< XTransferable > xTransferable;
1162 if ( xClipboard.is() )
1163 xTransferable = xClipboard->getContents();
1189 [
this, pTypedEntry](
const auto& rElem) {
1190 return m_xTreeView->iter_compare(*rElem, *pTypedEntry) == 0;
1240 case KeyFuncType::CUT:
1244 case KeyFuncType::PASTE:
1245 if ( implAcceptPaste() )
1249 case KeyFuncType::COPY:
1263 m_bEditing = !m_xTreeView->get_id(rIter).isEmpty();
1278 Reference< XForm > xNewForm(xContext->getServiceManager()->createInstanceWithContext(
FM_SUN_COMPONENT_FORM, xContext), UNO_QUERY);
1282 Reference< XPropertySet > xPropertySet(xNewForm, UNO_QUERY);
1283 if (!xPropertySet.is())
1301 OSL_FAIL(
"NavigatorTree::NewForm : could not set essential properties!");
1314 aSelection.
insert( Reference<XInterface>( xNewForm, UNO_QUERY ) );
1315 pFormShell->
GetImpl()->setCurrentSelection_Lock(std::move(aSelection));
1322 std::unique_ptr<weld::TreeIter> xNewEntry =
FindEntry(pNewFormData);
1336 Reference<XForm> xParentForm(pParentFormData->
GetFormIface());
1340 Reference<XFormComponent> xNewComponent( xContext->getServiceManager()->createInstanceWithContext(rServiceName, xContext), UNO_QUERY);
1341 if (!xNewComponent.is())
1358 std::unique_ptr<weld::TreeIter> xNewEntry =
FindEntry( pNewFormControlData );
1365 return pNewFormControlData;
1370 const sal_uInt16 nMaxCount = 99;
1375 if(
dynamic_cast<const FmFormData*
>( pEntryData) !=
nullptr )
1376 aBaseName =
SvxResId( RID_STR_STDFORMNAME );
1377 else if(
dynamic_cast<const FmControlData*
>( pEntryData) !=
nullptr )
1378 aBaseName =
SvxResId( RID_STR_CONTROL );
1384 for( sal_Int32
i=0;
i<nMaxCount;
i++ )
1386 aNewName = aBaseName;
1389 aNewName +=
" " + OUString::number(
i);
1392 if(
GetNavModel()->FindData(aNewName, pFormParentData,
false) ==
nullptr )
1405 FmEntryData* pEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rIter));
1409 m_xEditEntry = m_xTreeView->make_iterator(&rIter);
1418 nEditEvent =
nullptr;
1419 m_xTreeView->start_editing(*m_xEditEntry);
1421 m_xEditEntry.reset();
1426 m_sdiState = SDI_DIRTY;
1428 if (IsSelectionHandlingLocked())
1431 if (m_aSynchronizeTimer.IsActive())
1432 m_aSynchronizeTimer.Stop();
1435 m_aSynchronizeTimer.Start();
1440 SynchronizeMarkList();
1445 if ( m_aControlExchange.isClipboardOwner() )
1448 if ( !doingKeyboardCut() )
1451 for (
const auto& rEntry : m_aCutEntries)
1455 m_xTreeView->set_sensitive(*rEntry,
true);
1459 m_bKeyboardCut =
false;
1474 "NavigatorTree::ShowSelectionProperties : selection meta data invalid !");
1478 bool bSetSelectionAsMarkList =
false;
1494 aSelection.
insert( Reference< XInterface >( pFormData->
GetFormIface(), UNO_QUERY ) );
1500 aSelection.
insert( Reference< XInterface >( pEntryData->
GetElement(), UNO_QUERY ) );
1511 const std::unique_ptr<weld::TreeIter>& rIter = *it;
1524 const std::unique_ptr<weld::TreeIter>& rIter = *it;
1532 bSetSelectionAsMarkList =
true;
1540 if ( bSetSelectionAsMarkList )
1543 pFormShell->
GetImpl()->setCurrentSelection_Lock(std::move(aSelection));
1545 if (pFormShell->
GetImpl()->IsPropBrwOpen_Lock() || bForce)
1557 auto nSelectedEntries =
m_xTreeView->count_selected_rows();
1558 if (bRootSelected && (nSelectedEntries > 1))
1561 if ((nSelectedEntries == 0) || bRootSelected)
1584 DBG_ASSERT( pPage,
"NavigatorTree::DeleteSelection: invalid form page!" );
1597 pFormShell->
GetImpl()->EnableTrackProperties_Lock(
false);
1601 const std::unique_ptr<weld::TreeIter>& rIter = *it;
1605 auto pFormData =
dynamic_cast<FmFormData*
>(pCurrent);
1617 if (!pFormData && !bIsHidden)
1622 if ( aModelShapes.find( pCurrent->
GetElement() ) != aModelShapes.end() )
1638 pFormShell->
GetImpl()->EnableTrackProperties_Lock(
true);
1653 aUndoStr =
SvxResId(RID_STR_UNDO_CONTAINER_REMOVE);
1655 aUndoStr = aUndoStr.replaceFirst(
"#",
SvxResId( RID_STR_FORM ) );
1658 aUndoStr = aUndoStr.replaceFirst(
"#",
SvxResId( RID_STR_CONTROL ) );
1662 aUndoStr =
SvxResId(RID_STR_UNDO_CONTAINER_REMOVE_MULTIPLE);
1665 pFormModel->
BegUndo(aUndoStr);
1681 if (
auto pFormData =
dynamic_cast<FmFormData*
>( pCurrent))
1683 Reference< XForm > xCurrentForm( pFormData->GetFormIface() );
1684 if (pFormShell->
GetImpl()->getCurrentForm_Lock() == xCurrentForm)
1685 pFormShell->
GetImpl()->forgetCurrentForm_Lock();
1695 DBG_ASSERT(sdiHow !=
SDI_DIRTY,
"NavigatorTree::CollectSelectionData : ever thought about your parameter ? DIRTY ?");
1709 if (IsFormEntry(rSelectionLoop))
1713 ++m_nControlsSelected;
1714 if (IsHiddenControl(weld::fromId<FmEntryData*>(m_xTreeView->get_id(rSelectionLoop))))
1715 ++m_nHiddenControls;
1726 std::unique_ptr<weld::TreeIter> xParentLoop(m_xTreeView->make_iterator(&rSelectionLoop));
1727 bool bParentLoop = m_xTreeView->iter_parent(*xParentLoop);
1734 if (m_xTreeView->is_selected(*xParentLoop))
1738 if (m_xTreeView->iter_compare(*xParentLoop, *m_xRootEntry) == 0)
1741 m_arrCurrentSelection.emplace(m_xTreeView->make_iterator(&rSelectionLoop));
1745 bParentLoop = m_xTreeView->iter_parent(*xParentLoop);
1750 else if (sdiHow == SDI_NORMALIZED_FORMARK)
1752 std::unique_ptr<weld::TreeIter> xParent(m_xTreeView->make_iterator(&rSelectionLoop));
1753 bool bParent = m_xTreeView->iter_parent(*xParent);
1754 if (!bParent || !m_xTreeView->is_selected(*xParent) || IsFormEntry(rSelectionLoop))
1755 m_arrCurrentSelection.emplace(m_xTreeView->make_iterator(&rSelectionLoop));
1758 m_arrCurrentSelection.emplace(m_xTreeView->make_iterator(&rSelectionLoop));
1763 m_sdiState = sdiHow;
1768 LockSelectionHandling();
1769 if (arredToSelect.empty())
1771 m_xTreeView->unselect_all();
1776 m_xTreeView->selected_foreach([
this, &arredToSelect](
weld::TreeIter& rSelection) {
1777 FmEntryData* pCurrent = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rSelection));
1778 if (pCurrent !=
nullptr)
1780 FmEntryDataArray::iterator it = arredToSelect.find(pCurrent);
1781 if ( it != arredToSelect.end() )
1784 arredToSelect.erase(it);
1787 m_xTreeView->unselect(rSelection);
1790 m_xTreeView->scroll_to_row(rSelection);
1794 m_xTreeView->unselect(rSelection);
1807 m_xTreeView->all_foreach([
this, &arredToSelect](
weld::TreeIter& rLoop){
1808 FmEntryData* pCurEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rLoop));
1809 FmEntryDataArray::iterator it = arredToSelect.find(pCurEntryData);
1810 if (it != arredToSelect.end())
1812 m_xTreeView->select(rLoop);
1813 m_xTreeView->scroll_to_row(rLoop);
1819 UnlockSelectionHandling();
1823 void NavigatorTree::SynchronizeSelection()
1826 FmFormShell* pFormShell = GetNavModel()->GetFormShell();
1827 if(!pFormShell)
return;
1830 if (!pFormView)
return;
1836 void NavigatorTree::SynchronizeMarkList()
1839 FmFormShell* pFormShell = GetNavModel()->GetFormShell();
1840 if (!pFormShell)
return;
1842 CollectSelectionData(SDI_NORMALIZED_FORMARK);
1845 pFormShell->
GetImpl()->EnableTrackProperties_Lock(
false);
1849 for (
auto& rSelectionLoop : m_arrCurrentSelection)
1852 if (IsFormEntry(*rSelectionLoop) && m_xTreeView->iter_compare(*rSelectionLoop, *m_xRootEntry) != 0)
1853 MarkViewObj(weld::fromId<FmFormData*>(m_xTreeView->get_id(*rSelectionLoop)),
false);
1856 else if (IsFormComponentEntry(*rSelectionLoop))
1858 FmControlData* pControlData = weld::fromId<FmControlData*>(m_xTreeView->get_id(*rSelectionLoop));
1863 Reference< XFormComponent > xFormComponent( pControlData->
GetFormComponent());
1864 if (!xFormComponent.is())
1866 Reference< XPropertySet > xSet(xFormComponent, UNO_QUERY);
1870 sal_uInt16 nClassId = ::comphelper::getINT16(xSet->getPropertyValue(
FM_PROP_CLASSID));
1871 if (nClassId != FormComponentType::HIDDENCONTROL)
1872 MarkViewObj(pControlData);
1880 ShowSelectionProperties();
1883 pFormShell->
GetImpl()->EnableTrackProperties_Lock(
true);
1888 if ((m_arrCurrentSelection.size() != 1) || (m_nFormsSelected != 1))
1891 std::unique_ptr<weld::TreeIter> xSelected(m_xTreeView->make_iterator());
1892 if (!m_xTreeView->get_selected(xSelected.get()))
1894 FmFormData* pSingleSelectionData = xSelected ?
dynamic_cast<FmFormData*
>(weld::fromId<FmEntryData*>(m_xTreeView->get_id(*xSelected)))
1896 DBG_ASSERT( pSingleSelectionData,
"NavigatorTree::SynchronizeMarkList: invalid selected form!" );
1897 if ( pSingleSelectionData )
1900 aSelection.
insert( Reference< XInterface >( pSingleSelectionData->
GetFormIface(), UNO_QUERY ) );
1901 pFormShell->
GetImpl()->setCurrentSelection_Lock(std::move(aSelection));
1907 if (pEntryData ==
nullptr)
return false;
1909 Reference< XPropertySet > xProperties( pEntryData->
GetPropertySet() );
1913 return (::comphelper::getINT16(
aClassID) == FormComponentType::HIDDENCONTROL);
1918 void NavigatorTree::UnmarkAllViewObj()
1920 FmFormShell* pFormShell = GetNavModel()->GetFormShell();
1927 void NavigatorTree::MarkViewObj(
FmFormData const * pFormData,
bool bDeep )
1929 FmFormShell* pFormShell = GetNavModel()->GetFormShell();
1934 ::std::set< Reference< XFormComponent > > aObjects;
1935 CollectObjects(pFormData,bDeep,aObjects);
1948 FmFormObj* pFormObject = FmFormObj::GetFormObject( pSdrObject );
1952 Reference< XFormComponent > xControlModel( pFormObject->GetUnoControlModel(),UNO_QUERY );
1953 if ( xControlModel.is() && aObjects.find(xControlModel) != aObjects.end() && !pFormView->
IsObjMarked( pSdrObject ) )
1956 pFormView->
MarkObj( pSdrObject, pPageView );
1972 void NavigatorTree::CollectObjects(
FmFormData const * pFormData,
bool bDeep, ::std::set< Reference< XFormComponent > >& _rObjects)
1975 for(
size_t i = 0;
i < pChildList->
size(); ++
i )
1978 if(
auto pControlData =
dynamic_cast<FmControlData*
>( pEntryData) )
1980 _rObjects.insert(pControlData->GetFormComponent());
1983 if (
auto pEntryFormData =
dynamic_cast<FmFormData*
>( pEntryData))
1984 CollectObjects(pEntryFormData, bDeep, _rObjects);
1992 FmFormShell* pFormShell = GetNavModel()->GetFormShell();
1999 Reference< XFormComponent > xFormComponent( pControlData->
GetFormComponent());
2003 bool bPaint =
false;
2008 FmFormObj* pFormObject = FmFormObj::GetFormObject( pSdrObject );
2012 Reference< XInterface > xControlModel( pFormObject->GetUnoControlModel() );
2013 if ( xControlModel != xFormComponent )
2019 pFormView->
MarkObj( pSdrObject, pPageView );
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
const css::uno::Reference< css::form::XFormComponent > & GetFormComponent() const
void removeNoDelete(FmEntryData *pItem)
FmEntryData * at(size_t Index)
void insert(std::unique_ptr< FmEntryData > pItem, size_t Index)
const css::uno::Reference< css::container::XChild > & GetChildIFace() const
const OUString & GetText() const
const css::uno::Reference< css::uno::XInterface > & GetElement() const
const css::uno::Reference< css::beans::XPropertySet > & GetPropertySet() const
virtual bool IsEqualWithoutChildren(FmEntryData *pEntryData)
FmEntryDataList * GetChildList() const
FmEntryData * GetParent() const
const OUString & GetNormalImage() const
void SetText(const OUString &rText)
void SetParent(FmEntryData *pParentData)
static OUString setUniqueName(const css::uno::Reference< css::form::XFormComponent > &xFormComponent, const css::uno::Reference< css::form::XForm > &xControls)
const css::uno::Reference< css::form::XForms > & GetForms(bool _bForceCreate=true) const
static void DisposeElement(const css::uno::Reference< css::uno::XInterface > &xElem)
OutDevType GetOutDevType() const
virtual vcl::Window * GetOwnerWindow() const
bool IsObjMarked(SdrObject const *pObj) const
const SdrMarkList & GetMarkedObjectList() const
void UnMarkAll(SdrPageView const *pPV=nullptr)
const tools::Rectangle & GetAllMarkedRect() const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
bool IsUndoEnabled() const
returns true if undo is currently enabled This returns false if undo was disabled using EnableUndo( f...
SdrPage * GetPage() const
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin)
sal_uInt32 PaintWindowCount() const
SdrPageView * GetSdrPageView() const
OutputDevice & GetOutputDevice() const
virtual void DeleteMarked()
void Invalidate(sal_uInt16 nId)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
SfxViewShell * GetViewShell() const
SfxBindings & GetBindings()
SfxDispatcher * GetDispatcher()
SfxViewFrame & GetViewFrame() const
void SetInvokeHandler(const Link< Timer *, void > &rLink)
static TransferableDataHelper CreateFromClipboard(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rClipboard)
const DataFlavorExVector & GetDataFlavorExVector() const
std::pair< const_iterator, bool > insert(Value &&x)
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
KeyFuncType GetFunction() const
virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter *pResult, bool bDnDMode, bool bAutoScroll=true)=0
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
OUString SvxResId(TranslateId aId)
::std::vector< DataFlavorEx > DataFlavorExVector
std::set< FmEntryData * > FmEntryDataArray
constexpr OUStringLiteral FM_PROP_CLASSID
constexpr OUStringLiteral FM_PROP_NAME
constexpr OUStringLiteral FM_PROP_COMMANDTYPE
constexpr OUStringLiteral FM_SUN_COMPONENT_FORM
constexpr OUStringLiteral FM_COMPONENT_HIDDEN
constexpr OUStringLiteral HID_FORM_NAVIGATOR
constexpr sal_uInt16 KEY_DELETE
#define LINK(Instance, Class, Member)
#define SAL_WARN_IF(condition, area, stream)
std::unique_ptr< sal_Int32[]> pData
Reference< XComponentContext > getProcessComponentContext()
OUString toId(const void *pValue)
#define EXPLORER_SYNC_DELAY
const char *const aClassID
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
#define DND_ACTION_COPYMOVE