home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / sclayer.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-12  |  9.0 KB  |  330 lines

  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. #ifndef SCLAYER_H
  8. #define SCLAYER_H
  9.  
  10. #include <QColor>
  11. #include <QString>
  12. #include <QList>
  13. #include <QSet>    //necessary to avoid msvc warnings induced by SCRIBUS_API on ScLayers + early instanciation of templates
  14.  
  15. #include "scribusapi.h"
  16.  
  17. class SCRIBUS_API ScLayer
  18. {
  19. public:
  20.     ScLayer(void);
  21.     ScLayer(const QString& name, int level, int nr);
  22.     QString Name;
  23.     int     LNr;
  24.     int     Level;
  25.     bool    isPrintable;
  26.     bool    isViewable;
  27.     bool    isEditable;
  28.     bool    flowControl;
  29.     bool    outlineMode;
  30.     double  transparency;
  31.     int     blendMode;
  32.     QColor  markerColor;
  33.     bool operator< (const ScLayer& other) const;
  34.     bool operator== (const ScLayer& other) const;
  35. };
  36.  
  37. class SCRIBUS_API ScLayers : public QList<ScLayer>
  38. {
  39. protected:
  40.     /**
  41.      * @brief  Get layer max identifier
  42.      * @return Layer max identifier or -1 is list is empty
  43.      */
  44.     int getMaxNumber(void);
  45. public:
  46.  
  47.     /**
  48.      * @brief  Get bottom layer
  49.      * @return bottom layer or NULL if list is empty
  50.      */
  51.     const ScLayer* bottomLayer (void) const;
  52.  
  53.     /**
  54.      * @brief  Get top layer
  55.      * @return top layer or NULL if list is empty
  56.      */
  57.     const ScLayer* topLayer (void) const;
  58.  
  59.     /**
  60.      * @brief  Get layer at a specific level, replace old Level2Layer in util.cpp
  61.     \param layer a reference to the ScLayer
  62.      * @param  level the layer level
  63.      * @return the desired layer or NULL if not found
  64.      */
  65.     void levelToLayer (ScLayer& layer, int level) const;
  66.  
  67.     /**
  68.      * @brief  Get bottom layer
  69.      * @return bottom layer or NULL if list is empty
  70.      */
  71.     ScLayer* bottom(void);
  72.  
  73.     /**
  74.      * @brief  Get top layer
  75.      * @return top layer or NULL if list is empty
  76.      */
  77.     ScLayer* top(void);
  78.  
  79.     /**
  80.      * @brief  Get layer at a specific level
  81.      * @param  level the layer level
  82.      * @return layer with the specified level or NULL if not found
  83.      */
  84.     ScLayer* byLevel(const int level);
  85.  
  86.     /**
  87.      * @brief  Get layer with a specific number
  88.      * @param  nr the layer number
  89.      * @return layer with the specified number or NULL if not found
  90.      */
  91.     ScLayer* byNumber(const int nr);
  92.  
  93.     /**
  94.      * @brief  Get layer above the layer with the specified ID
  95.      * @param  nr number of the layer level
  96.      * @return layer above the specific layer or top layer if no layer above specified level was found
  97.      */
  98.     ScLayer* above (int nr);
  99.  
  100.     /**
  101.      * @brief  Get layer below the layer with the specified ID
  102.      * @param  nr the layer level
  103.      * @return layer below the specific layer or bottom layer if no layer below specified level was found
  104.      */
  105.     ScLayer* below (int nr);
  106.  
  107.     /**
  108.      * @brief  Get layer at a specific level
  109.      * @param  level the layer level
  110.      * @return layer with the specified level or NULL if not found
  111.      */
  112.     const ScLayer* layerByLevel (int level) const;
  113.  
  114.     /**
  115.      * @brief  Get layer with a specific number
  116.      * @param  nr the layer number
  117.      * @return layer with the specified number or NULL if not found
  118.      */
  119.     const ScLayer* layerByNumber (int nr) const;
  120.  
  121.     /**
  122.      * @brief  Get layer with a specific name
  123.      * @param  name the layer name
  124.      * @return layer with the specified name or NULL if not found
  125.      */
  126.     const ScLayer* layerByName (const QString& name) const;
  127.  
  128.     /**
  129.      * @brief  Get layer above a specific level
  130.      * @param  level the layer level
  131.      * @return layer above the specific layer or top layer if no layer above specified level was found
  132.      */
  133.     const ScLayer* layerAbove (int level) const;
  134.  
  135.     /**
  136.      * @brief  Get layer above a specific layer
  137.      * @param  layer the layer
  138.      * @return layer above the specific layer or top layer if no layer above specified level was found
  139.      */
  140.     const ScLayer* layerAbove (const ScLayer& layer) const;
  141.  
  142.     /**
  143.      * @brief  Get layer below a specific level
  144.      * @param  level the layer level
  145.      * @return layer below the specific layer or bottom layer if no layer below specified level was found
  146.      */
  147.     const ScLayer* layerBelow (int level) const;
  148.  
  149.     /**
  150.      * @brief  Get layer below a specific layer
  151.      * @param  layer the layer
  152.      * @return layer below the specific layer or bottom layer if no layer below specified level was found
  153.      */
  154.     const ScLayer* layerBelow (const ScLayer& layer) const;
  155.  
  156.     /**
  157.      * @brief  Add a layer to the layer list
  158.      * @param  layerName the layer name (may be empty)
  159.      * @return the new layer id on success, -1 on failure
  160.      */
  161.     int addLayer(const QString& layerName);
  162.  
  163.     /**
  164.      * @brief  Add a layer to the layer list
  165.      * @param  layer the layer object
  166.      * @return the new layer id on success, -1 on failure
  167.      */
  168.     int addLayer(const ScLayer& layer);
  169.  
  170.     /**
  171.      * @brief  Add a layer to the layer list
  172.      * @param  layerName the layer name (may be empty)
  173.      * @return the new layer on success, NULL on failure
  174.      */
  175.     ScLayer* newLayer(const QString& layerName);
  176.  
  177.     /**
  178.      * @brief  Remove a layer from the layer list
  179.      * @param  the layer number to remove
  180.      */
  181.     bool removeLayerByNumber(int nr);
  182.  
  183.     /**
  184.      * @brief  Remove a layer from the layer list
  185.      * @param  the layer level to remove
  186.      */
  187.     bool removeLayerByLevel(int level);
  188.  
  189.     /**
  190.      * @brief  Raise the layer with the specified ID
  191.      * @return success or failure
  192.      */
  193.     bool raiseLayer(int nr);
  194.  
  195.     /**
  196.      * @brief  Lower the layer with the specified ID
  197.      * @return success or failure
  198.      */
  199.     bool lowerLayer(int nr);
  200.  
  201.     /**
  202.      * @brief  sort layers by level order
  203.      */
  204.     void sort(void);
  205.  
  206.     /**
  207.      * @brief Is the layer printable
  208.      * @param layerNumber ID of the layer
  209.      * @return Printable or not
  210.      */
  211.     bool layerPrintable(const int layerNumber) const;
  212.  
  213.     /**
  214.      * @brief Set the layer printable via the layer number
  215.      * @param layerNumber ID of the layer
  216.      * @param isPrintable bool true = layer is prantable
  217.      * @return Success or failure
  218.      */
  219.     bool setLayerPrintable(const int layerNumber, const bool isPrintable);
  220.  
  221.     /**
  222.      * @brief Is the layer visible
  223.      * @param layerNumber ID of the layer
  224.      * @return Visible or not
  225.      */
  226.     bool layerVisible(const int layerNumber) const;
  227.  
  228.     /**
  229.      * @brief Set the layer visible via the layer number
  230.      * @param layerNumber ID of the layer
  231.      * @param isViewable true = layer is visible
  232.      * @return Success or failure
  233.      */
  234.     bool setLayerVisible(const int layerNumber, const bool isViewable);
  235.  
  236.     /**
  237.      * @brief Is the layer locked
  238.      * @param layerNumber ID of the layer
  239.      * @return Locked or not
  240.      */
  241.     bool layerLocked(const int layerNumber) const;
  242.  
  243.     /**
  244.      * @brief Set the layer locked via the layer number
  245.      * @param layerNumber ID of the layer
  246.      * @param isViewable true = layer is locked
  247.      * @return bool Success or failure
  248.      */
  249.     bool setLayerLocked(const int layerNumber, const bool isViewable);
  250.  
  251.     /**
  252.      * @brief does text flow around objects on this layer
  253.      * @param layerNumber ID of the layer
  254.      * @return flow or not
  255.      */
  256.     bool layerFlow(const int layerNumber) const;
  257.  
  258.     /**
  259.      * @brief Set the layer flow via the layer number
  260.      * @param layerNumber ID of the layer
  261.      * @param flow true = Text flows around objects on this layer
  262.      * @return Success or failure
  263.      */
  264.     bool setLayerFlow(const int layerNumber, const bool flow);
  265.  
  266.     /**
  267.      * @brief is this layer in outline mode
  268.      * @param layerNumber ID of the layer
  269.      * @return outline or not
  270.      */
  271.     bool layerOutline(const int layerNumber) const;
  272.  
  273.     /**
  274.      * @brief Set the layer outline mode via the layer number
  275.      * @param layerNumber ID of the layer
  276.      * @param outline true = layer is displayed in outlines only
  277.      * @return Success or failure
  278.      */
  279.     bool setLayerOutline(const int layerNumber, const bool outline);
  280.  
  281.     /**
  282.      * @brief returns the layer transparency
  283.      * @param layerNumber ID of the layer
  284.      * @return transparency value 0.0 - 1.0
  285.      */
  286.     double layerTransparency(const int layerNumber) const;
  287.  
  288.     /**
  289.      * @brief Set the layer transparency via the layer number
  290.      * @param layerNumber ID of the layer
  291.      * @param trans transparency value 0.0 - 1.0
  292.      * @return Success or failure
  293.      */
  294.     bool setLayerTransparency(const int layerNumber, double trans);
  295.  
  296.     /**
  297.      * @brief returns the layer BlendMode
  298.      * @param layerNumber ID of the layer
  299.      * @return layerBlendMode
  300.      */
  301.     int layerBlendMode(const int layerNumber) const;
  302.  
  303.     /**
  304.      * @brief Set the layer layerBlendMode via the layer number
  305.      * @param layerNumber ID of the layer
  306.      * @param trans layerBlendMode
  307.      * @return Success or failure
  308.      */
  309.     bool setLayerBlendMode(const int layerNumber, int blend);
  310.  
  311.     /**
  312.      * @brief returns the layer marker color
  313.      * @param layerNumber Number of the layer
  314.      * @return marker color
  315.      */
  316.     QColor layerMarker(const int layerNumber) const;
  317.  
  318.     /**
  319.      * @brief Set the layer marker color
  320.      * @param layerNumber ID of the layer
  321.      * @param color color of the marker
  322.      * @return Success or failure
  323.      */
  324.      bool setLayerMarker(const int layerNumber, QColor color);
  325. };
  326.  
  327. uint qHash(const ScLayer& layer);
  328.  
  329. #endif
  330.