/usr/include/scribus/selection.h is in scribus-dev 1.4.6+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | /*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
copyright : (C) 2005 by Craig Bradney
email : cbradney@zip.com.au
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SELECTION_H
#define SELECTION_H
#include <QList>
#include <QMap>
#include <QObject>
#include <QPointer>
#include "pageitem.h"
#include "scribusapi.h"
typedef QList< QPointer<PageItem> > SelectionList;
class SCRIBUS_API Selection : public QObject
{
Q_OBJECT
public:
/**
* \brief Create an empty selection that is not a GUI selection
* @param parent QObject
*/
explicit Selection(QObject* parent); // otherwise implicit conversion Selection* -> Selection& is possible
/**
* \brief Create an empty selection that may be a GUI selection
* @param parent QObject
* @param guiSelection If the selection is to be a GUI selection
*/
Selection(QObject* parent, bool guiSelection);
/**
* \brief Copy a selection
* \note We are leaving the connections of the items in place
* and the isGUISelection set in the copy. We cannot disconnect them
* as they may be connected via the main GUI selection.
* @param other selection
*/
Selection(const Selection& other);
Selection& operator=( const Selection & );
~Selection();
/**
* \brief Copy the selection of items from one selection to another
*/
void copy(Selection& other, bool emptyOther);
bool connectItemToGUI();
/**
* \brief Disconnect all items from the GUI slots.
* This should not really be necessary if all things are going ok
* except for within the clearAll function.
* @return bool true on success
*/
bool disconnectAllItemsFromGUI();
/**
* @brief Add an item to the selection.
* If its added to a GUI selection selection and its item 0, its connected to the GUI too
* @param item Item to add
* @param ignoreGUI Dont connect Item To GUI even if this is a GUI selection
* @return If the item was added
*/
bool addItem(PageItem *item, bool ignoreGUI=false);
/**
* @brief Prepend an item to the selection.
* If its added to a GUI selection selection and its item 0, its connected to the GUI too
* @param item Item to add
* @param doEmit call emitAllToGUI()
* @return If the item was added
*/
bool prependItem(PageItem *item, bool doEmit=true);
bool containsItem(PageItem *item) const { return m_SelList.contains(item); }
/**
* \brief Unused
*/
bool addGroup();
/**
* \brief Remove an item from list
* @param item page item
*/
bool removeItem(PageItem *item);
/**
* \brief Remove the first item from the list
* @return If the remove was successful
*/
bool removeFirst();
/**
* \brief Unused
*/
bool removeGroup();
/**
* \brief Remove an item from list listNumber and return a pointer to it
* @param itemIndex Index of the item in the list
* @return Item
*/
PageItem* takeItem(int itemIndex);
/**
* \brief Find an item from the selection and return an index to it
* @param item Item pointer to find in the list
* @return Item
*/
int findItem(PageItem *item) const { return m_SelList.indexOf(item); }
/**
* \brief Return the count of the selection
*/
int count() const { return m_SelList.count(); }
/**
* \brief Check if the selection is empty.
*/
bool isEmpty() const { return m_SelList.count()==0; }
/**
* \brief Clear a list
*/
bool clear();
/**
* \brief See if the first selected item is "me", usually called from an item object with "this".
* @param item PageItem reference
*/
bool primarySelectionIs(const PageItem* item) const { return (!m_SelList.isEmpty() && (item==m_SelList.first())); }
/**
* \brief Return item at specified index in the selection
* @param index index in selection
* @return Item
*/
PageItem *itemAt(int index=0) { return itemAt_(index); }
/**
* \brief Return item at specified index in the selection
* @param index index in selection
* @return const Item
*/
const PageItem *itemAt(int index=0) const { return const_cast<Selection*>(this)->itemAt_(index); }
/**
* \brief Get name of selected items
*/
QStringList getSelectedItemsByName() const;
/**
* \brief Return range of selected items. If selection is empty, the lowest index returned
* will be strictly superior to the highest
* @param lowest index of the lowest item number in the selection
* @param highest indest of the higest item number in the selection
*/
void getItemRange(int& lowest, int & highest);
bool isMultipleSelection() const { return m_hasGroupSelection; }
bool isGUISelection() const { return m_isGUISelection; }
double width() const;
double height() const;
//set the group rectangle properties
void setGroupRect();
void getGroupRect(double *x, double *y, double *w, double *h);
void getVisualGroupRect(double *x, double *y, double *w, double *h);
//!\brief Test to see if all items in the selection are the same typedef
bool itemsAreSameType() const;
/**
* \brief get the layer ID of items in the selection
* @return the layer ID or -1 if items do not belong to the same layer
*/
int objectsLayer(void) const;
bool signalsDelayed(void);
void delaySignalsOn(void);
void delaySignalsOff(void);
protected:
PageItem *itemAt_(int index=0);
SelectionList m_SelList;
bool m_hasGroupSelection;
bool m_isGUISelection;
double groupX;
double groupY;
double groupW;
double groupH;
double visualGX;
double visualGY;
double visualGW;
double visualGH;
int m_delaySignals;
bool m_sigSelectionChanged;
bool m_sigSelectionIsMultiple;
void addItemInternal(PageItem* item);
void prependItemInternal(PageItem* item);
void addGroupItem(PageItem* item);
void sendSignals(bool guiConnect = true);
signals:
void selectionIsMultiple(bool);
void empty();
void selectionChanged();
};
#endif
|