本文整理汇总了C++中UT_GenericVector类的典型用法代码示例。如果您正苦于以下问题:C++ UT_GenericVector类的具体用法?C++ UT_GenericVector怎么用?C++ UT_GenericVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UT_GenericVector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: clearScreen
void fp_FrameContainer::setPage(fp_Page * pPage)
{
if(pPage && (m_pPage != NULL) && m_pPage != pPage)
{
clearScreen();
m_pPage->removeFrameContainer(this);
getSectionLayout()->markAllRunsDirty();
UT_GenericVector<fl_ContainerLayout *> AllLayouts;
AllLayouts.clear();
m_pPage->getAllLayouts(AllLayouts);
UT_sint32 i = 0;
for(i=0; i<AllLayouts.getItemCount(); i++)
{
fl_ContainerLayout * pCL = AllLayouts.getNthItem(i);
pCL->collapse();
pCL->format();
}
m_pPage->getOwningSection()->setNeedsSectionBreak(true,m_pPage);
}
m_pPage = pPage;
if(pPage)
{
getFillType()->setParent(pPage->getFillType());
}
else
{
getFillType()->setParent(NULL);
}
}
开发者ID:Distrotech,项目名称:abiword,代码行数:31,代码来源:fp_FrameContainer.cpp
示例2: UT_DEBUGMSG
void TCPAccountHandler::addBuddy(BuddyPtr pBuddy)
{
UT_DEBUGMSG(("TCPAccountHandler::addBuddy()\n"));
UT_return_if_fail(pBuddy);
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_if_fail(pManager);
if (getProperty("allow-all") == "true")
{
const UT_GenericVector<AbiCollab *> pSessions = pManager->getSessions();
for (UT_sint32 i = 0; i < pSessions.size(); i++)
{
AbiCollab* pSession = pSessions.getNthItem(i);
UT_continue_if_fail(pSession);
if (pSession->getAclAccount() != this)
continue;
pSession->appendAcl(pBuddy->getDescriptor(false).utf8_str());
}
}
AccountHandler::addBuddy(pBuddy);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:25,代码来源:TCPAccountHandler.cpp
示例3: _enableUpdates
void ABI_Collab_Import::_enableUpdates(UT_GenericVector<AV_View *> vecViews, bool bIsGlob)
{
if (bIsGlob)
{
// allow updates again
m_pDoc->enableListUpdates();
m_pDoc->updateDirtyLists();
m_pDoc->setDontImmediatelyLayout(false);
m_pDoc->endUserAtomicGlob();
}
m_pDoc->notifyPieceTableChangeEnd();
bool bDone = false;
for (UT_sint32 i = 0; i<vecViews.getItemCount(); i++)
{
FV_View * pView = static_cast<FV_View *>( vecViews.getNthItem(i));
if(pView && !bDone && pView->shouldScreenUpdateOnGeneralUpdate())
{
m_pDoc->signalListeners(PD_SIGNAL_UPDATE_LAYOUT);
bDone = true;
}
if(pView)
{
pView->fixInsertionPointCoords();
pView->setActivityMask(true);
}
}
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:28,代码来源:AbiCollab_Import.cpp
示例4: repopulate
bool AP_CocoaToolbar_StyleCombo::repopulate(void)
{
// repopulate the vector from the current document
// If ithere is one present
AD_Document * pAD_Doc = m_pFrame->getCurrentDoc();
if(!pAD_Doc)
{
return false;
}
// clear anything that's already there
m_vecContents.clear();
m_pDocument = static_cast<PD_Document *>(pAD_Doc);
UT_GenericVector<PD_Style*>* pStyles = NULL;
m_pDocument->enumStyles(pStyles);
UT_uint32 nStyles = pStyles->getItemCount();
for (UT_uint32 k = 0; k < nStyles; k++)
{
const PD_Style * pStyle;
pStyle = pStyles->getNthItem(k);
if(pStyle) {
m_vecContents.addItem(pStyle->getName());
}
}
DELETEP(pStyles);
return true;
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:32,代码来源:ap_CocoaToolbar_StyleCombo.cpp
示例5: UT_return_val_if_fail
bool XAP_App::updateClones(XAP_Frame * pFrame)
{
UT_return_val_if_fail(pFrame,false);
UT_ASSERT(pFrame->getViewNumber() > 0);
// locate vector of this frame's clones
UT_GenericVector<XAP_Frame*>* pEntry = m_hashClones.pick(pFrame->getViewKey());
UT_ASSERT_HARMLESS(pEntry);
if (pEntry)
{
UT_GenericVector<XAP_Frame*>* pvClones = pEntry;
UT_return_val_if_fail(pvClones,false);
UT_uint32 count = pvClones->getItemCount();
UT_ASSERT(count > 0);
XAP_Frame * f = NULL;
for (UT_uint32 j=0; j<count; j++)
{
f = pvClones->getNthItem(j);
UT_continue_if_fail(f);
f->updateTitle();
}
}
return true;
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:29,代码来源:xap_App.cpp
示例6: write
/**
* Write the <text:list-style> element.
*/
bool ODe_Style_List::write(GsfOutput* pODT,
const UT_UTF8String& rSpacesOffset) const {
UT_uint32 i, count;
UT_UTF8String subElementSpacesOffset;
UT_UTF8String output;
UT_GenericVector<ODe_ListLevelStyle*>* pVector;
bool ok;
UT_UTF8String_sprintf(output, "%s<text:list-style style:name=\"%s\">\n",
rSpacesOffset.utf8_str(), m_name.utf8_str());
ODe_writeUTF8String(pODT, output);
subElementSpacesOffset = rSpacesOffset;
subElementSpacesOffset += " ";
pVector = m_levelStyles.enumerate();
count = pVector->getItemCount();
for (i=0; i<count; i++) {
ok = (*pVector)[i]->write(pODT, subElementSpacesOffset);
if (!ok) {
return false;
}
}
UT_UTF8String_sprintf(output, "%s</text:list-style>\n",
rSpacesOffset.utf8_str());
ODe_writeUTF8String(pODT, output);
return true;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:34,代码来源:ODe_Style_List.cpp
示例7: _storeStyle
/**
* Store the style in this automatic styles holder. As the specified
* style get's stored here, this class takes care of freeing its memory later, so
* you don't have to worry about freeing the memory of the stored style.
*
* The style also get's it's unique name on this method.
*
* After calling this method you may end up with your style pointer pointing to
* a different style. It happens when there is already a stored style equivalent
* to the one that you sent to be stored. The one that was passed is deleted.
*/
void ODe_AutomaticStyles::_storeStyle(ODe_Style_Style*& rpStyle,
UT_GenericStringMap<ODe_Style_Style*>& rStyles,
const char* pNamingPrefix) {
UT_GenericVector<ODe_Style_Style*>* pStyleVector;
ODe_Style_Style* pStyle;
bool isDuplicated;
UT_uint32 i, count;
pStyleVector = rStyles.enumerate();
count = pStyleVector->getItemCount();
for (i=0, isDuplicated=false; i<count && isDuplicated==false; i++) {
pStyle = pStyleVector->getNthItem(i);
if ( pStyle->isEquivalentTo(*rpStyle) ) {
isDuplicated = true; // exit the loop
delete rpStyle; // We don't want a duplicated style.
rpStyle = pStyle;
}
}
if (!isDuplicated) {
// Let's name and store this style.
UT_UTF8String styleName;
UT_UTF8String_sprintf(styleName, "%s%d", pNamingPrefix, count+1);
rpStyle->setStyleName(styleName);
rStyles.insert(styleName.utf8_str(), rpStyle);
}
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:44,代码来源:ODe_AutomaticStyles.cpp
示例8:
void
AP_UnixToolbar_StyleCombo::freeStyles() {
UT_GenericVector<PangoFontDescription*> *pVec = m_mapStyles.enumerate();
for (UT_sint32 i = 0; i < pVec->size(); i++) {
pango_font_description_free(pVec->getNthItem(i));
}
delete pVec;
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:9,代码来源:ap_UnixToolbar_StyleCombo.cpp
示例9: delete
/**
* Destructor
*/
ODe_DocumentData::~ODe_DocumentData() {
UT_GenericVector<ODe_Style_MasterPage*>* pMasterPageVector;
UT_uint32 count, i;
pMasterPageVector = m_masterStyles.enumerate();
count = pMasterPageVector->getItemCount();
for (i=0; i<count; i++) {
delete (*pMasterPageVector)[i];
}
DELETEP(pMasterPageVector);
if (m_pOfficeTextTemp != NULL) {
ODe_gsf_output_close(m_pOfficeTextTemp);
}
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:18,代码来源:ODe_DocumentData.cpp
示例10: _disableUpdates
void ABI_Collab_Import::_disableUpdates(UT_GenericVector<AV_View *>& vecViews, bool bIsGlob)
{
m_pDoc->getAllViews(&vecViews);
for (UT_sint32 i=0; i < vecViews.getItemCount(); i++)
{
vecViews.getNthItem(i)->setActivityMask(false);
}
m_pDoc->notifyPieceTableChangeStart();
if (bIsGlob)
{
// lock out all updates while processing the glob
m_pDoc->disableListUpdates();
m_pDoc->setDontImmediatelyLayout(true);
m_pDoc->beginUserAtomicGlob();
}
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:18,代码来源:AbiCollab_Import.cpp
示例11: write
/**
* Writes <office:automatic-styles> element.
*/
void ODe_AutomaticStyles::write(GsfOutput* pContentStream) const {
UT_GenericVector<ODe_Style_Style*>* pStyleVector;
UT_GenericVector<ODe_Style_PageLayout*>* pPageLayoutVector;
UT_GenericVector<ODe_Style_List*>* pListStyleVector;
UT_uint32 i, count;
UT_UTF8String spacesOffset = " ";
ODe_writeUTF8String(pContentStream, " <office:automatic-styles>\n");
#define ODE_WRITE_STYLES(styleMap) \
pStyleVector = styleMap.enumerate(); \
count = pStyleVector->getItemCount(); \
for (i=0; i<count; i++) { \
(*pStyleVector)[i]->write(pContentStream, spacesOffset); \
} \
DELETEP(pStyleVector);
ODE_WRITE_STYLES (m_textStyles);
ODE_WRITE_STYLES (m_paragraphStyles);
ODE_WRITE_STYLES (m_sectionStyles);
ODE_WRITE_STYLES (m_tableStyles);
ODE_WRITE_STYLES (m_tableColumnStyles);
ODE_WRITE_STYLES (m_tableRowStyles);
ODE_WRITE_STYLES (m_tableCellStyles);
ODE_WRITE_STYLES (m_graphicStyles);
#undef ODE_WRITE_STYLES
pPageLayoutVector = m_pageLayouts.enumerate();
count = pPageLayoutVector->getItemCount();
for (i=0; i<count; i++) {
(*pPageLayoutVector)[i]->write(pContentStream, spacesOffset);
}
pListStyleVector = m_listStyles.enumerate();
count = pListStyleVector->getItemCount();
for (i=0; i<count; i++) {
(*pListStyleVector)[i]->write(pContentStream, spacesOffset);
}
ODe_writeUTF8String(pContentStream, " </office:automatic-styles>\n");
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:47,代码来源:ODe_AutomaticStyles.cpp
示例12: signal
/*!
* Implements the signal() method of the Document listener class.
*/
bool AbiCollabService_Export::signal(UT_uint32 iSignal)
{
if((iSignal == PD_SIGNAL_SAVEDOC) && m_pDoc->isDirty())
{
bool bSavedRemotely = ServiceAccountHandler::m_saveInterceptor.save(m_pDoc);
if(bSavedRemotely)
{
UT_GenericVector<AV_View *> vecViews;
m_pDoc->getAllViews(&vecViews);
AV_View * pView = vecViews.getNthItem(0);
XAP_Frame * pFrame = static_cast<XAP_Frame *> (pView->getParentData());
if (pFrame->getViewNumber() > 0)
XAP_App::getApp()->updateClones(pFrame);
}
return bSavedRemotely;
}
return true;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:22,代码来源:AbiCollabService_Export.cpp
示例13: XAP_populateComboBoxWithIndex
void XAP_populateComboBoxWithIndex(GtkComboBox * combo,
const UT_GenericVector<const char*> & vec)
{
GtkListStore *store = GTK_LIST_STORE(gtk_combo_box_get_model(combo));
GtkTreeIter iter;
for(UT_sint32 i = 0; i < vec.getItemCount(); i++) {
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, vec[i], 1, i, -1);
}
}
开发者ID:Distrotech,项目名称:abiword,代码行数:11,代码来源:xap_GtkComboBoxHelpers.cpp
示例14: UT_ASSERT
bool fl_FrameLayout::doclistener_changeStrux(const PX_ChangeRecord_StruxChange * pcrxc)
{
UT_ASSERT(pcrxc->getType()==PX_ChangeRecord::PXT_ChangeStrux);
fp_FrameContainer * pFrameC = static_cast<fp_FrameContainer *>(getFirstContainer());
UT_GenericVector<fl_ContainerLayout *> AllLayouts;
AllLayouts.clear();
fp_Page * pPage = NULL;
UT_sint32 i = 0;
if(pFrameC)
{
pPage = pFrameC->getPage();
UT_return_val_if_fail(pPage, false);
pPage->getAllLayouts(AllLayouts);
for(i=0; i< AllLayouts.getItemCount();i++)
{
fl_ContainerLayout * pCL = AllLayouts.getNthItem(i);
pCL->collapse();
}
}
setAttrPropIndex(pcrxc->getIndexAP());
collapse();
lookupProperties();
format();
for(i=0; i< AllLayouts.getItemCount();i++)
{
fl_ContainerLayout * pCL = AllLayouts.getNthItem(i);
pCL->format();
xxx_UT_DEBUGMSG(("Format block %x \n",pBL));
pCL->markAllRunsDirty();
}
getDocSectionLayout()->markAllRunsDirty();
return true;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:33,代码来源:fl_FrameLayout.cpp
示例15: populate
bool AP_CocoaToolbar_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
// 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?
UT_GenericVector<const PD_Styles*> pStyles = NULL;
pDoc->enumStyles(pStyles);
UT_uint32 nStyles = pStyles->getItemCount();
for (UT_uint32 k = 0; k < nStyles; k++)
{
const PD_Style * pStyle;
pStyle = pStyles->getNthItem(k);
if(pStyle) {
m_vecContents.addItem(pStyle->getName());
}
}
DELETEP(pStyles);
#endif
return true;
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:39,代码来源:ap_CocoaToolbar_StyleCombo.cpp
示例16: UT_return_val_if_fail
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;
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:75,代码来源:fl_ContainerLayout.cpp
示例17: UT_UNUSED
bool fl_FrameLayout::doclistener_deleteStrux(const PX_ChangeRecord_Strux * pcrx)
{
UT_UNUSED(pcrx);
UT_ASSERT(pcrx->getType()==PX_ChangeRecord::PXT_DeleteStrux);
#if 0
fp_FrameContainer * pFrameC = getFirstContainer();
if(pFrameC && pFrameC->getPage())
{
pFrameC->getPage()->markDirtyOverlappingRuns(pFrameC);
}
#endif
fp_FrameContainer * pFrameC = static_cast<fp_FrameContainer *>(getFirstContainer());
UT_GenericVector<fl_BlockLayout *> vecBlocks;
pFrameC->getBlocksAroundFrame(vecBlocks);
UT_sint32 i = 0;
for(i=0; i< vecBlocks.getItemCount();i++)
{
fl_BlockLayout * pBL = vecBlocks.getNthItem(i);
pBL->collapse();
xxx_UT_DEBUGMSG(("Collapse block %x \n",pBL));
}
//
// Remove all remaining structures
//
collapse();
// UT_ASSERT(pcrx->getStruxType()== PTX_SectionFrame);
//
fl_ContainerLayout * pCL = getPrev();
myContainingLayout()->remove(this);
UT_DEBUGMSG(("Unlinking frame Layout %p \n",this));
//
// Remove from the list of frames in the previous block
//
while(pCL && pCL->getContainerType() != FL_CONTAINER_BLOCK)
{
pCL = pCL->getPrev();
}
if(pCL == NULL)
{
UT_DEBUGMSG(("No BlockLayout before this frame! \n"));
return false;
}
fl_BlockLayout * pBL = static_cast<fl_BlockLayout *>(pCL);
bool bFound = false;
for(i=0; i<pBL->getNumFrames() && !bFound;i++)
{
fl_FrameLayout * pF = pBL->getNthFrameLayout(i);
if(pF == this)
{
bFound = true;
}
}
if(bFound)
{
pBL->removeFrame(this);
}
else
{
UT_DEBUGMSG(("Whoops! not Frame found. Try ahead \n"));
pCL = this;
while(pCL && pCL->getContainerType() != FL_CONTAINER_BLOCK)
{
pCL = pCL->getNext();
}
if(pCL == NULL)
{
UT_DEBUGMSG(("No BlockLayout before this frame! \n"));
return false;
}
pBL = static_cast<fl_BlockLayout *>(pCL);
pBL->removeFrame(this);
}
for(i=0; i< vecBlocks.getItemCount();i++)
{
pBL = vecBlocks.getNthItem(i);
pBL->format();
xxx_UT_DEBUGMSG(("format block %x \n",pBL));
}
delete this; // TODO whoa! this construct is VERY dangerous.
return true;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:84,代码来源:fl_FrameLayout.cpp
示例18: setDocumentHandles
void AbiCollabSessionManager::setDocumentHandles(BuddyPtr pBuddy, const UT_GenericVector<DocHandle*>& vDocHandles)
{
UT_DEBUGMSG(("Setting document handles for buddy %s\n", pBuddy->getDescriptor().utf8_str()));
UT_return_if_fail(pBuddy);
// create a copy of the current document handles, which
// we'll use to determine which document handles do not exist anymore
std::vector<DocHandle*> oldDocHandles(pBuddy->getDocHandles());
for (UT_sint32 i = 0; i < vDocHandles.size(); i++)
{
DocHandle* pDocHandle = vDocHandles.getNthItem(i);
UT_continue_if_fail(pDocHandle);
// sanity checking
UT_UTF8String sId = pDocHandle->getSessionId();
UT_continue_if_fail(sId.size() > 0);
// construct a nice document name
UT_UTF8String sDocumentName = pDocHandle->getName();
if (sDocumentName.size() == 0)
{
// this document has no name yet; give it an untitled name
const XAP_StringSet * pSS = XAP_App::getApp()->getStringSet();
std::string sUntitled;
pSS->getValueUTF8(XAP_STRING_ID_UntitledDocument, sUntitled);
UT_UTF8String_sprintf(sDocumentName, sUntitled.c_str(), 0);
// TODO: as should append a number here, but at the moment
// XAP_Frame::m_iUntitled is not accessible from here
}
// check to see if we already have a document handle with this ID
DocHandle* pCurDocHandle = pBuddy->getDocHandle(sId);
if (!pCurDocHandle)
{
// Ok, all set. Get the buddy from the AccountHandler, and assign
// the document handle to the buddy
DocHandle * pNewDocHandle = new DocHandle(sId, sDocumentName);
pBuddy->addDocHandle(pNewDocHandle);
UT_DEBUGMSG(("Added DocHandle (%s) to buddy (%s)\n", sId.utf8_str(), pBuddy->getDescription().utf8_str()));
// signal that a buddy has a new session
AccountBuddyAddDocumentEvent event(pNewDocHandle);
signal(event, pBuddy);
}
else
{
UT_DEBUGMSG(("Found an existing DocHandle (%s) for buddy (%s)\n", sId.utf8_str(), pBuddy->getDescription().utf8_str()));
// we already have a handle for this document, remove it from the old document handles copy
for (std::vector<DocHandle*>::iterator it = oldDocHandles.begin(); it != oldDocHandles.end(); it++)
{
DocHandle* pOldDocHandle = *it;
if (pCurDocHandle == pOldDocHandle)
{
oldDocHandles.erase(it);
break;
}
}
}
}
// every document that is still in the old document handles list does not
// exist anymore, so let's delete it
std::vector<DocHandle*>::iterator it = oldDocHandles.begin();
while (it != oldDocHandles.end())
{
DocHandle* pDocHandle = *it;
UT_continue_if_fail(pDocHandle);
// TODO: when we are a part of this session, then handle that properly
UT_DEBUGMSG(("Purging existing DocHandle (%s) for buddy (%s)\n", pDocHandle->getSessionId().utf8_str(), pBuddy->getDescription().utf8_str()));
UT_UTF8String pDestroyedSessionId = pDocHandle->getSessionId();
pBuddy->destroyDocHandle(pDestroyedSessionId);
CloseSessionEvent event(pDestroyedSessionId);
signal(event, pBuddy);
it = oldDocHandles.erase(it);
}
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:83,代码来源:AbiCollabSessionManager.cpp
示例19: TFTEST_MAIN
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include "tf_test.h"
#include "ut_vector.h"
TFTEST_MAIN("UT_GenericVector basics")
{
UT_GenericVector<const char *> v;
TFPASS(v.getItemCount() == 0);
v.addItem("foo");
TFPASS(v.getItemCount() == 1);
v.addItem("bar");
TFPASS(v.getItemCount() == 2);
v.addItem("baz");
TFPASS(v.getItemCount() == 3);
TFPASS(strcmp(v[1], "bar") == 0);
TFPASS(strcmp(v.getNthItem(2), "baz") == 0);
TFPASS(strcmp(v.getFirstItem(), "foo") == 0);
TFPASS(strcmp(v.getLastItem(), "baz") == 0);
TFPASS(strcmp(v.back(), "baz") == 0);
开发者ID:Distrotech,项目名称:abiword,代码行数:31,代码来源:ut_vector.t.cpp
示例20: getBlocksAroundFrame
/*!
* Fill the supplied vector with a list of the blocks whose lines are affected
* by the Frame.
*/
void fp_FrameContainer::getBlocksAroundFrame(UT_GenericVector<fl_BlockLayout *> & vecBlocks)
{
fp_Page * pPage = getPage();
if(pPage == NULL)
{
return;
}
UT_sint32 iColLeader = 0;
fp_Column * pCol = NULL;
fl_BlockLayout * pCurBlock = NULL;
fp_Line * pCurLine = NULL;
fp_Container * pCurCon = NULL;
if(pPage->countColumnLeaders() == 0)
{
UT_sint32 iPage = getPreferedPageNo();
if(iPage >0)
setPreferedPageNo(iPage-1);
return;
}
for(iColLeader = 0; iColLeader < pPage->countColumnLeaders(); iColLeader++)
{
pCol = pPage->getNthColumnLeader(iColLeader);
while(pCol)
{
UT_sint32 i = 0;
UT_sint32 iYCol = pCol->getY(); // Vertical position relative to page.
for(i=0; i< pCol->countCons(); i++)
{
pCurCon = static_cast<fp_Container *>(pCol->getNthCon(i));
if(pCurCon->getContainerType() == FP_CONTAINER_LINE)
{
pCurLine = static_cast<fp_Line *>(pCurCon);
UT_sint32 iYLine = iYCol + pCurLine->getY();
xxx_UT_DEBUGMSG(("iYLine %d FullY %d FullHeight %d \n",iYLine,getFullY(),getFullHeight()));
if((iYLine + pCurLine->getHeight() > getFullY()) && (iYLine < (getFullY() + getFullHeight())))
{
//
// Line overlaps frame in Height. Add it's block to the vector.
//
if(pCurLine->getBlock() != pCurBlock)
{
pCurBlock = pCurLine->getBlock();
vecBlocks.addItem(pCurBlock);
xxx_UT_DEBUGMSG(("Add Block %x to vector \n",pCurBlock));
}
}
}
}
pCol = pCol->getFollower();
}
}
if(vecBlocks.getItemCount() == 0)
{
pCol = pPage->getNthColumnLeader(0);
fp_Container * pCon = pCol->getFirstContainer();
fl_BlockLayout * pB = NULL;
if(pCon && pCon->getContainerType() == FP_CONTAINER_LINE)
{
pB = static_cast<fp_Line *>(pCon)->getBlock();
}
else if(pCon)
{
fl_ContainerLayout * pCL = static_cast<fl_ContainerLayout *>(pCon->getSectionLayout());
pB = pCL->getNextBlockInDocument();
}
if(pB != NULL)
vecBlocks.addItem(pB);
}
}
开发者ID:Distrotech,项目名称:abiword,代码行数:74,代码来源:fp_FrameContainer.cpp
注:本文中的UT_GenericVector类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论