⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makeform.cpp

📁 IBM Lotus C++ API 7.0a for IBM Lotus Notes/Domino Directory Release --------- ------------------
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//
// Description:
//		Prints out various LNForm Properties.
//
//---------------------------------------------------------------------------

void PrintProperties(LNForm &form )
{
LNFormula formula;

	cout << "***** Current Properties on Form: [" << form.GetName() << "] ******" << endl << endl;
	cout << "Form Alias names:               [" << form.GetAlias() << "]" << endl;

	form.GetWindowTitleFormula( &formula );
	LNString code = formula.GetText();
	cout << "Window Title Formula:           [" << code << "]" << endl;

	cout << hex;

	cout << "GetIncludeInMenuOption:         [" << (LNINT)form.GetIncludeInMenuOption() << "]" << endl;
	cout << "GetFormType:                    [" << (LNINT)form.GetFormType() << "]" << endl;
	cout << "GetIncludeInSearchBuilder:      [" << form.GetIncludeInSearchBuilder() << "]" << endl;
	cout << "GetIsAnonymousForm:             [" << form.GetIsAnonymousForm() << "]" << endl;
	cout << "GetMergeReplicationConflicts:   [" << form.GetMergeReplicationConflicts() << "]" << endl;
	cout << "GetCreateVersionsAutomatically: [" << form.GetCreateVersionsAutomatically() << "]" << endl;
	cout << "GetVersioningOption:            [" << (LNINT)form.GetVersioningOption() << "]" << endl;
	cout << "GetRefreshFieldsAutomatically:  [" << (LNINT)form.GetRefreshFieldsAutomatically() << "]" << endl;
	cout << "GetContextPaneOption:           [" << (LNINT)form.GetContextPaneOption() << "]" << endl;
	cout << "GetDisableFieldExchange:        [" << form.GetDisableFieldExchange() << "]" << endl;
	cout << "GetEditOnOpen:                  [" << form.GetEditOnOpen() << "]" << endl;
	cout << "GetInheritDocumentOption:       [" << (LNINT)form.GetInheritDocumentOption() << "]" << endl;
	cout << "GetInheritDocumentFieldName:    [" << form.GetInheritDocumentFieldName() << "]" << endl;
	cout << "GetInheritFormulaValues:        [" << form.GetInheritFormulaValues() << "]" << endl;
	cout << "GetIsDefaultForm:               [" << form.GetIsDefaultForm() << "]" << endl;
	cout << "GetShowMailSendOnClose:         [" << form.GetShowMailSendOnClose() << "]" << endl;
	cout << "GetStoreFormInDocument:         [" << form.GetStoreFormInDocument() << "]" << endl;
	cout << "GetTreatContentsAsHTML:         [" << form.GetTreatContentsAsHTML() << "]" << endl;
	cout << "GetAllowAllAuthors:             [" << form.GetAllowAllAuthors() << "]" << endl;
	cout << "GetAllowAllReaders:             [" << form.GetAllowAllReaders() << "]" << endl;
	cout << "GetAllowPublicAccessUsers:      [" << form.GetAllowPublicAccessUsers() << "]" << endl;

	cout << dec;

	// Get the default encryption keys. (there may not be any for this form so you have to check it!)
	LNText keys = form.GetDefaultEncryptionKeys();

	// Make sure this form contains encryption keys before trying to use or look at them.
	if (!keys.IsNull())
		cout << "GetDefaultEncryptionKeys:       [" << (LNString)keys[0] << "]" << endl;

	cout << "GetDisablePrintingAndCopying:   [" << form.GetDisablePrintingAndCopying() << "]" << endl;
	cout << endl << "The list of Authors follows:" << endl << endl;

	LNText authorslist = form.GetAuthors();
	LNINT count = authorslist.GetCount();
	LNINT i;

	for (i=0; i<count; i++)
		cout << "     Author:     [" << i << "] " << "= " << "[" << (LNString)authorslist[i] << "]" << endl;

	cout << endl << "The list of Readers follows:" << endl << endl;

	LNText readerslist =  form.GetReaders();
	count = readerslist.GetCount();
	for (i=0; i<count; i++)
		cout << "     Reader:     [" << i << "] " << "= " << "[" << (LNString)readerslist[i] << "]" << endl;

	cout << "Hit return to continue: ";
	cin.getline(CommandBuf, 50);
	cout << endl;

} // END PrintProperties()

//---------------------------------------------------------------------------
//
// Name:
//		PrintAutoLaunchSettings
//
// Description:
//		Prints out the Auto Launch Settings on the form.
//
//---------------------------------------------------------------------------

void PrintAutoLaunchSettings(LNForm &form )
{
LNFormula formula;
LNString code;

	cout << "***** Auto Launch Settings on Form: [" << form.GetName() << "] ******" << endl << endl;

	cout << hex;

	cout << "GetAutoLaunchObjectType:        [" << (LNINT)form.GetAutoLaunchObjectType() << "]" << endl;
	cout << "GetLaunchOLEObjectInPlace:      [" << form.GetLaunchOLEObjectInPlace() << "]" << endl;
	cout << "GetCreateObjectInFieldOption:   [" << (LNINT)form.GetCreateObjectInFieldOption() << "]" << endl;
	cout << "GetCreateObjectInFieldName:     [" << form.GetCreateObjectInFieldName() << "]" << endl;
	cout << "GetLaunchObjectWhenFlags:       [" << form.GetLaunchObjectWhenFlags() << "]" << endl;
	cout << "GetHideDocumentWhenFlags:       [" << form.GetHideDocumentWhenFlags() << "]" << endl;
	cout << "GetPresentDocumentAsDialog:     [" << form.GetPresentDocumentAsDialog() << "]" << endl;

	cout << dec;

	cout << "Hit return to continue: ";
	cin.getline(CommandBuf, 50);
	cout << endl;

} // END PrintAutoLaunchSettings()

//---------------------------------------------------------------------------
//
// Name:
//		SetProperties
//
// Description:
//		Sets various LNForm Properties.
//
//---------------------------------------------------------------------------

void SetProperties(LNForm &form )
{
	form.SetAlias("NewAlias1|NewAlias2|Newalias3");

	form.SetInheritDocumentOption( LNINHERITDOCOPTION_RICH_TEXT );

	form.SetInheritDocumentFieldName("RichTextField1");

	form.SetTreatContentsAsHTML(TRUE);

	form.SetWindowTitleFormula( "@Text(\"NewForm: The Window Title has been changed!\")" );

	LNText authorslist;
	
	authorslist << "John Steinbeck";
	authorslist << "Philip K. Dick";
	authorslist << "Max V. Mathews";
	authorslist << "T.S. Eliot";
	authorslist << "Issac Asamov";
	authorslist << "Mark Twain";
	authorslist << "Jonathan Swift";

	form.SetAuthors(authorslist);

	LNText readerslist;
	
	readerslist << "Evelyn Wood";
	readerslist << "James Cagney";
	readerslist << "Duke Ellington";
	readerslist << "Bela Bartok";
	readerslist << "Steve Jobs";
	readerslist << "John Kennedy";
	readerslist << "Lenard Nemoy";

	form.SetReaders(readerslist);

	cout << "Properties for [" << form.GetName() << "] have been modified..." << endl << endl;

	cout << "Hit return to continue: ";
	cin.getline(CommandBuf, 50);
	cout << endl;

} // END SetProperties()

//---------------------------------------------------------------------------
//
// Name:
//		SetAutoLaunchProperties
//
// Description:
//		Sets various LNForm Auto Launch Properties.
//
//---------------------------------------------------------------------------

void SetAutoLaunchProperties(LNForm &form )
{
	// Set object type to OLE

	form.SetAutoLaunchObjectType( LNAUTOLAUNCHOBJECTTYPE_OLE_OBJECT );

	form.SetLaunchOLEObjectInPlace( TRUE );

	form.SetLaunchObjectWhenFlags( LNLAUNCHOBJECTWHENFLAGS_CREATING | 
								   LNLAUNCHOBJECTWHENFLAGS_EDITING    );

	form.SetCreateObjectInFieldOption( LNCREATEOBJECTINFIELDOPTION_NAMED_RT_FIELD );

	form.SetCreateObjectInFieldName( "RichTextField1" );

	cout << "Auto Launch Properties for [" << form.GetName() << "] have been modified..." << endl << endl;
	cout << "Hit return to continue: ";
	cin.getline(CommandBuf, 50);
	cout << endl;

} // END SetAutoLaunchProperties()

//----------------------------------------------------------------------
//
//	Function:
//		CreateActionBar
//
//	Description:
//		Create the action bar for the sample formula and "Approve"/"Deny"
//		actions.
//
//	Inputs:
//		sampleForm - Form to which the actions will be added
//		approvalAddress - Mail address to which approvals should be sent
//		ccList - List of people who receive copies of approve/deny messages.
//
//	Outputs:
//		None.
//
//	Returns:
//		None.
//
//	Remarks:
//		None.
//
//----------------------------------------------------------------------

void CreateActionBar (
	LNForm & sampleForm,
	const LNString &	approvalAddress,
	const LNString &	ccList
) {
	LNActions		actionArray;

		// Get the current set of actions
	sampleForm.GetActions (&actionArray);

		// Create an action that runs a formula
	{
		LNFormula		sampleFormula ("@Prompt([OK];\"Sample formula\";\"Running formula\")");
		LNAction		formulaAction ("Formula Action", sampleFormula);

			// Set the display attributes for the action
		formulaAction.SetIconIndex (12);
		formulaAction.SetShowInButtonBar (TRUE);
		formulaAction.SetShowInMenu (TRUE);

			// Add the action to the actions array
		actionArray.Append (formulaAction);
	}

		// Create the "Approve" operations
	{
		LNSimpleActions	approveSteps;

			// First step - send "Approve" message
		{
			LNSimpleSendMailAction	sendApproveMail;

			sendApproveMail.SetToString (approvalAddress);
			sendApproveMail.SetCCString (ccList);
			sendApproveMail.SetSubjectString ("Request approved");
			sendApproveMail.SetMessageBody ("This request has been approved.");
			sendApproveMail.SetIncludeDocument (TRUE);
			sendApproveMail.SetSaveMessage (TRUE);

				// Add to the set of simple actions
			approveSteps.Append (sendApproveMail);
		}

			// Second step - send reply to requestor
		{
			LNSimpleSendReplyAction	sendApproveReply;

			sendApproveReply.SetMessageBody ("This request has been approved.");
			sendApproveReply.SetIncludeDocument (TRUE);
			sendApproveReply.SetSaveMessage (FALSE);

				// Add to the list of simple actions
			approveSteps.Append (sendApproveReply);
		}

			// Final step - file in the "Approved Requests" folder
		{
			LNSimpleFolderAction	fileApproval (LNSIMPLEACTIONTYPE_MOVE_TO_FOLDER);

			fileApproval.SetCreateNewFolder (TRUE);
			fileApproval.SetPrivateFolder (TRUE);
			fileApproval.SetFolderName ("Approved Requests");

				// Add to the set of simple actions
			approveSteps.Append (fileApproval);
		}

		// The approval steps are ready to add!
		LNAction	approveAction ("Approve Request", approveSteps);

			// Set the display attributes for the action
		approveAction.SetIconIndex (15);
		approveAction.SetShowInButtonBar (TRUE);
		approveAction.SetShowInMenu (TRUE);

			// Add the action to the actions array
		actionArray.Append (approveAction);
	}

		// Create the "Deny" operations
	{
		LNSimpleActions	denySteps;

			// First step - send reply to requestor
		{
			LNSimpleSendReplyAction	sendDenyReply;

			sendDenyReply.SetMessageBody (
				"This request has been DENIED.  Call me if you wish to discuss this.");
			sendDenyReply.SetIncludeDocument (TRUE);
			sendDenyReply.SetSaveMessage (TRUE);

				// Add to the list of simple actions
			denySteps.Append (sendDenyReply);
		}

			// Final step - file in the "Denied Requests" folder
		{
			LNSimpleFolderAction	fileDenial (LNSIMPLEACTIONTYPE_MOVE_TO_FOLDER);

			fileDenial.SetCreateNewFolder (TRUE);
			fileDenial.SetPrivateFolder (TRUE);
			fileDenial.SetFolderName ("Denied Requests");

				// Add to the set of simple actions
			denySteps.Append (fileDenial);
		}

		// The approval steps are ready to add!
		LNAction	denyAction ("Deny Request", denySteps);

			// Set the display attributes for the action
		denyAction.SetIconIndex (16);
		denyAction.SetShowInButtonBar (TRUE);
		denyAction.SetShowInMenu (TRUE);

			// Add the action to the actions array
		actionArray.Append (denyAction);
	}

		// Store the new set of actions
	sampleForm.SetActions (actionArray);

	cout << "A New Action Bar for [" << sampleForm.GetName() << "] has been created..." << endl << endl;
	cout << "Hit return to continue: ";
	cin.getline(CommandBuf, 50);
	cout << endl;

} // END CreateActionBar()

// END Makeform sample application.


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -