本文整理汇总了C++中FL_DocLayout类的典型用法代码示例。如果您正苦于以下问题:C++ FL_DocLayout类的具体用法?C++ FL_DocLayout怎么用?C++ FL_DocLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FL_DocLayout类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBlock
bool fp_FieldTOCNumRun::calculateValue(void)
{
UT_UCSChar sz_ucs_FieldValue[FPFIELD_MAX_LENGTH + 1];
//
// First Find page number.
//
PL_StruxDocHandle sdh = getBlock()->getStruxDocHandle();
PD_Document * pDoc = getBlock()->getDocument();
PT_DocPosition pos = pDoc->getStruxPosition(sdh)+1;
FL_DocLayout * pLayout = getBlock()->getDocLayout();
fl_BlockLayout * pBlockInDoc = pLayout->findBlockAtPosition(pos);
if(pBlockInDoc == NULL)
{
sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
sz_ucs_FieldValue[1] = 0;
return _setValue(sz_ucs_FieldValue);
}
fp_Line * pLine = static_cast<fp_Line *>(pBlockInDoc->getFirstContainer());
if(pLine == NULL)
{
sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
sz_ucs_FieldValue[1] = 0;
return _setValue(sz_ucs_FieldValue);
}
fp_Page * pPage = pLine->getPage();
UT_sint32 iPage = pLayout->findPage(pPage);
if( iPage < 0)
{
sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
sz_ucs_FieldValue[1] = 0;
return _setValue(sz_ucs_FieldValue);
}
iPage++; // Start from Page 1.
UT_String sVal("");
FootnoteType iType = getBlock()->getTOCNumType();
pLayout->getStringFromFootnoteVal(sVal,iPage,iType);
const char * psz = sVal.c_str();
bool bStop = false;
UT_sint32 i = 0;
sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
for(i=1; (i<FPFIELD_MAX_LENGTH) && !bStop; i++)
{
sz_ucs_FieldValue[i] = static_cast<UT_UCSChar>(*psz);
if(*psz == 0)
{
bStop = true;
}
else
{
psz++;
}
}
return _setValue(sz_ucs_FieldValue);
}
示例2: _setMaxContainerHeight
void fp_EndnoteContainer::layout(void)
{
_setMaxContainerHeight(0);
UT_sint32 iY = 0, iPrevY = 0;
iY= 0;
UT_uint32 iCountContainers = countCons();
fp_Container *pContainer, *pPrevContainer = NULL;
for (UT_uint32 i=0; i < iCountContainers; i++)
{
pContainer = static_cast<fp_Container*>(getNthCon(i));
//
// This is to speedup redraws.
//
if(pContainer->getHeight() > _getMaxContainerHeight())
_setMaxContainerHeight(pContainer->getHeight());
if(pContainer->getY() != iY)
{
pContainer->clearScreen();
}
pContainer->setY(iY);
UT_sint32 iContainerHeight = pContainer->getHeight();
UT_sint32 iContainerMarginAfter = pContainer->getMarginAfter();
if (pPrevContainer)
{
pPrevContainer->setAssignedScreenHeight(iY - iPrevY);
}
iPrevY = iY;
iY += iContainerHeight;
iY += iContainerMarginAfter;
pPrevContainer = pContainer;
}
// Correct height position of the last line
if (pPrevContainer)
{
pPrevContainer->setAssignedScreenHeight(iY - iPrevY + 1);
}
UT_sint32 iNewHeight = iY;
if (getHeight() == iNewHeight)
{
return;
}
setHeight(iNewHeight);
fl_EndnoteLayout * pEL = static_cast<fl_EndnoteLayout *>(getSectionLayout());
FL_DocLayout * pDL = pEL->getDocLayout();
fl_DocSectionLayout * pDSL = pDL->getDocSecForEndnote(this);
fp_Page * pPage = getPage();
pDSL->setNeedsSectionBreak(true,pPage);
}
示例3: UT_return_if_fail
void AP_Dialog_Paragraph::_createPreviewFromGC(GR_Graphics * gc,
UT_uint32 width,
UT_uint32 height)
{
UT_return_if_fail (gc);
// g_free any attached preview
DELETEP(m_paragraphPreview);
// platform's runModal should have set this
UT_return_if_fail (m_pFrame);
AV_View * baseview = m_pFrame->getCurrentView();
UT_return_if_fail (baseview);
FV_View * view = static_cast<FV_View *> (baseview);
FL_DocLayout * dl = view->getLayout();
UT_return_if_fail (dl);
fl_BlockLayout * bl = dl->findBlockAtPosition((PT_DocPosition) view->getPoint());
UT_return_if_fail (bl);
UT_GrowBuf gb;
bool hadMem = bl->getBlockBuf(&gb);
UT_UCSChar * tmp = NULL;
if (hadMem && gb.getLength() > 0)
{
gb.truncate(NUM_CHARS_FOR_SAMPLE);
UT_UCS4_cloneString(&tmp, (UT_UCSChar *) gb.getPointer(0));
}
else
{
const XAP_StringSet * pSS = m_pApp->getStringSet();
// if the paragraph was empty, use our sample
UT_UCS4_cloneString_char(&tmp, pSS->getValue(AP_STRING_ID_DLG_Para_PreviewSampleFallback));
}
m_paragraphPreview = new AP_Preview_Paragraph(gc, tmp, this);
FREEP(tmp);
UT_return_if_fail (m_paragraphPreview);
m_paragraphPreview->setWindowSize(width, height);
// TODO : any setup of the GC for drawing
}
示例4: xxx_UT_DEBUGMSG
bool fp_FieldListLabelRun::calculateValue(void)
{
UT_UCSChar sz_ucs_FieldValue[FPFIELD_MAX_LENGTH + 1];
UT_uint32 i = 0;
UT_UCSChar * listlabel = NULL;
if(getBlock()->isContainedByTOC())
{
xxx_UT_DEBUGMSG(("!!!!!!------!!!! ListLabel in TOC!!!! \n"));
//
// First Find the block in the document.
//
pf_Frag_Strux* sdh = getBlock()->getStruxDocHandle();
PD_Document * pDoc = getBlock()->getDocument();
PT_DocPosition pos = pDoc->getStruxPosition(sdh)+1;
FL_DocLayout * pLayout = getBlock()->getDocLayout();
fl_BlockLayout * pBlockInDoc = pLayout->findBlockAtPosition(pos);
if(pBlockInDoc == NULL)
{
sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
sz_ucs_FieldValue[1] = 0;
return _setValue(sz_ucs_FieldValue);
}
i = 0;
listlabel = pBlockInDoc->getListLabel();
}
else
{
i = 0;
listlabel = getBlock()->getListLabel();
}
if(listlabel == NULL)
{
sz_ucs_FieldValue[0] = 0;
}
else
{
//
// This code is here because UT_UCS_copy_char is broken
//
i = 0;
UT_uint32 len = UT_MIN( UT_UCS4_strlen(listlabel),FPFIELD_MAX_LENGTH + 1) ;
for(i=0; i<=len;i++)
{
sz_ucs_FieldValue[i] = *listlabel++;
}
// sz_ucs_FieldValue[len] = 0;
// m_sFieldValue[0] = 0; // Force an update!!!
}
return _setValue(sz_ucs_FieldValue);
}
示例5: getDocLayout
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);
}
示例6: draw
/*!
Draw container content
\param pDA Draw arguments
*/
void fp_AnnotationContainer::draw(dg_DrawArgs* pDA)
{
if(getPage() == NULL)
{
return;
}
fl_AnnotationLayout * pAL2 = static_cast<fl_AnnotationLayout *>(getSectionLayout());
FL_DocLayout * pDL = pAL2->getDocLayout();
m_iLabelWidth = 0;
if(!pDL->displayAnnotations())
return;
UT_DEBUGMSG(("Annotation: Drawing unbroken annotation %p x %d, y %d width %d height %d \n",this,getX(),getY(),getWidth(),getHeight()));
UT_DEBUGMSG(("Annotation: Drawing PDA->xoff %d, pDA->yoff %ld \n",pDA->xoff,pDA->yoff));
//
// Only draw the lines in the clipping region.
//
dg_DrawArgs da = *pDA;
UT_uint32 count = countCons();
for (UT_uint32 i = 0; i<count; i++)
{
fp_ContainerObject* pContainer = static_cast<fp_ContainerObject*>(getNthCon(i));
da.xoff = pDA->xoff + pContainer->getX();
if(i == 0)
{
fl_AnnotationLayout * pAL = static_cast<fl_AnnotationLayout *>(getSectionLayout());
fp_AnnotationRun * pAR = pAL->getAnnotationRun();
if(pAR)
{
m_iLabelWidth = pAR->getWidth();
da.xoff = pDA->xoff + pContainer->getX() - m_iLabelWidth;
fp_Line * pLine = static_cast<fp_Line *>(pContainer);
da.yoff = pDA->yoff + pContainer->getY() + pLine->getAscent();
da.bDirtyRunsOnly = false;
m_iXLabel = da.xoff;
m_iYLabel = da.yoff;
pAR->draw(&da);
da.xoff = pDA->xoff + pContainer->getX();
}
}
da.yoff = pDA->yoff + pContainer->getY();
pContainer->draw(&da);
}
_drawBoundaries(pDA);
}
示例7: setPreferedPageNo
void fp_FrameContainer::setPreferedPageNo(UT_sint32 i)
{
if(m_iPreferedPageNo == i)
return;
m_iPreferedPageNo = i;
fl_FrameLayout * pFL = static_cast<fl_FrameLayout *>(getSectionLayout());
FL_DocLayout * pDL = pFL->getDocLayout();
if(pDL->isLayoutFilling())
return;
PD_Document * pDoc = pDL->getDocument();
UT_UTF8String sVal;
UT_UTF8String_sprintf(sVal,"%d",i);
const char * attr = PT_PROPS_ATTRIBUTE_NAME;
UT_UTF8String sAttVal = "pref-page:";
sAttVal += sVal.utf8_str();
pDoc->changeStruxAttsNoUpdate(pFL->getStruxDocHandle(),attr,sAttVal.utf8_str());
}
示例8: getBlock
void fp_AnnotationRun::_lookupProperties(const PP_AttrProp * pSpanAP,
const PP_AttrProp * pBlockAP,
const PP_AttrProp * pSectionAP,
GR_Graphics * pG)
{
FL_DocLayout * pLayout = getBlock()->getDocLayout();
const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,pG);
if(pFont == NULL)
{
pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,getGraphics());
UT_ASSERT_HARMLESS(pFont);
}
if (pFont != _getFont())
{
_setFont(pFont);
_setAscent(getGraphics()->getFontAscent(pFont));
_setDescent(getGraphics()->getFontDescent(pFont));
_setHeight(getGraphics()->getFontHeight(pFont));
}
}
示例9: getValue
/*!
* This method returns the value of the footnote reference (or anchor)
*/
UT_sint32 fp_FootnoteContainer::getValue(void)
{
fl_FootnoteLayout * pFL = static_cast<fl_FootnoteLayout *>(getSectionLayout());
FL_DocLayout * pDL = pFL->getDocLayout();
return pDL->getFootnoteVal(pFL->getFootnotePID());
}
示例10: GetDesktopWindow
bool AP_Win32App::_pasteFormatFromClipboard(PD_DocumentRange * pDocRange, const char * szFormat,
const char * szType, bool bWide)
{
HANDLE hData;
bool bSuccess = false;
if (!(hData = m_pClipboard->getHandleInFormat(szFormat)))
return bSuccess;
// It's a bitmap
if (g_ascii_strcasecmp(szFormat, AP_CLIPBOARD_BMP)==0)
{
HBITMAP hBitmap;
PBITMAPINFO bi;
HWND hWnd;
HDC hdc;
IE_ImpGraphic* pIEG = NULL;
FG_Graphic* pFG = NULL;
UT_Error errorCode;
UT_ByteBuf byteBuf;
IEGraphicFileType iegft = IEGFT_BMP;
XAP_Frame* pFrame;
AP_FrameData* pFrameData;
FL_DocLayout* pDocLy;
FV_View* pView;
UT_ByteBuf* bBufBMP = new UT_ByteBuf;
hBitmap = (HBITMAP)hData;
hWnd = GetDesktopWindow();
hdc = GetDC(hWnd);
// Create a BMP file from a BITMAP
bi = CreateBitmapInfoStruct(hBitmap);
CreateBMP(hWnd, *bBufBMP, bi, hBitmap,hdc);
// Since we are providing the file type, there is not need to pass the bytebuff filled up
errorCode = IE_ImpGraphic::constructImporter(*bBufBMP, iegft, &pIEG);
if(errorCode != UT_OK)
return false;
errorCode = pIEG->importGraphic(bBufBMP, &pFG);
if(errorCode != UT_OK || !pFG)
{
DELETEP(bBufBMP);
DELETEP(pIEG);
return false;
}
// sunk in importGraphic
bBufBMP = NULL;
// Insert graphic in the view
pFrame = getLastFocussedFrame();
pFrameData = (AP_FrameData*) pFrame->getFrameData();
pDocLy = pFrameData->m_pDocLayout;
pView = pDocLy->getView();
errorCode = pView->cmdInsertGraphic(pFG);
DELETEP(pIEG);
//DELETEP(pFG);
bSuccess = true;
}
else
{
unsigned char * pData = static_cast<unsigned char *>(GlobalLock(hData));
UT_DEBUGMSG(("Paste: [fmt %s %s][hdata 0x%08lx][pData 0x%08lx]\n",
szFormat, szType, hData, pData));
UT_uint32 iSize = GlobalSize(hData);
UT_uint32 iStrLen = bWide
? wcslen(reinterpret_cast<const wchar_t *>(pData)) * 2
: strlen(reinterpret_cast<const char *>(pData));
UT_uint32 iLen = UT_MIN(iSize,iStrLen);
IE_Imp * pImp = 0;
IE_Imp::constructImporter(pDocRange->m_pDoc, IE_Imp::fileTypeForSuffix(szType), &pImp, 0);
if (pImp)
{
const char * szEncoding = 0;
if (bWide)
szEncoding = XAP_EncodingManager::get_instance()->getUCS2LEName();
else
; // TODO Get code page using CF_LOCALE
pImp->pasteFromBuffer(pDocRange,pData,iLen,szEncoding);
delete pImp;
}
GlobalUnlock(hData);
bSuccess = true;
}
return bSuccess;
}
示例11: UT_return_if_fail
void fp_EmbedRun::_lookupProperties(const PP_AttrProp * pSpanAP,
const PP_AttrProp * /*pBlockAP*/,
const PP_AttrProp * /*pSectionAP*/,
GR_Graphics * pG)
{
UT_return_if_fail(pSpanAP != NULL);
UT_DEBUGMSG(("fp_EmbedRun _lookupProperties span %p \n",pSpanAP));
m_pSpanAP = pSpanAP;
m_bNeedsSnapshot = true;
pSpanAP->getAttribute("dataid", m_pszDataID);
const gchar * pszEmbedType = NULL;
pSpanAP->getProperty("embed-type", pszEmbedType);
UT_ASSERT(pszEmbedType);
UT_DEBUGMSG(("Embed Type %s \n",pszEmbedType));
bool bFontChanged = false;
// Load this into EmbedView
// LUCA: chunk of code moved up here from the bottom of the method
// 'cause we need to retrieve the font-size
const PP_AttrProp * pBlockAP = NULL;
const PP_AttrProp * pSectionAP = NULL;
FL_DocLayout * pLayout = getBlock()->getDocLayout();
if(pG == NULL && pLayout->isQuickPrint() )
{
pG = getGraphics();
if((m_iEmbedUID >= 0) && getEmbedManager())
{
getEmbedManager()->releaseEmbedView(m_iEmbedUID);
m_iEmbedUID = -1;
}
m_iEmbedUID = -1;
}
getBlockAP(pBlockAP);
const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,pG);
if(pLayout->isQuickPrint() && pG->queryProperties(GR_Graphics::DGP_PAPER))
{
if(m_iEmbedUID >= 0 )
{
getEmbedManager()->releaseEmbedView(m_iEmbedUID);
m_iEmbedUID = -1;
}
m_iEmbedUID = - 1;
m_pEmbedManager = m_pDocLayout->getQuickPrintEmbedManager(pszEmbedType);
}
else
{
m_pEmbedManager = m_pDocLayout->getEmbedManager(pszEmbedType);
}
if (pFont != _getFont())
{
_setFont(pFont);
bFontChanged = true;
}
if(pG == NULL)
pG = getGraphics();
m_iPointHeight = pG->getFontAscent(pFont) + pG->getFontDescent(pFont);
const char* pszSize = PP_evalProperty("font-size",pSpanAP,pBlockAP,pSectionAP,
getBlock()->getDocument(), true);
// LUCA: It is fundamental to do this before the EmbedView object
// gets destroyed to avoid resuscitating it
UT_sint32 iWidth,iAscent,iDescent=0;
if(m_iEmbedUID < 0)
{
PD_Document * pDoc = getBlock()->getDocument();
m_iEmbedUID = getEmbedManager()->makeEmbedView(pDoc,m_iIndexAP,m_pszDataID);
UT_DEBUGMSG((" EmbedRun %p UID is %d \n",this,m_iEmbedUID));
getEmbedManager()->initializeEmbedView(m_iEmbedUID);
getEmbedManager()->setRun (m_iEmbedUID, this);
getEmbedManager()->loadEmbedData(m_iEmbedUID);
}
getEmbedManager()->setDefaultFontSize(m_iEmbedUID,atoi(pszSize));
if (bFontChanged)
bFontChanged = getEmbedManager()->setFont(m_iEmbedUID,pFont);
if(getEmbedManager()->isDefault())
{
iWidth = _getLayoutPropFromObject("width");
iAscent = _getLayoutPropFromObject("ascent");
iDescent = _getLayoutPropFromObject("descent");
}
else
{
const char * pszHeight = NULL;
bool bFoundHeight = pSpanAP->getProperty("height", pszHeight) && !bFontChanged;
const char * pszWidth = NULL;
bool bFoundWidth = pSpanAP->getProperty("width", pszWidth) && !bFontChanged;
const char * pszAscent = NULL;
bool bFoundAscent = pSpanAP->getProperty("ascent", pszAscent);
if(!bFoundWidth || pszWidth == NULL)
{
iWidth = getEmbedManager()->getWidth(m_iEmbedUID);
}
else
//.........这里部分代码省略.........
示例12: getBlock
bool fp_FieldTOCNumRun::calculateValue(void)
{
UT_UCSChar sz_ucs_FieldValue[FPFIELD_MAX_LENGTH + 1];
//
// First Find page number.
//
pf_Frag_Strux* sdh = getBlock()->getStruxDocHandle();
PD_Document * pDoc = getBlock()->getDocument();
PT_DocPosition pos = pDoc->getStruxPosition(sdh)+1;
FL_DocLayout * pLayout = getBlock()->getDocLayout();
fl_BlockLayout * pBlockInDoc = pLayout->findBlockAtPosition(pos);
if(pBlockInDoc == NULL)
{
sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
sz_ucs_FieldValue[1] = 0;
return _setValue(sz_ucs_FieldValue);
}
fp_Line * pLine = static_cast<fp_Line *>(pBlockInDoc->getFirstContainer());
UT_sint32 kk = 0;
bool b_goodLine = false;
while (pLine && !b_goodLine)
{
for (kk = 0; kk < pLine->getNumRunsInLine(); kk++)
{
if(pLine->getRunFromIndex(kk)->getType() == FPRUN_TEXT)
{
b_goodLine = true;
break;
}
}
if (!b_goodLine)
{
pLine = static_cast<fp_Line *>(pLine->getNext());
}
}
if(pLine == NULL)
{
sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
sz_ucs_FieldValue[1] = 0;
return _setValue(sz_ucs_FieldValue);
}
fp_Page * pPage = pLine->getPage();
UT_sint32 iPage = pPage->getFieldPageNumber();
bool b_hasSetFieldPageNumber = false;
if(iPage < 0)
{
pPage->resetFieldPageNumber();
iPage = pPage->getFieldPageNumber();
b_hasSetFieldPageNumber = true;
if (iPage < 0)
{
sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
sz_ucs_FieldValue[1] = 0;
return _setValue(sz_ucs_FieldValue);
}
}
UT_String sVal("");
FootnoteType iType = getBlock()->getTOCNumType();
pLayout->getStringFromFootnoteVal(sVal,iPage,iType);
const char * psz = sVal.c_str();
if (b_hasSetFieldPageNumber)
{
// We need to set the field page number value to -1 so that we
// recalculate the page number next time we enter this function
pPage->setFieldPageNumber(-1);
}
bool bStop = false;
UT_sint32 i = 0;
sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
for(i=1; (i<FPFIELD_MAX_LENGTH) && !bStop; i++)
{
sz_ucs_FieldValue[i] = static_cast<UT_UCSChar>(*psz);
if(*psz == 0)
{
bStop = true;
}
else
{
psz++;
}
}
return _setValue(sz_ucs_FieldValue);
}