📄 nsflog.cpp
字号:
//
// Remarks:
//
// The following Item Data Types have been defined by version 4.01 of
// the C++ API. NOTE: More, have been added since, and more will be
// added in the future.
//
// C++ API Symbol C API Symbol(s) that map to it.
// -----------------------------------------------------------------------
// LNITEMTYPE_DATETIMES TYPE_TIME_RANGE
// LNITEMTYPE_ERROR TYPE_ERROR
// LNITEMTYPE_FONTTABLE TYPE_COMPOSITE
// LNITEMTYPE_FORMULA TYPE_FORMULA
// LNITEMTYPE_ICON TYPE_ICON
// LNITEMTYPE_NOTELINKS TYPE_NOTELINK_LIST
// LNITEMTYPE_NOTEREFS TYPE_NOTEREF_LIST
// LNITEMTYPE_NUMBERS TYPE_NUMBER_RANGE (also) TYPE_NUMBER
// LNITEMTYPE_OBJECT TYPE_OBJECT
// LNITEMTYPE_RICHTEXT TYPE_COMPOSITE
// LNITEMTYPE_SIGNATURE TYPE_SIGNATURE
// LNITEMTYPE_TEXT TYPE_TEXT_LIST (also) TYPE_TEXT
// LNITEMTYPE_UNAVAILABLE TYPE_UNAVAILABLE
// LNITEMTYPE_UNSUPPORTED TYPE_INVALID_OR_UNKNOWN
// LNITEMTYPE_USERDATA TYPE_USERDATA
//
// New Item types that have been implemented in the 2.1 release of
// the C++ API Toolkit: (Need to implement these here... ***dhs)
//
// LNITEMTYPE_ACTION TYPE_ACTION
// LNITEMTYPE_ASSISTANT_INFO TYPE_ASSISTANT_INFO
// LNITEMTYPE_CALENDAR_FORMAT TYPE_CALENDAR_FORMAT
// LNITEMTYPE_COLLATION TYPE_COLLATION
// LNITEMTYPE_FORM_VIEW_ACTION (TYPE_COMPOSITE | LNITEMTYPE_SPECIAL | LNITEMTYPE_COMPOSITE_ACTION_FLAG)
// LNITEMTYPE_HIGHLIGHTS TYPE_HIGHLIGHTS
// LNITEMTYPE_HTML TYPE_HTML
// LNITEMTYPE_LSOBJECT TYPE_LSOBJECT
// LNITEMTYPE_OLE_OBJECT (TYPE_COMPOSITE | LNITEMTYPE_SPECIAL | LNITEMTYPE_COMPOSITE_OLE_FLAG)
// LNITEMTYPE_QUERY TYPE_QUERY
// LNITEMTYPE_SCHED_LIST TYPE_SCHED_LIST
// LNITEMTYPE_SEAL TYPE_SEAL
// LNITEMTYPE_SEALDATA TYPE_SEALDATA
// LNITEMTYPE_SEAL_LIST TYPE_SEAL_LIST
// LNITEMTYPE_USERID TYPE_USERID
// LNITEMTYPE_VIEW_FORMAT TYPE_VIEW_FORMAT
// LNITEMTYPE_VIEWMAP_DATASET TYPE_VIEWMAP_DATASET
// LNITEMTYPE_VIEWMAP_LAYOUT TYPE_VIEWMAP_LAYOUT
// LNITEMTYPE_WORKSHEET_DATA TYPE_WORKSHEET_DATA
//
//---------------------------------------------------------------------------
void NSFLog::ProcessItemType( LNItem &Item, LNITEMTYPE ItemType )
{
switch (ItemType)
{
case LNITEMTYPE_ERROR :
case LNITEMTYPE_UNAVAILABLE :
case LNITEMTYPE_UNSUPPORTED :
break;
case LNITEMTYPE_TEXT :
LogTextItem( Item );
break;
case LNITEMTYPE_NUMBERS :
LogNumbersItem( Item );
break;
case LNITEMTYPE_DATETIMES :
LogDateTimesItem( Item );
break;
case LNITEMTYPE_FORMULA :
LogUndefinedItem( );
break;
case LNITEMTYPE_RICHTEXT :
ProcessRichTextItem( Item );
break;
case LNITEMTYPE_FONTTABLE :
ProcessFontTableItem( Item );
break;
case LNITEMTYPE_ICON :
LogUndefinedItem( );
break;
case LNITEMTYPE_NOTEREFS :
LogUndefinedItem( );
break;
case LNITEMTYPE_SIGNATURE :
LogUndefinedItem( );
break;
case LNITEMTYPE_NOTELINKS :
LogUndefinedItem( );
break;
case LNITEMTYPE_OBJECT :
LogUndefinedItem( );
break;
case LNITEMTYPE_USERDATA :
LogUndefinedItem( );
break;
// case TYPE_USERID :
// Type USERID is not supported by the C++ API
// and is obsolete In Notes Version 3.0 or later.
// break;
case TYPE_SEAL:
LogUndefinedItem( );
break;
case TYPE_SEALDATA:
LogUndefinedItem( );
break;
case TYPE_SEAL_LIST:
LogUndefinedItem( );
break;
case TYPE_HIGHLIGHTS:
LogUndefinedItem( );
break;
case TYPE_WORKSHEET_DATA:
LogUndefinedItem( );
break;
case TYPE_COLLATION:
LogUndefinedItem( );
break;
default:
// Item Type Unknown or Unexposed.
break;
} // END switch (ItemType)
} // END NSFLog::ProcessItemType
//---------------------------------------------------------------------------
//
// Name:
// NSFLog::LogTextItem
//
// Description:
// Extracts all of the Text elements from the LNText object.
// Converts each element to an LNString and Appends it
// to the Log file.
//---------------------------------------------------------------------------
void NSFLog::LogTextItem( const LNItem &Item )
{
LNINT Count, i;
LNText TempText;
TempText = Item;
Count = TempText.GetCount();
LogFile << endl << "Dump Of Text Data Follows:" << endl;
for (i = 0; i<Count; i++)
{
LogFile << " [" << (LNString)TempText[i] << "]" << endl;
}
} // END NSFLog::LogTextItem
//---------------------------------------------------------------------------
//
// Name:
// NSFLog::LogNumbersItem
//
// Description:
// Extracts all of the Number elements from the LNNumbers object.
// Converts each element to an LNString and Appends it to the
// Log file.
//---------------------------------------------------------------------------
void NSFLog::LogNumbersItem( const LNItem &Item )
{
LNINT Count, i;
LNNumbers TempNumber;
LNNumber Number;
LNString TempString;
TempNumber = Item;
Count = TempNumber.GetCount();
LogFile << " Dump Of Number Data Follows:" << endl << endl;
for (i = 0; i<Count; i++)
{
Number = (LNNUMBER)TempNumber[i];
Number.GetText( &TempString );
LogFile << " [" << TempString << "]" << endl;
}
LogFile << endl;
} // END NSFLog::LogNumbersItem
//---------------------------------------------------------------------------
//
// Name:
// NSFLog::LogDateTimesItem
//
// Description:
// Extracts all of the Date Time elements from the LNDatetimes object.
// Converts each element to an LNString and Appends it to the
// Log file.
//---------------------------------------------------------------------------
void NSFLog::LogDateTimesItem( const LNItem &Item )
{
LNINT Count, i;
LNDatetimes TempDates;
LNDatetime Date;
LNString TempString;
TempDates = Item;
Count = TempDates.GetCount();
LogFile << " Dump Of Date Data Follows:" << endl << endl;
for (i = 0; i<Count; i++)
{
Date = (LNDatetime)TempDates[i];
if (!Date.IsSpecialCase())
Date.GetText( &TempString );
else
TempString = "Date Time is Special Case";
LogFile << " [" << TempString << "]" << endl;
}
LogFile << endl;
} // END NSFLog::LogDateTimesItem
//---------------------------------------------------------------------------
//
// Name:
// NSFLog::LogUndefinedItem
//
// Description:
// This funciton is just a placeholder function for Items that
// have not been defined as Classes in C++ API.
// To further process these items you must use CAPI functions.
// It Appends to the log file a message that the item is not defined
// as a C++ API class.
//
//---------------------------------------------------------------------------
void NSFLog::LogUndefinedItem()
{
LogFile << endl
<< "This Item has not been defined as a C++ API Class." << endl
<< "Use NSF calls to further process and display it." << endl
<< endl;
} // END NSFLog::LogUndefinedItem
//---------------------------------------------------------------------------
//
// Name:
// NSFLog::ProcessRichTextItem
//
// Description:
// This method processes any Items that are abstracted by the C++
// API as Rich Text, which includes all Composite Data Records,
// Stylized Text, Font Styles, Icons, etc... Because Rich Text can
// contain sub objects, such as in the case of Stylized Text
// (i.e. Font Styles etc.) this method contains a loop which itterates
// through the rich text field looking for sub items and calls methods
// that process those objects even further.
//
//---------------------------------------------------------------------------
void NSFLog::ProcessRichTextItem( const LNItem &Item )
{
LNSTATUS lnStatus;
LNRichText Rt;
LNRTCursor Curser;
LNRTObject Obj;
LNRTContainer Container;
LNBOOL isObjFound;
LNINT i;
// Get The Item as a Rich Text Object.
Rt = Item;
// Get a Curser object which will be pointing
// to the left of the first element in the RT field.
lnStatus = Rt.GetCursor( &Curser );
if (LNWARN_NOT_FOUND == lnStatus)
return;
// Begin processing all objects contained in this RT Field.
isObjFound = TRUE;
for (i=1; isObjFound; i++)
{
// Get The Object to the Right of the Curser Position.
if ( Curser.GetObject( &Obj ) == LNWARN_NOT_FOUND )
{
isObjFound = FALSE;
}
// Find out what type of Rich Text Type this Object is and process it.
else if ( Obj.IsType( LNRTTYPE_STYLIZED_TEXT ) )
{
// Process and Append info about the Stylized text to the Log.
ProcessStylizedText( Obj, i );
// Position the Curser to the right of the last element
// in this Stylized Text Object. (Must use as Contaier Object)
Container = Obj;
Curser.GotoEnd( Container );
}
else if ( Obj.IsType( LNRTTYPE_COMPOSITE_DATA ) )
{
// Process and Append info about the CD Record to the Log.
ProcessCompositeData( Obj, i );
// Put the curser on the next element in the RT field.
// This will not error if it is the last element. It
// just stays where it is and the above GetObject call will
// return NOT FOUND to terminate the loop.
Curser++;
}
else
{
// Add a heading for the UN-EXPOSED OR UNKNOWN record to be logged.
LogUnexposedCDRHeading( i );
// Put the curser on the next element in the RT field.
Curser++;
}
} // END for (i=1; isObjFound; i++)
} // END NSFLog::ProcessRichTextItem
//---------------------------------------------------------------------------
//
// Name:
// NSFLog::LogUnexposedCDRHeading
//
// Description:
// Appends a heading to record the encounter with an unknown or
// un-exposed CD record in the C++ API. These records have to
// be processed using CAPI calls, (i.e. NSF_DUMP) to be logged.
//
//---------------------------------------------------------------------------
LNSTATUS NSFLog::LogUnexposedCDRHeading( const LNINT recordcount )
{
LogFile << " Un-Exposed or Unknown CD Record [";
LogNumberData( recordcount, 10 );
LogFile << "]" << endl;
return LNNOERROR;
} // END NSFLog::LogUnexposedCDRHeading
//---------------------------------------------------------------------------
//
// Name:
// NSFLog::ProcessStylizedText
//
// Description:
// Processes and Logs data about the current Rich Text Object
// which has been determined to be a Stylized Text Object.
//
// Remarks:
// LNFontStyle::GetCDFace and LNFontStyle::GetFontID
// could have been called here to get the
// lower level font records needed for doing things
// in combination with C API calls. However, calling it
// here is not necessary since higher level objects have
// taken care of all that detail for us.
//---------------------------------------------------------------------------
void NSFLog::ProcessStylizedText( const LNRTObject &Obj, const LNINT recordcount )
{
LNStylizedText StyleText;
LNFontStyle FontStyle;
LNString TextBuf;
StyleText = Obj;
LogFile << endl;
// Add a heading for the record to be logged.
LogLabel( " CD Record", recordcount, 10);
// Get the Font Style of the Stylized text.
StyleText.GetFontStyle( &FontStyle );
// Append the font style attribues flags info to the Log.
LogFontAttributes( FontStyle.GetAttributes() );
// Append the font's Color to the Log. Expressed as an
// integer from 0-239. Colors 0-15 have symbolic names
// (e.g., LNCOLOR_BLACK)
LogLabel( " Font Color: ", GetFontColorString( FontStyle.GetColor() ) );
// Append the font Face ID to the Log.
LogLabel( " Font Face ID: ", GetFontFaceString( FontStyle.GetFaceID() ) );
// Append the font point size to the Log.
LogLabel( " Font Point Size: ", FontStyle.GetPointSize(), 10 );
// Append the Text String of this segment of stylized text to the Log.
StyleText.GetText( &TextBuf );
LogLabel(" Dump Of Stylized Text Data Follows:\n ", TextBuf );
} // END NSFLog::ProcessStylizedText
//---------------------------------------------------------------------------
//
// Name:
// NSFLog::LogFontAttributes
//
// Description:
// Logs data about the current Font Styles Font Attribute flags
// by checking each bit in the bitfield and loging it if set.
//
//---------------------------------------------------------------------------
void NSFLog::LogFontAttributes( const LNFONTATTRIBUTEFLAGS FontFlags )
{
// Append a heading to indicate the following are Font Attribute Flags.
LogFile << " Font Attribute Flags That Are Set:" << endl;
// Log all the flags that are set.
if ( FontFlags & LNFONTATTRIBUTEFLAGS_BOLD )
LogFile << " LNFONTATTRIBUTEFLAGS_BOLD" << endl;
if ( FontFlags & LNFONTATTRIBUTEFLAGS_ITALIC )
LogFile << " LNFONTATTRIBUTEFLAGS_ITALIC" << endl;
if ( FontFlags & LNFONTATTRIBUTEFLAGS_UNDERLINE )
LogFile << " LNFONTATTRIBUTEFLAGS_UNDERLINE" << endl;
if (FontFlags & LNFONTATTRIBUTEFLAGS_STRIKETHROUGH )
LogFile << " LNFONTATTRIBUTEFLAGS_STRIKETHROUGH" << endl;
if (FontFlags & LNFONTATTRIBUTEFLAGS_SUPERSCRIPT )
LogFile << " LNFONTATTRIBUTEFLAGS_SUPERSCRIPT" << endl;
if (FontFlags & LNFONTATTRIBUTEFLAGS_SUBSCRIPT )
LogFile << " LNFONTATTRIBUTEFLAGS_SUBSCRIPT" << endl;
if ( FontFlags == LNFONTATTRIBUTEFLAGS_PLAIN )
LogFile << " LNFONTATTRIBUTEFLAGS_PLAIN" << endl;
} // END NSFLog::LogFontAttributes
//---------------------------------------------------------------------------
//
// Name:
// NSFLog::GetFontColorString
//
// Description:
// Translates the Font Color Symbol value into a string or an
// string value representing any integers passed in greater than 15.
//
//---------------------------------------------------------------------------
LNString NSFLog::GetFontColorString( const LNCOLOR FontColor )
{
char Buf[20];
switch (FontColor)
{
case LNCOLOR_BLACK :
return "LNCOLOR_BLACK";
case LNCOLOR_WHITE :
return "LNCOLOR_WHITE";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -