/*! Create a new Frame container. \param If pPrevFrame is non-null place the new cell after this in the linked list, otherwise just append it to the end. \return The newly created Frame container */ fp_Container* fl_FrameLayout::getNewContainer(fp_Container *) { UT_DEBUGMSG(("creating new Frame container\n")); _createFrameContainer(); m_bIsOnPage = false; return static_cast<fp_Container *>(getLastContainer()); }
fl_FrameLayout::~fl_FrameLayout() { // NB: be careful about the order of these UT_DEBUGMSG(("Deleting Framelayout %p \n",this)); _purgeLayout(); fp_FrameContainer * pFC = static_cast<fp_FrameContainer *>(getFirstContainer()); while(pFC) { fp_FrameContainer * pNext = static_cast<fp_FrameContainer *>(pFC->getNext()); if(pFC == static_cast<fp_FrameContainer *>(getLastContainer())) { pNext = NULL; } delete pFC; pFC = pNext; } setFirstContainer(NULL); setLastContainer(NULL); // // Remove pointers to this if they exist // if(getDocLayout() && getDocLayout()->getView()) { FV_FrameEdit * pFE = getDocLayout()->getView()->getFrameEdit(); if(pFE->getFrameLayout() == this) { pFE->setMode(FV_FrameEdit_NOT_ACTIVE); } } }
/*! Create a new Annotation container. \param If pPrevAnnotation is non-null place the new cell after this in the linked list, otherwise just append it to the end. \return The newly created Annotation container */ fp_Container* fl_AnnotationLayout::getNewContainer(fp_Container *) { UT_DEBUGMSG(("Creating new Annotation container\n")); _createAnnotationContainer(); m_bIsOnPage = false; return static_cast<fp_Container *>(getLastContainer()); }
/*! Create a new Footnote container. \param If pPrevFootnote is non-null place the new cell after this in the linked list, otherwise just append it to the end. \return The newly created Footnote container */ fp_Container* fl_FootnoteLayout::getNewContainer(fp_Container *) { UT_DEBUGMSG(("PLAM: creating new footnote container\n")); _createFootnoteContainer(); m_bIsOnPage = false; return static_cast<fp_Container *>(getLastContainer()); }
fl_EndnoteLayout::~fl_EndnoteLayout() { // NB: be careful about the order of these xxx_UT_DEBUGMSG(("Deleting Endlayout %x \n",this)); _purgeLayout(); fp_EndnoteContainer * pEC = static_cast<fp_EndnoteContainer *>(getFirstContainer()); while(pEC) { fp_EndnoteContainer * pNext = static_cast<fp_EndnoteContainer *>(pEC->getNext()); if(pEC == static_cast<fp_EndnoteContainer *>(getLastContainer())) { pNext = NULL; } m_pLayout->removeEndnoteContainer(pEC); delete pEC; pEC = pNext; } setFirstContainer(NULL); setLastContainer(NULL); m_pLayout->removeEndnote(this); }
fl_AnnotationLayout::~fl_AnnotationLayout() { // NB: be careful about the order of these UT_DEBUGMSG(("Deleting Annotationlayout %p \n",this)); _purgeLayout(); fp_AnnotationContainer * pAC = static_cast<fp_AnnotationContainer *>(getFirstContainer()); while(pAC) { fp_AnnotationContainer * pNext = static_cast<fp_AnnotationContainer *>(pAC->getNext()); if(pAC == static_cast<fp_AnnotationContainer *>(getLastContainer())) { pNext = NULL; } delete pAC; pAC = pNext; } setFirstContainer(NULL); setLastContainer(NULL); UT_return_if_fail( m_pLayout ); m_pLayout->removeAnnotation(this); }
fl_FootnoteLayout::~fl_FootnoteLayout() { // NB: be careful about the order of these xxx_UT_DEBUGMSG(("Deleting Footlayout %x \n",this)); _purgeLayout(); fp_FootnoteContainer * pFC = static_cast<fp_FootnoteContainer *>(getFirstContainer()); while(pFC) { fp_FootnoteContainer * pNext = static_cast<fp_FootnoteContainer *>(pFC->getNext()); if(pFC == static_cast<fp_FootnoteContainer *>(getLastContainer())) { pNext = NULL; } delete pFC; pFC = pNext; } setFirstContainer(NULL); setLastContainer(NULL); UT_return_if_fail( m_pLayout ); m_pLayout->removeFootnote(this); }
bool fl_ContainerLayout::isOnScreen() const { // we check if any of our containers is on screen // however, we will not call fp_Container::isOnScreen() to avoid // unnecessary overhead if(isCollapsed()) return false; UT_return_val_if_fail(getDocLayout(),false); FV_View *pView = getDocLayout()->getView(); bool bShowHidden = pView && pView->getShowPara(); bool bHidden = ((m_eHidden == FP_HIDDEN_TEXT && !bShowHidden) || m_eHidden == FP_HIDDEN_REVISION || m_eHidden == FP_HIDDEN_REVISION_AND_TEXT); if(bHidden) return false; UT_GenericVector<UT_Rect*> vRect; UT_GenericVector<fp_Page*> vPages; pView->getVisibleDocumentPagesAndRectangles(vRect, vPages); UT_uint32 iCount = vPages.getItemCount(); if(!iCount) return false; bool bRet = false; fp_Container * pC = getFirstContainer(); if(!pC) return false; fp_Container *pCEnd = getLastContainer(); while(pC) { fp_Page * pMyPage = pC->getPage(); if(pMyPage) { for(UT_uint32 i = 0; i < iCount; i++) { fp_Page * pPage = vPages.getNthItem(i); if(pPage == pMyPage) { UT_Rect r; UT_Rect *pR = vRect.getNthItem(i); if(!pC->getPageRelativeOffsets(r)) break; bRet = r.intersectsRect(pR); break; } } } if(bRet || pC == pCEnd) break; pC = static_cast<fp_Container*>(pC->getNext()); } UT_VECTOR_PURGEALL(UT_Rect*,vRect); return bRet; }
/*! * This loads all the properties of the container found in the piecetable * into the physical frame container */ void fl_FrameLayout::setContainerProperties(void) { fp_FrameContainer * pFrame = static_cast<fp_FrameContainer *>(getLastContainer()); if(pFrame == NULL) { UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); return; } pFrame->setBackground(m_background ); pFrame->setBottomStyle(m_lineBottom ); pFrame->setTopStyle(m_lineTop ); pFrame->setLeftStyle(m_lineLeft ); pFrame->setRightStyle(m_lineRight ); pFrame->setXpad(m_iXpad); pFrame->setYpad(m_iYpad); pFrame->setTightWrapping(m_bIsTightWrap); if(FL_FRAME_BELOW_TEXT == m_iFrameWrapMode) { pFrame->setAbove(false); } else if(FL_FRAME_WRAPPED_TO_RIGHT == m_iFrameWrapMode) { pFrame->setRightWrapped(true); } else if(FL_FRAME_WRAPPED_TO_LEFT == m_iFrameWrapMode) { pFrame->setLeftWrapped(true); } else if(FL_FRAME_WRAPPED_TOPBOT == m_iFrameWrapMode) { pFrame->setTopBot(true); } // // Now do the image for this frame. // if(m_pGraphicImage) { if(m_pImageImage == NULL) { const PP_AttrProp * pAP = NULL; getAP(pAP); GR_Graphics * pG = getDocLayout()->getGraphics(); UT_sint32 iWidth = pG->tlu(100); UT_sint32 iHeight = pG->tlu(100); if(m_pGraphicImage->getType() == FGT_Raster) { iWidth = pG->tlu(m_pGraphicImage->getWidth()); iHeight = pG->tlu(m_pGraphicImage->getHeight()); } GR_Image * pImage = m_pGraphicImage->generateImage(pG,pAP,iWidth,iHeight); m_iDocImageWidth = pFrame->getFullWidth(); m_iDocImageHeight = pFrame->getFullHeight(); m_iGraphicTick = getDocLayout()->getGraphicTick(); UT_Rect rec(0,0,pFrame->getFullWidth(),pFrame->getFullHeight()); if(rec.width < pG->tlu(3)) { rec.width = pG->tlu(3); } if(rec.height < pG->tlu(3)) { rec.height = pG->tlu(3); } if(pImage) { pImage->scaleImageTo(pG,rec); } m_pImageImage = pImage; } pFrame->getFillType()->setImagePointer(&m_pGraphicImage,&m_pImageImage); } if(m_iFrameWrapMode >= FL_FRAME_WRAPPED_TO_RIGHT) { // // Set text wrapping around frame // pFrame->setWrapping(true); } pFrame->setPreferedPageNo(m_iPrefPage); }