OSDN Git Service

[denncoCreator] expand the rectangle of DCVCPage when a cell is placed outside the...
[dennco/denncoCreator.git] / Source / visualizer / component / dcvcpage.h
index b6c0efc..acc7302 100644 (file)
@@ -22,6 +22,7 @@
 #include "dcvcomponent.h"
 
 class DCVPageComponent;
+class DCContainer;
 
 class DCVCPage : public DCVComponent
 {
@@ -40,6 +41,8 @@ class DCVCPage : public DCVComponent
 
     DCVPageComponent *d_editCursor;
 
+    QString d_hash;
+
 public:
     DCVCPage(const QString &locationPath);
     virtual ~DCVCPage();
@@ -49,6 +52,9 @@ public:
     virtual DCVVisibility   getIsVisible() const { return d_colorA == 0 ?  DCV_VISIBLE_NONE : DCVComponent::getIsVisible(); }
     virtual bool            isResizingArea(float x, float y, float z) const { return false; }
     QString                 getLocationPath() const { return d_locationPath; }
+    bool                    getIsModified(DCContainer *container) const;
+    inline float            getWidth() const { return d_width; }
+    inline float            getDepth() const { return d_depth; }
 
     const QList<DCVPageComponent*>* getCells() const { return &d_cells; }
     const QList<DCVPageComponent*>* getCellCodeClasses() const { return &d_cellCodeClasses; }
@@ -57,7 +63,7 @@ public:
     // They are called from DCVCCell.
     // Other classes shouldn't call this directly.
     // To change the page a cell belonging,
-    // DCVCCell::changePageBelonging() should be called instead.
+    // DCMoveCellCommand() should be used instead.
     void registerCell(DCVPageComponent *cell);
     void unregisterCell(DCVPageComponent *cell);
 
@@ -65,7 +71,7 @@ public:
     // They are called from DCVCCellCode.
     // Other classes shouldn't call this directly.
     // To change the page a cell code class belonging,
-    // DCVCCellCode::changePageBelonging() should be called instead.
+    // DCMoveCellCodeClassCommand should be used instead.
     void registerCellCodeClass(DCVPageComponent *cellCodeClass);
     void unregisterCellCodeClass(DCVPageComponent *cellCodeClass);
 
@@ -77,6 +83,19 @@ public:
     void registerEditCursor(DCVPageComponent *ecursor);
     void unregisterEditCursor();
 
+    /**
+     * @brief Move cells and cell codes belong to this page to newPage.
+     * @param newPage : the target page cells and cell codes are moving into.
+     *
+     * This will move cells, cell codes and connections belong to this page to the page passed in the parameter.
+     * This expected to be called from DCContainer.
+     * This shouldn't be called directly.
+     * To change the path / file name for a container file, DCMovePageCommand should be used.
+     *
+     * @return true for succuss, false for failure.
+     */
+    bool moveComponentsTo(DCVCPage *newPage);
+
     void updateVisiblity(bool linkedCellVisible, bool linkedCellRenderFull, bool linkedCellSelectable, bool otherCellVisible, bool otherCellRenderFull, bool otherCellSelectable);
 
     virtual void    prepareChildrenForDraw(bool isAnimationInterval);
@@ -92,13 +111,15 @@ public:
     virtual bool    endDrag(float x, float y, float z, bool isResizingDrag);
     virtual void    updateShape() {}
 
-    virtual void    saveAttributesToXML(QDomDocument *document, QDomElement* element);
+    virtual void    saveAttributesToXML(QDomDocument *document, QDomElement* element) const;
     virtual void    loadAttributesFromXML(QDomElement element);
 
     void setHeight(float height);
     void setWidth(float width);
     void setDepth(float depth);
     void setColor(float r, float g, float b, float a);
+
+    void updateSavedState(DCContainer *container);
 };
 
 #endif // DCVCPAGE_H