#include <txtattr.h>
Inheritance diagram for TxtRulerAttribute:
Public Member Functions | |
TxtRulerAttribute () | |
Default Constructor for TxtRulerAttribute Creates an empty tab stops list. | |
~TxtRulerAttribute () | |
Destructor. | |
virtual void | Restore (RenderRegion *, BOOL) |
Restores the TxtRulerAttribute attribute for the given render region. | |
virtual void | Render (RenderRegion *pRegion, BOOL Temp=FALSE) |
Sets the TxtRulerAttribute attribute for the given render region. | |
virtual void | SimpleCopy (AttributeValue *) |
See AttributeValue::SimpleCopy. | |
virtual NodeAttribute * | MakeNode () |
Make a AttrTxtTracking node, see base class. | |
BOOL | IsDifferent (AttributeValue *pAttr) |
See base class version. | |
virtual TxtRulerAttribute & | operator= (TxtRulerAttribute &Attrib) |
Assignment operator. | |
INT32 | operator== (const TxtRulerAttribute &Attrib) |
Comparison operator. See NodeAttribute::operator== for a description of why it's required. | |
void | AddTabStop (TxtTabType Type, MILLIPOINT Position) |
Adds a new tab stop at the given position to the sorted list, removing any other tab stop already present at this position. | |
void | AddTabStop (TxtTabType Type, MILLIPOINT Position, WCHAR DecimalPointChar, WCHAR TabFillerChar) |
Adds a new tab stop at the given position to the sorted list, removing any other tab stop already present at this position. | |
void | AddTabStop (TxtTabStop TabStop) |
Adds a new tab stop at the given position to the sorted list, removing any other tab stop already present at this position. | |
void | FindTabStop (MILLIPOINT MinPos, TxtTabType *pType, MILLIPOINT *pPos, WCHAR *pDecimalPointChar) const |
Finds a tab stop at the given position or higher. | |
const_TxtTabStopIterator | begin () const |
const_TxtTabStopIterator | end () const |
TxtTabStopIterator | begin () |
TxtTabStopIterator | end () |
INT32 | NumTabStops () const |
Static Public Member Functions | |
static BOOL | Init () |
Registers default attribute. | |
static void | FindTabStopInRuler (const TxtRuler *pRuler, MILLIPOINT MinPos, TxtTabType *pType, MILLIPOINT *pPos, WCHAR *pDecimalPointChar) |
Finds a tab stop at the given position or higher. | |
Public Attributes | |
TxtRuler * | Value |
Private Member Functions | |
TxtRulerAttribute (const TxtRulerAttribute &) |
Definition at line 642 of file txtattr.h.
|
Default Constructor for TxtRulerAttribute Creates an empty tab stops list.
Definition at line 3037 of file txtattr.cpp.
|
|
Destructor.
Definition at line 3051 of file txtattr.cpp. 03052 { 03053 delete Value; 03054 }
|
|
|
|
Adds a new tab stop at the given position to the sorted list, removing any other tab stop already present at this position.
Definition at line 3068 of file txtattr.cpp. 03069 { 03070 MILLIPOINT Position = TabStop.GetPosition(); 03071 TxtTabStopIterator It = begin(); 03072 TxtTabStopIterator End = end(); 03073 while(It != End) 03074 { 03075 if ((*It).GetPosition() > Position) break; 03076 else if ((*It).GetPosition() == Position) 03077 { 03078 // modify this tab directly 03079 (*It) = TabStop; 03080 return; 03081 } 03082 ++It; 03083 } 03084 Value->insert(It, TabStop); 03085 }
|
|
Adds a new tab stop at the given position to the sorted list, removing any other tab stop already present at this position.
Definition at line 3130 of file txtattr.cpp. 03131 { 03132 TxtTabStopIterator It = begin(); 03133 TxtTabStopIterator End = end(); 03134 while(It != End) 03135 { 03136 if ((*It).GetPosition() > Position) break; 03137 else if ((*It).GetPosition() == Position) 03138 { 03139 // modify this tab directly 03140 *It = TxtTabStop(Type, Position, DecimalPointChar, TabFillerChar); 03141 return; 03142 } 03143 ++It; 03144 } 03145 Value->insert(It, TxtTabStop(Type, Position, DecimalPointChar, TabFillerChar)); 03146 }
|
|
Adds a new tab stop at the given position to the sorted list, removing any other tab stop already present at this position.
Definition at line 3100 of file txtattr.cpp. 03101 { 03102 TxtTabStopIterator It = begin(); 03103 TxtTabStopIterator End = end(); 03104 while(It != End) 03105 { 03106 if ((*It).GetPosition() > Position) break; 03107 else if ((*It).GetPosition() == Position) 03108 { 03109 // modify this tab directly 03110 (*It).SetType(Type); 03111 return; 03112 } 03113 ++It; 03114 } 03115 Value->insert(It, TxtTabStop(Type, Position)); 03116 }
|
|
Definition at line 668 of file txtattr.h. 00668 { return Value->begin(); }
|
|
Definition at line 666 of file txtattr.h. 00666 { return Value->begin(); }
|
|
Definition at line 669 of file txtattr.h. 00669 { return Value->end(); }
|
|
Definition at line 667 of file txtattr.h. 00667 { return Value->end(); }
|
|
Finds a tab stop at the given position or higher.
Definition at line 3161 of file txtattr.cpp. 03163 { 03164 FindTabStopInRuler(Value, MinPos, pType, pPos, pDecimalPointChar); 03165 }
|
|
Finds a tab stop at the given position or higher.
Definition at line 3181 of file txtattr.cpp. 03183 { 03184 // we cope with pRuler being NULL, in which case we simply treat it as empty 03185 if (pRuler) 03186 { 03187 for(const_TxtTabStopIterator It = pRuler->begin() ; It != pRuler->end(); ++It) 03188 { 03189 // NB - we must find a tab stop *beyond* our current position, we cannot 03190 // take the one exactly at our position - otherwise, having a tab 03191 // directly after a tab would not advance to the next tab stop 03192 if ((*It).GetPosition() > MinPos) { 03193 *pType = (*It).GetType(); 03194 *pPos = (*It).GetPosition(); 03195 if ((*It).GetType() == DecimalTab) 03196 *pDecimalPointChar = (*It).GetDecimalPointChar(); 03197 return; 03198 } 03199 } 03200 } 03201 // we did not find any tab stop beyond our position, so assume equidistant left tabs 03202 // at each multiple of 0.5in (this is what OpenOffice does) 03203 *pType = LeftTab; 03204 *pPos = MinPos + 36000 - (MinPos % 36000); 03205 }
|
|
Registers default attribute.
Reimplemented from SimpleCCObject. Definition at line 3450 of file txtattr.cpp. 03451 { 03452 TxtRulerAttribute *pAttr = new TxtRulerAttribute; 03453 if (pAttr==NULL) 03454 // error message has already been set by new 03455 return FALSE; 03456 03457 // The default ruler attribute is an empty ruler, so we need not do anything 03458 // here. There are implicit left align tab stops at multiples of 0.5in beyond 03459 // the last user-defined tab stop, so tabs always have an effect. 03460 #if 0 03461 PORTNOTE("text","Just for testing, add a tab stop of each type") 03462 // To test the various tab stop types without requiring a user interface for 03463 // setting tab stops, simply enable this code section 03464 pAttr->AddTabStop(LeftTab, 80000); 03465 pAttr->AddTabStop(CentreTab, 160000); 03466 pAttr->AddTabStop(RightTab, 280000); 03467 pAttr->AddTabStop(DecimalTab, 300000); 03468 #endif 03469 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 03470 pAttr); 03471 03472 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtRulerAttribute"); 03473 03474 return TRUE; 03475 }
|
|
See base class version.
Reimplemented from AttributeValue. Definition at line 3427 of file txtattr.cpp. 03428 { 03429 // This must be at least a FillGeometryAttribute... 03430 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtRulerAttribute)), 03431 "Different attribute types in TxtRulerAttribute::IsDifferent()"); 03432 03433 // Check they are NOT the same. 03434 return ( !(*((TxtRulerAttribute *)pAttr) == *this) ); 03435 }
|
|
Make a AttrTxtTracking node, see base class.
Reimplemented from AttributeValue. Definition at line 3490 of file txtattr.cpp. 03491 { 03492 // Create new attribute node 03493 AttrTxtRuler* pAttr = new AttrTxtRuler(); 03494 if (pAttr==NULL) 03495 // error message has already been set by new 03496 return NULL; 03497 03498 // Copy attribute value into the new node. 03499 pAttr->Value.SimpleCopy(this); 03500 03501 // Return the new node 03502 return pAttr; 03503 }
|
|
Definition at line 670 of file txtattr.h. 00670 { return Value->size(); }
|
|
Assignment operator.
Definition at line 3253 of file txtattr.cpp. 03254 { 03255 *Value = *Attrib.Value; // use TxtRuler's assignment operator (list template class) 03256 return *this; 03257 }
|
|
Comparison operator. See NodeAttribute::operator== for a description of why it's required.
Definition at line 3375 of file txtattr.cpp. 03376 { 03377 // we simply step through both rulers and return FALSE if we find any mismatches 03378 const_TxtTabStopIterator ThisEnd = end(); 03379 const_TxtTabStopIterator ThatEnd = Attrib.end(); 03380 const_TxtTabStopIterator ThisIt = begin(); 03381 const_TxtTabStopIterator ThatIt = Attrib.begin(); 03382 for (; ThisIt != ThisEnd || ThatIt != ThatEnd; ++ThisIt, ++ThatIt) 03383 { 03384 // at least one of the iterators still points to a valid tab stop 03385 // so, if either is past the end the rulers are different 03386 if (ThisIt == ThisEnd || ThatIt == ThatEnd) return FALSE; 03387 TxtTabStop ThisStop = *ThisIt; 03388 TxtTabStop ThatStop = *ThatIt; 03389 // both iterators valid, so compare the tab stops 03390 if (ThisStop != ThatStop) return FALSE; 03391 } 03392 return TRUE; 03393 }
|
|
Sets the TxtRulerAttribute attribute for the given render region.
Implements AttributeValue. Definition at line 3218 of file txtattr.cpp. 03219 { 03220 pRegion->SetTxtRuler(this, Temp); 03221 }
|
|
Restores the TxtRulerAttribute attribute for the given render region.
Implements TxtBaseClassAttribute. Definition at line 3237 of file txtattr.cpp. 03238 { 03239 pRegion->RestoreTxtRuler(this, Temp); 03240 }
|
|
See AttributeValue::SimpleCopy.
Implements AttributeValue. Definition at line 3406 of file txtattr.cpp. 03407 { 03408 ERROR3IF(!IS_A(pValue, TxtRulerAttribute), 03409 "Invalid Attribute value passed to TxtRulerAttribute::SimpleCopy"); 03410 // We may as well just use our assignment operator. 03411 *this = *((TxtRulerAttribute*)pValue); 03412 }
|
|
|