fp_Run * fl_ContainerLayout::getFirstRun(void) const
{
	if(getContainerType() == FL_CONTAINER_BLOCK)
	{
		const fl_BlockLayout * pBL = static_cast<const fl_BlockLayout *>(this);
		return pBL->getFirstRun();
	}
	else if(getFirstLayout() == NULL)
	{
		return NULL;
	}
	return getFirstLayout()->getFirstRun();
}
bool fl_EmbedLayout::bl_doclistener_insertEndEmbed(fl_ContainerLayout*,
											  const PX_ChangeRecord_Strux * pcrx,
											  pf_Frag_Strux* sdh,
											  PL_ListenerId lid,
											  void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
																	  PL_ListenerId lid,
																	  fl_ContainerLayout* sfhNew))
{
	// The endFootnote strux actually needs a format handle to to this Footnote layout.
	// so we bind to this layout.

		
	fl_ContainerLayout* sfhNew = this;
	pfnBindHandles(sdh,lid,sfhNew);

//
// increment the insertion point in the view.
//
	FV_View* pView = m_pLayout->getView();
	if (pView && (pView->isActive() || pView->isPreview()))
	{
		pView->setPoint(pcrx->getPosition() +  fl_BLOCK_STRUX_OFFSET);
	}
	else if(pView && pView->getPoint() > pcrx->getPosition())
	{
		pView->setPoint(pView->getPoint() +  fl_BLOCK_STRUX_OFFSET);
	}
	m_bHasEndFootnote = true;
	fl_BlockLayout * pBL = static_cast<fl_BlockLayout *>(getFirstLayout());
	pBL->updateEnclosingBlockIfNeeded();
	return true;
}
void fl_AnnotationLayout::format(void)
{
	UT_DEBUGMSG(("SEVIOR: Formatting Annotations first container is %p\n", getFirstContainer()));
	if(getFirstContainer() == NULL)
	{
		getNewContainer();
	}
	if(!m_bIsOnPage)
	{
		_insertAnnotationContainer(getFirstContainer());
	}
	fl_ContainerLayout*	pBL = getFirstLayout();
	
	while (pBL)
	{
		pBL->format();
		UT_sint32 count = 0;
		while(pBL->getLastContainer() == NULL || pBL->getFirstContainer()==NULL)
		{
			UT_DEBUGMSG(("Error formatting a block try again \n"));
			count = count + 1;
			pBL->format();
			if(count > 3)
			{
				UT_DEBUGMSG(("Give up trying to format. Hope for the best :-( \n"));
				break;
			}
		}
		pBL = pBL->getNext();
	}
	static_cast<fp_AnnotationContainer *>(getFirstContainer())->layout();
	m_bNeedsFormat = false;
	m_bNeedsReformat = false;
}
void fl_EmbedLayout::updateLayout(bool /*bDoAll*/)
{
  fl_ContainerLayout * pBL = getFirstLayout();
  while(pBL)
  {
    pBL->format();
    pBL = pBL->getNext();
  }
}
Beispiel #5
0
void fl_FrameLayout::markAllRunsDirty(void)
{
	fl_ContainerLayout*	pCL = getFirstLayout();
	while (pCL)
	{
		pCL->markAllRunsDirty();
		pCL = pCL->getNext();
	}
}
Beispiel #6
0
/*!
 * This method removes all layout structures contained by this layout
 * structure.
 */
void fl_FrameLayout::_purgeLayout(void)
{
	UT_DEBUGMSG(("FrameLayout: purge \n"));
	fl_ContainerLayout * pCL = getFirstLayout();
	while(pCL)
	{
		fl_ContainerLayout * pNext = pCL->getNext();
		delete pCL;
		pCL = pNext;
	}
}
bool fl_EmbedLayout::recalculateFields(UT_uint32 iUpdateCount)
{

	bool bResult = false;
	fl_ContainerLayout*	pBL = getFirstLayout();
	while (pBL)
	{
		bResult = pBL->recalculateFields(iUpdateCount) || bResult;
		pBL = pBL->getNext();
	}
	return bResult;
}
Beispiel #8
0
void fl_FrameLayout::redrawUpdate(void)
{
	fl_ContainerLayout*	pBL = getFirstLayout();
	while (pBL)
	{
		if (pBL->needsRedraw())
		{
			pBL->redrawUpdate();
		}

		pBL = pBL->getNext();
	}
}
/*!
 * This method appends all the text in the current layout to the supplied 
 * GrowBuf.
 */
void fl_ContainerLayout::appendTextToBuf(UT_GrowBuf & buf) const
{
	if(getContainerType() == FL_CONTAINER_BLOCK)
	{
		const fl_BlockLayout * pBL = static_cast<const fl_BlockLayout *>(this);
		pBL->appendTextToBuf(buf);
		return;
	}
	const fl_ContainerLayout * pCL = getFirstLayout();
	while(pCL)
	{
		pCL->appendTextToBuf(buf);
		pCL = pCL->getNext();
	}
}
Beispiel #10
0
bool fl_FrameLayout::recalculateFields(UT_uint32 iUpdateCount)
{
	// ingnore frames in normal view mode
	FV_View * pView = getDocLayout()->getView();
	GR_Graphics * pG = getDocLayout()->getGraphics();
	UT_return_val_if_fail( pView && pG, false );
	
	bool bResult = false;
	fl_ContainerLayout*	pBL = getFirstLayout();
	while (pBL)
	{
		bResult = pBL->recalculateFields(iUpdateCount) || bResult;
		pBL = pBL->getNext();
	}
	return bResult;
}
Beispiel #11
0
void fl_FrameLayout::localCollapse(void)
{
	// ClearScreen on our Cell. One Cell per layout.
	fp_FrameContainer *pFC = static_cast<fp_FrameContainer *>(getFirstContainer());
	if (pFC)
	{
		pFC->clearScreen();
	}

	// get rid of all the layout information for every containerLayout
	fl_ContainerLayout*	pCL = getFirstLayout();
	while (pCL)
	{
		pCL->collapse();
		pCL = pCL->getNext();
	}
	m_bNeedsReformat = true;
}
void fl_EmbedLayout::updateLayout(void)
{
	if(needsReformat())
	{
		format();
	}
	m_vecFormatLayout.clear();
	fl_ContainerLayout*	pBL = getFirstLayout();
	while (pBL)
	{
		if (pBL->needsReformat())
		{
			pBL->format();
		}

		pBL = pBL->getNext();
	}
}
void fl_EndnoteLayout::format(void)
{
	UT_DEBUGMSG(("SEVIOR: Formatting Endnote first container is %p \n",getFirstContainer()));
	if(getFirstContainer() == NULL)
	{
		getNewContainer();
	}
	if(!m_bIsOnPage)
	{
		_insertEndnoteContainer(getFirstContainer());
	}
	fl_ContainerLayout*	pBL = getFirstLayout();
	while (pBL)
	{
		pBL->format();
		UT_sint32 count = 0;
		while(pBL->getLastContainer() == NULL || pBL->getFirstContainer()==NULL)
		{
			UT_DEBUGMSG(("Error formatting a block try again \n"));
			count = count + 1;
			pBL->format();
			if(count > 3)
			{
				UT_DEBUGMSG(("Give up trying to format. Hope for the best :-( \n"));
				break;
			}
		}
		pBL = pBL->getNext();
	}
	static_cast<fp_EndnoteContainer *>(getFirstContainer())->layout();
	m_bNeedsFormat = false;
	m_bNeedsReformat = false;
	bool bOnPage = (getFirstContainer()->getPage() != NULL);
	FV_View * pView = NULL;
	if(m_pLayout)
		pView = m_pLayout->getView();
	if(bOnPage && pView && !pView->isLayoutFilling())
	{
	       getDocSectionLayout()->setNeedsSectionBreak(true,NULL);
	}
	UT_ASSERT(getFirstContainer()->getPage());
}
Beispiel #14
0
void fl_FrameLayout::miniFormat(void)
{
	// ingnore frames in normal view mode
	FV_View * pView = getDocLayout()->getView();
	GR_Graphics * pG = getDocLayout()->getGraphics();
	UT_return_if_fail( pView && pG );
	
	fl_ContainerLayout*	pBL = getFirstLayout();
	
	while (pBL)
	{
		pBL->format();
		pBL = pBL->getNext();
	}
	fp_FrameContainer * pFrame = static_cast<fp_FrameContainer *>(getFirstContainer());
	pFrame->layout();
	pFrame->getFillType()->setWidthHeight(getDocLayout()->getGraphics(),pFrame->getFullWidth(),pFrame->getFullHeight(),false);
	m_bNeedsFormat = false;
	m_bNeedsReformat = false;
}
Beispiel #15
0
void fl_FrameLayout::updateLayout(bool /*bDoAll*/)
{
	// ingnore frames in normal view mode
	FV_View * pView = getDocLayout()->getView();
	GR_Graphics * pG = getDocLayout()->getGraphics();
	UT_return_if_fail( pView && pG);
	
	xxx_UT_DEBUGMSG(("UpdsateLayout in in framelayout \n"));
	if(needsReformat())
	{
		format();
	}
	m_vecFormatLayout.clear();
	fl_ContainerLayout*	pBL = getFirstLayout();
	while (pBL)
	{
		if (pBL->needsReformat())
		{
			pBL->format();
		}

		pBL = pBL->getNext();
	}
}
fl_BlockLayout* fl_ContainerLayout::getNextBlockInDocument(void) const
{
	fl_ContainerLayout * pNext = getNext();
	if(getContainerType() != FL_CONTAINER_BLOCK)
	{
	  pNext = getFirstLayout();
	}
	fl_ContainerLayout * pOld = NULL;
	UT_uint32 depth = 0;
	next_is_null :
	if(pNext == NULL)
	{
		while((pNext == NULL) && ((pOld != NULL) || (depth == 0)))
	    {
			fl_ContainerLayout * pPrevOld = pOld;
			if(depth > 0)
			{
				pOld = pOld->myContainingLayout();
			}
			else
			{
				pOld = myContainingLayout();
			}
			depth++;
			if(pOld != NULL) // HdrFtr's have myContainingLayout == NULL
			{
				pNext = pOld->getNext();
			}
			if(pPrevOld == pOld)
			{
				pOld = NULL;
			}
		}
	}
	while(pNext)
	{
		pOld = pNext;
		if(pNext->getContainerType() == FL_CONTAINER_BLOCK)
		{
			return static_cast<fl_BlockLayout *>(pNext);
		}
		else if(pNext->getContainerType() == FL_CONTAINER_DOCSECTION)
		{
			pNext = pNext->getFirstLayout();
		}
		else if(pNext->getContainerType() == FL_CONTAINER_TABLE)
		{
			pNext = pNext->getFirstLayout();
		}
		else if(pNext->getContainerType() == FL_CONTAINER_FRAME)
		{
			if(pNext->getFirstLayout() == NULL)
			{
			     pNext = pNext->getNext();
			}
			else
			{
			     pNext = pNext->getFirstLayout();
			}
		}
		else if(pNext->getContainerType() == FL_CONTAINER_CELL)
		{
			pNext = pNext->getFirstLayout();
		}
		else if(pNext->getContainerType() == FL_CONTAINER_TOC)
		{
			pNext = pNext->getNext();
			if(pNext == NULL)
			{
				goto next_is_null;
			}
		}
		else if(pNext->getContainerType() == FL_CONTAINER_FOOTNOTE)
		{
			pNext = pNext->getNext();
			if(pNext == NULL)
			{
				goto next_is_null;
			}
		}
		else if(pNext->getContainerType() == FL_CONTAINER_ANNOTATION)
		{
			pNext = pNext->getNext();
			if(pNext == NULL)
			{
				goto next_is_null;
			}
		}
		else if(pNext->getContainerType() == FL_CONTAINER_RDFANCHOR)
		{
			pNext = pNext->getNext();
			if(pNext == NULL)
			{
				goto next_is_null;
			}
		}
		else if(pNext->getContainerType() == FL_CONTAINER_ENDNOTE)
		{
			pNext = pNext->getNext();
			if(pNext == NULL)
			{
				goto next_is_null;
			}
		}
		else
		{
			pNext = NULL;
			break;
		}
		if(pNext == NULL)
		{
				goto next_is_null;
		}
	}
	return NULL;
}
Beispiel #17
0
void fl_FrameLayout::_lookupMarginProperties(const PP_AttrProp* pSectionAP)
{
	
	UT_return_if_fail(pSectionAP);
	FV_View * pView = getDocLayout()->getView();
	GR_Graphics * pG = getDocLayout()->getGraphics();
	UT_return_if_fail( pView && pG );
	
	UT_sint32 iFramePositionTo = m_iFramePositionTo;
	FL_FrameWrapMode iFrameWrapMode = m_iFrameWrapMode;
	bool bIsTightWrap = m_bIsTightWrap;
	UT_sint32 iXpos = m_iXpos;
	UT_sint32 iYpos = m_iYpos;
	UT_sint32 iXColumn = m_iXColumn;
	UT_sint32 iYColumn = m_iYColumn;
	UT_sint32 iXPage = m_iXPage;
	UT_sint32 iYPage = m_iYPage;

	
	if(pView->getViewMode() == VIEW_NORMAL && !pG->queryProperties(GR_Graphics::DGP_PAPER))
	{
		m_iFramePositionTo = FL_FRAME_POSITIONED_TO_BLOCK;
		m_iFrameWrapMode = FL_FRAME_WRAPPED_TO_RIGHT;
		m_bIsTightWrap = false;
		m_iXpos = 0;
		m_iYpos = 0;
		m_iXColumn = 0;
		m_iYColumn = 0;
		m_iXPage = 0;
		m_iYPage = 0;
	}
	else
	{
		const gchar *pszPositionTo = NULL;
		const gchar *pszWrapMode = NULL;
		const gchar *pszXpos = NULL;
		const gchar *pszYpos = NULL;
		const gchar *pszColXpos = NULL;
		const gchar *pszColYpos = NULL;
		const gchar *pszPageXpos = NULL;
		const gchar *pszPageYpos = NULL;
		const gchar * pszTightWrapped = NULL;


		// Position-to

		if(!pSectionAP || !pSectionAP->getProperty("position-to",pszPositionTo))
		{
			m_iFramePositionTo = FL_FRAME_POSITIONED_TO_BLOCK;
		}
		else if(strcmp(pszPositionTo,"block-above-text") == 0)
		{
			m_iFramePositionTo = FL_FRAME_POSITIONED_TO_BLOCK;
		}
		else if(strcmp(pszPositionTo,"column-above-text") == 0)
		{
			m_iFramePositionTo = FL_FRAME_POSITIONED_TO_COLUMN;
		}
		else if(strcmp(pszPositionTo,"page-above-text") == 0)
		{
			m_iFramePositionTo = FL_FRAME_POSITIONED_TO_PAGE;
		}
		else 
		{
			UT_DEBUGMSG(("Unknown Position to %s \n",pszPositionTo));
			UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
			m_iFramePositionTo =  FL_FRAME_POSITIONED_TO_BLOCK;
		}


		// wrap-mode

		if(!pSectionAP || !pSectionAP->getProperty("wrap-mode",pszWrapMode))
		{
			m_iFrameWrapMode = FL_FRAME_ABOVE_TEXT;
		}
		else if(strcmp(pszWrapMode,"above-text") == 0)
		{
			m_iFrameWrapMode = FL_FRAME_ABOVE_TEXT;
		}
		else if(strcmp(pszWrapMode,"below-text") == 0)
		{
			m_iFrameWrapMode = FL_FRAME_BELOW_TEXT;
		}
		else if(strcmp(pszWrapMode,"wrapped-to-right") == 0)
		{
			m_iFrameWrapMode = FL_FRAME_WRAPPED_TO_RIGHT;
		}
		else if(strcmp(pszWrapMode,"wrapped-to-left") == 0)
		{
			m_iFrameWrapMode = FL_FRAME_WRAPPED_TO_LEFT;
		}
		else if(strcmp(pszWrapMode,"wrapped-both") == 0)
		{
			m_iFrameWrapMode = FL_FRAME_WRAPPED_BOTH_SIDES;
		}
		else if(strcmp(pszWrapMode,"wrapped-topbot") == 0)
		{
			m_iFrameWrapMode = FL_FRAME_WRAPPED_TOPBOT;
		}
		else 
		{
			UT_DEBUGMSG(("Unknown wrap-mode %s \n",pszWrapMode));
			UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
			m_iFrameWrapMode = FL_FRAME_ABOVE_TEXT;
		}
		//
		// Wrap type
		//
		if(!pSectionAP || !pSectionAP->getProperty("tight-wrap",pszTightWrapped))
		{
			m_bIsTightWrap = false;
		}
		else if(strcmp(pszTightWrapped,"1") == 0)
		{
			m_bIsTightWrap = true;
		}
		else
		{
			m_bIsTightWrap = false;
		}

		// Xpos

		if(!pSectionAP || !pSectionAP->getProperty("xpos",pszXpos))
		{
			m_iXpos = 0;
		}
		else
		{
			m_iXpos = UT_convertToLogicalUnits(pszXpos);
		}
		UT_DEBUGMSG(("xpos for frame is %s \n",pszXpos));
		// Ypos

		if(!pSectionAP || !pSectionAP->getProperty("ypos",pszYpos))
		{
			m_iYpos = 0;
		}
		else
		{
			m_iYpos = UT_convertToLogicalUnits(pszYpos);
		}
		UT_DEBUGMSG(("ypos for frame is %s \n",pszYpos));

		// ColXpos

		if(!pSectionAP || !pSectionAP->getProperty("frame-col-xpos",pszColXpos))
		{
			m_iXColumn = 0;
		}
		else
		{
			m_iXColumn = UT_convertToLogicalUnits(pszColXpos);
		}
		UT_DEBUGMSG(("ColXpos for frame is %s \n",pszColXpos));
		// colYpos

		if(!pSectionAP || !pSectionAP->getProperty("frame-col-ypos",pszColYpos))
		{
			m_iYColumn = 0;
		}
		else
		{
			m_iYColumn = UT_convertToLogicalUnits(pszColYpos);
		}
		UT_DEBUGMSG(("ColYpos for frame is %s units %d \n",pszColYpos,m_iYColumn));


		// PageXpos

		if(!pSectionAP || !pSectionAP->getProperty("frame-page-xpos",pszPageXpos))
		{
			m_iXPage = 0;
		}
		else
		{
			m_iXPage = UT_convertToLogicalUnits(pszPageXpos);
		}
		UT_DEBUGMSG(("PageXpos for frame is %s \n",pszPageXpos));
		// PageYpos

		if(!pSectionAP || !pSectionAP->getProperty("frame-page-ypos",pszPageYpos))
		{
			m_iYPage = 0;
		}
		else
		{
			m_iYPage = UT_convertToLogicalUnits(pszPageYpos);
		}
		UT_DEBUGMSG(("PageYpos for frame is %s units %d \n",pszColYpos,m_iYPage));

	}

	fl_ContainerLayout*	pCL = getFirstLayout();
	while (pCL)
	{
		pCL->lookupMarginProperties();
		pCL = pCL->getNext();
	}

	if(iFramePositionTo != m_iFramePositionTo || iFrameWrapMode != m_iFrameWrapMode ||
	   bIsTightWrap != m_bIsTightWrap || iXpos != m_iXpos || iYpos != m_iYpos ||
	   iXColumn != m_iXColumn || iYColumn != m_iYColumn || iXPage != m_iXPage ||
	   iYPage != m_iYPage)
	{
		collapse();
	}
}
Beispiel #18
0
void fl_FrameLayout::format(void)
{
	// ingnore frames in normal view mode
	FV_View * pView = getDocLayout()->getView();
	GR_Graphics * pG = getDocLayout()->getGraphics();
	UT_return_if_fail( pView && pG );
	
	xxx_UT_DEBUGMSG(("SEVIOR: Formatting first container is %x \n",getFirstContainer()));
	if(isHidden() > FP_VISIBLE)
	{
		xxx_UT_DEBUGMSG(("Don't format FRAME coz I'm hidden! \n"));
		return;
	}

	if(getFirstContainer() == NULL)
	{
		getNewContainer();
	}
	fl_ContainerLayout*	pBL2 = getFirstLayout();
	while (pBL2)
	{
		pBL2->format();
		UT_sint32 count = 0;
		while(pBL2->getLastContainer() == NULL || pBL2->getFirstContainer()==NULL)
		{
			UT_DEBUGMSG(("Error formatting a block try again \n"));
			count = count + 1;
			pBL2->format();
			if(count > 3)
			{
				UT_DEBUGMSG(("Give up trying to format. Hope for the best :-( \n"));
				break;
			}
		}
		pBL2 = pBL2->getNext();
	}
	static_cast<fp_FrameContainer *>(getFirstContainer())->layout();
	bool bPlacedOnPage = false;
	if(!m_bIsOnPage)
	{
//
// Place it on the correct page.
//
		fl_ContainerLayout * pCL = getPrev();
		while(pCL && ((pCL->getContainerType() == FL_CONTAINER_ENDNOTE) ||
					  (pCL->getContainerType() == FL_CONTAINER_FOOTNOTE) ||
					  (pCL->getContainerType() == FL_CONTAINER_TOC) ||
					  (pCL->getContainerType() == FL_CONTAINER_FRAME)  ))
		{
			pCL = pCL->getPrev();
		}
		if(pCL == NULL)
		{
			UT_DEBUGMSG(("No BlockLayout before this frame! \n"));
			UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
			return;
		}
		fl_BlockLayout * pBL = NULL;
		if(pCL->getContainerType() != FL_CONTAINER_BLOCK)
		{
			pCL = pCL->getPrevBlockInDocument();
			pBL = static_cast<fl_BlockLayout *>(pCL);
		}
		else
		{
			pBL = static_cast<fl_BlockLayout *>(pCL);
		}
		UT_return_if_fail(pBL);
		UT_sint32 count = pBL->getNumFrames();
		if(count == 0)
		{
			UT_DEBUGMSG(("BlockLayout does not contain this frame! \n"));
			UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
			return;
		}
		UT_sint32 i =0;
		for(i=0; i<count; i++)
		{
			fl_FrameLayout * pFL = pBL->getNthFrameLayout(i);
			if(pFL == this)
			{
				break;
			}
		}
		if(count == i)
		{
			UT_DEBUGMSG(("BlockLayout does not contain this frame! \n"));
			UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
			return;
		}
		if(!pBL->isCollapsed())
		{
			m_bIsOnPage = pBL->setFramesOnPage(NULL);
			if(!m_bIsOnPage)
			{
				setNeedsReformat(this);
			}
		}
		if(m_bIsOnPage)
			bPlacedOnPage = true;
	}
	m_bNeedsFormat = m_bIsOnPage;
	m_bNeedsReformat = m_bIsOnPage;
	if(!m_bIsOnPage)
	{
		setNeedsReformat(this);
	}
	if(!m_bIsOnPage)
	{
		return;
	}
	if(bPlacedOnPage)
	{
		fl_DocSectionLayout * pDSL = getDocSectionLayout();
		fp_FrameContainer * pFC = static_cast<fp_FrameContainer *>(getFirstContainer());
		if(pFC)
		{
			pDSL->setNeedsSectionBreak(true,pFC->getPage());
		}
	}
}