コード例 #1
0
ファイル: PWL_EditCtrl.cpp プロジェクト: abbro-ca/pdfium
CPDF_Font * CPWL_EditCtrl::GetCaretFont() const
{
    int32_t nFontIndex = 0;

    if (IFX_Edit_Iterator * pIterator = m_pEdit->GetIterator())
    {
        pIterator->SetAt(m_pEdit->GetCaret());
        CPVT_Word word;
        CPVT_Section section;
        if (pIterator->GetWord(word))
        {
            nFontIndex = word.nFontIndex;
        }
        else if (HasFlag(PES_RICH))
        {
            if (pIterator->GetSection(section))
            {
                nFontIndex = section.WordProps.nFontIndex;
            }
        }
    }

    if (IFX_Edit_FontMap* pFontMap = GetFontMap())
        return pFontMap->GetPDFFont(nFontIndex);

    return NULL;
}
コード例 #2
0
ファイル: PWL_EditCtrl.cpp プロジェクト: hfiguiere/pdfium
void CPWL_EditCtrl::OnCreated() {
  SetFontSize(GetCreationParam().fFontSize);

  m_pEdit->SetFontMap(GetFontMap());
  m_pEdit->SetNotify(this);
  m_pEdit->Initialize();
}
コード例 #3
0
ファイル: PWL_ListBox.cpp プロジェクト: MIPS/external-pdfium
void CPWL_ListBox::OnCreated() {
  m_pList->SetFontMap(GetFontMap());
  m_pListNotify = pdfium::MakeUnique<CPWL_List_Notify>(this);
  m_pList->SetNotify(m_pListNotify.get());

  SetHoverSel(HasFlag(PLBS_HOVERSEL));
  m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL));
  m_pList->SetFontSize(GetCreationParam().fFontSize);

  m_bHoverSel = HasFlag(PLBS_HOVERSEL);
}
コード例 #4
0
ファイル: PWL_Label.cpp プロジェクト: JinAirsOs/pdfium
void CPWL_Label::OnCreated() {
  SetParamByFlag();
  SetFontSize(GetCreationParam().fFontSize);

  m_pEdit->SetFontMap(GetFontMap());
  m_pEdit->Initialize();

  if (HasFlag(PES_TEXTOVERFLOW)) {
    SetClipRect(CFX_FloatRect(0.0f, 0.0f, 0.0f, 0.0f));
    m_pEdit->SetTextOverflow(TRUE);
  }
}
コード例 #5
0
ファイル: UniscribeLinux.cpp プロジェクト: FieldDB/FieldWorks
PangoContext* GetPangoContext(SCRIPT_CACHE *context)
{
	if (*context == NULL)
		*context = new ScriptCacheImplementation();

	ScriptCacheImplementation * cache = reinterpret_cast<ScriptCacheImplementation*>(*context);

	if (cache->m_pangoContext == NULL)
		cache->m_pangoContext = pango_font_map_create_context(GetFontMap());

	return cache->m_pangoContext;
}
コード例 #6
0
ファイル: PWL_Edit.cpp プロジェクト: MIPS/external-pdfium
bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) {
  if (m_bMouseDown)
    return true;

  bool bRC = true;
  bool bExit = false;

  if (!IsCTRLpressed(nFlag)) {
    if (m_pFillerNotify) {
      CFX_WideString swChange;

      int nSelStart = 0;
      int nSelEnd = 0;
      GetSel(nSelStart, nSelEnd);

      switch (nChar) {
        case FWL_VKEY_Back:
          if (nSelStart == nSelEnd)
            nSelStart = nSelEnd - 1;
          break;
        case FWL_VKEY_Return:
          break;
        default:
          swChange += nChar;
          break;
      }

      CFX_WideString strChangeEx;
      m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange,
                                         strChangeEx, nSelStart, nSelEnd, true,
                                         bRC, bExit, nFlag);
    }
  }

  if (!bRC)
    return true;
  if (bExit)
    return false;

  if (IPVT_FontMap* pFontMap = GetFontMap()) {
    int32_t nOldCharSet = GetCharSet();
    int32_t nNewCharSet =
        pFontMap->CharSetFromUnicode(nChar, FXFONT_DEFAULT_CHARSET);
    if (nOldCharSet != nNewCharSet) {
      SetCharSet(nNewCharSet);
    }
  }

  return CPWL_EditCtrl::OnChar(nChar, nFlag);
}
コード例 #7
0
void CPWL_ListBox::OnCreated() {
  if (m_pList) {
    delete m_pListNotify;

    m_pList->SetFontMap(GetFontMap());
    m_pList->SetNotify(m_pListNotify = new CPWL_List_Notify(this));

    SetHoverSel(HasFlag(PLBS_HOVERSEL));
    m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL));
    m_pList->SetFontSize(GetCreationParam().fFontSize);

    m_bHoverSel = HasFlag(PLBS_HOVERSEL);
  }
}
コード例 #8
0
ファイル: PWL_Edit.cpp プロジェクト: primiano/pdfium-merge
FX_BOOL CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag) {
  if (m_bMouseDown)
    return TRUE;

  FX_BOOL bRC = TRUE;
  FX_BOOL bExit = FALSE;

  if (!IsCTRLpressed(nFlag)) {
    if (m_pFillerNotify) {
      CFX_WideString swChange;

      int nSelStart = 0;
      int nSelEnd = 0;
      GetSel(nSelStart, nSelEnd);

      switch (nChar) {
        case FWL_VKEY_Back:
          if (nSelStart == nSelEnd)
            nSelStart = nSelEnd - 1;
          break;
        case FWL_VKEY_Return:
          break;
        default:
          swChange += nChar;
          break;
      }

      CFX_WideString strChangeEx;
      m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange,
                                         strChangeEx, nSelStart, nSelEnd, TRUE,
                                         bRC, bExit, nFlag);
    }
  }

  if (!bRC)
    return TRUE;
  if (bExit)
    return FALSE;

  if (IFX_Edit_FontMap* pFontMap = GetFontMap()) {
    int32_t nOldCharSet = GetCharSet();
    int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAULT_CHARSET);
    if (nOldCharSet != nNewCharSet) {
      SetCharSet(nNewCharSet);
    }
  }

  return CPWL_EditCtrl::OnChar(nChar, nFlag);
}
コード例 #9
0
ファイル: PWL_Edit.cpp プロジェクト: primiano/pdfium-merge
void CPWL_Edit::SetCharArray(int32_t nCharArray) {
  if (HasFlag(PES_CHARARRAY) && nCharArray > 0) {
    m_pEdit->SetCharArray(nCharArray);
    m_pEdit->SetTextOverflow(TRUE);

    if (HasFlag(PWS_AUTOFONTSIZE)) {
      if (IFX_Edit_FontMap* pFontMap = GetFontMap()) {
        FX_FLOAT fFontSize = GetCharArrayAutoFontSize(
            pFontMap->GetPDFFont(0), GetClientRect(), nCharArray);
        if (fFontSize > 0.0f) {
          m_pEdit->SetAutoFontSize(FALSE);
          m_pEdit->SetFontSize(fFontSize);
        }
      }
    }
  }
}