*** old/sc/source/ui/drawfunc/fusel2.cxx Wed Jun 27 13:06:06 2007 --- new/sc/source/ui/drawfunc/fusel2.cxx Wed Jun 27 13:06:12 2007 *************** *** 53,58 **** --- 53,60 ---- #include "detfunc.hxx" #include "futext.hxx" #include "sc.hrc" + #include "attrib.hxx" + #include "scitems.hxx" // ----------------------------------------------------------------------- *************** *** 148,157 **** if ( pFoundObj ) { SdrLayer* pLockLayer = NULL; // Leave the internal note object unlocked - re-lock in ScDrawView::MarkListHasChanged() pLockLayer = pDrDoc->GetLayerAdmin().GetLayerPerID(SC_LAYER_INTERN); if (pLockLayer && pView->IsLayerLocked(pLockLayer->GetName())) ! pView->SetLayerLocked( pLockLayer->GetName(), FALSE ); } return (pFoundObj != NULL); --- 150,168 ---- if ( pFoundObj ) { SdrLayer* pLockLayer = NULL; + SCCOL nPosX = pViewShell->GetViewData()->GetCurX(); + SCROW nPosY = pViewShell->GetViewData()->GetCurY(); + SCTAB nTab = pViewShell->GetViewData()->GetTabNo(); + ScDocument* pDoc = pViewShell->GetViewData()->GetDocument(); + SfxObjectShell* pDocSh = pViewShell->GetViewData()->GetSfxDocShell(); + const ScProtectionAttr* pProtAttr = (const ScProtectionAttr*) pDoc->GetAttr(nPosX, nPosY, nTab, ATTR_PROTECTION ); + BOOL bProtectAttr = pProtAttr->GetProtection() || pProtAttr->GetHideCell() ; + BOOL bProtectDoc = pDoc->IsTabProtected(nTab) || pDocSh->IsReadOnly() ; + BOOL bProtect = bProtectDoc && bProtectAttr ; // Leave the internal note object unlocked - re-lock in ScDrawView::MarkListHasChanged() pLockLayer = pDrDoc->GetLayerAdmin().GetLayerPerID(SC_LAYER_INTERN); if (pLockLayer && pView->IsLayerLocked(pLockLayer->GetName())) ! pView->SetLayerLocked( pLockLayer->GetName(), bProtect ); } return (pFoundObj != NULL);