~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to libs/kopageapp/KoPADocumentModel.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
    if( ! parentShape )
81
81
        return 0;
82
82
 
83
 
    return parentShape->childCount();
 
83
    return parentShape->shapeCount();
84
84
}
85
85
 
86
86
int KoPADocumentModel::columnCount( const QModelIndex & ) const
109
109
    if( ! parentShape )
110
110
        return QModelIndex();
111
111
 
112
 
    if( row < parentShape->childCount() )
 
112
    if( row < parentShape->shapeCount() )
113
113
        return createIndex( row, column, childFromIndex( parentShape, row ) );
114
114
    else
115
115
        return QModelIndex();
208
208
        case PropertiesRole: return QVariant::fromValue( properties( shape ) );
209
209
        case AspectRatioRole:
210
210
        {
211
 
            QMatrix matrix = shape->absoluteTransformation( 0 );
 
211
            QTransform matrix = shape->absoluteTransformation( 0 );
212
212
            QRectF bbox = matrix.mapRect( shape->outline().boundingRect() );
213
213
            KoShapeContainer *container = dynamic_cast<KoShapeContainer*>( shape );
214
214
            if( container )
215
215
            {
216
216
                bbox = QRectF();
217
 
                foreach( KoShape* shape, container->childShapes() )
 
217
                foreach( KoShape* shape, container->shapes() )
218
218
                    bbox = bbox.united( shape->outline().boundingRect() );
219
219
            }
220
220
            return qreal(bbox.width()) / bbox.height();
330
330
    shapes.append( shape );
331
331
    KoShapeContainer * container = dynamic_cast<KoShapeContainer*>( shape );
332
332
    if( container )
333
 
        shapes = container->childShapes();
 
333
        shapes = container->shapes();
334
334
 
335
335
    shapePainter.setShapes( shapes );
336
336
 
344
344
 
345
345
KoShape * KoPADocumentModel::childFromIndex( KoShapeContainer *parent, int row ) const
346
346
{
347
 
    return parent->childShapes().at(row);
 
347
    return parent->shapes().at(row);
348
348
 
349
349
    if( parent != m_lastContainer )
350
350
    {
351
351
        m_lastContainer = parent;
352
 
        m_childs = parent->childShapes();
 
352
        m_childs = parent->shapes();
353
353
        qSort( m_childs.begin(), m_childs.end(), KoShape::compareShapeZIndex );
354
354
    }
355
355
    return m_childs.at( row );
360
360
    if ( !m_document )
361
361
        return 0;
362
362
 
363
 
    return parent->childShapes().indexOf( child );
 
363
    return parent->shapes().indexOf( child );
364
364
 
365
365
    if( parent != m_lastContainer )
366
366
    {
367
367
        m_lastContainer = parent;
368
 
        m_childs = parent->childShapes();
 
368
        m_childs = parent->shapes();
369
369
        qSort( m_childs.begin(), m_childs.end(), KoShape::compareShapeZIndex );
370
370
    }
371
371
    return m_childs.indexOf( child );
402
402
    // encode the data
403
403
    QModelIndexList::ConstIterator it = indexes.begin();
404
404
    for( ; it != indexes.end(); ++it)
405
 
        stream << qVariantFromValue( qulonglong( it->internalPointer() ) );
 
405
        stream << QVariant::fromValue( qulonglong( it->internalPointer() ) );
406
406
 
407
407
    data->setData(format, encoded);
408
408
    return data;
499
499
                return false;
500
500
 
501
501
            emit layoutAboutToBeChanged();
502
 
            beginInsertRows( parent, group->childCount(), group->childCount()+toplevelShapes.count() );
 
502
            beginInsertRows( parent, group->shapeCount(), group->shapeCount()+toplevelShapes.count() );
503
503
 
504
504
            QUndoCommand * cmd = new QUndoCommand();
505
505
            cmd->setText( i18n("Reparent shapes") );
520
520
            if( toplevelShapes.count() )
521
521
            {
522
522
                emit layoutAboutToBeChanged();
523
 
                beginInsertRows( parent, container->childCount(), container->childCount()+toplevelShapes.count() );
 
523
                beginInsertRows( parent, container->shapeCount(), container->shapeCount()+toplevelShapes.count() );
524
524
 
525
525
                QUndoCommand * cmd = new QUndoCommand();
526
526
                cmd->setText( i18n("Reparent shapes") );
527
527
 
528
528
                QList<bool> clipped;
 
529
                QList<bool> inheritsTransform;
529
530
                foreach( KoShape * shape, toplevelShapes )
530
531
                {
531
532
                    if( ! shape->parent() )
532
533
                    {
533
534
                        clipped.append( false );
 
535
                        inheritsTransform.append(false);
534
536
                        continue;
535
537
                    }
536
538
 
537
 
                    clipped.append( shape->parent()->childClipped( shape ) );
 
539
                    clipped.append( shape->parent()->isClipped( shape ) );
 
540
                    inheritsTransform.append(shape->parent()->inheritsTransform(shape));
538
541
                    new KoShapeUngroupCommand( shape->parent(), QList<KoShape*>() << shape, QList<KoShape*>(), cmd );
539
542
                }
540
543
                // shapes are dropped on a container, so add them to the container
541
 
                new KoShapeGroupCommand( container, toplevelShapes, clipped, cmd );
 
544
                new KoShapeGroupCommand(container, toplevelShapes, clipped, inheritsTransform, cmd);
542
545
                KoCanvasController * canvasController = KoToolManager::instance()->activeCanvasController();
543
546
                canvasController->canvas()->addCommand( cmd );
544
547