예제 #1
0
DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
                                                double a,
                                                double b,
                                                double c,
                                                double d,
                                                double e,
                                                double f) {
  CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
  if (!pPage)
    return;
  CPDF_AnnotList AnnotList(pPage);
  for (size_t i = 0; i < AnnotList.Count(); ++i) {
    CPDF_Annot* pAnnot = AnnotList.GetAt(i);
    // transformAnnots Rectangle
    CPDF_Rect rect;
    pAnnot->GetRect(rect);
    CFX_AffineMatrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
                            (FX_FLOAT)e, (FX_FLOAT)f);
    rect.Transform(&matrix);
    CPDF_Array* pRectArray = NULL;
    pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect");
    if (!pRectArray)
      pRectArray = CPDF_Array::Create();
    pRectArray->SetAt(0, new CPDF_Number(rect.left));
    pRectArray->SetAt(1, new CPDF_Number(rect.bottom));
    pRectArray->SetAt(2, new CPDF_Number(rect.right));
    pRectArray->SetAt(3, new CPDF_Number(rect.top));
    pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray);

    // Transform AP's rectangle
    // To Do
  }
}
예제 #2
0
void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf & sAppStream,const CPDF_Point & ptOffset)
{
	if (IsVisible() && m_bFlash)
	{
		CFX_ByteTextBuf sCaret;

		CPDF_Rect rcRect = GetCaretRect();
		CPDF_Rect rcClip = GetClipRect();

		rcRect = CPWL_Utils::OffsetRect(rcRect,ptOffset.x,ptOffset.y);
		rcClip = CPWL_Utils::OffsetRect(rcClip,ptOffset.x,ptOffset.y);

		sCaret << "q\n";
		if (!rcClip.IsEmpty())
		{
			sCaret << rcClip.left << " " << rcClip.bottom + 2.5f << " "
				<< rcClip.right - rcClip.left << " " << rcClip.top - rcClip.bottom - 4.5f << " re W n\n";
		}
		sCaret << m_fWidth << " w\n0 G\n";
		sCaret << rcRect.left + m_fWidth/2 << " " << rcRect.bottom << " m\n";
		sCaret << rcRect.left + m_fWidth/2 << " " << rcRect.top << " l S\nQ\n";

		sAppStream << sCaret;
	}
}
예제 #3
0
void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
                                       CPDF_Matrix* pUser2Device) {
  CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);

  CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect();

  if (IsVisible() && !rectWnd.IsEmpty()) {
    CPDF_Point ptCenter = GetCenterPoint();

    CPDF_Point pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,
                   ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
    CPDF_Point pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,
                   ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
    CPDF_Point pt3(ptCenter.x,
                   ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);

    if (IsFloatBigger(rectWnd.right - rectWnd.left,
                      PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) &&
        IsFloatBigger(rectWnd.top - rectWnd.bottom,
                      PWL_CBBUTTON_TRIANGLE_HALFLEN)) {
      CFX_PathData path;

      path.SetPointCount(4);
      path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO);
      path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO);
      path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO);
      path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO);

      pDevice->DrawPath(&path, pUser2Device, NULL,
                        CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,
                                                      GetTransparency()),
                        0, FXFILL_ALTERNATE);
    }
  }
}
예제 #4
0
CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage,
                                        FX_FLOAT pdf_x,
                                        FX_FLOAT pdf_y,
                                        int* z_order) {
  const std::vector<CPDF_Dictionary*>* pPageLinkList = GetPageLinks(pPage);
  if (!pPageLinkList)
    return CPDF_Link();

  for (size_t i = pPageLinkList->size(); i > 0; --i) {
    size_t annot_index = i - 1;
    CPDF_Dictionary* pAnnot = (*pPageLinkList)[annot_index];
    if (!pAnnot)
      continue;

    CPDF_Link link(pAnnot);
    CPDF_Rect rect = link.GetRect();
    if (!rect.Contains(pdf_x, pdf_y))
      continue;

    if (z_order)
      *z_order = annot_index;
    return link;
  }
  return CPDF_Link();
}
예제 #5
0
FX_BOOL CPWL_Note::ScrollBarShouldVisible()
{
	CPDF_Rect rcContentsFact = m_pContents->GetScrollArea();
	CPDF_Rect rcContentsClient = m_pContents->GetClientRect();

	return rcContentsFact.Height() > rcContentsClient.Height();	
}
예제 #6
0
FX_BOOL CPWL_Note::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag)
{
	CPDF_Point ptScroll = m_pContents->GetScrollPos();
	CPDF_Rect rcScroll = m_pContents->GetScrollArea();
	CPDF_Rect rcContents = m_pContents->GetClientRect();

	if (rcScroll.top - rcScroll.bottom > rcContents.Height())
	{
		CPDF_Point ptNew = ptScroll;

		if (zDelta > 0)
			ptNew.y += 30;
		else
			ptNew.y -= 30;

		if (ptNew.y > rcScroll.top)
			ptNew.y = rcScroll.top;
		if (ptNew.y < rcScroll.bottom + rcContents.Height())
			ptNew.y = rcScroll.bottom + rcContents.Height();
		if (ptNew.y < rcScroll.bottom)
			ptNew.y = rcScroll.bottom;

		if (ptNew.y != ptScroll.y)
		{
			m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0);
			m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (FX_INTPTR)&ptNew.y);			
			m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (FX_INTPTR)&ptNew.y);

			return TRUE;
		}
	}

	return FALSE;
}
예제 #7
0
void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
  CPWL_Wnd::GetThisAppearanceStream(sAppStream);

  CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect();

  if (IsVisible() && !rectWnd.IsEmpty()) {
    CFX_ByteTextBuf sButton;

    CPDF_Point ptCenter = GetCenterPoint();

    CPDF_Point pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,
                   ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
    CPDF_Point pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,
                   ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
    CPDF_Point pt3(ptCenter.x,
                   ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);

    if (IsFloatBigger(rectWnd.right - rectWnd.left,
                      PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) &&
        IsFloatBigger(rectWnd.top - rectWnd.bottom,
                      PWL_CBBUTTON_TRIANGLE_HALFLEN)) {
      sButton << "0 g\n";
      sButton << pt1.x << " " << pt1.y << " m\n";
      sButton << pt2.x << " " << pt2.y << " l\n";
      sButton << pt3.x << " " << pt3.y << " l\n";
      sButton << pt1.x << " " << pt1.y << " l f\n";

      sAppStream << "q\n" << sButton << "Q\n";
    }
  }
}
예제 #8
0
FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot)
{
	if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
	{
		return pFormFiller->GetViewBBox(pPageView, pAnnot);
	}
	else
	{
		ASSERT(pPageView != NULL);
		ASSERT(pAnnot != NULL);

		CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
		ASSERT(pPDFAnnot != NULL);

		CPDF_Rect rcAnnot;
		pPDFAnnot->GetRect(rcAnnot);

// 		CRect rcWin;
// 		pPageView->DocToWindow(rcAnnot, rcWin);
		CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot,1);
//		rcWin.InflateRect(1, 1);

		return rcWin.GetOutterRect();
	}
}
예제 #9
0
FX_BOOL	CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Annot* pAnnot, CPDF_Point point)
{
	CPDF_Rect rc = pAnnot->GetRect();
	if(rc.Contains(point.x, point.y))
		return TRUE;
	return FALSE;
}
예제 #10
0
void CPWL_IconList_Content::ScrollToItem(int32_t nItemIndex) {
  CPDF_Rect rcClient = GetClientRect();

  if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) {
    CPDF_Rect rcOrigin = pItem->GetWindowRect();
    CPDF_Rect rcWnd = pItem->ChildToParent(rcOrigin);

    if (!(rcWnd.bottom > rcClient.bottom && rcWnd.top < rcClient.top)) {
      CPDF_Point ptScroll = GetScrollPos();

      if (rcWnd.top > rcClient.top) {
        ptScroll.y = rcOrigin.top;
      } else if (rcWnd.bottom < rcClient.bottom) {
        ptScroll.y = rcOrigin.bottom + rcClient.Height();
      }

      SetScrollPos(ptScroll);
      ResetFace();
      InvalidateRect();
      if (CPWL_Wnd* pParent = GetParentWindow()) {
        pParent->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL,
                          (intptr_t)&ptScroll.y);
      }
    }
  }
}
예제 #11
0
FX_BOOL CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView* pPageView,
                                        CPDFSDK_Annot* pAnnot,
                                        const CPDF_Point& point) {
  ASSERT(pPageView);
  ASSERT(pAnnot);

  CPDF_Rect rect = GetViewBBox(pPageView, pAnnot);
  return rect.Contains(point.x, point.y);
}
예제 #12
0
CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) {
  if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
    CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect()));
    CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox();
    if (rcPage.Contains(rcFocus))
      return rcFocus;
  }
  return CPDF_Rect(0, 0, 0, 0);
}
예제 #13
0
CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX,
                                                   FX_FLOAT pageY) {
  CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
  CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr();
  CPDFSDK_AnnotIterator annotIterator(this, false);
  while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) {
    CPDF_Rect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot);
    if (rc.Contains(pageX, pageY))
      return pSDKAnnot;
  }

  return nullptr;
}
예제 #14
0
FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView,
                                   CPDFSDK_Annot* pAnnot,
                                   FX_UINT nFlags,
                                   const CPDF_Point& point) {
  CPDF_Rect rcAnnot = pAnnot->GetRect();
  if (!rcAnnot.Contains(point.x, point.y))
    return FALSE;

  m_bMouseDown = TRUE;
  m_bValid = TRUE;
  FX_RECT rect = GetViewBBox(pPageView, pAnnot);
  InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
  return TRUE;
}
예제 #15
0
void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView,
                              /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
                              CFX_RenderDevice* pDevice,
                              CPDF_Matrix* pUser2Device,
                              /*const CRect& rcWindow,*/ FX_DWORD dwFlags) {
    ASSERT(pPageView != NULL);
    CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;

    if (IsVisible(pWidget)) {
        if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
            if (pFormFiller->IsValid()) {
                pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
                pAnnot->GetPDFPage();

                CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
                if (pDocument->GetFocusAnnot() == pAnnot) {
                    CPDF_Rect rcFocus = pFormFiller->GetFocusBox(pPageView);
                    if (!rcFocus.IsEmpty()) {
                        CFX_PathData path;
                        path.SetPointCount(5);
                        path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO);
                        path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO);
                        path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO);
                        path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO);
                        path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO);

                        CFX_GraphStateData gsd;
                        gsd.SetDashCount(1);
                        gsd.m_DashArray[0] = 1.0f;
                        gsd.m_DashPhase = 0;
                        gsd.m_LineWidth = 1.0f;
                        pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
                                          ArgbEncode(255, 0, 0, 0), FXFILL_ALTERNATE);
                    }
                }
                return;
            }
        }

        if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
            pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device,
                                        dwFlags);
        else
            pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);

        if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget))
            pWidget->DrawShadow(pDevice, pPageView);
    }
}
예제 #16
0
FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont,
                                             const CPDF_Rect& rcPlate,
                                             int32_t nCharArray) {
  if (pFont && !pFont->IsStandardFont()) {
    FX_RECT rcBBox;
    pFont->GetFontBBox(rcBBox);

    CPDF_Rect rcCell = rcPlate;
    FX_FLOAT xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.Width();
    FX_FLOAT ydiv = -rcCell.Height() * 1000.0f / rcBBox.Height();

    return xdiv < ydiv ? xdiv : ydiv;
  }

  return 0.0f;
}
예제 #17
0
CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y)
{
    CFX_PtrArray* pPageLinkList = GetPageLinks(pPage);
    if (pPageLinkList == NULL) {
        return NULL;
    }
    int size = pPageLinkList->GetSize();
    for (int i = 0; i < size; i ++) {
        CPDF_Link Link = (CPDF_Dictionary*)pPageLinkList->GetAt(i);
        CPDF_Rect rect = Link.GetRect();
        if (rect.Contains(pdf_x, pdf_y)) {
            return Link;
        }
    }
    return NULL;
}
예제 #18
0
void CFX_ListCtrl::SetScrollInfo()
{
	if (m_pNotify)
	{
		CPDF_Rect rcPlate = GetPlateRect();
		CPDF_Rect rcContent = CFX_List::GetContentRect();

		if (!m_bNotifyFlag)
		{
			m_bNotifyFlag = TRUE;
			m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top,
					rcContent.bottom, rcContent.top, GetFirstHeight(), rcPlate.Height());
			m_bNotifyFlag = FALSE;
		}
	}
}
예제 #19
0
CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY)
{

    CPDFSDK_AnnotIterator annotIterator(this, FALSE);
    CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
    CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr();
    CPDFSDK_Annot* pSDKAnnot = NULL;
    int index = -1;
    while((pSDKAnnot = annotIterator.Next(index)))
    {
        CPDF_Rect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot);
        if(rc.Contains(pageX, pageY))
            return pSDKAnnot;
    }

    return NULL;
}
예제 #20
0
void CPDF_Annot::GetRect(CPDF_Rect& rect) const
{
    if (m_pAnnotDict == NULL) {
        return;
    }
    rect = m_pAnnotDict->GetRect("Rect");
    rect.Normalize();
}
예제 #21
0
void CPWL_Note_RBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device)
{
	CPDF_Rect rcClient = this->GetClientRect();

	CFX_GraphStateData gsd;
	gsd.m_LineWidth = 1.0f;

	CFX_PathData pathCross;

	pathCross.SetPointCount(4);
	pathCross.SetPoint(0, rcClient.right, rcClient.top, FXPT_MOVETO);
	pathCross.SetPoint(1, rcClient.left, rcClient.bottom, FXPT_LINETO);
	pathCross.SetPoint(2, rcClient.right, rcClient.bottom + rcClient.Height() * 0.5f, FXPT_MOVETO);
	pathCross.SetPoint(3, rcClient.left + rcClient.Width() * 0.5f, rcClient.bottom, FXPT_LINETO);
	
	pDevice->DrawPath(&pathCross, pUser2Device, &gsd, 
		0, CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), FXFILL_ALTERNATE);
}
예제 #22
0
void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device)
{
	if (IsVisible() && m_bFlash)
	{
		CPDF_Rect rcRect = GetCaretRect();
		CPDF_Rect rcClip = GetClipRect();

		CFX_PathData path;

		path.SetPointCount(2);

		FX_FLOAT fCaretX = rcRect.left + m_fWidth * 0.5f;
		FX_FLOAT fCaretTop = rcRect.top;
		FX_FLOAT fCaretBottom = rcRect.bottom;

		if (!rcClip.IsEmpty())
		{
			rcRect.Intersect(rcClip);
			if (!rcRect.IsEmpty())
			{
				fCaretTop = rcRect.top;
				fCaretBottom = rcRect.bottom;
				path.SetPoint(0, fCaretX, fCaretBottom, FXPT_MOVETO);
				path.SetPoint(1, fCaretX, fCaretTop, FXPT_LINETO);
			}
			else
			{
				return;
			}
		}
		else
		{
			path.SetPoint(0, fCaretX, fCaretBottom, FXPT_MOVETO);
			path.SetPoint(1, fCaretX, fCaretTop, FXPT_LINETO);
		}

		CFX_GraphStateData gsd;
		gsd.m_LineWidth = m_fWidth;

		pDevice->DrawPath(&path, pUser2Device, &gsd,0,  ArgbEncode(255,0,0,0), FXFILL_ALTERNATE);
	}
}
예제 #23
0
void CPWL_Note_Options::RePosChildWnd()
{
	if (this->IsValid())
	{
		ASSERT(m_pText != NULL);

		CPDF_Rect rcClient = GetClientRect();

		if (rcClient.Width() > 15.0f)
		{
			rcClient.right -= 15.0f;
			m_pText->Move(rcClient, TRUE, FALSE);
			m_pText->SetVisible(TRUE);
		}
		else
		{
			m_pText->Move(CPDF_Rect(0,0,0,0), TRUE, FALSE);
			m_pText->SetVisible(FALSE);
		}
	}
}
예제 #24
0
void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice,
                             CPDF_Matrix* pUser2Device,
                             IFX_Edit* pEdit,
                             FX_COLORREF color,
                             const CPDF_Rect& rcClip,
                             const CPDF_Point& ptOffset,
                             const CPVT_WordRange* pRange) {
  pDevice->SaveState();

  if (!rcClip.IsEmpty()) {
    CPDF_Rect rcTemp = rcClip;
    pUser2Device->TransformRect(rcTemp);
    FX_RECT rcDevClip;
    rcDevClip.left = (int32_t)rcTemp.left;
    rcDevClip.right = (int32_t)rcTemp.right;
    rcDevClip.top = (int32_t)rcTemp.top;
    rcDevClip.bottom = (int32_t)rcTemp.bottom;
    pDevice->SetClip_Rect(&rcDevClip);
  }

  if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) {
    if (pEdit->GetFontMap()) {
      if (pRange)
        pIterator->SetAt(pRange->BeginPos);
      else
        pIterator->SetAt(0);

      while (pIterator->NextWord()) {
        CPVT_WordPlace place = pIterator->GetAt();
        if (pRange && place.WordCmp(pRange->EndPos) > 0)
          break;

        CPVT_Word word;
        if (pIterator->GetWord(word)) {
          CFX_PathData pathUnderline;
          CPDF_Rect rcUnderline = GetUnderLineRect(word);
          rcUnderline.left += ptOffset.x;
          rcUnderline.right += ptOffset.x;
          rcUnderline.top += ptOffset.y;
          rcUnderline.bottom += ptOffset.y;
          pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom,
                                   rcUnderline.right, rcUnderline.top);

          pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, color, 0,
                            FXFILL_WINDING);
        }
      }
    }
  }

  pDevice->RestoreState();
}
예제 #25
0
void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcWindow)
{
	ASSERT(pPrivateData != NULL);

	CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;

	if (CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, TRUE))
	{

		CPDF_Rect rcOld = pFormFiller->PWLtoFFL(pFormFiller->GetWindowRect(pData->pPageView));
		CPDF_Rect rcNew = pFormFiller->PWLtoFFL(rcWindow);
		pFormFiller->SetWindowRect(pData->pPageView, rcWindow);

		CPDF_Rect unRect = rcOld;
		unRect.Union(rcNew);
		//FX_RECT rcRect = unRect.GetOutterRect();
		unRect.left = (FX_FLOAT)(unRect.left - 0.5);
		unRect.right = (FX_FLOAT)(unRect.right + 0.5);
		unRect.top = (FX_FLOAT)(unRect.top + 0.5);
		unRect.bottom = (FX_FLOAT)(unRect.bottom -0.5);
		m_pApp->FFI_Invalidate(pData->pWidget->GetPDFPage(), unRect.left, unRect.top, unRect.right, unRect.bottom);
	}
}
예제 #26
0
void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex)
{
	if (!IsValid(nItemIndex)) return;

	CPDF_Rect rcPlate = GetPlateRect();
	CPDF_Rect rcItem = CFX_List::GetItemRect(nItemIndex);
	CPDF_Rect rcItemCtrl = GetItemRect(nItemIndex);

	if (FX_EDIT_IsFloatSmaller(rcItemCtrl.bottom, rcPlate.bottom))
	{
		if (FX_EDIT_IsFloatSmaller(rcItemCtrl.top, rcPlate.top))
		{
			SetScrollPosY(rcItem.bottom + rcPlate.Height());
		}
	}
	else if (FX_EDIT_IsFloatBigger(rcItemCtrl.top, rcPlate.top))
	{
		if (FX_EDIT_IsFloatBigger(rcItemCtrl.bottom, rcPlate.bottom))
		{
			SetScrollPosY(rcItem.top);
		}
	}
}
예제 #27
0
FX_BOOL CPWL_IconList::OnMouseWheel(short zDelta,
                                    const CPDF_Point& point,
                                    FX_DWORD nFlag) {
  CPDF_Point ptScroll = m_pListContent->GetScrollPos();
  CPDF_Rect rcScroll = m_pListContent->GetScrollArea();
  CPDF_Rect rcContents = m_pListContent->GetClientRect();

  if (rcScroll.top - rcScroll.bottom > rcContents.Height()) {
    CPDF_Point ptNew = ptScroll;

    if (zDelta > 0)
      ptNew.y += 30;
    else
      ptNew.y -= 30;

    if (ptNew.y > rcScroll.top)
      ptNew.y = rcScroll.top;
    if (ptNew.y < rcScroll.bottom + rcContents.Height())
      ptNew.y = rcScroll.bottom + rcContents.Height();
    if (ptNew.y < rcScroll.bottom)
      ptNew.y = rcScroll.bottom;

    if (ptNew.y != ptScroll.y) {
      m_pListContent->SetScrollPos(ptNew);
      m_pListContent->ResetFace();
      m_pListContent->InvalidateRect(NULL);

      if (CPWL_ScrollBar* pScrollBar = GetVScrollBar())
        pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL,
                             (intptr_t)&ptNew.y);

      return TRUE;
    }
  }

  return FALSE;
}
예제 #28
0
CFX_AffineMatrix GetMatrix(CPDF_Rect rcAnnot, CPDF_Rect rcStream, CFX_AffineMatrix matrix)
{
	if(rcStream.IsEmpty())
		return CFX_AffineMatrix();
	
	matrix.TransformRect(rcStream);
	rcStream.Normalize();
	
	FX_FLOAT a = rcAnnot.Width()/rcStream.Width();
	FX_FLOAT d = rcAnnot.Height()/rcStream.Height();
	
	FX_FLOAT e = rcAnnot.left - rcStream.left * a;
	FX_FLOAT f = rcAnnot.bottom - rcStream.bottom * d;
	return CFX_AffineMatrix(a, 0, 0, d, e, f);
}
예제 #29
0
FX_BOOL IsValiableRect(CPDF_Rect rect, CPDF_Rect rcPage)
{
	if ( rect.left - rect.right > 0.000001f || 
		 rect.bottom - rect.top > 0.000001f)
		return FALSE;
	
	if (rect.left == 0.0f &&
		rect.top == 0.0f &&
		rect.right == 0.0f &&
		rect.bottom == 0.0f)
		return FALSE;
	
	if (!rcPage.IsEmpty())
	{
		if (rect.left - rcPage.left < -10.000001f ||
			rect.right - rcPage.right > 10.000001f ||
			rect.top - rcPage.top > 10.000001f ||
			rect.bottom - rcPage.bottom < -10.000001f)
			return FALSE;
	}
	
	return TRUE;
}
예제 #30
0
FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView* pPageView,
                                     CPDFSDK_Annot* pAnnot) {
  ASSERT(pPageView != NULL);
  ASSERT(pAnnot != NULL);

  CPDF_Rect rcAnnot = m_pWidget->GetRect();

  if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
    CPDF_Rect rcWindow = pWnd->GetWindowRect();
    rcAnnot = PWLtoFFL(rcWindow);
  }

  CPDF_Rect rcWin = rcAnnot;

  CPDF_Rect rcFocus = GetFocusBox(pPageView);
  if (!rcFocus.IsEmpty())
    rcWin.Union(rcFocus);

  CPDF_Rect rect = CPWL_Utils::InflateRect(rcWin, 1);

  return rect.GetOutterRect();
}