// returns true if created a new page bool HtmlFormatter::FlushCurrLine(bool isParagraphBreak) { if (IsCurrLineEmpty()) { currX = NewLineX(); currLineTopPadding = 0; // remove all spaces (only keep SetFont, LinkStart and Anchor instructions) for (size_t k = currLineInstr.size(); k > 0; k--) { DrawInstr& i = currLineInstr.at(k - 1); if (InstrFixedSpace == i.type || InstrElasticSpace == i.type) currLineInstr.RemoveAt(k - 1); } return false; } AlignAttr align = CurrStyle()->align; if (isParagraphBreak && (Align_Justify == align)) align = Align_Left; JustifyCurrLine(align); // create a new page if necessary float totalLineDy = CurrLineDy() + currLineTopPadding; bool createdPage = false; if (currY + totalLineDy > pageDy) { // current line too big to fit in current page, // so need to start another page UpdateLinkBboxes(currPage); pagesToSend.Append(currPage); // instructions for each page need to be self-contained // so we have to carry over some state (like current font) CrashIf(!CurrFont()); EmitNewPage(); CrashIf(currLineReparseIdx > INT_MAX); currPage->reparseIdx = (int)currLineReparseIdx; createdPage = true; } SetYPos(currLineInstr, currY + currLineTopPadding); currY += totalLineDy; DrawInstr link; if (currLinkIdx) { link = currLineInstr.at(currLinkIdx - 1); // TODO: this occasionally leads to empty links AppendInstr(DrawInstr(InstrLinkEnd)); } currPage->instructions.Append(currLineInstr.LendData(), currLineInstr.size()); currLineInstr.Reset(); currLineReparseIdx = -1; // mark as not set currLineTopPadding = 0; currX = NewLineX(); if (currLinkIdx) { AppendInstr(DrawInstr::LinkStart(link.str.s, link.str.len)); currLinkIdx = currLineInstr.size(); } nextPageStyle = styleStack.Last(); return createdPage; }
void CCEtoODBView::recallView(CNamedView& namedView) { ScaleNum = namedView.getScaleNum(); ScaleDenom = namedView.getScaleDenom(); UpdateScale(); SetXPos(namedView.getScrollX()); SetYPos(namedView.getScrollY()); GetDocument()->setLayerViewData(namedView); GetDocument()->UpdateAllViews(NULL); }
void DocReport::Put(const Table& tab) { if(dortf) rtf.Put(tab); SkipBefore(tab.GetBefore()); if(valrects) { int y = ypos; Vector<ValueRect> v; tab.GetValueRects(1024, *this, lm, y, pgsz.cx - lm, v); AddVR(v); } Table::PaintInfo pi; while(tab.Paint(*this, lm, ypos, pgsz.cx - lm, GetYLim(), pi)) Page(); SetYPos(pi.ypos); SkipAfter(tab.GetAfter()); }
void DocReport::Put(const Paragraph& p) { if(dortf) rtf.Put(p); SkipBefore(p.GetBefore()); if(valrects) { int y = ypos; Vector<ValueRect> v; p.GetValueRects(1024, *this, lm, y, pgsz.cx - lm, v); AddVR(v); } Paragraph::PaintInfo pi; while(p.Paint(*this, lm, ypos, pgsz.cx - lm, GetYLim(), pi)) Page(); SetYPos(pi.ypos); SkipAfter(p.GetAfter()); }
void nuiScrollView::OnSmoothScrolling(const nuiEvent& rEvent) { if (!mTimerOn) return; if (!mLeftClick) { float XOffset = mpHorizontal->GetRange().GetValue(); float YOffset = mpVertical->GetRange().GetValue(); float xdiff = XOffset - mXOffset; float ydiff = YOffset - mYOffset; if (xdiff > 2 || xdiff < -2) mXOffset += xdiff * NUI_SMOOTH_SCROLL_RATIO; else mXOffset = XOffset; if (ydiff > 2 || ydiff < -2) mYOffset += ydiff * NUI_SMOOTH_SCROLL_RATIO; else mYOffset = YOffset; if (mXOffset == XOffset && mYOffset == YOffset) { mTimerOn = false; } if (mSpeedX != 0) { SetXPos(GetXPos() + mSpeedX); //mXOffset = GetXPos(); mSpeedX *= 0.7; } if (mSpeedY != 0) { SetYPos(GetYPos() + mSpeedY); //mYOffset = GetYPos(); mSpeedY *= 0.7; } } UpdateLayout(); OffsetsChanged(); }