Пример #1
0
//========================================================
// Name   : AppendChild
// Desc   : add node
// Param  :
// Return : 
//--------------------------------------------------------
// Coder    Date                      Desc
// bro      2002-10-29
//========================================================
XNode *XNode::AppendChild( const char* name, const char* value )
{
	XNode *p = new XNode;
	ASSERT(name);
	p->m_sName = CString(name);
	if ( value == NULL )
		p->m_sValue = "";
	else
		p->m_sValue = value;
	return AppendChild( p );
}
Пример #2
0
static void AddGUID(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent,const GUID& g)
{
	HRESULT hr;
	IXMLDOMElementPtr guid;
	std::wstring guidstr;

	CreateElement(pDoc,L"guid",&guid);
	guid_to_string(g,guidstr);
	AddAttribute(pDoc,L"name",guidstr.c_str(),guid);
	return AppendChild(guid,pParent);
}
Пример #3
0
static void CreateDeviceList(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent,const DEVICELIST& l)
{
	HRESULT hr;
	for(size_t n=0;n<l.size();n++)
	{
		IXMLDOMElementPtr device;
		CreateElement(pDoc,L"device",&device);
		AddDevice(pDoc,device,l[n]);
		AppendChild(device,pParent);
	}
}
Пример #4
0
static void AddBDATopology(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent,const BDATOPOLOGY& t)
{
	HRESULT hr;
	IXMLDOMElementPtr bda_template_connection, bdanode_descriptor, bda_node_properties, bda_node_types, bda_pin_types, bda_node_methods, bda_node_events;

	CreateElement(pDoc,L"ksproperty_bda_template_connections",&bda_template_connection);
	CreateElement(pDoc,L"ksproperty_bda_node_descriptors",&bdanode_descriptor);
	CreateElement(pDoc,L"ksproperty_bda_node_properties",&bda_node_properties);
	CreateElement(pDoc,L"ksproperty_bda_node_types",&bda_node_types);
	CreateElement(pDoc,L"ksproperty_bda_pin_types",&bda_pin_types);
	CreateElement(pDoc,L"ksproperty_bda_node_methods",&bda_node_methods);
	CreateElement(pDoc,L"ksproperty_bda_node_events",&bda_node_events);

	for(size_t n = 0;n<t.bda_template_connection.size();n++)
	{
		AddBDATemplateConnection(pDoc,bda_template_connection,t.bda_template_connection[n]);
	}

	for(size_t n = 0;n<t.bdanode_descriptor.size();n++)
	{
		AddBDANodeDescriptor(pDoc,bdanode_descriptor,t.bdanode_descriptor[n]);
	}

	for(std::map<unsigned long,std::vector<GUID> >::const_iterator it=t.bda_node_properties.begin();it!=t.bda_node_properties.end();it++)
	{
		AddGUIDList(pDoc,bda_node_properties,it);
	}

	for(size_t n = 0;n<t.bda_node_types.size();n++)
	{
		AddULong(pDoc,bda_node_types,t.bda_node_types[n]);
	}

	for(size_t n = 0;n<t.bda_pin_types.size();n++)
	{
		AddULong(pDoc,bda_pin_types,t.bda_pin_types[n]);
	}

	for(std::map<unsigned long,std::vector<GUID> >::const_iterator it=t.bda_node_methods.begin();it!=t.bda_node_methods.end();it++)
	{
		AddGUIDList(pDoc,bda_node_methods,it);
	}

	for(std::map<unsigned long,std::vector<GUID> >::const_iterator it=t.bda_node_events.begin();it!=t.bda_node_events.end();it++)
	{
		AddGUIDList(pDoc,bda_node_events,it);
	}

	AppendChild(bda_template_connection,pParent);
	AppendChild(bdanode_descriptor,pParent);
	AppendChild(bda_node_properties,pParent);
	AppendChild(bda_node_types,pParent);
	AppendChild(bda_pin_types,pParent);
	AppendChild(bda_node_methods,pParent);
	AppendChild(bda_node_events,pParent);
}
NS_IMETHODIMP
nsHTMLTableSectionElement::InsertRow(PRInt32 aIndex,
                                     nsIDOMHTMLElement** aValue)
{
  *aValue = nsnull;

  if (aIndex < -1) {
    return NS_ERROR_DOM_INDEX_SIZE_ERR;
  }

  nsCOMPtr<nsIDOMHTMLCollection> rows;
  GetRows(getter_AddRefs(rows));

  PRUint32 rowCount;
  rows->GetLength(&rowCount);

  if (aIndex > (PRInt32)rowCount) {
    return NS_ERROR_DOM_INDEX_SIZE_ERR;
  }

  PRBool doInsert = (aIndex < PRInt32(rowCount)) && (aIndex != -1);

  // create the row
  nsCOMPtr<nsINodeInfo> nodeInfo;
  nsContentUtils::NameChanged(mNodeInfo, nsGkAtoms::tr,
                              getter_AddRefs(nodeInfo));

  nsCOMPtr<nsIContent> rowContent = NS_NewHTMLTableRowElement(nodeInfo);
  if (!nodeInfo) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  nsCOMPtr<nsIDOMNode> rowNode(do_QueryInterface(rowContent));
  NS_ASSERTION(rowNode, "Should implement nsIDOMNode!");

  nsCOMPtr<nsIDOMNode> retChild;

  nsresult rv;
  if (doInsert) {
    nsCOMPtr<nsIDOMNode> refRow;
    rows->Item(aIndex, getter_AddRefs(refRow));

    rv = InsertBefore(rowNode, refRow, getter_AddRefs(retChild));
  } else {
    rv = AppendChild(rowNode, getter_AddRefs(retChild));
  }

  if (retChild) {
    CallQueryInterface(retChild, aValue);
  }

  return NS_OK;
}
Пример #6
0
static void AddGUIDList(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent,std::map<unsigned long,std::vector<GUID> >::const_iterator& l)
{
	HRESULT hr;
	IXMLDOMElementPtr node;

	CreateElement(pDoc,L"node",&node);
	AddAttribute(pDoc,L"id",_variant_t(l->first),node);

	for(size_t n=0;n<l->second.size();n++)
	{
		IXMLDOMElementPtr guid;
		std::wstring guidstr;

		CreateElement(pDoc,L"guid",&guid);
		guid_to_string(l->second[n],guidstr);
		AddAttribute(pDoc,L"name",guidstr.c_str(),guid);
		AppendChild(guid,node);
	}

	return AppendChild(node,pParent);
}
Пример #7
0
static void AddTopologyConnection(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent, const KSTOPOLOGY_CONNECTION& t)
{
	HRESULT hr;
	IXMLDOMElementPtr connection;

	CreateElement(pDoc,L"connection",&connection);
	AddAttribute(pDoc,L"FromNode",_variant_t(t.FromNode),connection);
	AddAttribute(pDoc,L"FromNodePin",_variant_t(t.FromNodePin),connection);
	AddAttribute(pDoc,L"ToNode",_variant_t(t.ToNode),connection);
	AddAttribute(pDoc,L"ToNodePin",_variant_t(t.ToNodePin),connection);
	return AppendChild(connection,pParent);
}
Пример #8
0
static void AddBDATemplateConnection(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent, const BDA_TEMPLATE_CONNECTION& t)
{
	HRESULT hr;
	IXMLDOMElementPtr connection;

	CreateElement(pDoc,L"connection",&connection);
	AddAttribute(pDoc,L"FromNodeType",_variant_t(t.FromNodeType),connection);
	AddAttribute(pDoc,L"FromNodePinType",_variant_t(t.FromNodePinType),connection);
	AddAttribute(pDoc,L"ToNodeType",_variant_t(t.ToNodeType),connection);
	AddAttribute(pDoc,L"ToNodePinType",_variant_t(t.ToNodePinType),connection);
	return AppendChild(connection,pParent);
}
Пример #9
0
static void AddKSIDENTIFIER(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent,const KSIDENTIFIER& v)
{
	HRESULT hr;
	IXMLDOMElementPtr element;
	std::wstring guid;

	CreateElement(pDoc,L"ksidentifier",&element);
	guid_to_string(v.Set,guid);
	AddAttribute(pDoc,L"Set",guid.c_str(),element);
	AddAttribute(pDoc,L"Id",_variant_t(v.Id),element);
	AddAttribute(pDoc,L"Flags",_variant_t(v.Flags),element);
	return AppendChild(element,pParent);
}
Пример #10
0
void CTaskModel::AddPrerequisite(unsigned __int64 prereq)
{
	//AddPrerequisite(prereq, true);
	MSXML2::IXMLDOMNode *pNode = 0;
	HRESULT hr = AppendChild(&pNode, PREREQUISITE);
	if(hr == S_OK && pNode)
	{
		StringBuffer temp(32);
		XMLHelper::SetAttribute(pNode, TASKID, ModelUtils::toHexString(prereq, temp));
		pNode->Release();
	}
	//TODO: notify?..
}
void
nsXULTextFieldAccessible::CacheChildren()
{
  // Create child accessibles for native anonymous content of underlying HTML
  // input element.
  nsCOMPtr<nsIContent> inputContent(GetInputField());
  if (!inputContent)
    return;

  nsAccTreeWalker walker(mWeakShell, inputContent, PR_FALSE);

  nsAccessible* child = nsnull;
  while ((child = walker.NextChild()) && AppendChild(child));
}
Пример #12
0
Core::Element* ElementTabSet::GetChildByTag(const Rocket::Core::String& tag)
{
	// Look for the existing child
	for (int i = 0; i < GetNumChildren(); i++)
	{
		if (GetChild(i)->GetTagName() == tag)
			return GetChild(i);
	}

	// If it doesn't exist, create it
	Core::Element* element = Core::Factory::InstanceElement(this, "*", tag, Rocket::Core::XMLAttributes());
	AppendChild(element);
	element->RemoveReference();
	return element;
}
Пример #13
0
static void AddBDANodeDescriptor(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent, const BDANODE_DESCRIPTOR& t)
{
	HRESULT hr;
	IXMLDOMElementPtr descriptor;
	std::wstring guid;

	CreateElement(pDoc,L"descriptor",&descriptor);
	AddAttribute(pDoc,L"ulBdaNodeType",_variant_t(t.ulBdaNodeType),descriptor);
	guid_to_string(t.guidFunction,guid);
	AddAttribute(pDoc,L"guidFunction",guid.c_str(),descriptor);
	guid_to_string(t.guidName,guid);
	AddAttribute(pDoc,L"guidName",guid.c_str(),descriptor);

	return AppendChild(descriptor,pParent);
}
Пример #14
0
static void AddPinTopology(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent, const PINTOPOLOGY& t)
{
	HRESULT hr;
	IXMLDOMElementPtr pins;

	AddAttribute(pDoc,L"ksproperty_pin_ctypes",_variant_t(t.pin_ctypes),pParent);
	CreateElement(pDoc,L"pins",&pins);

	for(size_t n=0;n<t.pininfo.size();n++)
	{
		AddPinInfo(pDoc,pins,t.pininfo[n]);
	}

	return AppendChild(pins,pParent);
}
Пример #15
0
void CWorldEditor::CreateMap(uint32 mapId)
{
	auto sceneRoot = m_mainViewport->GetSceneRoot();

	//Create skybox
	{
		auto skyTexture = Palleon::CTextureLoader::CreateCubeTextureFromFile("./data/global/skybox.dds");
		auto skyBox = Palleon::CCubeMesh::Create();
		skyBox->SetIsPeggedToOrigin(true);
		skyBox->SetScale(CVector3(50, 50, 50));
		skyBox->GetMaterial()->SetCullingMode(Palleon::CULLING_CCW);
		skyBox->GetMaterial()->SetTexture(0, skyTexture);
		skyBox->GetMaterial()->SetTextureCoordSource(0, Palleon::TEXTURE_COORD_CUBE_POS);
		sceneRoot->AppendChild(skyBox);
	}

	{
		auto mapLayoutPath = CFileManager::GetResourcePath(mapId);
		auto mapLayout = std::make_shared<CMapLayout>();
		auto mapStream = Framework::CreateInputStdStream(mapLayoutPath.native());
		mapLayout->Read(mapStream);

		auto map = std::make_shared<CUmbralMap>(mapLayout);
		sceneRoot->AppendChild(map);
	}
#if 0
	{
		auto mapLayoutPath = CFileManager::GetResourcePath(0x29D90002);
		auto mapLayout = std::make_shared<CMapLayout>();
		mapLayout->Read(Framework::CreateInputStdStream(mapLayoutPath.native()));

		auto map = std::make_shared<CUmbralMap>(mapLayout);
		sceneRoot->AppendChild(map);
	}
#endif
}
Пример #16
0
//========================================================
// Name   : _CopyBranch
// Desc   : recursive internal copy branch 
// Param  :
// Return : 
//--------------------------------------------------------
// Coder    Date                      Desc
// bro      2002-10-29
//========================================================
void _tagXMLNode::_CopyBranch( LPXNode node )
{
	CopyNode( node );

	for( unsigned int i = 0 ; i < node->childs.size(); i++)
	{
		LPXNode child = node->childs[i];
		if( child )
		{
			LPXNode mychild = new XNode;
			mychild->CopyNode( child );
			AppendChild( mychild );

			mychild->_CopyBranch( child );
		}
	}
}
Пример #17
0
static void AddKSDATARANGE(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent,LPCWSTR name,const KSDATARANGE& v)
{
	HRESULT hr;
	IXMLDOMElementPtr element;
	std::wstring guid;
	CreateElement(pDoc,name,&element);
	AddAttribute(pDoc,L"FormatSize",_variant_t(v.FormatSize),element);
	AddAttribute(pDoc,L"Flags",_variant_t(v.Flags),element);
	AddAttribute(pDoc,L"SampleSize",_variant_t(v.SampleSize),element);
	AddAttribute(pDoc,L"Reserved",_variant_t(v.Reserved),element);
	guid_to_string(v.MajorFormat,guid);
	AddAttribute(pDoc,L"MajorFormat",guid.c_str(),element);
	guid_to_string(v.SubFormat,guid);
	AddAttribute(pDoc,L"SubFormat",guid.c_str(),element);
	guid_to_string(v.Specifier,guid);
	AddAttribute(pDoc,L"Specifier",guid.c_str(),element);
	return AppendChild(element,pParent);
}
void
nsXULColorPickerAccessible::CacheChildren()
{
  nsAccTreeWalker walker(mWeakShell, mContent, PR_TRUE);

  nsRefPtr<nsAccessible> child;
  while ((child = walker.GetNextChild())) {
    // XXX: do not call nsAccessible::GetRole() while accessible not in tree
    // (bug 574588).
    PRUint32 role = nsAccUtils::Role(child);

    // Get an accessbile for menupopup or panel elements.
    if (role == nsIAccessibleRole::ROLE_ALERT) {
      AppendChild(child);
      return;
    }
  }
}
Пример #19
0
void CWorldEditor::CreateActors()
{
	//WIP
#if 0
	auto sceneRoot = m_mainViewport->GetSceneRoot();

	Framework::CStdStream stream("D:\\Projects\\SeventhUmbral\\data\\ffxivd_actors.xml", "rb");
	CActorDatabase actorDatabase = CActorDatabase::CreateFromXml(stream);

	for(const auto& actorDef : actorDatabase.GetActors())
	{
		auto actor = std::make_shared<CUmbralActor>();
		actor->SetBaseModelId(actorDef.baseModelId);
		actor->SetPosition(actorDef.position);
		sceneRoot->AppendChild(actor);
	}
#endif
}
Пример #20
0
nsresult XULTooltipElement::Init() {
  // Create the default child label node that will contain the text of the
  // tooltip.
  RefPtr<mozilla::dom::NodeInfo> nodeInfo;
  nodeInfo = mNodeInfo->NodeInfoManager()->GetNodeInfo(
      nsGkAtoms::description, nullptr, kNameSpaceID_XUL, nsINode::ELEMENT_NODE);
  nsCOMPtr<Element> description;
  nsresult rv = NS_NewXULElement(getter_AddRefs(description), nodeInfo.forget(),
                                 dom::NOT_FROM_PARSER);
  NS_ENSURE_SUCCESS(rv, rv);
  description->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
                       NS_LITERAL_STRING("tooltip-label"), false);
  description->SetAttr(kNameSpaceID_None, nsGkAtoms::flex,
                       NS_LITERAL_STRING("true"), false);
  ErrorResult error;
  AppendChild(*description, error);

  return error.StealNSResult();
}
Пример #21
0
void CActorViewer::SetActor(uint32 baseModelId, uint32 topModelId)
{
	auto sceneRoot = m_mainViewport->GetSceneRoot();

	if(m_actor)
	{
		m_actorRotationNode->RemoveChild(m_actor);
		m_actor.reset();
	}

	if(m_actorRotationNode)
	{
		sceneRoot->RemoveChild(m_actorRotationNode);
		m_actorRotationNode.reset();
	}

	m_cameraHAngle = 0;
	m_cameraVAngle = 0;
	m_cameraZoomDelta = 0;

	{
		auto node = Palleon::CSceneNode::Create();
		sceneRoot->AppendChild(node);
		m_actorRotationNode = node;
	}

	{
		auto actor = std::make_shared<CUmbralActor>();
		actor->SetBaseModelId(baseModelId);
		actor->SetTopModelId(topModelId);
		actor->RebuildActorRenderables();
		m_actorRotationNode->AppendChild(actor);
		m_actor = actor;
	}

	{
		auto boundingSphere = m_actor->GetBoundingSphere();
		m_actor->SetPosition(boundingSphere.position * -1.0f);
	}

	UpdateCameraLookAt();
}
Пример #22
0
void UISingleTextInputDialog::InitUI ()
{
    m_txtPasswordHintLabel.SetText(StringManager::GetStringById(INPUT_PASSWORD_NO_COLON));
    m_txtPasswordHintLabel.SetFont (0, 0, m_DEFAULT_FONTSIZE);
    m_txtPasswordHintLabel.SetForeColor (ColorManager::knBlack);

    m_tbPassword.SetTipUTF8(StringManager::GetStringById(INPUT_NUMBER_SYMBOL_SYM_PRESS));
    m_tbPassword.SetFont (0, 0, m_DEFAULT_FONTSIZE);
    m_tbPassword.SetFocus(TRUE);
	m_tbPassword.SetId(ID_TEXTBOX_PASSWORD);

    AppendChild(&m_txtPasswordHintLabel);
    AppendChild(&m_tbPassword);

    if(m_iDialogType == Type_Default)
    {
        m_btnOK.Initialize(IDOK, StringManager::GetStringById(ACTION_OK), m_DEFAULT_FONTSIZE, SPtr<ITpImage>());
        m_btnCancel.Initialize(IDCANCEL,  StringManager::GetStringById(ACTION_CANCEL), m_DEFAULT_FONTSIZE, SPtr<ITpImage>());
        
        AppendChild(&m_btnOK);
        AppendChild(&m_btnCancel);
    }
    else if(m_iDialogType == Type_AddLabel)
    {
        m_btnOK.Initialize(IDOK, StringManager::GetStringById(ADD), m_DEFAULT_FONTSIZE, SPtr<ITpImage>());
        m_btnCancel.Initialize(IDCANCEL,  StringManager::GetStringById(ACTION_CANCEL), m_DEFAULT_FONTSIZE, SPtr<ITpImage>());

        m_txtLabelHint.SetText(StringManager::GetStringById(PUT_SPACE_BETWEEN_LABEL));
        m_txtLabelHint.SetFont (0, 0, m_DEFAULT_FONTSIZE);
        m_txtLabelHint.SetForeColor (ColorManager::GetColor(COLOR_MENUITEM_INACTIVE));
        
        AppendChild(&m_btnOK);
        AppendChild(&m_btnCancel);
        AppendChild(&m_txtLabelHint);
    }

    UIIME* pIME = UIIMEManager::GetIME(IUIIME_CHINESE_LOWER, &m_tbPassword);
    if (pIME)
    {
        m_tbPassword.SetFocus(true);
        pIME->SetShowDelay(true);
    }
}
nsresult
DeleteRangeTransaction::CreateTxnsToDeleteNodesBetween()
{
  nsCOMPtr<nsIContentIterator> iter = NS_NewContentSubtreeIterator();

  nsresult res = iter->Init(mRange);
  NS_ENSURE_SUCCESS(res, res);

  while (!iter->IsDone()) {
    nsCOMPtr<nsINode> node = iter->GetCurrentNode();
    NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);

    RefPtr<DeleteNodeTransaction> transaction = new DeleteNodeTransaction();
    res = transaction->Init(mEditorBase, node, mRangeUpdater);
    NS_ENSURE_SUCCESS(res, res);
    AppendChild(transaction);

    iter->Next();
  }
  return NS_OK;
}
Пример #24
0
void buildCommentTree(ND* root, ND** noderay, int szRaySz, int depth)
{

	int i = 0;

	for (i = 0; i < 1000; i++) {
		if (noderay[i] != NULL && noderay[i]->parentid == root->id ) {
			int _p = 0;
			int _l = strlen(noderay[i]->text);
			for(_p = 0; _p < _l;_p++){
				if(noderay[i]->text[_p] == 10){
					noderay[i]->text[_p] = ' ';
				}
			}
			_p = 0;
			/*
			   printf("%.*s-->%d was %p, id=%d, tx=%s\n",
			       depth,
			       "    ",
			       i,
			       noderay[i],
			       noderay[i]->id,
			       substring(noderay[i]->text, 10));
			        ND* item = noderay[i];
			        AppendChild(root, item);
			       buildCommentTree(item, noderay, szRaySz, depth + 1);
			printf("%.*s-->%d tx=%s\n",
			       depth,
			       "    ",
			       i,
			       substring(noderay[i]->text, 30));
			 */
			ND* item = noderay[i];
			AppendChild(root, item);
			buildCommentTree(item, noderay, szRaySz, depth + 1);
		}
	}


}
Пример #25
0
CUmbralModel::CUmbralModel(const ModelChunkPtr& modelChunk)
{
	auto resourceSection = std::dynamic_pointer_cast<CResourceSection>(modelChunk->GetParent()->GetParent()->GetParent()->GetParent());
	assert(resourceSection);
	auto shaderSections = resourceSection->SelectNodes<CShaderSection>();

	auto meshNodes = modelChunk->SelectNodes<CMeshChunk>();
	assert(!meshNodes.empty());
	for(const auto& meshNode : meshNodes)
	{
		auto name = meshNode->SelectNode<CStringChunk>();
		assert(name);

		auto shaderSection = FindShaderForName(shaderSections, name->GetString());

		auto mesh = std::make_shared<CUmbralMesh>(meshNode, shaderSection);
		mesh->SetName(name->GetString());
		AppendChild(mesh);

		m_boundingSphere = m_boundingSphere.Accumulate(mesh->GetBoundingSphere());
	}
}
Пример #26
0
void 
nsHTMLImageMapAccessible::CacheChildren()
{
  if (!mMapElement)
    return;

  nsCOMPtr<nsIDOMHTMLCollection> mapAreas;
  mMapElement->GetAreas(getter_AddRefs(mapAreas));
  if (!mapAreas)
    return;

  PRUint32 areaCount = 0;
  mapAreas->GetLength(&areaCount);

  for (PRUint32 areaIdx = 0; areaIdx < areaCount; areaIdx++) {
    nsCOMPtr<nsIDOMNode> areaNode;
    mapAreas->Item(areaIdx, getter_AddRefs(areaNode));
    if (!areaNode)
      return;

    nsCOMPtr<nsIContent> areaContent(do_QueryInterface(areaNode));
    nsRefPtr<nsAccessible> areaAcc =
      new nsHTMLAreaAccessible(areaContent, mWeakShell);
    if (!areaAcc)
      return;

    if (!areaAcc->Init()) {
      areaAcc->Shutdown();
      return;
    }

    // We must respect ARIA on area elements (for the canvas map technique)
    areaAcc->SetRoleMapEntry(nsAccUtils::GetRoleMapEntry(areaContent));

    if (!AppendChild(areaAcc))
      return;
  }
}
Пример #27
0
NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteNodesBetween()
{
  nsCOMPtr<nsIContentIterator> iter = do_CreateInstance("@mozilla.org/content/subtree-content-iterator;1");
  NS_ENSURE_TRUE(iter, NS_ERROR_NULL_POINTER);

  nsresult result = iter->Init(mRange);
  NS_ENSURE_SUCCESS(result, result);

  while (!iter->IsDone() && NS_SUCCEEDED(result))
  {
    nsCOMPtr<nsIDOMNode> node = do_QueryInterface(iter->GetCurrentNode());
    NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);

    nsRefPtr<DeleteElementTxn> txn = new DeleteElementTxn();
    NS_ENSURE_TRUE(txn, NS_ERROR_OUT_OF_MEMORY);

    result = txn->Init(mEditor, node, mRangeUpdater);
    if (NS_SUCCEEDED(result))
      AppendChild(txn);
    iter->Next();
  }
  return result;
}
Пример #28
0
NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteContent(nsIDOMNode *aParent, 
                                                        PRUint32    aOffset, 
                                                        nsIEditor::EDirection aAction)
{
  nsresult result = NS_OK;
  // see what kind of node we have
  nsCOMPtr<nsIDOMCharacterData> textNode = do_QueryInterface(aParent);
  if (textNode)
  { // if the node is a text node, then delete text content
    PRUint32 start, numToDelete;
    if (nsIEditor::eNext == aAction)
    {
      start=aOffset;
      textNode->GetLength(&numToDelete);
      numToDelete -= aOffset;
    }
    else
    {
      start=0;
      numToDelete=aOffset;
    }
    
    if (numToDelete)
    {
      nsRefPtr<DeleteTextTxn> txn = new DeleteTextTxn();
      if (!txn)
        return NS_ERROR_OUT_OF_MEMORY;

      result = txn->Init(mEditor, textNode, start, numToDelete, mRangeUpdater);
      if (NS_SUCCEEDED(result))
        AppendChild(txn);
    }
  }

  return result;
}
Пример #29
0
void ElementDataGridRow::Initialise(ElementDataGrid* _parent_grid, ElementDataGridRow* _parent_row, int _child_index, ElementDataGridRow* header_row, int _depth)
{
	parent_grid = _parent_grid;
	parent_row = _parent_row;
	child_index = _child_index;
	depth = _depth;

	// We start all the rows collapsed, except for the root row.
	if (child_index != -1)
	{
		row_expanded = false;
	}

	int num_columns = parent_grid->GetNumColumns();
	Rocket::Core::XMLAttributes cell_attributes;
	for (int i = 0; i < num_columns; i++)
	{
		ElementDataGridCell* cell = dynamic_cast< ElementDataGridCell* >(Core::Factory::InstanceElement(this, "#rktctl_datagridcell", "datagridcell", cell_attributes));
		cell->Initialise(i, header_row->GetChild(i));
		cell->SetProperty("display", Rocket::Core::Property(Rocket::Core::DISPLAY_INLINE_BLOCK, Rocket::Core::Property::KEYWORD));
		AppendChild(cell);
		cell->RemoveReference();
	}
}
Пример #30
0
void Box::PackEnd(Widget *child)
{
	AppendChild(child, 0, 0);
	ResizeRequest();
}