diff options
-rw-r--r-- | dw/oofawarewidget.hh | 2 | ||||
-rw-r--r-- | dw/textblock.cc | 8 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 25 |
3 files changed, 15 insertions, 20 deletions
diff --git a/dw/oofawarewidget.hh b/dw/oofawarewidget.hh index a7b3de2b..7c3b9af6 100644 --- a/dw/oofawarewidget.hh +++ b/dw/oofawarewidget.hh @@ -22,11 +22,9 @@ protected: enum { PARENT_REF_OOFM_BITS = 2, PARENT_REF_OOFM_MASK = (1 << PARENT_REF_OOFM_BITS) - 1 }; -public: OOFAwareWidget *oofContainer[NUM_OOFM]; OutOfFlowMgr *outOfFlowMgr[NUM_OOFM]; -protected: inline OutOfFlowMgr *searchOutOfFlowMgr (int oofmIndex) { return oofContainer[oofmIndex] ? oofContainer[oofmIndex]->outOfFlowMgr[oofmIndex] : NULL; } diff --git a/dw/textblock.cc b/dw/textblock.cc index 5d79f2a5..4ac4bc2a 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -2284,8 +2284,8 @@ void Textblock::addWidget (core::Widget *widget, core::style::Style *style) widget->setParent (oofContainer[oofmIndex]); widget->setGenerator (this); int oofmSubRef = - oofContainer[oofmIndex]->outOfFlowMgr[oofmIndex] - ->addWidgetOOF (widget, this, words->size ()); + searchOutOfFlowMgr(oofmIndex)->addWidgetOOF (widget, this, + words->size ()); widget->parentRef = makeParentRefOOF (oofmIndex, oofmSubRef); Word *word = addWord (0, 0, 0, 0, style); @@ -2301,8 +2301,8 @@ void Textblock::addWidget (core::Widget *widget, core::style::Style *style) // TODO Replace (perhaps) later "textblock" by "OOF aware widget". if (widget->instanceOf (Textblock::CLASS_ID)) { for (int i = 0; i < NUM_OOFM; i++) - oofContainer[i]->outOfFlowMgr[i] - ->addWidgetInFlow ((Textblock*)widget, this, words->size ()); + searchOutOfFlowMgr(i)->addWidgetInFlow ((Textblock*)widget, this, + words->size ()); } core::Requisition size; diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index 2a8347d2..94acc609 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -735,10 +735,10 @@ int Textblock::wrapWordInFlow (int wordIndex, bool wrapAll) core::Content *content = &(words->getRef(i)->content); if (content->type == core::Content::WIDGET_OOF_REF) { for (int j = 0; newFloatPos == -1 && j < NUM_OOFM; j++) { - if ((oofContainer[j]->outOfFlowMgr[j] - ->affectsLeftBorder (content->widget) || - oofContainer[j]->outOfFlowMgr[j] - ->affectsRightBorder (content->widget))) + if ((searchOutOfFlowMgr(j) ->affectsLeftBorder(content + ->widget) || + searchOutOfFlowMgr(j)->affectsRightBorder (content + ->widget))) newFloatPos = i; } } @@ -755,7 +755,7 @@ int Textblock::wrapWordInFlow (int wordIndex, bool wrapAll) lastFloatPos = newFloatPos; for (int i = 0; i < NUM_OOFM; i++) - oofContainer[i]->outOfFlowMgr[i]->tellPosition + searchOutOfFlowMgr(i)->tellPosition (words->getRef(lastFloatPos)->content.widget, yNewLine); balanceBreakPosAndHeight (wordIndex, firstIndex, &searchUntil, @@ -1416,10 +1416,8 @@ void Textblock::moveWordIndices (int wordIndex, int num, int *addIndex1) wordIndex, num); for (int i = 0; i < NUM_OOFM; i++) - if (oofContainer[i]->outOfFlowMgr[i]) - oofContainer[i]->outOfFlowMgr[i]->moveExternalIndices (this, - wordIndex, - num); + if (searchOutOfFlowMgr(i)) + searchOutOfFlowMgr(i)->moveExternalIndices (this, wordIndex, num); for (int i = lines->size () - 1; i >= 0; i--) { Line *line = lines->getRef (i); @@ -1904,11 +1902,10 @@ void Textblock::initNewLine () int clearPosition = 0; for (int i = 0; i < NUM_OOFM; i++) - if (oofContainer[i] && oofContainer[i]->outOfFlowMgr[i]) + if (searchOutOfFlowMgr(i)) clearPosition = misc::max (clearPosition, - oofContainer[i]->outOfFlowMgr[i]->getClearPosition - (this)); + searchOutOfFlowMgr(i)->getClearPosition (this)); setVerticalOffset (misc::max (clearPosition, 0)); } @@ -1936,7 +1933,7 @@ void Textblock::calcBorders (int lastOofRef, int height) bool oofmDefined = false; for (int i = 0; i < NUM_OOFM && !oofmDefined; i++) - if (oofContainer[i] && oofContainer[i]->outOfFlowMgr[i]) + if (searchOutOfFlowMgr(i)) oofmDefined = true; if (oofmDefined) { @@ -1946,7 +1943,7 @@ void Textblock::calcBorders (int lastOofRef, int height) int y = yOffsetOfPossiblyMissingLine (lines->size ()); for (int i = 0; i < NUM_OOFM; i++) { - oof::OutOfFlowMgr *oofm = oofContainer[i]->outOfFlowMgr[i]; + oof::OutOfFlowMgr *oofm = searchOutOfFlowMgr(i); if (oofm) { // Consider the example: // |