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

« back to all changes in this revision

Viewing changes to libs/flake/KoSelection.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
            continue;
89
89
        selectedShapes << shape;
90
90
 
91
 
        KoShapeGroup* childGroup = dynamic_cast<KoShapeGroup*>(shape);
 
91
        KoShapeGroup *childGroup = dynamic_cast<KoShapeGroup*>(shape);
92
92
        if (childGroup)
93
93
            selectGroupChildren(childGroup);
94
94
    }
103
103
        if (selectedShapes.contains(shape))
104
104
            selectedShapes.removeAll(shape);
105
105
 
106
 
        KoShapeGroup* childGroup = dynamic_cast<KoShapeGroup*>(shape);
 
106
        KoShapeGroup *childGroup = dynamic_cast<KoShapeGroup*>(shape);
107
107
        if (childGroup)
108
108
            deselectGroupChildren(childGroup);
109
109
    }
135
135
        return;
136
136
 
137
137
    // save old number of selected shapes
138
 
    uint oldSelectionCount = d->selectedShapes.count();
 
138
    int oldSelectionCount = d->selectedShapes.count();
139
139
 
140
140
    if (!d->selectedShapes.contains(shape))
141
141
        d->selectedShapes << shape;
142
142
 
143
143
    // automatically recursively select all child shapes downwards in the hierarchy
144
 
    KoShapeGroup* group = dynamic_cast<KoShapeGroup*>(shape);
 
144
    KoShapeGroup *group = dynamic_cast<KoShapeGroup*>(shape);
145
145
    if (group)
146
146
        d->selectGroupChildren(group);
147
147
 
165
165
    }
166
166
    else {
167
167
        // reset global bound if there were no shapes selected before
168
 
        if( ! oldSelectionCount )
 
168
        if (!oldSelectionCount )
169
169
            d->globalBound = QRectF();
170
170
 
171
171
        setTransformation(QMatrix());
172
172
        // we are resetting the transformation here anyway,
173
173
        // so we can just add the newly selected shapes to the bounding box
174
174
        // in document coordinates and then use that size and position
175
 
        uint newSelectionCount = d->selectedShapes.count();
176
 
        for( uint i = oldSelectionCount; i < newSelectionCount; ++i ) {
177
 
            KoShape * shape = d->selectedShapes[i];
 
175
        int newSelectionCount = d->selectedShapes.count();
 
176
        for (int i = oldSelectionCount; i < newSelectionCount; ++i) {
 
177
            KoShape *shape = d->selectedShapes[i];
178
178
            const QMatrix shapeTransform = shape->absoluteTransformation(0);
179
179
            const QRectF shapeRect(QRectF(QPointF(), shape->size()));
180
180
 
243
243
    if (count() > 1) {
244
244
        QRectF bb(boundingRect());
245
245
        return bb.contains(position);
246
 
    } else if (count() == 1)
 
246
    } else if (count() == 1) {
247
247
        return (*d->selectedShapes.begin())->hitTest(position);
248
 
    else // count == 0
 
248
    } else { // count == 0
249
249
        return false;
 
250
    }
250
251
}
251
252
void KoSelection::updateSizeAndPosition()
252
253
{
312
313
    return *(set.begin());
313
314
}
314
315
 
315
 
void KoSelection::setActiveLayer(KoShapeLayer* layer)
 
316
void KoSelection::setActiveLayer(KoShapeLayer *layer)
316
317
{
317
318
    Q_D(KoSelection);
318
319
    d->activeLayer = layer;
334
335
    return true;
335
336
}
336
337
 
337
 
#include "KoSelection.moc"
 
338
#include <KoSelection.moc>