Пример #1
0
void DetailSectionDialog::btnEdit_clicked()
{
  int idx = lbGroups->currentRow();
  if(idx < 0)
    return;
  DetailGroupSectionDialog * dgsd = new DetailGroupSectionDialog(this);

  if(_gsd)
  {
    ORGraphicsSectionDetailGroup * rsdg = _gsd->getSection(idx);
    dgsd->tbName->setText(rsdg->getTitle());
    dgsd->tbColumn->setText(rsdg->column());
    dgsd->breakAfterFooter->setChecked(rsdg->pageBreak()==ORGraphicsSectionDetailGroup::BreakAfterGroupFooter);
    dgsd->cbHead->setChecked(rsdg->isGroupHeadShowing());
    dgsd->cbFoot->setChecked(rsdg->isGroupFootShowing());

    bool exitLoop = false;
    while(!exitLoop)
    {
      if(dgsd->exec() == QDialog::Accepted)
      {
        QString name = dgsd->tbName->text();
        QString column = dgsd->tbColumn->text();
        bool showgh = dgsd->cbHead->isChecked();
        bool showgf = dgsd->cbFoot->isChecked();
        bool breakafterfoot = dgsd->breakAfterFooter->isChecked();

        if(name != rsdg->getTitle() && _gsd->findSection(name) != -1)
        {
          QMessageBox::warning(this, tr("Error Encountered"),
              tr("Tried to add a new Group section with a non-unique name."));
        }
        else
        {
          if(name != rsdg->getTitle())
          {
            rsdg->setTitle(name);
            lbGroups->item(idx)->setText(name);
          }
          rsdg->setColumn(column);
          rsdg->showGroupHead(showgh);
          rsdg->showGroupFoot(showgf);
          if(breakafterfoot)
            rsdg->setPageBreak(ORGraphicsSectionDetailGroup::BreakAfterGroupFooter);
          else
            rsdg->setPageBreak(ORGraphicsSectionDetailGroup::BreakNone);

          exitLoop = true;
        }
      }
      else
      {
        exitLoop = true;
      }
    }
  }

  if(dgsd)
    delete dgsd;
}
Пример #2
0
void DetailSectionDialog::brnMoveDown_clicked()
{
  int idx = lbGroups->currentRow();
  if(idx == (int)(lbGroups->count() - 1))
    return;
  QString s = lbGroups->item(idx)->text();
  lbGroups->takeItem(idx);
  lbGroups->insertItem(idx+1, s);
  if(_gsd)
  {
    ORGraphicsSectionDetailGroup * rsdg = _gsd->getSection(idx);
    bool showgh = rsdg->isGroupHeadShowing();
    bool showgf = rsdg->isGroupFootShowing();
    _gsd->removeSection(idx);
    _gsd->insertSection(idx+1, rsdg);
    rsdg->showGroupHead(showgh);
    rsdg->showGroupFoot(showgf);
  }
}
Пример #3
0
void ORGraphicsSectionDetail::buildXML(QDomDocument & doc, QDomElement & section)
{
  // name/title
  QDomElement name = doc.createElement("name");
  name.appendChild(doc.createTextNode(getTitle()));
  section.appendChild(name);

  if(pageBreak() != ORGraphicsSectionDetail::BreakNone)
  {
    QDomElement spagebreak = doc.createElement("pagebreak");
    if(pageBreak() == ORGraphicsSectionDetail::BreakAtEnd)
      spagebreak.setAttribute("when", "at end");
    section.appendChild(spagebreak);
  }

  for(int i = 0; i < groupList.count(); i++)
  {
    ORGraphicsSectionDetailGroup * rsdg = groupList.at(i);
    QDomNode grp = doc.createElement("group");

    QDomNode gname = doc.createElement("name");
    gname.appendChild(doc.createTextNode(rsdg->getTitle()));
    grp.appendChild(gname);

    QDomNode gcol = doc.createElement("column");
    gcol.appendChild(doc.createTextNode(rsdg->column()));
    grp.appendChild(gcol);

    if(rsdg->pageBreak() != ORGraphicsSectionDetailGroup::BreakNone)
    {
      QDomElement pagebreak = doc.createElement("pagebreak");
      if(rsdg->pageBreak() == ORGraphicsSectionDetailGroup::BreakAfterGroupFooter)
        pagebreak.setAttribute("when", "after foot");
      grp.appendChild(pagebreak);
    }

    //group head
    if(rsdg->isGroupHeadShowing())
    {
      QDomElement ghead = doc.createElement("head");
      rsdg->getGroupHead()->buildXML(doc,ghead);
      grp.appendChild(ghead);
    }
    // group foot
    if(rsdg->isGroupFootShowing())
    {
      QDomElement gfoot = doc.createElement("foot");
      rsdg->getGroupFoot()->buildXML(doc,gfoot);
      grp.appendChild(gfoot);
    }

    section.appendChild(grp);
  }

  // detail section
  QDomElement gdetail = doc.createElement("detail");
  QDomElement key = doc.createElement("key");
  QDomElement kquery = doc.createElement("query");
  kquery.appendChild(doc.createTextNode(query()));
  key.appendChild(kquery);
  gdetail.appendChild(key);
  _detail->buildXML(doc,gdetail);
  section.appendChild(gdetail);
}