21#ifndef KSPREAD_SELECTION
22#define KSPREAD_SELECTION
34class Selection :
public TQObject,
public Region
40 Selection(
const Selection&);
46 void initialize(
const TQPoint&, Sheet* sheet = 0);
50 void initialize(
const TQRect&, Sheet* sheet = 0);
54 void initialize(
const Region&, Sheet* sheet = 0);
63 void update(
const TQPoint&);
68 void extend(
const TQPoint&, Sheet* sheet = 0);
72 void extend(
const TQRect&, Sheet* sheet = 0);
76 void extend(
const Region&);
82 virtual Element* eor(
const TQPoint& point, Sheet* sheet = 0);
87 const TQPoint& anchor()
const;
91 const TQPoint& cursor()
const;
95 const TQPoint& marker()
const;
100 bool isSingular()
const;
104 TQRect selectionHandleArea()
const;
109 TQString name(Sheet* originSheet = 0)
const;
115 void setSheet(Sheet* sheet);
119 Sheet* sheet()
const;
124 void setActiveElement(
const TQPoint& point);
128 void setActiveElement(uint number);
132 Element* activeElement()
const;
137 void setActiveSubRegion(uint start, uint length);
141 TQString activeSubRegionName()
const;
145 void clearSubRegion();
149 void fixSubRegionDimension();
153 virtual void clear();
159 void setMultipleSelection(
bool state);
161 TQRect lastRange(
bool extend =
true)
const;
162 TQRect extendToMergedAreas(TQRect area)
const;
164 const TQValueList<TQColor>& colors()
const;
167 TQRect selection(
bool extend =
true)
const;
170 void changed(
const Region&);
176 virtual Region::Point* createPoint(
const TQPoint&)
const;
177 virtual Region::Point* createPoint(
const TQString&)
const;
178 virtual Region::Point* createPoint(
const Point&)
const;
179 virtual Region::Range* createRange(
const TQRect&)
const;
180 virtual Region::Range* createRange(
const TQString&)
const;
181 virtual Region::Range* createRange(
const Range&)
const;
192class Selection::Point :
public Region::Point
195 Point(
const TQPoint& point);
196 Point(
const TQString&
string);
198 void setColor(
const TQColor& color) { m_color = color; }
199 virtual const TQColor& color()
const {
return m_color; }
201 bool columnFixed()
const {
return m_columnFixed; }
202 bool rowFixed()
const {
return m_rowFixed; }
208 bool m_columnFixed : 1;
216class Selection::Range :
public Region::Range
219 Range(
const TQRect& rect);
220 Range(
const TQString&
string);
222 virtual bool isColorizable()
const {
return true; }
224 void setColor(
const TQColor& color) { m_color = color; }
225 const TQColor& color()
const {
return m_color; }
231 bool m_leftFixed : 1;
232 bool m_rightFixed : 1;
234 bool m_bottomFixed : 1;
244inline kdbgstream operator<<( kdbgstream str,
const KSpread::Selection& s )
246 str <<
"Selection = " << s.name();
250inline kndbgstream operator<<( kndbgstream str,
const KSpread::Selection& )