You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
1.8 KiB
C++

#include "stdafx.h"
#include "SigmaView.h"
#include "DrawBend.h"
#include "SectionDoc.h"
#include "Item.h"
#include "ItemSelect.h"
#include ".\itemdelete.h"
#include "ActionDeleteLayerItem.h"
/*
20200422
fengbowen
拷贝粘贴剪切
*/
extern "C" __declspec(dllexport)
void Copy(CSigmaView * pVIew) {
if (pVIew == NULL)
return ;
CItem* pItem = pVIew->GetItem();
if (pItem == NULL)
return ;
CItemSelect* itemSelect = dynamic_cast<CItemSelect*>(pItem);
if (itemSelect == NULL)
return ;
itemSelect->Copy();
}
extern "C" __declspec(dllexport)
bool Paste(CSigmaView * pVIew,int nPasteMode) {
if (pVIew == NULL)
return false;
pVIew->SetItem(ITEM_SELECT); //无法跨文档粘贴的原因是:被粘贴的文档,Item不是处于选择状态.导致无法调用CItemSelect的paste方法粘贴.
CItem* pItem = pVIew->GetItem();
if (pItem == NULL)
return false;
CItemSelect* itemSelect = dynamic_cast<CItemSelect*>(pItem);
if (itemSelect == NULL)
return false;
bool ret = itemSelect->Past(nPasteMode);
// 必须把选中的元素同步到 SigmaDoc 中,右键点击编辑时,需要从 SigmaDoc 中获取图元
pVIew->m_pDoc->ReplaceSelectionSet(itemSelect->m_selection);
return ret;
//itemSelect->Past(1);
}
extern "C" __declspec(dllexport)
void Cutx(CSigmaView * pVIew) {
if (pVIew == NULL)
return;
CItem* pItem = pVIew->GetItem();
if (pItem == NULL)
return;
CItemSelect* itemSelect = dynamic_cast<CItemSelect*>(pItem);
if (itemSelect == NULL)
return;
itemSelect->Copy();
//itemSelect->DeleteSelection();
itemSelect->DeleteSelection();
itemSelect->GetTracker().Clear();
}
extern "C" __declspec(dllexport)
void Sigma_Delete(CSigmaView * pVIew)
{
if (pVIew == NULL)
return;
CItem* pItem = pVIew->GetItem();
if (pItem == NULL)
return;
CItemSelect* itemSelect = dynamic_cast<CItemSelect*>(pItem);
if (itemSelect == NULL)
return;
itemSelect->DeleteSelection();
}