コード例 #1
0
ファイル: textodt.cpp プロジェクト: Lorette/Antiplagiat
void TextOdt::tri(int max_word, bool tri_police, bool tri_size)
{
    int tri_ = 0;
    (tri_police == true) ? tri_++ : tri_;
    (tri_size == true) ? tri_++ : tri_;

    int tri;
    QList <XString *> textCibles;
    XString aux;
    QString text = "";
    QStringList list;

    for(int i = 0;i < m_textCibles.count();i++)
    {
        if(text.count() != 0)
        {
            tri = 0;
            if(tri_police && aux.get_m_police() == m_textCibles.at(i)->get_m_police())
                tri++;
            if(tri_size && aux.get_m_size() == m_textCibles.at(i)->get_m_size())
                tri++;

            if(tri == tri_)
            {
                m_textCibles.at(i)->setText(text +m_textCibles.at(i)->toString());
                text = "";
            }

        }

        if(text.count() != 0)
        {
            textCibles << new XString(text,aux.get_m_police(),aux.get_m_size());
            text = "";
        }

        aux = *m_textCibles.at(i);
        list = aux.toString().split(" ");

        while(list.count() > 0)
        {

            text = text + list.takeFirst()+" ";
            if(text.split(" ").count() > max_word)
            {
                textCibles << new XString(text,m_textCibles.at(i)->get_m_police(),m_textCibles.at(i)->get_m_size());
                text = "";
            }
        }
    }
    textCibles << new XString(text,aux.get_m_police(),aux.get_m_size());

    m_textCibles = textCibles;

}