Grafoscopio/src/Grafoscopio/PRDocumentItem.extension.st

64 lines
1.5 KiB
Smalltalk

Extension { #name : #PRDocumentItem }
{ #category : #'*Grafoscopio' }
PRDocumentItem >> formats [
| ancestors |
ancestors := (self parent ifNil: [ {} ] ifNotNil: [ self parent formats ]).
^ ancestors , (self propertyAt: #gfpFormat ifAbsent: [ Array empty ])
]
{ #category : #'*Grafoscopio' }
PRDocumentItem >> installFormat: aFormat [
(self propertyAt: #gfpFormat ifAbsentPut: [ OrderedCollection new ]) add: aFormat.
]
{ #category : #'*Grafoscopio' }
PRDocumentItem >> isLineBreak [
^ false
]
{ #category : #'*Grafoscopio' }
PRDocumentItem >> isTextOrLineBreak [
^ false
]
{ #category : #'*Grafoscopio' }
PRDocumentItem >> markAsDirty [
self parent ifNotNil: [ :p | p markAsDirty ].
properties removeKey: #textStart ifAbsent: [ ].
properties removeKey: #textStop ifAbsent: [ ]
]
{ #category : #'*Grafoscopio' }
PRDocumentItem >> parent [
^ self propertyAt: #parent ifAbsent: [ nil ]
]
{ #category : #'*Grafoscopio' }
PRDocumentItem >> parent: aParent [
self propertyAt: #parent put: aParent
]
{ #category : #'*Grafoscopio' }
PRDocumentItem >> textSize [
^ self textStop - self textStart
]
{ #category : #'*Grafoscopio' }
PRDocumentItem >> textStart [
^ self
propertyAt: #textStart
ifAbsentPut: [ self hasChildren
ifTrue: [ self children first textStart ]
ifFalse: [ 0 ] ]
]
{ #category : #'*Grafoscopio' }
PRDocumentItem >> textStop [
^ self
propertyAt: #textStop
ifAbsentPut: [ self hasChildren
ifTrue: [ self children last textStop ]
ifFalse: [ 0 ] ]
]