void fl_ContainerLayout::getSpanAP(UT_uint32 blockPos, bool bLeft, const PP_AttrProp * &pSpanAP) const { //first we need to ascertain if this revision is visible FL_DocLayout* pDL = getDocLayout(); UT_return_if_fail(pDL); FV_View* pView = pDL->getView(); UT_return_if_fail(pView); UT_uint32 iId = pView->getRevisionLevel(); bool bShow = pView->isShowRevisions(); bool bHiddenRevision = false; getSpanAttrProp(blockPos, bLeft, &pSpanAP,NULL,bShow,iId,bHiddenRevision); }
/*! retrieves AP associated with this layout, corretly processing any revision information; /return return value indicates whether the layout is hidden due to current revision settings or not */ FPVisibility fl_ContainerLayout::getAP(const PP_AttrProp *& pAP)const { FL_DocLayout* pDL = getDocLayout(); UT_return_val_if_fail(pDL,FP_VISIBLE); FV_View* pView = pDL->getView(); UT_return_val_if_fail(pView,FP_VISIBLE); UT_uint32 iId = pView->getRevisionLevel(); bool bShow = pView->isShowRevisions(); bool bHiddenRevision = false; getAttrProp(&pAP,NULL,bShow,iId,bHiddenRevision); if(bHiddenRevision) { return FP_HIDDEN_REVISION; } else { return FP_VISIBLE; } }
bool fp_FieldTableSumCols::calculateValue(void) { FV_View * pView = _getView(); pf_Frag_Strux* tableSDH= NULL; UT_sint32 numRows =0; UT_sint32 numCols = 0; bUseCurrency = false; cCurrency = '$'; pf_Frag_Strux* sdh = getBlock()->getStruxDocHandle(); PD_Document * pDoc = getBlock()->getDocument(); if(pDoc->isPieceTableChanging()) { return false; } if(getLine() == NULL) { return false; } fp_Container * pCol = getLine()->getColumn(); if(pCol == NULL) { return false; } fp_ShadowContainer * pShad =NULL; fl_HdrFtrShadow * pShadL = NULL; if(pCol->getContainerType() == FP_CONTAINER_COLUMN_SHADOW) { pShad = static_cast<fp_ShadowContainer *>(pCol); pShadL = pShad->getShadow(); } PT_DocPosition pos = pDoc->getStruxPosition(sdh)+1; pDoc->getStruxOfTypeFromPosition(pos,PTX_SectionTable,&tableSDH); pDoc-> getRowsColsFromTableSDH(tableSDH, pView->isShowRevisions(), pView->getRevisionLevel(), &numRows, &numCols); UT_UTF8String sValF; if(!pView->isInTable(pos)) { sValF = "???"; return _setValue(sValF.ucs4_str().ucs4_str()); } fl_CellLayout * pCell = NULL; UT_sint32 myLeft,myRight,myTop,myBot; pView->getCellParams(pos,&myLeft,&myRight,&myTop,&myBot); UT_sint32 col = 0; UT_sint32 row = myTop; UT_sint32 lastCol = -1; double dSum = 0.0; for(col = 0; col < numCols; col++) { pf_Frag_Strux* sdhCell = pDoc->getCellSDHFromRowCol(tableSDH,true,99999,row,col); UT_sint32 i = getBlock()->getDocLayout()->getLID(); fl_ContainerLayout* fmtCell = pDoc->getNthFmtHandle(sdhCell,i); pCell = static_cast<fl_CellLayout *>(fmtCell); if(pCell->getLeftAttach() == lastCol) { continue; } if((pCell->getTopAttach() == myTop) && (pCell->getLeftAttach() == myLeft)) { continue; } UT_GrowBuf grText; pCell->appendTextToBuf(grText); if(grText.getLength() == 0) { fl_ContainerLayout * pC = pCell->getFirstLayout(); while(pC) { if(pC->getContainerType() == FL_CONTAINER_BLOCK) { fl_BlockLayout * pBL = static_cast<fl_BlockLayout *>(pC); if(pShadL) { pBL = static_cast<fl_BlockLayout *>(pShadL->findMatchingContainer(pBL)); } if(pBL == NULL) { continue; } fp_Run * pRun = pBL->getFirstRun(); while(pRun) { if(pRun->getType() == FPRUN_FIELD) { fp_FieldRun * pFRun = static_cast<fp_FieldRun *>(pRun); const UT_UCS4Char * szVal = pFRun->getValue(); sValF.clear(); sValF.appendUCS4(szVal); dSum += dGetVal(sValF.utf8_str()); pRun = NULL; pC = NULL; break; } pRun = pRun->getNextRun(); } } if(pC) { pC = pC->getNext(); } } } else { sValF.clear(); sValF.appendUCS4(reinterpret_cast<const UT_UCS4Char *>(grText.getPointer(0)),grText.getLength()); dSum += dGetVal(sValF.utf8_str()); } lastCol = col; } sFormatDouble(sValF,dSum); return _setValue(sValF.ucs4_str().ucs4_str()); }