Пример #1
1
//将数据更新到数据集
void	__fastcall ASEditSvr::toXML(_di_IXMLNode aNode){
   ASEditDataSet *lObj;
   for(int i=0;i<EditDS->Count;i++){
	  _di_IXMLNode lNode = aNode->AddChild(WideString("DATASET"));
	  lObj = EditDS->ObjByIndex[i];
	  BLNODEATTSET(lNode,"CODE",lObj->Code);
	  BLNODEATTSET(lNode,"ERI",lObj->DataSetSvr->ERI);
	  lObj->DataSetSvr->toXML(lNode);
   }
}
Пример #2
0
WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const {
  WideString str = CPDF_Font::UnicodeFromCharCode(charcode);
  if (!str.IsEmpty())
    return str;
  wchar_t ret = GetUnicodeFromCharCode(charcode);
  return ret ? ret : WideString();
}
Пример #3
0
//---------------------------------------------------------------------------
void __fastcall TForm7::Button2Click(TObject *Sender)
{
FILE * pFile = fopen ("ver.txt" , "r");
char mystring [100];
if (pFile == NULL)
{
MessageBoxA(0,"Gagal Membuka File","Error!!",MB_ICONERROR|MB_OK);
return;
}
else
{
fgets (mystring , 100 , pFile);
puts (mystring);
fclose (pFile);
}
ShowMessage("Versi Sekarang : "+WideString(mystring));
TStringList*Send = new TStringList(this);
TStringStream * Receive = new TStringStream();
IdHTTP1->Request->UserAgent = "*";
IdHTTP1->Request->ContentType="application/x-www-form-urlencoded";
IdHTTP1->Post("http://ariefsetya.com/p3m/usiroh/cek.php",Send,Receive);
ShowMessage("Versi Terbaru : "+Receive->DataString);
NEWVERSION = Receive->DataString;
if(mystring!=Receive->DataString){
Button2->Show();
ShowMessage("Aplikasi kamu versi lama,silahkan download versi terbaru");
}
else{
ShowMessage("Tidak Tersedia Versi Terbaru");
}

}
Пример #4
0
WideString StringUtil::ansiToWide(const AnsiString &str) {
	// TODO: This function gets called a lot, so warnings like these drown out the usefull information
	Common::String converted = "";
	uint32 index = 0;
	while (index != str.size()) {
		byte c = str[index];
		if (c == 146) {
			converted += (char)39;  // Replace right-quote with apostrophe
		} else if (c == 133) {
			converted += Common::String("..."); // Replace ...-symbol with ...
		} else {
			converted += c;
		}
		index++;
	}
	// using default os locale!

	/*  setlocale(LC_CTYPE, "");
	    size_t wideSize = mbstowcs(NULL, str.c_str(), 0) + 1;
	    wchar_t *wstr = new wchar_t[WideSize];
	    mbstowcs(wstr, str.c_str(), WideSize);
	    WideString ResultString(wstr);
	    delete[] wstr;
	    return ResultString;*/
	return WideString(converted);
}
Пример #5
0
///////////////////////////////////////////////////////////////////////////////
// Helperroutinen
HRESULT LoadSearchEngine (IPropertyActionSequence *pISeq, LPCSTR pcKey)
{
// ClassID aus Registry besorgen
CLSID clsID;
HRESULT hr = CLSIDFromProgID (WideString(pcKey), &clsID);

	if (FAILED(hr)) return hr;		// nichts gefunden

	COM_TRY {
	// Objekt instantiieren
	WPropertyAction WAct (clsID);		// throws hr

	// Objekt initialisieren
		{
		WPersistStreamInit Init (WAct);	// throws hr;
		HRESULT hr = Init -> InitNew();

			if (FAILED(hr)) {
				if (hr != E_ABORT)
					return hr;
				return S_FALSE;			// darf mit E_ABORT fehlschlagen
			}
		}
		
	// zur Sequence hinzufügen
		THROW_FAILED_HRESULT(pISeq -> AddAction (WAct));
		
	} COM_CATCH;
	return S_OK;
}
Пример #6
0
TEST_F(FPDFStructTreeEmbedderTest, GetType) {
  ASSERT_TRUE(OpenDocument("tagged_alt_text.pdf"));
  FPDF_PAGE page = LoadPage(0);
  ASSERT_TRUE(page);

  {
    ScopedFPDFStructTree struct_tree(FPDF_StructTree_GetForPage(page));
    ASSERT_TRUE(struct_tree);
    ASSERT_EQ(1, FPDF_StructTree_CountChildren(struct_tree.get()));

    FPDF_STRUCTELEMENT element =
        FPDF_StructTree_GetChildAtIndex(struct_tree.get(), 0);
    ASSERT_NE(nullptr, element);

    unsigned short buffer[12];
    memset(buffer, 0, sizeof(buffer));
    // Deliberately pass in a small buffer size to make sure |buffer| remains
    // untouched.
    ASSERT_EQ(18U, FPDF_StructElement_GetType(element, buffer, 1));
    for (size_t i = 0; i < FX_ArraySize(buffer); ++i)
      EXPECT_EQ(0U, buffer[i]);

    ASSERT_EQ(18U, FPDF_StructElement_GetType(element, buffer, sizeof(buffer)));
    const wchar_t kExpected[] = L"Document";
    EXPECT_EQ(WideString(kExpected),
              WideString::FromUTF16LE(buffer, FXSYS_len(kExpected)));
  }

  UnloadPage(page);
}
Пример #7
0
WideString CPDF_TextPage::GetTextByPredicate(
    const std::function<bool(const PAGECHAR_INFO&)>& predicate) const {
  if (!m_bIsParsed)
    return WideString();

  float posy = 0;
  bool IsContainPreChar = false;
  bool IsAddLineFeed = false;
  WideString strText;
  for (const auto& charinfo : m_CharList) {
    if (predicate(charinfo)) {
      if (fabs(posy - charinfo.m_Origin.y) > 0 && !IsContainPreChar &&
          IsAddLineFeed) {
        posy = charinfo.m_Origin.y;
        if (!strText.IsEmpty())
          strText += L"\r\n";
      }
      IsContainPreChar = true;
      IsAddLineFeed = false;
      if (charinfo.m_Unicode)
        strText += charinfo.m_Unicode;
    } else if (charinfo.m_Unicode == L' ') {
      if (IsContainPreChar) {
        strText += L' ';
        IsContainPreChar = false;
        IsAddLineFeed = false;
      }
    } else {
      IsContainPreChar = false;
      IsAddLineFeed = true;
    }
  }
  return strText;
}
Пример #8
0
// ---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent *Owner) : TForm(Owner) {
	DragAcceptFiles(Handle, true); // Enable D&D

	Gdv0->LicenseKEY = WideString(L"6223560888372426056441256");

	IniFile = TPath::Combine(ExtractFilePath(Application->ExeName), "v2iewx.ini");
	KeyFile = TPath::Combine(ExtractFilePath(Application->ExeName), "key.ini");
	LangFile = TPath::Combine(ExtractFilePath(Application->ExeName), "lang.ini");
	RecentFile = TPath::Combine(ExtractFilePath(Application->ExeName), "recent.ini");

	hSPI = new TObjectList();
	flst = new TObjectList();
	paramStr = new TStringList();
	RecentList = new TStringList();

	fn_LoadLang();
	fn_LoadIni();
	fn_LoadRecent();

	KeyConf = new TMemIniFile(KeyFile);
	Recent = new TMemIniFile(RecentFile);

	if (ParamCount() > 0) {
		for (int i = 1; i <= ParamCount(); ++i) {
			paramStr->Add(ParamStr(i));
		}
		fn_ParseFiles(paramStr);
	}
}
Пример #9
0
static WideString Builder_getRomanBullet(int64_t v, bool uppercase) {
	struct romandata_t {
		int value;
		char16_t const* numeral;
	};
	static romandata_t const romandata_upper[] = {
			{ 1000, u"Ⅿ" }, { 900, u"ⅭⅯ" }, { 500, u"Ⅾ" }, { 400, u"ⅭⅮ" }, { 100, u"Ⅽ" }, { 90, u"ⅩⅭ" },
			{ 50, u"Ⅼ" }, { 40, u"ⅩⅬ" }, { 10, u"Ⅹ" }, { 9, u"ⅠⅩ" }, { 5, u"Ⅴ" }, { 4, u"ⅠⅤ" },
			{ 1, u"Ⅰ" }, { 0, nullptr }}; // end marker
	static romandata_t const romandata_lower[] = {
			{ 1000, u"ⅿ" }, { 900, u"ⅽⅿ" }, { 500, u"ⅾ" }, { 400, u"ⅽⅾ" }, { 100, u"ⅽ" }, { 90, u"ⅹⅽ" },
			{ 50, u"ⅼ" }, { 40, u"ⅹⅼ" }, { 10, u"ⅹ" }, { 9, u"ⅰⅹ" }, { 5, u"ⅴ" }, { 4, u"ⅰⅴ" },
			{ 1, u"ⅰ" }, { 0, nullptr }}; // end marker

	if (v == 0) {
		return WideString(u"0");
	}
	WideString result;
	if (v < 0) {
		result += u"-";
		v = std::abs(v);
	}
	if (v <= 12) {
		result += (uppercase?(u'Ⅰ' + (v - 1)):(u'ⅰ' + (v - 1)));
	} else {
		auto romandata = uppercase?romandata_upper:romandata_lower;
		for (romandata_t const* current = romandata; current->value > 0; ++current) {
			while (v >= current->value) {
				result += current->numeral;
				v -= current->value;
			}
		}
	}
	return result;
}
WideString
NativeLookupTable::get_candidate (int index) const
{
    if (index < 0 || index >= (int) number_of_candidates ())
        return WideString ();

    if (index < (int) m_strings.size ()) {
        return m_strings [index];
    } else if (index < (int) (m_strings.size () + m_phrases.size ())) {
        return m_phrases [index - m_strings.size ()].get_content ();
    } else {
        return WideString (m_chars.begin () + index - m_strings.size () - m_phrases.size (), 
                        m_chars.begin () + index - m_strings.size () - m_phrases.size () + 1);
    }
    return WideString ();
}
Пример #11
0
void Editor::addLogMessage(char const* text, uint64 timestamp, uint32 type)
{
  int len = getTextLength();
  POINT ptCaret = toPoint(caret);
  POINT ptSelStart = toPoint(selStart);
  if (lines.length() == 1 && lines[0].timestamp == 0)
    lines.pop();
  else if (lines.length() > 1024)
  {
    lines.remove(0, 1);
    ptCaret.y--;
    ptSelStart.y--;
  }
  int pos = 0;
  while (true)
  {
    if (text[pos] == '\r' || text[pos] == '\n' || text[pos] == 0)
    {
      Line& ln = lines.push();
      ln.text = WideString(text, pos);
      for (int i = 0; i < ln.text.length(); i++)
        if (ln.text[i] == '\t')
          ln.text.replace(i, 1, WideString(" ") * (settings->tabSize - (i % settings->tabSize)));
      ln.ctx = type;
      ln.timestamp = timestamp;
      if (text[pos] == 0)
        break;
      pos++;
      if ((text[pos] == '\r' || text[pos] == '\n') && text[pos - 1] != text[pos])
        pos++;
      text += pos;
      pos = 0;
    }
    else
      pos++;
  }
  if (selStart == caret && caret == len)
    selStart = caret = getTextLength();
  else
  {
    caret = fromPoint(ptCaret);
    selStart = fromPoint(ptSelStart);
  }
  updateExtent();
  updateCaret();
}
Пример #12
0
bool CBC_DataMatrix::Encode(WideStringView contents) {
  int32_t width;
  int32_t height;
  auto* pWriter = GetDataMatrixWriter();
  std::vector<uint8_t> data =
      pWriter->Encode(WideString(contents), &width, &height);
  return pWriter->RenderResult(data, width, height);
}
Пример #13
0
WideString QStrint2WideString(const QString& str)
{
#ifdef __DAVAENGINE_MACOS__
	return str.toStdWString();
#else
	return WideString((wchar_t*)str.unicode(), str.length());
#endif
}
Пример #14
0
static WideString Builder_getGreekBullet(int64_t v) {
	static constexpr int mod = (u'ω' - u'α') + 1;
	if (v == 0) {
		return WideString(u"0");
	}

	WideString ret;
	bool isNegative = v < 0;
	v = std::abs(v) - 1;
	do {
		ret = WideString(1, char16_t(u'α' + v % mod)) + ret;
		v /= mod;
	} while (v > 0);
	if (isNegative) {
		ret = WideString(u"-") + ret;
	}
	return ret;
}
Пример #15
0
static void unpack(mpq::Loader* loader, mpq::ListFile* list, char const* spath)
{
  String path = String::format("data\\global\\items\\%s.dc6", spath);
  if (list->has(path)) return;
  LocalPtr<File> src = loader->load(path);
  if (!src) return;
  LocalPtr<File> dst = File::create(WideString(path));
  if (dst) dst->copy(src);
}
Пример #16
0
//---------------------------------------------------------------------------
void __fastcall TTagForm::FormHide(TObject *Sender)
{
	String	buf;
//	CEdit	*pEdit;
	int	tempi=0;
	float	tempf=0.0;
	WCHAR	*pWCHAR;
//	CWTSvrTestApp	*pApp;

//	pApp = (CWTSvrTestApp *)AfxGetApp();

//	pEdit = (CEdit *)GetDlgItem(IDC_VALUE);
        m_name=Edit1->Text;
        m_description=Edit3->Text;
        m_units=Edit4->Text;
	buf=Edit2->Text;
	switch (m_value.vt)
		{
		case VT_I2:
		     m_value.intVal = StrToInt(buf);
		break;
		case VT_BOOL: if (buf == "true")
				  m_value.boolVal = TRUE;
			      else
				  {
				  tempi = StrToInt(buf);
				  if (tempi > 0)
				    m_value.boolVal = TRUE;
				  else
				    m_value.boolVal = FALSE;
				  }
				break;
		case VT_BSTR: 	pWCHAR = WideString (buf);
				m_value.bstrVal = SysAllocString (pWCHAR);
//					pApp->WSTRFree (pWCHAR);
				break;
		default: tempf= StrToFloat(buf);
			 m_value.fltVal = tempf;
			 break;
		}
		m_enabled[3] = CheckBox1->Checked;
		m_enabled[2] = CheckBox2->Checked;
		m_enabled[1] = CheckBox3->Checked;
		m_enabled[0] = CheckBox4->Checked;

		m_alarms[3] = StrToFloat(Edit5->Text);
		m_alarms[2] = StrToFloat(Edit7->Text);
		m_alarms[1] = StrToFloat(Edit9->Text);
		m_alarms[0] = StrToFloat(Edit11->Text);

		m_severity[3] = StrToInt(Edit6->Text);
		m_severity[2] = StrToInt(Edit8->Text);
		m_severity[1] = StrToInt(Edit10->Text);
		m_severity[0] = StrToInt(Edit12->Text);

}
Пример #17
0
TEST_F(FPDFDocEmbedderTest, Bug_182) {
  ASSERT_TRUE(OpenDocument("bug_182.pdf"));

  unsigned short buf[128];
  constexpr wchar_t kExpectedTitle[] = L"Super Visual Formade 印刷";

  ASSERT_EQ(48u, FPDF_GetMetaText(document(), "Title", buf, sizeof(buf)));
  EXPECT_EQ(WideString(kExpectedTitle),
            WideString::FromUTF16LE(buf, FXSYS_len(kExpectedTitle)));
}
Пример #18
0
WideString CPDF_TextPage::GetPageText(int start, int count) const {
  if (start < 0 || start >= CountChars() || count <= 0 || !m_bIsParsed ||
      m_CharList.empty() || m_TextBuf.GetLength() == 0) {
    return WideString();
  }

  const int count_chars = CountChars();
  int text_start = TextIndexFromCharIndex(start);

  // If the character at |start| is a non-printing character, then
  // TextIndexFromCharIndex will return -1, so scan ahead to the first printing
  // character.
  while (text_start < 0) {
    if (start >= count_chars)
      return WideString();
    start++;
    text_start = TextIndexFromCharIndex(start);
  }

  count = std::min(count, count_chars - start);

  int last = start + count - 1;
  int text_last = TextIndexFromCharIndex(last);

  // If the character at |last| is a non-printing character, then
  // TextIndexFromCharIndex will return -1, so scan back to the last printing
  // character.
  while (text_last < 0) {
    if (last < text_start)
      return WideString();

    last--;
    text_last = TextIndexFromCharIndex(last);
  }

  if (text_last < text_start)
    return WideString();

  int text_count = text_last - text_start + 1;

  return WideString(m_TextBuf.AsStringView().Mid(
      static_cast<size_t>(text_start), static_cast<size_t>(text_count)));
}
Пример #19
0
TEST_F(FPDFDocEmbedderTest, GetMetaTextInAttachmentFile) {
  ASSERT_TRUE(OpenDocument("embedded_attachments.pdf"));

  // Make sure this is the date from the PDF itself and not the attached PDF.
  unsigned short buf[128];
  constexpr wchar_t kExpectedModDate[] = L"D:20170712214448-07'00'";
  ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf)));
  EXPECT_EQ(WideString(kExpectedModDate),
            WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
}
//----------------------------------------------------------------------------------------
// GetShortName
//----------------------------------------------------------------------------------------
WideString
CZPLinkResource::GetShortName(
	bool bUIName) const
{
	IDFile file;
	Utils<IZPAssetUtils>()->URIToIDFile(mId, file);

	AString name(file.GetNameStr());
	return WideString(name.GrabWString(), name.UTF16Count(), name.CharCount());
}
//---------------------------------------------------------------------------
__fastcall TPreferences_SheetF::TPreferences_SheetF(TComponent* Owner)
    : TForm(Owner)
{
    Columns_Count=0;

    //Columns count
    for (int I1=0; I1<100; I1++)
        ColumnsCount->Items->Add(WideString(I1));
    ColumnsCount->ItemIndex=1;
}
Пример #22
0
void __fastcall TForm1::actViewClassificationsExecute(TObject *Sender)
{
	Variant app = Variant::CreateObject("Excel.Application");
	Variant excel = app.OlePropertyGet("Workbooks").OleFunction("Open", WideString(m_strFileName.c_str()));
	Variant vSheets = excel.OlePropertyGet("Worksheets");
	Variant vSheet = vSheets.OlePropertyGet("Item",m_nPageClassification);
	UnicodeString strPageName = vSheet.OlePropertyGet("Name");
	if (strPageName.UpperCase() != UnicodeString("классификации").UpperCase()) {
	   app.OleProcedure("Quit");
	   MessageBox (Handle, UnicodeString(L"Не верное имя страницы").c_str(), L"prompt", MB_OK);
	   return;
	};

	std::vector<exlClass> classes;
	ReadClassifications(vSheet, classes);
	app.OleProcedure("Quit");

	/*RichEdit1->Lines->Clear();
	RichEdit1->Lines->Add("Уровень TreeView1->Selected->Level: "+IntToStr(TreeView1->Selected->Level));
	int n = TreeView1->Selected->AbsoluteIndex;
	RichEdit1->Lines->Add("Асболютный номер TreeView1->Selected->AbsoluteIndex: "+IntToStr(n));
	RichEdit1->Lines->Add("Текст из выбранного узла: "+TreeView1->Selected->Text);*/
	FormSelectClass->ComboBox1->Items->Clear();
	FormClassEditor->TreeView1->Items->Clear();
	std::map<UnicodeString, TTreeNode *> nodeclasses;
	for (unsigned int i = 0; i < classes.size(); i++) {
		if (nodeclasses.count(classes[i].Class) == 0) {
			TTreeNode *parentNode = FormClassEditor->TreeView1->Items->Add(NULL, classes[i].Class);
			nodeclasses[classes[i].Class] = parentNode;
			parentNode->ImageIndex = 0;
			parentNode->SelectedIndex = 0;
			FormSelectClass->ComboBox1->Items->Add(classes[i].Class);
		}
		TTreeNode *pParentNode = nodeclasses[classes[i].Class];
		TTreeNode *pChildNode = FormClassEditor->TreeView1->Items->AddChild(pParentNode, classes[i].Name);
		pChildNode->ImageIndex = 1;
		pChildNode->Data = new exlClass(classes[i]);
		pChildNode->SelectedIndex = 1;
	}


//	TTreeNode *Node1 = FormClassEditor->TreeView1->Items->Add(NULL, "Root");
//	Node1->ImageIndex = 0;
//	FormClassEditor->TreeView1->Items->AddChild(Node1, "Root1");



/*	int n = TreeView1->Selected->AbsoluteIndex;
	TTreeNode *Node1 = TreeView1->Items->Item[n];
	TreeView1->Items->AddChild(Node1,"ChildNode");*/
//	Node1->Selected=true;
    ProgressBar1->Position = 0;
	FormClassEditor->ShowModal();
}
Пример #23
0
WideString GetGlobalTextWide(HGLOBAL data)
{
  WideString result;
  wchar_t* ptr = (wchar_t*) GlobalLock(data);
  if (ptr)
  {
    result = WideString(ptr);
    GlobalUnlock(data);
  }
  return result;
}
void __fastcall TPreferences_SheetF::Column_Size0Change(TObject *Sender)
{
    //Sum of sizes
    int Total=0;
    for (int Pos=0; Pos<Columns_Count; Pos++)
    #ifdef UNICODE
        Total+=Ztring(WideString(Column_Size[Pos]->Text).c_bstr()).To_int32s();
    #else
        Total+=Ztring().From_Unicode(Column_Size[Pos]->Text.c_bstr()).To_int32s();
    #endif

    //Adapt column sizes
    Sheet_Show->ColCount=Columns_Count;
    for (int Pos=0; Pos<Columns_Count; Pos++)
    #ifdef UNICODE
         Sheet_Show->ColWidths[Pos]=Ztring(WideString(Column_Size[Pos]->Text).c_bstr()).To_int32s()*Sheet_Show->ClientWidth/Total;
    #else
         Sheet_Show->ColWidths[Pos]=Ztring().From_Unicode(Column_Size[Pos]->Text.c_bstr()).To_int32s()*Sheet_Show->ClientWidth/Total;
    #endif
}
Пример #25
0
//---------------------------------------------------------------------------
bool __fastcall TTSSWaveContext::Start(AnsiString filename)
{
	if(FDecoder) FDecoder->Release(), FDecoder = NULL;


	HRESULT hr;
	IUnknown * decoder;

	hr = FModule->GetMediaInstance(WideString(filename).c_bstr(), &decoder);
	if(FAILED(hr))
	{
		throw Exception(filename + " は開くことができません");
	}

	hr = decoder->QueryInterface(IID_ITSSWaveDecoder, (void**)&FDecoder);
	if(FAILED(hr))
	{
		decoder->Release();
		FDecoder = NULL;
		throw Exception(filename + " のメディア・タイプは扱うことができません");
	}

	decoder->Release();

	TSSWaveFormat format;
	FDecoder->GetFormat(&format);
	if(format.dwBitsPerSample != 16)
	{
		throw Exception(filename + " は 16bit PCM に変換できないため扱うことができません");
	}
	if(format.dwChannels > 8)
	{
		throw Exception(filename + " は 9チャネル以上あるため扱うことができません");
	}
	if(format.ui64TotalSamples == 0)
	{
		throw Exception(filename + " は 総サンプル数が不明か、ゼロのため扱うことができません");
	}
	if(format.ui64TotalSamples >= 0x10000000ui64)
	{
		throw Exception(filename + " は 大きすぎるため、扱うことができません");
	}
	FChannels = format.dwChannels;
	FFrequency = format.dwSamplesPerSec;
	FBitsPerSample = 16;
	FSpeakerConfig = 0; // 現時点では常に 0 (なにか規格をつくるかも)
	FTotalSamples = (int)format.ui64TotalSamples;

	FGranuleSize = FChannels * sizeof(__int16);

//	FDecoder->SetPosition(0); /// test

	return true;
}
Пример #26
0
STDMETHODIMP TGuideImpl::get_HelpFile(BSTR* Value)
{
  try
  {
    *Value = WideString(m_VclCtl->HelpFile).Copy();
  }
  catch(Exception &e)
  {
    return Error(e.Message.c_str(), IID_IGuide);
  }
  return S_OK;
};
Пример #27
0
STDMETHODIMP TChaiXImpl::get_Caption(BSTR* Value)
{
  try
  {
    *Value = WideString(m_VclCtl->Caption).Copy();
  }
  catch(Exception &e)
  {
    return Error(e.Message.c_str(), IID_IActiveFormX);
  }
  return S_OK;
};
Пример #28
0
// Geometrie nicht modifizieren, nur Merkmale/Ident korrigieren ---------------
bool UpdateFeatures (HPROJECT hPr, LONG &rlONr, ULONG lIdent, long sta[], long mi[])
{
// Objekt wiederfinden
char *pUIdent = NULL;
	
	rlONr = 0L;

	TX_ASSERT(!(g_fAbglGeom && g_fAbglAttr));	// nie gleichzeitig Attribs und Geometrie abgleichen!

// versuchen über GUID zu finden
	if ('\0' != guid[0]) {
	OBJECTGUID OUID;

		INITSTRUCT (OUID, OBJECTGUID);
		if (SUCCEEDED(CLSIDFromString (WideString(guid), &OUID.guid))) {
			if (SUCCEEDED(DEX_FindObjectFromGuidEx (hPr, OUID)))
				rlONr = OUID.lONr;
		}
	}

// versuchen, über Unique Ident zu finden
	if (0 == rlONr && RetrieveText (g_ulUniqueId, mi, &pUIdent, false, !g_fImportObj) > 0) 
		rlONr = FindObject (g_ulUniqueId, pUIdent);

	DELETE_OBJ(pUIdent);

	if (rlONr > 0) {		// Merkmale erzeugen
		if (m_flag && !CreateFeatures (rlONr, mi, lIdent)) {
			g_lWithErrors++;	// mit Fehlern importiert
			return false;
		}

	ULONG lOldId = (ULONG)DEX_GetObjIdent (rlONr);

		if (lIdent != lOldId) {
		MODOBJIDENT MOI;

			INITSTRUCT(MOI, MODOBJIDENT);
			MOI.lONr = rlONr;
			MOI.lNewIdent = lIdent;
			MOI.iMode = 0;
			if (!DEX_ModObjectIdent (MOI)) {
				g_lWithErrors++;	// mit Fehlern importiert
				return false;
			}
		}
		CountObjects (sta[1]);
		return true;
	} else
		g_lNotImported++;		// nicht wiedergefunden

    return false;
}
Пример #29
0
TEST_F(FPDFDocEmbedderTest, GetMetaTextSameObjectNumber) {
  ASSERT_TRUE(OpenDocument("annotation_highlight_square_with_ap.pdf"));

  // The PDF has been edited. It has two %%EOF markers, and 2 objects numbered
  // (1 0). Both objects are /Info dictionaries, but contain different data.
  // Make sure ModDate is the date of the last modification.
  unsigned short buf[128];
  constexpr wchar_t kExpectedModDate[] = L"D:20170612232940-04'00'";
  ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf)));
  EXPECT_EQ(WideString(kExpectedModDate),
            WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
}
Пример #30
0
TEST_F(FPDFDocEmbedderTest, Bookmarks) {
  // Open a file with two bookmarks.
  EXPECT_TRUE(OpenDocument("bookmarks.pdf"));

  // The existent top-level bookmark has no title.
  unsigned short buf[128];
  EXPECT_EQ(0u, FPDFBookmark_GetTitle(nullptr, buf, sizeof(buf)));

  FPDF_BOOKMARK child = FPDFBookmark_GetFirstChild(document(), nullptr);
  EXPECT_TRUE(child);
  EXPECT_EQ(34u, FPDFBookmark_GetTitle(child, buf, sizeof(buf)));
  EXPECT_EQ(WideString(L"A Good Beginning"), WideString::FromUTF16LE(buf, 16));

  EXPECT_EQ(nullptr, FPDFBookmark_GetFirstChild(document(), child));

  FPDF_BOOKMARK sibling = FPDFBookmark_GetNextSibling(document(), child);
  EXPECT_TRUE(sibling);
  EXPECT_EQ(28u, FPDFBookmark_GetTitle(sibling, buf, sizeof(buf)));
  EXPECT_EQ(WideString(L"A Good Ending"), WideString::FromUTF16LE(buf, 13));

  EXPECT_EQ(nullptr, FPDFBookmark_GetNextSibling(document(), sibling));
}