Changeset View
Changeset View
Standalone View
Standalone View
filters/libmsooxml/MsooXmlDiagramReader_p.h
Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Line(s) | |||||
175 | { | 175 | { | ||
176 | public: | 176 | public: | ||
177 | QString m_modelId; | 177 | QString m_modelId; | ||
178 | QString m_type; | 178 | QString m_type; | ||
179 | QString m_cxnId; | 179 | QString m_cxnId; | ||
180 | QString m_text; | 180 | QString m_text; | ||
181 | QMap< QString, QString > prSet; | 181 | QMap< QString, QString > prSet; | ||
182 | explicit PointNode() : AbstractNode("dgm:pt") {} | 182 | explicit PointNode() : AbstractNode("dgm:pt") {} | ||
183 | virtual ~PointNode() {} | 183 | ~PointNode() override {} | ||
184 | virtual void dump(Context* context, int level); | 184 | void dump(Context* context, int level) override; | ||
185 | virtual void dump( QTextStream& device ); | 185 | void dump( QTextStream& device ) override; | ||
186 | virtual void readElement(Context* context, MsooXmlDiagramReader* reader); | 186 | void readElement(Context* context, MsooXmlDiagramReader* reader) override; | ||
187 | virtual void readAll(Context* context, MsooXmlDiagramReader* reader); | 187 | void readAll(Context* context, MsooXmlDiagramReader* reader) override; | ||
188 | private: | 188 | private: | ||
189 | void readTextBody(Context*, MsooXmlDiagramReader* reader); | 189 | void readTextBody(Context*, MsooXmlDiagramReader* reader); | ||
190 | }; | 190 | }; | ||
191 | 191 | | |||
192 | /// A list of points in the data-model. | 192 | /// A list of points in the data-model. | ||
193 | class PointListNode : public AbstractNode | 193 | class PointListNode : public AbstractNode | ||
194 | { | 194 | { | ||
195 | public: | 195 | public: | ||
196 | explicit PointListNode() : AbstractNode("dgm:ptLst") {} | 196 | explicit PointListNode() : AbstractNode("dgm:ptLst") {} | ||
197 | virtual ~PointListNode() {} | 197 | ~PointListNode() override {} | ||
198 | virtual void dump(Context* context, int level); | 198 | void dump(Context* context, int level) override; | ||
199 | virtual void dump( QTextStream& device ); | 199 | void dump( QTextStream& device ) override; | ||
200 | virtual void readElement(Context* context, MsooXmlDiagramReader* reader); | 200 | void readElement(Context* context, MsooXmlDiagramReader* reader) override; | ||
201 | }; | 201 | }; | ||
202 | 202 | | |||
203 | /// A connection between two nodes in the data-model. | 203 | /// A connection between two nodes in the data-model. | ||
204 | class ConnectionNode : public AbstractNode | 204 | class ConnectionNode : public AbstractNode | ||
205 | { | 205 | { | ||
206 | public: | 206 | public: | ||
207 | QString m_modelId; | 207 | QString m_modelId; | ||
208 | QString m_type; | 208 | QString m_type; | ||
209 | QString m_srcId; | 209 | QString m_srcId; | ||
210 | QString m_destId; | 210 | QString m_destId; | ||
211 | QString m_presId; | 211 | QString m_presId; | ||
212 | QString m_parTransId; | 212 | QString m_parTransId; | ||
213 | QString m_sibTransId; | 213 | QString m_sibTransId; | ||
214 | int m_srcOrd; | 214 | int m_srcOrd; | ||
215 | int m_destOrd; | 215 | int m_destOrd; | ||
216 | explicit ConnectionNode() : AbstractNode("dgm:cxn"), m_srcOrd(0), m_destOrd(0) {} | 216 | explicit ConnectionNode() : AbstractNode("dgm:cxn"), m_srcOrd(0), m_destOrd(0) {} | ||
217 | virtual ~ConnectionNode() {} | 217 | ~ConnectionNode() override {} | ||
218 | virtual void dump(Context*, int level); | 218 | void dump(Context*, int level) override; | ||
219 | virtual void dump( QTextStream& device ); | 219 | void dump( QTextStream& device ) override; | ||
220 | virtual void readElement(Context* context, MsooXmlDiagramReader* reader); | 220 | void readElement(Context* context, MsooXmlDiagramReader* reader) override; | ||
221 | virtual void readAll(Context* context, MsooXmlDiagramReader* reader); | 221 | void readAll(Context* context, MsooXmlDiagramReader* reader) override; | ||
222 | }; | 222 | }; | ||
223 | 223 | | |||
224 | /// A list of connections in the data-model. | 224 | /// A list of connections in the data-model. | ||
225 | class ConnectionListNode : public AbstractNode | 225 | class ConnectionListNode : public AbstractNode | ||
226 | { | 226 | { | ||
227 | public: | 227 | public: | ||
228 | explicit ConnectionListNode() : AbstractNode("dgm:cxnLst") {} | 228 | explicit ConnectionListNode() : AbstractNode("dgm:cxnLst") {} | ||
229 | virtual ~ConnectionListNode() {} | 229 | ~ConnectionListNode() override {} | ||
230 | virtual void dump(Context* context, int level); | 230 | void dump(Context* context, int level) override; | ||
231 | virtual void dump( QTextStream& device ); | 231 | void dump( QTextStream& device ) override; | ||
232 | virtual void readElement(Context* context, MsooXmlDiagramReader* reader); | 232 | void readElement(Context* context, MsooXmlDiagramReader* reader) override; | ||
233 | }; | 233 | }; | ||
234 | 234 | | |||
235 | /**************************************************************************************************** | 235 | /**************************************************************************************************** | ||
236 | * So much for the nodes. Now the atoms are following which are used to add some logic to the | 236 | * So much for the nodes. Now the atoms are following which are used to add some logic to the | ||
237 | * data-model and they do provide the functionality to build up a hierarchical layout tree. | 237 | * data-model and they do provide the functionality to build up a hierarchical layout tree. | ||
238 | */ | 238 | */ | ||
239 | 239 | | |||
240 | /// Base class for layout-operations (content of layout1.xml) | 240 | /// Base class for layout-operations (content of layout1.xml) | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 279 | enum Algorithm { | |||
287 | PyramidAlg, ///< The pyramid algorithm lays out child layout nodes along a vertical path and works with the trapezoid shape to create a pyramid. | 287 | PyramidAlg, ///< The pyramid algorithm lays out child layout nodes along a vertical path and works with the trapezoid shape to create a pyramid. | ||
288 | SnakeAlg, ///< The snake algorithm lays out child layout nodes along a linear path in two dimensions, allowing the linear flow to continue across multiple rows or columns. | 288 | SnakeAlg, ///< The snake algorithm lays out child layout nodes along a linear path in two dimensions, allowing the linear flow to continue across multiple rows or columns. | ||
289 | SpaceAlg, ///< The space algorithm is used to specify a minimum space between other layout nodes or as an indication to do nothing with the layout node’s size and position. | 289 | SpaceAlg, ///< The space algorithm is used to specify a minimum space between other layout nodes or as an indication to do nothing with the layout node’s size and position. | ||
290 | TextAlg ///< The text algorithm sizes text to fit inside a shape and controls its margins and alignment. | 290 | TextAlg ///< The text algorithm sizes text to fit inside a shape and controls its margins and alignment. | ||
291 | }; | 291 | }; | ||
292 | Algorithm m_type; | 292 | Algorithm m_type; | ||
293 | QMap<QString, QString> m_params; // list of type=value parameters that modify the default behavior of the algorithm. | 293 | QMap<QString, QString> m_params; // list of type=value parameters that modify the default behavior of the algorithm. | ||
294 | explicit AlgorithmAtom() : AbstractAtom("dgm:alg"), m_type(UnknownAlg) {} | 294 | explicit AlgorithmAtom() : AbstractAtom("dgm:alg"), m_type(UnknownAlg) {} | ||
295 | virtual ~AlgorithmAtom() {} | 295 | ~AlgorithmAtom() override {} | ||
296 | virtual AlgorithmAtom* clone(Context* context); | 296 | AlgorithmAtom* clone(Context* context) override; | ||
297 | virtual void dump(Context* context, int level); | 297 | void dump(Context* context, int level) override; | ||
298 | virtual void readAll(Context* context, MsooXmlDiagramReader* reader); | 298 | void readAll(Context* context, MsooXmlDiagramReader* reader) override; | ||
299 | virtual void readElement(Context*, MsooXmlDiagramReader* reader); | 299 | void readElement(Context*, MsooXmlDiagramReader* reader) override; | ||
300 | private: | 300 | private: | ||
301 | QString typeAsString() const; | 301 | QString typeAsString() const; | ||
302 | }; | 302 | }; | ||
303 | 303 | | |||
304 | /// The layout node is the basic building block of diagrams. The layout node is responsible for defining how shapes are arranged in a diagram and how the data maps to a particular shape in a diagram. | 304 | /// The layout node is the basic building block of diagrams. The layout node is responsible for defining how shapes are arranged in a diagram and how the data maps to a particular shape in a diagram. | ||
305 | class LayoutNodeAtom : public AbstractAtom | 305 | class LayoutNodeAtom : public AbstractAtom | ||
306 | { | 306 | { | ||
307 | public: | 307 | public: | ||
308 | QString m_name; | 308 | QString m_name; | ||
309 | ValueCache m_values; | 309 | ValueCache m_values; | ||
310 | QMap<QString, qreal> m_factors; | 310 | QMap<QString, qreal> m_factors; | ||
311 | QMap<QString, int> m_countFactors; | 311 | QMap<QString, int> m_countFactors; | ||
312 | int m_rotateAngle; | 312 | int m_rotateAngle; | ||
313 | bool m_needsReinit, m_needsRelayout, m_childNeedsRelayout; | 313 | bool m_needsReinit, m_needsRelayout, m_childNeedsRelayout; | ||
314 | explicit LayoutNodeAtom() : AbstractAtom("dgm:layoutNode"), m_rotateAngle(0), m_needsReinit(true), m_needsRelayout(true), m_childNeedsRelayout(true), m_firstLayout(true), m_algorithmImpl(0) {} | 314 | explicit LayoutNodeAtom() : AbstractAtom("dgm:layoutNode"), m_rotateAngle(0), m_needsReinit(true), m_needsRelayout(true), m_childNeedsRelayout(true), m_firstLayout(true), m_algorithmImpl(0) {} | ||
315 | virtual ~LayoutNodeAtom() {} | 315 | ~LayoutNodeAtom() override {} | ||
316 | virtual LayoutNodeAtom* clone(Context* context); | 316 | LayoutNodeAtom* clone(Context* context) override; | ||
317 | virtual void dump(Context* context, int level); | 317 | void dump(Context* context, int level) override; | ||
318 | virtual void readAll(Context* context, MsooXmlDiagramReader* reader); | 318 | void readAll(Context* context, MsooXmlDiagramReader* reader) override; | ||
319 | virtual void build(Context* context); | 319 | void build(Context* context) override; | ||
320 | virtual void finishBuild(Context* context); | 320 | void finishBuild(Context* context) override; | ||
321 | virtual void layoutAtom(Context* context); | 321 | void layoutAtom(Context* context) override; | ||
322 | virtual void writeAtom(Context* context, KoXmlWriter* xmlWriter, KoGenStyles* styles); | 322 | void writeAtom(Context* context, KoXmlWriter* xmlWriter, KoGenStyles* styles) override; | ||
323 | 323 | | |||
324 | QList< QExplicitlySharedDataPointer<ConstraintAtom> > constraints() const; | 324 | QList< QExplicitlySharedDataPointer<ConstraintAtom> > constraints() const; | ||
325 | QList< QExplicitlySharedDataPointer<AdjustAtom> > adjustments() const; | 325 | QList< QExplicitlySharedDataPointer<AdjustAtom> > adjustments() const; | ||
326 | 326 | | |||
327 | QExplicitlySharedDataPointer<AlgorithmAtom> algorithm() const; | 327 | QExplicitlySharedDataPointer<AlgorithmAtom> algorithm() const; | ||
328 | void setAlgorithm(QExplicitlySharedDataPointer<AlgorithmAtom> algorithm); | 328 | void setAlgorithm(QExplicitlySharedDataPointer<AlgorithmAtom> algorithm); | ||
329 | 329 | | |||
330 | QList<AbstractNode*> axis(Context* context) const; | 330 | QList<AbstractNode*> axis(Context* context) const; | ||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 366 | public: | |||
385 | /// Specifies the constraint to apply to this layout node. | 385 | /// Specifies the constraint to apply to this layout node. | ||
386 | QString m_type; | 386 | QString m_type; | ||
387 | /// Specifies an absolute value instead of reference another constraint. | 387 | /// Specifies an absolute value instead of reference another constraint. | ||
388 | QString m_value; | 388 | QString m_value; | ||
389 | /// The referenced layout-nodes where we should fetch the values from. | 389 | /// The referenced layout-nodes where we should fetch the values from. | ||
390 | QList< QExplicitlySharedDataPointer<LayoutNodeAtom> > m_referencedLayouts; | 390 | QList< QExplicitlySharedDataPointer<LayoutNodeAtom> > m_referencedLayouts; | ||
391 | 391 | | |||
392 | explicit ConstraintAtom() : AbstractAtom("dgm:constr") {} | 392 | explicit ConstraintAtom() : AbstractAtom("dgm:constr") {} | ||
393 | virtual ~ConstraintAtom() {} | 393 | ~ConstraintAtom() override {} | ||
394 | virtual ConstraintAtom* clone(Context* context); | 394 | ConstraintAtom* clone(Context* context) override; | ||
395 | virtual void dump(Context*, int level); | 395 | void dump(Context*, int level) override; | ||
396 | virtual void readAll(Context*, MsooXmlDiagramReader* reader); | 396 | void readAll(Context*, MsooXmlDiagramReader* reader) override; | ||
397 | virtual void build(Context* context); | 397 | void build(Context* context) override; | ||
398 | virtual void finishBuild(Context* context); | 398 | void finishBuild(Context* context) override; | ||
399 | void applyConstraint(Context* context, LayoutNodeAtom* atom); | 399 | void applyConstraint(Context* context, LayoutNodeAtom* atom); | ||
400 | private: | 400 | private: | ||
401 | QString dump() const; | 401 | QString dump() const; | ||
402 | }; | 402 | }; | ||
403 | 403 | | |||
404 | /// Shape adjust value. These can be used to modify the adjust handles supported on various auto shapes. It is only possible to set the initial value, not to modify it using constraints and rules. | 404 | /// Shape adjust value. These can be used to modify the adjust handles supported on various auto shapes. It is only possible to set the initial value, not to modify it using constraints and rules. | ||
405 | class AdjustAtom : public AbstractAtom | 405 | class AdjustAtom : public AbstractAtom | ||
406 | { | 406 | { | ||
407 | public: | 407 | public: | ||
408 | int m_index; | 408 | int m_index; | ||
409 | qreal m_value; | 409 | qreal m_value; | ||
410 | explicit AdjustAtom() : AbstractAtom("dgm:adj"), m_index(-1) {} | 410 | explicit AdjustAtom() : AbstractAtom("dgm:adj"), m_index(-1) {} | ||
411 | virtual ~AdjustAtom() {} | 411 | ~AdjustAtom() override {} | ||
412 | virtual AdjustAtom* clone(Context* context); | 412 | AdjustAtom* clone(Context* context) override; | ||
413 | virtual void dump(Context* context, int level); | 413 | void dump(Context* context, int level) override; | ||
414 | virtual void readAll(Context* context, MsooXmlDiagramReader* reader); | 414 | void readAll(Context* context, MsooXmlDiagramReader* reader) override; | ||
415 | void applyAdjustment(Context* context, LayoutNodeAtom* atom); | 415 | void applyAdjustment(Context* context, LayoutNodeAtom* atom); | ||
416 | }; | 416 | }; | ||
417 | 417 | | |||
418 | /// Rules indicate the ranges of values that a layout algorithm can use to modify the constraint values if it cannot lay out the graphic by using the constraints. | 418 | /// Rules indicate the ranges of values that a layout algorithm can use to modify the constraint values if it cannot lay out the graphic by using the constraints. | ||
419 | class RuleAtom : public AbstractAtom | 419 | class RuleAtom : public AbstractAtom | ||
420 | { | 420 | { | ||
421 | public: | 421 | public: | ||
422 | QString m_fact; | 422 | QString m_fact; | ||
423 | QString m_for; | 423 | QString m_for; | ||
424 | QString m_forName; | 424 | QString m_forName; | ||
425 | QString m_max; | 425 | QString m_max; | ||
426 | QString m_ptType; | 426 | QString m_ptType; | ||
427 | QString m_type; | 427 | QString m_type; | ||
428 | QString m_value; | 428 | QString m_value; | ||
429 | explicit RuleAtom() : AbstractAtom("dgm:rule") {} | 429 | explicit RuleAtom() : AbstractAtom("dgm:rule") {} | ||
430 | virtual ~RuleAtom() {} | 430 | ~RuleAtom() override {} | ||
431 | virtual RuleAtom* clone(Context* context); | 431 | RuleAtom* clone(Context* context) override; | ||
432 | virtual void dump(Context* context, int level); | 432 | void dump(Context* context, int level) override; | ||
433 | virtual void readAll(Context* context, MsooXmlDiagramReader* reader); | 433 | void readAll(Context* context, MsooXmlDiagramReader* reader) override; | ||
434 | }; | 434 | }; | ||
435 | 435 | | |||
436 | /// List of atoms. | 436 | /// List of atoms. | ||
437 | class ListAtom : public AbstractAtom | 437 | class ListAtom : public AbstractAtom | ||
438 | { | 438 | { | ||
439 | public: | 439 | public: | ||
440 | explicit ListAtom(const QString &tagName) : AbstractAtom(tagName) {} | 440 | explicit ListAtom(const QString &tagName) : AbstractAtom(tagName) {} | ||
441 | explicit ListAtom(const QStringRef &tagName) : AbstractAtom(tagName.toString()) {} | 441 | explicit ListAtom(const QStringRef &tagName) : AbstractAtom(tagName.toString()) {} | ||
442 | virtual ~ListAtom() {} | 442 | ~ListAtom() override {} | ||
443 | virtual ListAtom* clone(Context* context); | 443 | ListAtom* clone(Context* context) override; | ||
444 | virtual void dump(Context* context, int level); | 444 | void dump(Context* context, int level) override; | ||
445 | virtual void readElement(Context* context, MsooXmlDiagramReader* reader); | 445 | void readElement(Context* context, MsooXmlDiagramReader* reader) override; | ||
446 | }; | 446 | }; | ||
447 | 447 | | |||
448 | /// The shape displayed by the containing layout node. Not all layout nodes display shapes. | 448 | /// The shape displayed by the containing layout node. Not all layout nodes display shapes. | ||
449 | class ShapeAtom : public AbstractAtom | 449 | class ShapeAtom : public AbstractAtom | ||
450 | { | 450 | { | ||
451 | public: | 451 | public: | ||
452 | QString m_type; | 452 | QString m_type; | ||
453 | QString m_blip; | 453 | QString m_blip; | ||
454 | bool m_hideGeom; | 454 | bool m_hideGeom; | ||
455 | explicit ShapeAtom() : AbstractAtom("dgm:shape"), m_hideGeom(false) {} | 455 | explicit ShapeAtom() : AbstractAtom("dgm:shape"), m_hideGeom(false) {} | ||
456 | virtual ~ShapeAtom() {} | 456 | ~ShapeAtom() override {} | ||
457 | QList< QExplicitlySharedDataPointer<AdjustAtom> > adjustments() const; | 457 | QList< QExplicitlySharedDataPointer<AdjustAtom> > adjustments() const; | ||
458 | virtual ShapeAtom* clone(Context* context); | 458 | ShapeAtom* clone(Context* context) override; | ||
459 | virtual void dump(Context* context, int level); | 459 | void dump(Context* context, int level) override; | ||
460 | virtual void readAll(Context* context, MsooXmlDiagramReader* reader); | 460 | void readAll(Context* context, MsooXmlDiagramReader* reader) override; | ||
461 | virtual void build(Context* context); | 461 | void build(Context* context) override; | ||
462 | virtual void writeAtom(Context* context, KoXmlWriter* xmlWriter, KoGenStyles* styles); | 462 | void writeAtom(Context* context, KoXmlWriter* xmlWriter, KoGenStyles* styles) override; | ||
463 | //virtual void build(Context* context); | 463 | //virtual void build(Context* context); | ||
464 | }; | 464 | }; | ||
465 | 465 | | |||
466 | /// This element specifies a particular data model point which is to be mapped to the containing layout node. | 466 | /// This element specifies a particular data model point which is to be mapped to the containing layout node. | ||
467 | class PresentationOfAtom : public AbstractAtom | 467 | class PresentationOfAtom : public AbstractAtom | ||
468 | { | 468 | { | ||
469 | public: | 469 | public: | ||
470 | QString m_axis; // This determines how to navigate through the data model, setting the context node as it moves. | 470 | QString m_axis; // This determines how to navigate through the data model, setting the context node as it moves. | ||
471 | QString m_ptType; // dataPointType | 471 | QString m_ptType; // dataPointType | ||
472 | QString m_count; | 472 | QString m_count; | ||
473 | QString m_hideLastTrans; | 473 | QString m_hideLastTrans; | ||
474 | QString m_start; | 474 | QString m_start; | ||
475 | QString m_step; | 475 | QString m_step; | ||
476 | explicit PresentationOfAtom() : AbstractAtom("dgm:presOf") {} | 476 | explicit PresentationOfAtom() : AbstractAtom("dgm:presOf") {} | ||
477 | virtual ~PresentationOfAtom() {} | 477 | ~PresentationOfAtom() override {} | ||
478 | virtual PresentationOfAtom* clone(Context* context); | 478 | PresentationOfAtom* clone(Context* context) override; | ||
479 | virtual void dump(Context* context, int level); | 479 | void dump(Context* context, int level) override; | ||
480 | virtual void readAll(Context* context, MsooXmlDiagramReader* reader); | 480 | void readAll(Context* context, MsooXmlDiagramReader* reader) override; | ||
481 | virtual void build(Context* context); | 481 | void build(Context* context) override; | ||
482 | private: | 482 | private: | ||
483 | QString dump() const; | 483 | QString dump() const; | ||
484 | bool isEmpty() const; | 484 | bool isEmpty() const; | ||
485 | }; | 485 | }; | ||
486 | 486 | | |||
487 | /// The if element represents a condition that applies to all it's children. | 487 | /// The if element represents a condition that applies to all it's children. | ||
488 | class IfAtom : public AbstractAtom | 488 | class IfAtom : public AbstractAtom | ||
489 | { | 489 | { | ||
490 | public: | 490 | public: | ||
491 | QString m_argument; | 491 | QString m_argument; | ||
492 | QString m_axis; | 492 | QString m_axis; | ||
493 | QString m_function; | 493 | QString m_function; | ||
494 | QString m_hideLastTrans; | 494 | QString m_hideLastTrans; | ||
495 | QString m_name; | 495 | QString m_name; | ||
496 | QString m_operator; | 496 | QString m_operator; | ||
497 | QString m_ptType; | 497 | QString m_ptType; | ||
498 | QString m_start; | 498 | QString m_start; | ||
499 | QString m_step; | 499 | QString m_step; | ||
500 | QString m_count; | 500 | QString m_count; | ||
501 | QString m_value; | 501 | QString m_value; | ||
502 | explicit IfAtom(bool isTrue) : AbstractAtom(isTrue ? "dgm:if" : "dgm:else"), m_isTrue(isTrue) {} | 502 | explicit IfAtom(bool isTrue) : AbstractAtom(isTrue ? "dgm:if" : "dgm:else"), m_isTrue(isTrue) {} | ||
503 | virtual ~IfAtom() {} | 503 | ~IfAtom() override {} | ||
504 | virtual IfAtom* clone(Context* context); | 504 | IfAtom* clone(Context* context) override; | ||
505 | virtual void dump(Context* context, int level); | 505 | void dump(Context* context, int level) override; | ||
506 | virtual void readAll(Context* context, MsooXmlDiagramReader* reader); | 506 | void readAll(Context* context, MsooXmlDiagramReader* reader) override; | ||
507 | bool isTrue() const; | 507 | bool isTrue() const; | ||
508 | bool testAtom(Context* context); | 508 | bool testAtom(Context* context); | ||
509 | private: | 509 | private: | ||
510 | bool m_isTrue; | 510 | bool m_isTrue; | ||
511 | }; | 511 | }; | ||
512 | 512 | | |||
513 | /// The choose element wraps if/else blocks into a choose block. | 513 | /// The choose element wraps if/else blocks into a choose block. | ||
514 | class ChooseAtom : public AbstractAtom | 514 | class ChooseAtom : public AbstractAtom | ||
515 | { | 515 | { | ||
516 | public: | 516 | public: | ||
517 | QString m_name; | 517 | QString m_name; | ||
518 | explicit ChooseAtom() : AbstractAtom("dgm:choose") {} | 518 | explicit ChooseAtom() : AbstractAtom("dgm:choose") {} | ||
519 | virtual ~ChooseAtom() {} | 519 | ~ChooseAtom() override {} | ||
520 | virtual ChooseAtom* clone(Context* context); | 520 | ChooseAtom* clone(Context* context) override; | ||
521 | virtual void dump(Context* context, int level); | 521 | void dump(Context* context, int level) override; | ||
522 | virtual void readAll(Context* context, MsooXmlDiagramReader* reader); | 522 | void readAll(Context* context, MsooXmlDiagramReader* reader) override; | ||
523 | virtual void readElement(Context* context, MsooXmlDiagramReader* reader); | 523 | void readElement(Context* context, MsooXmlDiagramReader* reader) override; | ||
524 | virtual void build(Context* context); | 524 | void build(Context* context) override; | ||
525 | }; | 525 | }; | ||
526 | 526 | | |||
527 | /// A looping structure, similar to a for loop in a programming language, which defines what data model points will use this layout node. | 527 | /// A looping structure, similar to a for loop in a programming language, which defines what data model points will use this layout node. | ||
528 | class ForEachAtom : public AbstractAtom | 528 | class ForEachAtom : public AbstractAtom | ||
529 | { | 529 | { | ||
530 | public: | 530 | public: | ||
531 | QString m_axis; | 531 | QString m_axis; | ||
532 | QString m_hideLastTrans; | 532 | QString m_hideLastTrans; | ||
533 | QString m_name; | 533 | QString m_name; | ||
534 | QString m_ptType; | 534 | QString m_ptType; | ||
535 | QString m_reference; | 535 | QString m_reference; | ||
536 | QString m_start; | 536 | QString m_start; | ||
537 | QString m_step; | 537 | QString m_step; | ||
538 | QString m_count; | 538 | QString m_count; | ||
539 | explicit ForEachAtom() : AbstractAtom("dgm:forEach") {} | 539 | explicit ForEachAtom() : AbstractAtom("dgm:forEach") {} | ||
540 | virtual ~ForEachAtom() {} | 540 | ~ForEachAtom() override {} | ||
541 | virtual ForEachAtom* clone(Context* context); | 541 | ForEachAtom* clone(Context* context) override; | ||
542 | virtual void dump(Context* context, int level); | 542 | void dump(Context* context, int level) override; | ||
543 | virtual void readAll(Context* context, MsooXmlDiagramReader* reader); | 543 | void readAll(Context* context, MsooXmlDiagramReader* reader) override; | ||
544 | virtual void build(Context* context); | 544 | void build(Context* context) override; | ||
545 | private: | 545 | private: | ||
546 | QString dump() const; | 546 | QString dump() const; | ||
547 | }; | 547 | }; | ||
548 | 548 | | |||
549 | /// The base class for layout-algorithms. | 549 | /// The base class for layout-algorithms. | ||
550 | class AbstractAlgorithm { | 550 | class AbstractAlgorithm { | ||
551 | public: | 551 | public: | ||
552 | explicit AbstractAlgorithm(); | 552 | explicit AbstractAlgorithm(); | ||
Show All 20 Lines | 570 | private: | |||
573 | QExplicitlySharedDataPointer<LayoutNodeAtom> m_parentLayout; | 573 | QExplicitlySharedDataPointer<LayoutNodeAtom> m_parentLayout; | ||
574 | AbstractNode* m_oldCurrentNode; | 574 | AbstractNode* m_oldCurrentNode; | ||
575 | }; | 575 | }; | ||
576 | 576 | | |||
577 | /// The composite algorithm specifies the size and position for all child layout nodes. You can use it to create graphics with a predetermined layout or in combination with other algorithms to create more complex shapes. | 577 | /// The composite algorithm specifies the size and position for all child layout nodes. You can use it to create graphics with a predetermined layout or in combination with other algorithms to create more complex shapes. | ||
578 | class CompositeAlgorithm : public AbstractAlgorithm { | 578 | class CompositeAlgorithm : public AbstractAlgorithm { | ||
579 | public: | 579 | public: | ||
580 | explicit CompositeAlgorithm() : AbstractAlgorithm() {} | 580 | explicit CompositeAlgorithm() : AbstractAlgorithm() {} | ||
581 | virtual ~CompositeAlgorithm() {} | 581 | ~CompositeAlgorithm() override {} | ||
582 | virtual QString name() const { return "Composite"; } | 582 | QString name() const override { return "Composite"; } | ||
583 | protected: | 583 | protected: | ||
584 | virtual qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values); | 584 | qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values) override; | ||
585 | }; | 585 | }; | ||
586 | 586 | | |||
587 | /// The connector algorithm lays out and routes connecting lines, arrows, and shapes between layout nodes. | 587 | /// The connector algorithm lays out and routes connecting lines, arrows, and shapes between layout nodes. | ||
588 | class ConnectorAlgorithm : public AbstractAlgorithm { | 588 | class ConnectorAlgorithm : public AbstractAlgorithm { | ||
589 | public: | 589 | public: | ||
590 | explicit ConnectorAlgorithm() : AbstractAlgorithm() {} | 590 | explicit ConnectorAlgorithm() : AbstractAlgorithm() {} | ||
591 | virtual ~ConnectorAlgorithm() {} | 591 | ~ConnectorAlgorithm() override {} | ||
592 | virtual QString name() const { return "Connector"; } | 592 | QString name() const override { return "Connector"; } | ||
593 | protected: | 593 | protected: | ||
594 | virtual qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values); | 594 | qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values) override; | ||
595 | virtual void virtualDoLayoutChildren(); | 595 | void virtualDoLayoutChildren() override; | ||
596 | private: | 596 | private: | ||
597 | qreal connectorDistance() const; | 597 | qreal connectorDistance() const; | ||
598 | }; | 598 | }; | ||
599 | 599 | | |||
600 | /// The cycle algorithm lays out child layout nodes around a circle or portion of a circle using equal angle spacing. | 600 | /// The cycle algorithm lays out child layout nodes around a circle or portion of a circle using equal angle spacing. | ||
601 | class CycleAlgorithm : public AbstractAlgorithm { | 601 | class CycleAlgorithm : public AbstractAlgorithm { | ||
602 | public: | 602 | public: | ||
603 | explicit CycleAlgorithm() : AbstractAlgorithm() {} | 603 | explicit CycleAlgorithm() : AbstractAlgorithm() {} | ||
604 | virtual ~CycleAlgorithm() {} | 604 | ~CycleAlgorithm() override {} | ||
605 | virtual QString name() const { return "Cycle"; } | 605 | QString name() const override { return "Cycle"; } | ||
606 | protected: | 606 | protected: | ||
607 | virtual qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values); | 607 | qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values) override; | ||
608 | virtual void virtualDoLayout(); | 608 | void virtualDoLayout() override; | ||
609 | }; | 609 | }; | ||
610 | 610 | | |||
611 | /// The linear algorithm lays out child layout nodes along a horizontal or vertical linear path. | 611 | /// The linear algorithm lays out child layout nodes along a horizontal or vertical linear path. | ||
612 | class LinearAlgorithm : public AbstractAlgorithm { | 612 | class LinearAlgorithm : public AbstractAlgorithm { | ||
613 | public: | 613 | public: | ||
614 | explicit LinearAlgorithm() : AbstractAlgorithm() {} | 614 | explicit LinearAlgorithm() : AbstractAlgorithm() {} | ||
615 | virtual ~LinearAlgorithm() {} | 615 | ~LinearAlgorithm() override {} | ||
616 | virtual QString name() const { return "Linear"; } | 616 | QString name() const override { return "Linear"; } | ||
617 | protected: | 617 | protected: | ||
618 | virtual qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values); | 618 | qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values) override; | ||
619 | virtual void virtualDoLayout(); | 619 | void virtualDoLayout() override; | ||
620 | }; | 620 | }; | ||
621 | 621 | | |||
622 | /// The snake algorithm lays out child layout nodes along a linear path in two dimensions, allowing the linear flow to continue across multiple rows or columns. | 622 | /// The snake algorithm lays out child layout nodes along a linear path in two dimensions, allowing the linear flow to continue across multiple rows or columns. | ||
623 | class SnakeAlgorithm : public AbstractAlgorithm { | 623 | class SnakeAlgorithm : public AbstractAlgorithm { | ||
624 | public: | 624 | public: | ||
625 | explicit SnakeAlgorithm() : AbstractAlgorithm() {} | 625 | explicit SnakeAlgorithm() : AbstractAlgorithm() {} | ||
626 | virtual ~SnakeAlgorithm() {} | 626 | ~SnakeAlgorithm() override {} | ||
627 | virtual QString name() const { return "Snake"; } | 627 | QString name() const override { return "Snake"; } | ||
628 | protected: | 628 | protected: | ||
629 | virtual qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values); | 629 | qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values) override; | ||
630 | virtual void virtualDoLayout(); | 630 | void virtualDoLayout() override; | ||
631 | }; | 631 | }; | ||
632 | 632 | | |||
633 | /// The hierarchy root algorithm works with the hierChild algorithm to create hierarchical tree layouts. | 633 | /// The hierarchy root algorithm works with the hierChild algorithm to create hierarchical tree layouts. | ||
634 | class HierarchyAlgorithm : public AbstractAlgorithm { | 634 | class HierarchyAlgorithm : public AbstractAlgorithm { | ||
635 | public: | 635 | public: | ||
636 | explicit HierarchyAlgorithm(bool isRoot) : AbstractAlgorithm(), m_isRoot(isRoot) {} | 636 | explicit HierarchyAlgorithm(bool isRoot) : AbstractAlgorithm(), m_isRoot(isRoot) {} | ||
637 | virtual ~HierarchyAlgorithm() {} | 637 | ~HierarchyAlgorithm() override {} | ||
638 | virtual QString name() const { return "Hierarchy"; } | 638 | QString name() const override { return "Hierarchy"; } | ||
639 | protected: | 639 | protected: | ||
640 | virtual qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values); | 640 | qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values) override; | ||
641 | virtual void virtualDoLayout(); | 641 | void virtualDoLayout() override; | ||
642 | private: | 642 | private: | ||
643 | bool m_isRoot; // root or child? | 643 | bool m_isRoot; // root or child? | ||
644 | }; | 644 | }; | ||
645 | 645 | | |||
646 | /// The pyramid algorithm lays out child layout nodes along a vertical path and works with the trapezoid shape to create a pyramid. | 646 | /// The pyramid algorithm lays out child layout nodes along a vertical path and works with the trapezoid shape to create a pyramid. | ||
647 | class PyramidAlgorithm : public AbstractAlgorithm { | 647 | class PyramidAlgorithm : public AbstractAlgorithm { | ||
648 | public: | 648 | public: | ||
649 | explicit PyramidAlgorithm() : AbstractAlgorithm() {} | 649 | explicit PyramidAlgorithm() : AbstractAlgorithm() {} | ||
650 | virtual ~PyramidAlgorithm() {} | 650 | ~PyramidAlgorithm() override {} | ||
651 | virtual QString name() const { return "Pyramid"; } | 651 | QString name() const override { return "Pyramid"; } | ||
652 | protected: | 652 | protected: | ||
653 | virtual qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values); | 653 | qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values) override; | ||
654 | virtual void virtualDoLayout(); | 654 | void virtualDoLayout() override; | ||
655 | }; | 655 | }; | ||
656 | 656 | | |||
657 | /// The space algorithm is used to specify a minimum space between other layout nodes or as an indication to do nothing with the layout node’s size and position. | 657 | /// The space algorithm is used to specify a minimum space between other layout nodes or as an indication to do nothing with the layout node’s size and position. | ||
658 | class SpaceAlg : public AbstractAlgorithm { | 658 | class SpaceAlg : public AbstractAlgorithm { | ||
659 | public: | 659 | public: | ||
660 | explicit SpaceAlg() : AbstractAlgorithm() {} | 660 | explicit SpaceAlg() : AbstractAlgorithm() {} | ||
661 | virtual ~SpaceAlg() {} | 661 | ~SpaceAlg() override {} | ||
662 | virtual QString name() const { return "Space"; } | 662 | QString name() const override { return "Space"; } | ||
663 | protected: | 663 | protected: | ||
664 | virtual qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values); | 664 | qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values) override; | ||
665 | virtual void virtualDoLayout(); | 665 | void virtualDoLayout() override; | ||
666 | }; | 666 | }; | ||
667 | 667 | | |||
668 | /// The text algorithm sizes text to fit inside a shape and controls its margins and alignment. | 668 | /// The text algorithm sizes text to fit inside a shape and controls its margins and alignment. | ||
669 | class TextAlgorithm : public AbstractAlgorithm { | 669 | class TextAlgorithm : public AbstractAlgorithm { | ||
670 | public: | 670 | public: | ||
671 | explicit TextAlgorithm() : AbstractAlgorithm() {} | 671 | explicit TextAlgorithm() : AbstractAlgorithm() {} | ||
672 | virtual ~TextAlgorithm() {} | 672 | ~TextAlgorithm() override {} | ||
673 | virtual QString name() const { return "Text"; } | 673 | QString name() const override { return "Text"; } | ||
674 | protected: | 674 | protected: | ||
675 | virtual qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values); | 675 | qreal virtualGetDefaultValue(const QString& type, const QMap<QString, qreal>& values) override; | ||
676 | virtual void virtualDoLayout(); | 676 | void virtualDoLayout() override; | ||
677 | }; | 677 | }; | ||
678 | 678 | | |||
679 | }} // namespace MSOOXML::Diagram | 679 | }} // namespace MSOOXML::Diagram | ||
680 | 680 | | |||
681 | #endif | 681 | #endif |