当前位置: 首页>>代码示例>>C++>>正文


C++ PD_Document类代码示例

本文整理汇总了C++中PD_Document的典型用法代码示例。如果您正苦于以下问题:C++ PD_Document类的具体用法?C++ PD_Document怎么用?C++ PD_Document使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PD_Document类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UT_return_val_if_fail

bool IE_Imp_EPUB::pasteFromBuffer(PD_DocumentRange* pDocRange,
				  const unsigned char* pData, UT_uint32 lenData, const char* /*szEncoding*/)
{
    UT_return_val_if_fail(getDoc() == pDocRange->m_pDoc,false);
    UT_return_val_if_fail(pDocRange->m_pos1 == pDocRange->m_pos2,false);

    PD_Document * newDoc = new PD_Document();
    newDoc->createRawDocument();
    IE_Imp_EPUB * pEPUBImp = new IE_Imp_EPUB(newDoc);
    //
    // Turn pData into something that can be imported by the open documenb
    // importer.
    //
    GsfInput * pInStream = gsf_input_memory_new((const guint8 *) pData,
            (gsf_off_t) lenData, FALSE);
    pEPUBImp->loadFile(newDoc, pInStream);

    newDoc->finishRawCreation();

    IE_Imp_PasteListener * pPasteListen = new IE_Imp_PasteListener(getDoc(),
            pDocRange->m_pos1, newDoc);
    newDoc->tellListener(static_cast<PL_Listener *> (pPasteListen));
    delete pPasteListen;
    delete pEPUBImp;
    UNREFP( newDoc);
    return true;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:27,代码来源:ie_imp_EPUB.cpp

示例2: UT_return_if_fail

/*!
 * Autoupdater of the dialog.
 */
void AP_Dialog_SplitCells::autoUpdateMC(UT_Worker * pTimer)
{
	UT_return_if_fail(pTimer);
	
// this is a static callback method and does not have a 'this' pointer

	AP_Dialog_SplitCells * pDialog = static_cast<AP_Dialog_SplitCells *>(pTimer->getInstanceData());

	if (pDialog->m_bDestroy_says_stopupdating != true)
	{
		FV_View * pView = 0;
		PD_Document * pDoc = NULL;

		if (XAP_Frame * pFrame = pDialog->getApp()->getLastFocussedFrame())
		{
			pView = static_cast<FV_View *>(pFrame->getCurrentView());
		}
		if (pView)
		{
			pDoc = pView->getDocument();
		}
		if (!pView || (pDoc && !pDoc->isPieceTableChanging()))
		{
			pDialog->m_bAutoUpdate_happening_now = true;
			pDialog->setAllSensitivities();
			pDialog->m_bAutoUpdate_happening_now = false;
		}
	}
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:32,代码来源:ap_Dialog_SplitCells.cpp

示例3: cairo_image_surface_create

bool AP_UnixApp::makePngPreview(const char * pszInFile, const char * pszPNGFile, UT_sint32 iWidth, UT_sint32 iHeight)
{
	cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, iWidth, iHeight);
	cairo_t *cr = cairo_create (surface);

	GR_UnixCairoAllocInfo ai(NULL, false);

	GR_CairoGraphics * pG = static_cast<GR_CairoGraphics*>(GR_UnixCairoGraphics::graphicsAllocator(ai));
	pG->setCairo(cr);
	pG->beginPaint(); // needed to avoid cairo reference loss

	UT_Error error = UT_OK;
	PD_Document * pNewDoc = new PD_Document();
	error = pNewDoc->readFromFile(pszInFile,IEFT_Unknown, NULL);

	if (error != UT_OK) 
	{
		return false;
	}
	AP_Preview_Abi * pPrevAbi = new AP_Preview_Abi(pG,iWidth,iHeight,NULL, PREVIEW_ZOOMED,pNewDoc);
	dg_DrawArgs da;
	memset(&da, 0, sizeof(da));
	da.pG = pG;
	GR_Painter * pPaint = new GR_Painter(pG);
	pPaint->clearArea(0,0,pG->tlu(iWidth),pG->tlu(iHeight));
	pPrevAbi->getView()->draw(0, &da);
	pG->endPaint();
	cairo_destroy(cr);
	DELETEP(pPaint);
	cairo_surface_write_to_png(surface, pszPNGFile);
	cairo_surface_destroy(surface);
	DELETEP(pG);
	DELETEP(pPrevAbi); // This deletes pNewDoc
	return true;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:35,代码来源:ap_UnixApp.cpp

示例4: UT_return_val_if_fail

bool AbiCollabSessionManager::_setupFrame(XAP_Frame** pFrame, PD_Document* pDoc)
{
	UT_return_val_if_fail(pFrame, false);
	
	if (*pFrame)
	{
		UT_DEBUGMSG(("Frame is non-NULL, NOT loading document in the frame\n"));
		return true;
	}
	
	// if the document doesn't belong to a frame already, then create a 
	// new frame for this session (except when the document in the current 
	// frame is not dirty, doesn't have a filename yet (which means it 
	// is a brand new empty document), and isn't being shared at the moment)
	XAP_Frame* pCurFrame = XAP_App::getApp()->getLastFocussedFrame();
	UT_return_val_if_fail(pCurFrame, false);

	bool isNewFrame = false;
	PD_Document * pFrameDoc = static_cast<PD_Document *>(pCurFrame->getCurrentDoc());
	if (pFrameDoc != pDoc)
	{
		if (!pFrameDoc || (pFrameDoc->getFilename().empty() && !pFrameDoc->isDirty() && !isInSession(pFrameDoc)))
		{
			// we can replace the document in this frame safely, as it is 
			// brand new, and doesn't have any contents yet
		}
		else
		{
			// the current frame has already a document loaded, let's create
			// a new frame
			pCurFrame = XAP_App::getApp()->newFrame();
			isNewFrame = true;
		}

	}
	else
    {
		UT_DEBUGMSG(("This document is already in the current frame; using this frame\n"));
    }
	
	UT_return_val_if_fail(pCurFrame, false);
	*pFrame = pCurFrame;
		
	// load the document in the frame; this will also delete the old document (or at least, it should)
	if (static_cast<PD_Document *>((*pFrame)->getCurrentDoc()) != pDoc)
	{
		UT_DEBUGMSG(("Loading the document in the frame\n"));
		(*pFrame)->loadDocument(pDoc);
	}
	else
    {
		UT_DEBUGMSG(("Not loading the document in the frame, as the frame already has it\n"));
    }
	
	if (isNewFrame)
		(*pFrame)->show();
	
	return true;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:59,代码来源:AbiCollabSessionManager.cpp

示例5: getView

PD_DocumentRDFHandle
AP_Dialog_RDFEditor::getRDF()
{
    FV_View* view = getView();
    PD_Document* doc = view->getDocument();
    PD_DocumentRDFHandle rdf = doc->getDocumentRDF();
    return rdf;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:8,代码来源:ap_Dialog_RDFEditor.cpp

示例6: s_abicollab_authors

bool s_abicollab_authors(AV_View* v, EV_EditMethodCallData* /*d*/)
{
	AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
	UT_return_val_if_fail(pManager, false);
	FV_View * pView = static_cast<FV_View *>(v);
	PD_Document * pDoc = pView->getDocument();
	bool b = pDoc->isShowAuthors();
	pDoc->setShowAuthors(!b);
	return true;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:10,代码来源:AbiCollab_Plugin.cpp

示例7: 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);
}
开发者ID:Distrotech,项目名称:abiword,代码行数:54,代码来源:fp_FieldTOCNum.cpp

示例8: 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);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:51,代码来源:fp_FieldListLabelRun.cpp

示例9: UT_return_val_if_fail

bool AP_Win32App::_cacheClipboardDoc(PD_DocumentRange *pDocRange)
{
	UT_return_val_if_fail(m_pClipboard && pDocRange, false);

	UT_ByteBuf buf;
	UT_Error status;;
	UT_Byte b = 0;

	IE_Exp_RTF * pExpRtf = new IE_Exp_RTF(pDocRange->m_pDoc);
	if (pExpRtf)
	{
		status = pExpRtf->copyToBuffer(pDocRange,&buf);

		if(status != UT_OK)
			return false;
			
		buf.append(&b,1);			// NULL terminate the string
		DELETEP(pExpRtf);
	}
	else
	{
		return false;
	}

	// now create a subdocument ...
	PD_Document * pDoc = new PD_Document();

	if(!pDoc)
		return false;
	
	pDoc->newDocument();
	
	PD_DocumentRange DocRange(pDoc, 2, 2);
	
	IE_Imp * pImp = 0;
	IE_Imp::constructImporter(pDoc, IE_Imp::fileTypeForSuffix(".rtf"),&pImp,0);

	if(pImp)
	{
		pImp->pasteFromBuffer(&DocRange,buf.getPointer(0),buf.getLength(),NULL);
		delete pImp;
	}
	else
	{
		return false;
	}
	
	m_pClipboard->setClipboardDoc(pDoc);
	return true;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:50,代码来源:ap_Win32App.cpp

示例10: AbiMathView_FileInsert

//
// AbiMathView_FileInsert
// -------------------
//   This is the function that we actually call to insert the MathML.
//
bool 
AbiMathView_FileInsert(AV_View* /*v*/, EV_EditMethodCallData* /*d*/)
{
	// Get the current view that the user is in.
	XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
	FV_View* pView = static_cast<FV_View*>(pFrame->getCurrentView());
	PD_Document * pDoc = static_cast<PD_Document *>(pFrame->getCurrentDoc());
	char* pNewFile = NULL;


	bool bOK = s_AskForMathMLPathname(pFrame,&pNewFile);
	
	if (!bOK || !pNewFile)
	{
		UT_DEBUGMSG(("ARRG! bOK = %d pNewFile = %s \n",bOK,pNewFile));
		return false;
	}
	UT_UTF8String sNewFile = pNewFile;

	// we own storage for pNewFile and must free it.
	FREEP(pNewFile);

	UT_DEBUGMSG(("fileInsertMathML: loading [%s]\n",sNewFile.utf8_str()));
   
	IE_Imp_MathML * pImpMathML = new IE_Imp_MathML(pDoc, pMathManager->EntityTable());
	UT_Error errorCode = pImpMathML->importFile(sNewFile.utf8_str());

	if (errorCode != UT_OK)
	{
		s_CouldNotLoadFileMessage(pFrame, sNewFile.utf8_str(), errorCode);
		DELETEP(pImpMathML);
		return false;
	}

	/* Create the data item */
	UT_uint32 uid = pDoc->getUID(UT_UniqueId::Image);
	UT_UTF8String sUID;
	UT_UTF8String_sprintf(sUID,"%d",uid);
	pDoc->createDataItem(sUID.utf8_str(), false, pImpMathML->getByteBuf(), 
                         "application/mathml+xml", NULL);

	/* Insert the MathML Object */
	PT_DocPosition pos = pView->getPoint();
	pView->cmdInsertMathML(sUID.utf8_str(),pos);

	DELETEP(pImpMathML);

	return true;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:54,代码来源:AbiMathView.cpp

示例11: 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());
}
开发者ID:Distrotech,项目名称:abiword,代码行数:18,代码来源:fp_FrameContainer.cpp

示例12: getSessionFromDocumentId

AbiCollab* AbiCollabSessionManager::getSessionFromDocumentId(const UT_UTF8String& sDocumentId)
{
	AbiCollab * pCollab = NULL;
	UT_sint32 i = 0;
	for(i = 0; i < m_vecSessions.getItemCount(); i++)
	{
		pCollab = m_vecSessions.getNthItem(i);
		if (pCollab)
		{
			PD_Document* pDoc = pCollab->getDocument();
			if (strcmp(pDoc->getDocUUIDString(), sDocumentId.utf8_str()) == 0)
			{
				return pCollab;
			}
		}
	}
	return NULL;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:18,代码来源:AbiCollabSessionManager.cpp

示例13: populate

bool AP_UnixToolbar_StyleCombo::populate(void)
{
	// clear anything that's already there
	m_vecContents.clear();

	// populate the vector

#if 1
	// HACK: for now, just hardwire it
	// NB if you change the case of the labels, it will stop working
	// unless you also change all the places where the style appears!
	m_vecContents.addItem("Normal");
	m_vecContents.addItem("Heading 1");
	m_vecContents.addItem("Heading 2");
	m_vecContents.addItem("Heading 3");
	m_vecContents.addItem("Plain Text");
	m_vecContents.addItem("Block Text");
#else

	AD_Document * pAD_Doc = m_pFrame->getCurrentDoc();
	if(!pAD_Doc)
	{
		return false;
	}
	PD_Document *pDocument = static_cast<PD_Document *>(pAD_Doc);

	// TODO: need a view/doc pointer to get this right
	// ALSO: will need to repopulate as new styles added
	// HYP:  only call this method from shared code? 
	const char * szName;
	const PD_Style * pStyle;

	for (UT_uint32 k=0; (pDocument->enumStyles(k,&szName,&pStyle)); k++)
	{
		if (pStyle && pStyle->isDisplayed()) {
			m_vecContents.addItem(szName);
		}
	}
#endif 

	return true;
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:42,代码来源:ap_UnixToolbar_StyleCombo.cpp

示例14: UT_return_val_if_fail

bool IE_Imp_OpenDocument::pasteFromBuffer(PD_DocumentRange * pDocRange,
				    const unsigned char * pData, 
				    UT_uint32 lenData, 
					  const char * /*szEncoding*/)
{
    UT_return_val_if_fail(getDoc() == pDocRange->m_pDoc,false);
    UT_return_val_if_fail(pDocRange->m_pos1 == pDocRange->m_pos2,false);
	
    PD_Document * newDoc = new PD_Document();
    newDoc->createRawDocument();
    IE_Imp_OpenDocument * pODImp = new IE_Imp_OpenDocument(newDoc);
    //
    // Turn pData into something that can be imported by the open documenb
    // importer.
    //
    GsfInput * pInStream =  gsf_input_memory_new((const guint8 *) pData, 
						 (gsf_off_t) lenData,
						 FALSE);
    pODImp->loadFile(newDoc, pInStream);
    // pInStream deleted after load.
    newDoc->finishRawCreation();

    // Handle RDF for the newdoc
    {
        PD_DocumentRDFHandle rdf = newDoc->getDocumentRDF();
        rdf->dumpModel("about to broadcast...");
        PD_DocumentRDFMutationHandle m = getDoc()->getDocumentRDF()->createMutation();
        m->add( rdf );
        m->commit();
    }
    
    //
    // OK Broadcast from the just filled source document into our current
    // doc via the paste listener
    //
    IE_Imp_PasteListener * pPasteListen = new  IE_Imp_PasteListener(getDoc(),pDocRange->m_pos1,newDoc);
    newDoc->tellListener(static_cast<PL_Listener *>(pPasteListen));
    delete pPasteListen;
    delete pODImp;
    UNREFP( newDoc);
    return true;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:42,代码来源:ie_imp_OpenDocument.cpp

示例15: gdk_pixmap_new

bool AP_UnixApp::makePngPreview(const char * pszInFile, const char * pszPNGFile, UT_sint32 iWidth, UT_sint32 iHeight)
{
	GdkPixmap*  pPixmap = gdk_pixmap_new(NULL,iWidth,iHeight,24);

	GR_UnixPixmapAllocInfo ai(pPixmap);

	GR_UnixPangoPixmapGraphics * pG = (GR_UnixPangoPixmapGraphics*) GR_UnixPangoPixmapGraphics::graphicsAllocator(ai);

	UT_Error error = UT_OK;
	PD_Document * pNewDoc = new PD_Document();
	error = pNewDoc->readFromFile(pszInFile,IEFT_Unknown, NULL);

	if (error != UT_OK) 
	{
		return false;
	}
	AP_Preview_Abi * pPrevAbi = new AP_Preview_Abi(pG,iWidth,iHeight,NULL, PREVIEW_ZOOMED,pNewDoc);
	dg_DrawArgs da;
	memset(&da, 0, sizeof(da));
	da.pG = pG;
	GR_Painter * pPaint = new GR_Painter(pG);
	pPaint->clearArea(0,0,pG->tlu(iWidth),pG->tlu(iHeight));
	pPrevAbi->getView()->draw(0, &da);
	UT_Rect r;
	r.left = 0;
	r.top = 0;
	r.width = pG->tlu(iWidth);
	r.height = pG->tlu(iHeight);
	GR_Image * pImage = pPaint->genImageFromRectangle(r);
	DELETEP(pPaint);
	static_cast<GR_UnixImage *>(pImage)->saveToPNG( pszPNGFile);
	DELETEP(pImage);
	DELETEP(pG);
	DELETEP(pPrevAbi); // This deletes pNewDoc
	return true;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:36,代码来源:ap_UnixApp.cpp


注:本文中的PD_Document类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。