"));
PageData.append(wxT(""));
PageData.append(wxT(""));
PageData.append(vCardObj->Get(wxT("FN")));
PageData.append(wxT(""));
PageData.append(wxT(" | "));
PageData.append(wxT(""));
// Define common variables for ADR.
std::map SplitPoints;
std::map SplitLength;
std::map::iterator SLiter;
int intPropertyLen;
int intSplitsFound;
int intSplitSize;
int intPrevValue;
wxString AddressPOBox;
wxString AddressStreet;
wxString AddressLocality;
wxString AddressRegion;
wxString AddressPostalCode;
wxString AddressCountry;
wxString AddressExtended;
wxString FinalAddressLine;
bool AddressFirst = TRUE;
// Define common variables for PHOTO and LOGO.
std::string PhotoDataBin;
std::string PhotoDataIn;
wxString PhotoSplitData;
wxString PhotoMIMEType;
wxString PhotoEncType;
wxString PhotoEncData;
bool LoadPicture = FALSE;
bool DataDisplay = FALSE;
bool RectData = FALSE;
wxRect PhotoRectPoints;
wxString SIDFilename;
wxString OutData;
wxString DataLines;
// Picture
ArrayvCardOutData ContactData = vCardObj->GetByPartial(wxT("PHOTO"));
if (ContactData.PropCount > 0){
// Split the data.
/*std::map SplitPts;
std::map SplitLen;
std::map SplitData;
int intSize = 0;
SplitPropertyData(&ContactData.PropData[0],
&SplitPts,
&SplitLen,
0,
&SplitData);
for (std::map::iterator striter = SplitData.begin();
striter != SplitData.end(); striter++){
raise(SIGABRT);
}*/
// Look for the X-ABCROP-RECTANGLE.
wxStringTokenizer PhotoSplit(ContactData.PropData[0], wxT(":"));
wxString PhotoPropertyDataString = PhotoSplit.GetNextToken();
wxStringTokenizer PhotoPropertyData(PhotoPropertyDataString, wxT(";"));
wxString PropertyLineData;
wxString PropertyName;
wxString PropertyValue;
wxStringTokenizer DataSplit(ContactData.PropValues[0], wxT(";"));
PhotoSplitData = DataSplit.GetNextToken();
wxStringTokenizer MIMESplit(PhotoSplitData, wxT(":"));
MIMESplit.GetNextToken();
PhotoMIMEType = MIMESplit.GetNextToken();
PhotoSplitData = DataSplit.GetNextToken();
wxStringTokenizer EncSplit(PhotoSplitData, wxT(","));
PhotoEncType = EncSplit.GetNextToken();
PhotoEncData = EncSplit.GetNextToken();
// Convert the picture data from base64 to binary.
PhotoDataIn = std::string(PhotoEncData.mb_str());
PhotoDataBin = base64_decode(PhotoDataIn);
wxMemoryInputStream istream(PhotoDataBin.c_str(), (size_t)PhotoDataBin.size());
wxImage photo;
if (!photo.LoadFile(istream, wxBITMAP_TYPE_ANY)){
// Photo failed to load so do nothing.
LoadPicture = FALSE;
} else {
while (PhotoPropertyData.HasMoreTokens()){
PropertyLineData = PhotoPropertyData.GetNextToken();
wxStringTokenizer PhotoPropPair(PropertyLineData, wxT("="));
wxString PhotoPropName = PhotoPropPair.GetNextToken();
wxString PhotoPropValue = PhotoPropPair.GetNextToken();
if (PhotoPropName == wxT("X-ABCROP-RECTANGLE")){
wxStringTokenizer PhotoRectData(PhotoPropValue, wxT("&"));
PhotoRectData.GetNextToken();
//PhotoRectPoints.SetX(wxAtoi(PhotoRectData.GetNextToken()));
//PhotoRectPoints.SetY(wxAtoi(PhotoRectData.GetNextToken()) - 100);
int PointXBase = wxAtoi(PhotoRectData.GetNextToken());
int PointYBase = wxAtoi(PhotoRectData.GetNextToken());
int PointWBase = wxAtoi(PhotoRectData.GetNextToken());
int PointHBase = wxAtoi(PhotoRectData.GetNextToken());
int PointX = PointXBase;
int PointY = PointYBase;
int PointW = PointWBase;
int PointH = PointHBase;
// Top Right Method
if (PointYBase > PointHBase){
PointX = photo.GetWidth() - PointXBase - 140;
PointY = photo.GetHeight() - PointYBase - 140;
PointW = PointWBase;
PointH = PointHBase;
} else if (PointXBase > PointWBase){
PointX = photo.GetWidth() - PointXBase;
PointY = PointYBase - 50;
PointW = PointWBase;
PointH = PointHBase;
} else {
}
/*int PointX = PointXBase;
int PointY = PointYBase;
int PointW = PointWBase;
int PointH = PointHBase;*/
// Bottom Left Method
/*int PointX = wxAtoi(PhotoRectData.GetNextToken());
int PointY = photo.GetHeight() - wxAtoi(PhotoRectData.GetNextToken()) - 340;
int PointW = wxAtoi(PhotoRectData.GetNextToken());
int PointH = wxAtoi(PhotoRectData.GetNextToken());*/
// Bottom Right Method
/*int PointXRemain = photo.GetWidth() - PointX - 140;
int PointYRemain = photo.GetHeight() - PointY - 140;*/
PhotoRectPoints.SetX(PointX);
PhotoRectPoints.SetY(PointY);
PhotoRectPoints.SetWidth(PointW);
PhotoRectPoints.SetHeight(PointH);
RectData = TRUE;
}
}
LoadPicture = TRUE;
// Resize the picture to 125x125.
// Add to the wxMemnoryFSHandler.
SIDFilename = SID + wxT("-photo");
if (RectData == TRUE){
wxImage rectphoto = photo.GetSubImage(PhotoRectPoints);
rectphoto = rectphoto.Scale(75, 75, wxIMAGE_QUALITY_HIGH);
wxMemoryFSHandler::AddFile(SIDFilename, rectphoto, wxBITMAP_TYPE_PNG);
} else {
photo = photo.Scale(50, 50, wxIMAGE_QUALITY_HIGH);
wxMemoryFSHandler::AddFile(SIDFilename, photo, wxBITMAP_TYPE_PNG);
}
// Add the filename to the MemoryFSList map.
MemoryFSList->insert(std::make_pair(SIDFilename, SID));
}
}
if (LoadPicture == TRUE){
PageData.append(wxT(""));
}
LoadPicture = FALSE;
// Logo
ContactData = vCardObj->GetByPartial(wxT("LOGO"));
if (ContactData.PropCount > 0){
// Split the data.
wxStringTokenizer DataSplit(ContactData.PropValues[0], wxT(";"));
PhotoSplitData = DataSplit.GetNextToken();
wxStringTokenizer MIMESplit(PhotoSplitData, wxT(":"));
MIMESplit.GetNextToken();
PhotoMIMEType = MIMESplit.GetNextToken();
PhotoSplitData = DataSplit.GetNextToken();
wxStringTokenizer EncSplit(PhotoSplitData, wxT(","));
PhotoEncType = EncSplit.GetNextToken();
PhotoEncData = EncSplit.GetNextToken();
// Convert the picture data from base64 to binary.
PhotoDataIn = std::string(PhotoEncData.mb_str());
PhotoDataBin = base64_decode(PhotoDataIn);
wxMemoryInputStream istream(PhotoDataBin.c_str(), (size_t)PhotoDataBin.size());
wxImage photo;
if (!photo.LoadFile(istream, wxBITMAP_TYPE_ANY)){
// Photo failed to load so do nothing.
LoadPicture = FALSE;
} else {
LoadPicture = TRUE;
photo = photo.Scale(50, 50, wxIMAGE_QUALITY_HIGH);
// Resize the picture to 125x125.
// Add to the wxMemnoryFSHandler.
SIDFilename = SID + wxT("-logo");
wxMemoryFSHandler::AddFile(SIDFilename, photo, wxBITMAP_TYPE_PNG);
// Add the filename to the MemoryFSList map.
MemoryFSList->insert(std::make_pair(SIDFilename, SID));
}
}
if (LoadPicture == TRUE){
PageData.append(wxT(""));
}
PageData.append(wxT(" | "));
PageData.append(wxT("
"));
PageData.append(wxT("