~scribus/scribus/trunk

« back to all changes in this revision

Viewing changes to scribus/plugins/scripter/api_item.cpp

  • Committer: jghali
  • Date: 2018-10-14 10:31:03 UTC
  • Revision ID: svn-v4:11d20701-8431-0410-a711-e3c959e3b870:trunk/Scribus:22731
#15441: Text vertical alignment not accessible from python/scripter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
 
to the COPYING file provided with the program. Following this notice may exist
4
 
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
 
for which a new license (GPL+exception) is in place.
6
 
*/
7
 
#include "api_item.h"
8
 
#include "utils.h"
9
 
#include "undomanager.h"
10
 
#include "selection.h"
11
 
#include "scribusview.h"
12
 
 
13
 
ItemAPI::ItemAPI(PageItem* it) : QObject(COLLECTOR)
14
 
{
15
 
        qDebug() << "ItemAPI loaded";
16
 
    setObjectName("ItemAPI");
17
 
        item = it;
18
 
}
19
 
 
20
 
QString ItemAPI::name()
21
 
{
22
 
        return item->itemName();
23
 
}
24
 
 
25
 
void ItemAPI::setName(QString name)
26
 
{
27
 
        item->setItemName(name);
28
 
}
29
 
 
30
 
 
31
 
QString ItemAPI::fillColor()
32
 
{
33
 
        return item->fillColor();
34
 
}
35
 
 
36
 
void ItemAPI::setFillColor(QString color)
37
 
{
38
 
        item->setFillColor(color);
39
 
}
40
 
 
41
 
QString ItemAPI::lineColor()
42
 
{
43
 
        return item->lineColor();
44
 
}
45
 
 
46
 
void ItemAPI::setLineColor(QString color)
47
 
{
48
 
        item->setLineColor(color);
49
 
}
50
 
 
51
 
 
52
 
double ItemAPI::fillShade()
53
 
{
54
 
        return item->fillShade();
55
 
}
56
 
 
57
 
void ItemAPI::setFillShade(double value)
58
 
{
59
 
        item->setFillShade(value);
60
 
}
61
 
 
62
 
double ItemAPI::lineShade()
63
 
{
64
 
        return item->lineShade();
65
 
}
66
 
 
67
 
void ItemAPI::setLineShade(double value)
68
 
{
69
 
        item->setLineShade(value);
70
 
}
71
 
 
72
 
double ItemAPI::fillTransparency()
73
 
{
74
 
        return item->fillTransparency();
75
 
}
76
 
 
77
 
void ItemAPI::setFillTransparency(double value)
78
 
{
79
 
        item->setFillTransparency(value);
80
 
}
81
 
 
82
 
 
83
 
double ItemAPI::lineTransparency()
84
 
{
85
 
        return item->lineTransparency();
86
 
}
87
 
 
88
 
void ItemAPI::setLineTransparency(double value)
89
 
{
90
 
        item->setLineTransparency(value);
91
 
}
92
 
 
93
 
bool ItemAPI::locked()
94
 
{
95
 
        return item->locked();
96
 
}
97
 
 
98
 
void ItemAPI::setLocked(bool value)
99
 
{
100
 
        item->setLocked(value);
101
 
}
102
 
 
103
 
bool ItemAPI::sizeLocked()
104
 
{
105
 
        return item->sizeLocked();
106
 
}
107
 
 
108
 
void ItemAPI::setSizeLocked(bool value)
109
 
{
110
 
        item->setSizeLocked(value);
111
 
}
112
 
 
113
 
bool ItemAPI::imageFlippedV()
114
 
{
115
 
        return item->imageFlippedV();
116
 
}
117
 
 
118
 
void ItemAPI::setImageFlippedV(bool value)
119
 
{
120
 
        item->setImageFlippedV(value);
121
 
}
122
 
 
123
 
bool ItemAPI::imageFlippedH()
124
 
{
125
 
        return item->imageFlippedH();
126
 
}
127
 
 
128
 
void ItemAPI::setImageFlippedH(bool value)
129
 
{
130
 
        item->setImageFlippedH(value);
131
 
}
132
 
 
133
 
double ItemAPI::lineWidth()
134
 
{
135
 
        return item->lineWidth();
136
 
}
137
 
 
138
 
void ItemAPI::setLineWidth(double value)
139
 
{
140
 
        item->setLineWidth(value);
141
 
}
142
 
 
143
 
QString ItemAPI::customLineStyle()
144
 
{
145
 
        return item->customLineStyle();
146
 
}
147
 
 
148
 
void ItemAPI::setCustomLineStyle(QString name)
149
 
{
150
 
        item->setCustomLineStyle(name);
151
 
}
152
 
 
153
 
int ItemAPI::startArrowIndex()
154
 
{
155
 
        return item->startArrowIndex();
156
 
}
157
 
 
158
 
void ItemAPI::setStartArrowIndex(int value)
159
 
{
160
 
        item->setStartArrowIndex(value);
161
 
}
162
 
 
163
 
int ItemAPI::endArrowIndex()
164
 
{
165
 
        return item->endArrowIndex();
166
 
}
167
 
 
168
 
void ItemAPI::setEndArrowIndex(int value)
169
 
{
170
 
        item->setEndArrowIndex(value);
171
 
}
172
 
 
173
 
bool ItemAPI::printEnabled()
174
 
{
175
 
        return item->printEnabled();
176
 
}
177
 
 
178
 
void ItemAPI::setPrintEnabled(bool value)
179
 
{
180
 
        item->setPrintEnabled(value);
181
 
}
182
 
 
183
 
double ItemAPI::xPos()
184
 
{
185
 
        return item->xPos();
186
 
}
187
 
 
188
 
void ItemAPI::setXPos(double value)
189
 
{
190
 
        item->setXPos(value);
191
 
}
192
 
 
193
 
double ItemAPI::yPos()
194
 
{
195
 
        return item->yPos();
196
 
}
197
 
 
198
 
void ItemAPI::setYPos(double value)
199
 
{
200
 
        item->setYPos(value);
201
 
}
202
 
 
203
 
double ItemAPI::width()
204
 
{
205
 
        return item->width();
206
 
}
207
 
 
208
 
void ItemAPI::setWidth(double value)
209
 
{
210
 
        item->setWidth(value);
211
 
}
212
 
 
213
 
double ItemAPI::height()
214
 
{
215
 
        return item->height();
216
 
}
217
 
 
218
 
void ItemAPI::setHeight(double value)
219
 
{
220
 
        item->setHeight(value);
221
 
}
222
 
 
223
 
double ItemAPI::rotation()
224
 
{
225
 
        return item->rotation();
226
 
}
227
 
 
228
 
void ItemAPI::setRotation(double rotation)
229
 
{
230
 
        item->setRotation(rotation);
231
 
}
232
 
 
233
 
bool ItemAPI::reversed()
234
 
{
235
 
        return false; // item->reversed(); FIXME
236
 
}
237
 
 
238
 
void ItemAPI::setReversed(bool value)
239
 
{
240
 
        // item->setReversed(value); FIXME
241
 
}
242
 
 
243
 
double ItemAPI::cornerRadius()
244
 
{
245
 
        return item->cornerRadius();
246
 
}
247
 
 
248
 
void ItemAPI::setCornerRadius(double value)
249
 
{
250
 
        item->setCornerRadius(value);
251
 
}
252
 
 
253
 
double ItemAPI::columnGap()
254
 
{
255
 
        return item->columnGap();
256
 
}
257
 
 
258
 
void ItemAPI::setColumnGap(double value)
259
 
{
260
 
        if (!checkHaveDocument())
261
 
                RAISE("No document open");
262
 
        if (value < 0.0)
263
 
        {
264
 
                RAISE("Column gap out of bounds, must be positive.");
265
 
        }
266
 
        item->ColGap = ValueToPoint(value);
267
 
}
268
 
 
269
 
int ItemAPI::columns()
270
 
{
271
 
        return item->columns();
272
 
}
273
 
 
274
 
void ItemAPI::setColumns(int value)
275
 
{
276
 
        if (!checkHaveDocument())
277
 
                RAISE("No document open");
278
 
        if (value < 1)
279
 
        {
280
 
                RAISE("Column count out of bounds, must be > 1.");
281
 
        }
282
 
        item->Cols = value;
283
 
}
284
 
 
285
 
 
286
 
/**
287
 
 * Methods
288
 
 */
289
 
 
290
 
void ItemAPI::move(double dx, double dy)
291
 
{
292
 
        if (!checkHaveDocument())
293
 
                return;
294
 
        if (item==nullptr)
295
 
                return;
296
 
        // Grab the old selection - but use it only where is there any
297
 
        Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
298
 
        bool hadOrigSelection = (tempSelection.count() != 0);
299
 
 
300
 
        ScCore->primaryMainWindow()->doc->m_Selection->clear();
301
 
        // Clear the selection
302
 
        ScCore->primaryMainWindow()->view->Deselect();
303
 
        // Select the item, which will also select its group if
304
 
        // there is one.
305
 
        ScCore->primaryMainWindow()->view->SelectItem(item);
306
 
        // Move the item, or items
307
 
        if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
308
 
        {
309
 
                ScCore->primaryMainWindow()->view->startGroupTransaction(Um::Move, "", Um::IMove);
310
 
                ScCore->primaryMainWindow()->doc->moveGroup(ValueToPoint(dx), ValueToPoint(dy));
311
 
                ScCore->primaryMainWindow()->view->endGroupTransaction();
312
 
        }
313
 
        else
314
 
        {
315
 
                ScCore->primaryMainWindow()->doc->moveItem(ValueToPoint(dx), ValueToPoint(dy), item);
316
 
        }
317
 
        // Now restore the selection.
318
 
        ScCore->primaryMainWindow()->view->Deselect();
319
 
        if (hadOrigSelection)
320
 
                *ScCore->primaryMainWindow()->doc->m_Selection=tempSelection;
321
 
 
322
 
}
323
 
 
324
 
void ItemAPI::moveAbs(double x, double y)
325
 
{
326
 
        if (!checkHaveDocument())
327
 
                return;
328
 
        if (item == nullptr)
329
 
                return;
330
 
        // Grab the old selection - but use it only where is there any
331
 
        Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
332
 
        bool hadOrigSelection = (tempSelection.count() != 0);
333
 
 
334
 
        // Clear the selection
335
 
        ScCore->primaryMainWindow()->view->Deselect();
336
 
        // Select the item, which will also select its group if
337
 
        // there is one.
338
 
        ScCore->primaryMainWindow()->view->SelectItem(item);
339
 
        // Move the item, or items
340
 
        if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
341
 
        {
342
 
                ScCore->primaryMainWindow()->view->startGroupTransaction(Um::Move, "", Um::IMove);
343
 
                double x2, y2, w, h;
344
 
                ScCore->primaryMainWindow()->doc->m_Selection->getGroupRect(&x2, &y2, &w, &h);
345
 
                ScCore->primaryMainWindow()->doc->moveGroup(pageUnitXToDocX(x) - x2, pageUnitYToDocY(y) - y2);
346
 
                ScCore->primaryMainWindow()->view->endGroupTransaction();
347
 
        }
348
 
        else
349
 
                ScCore->primaryMainWindow()->doc->moveItem(pageUnitXToDocX(x) - item->xPos(), pageUnitYToDocY(y) - item->yPos(), item);
350
 
        // Now restore the selection.
351
 
        ScCore->primaryMainWindow()->view->Deselect();
352
 
        if (hadOrigSelection)
353
 
                *ScCore->primaryMainWindow()->doc->m_Selection=tempSelection;
354
 
}
355
 
 
356
 
void ItemAPI::resize(double width, double height)
357
 
{
358
 
        if (!checkHaveDocument())
359
 
                return;
360
 
        if (item == nullptr)
361
 
                return;
362
 
        ScCore->primaryMainWindow()->doc->sizeItem(ValueToPoint(width), ValueToPoint(height), item);
363
 
}
364
 
 
365
 
void ItemAPI::rotate(double rot)
366
 
{
367
 
        if (!checkHaveDocument())
368
 
                return;
369
 
        if (item == nullptr)
370
 
                return;
371
 
        ScCore->primaryMainWindow()->doc->rotateItem(item->rotation() - rot, item);
372
 
 
373
 
}
374
 
void ItemAPI::rotateAbs(double rot)
375
 
{
376
 
        if (!checkHaveDocument())
377
 
                return;
378
 
        if (item == nullptr)
379
 
                return;
380
 
        ScCore->primaryMainWindow()->doc->rotateItem(rot * -1.0, item);
381
 
}
382
 
 
383
 
 
384
 
ItemAPI::~ItemAPI()
385
 
{
386
 
        qDebug() << "ItemAPI deleted";
387
 
}
388
 
 
389
 
 
 
1
/*
 
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
 
3
to the COPYING file provided with the program. Following this notice may exist
 
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
 
5
for which a new license (GPL+exception) is in place.
 
6
*/
 
7
#include "api_item.h"
 
8
#include "utils.h"
 
9
#include "undomanager.h"
 
10
#include "selection.h"
 
11
#include "scribusview.h"
 
12
 
 
13
ItemAPI::ItemAPI(PageItem* it) : QObject(COLLECTOR)
 
14
{
 
15
        qDebug() << "ItemAPI loaded";
 
16
    setObjectName("ItemAPI");
 
17
        item = it;
 
18
}
 
19
 
 
20
QString ItemAPI::name()
 
21
{
 
22
        return item->itemName();
 
23
}
 
24
 
 
25
void ItemAPI::setName(QString name)
 
26
{
 
27
        item->setItemName(name);
 
28
}
 
29
 
 
30
 
 
31
QString ItemAPI::fillColor()
 
32
{
 
33
        return item->fillColor();
 
34
}
 
35
 
 
36
void ItemAPI::setFillColor(QString color)
 
37
{
 
38
        item->setFillColor(color);
 
39
}
 
40
 
 
41
QString ItemAPI::lineColor()
 
42
{
 
43
        return item->lineColor();
 
44
}
 
45
 
 
46
void ItemAPI::setLineColor(QString color)
 
47
{
 
48
        item->setLineColor(color);
 
49
}
 
50
 
 
51
 
 
52
double ItemAPI::fillShade()
 
53
{
 
54
        return item->fillShade();
 
55
}
 
56
 
 
57
void ItemAPI::setFillShade(double value)
 
58
{
 
59
        item->setFillShade(value);
 
60
}
 
61
 
 
62
double ItemAPI::lineShade()
 
63
{
 
64
        return item->lineShade();
 
65
}
 
66
 
 
67
void ItemAPI::setLineShade(double value)
 
68
{
 
69
        item->setLineShade(value);
 
70
}
 
71
 
 
72
double ItemAPI::fillTransparency()
 
73
{
 
74
        return item->fillTransparency();
 
75
}
 
76
 
 
77
void ItemAPI::setFillTransparency(double value)
 
78
{
 
79
        item->setFillTransparency(value);
 
80
}
 
81
 
 
82
 
 
83
double ItemAPI::lineTransparency()
 
84
{
 
85
        return item->lineTransparency();
 
86
}
 
87
 
 
88
void ItemAPI::setLineTransparency(double value)
 
89
{
 
90
        item->setLineTransparency(value);
 
91
}
 
92
 
 
93
bool ItemAPI::locked()
 
94
{
 
95
        return item->locked();
 
96
}
 
97
 
 
98
void ItemAPI::setLocked(bool value)
 
99
{
 
100
        item->setLocked(value);
 
101
}
 
102
 
 
103
bool ItemAPI::sizeLocked()
 
104
{
 
105
        return item->sizeLocked();
 
106
}
 
107
 
 
108
void ItemAPI::setSizeLocked(bool value)
 
109
{
 
110
        item->setSizeLocked(value);
 
111
}
 
112
 
 
113
bool ItemAPI::imageFlippedV()
 
114
{
 
115
        return item->imageFlippedV();
 
116
}
 
117
 
 
118
void ItemAPI::setImageFlippedV(bool value)
 
119
{
 
120
        item->setImageFlippedV(value);
 
121
}
 
122
 
 
123
bool ItemAPI::imageFlippedH()
 
124
{
 
125
        return item->imageFlippedH();
 
126
}
 
127
 
 
128
void ItemAPI::setImageFlippedH(bool value)
 
129
{
 
130
        item->setImageFlippedH(value);
 
131
}
 
132
 
 
133
double ItemAPI::lineWidth()
 
134
{
 
135
        return item->lineWidth();
 
136
}
 
137
 
 
138
void ItemAPI::setLineWidth(double value)
 
139
{
 
140
        item->setLineWidth(value);
 
141
}
 
142
 
 
143
QString ItemAPI::customLineStyle()
 
144
{
 
145
        return item->customLineStyle();
 
146
}
 
147
 
 
148
void ItemAPI::setCustomLineStyle(QString name)
 
149
{
 
150
        item->setCustomLineStyle(name);
 
151
}
 
152
 
 
153
int ItemAPI::startArrowIndex()
 
154
{
 
155
        return item->startArrowIndex();
 
156
}
 
157
 
 
158
void ItemAPI::setStartArrowIndex(int value)
 
159
{
 
160
        item->setStartArrowIndex(value);
 
161
}
 
162
 
 
163
int ItemAPI::endArrowIndex()
 
164
{
 
165
        return item->endArrowIndex();
 
166
}
 
167
 
 
168
void ItemAPI::setEndArrowIndex(int value)
 
169
{
 
170
        item->setEndArrowIndex(value);
 
171
}
 
172
 
 
173
bool ItemAPI::printEnabled()
 
174
{
 
175
        return item->printEnabled();
 
176
}
 
177
 
 
178
void ItemAPI::setPrintEnabled(bool value)
 
179
{
 
180
        item->setPrintEnabled(value);
 
181
}
 
182
 
 
183
double ItemAPI::xPos()
 
184
{
 
185
        return item->xPos();
 
186
}
 
187
 
 
188
void ItemAPI::setXPos(double value)
 
189
{
 
190
        item->setXPos(value);
 
191
}
 
192
 
 
193
double ItemAPI::yPos()
 
194
{
 
195
        return item->yPos();
 
196
}
 
197
 
 
198
void ItemAPI::setYPos(double value)
 
199
{
 
200
        item->setYPos(value);
 
201
}
 
202
 
 
203
double ItemAPI::width()
 
204
{
 
205
        return item->width();
 
206
}
 
207
 
 
208
void ItemAPI::setWidth(double value)
 
209
{
 
210
        item->setWidth(value);
 
211
}
 
212
 
 
213
double ItemAPI::height()
 
214
{
 
215
        return item->height();
 
216
}
 
217
 
 
218
void ItemAPI::setHeight(double value)
 
219
{
 
220
        item->setHeight(value);
 
221
}
 
222
 
 
223
double ItemAPI::rotation()
 
224
{
 
225
        return item->rotation();
 
226
}
 
227
 
 
228
void ItemAPI::setRotation(double rotation)
 
229
{
 
230
        item->setRotation(rotation);
 
231
}
 
232
 
 
233
bool ItemAPI::reversed()
 
234
{
 
235
        return false; // item->reversed(); FIXME
 
236
}
 
237
 
 
238
void ItemAPI::setReversed(bool value)
 
239
{
 
240
        // item->setReversed(value); FIXME
 
241
}
 
242
 
 
243
double ItemAPI::cornerRadius()
 
244
{
 
245
        return item->cornerRadius();
 
246
}
 
247
 
 
248
void ItemAPI::setCornerRadius(double value)
 
249
{
 
250
        item->setCornerRadius(value);
 
251
}
 
252
 
 
253
double ItemAPI::columnGap()
 
254
{
 
255
        return item->columnGap();
 
256
}
 
257
 
 
258
void ItemAPI::setColumnGap(double value)
 
259
{
 
260
        if (!checkHaveDocument())
 
261
                RAISE("No document open");
 
262
        if (value < 0.0)
 
263
        {
 
264
                RAISE("Column gap out of bounds, must be positive.");
 
265
        }
 
266
        item->ColGap = ValueToPoint(value);
 
267
}
 
268
 
 
269
int ItemAPI::columns()
 
270
{
 
271
        return item->columns();
 
272
}
 
273
 
 
274
void ItemAPI::setColumns(int value)
 
275
{
 
276
        if (!checkHaveDocument())
 
277
                RAISE("No document open");
 
278
        if (value < 1)
 
279
        {
 
280
                RAISE("Column count out of bounds, must be > 1.");
 
281
        }
 
282
        item->Cols = value;
 
283
}
 
284
 
 
285
int ItemAPI::verticalAlignment()
 
286
{
 
287
        return item->verticalAlignment();
 
288
}
 
289
 
 
290
void ItemAPI::setVerticalAlignment(int value)
 
291
{
 
292
        if (!checkHaveDocument())
 
293
                RAISE("No document open");
 
294
        item->setVerticalAlignment(value);
 
295
}
 
296
 
 
297
 
 
298
/**
 
299
 * Methods
 
300
 */
 
301
 
 
302
void ItemAPI::move(double dx, double dy)
 
303
{
 
304
        if (!checkHaveDocument())
 
305
                return;
 
306
        if (item==nullptr)
 
307
                return;
 
308
        // Grab the old selection - but use it only where is there any
 
309
        Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
 
310
        bool hadOrigSelection = (tempSelection.count() != 0);
 
311
 
 
312
        ScCore->primaryMainWindow()->doc->m_Selection->clear();
 
313
        // Clear the selection
 
314
        ScCore->primaryMainWindow()->view->Deselect();
 
315
        // Select the item, which will also select its group if
 
316
        // there is one.
 
317
        ScCore->primaryMainWindow()->view->SelectItem(item);
 
318
        // Move the item, or items
 
319
        if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
 
320
        {
 
321
                ScCore->primaryMainWindow()->view->startGroupTransaction(Um::Move, "", Um::IMove);
 
322
                ScCore->primaryMainWindow()->doc->moveGroup(ValueToPoint(dx), ValueToPoint(dy));
 
323
                ScCore->primaryMainWindow()->view->endGroupTransaction();
 
324
        }
 
325
        else
 
326
        {
 
327
                ScCore->primaryMainWindow()->doc->moveItem(ValueToPoint(dx), ValueToPoint(dy), item);
 
328
        }
 
329
        // Now restore the selection.
 
330
        ScCore->primaryMainWindow()->view->Deselect();
 
331
        if (hadOrigSelection)
 
332
                *ScCore->primaryMainWindow()->doc->m_Selection=tempSelection;
 
333
 
 
334
}
 
335
 
 
336
void ItemAPI::moveAbs(double x, double y)
 
337
{
 
338
        if (!checkHaveDocument())
 
339
                return;
 
340
        if (item == nullptr)
 
341
                return;
 
342
        // Grab the old selection - but use it only where is there any
 
343
        Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
 
344
        bool hadOrigSelection = (tempSelection.count() != 0);
 
345
 
 
346
        // Clear the selection
 
347
        ScCore->primaryMainWindow()->view->Deselect();
 
348
        // Select the item, which will also select its group if
 
349
        // there is one.
 
350
        ScCore->primaryMainWindow()->view->SelectItem(item);
 
351
        // Move the item, or items
 
352
        if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
 
353
        {
 
354
                ScCore->primaryMainWindow()->view->startGroupTransaction(Um::Move, "", Um::IMove);
 
355
                double x2, y2, w, h;
 
356
                ScCore->primaryMainWindow()->doc->m_Selection->getGroupRect(&x2, &y2, &w, &h);
 
357
                ScCore->primaryMainWindow()->doc->moveGroup(pageUnitXToDocX(x) - x2, pageUnitYToDocY(y) - y2);
 
358
                ScCore->primaryMainWindow()->view->endGroupTransaction();
 
359
        }
 
360
        else
 
361
                ScCore->primaryMainWindow()->doc->moveItem(pageUnitXToDocX(x) - item->xPos(), pageUnitYToDocY(y) - item->yPos(), item);
 
362
        // Now restore the selection.
 
363
        ScCore->primaryMainWindow()->view->Deselect();
 
364
        if (hadOrigSelection)
 
365
                *ScCore->primaryMainWindow()->doc->m_Selection=tempSelection;
 
366
}
 
367
 
 
368
void ItemAPI::resize(double width, double height)
 
369
{
 
370
        if (!checkHaveDocument())
 
371
                return;
 
372
        if (item == nullptr)
 
373
                return;
 
374
        ScCore->primaryMainWindow()->doc->sizeItem(ValueToPoint(width), ValueToPoint(height), item);
 
375
}
 
376
 
 
377
void ItemAPI::rotate(double rot)
 
378
{
 
379
        if (!checkHaveDocument())
 
380
                return;
 
381
        if (item == nullptr)
 
382
                return;
 
383
        ScCore->primaryMainWindow()->doc->rotateItem(item->rotation() - rot, item);
 
384
 
 
385
}
 
386
void ItemAPI::rotateAbs(double rot)
 
387
{
 
388
        if (!checkHaveDocument())
 
389
                return;
 
390
        if (item == nullptr)
 
391
                return;
 
392
        ScCore->primaryMainWindow()->doc->rotateItem(rot * -1.0, item);
 
393
}
 
394
 
 
395
 
 
396
ItemAPI::~ItemAPI()
 
397
{
 
398
        qDebug() << "ItemAPI deleted";
 
399
}
 
400
 
 
401