void OXMLi_ListenerState_Styles::endElement (OXMLi_EndElementRequest * rqst) { UT_return_if_fail( _error_if_fail(rqst != NULL) ); if (nameMatches(rqst->pName, NS_W_KEY, "docDefaults") || nameMatches(rqst->pName, NS_W_KEY, "style")) { UT_return_if_fail(_error_if_fail(m_pCurrentStyle != NULL)); OXML_Document * doc = OXML_Document::getInstance(); UT_return_if_fail( _error_if_fail(doc != NULL) ); OXML_SharedStyle styl(m_pCurrentStyle); doc->addStyle(styl); m_pCurrentStyle = NULL; rqst->handled = true; } else if (nameMatches(rqst->pName, NS_W_KEY, "rPr") || nameMatches(rqst->pName, NS_W_KEY, "pPr") || nameMatches(rqst->pName, NS_W_KEY, "tblPr") || nameMatches(rqst->pName, NS_W_KEY, "trPr") || nameMatches(rqst->pName, NS_W_KEY, "tcPr")) { //Retrieve the formatting collected by the Common listener state. OXML_SharedElement dummy = rqst->stck->top(); const gchar ** props = dummy->getProperties(); if (props != NULL) { //Pass the retrieved properties to a new style object UT_return_if_fail(_error_if_fail(UT_OK == m_pCurrentStyle->appendProperties(props))); } rqst->stck->pop(); rqst->handled = !nameMatches(rqst->pName, NS_W_KEY, "tblPr") && !nameMatches(rqst->pName, NS_W_KEY, "trPr") && !nameMatches(rqst->pName, NS_W_KEY, "tcPr"); } }
void OXMLi_ListenerState_Numbering::endElement (OXMLi_EndElementRequest * rqst) { if ( nameMatches(rqst->pName, NS_W_KEY, "numbering") || nameMatches(rqst->pName, NS_W_KEY, "abstractNum") || nameMatches(rqst->pName, NS_W_KEY, "multiLevelType") || nameMatches(rqst->pName, NS_W_KEY, "name") || nameMatches(rqst->pName, NS_W_KEY, "nsid") || nameMatches(rqst->pName, NS_W_KEY, "numStyleLink") || nameMatches(rqst->pName, NS_W_KEY, "styleLink") || nameMatches(rqst->pName, NS_W_KEY, "tmpl") || nameMatches(rqst->pName, NS_W_KEY, "isLgl") || nameMatches(rqst->pName, NS_W_KEY, "legacy") || nameMatches(rqst->pName, NS_W_KEY, "lvlJc") || nameMatches(rqst->pName, NS_W_KEY, "lvlPicBulletId") || nameMatches(rqst->pName, NS_W_KEY, "lvlRestart") || nameMatches(rqst->pName, NS_W_KEY, "lvlText") || nameMatches(rqst->pName, NS_W_KEY, "numFmt") || nameMatches(rqst->pName, NS_W_KEY, "start") || nameMatches(rqst->pName, NS_W_KEY, "suff") || nameMatches(rqst->pName, NS_W_KEY, "abstractNumId") ) { //TODO: add functionality here rqst->handled = true; } else if(nameMatches(rqst->pName, NS_W_KEY, "lvl")) { OXML_Document * doc = OXML_Document::getInstance(); if(!doc) { doc = OXML_Document::getNewInstance(); } OXML_SharedList sharedList(m_currentList); doc->addList(sharedList); m_currentList = NULL; rqst->handled = true; } else if(nameMatches(rqst->pName, NS_W_KEY, "num")) { m_currentNumId.clear(); //set it to empty string rqst->handled = true; } else if(nameMatches(rqst->pName, NS_W_KEY, "pPr") || nameMatches(rqst->pName, NS_W_KEY, "rPr")) { if(rqst->stck->empty()) { rqst->handled = false; rqst->valid = false; return; } OXML_SharedElement dummy = rqst->stck->top(); if(m_currentList) { m_currentList->setAttributes(dummy->getAttributes()); m_currentList->setProperties(dummy->getProperties()); } rqst->stck->pop(); //remove the dummy element rqst->handled = true; } }