Beispiel #1
0
BOOL BfxPixelOp::SetBitmap(KernelBitmap * pKB, DWORD theCacheStateMask, DWORD theCacheValueMask,
								  BOOL theDefaultValue)
{
	Base = NULL;
	ERROR2IF( ((!pKB) || (pKB->ActualBitmap==NULL)) ,FALSE,"BfxALU can't find OIL bitmap");
	ERROR3IF( (!(pKB->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxALU Oil layer inconsistency");

	BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pKB->ActualBitmap))->BMInfo->bmiHeader);

	ERROR2IF( (BPP && pBMI->biBitCount != BPP), FALSE, "BfxPixelOp called with incorrect BPP");

	Base = (DWORD *)(void *)(((CWxBitmap *)(pKB->ActualBitmap))->BMBytes);
	Width = pBMI->biWidth;
	INT32 Bits = pBMI->biBitCount;
	switch (Bits)
	{
		case 1 : WidthRounded = (Width+31) &~31; break;
		case 2 : WidthRounded = (Width+15) &~15; break;
		case 4 : WidthRounded = (Width+7) &~7; break;
		case 8 : WidthRounded = (Width+3) &~3; break;
		case 16: WidthRounded = (Width+1) &~1; break;
		case 32:
		default:
				 WidthRounded = Width; break;
	}

 	Height = pBMI->biHeight;
	Size = (pBMI->biSizeImage)>>2;

	return TRUE;
}
Beispiel #2
0
BOOL PointersTab::CommitSection()
{
TRACEUSER( "Neville", _T("commit PointersTab section\n"));
	ERROR2IF(pPrefsDlg == NULL,FALSE,"PointersTab::CommitSection called with no dialog pointer");

	BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_POINTERS));	// The pointers page identifier
	if (!ok)
		return TRUE;	// Talk to page failed to return now

	// Section = Pointers

	// Ok has been pressed so take the values from this section of the dialog box
	BOOL Valid=FALSE;		// Flag for validity of value
//	BOOL State=FALSE;		// Flag for state of button/switch
	BOOL SetOk=TRUE;		// Preference value set ok

	// Middle button removed for now as nothing seems to use it.

	// 0, 1 or 2 indicating Left Middle or Right mouse button
	ButtonFunction LeftButton = (ButtonFunction)pPrefsDlg->GetSelectedValueIndex(_R(IDC_OPTS_LEFTBUTTON));
//	ButtonFunction MiddleButton = (ButtonFunction)pPrefsDlg->GetSelectedValueIndex(_R(IDC_OPTS_MIDDLEBUTTON));
	ButtonFunction RightButton = (ButtonFunction)pPrefsDlg->GetSelectedValueIndex(_R(IDC_OPTS_RIGHTBUTTON));
	ClickModifiers::SetButtonFunc(0, LeftButton);
//	ClickModifiers::SetButtonFunc(1, MiddleButton);
	ClickModifiers::SetButtonFunc(2, RightButton);

	// All units work off the selected document and so we must do nothing if there is no
	// selected document. Check our clas variable to see if this is true or not.
	// Units should have been set up by the caller.
	if (pDocument == NULL || pSpread == NULL)
		return (TRUE);

	// Now the magnetic radii
	INT32 LineRadius = 0;					
	INT32 PointRadius = 0;					
	LineRadius = pPrefsDlg->GetUnitGadgetValue(_R(IDC_OPTS_LINERADIUS), CurrentPageUnits,
											 0, INT_MAX, _R(IDE_OPTS_INVALIDLINERAD), &Valid);
TRACEUSER( "Neville", _T("commit LineRadius distance='%d' Valid ='%d'\n"),LineRadius, Valid);
	if (Valid)
	{
		SetOk = Camelot.SetPrefValue(TEXT("Magnetic Options"), TEXT("Line Radius"), &LineRadius);
		ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_EDIT));
	}
	else
		return FALSE; 			// Magnetic line radius incorrect, user has been warned already

	PointRadius = pPrefsDlg->GetUnitGadgetValue(_R(IDC_OPTS_POINTRADIUS), CurrentPageUnits,
											 0, INT_MAX, _R(IDE_OPTS_INVALIDPOINTRAD), &Valid);
TRACEUSER( "Neville", _T("commit PointRadius distance='%d' Valid ='%d'\n"),PointRadius, Valid);
	if (Valid)
	{
		SetOk = Camelot.SetPrefValue(TEXT("Magnetic Options"), TEXT("Point Radius"), &PointRadius);
		ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_EDIT));
	}
	else
		return FALSE; 			// Magnetic point radius incorrect, user has been warned already


	return TRUE;
}
Beispiel #3
0
/********************************************************************************************

>	BOOL EllipseTool::Init()

	Author:		Peter_Arnold (Xara Group Ltd) <*****@*****.**>
	Created:	18/03/95
	Inputs:		-
	Outputs:	-
	Returns:	TRUE/FALSE for success/failure
	Purpose:	Called to initialise the ellipse tool.
	Errors:		-
	SeeAlso:	QuickShapeBase::Init

********************************************************************************************/
BOOL EllipseTool::Init()
{
	BOOL ok = TRUE;

	pQuickShapeBaseInfoBarOp = new QuickShapeBaseInfoBarOp(this, _R(IDD_ELLIPSETOOLBAR));
	return pQuickShapeBaseInfoBarOp != NULL;

PORTNOTE("dialog", "Removed Bar reading")
#if 0
	CCResTextFile file;									// Resource File
	QuickShapeBaseInfoBarOpCreate BarCreate;			// Object that creates QuickShapeBaseInfoBarOp objects

	 		ok = file.open(_R(IDM_ELLIPSE_BAR), _R(IDT_INFO_BAR_RES));	// Open resource
	if (ok) ok = DialogBarOp::ReadBarsFromFile(file,BarCreate);	// Read and create info bar
	if (ok) file.close();									 	// Close resource

	ERROR2IF(!ok,FALSE,"Unable to load EllipseTool.ini from resource"); 

	// Info bar now exists.  Now get a pointer to it
	String_32 str = String_32(_R(IDS_ELIPTOOL_INFOBARNAME));
	DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str);
	
	ERROR2IF(pDialogBarOp==NULL, FALSE, "Ellipse infobar not found\n");

	ok = pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(QuickShapeBaseInfoBarOp));
	if (ok)
	{
		pQuickShapeBaseInfoBarOp = (QuickShapeBaseInfoBarOp*)pDialogBarOp;
		pQuickShapeBaseInfoBarOp->pQuickShapeBase = this;
	}
#endif
	ERROR2IF(!ok,FALSE,"Error finding the Ellipse tool info bar");

	return (ok);
}
Beispiel #4
0
BOOL FreeHandEPSFilter::ValidateGroup(Node *pGroup)
{
	ERROR2IF(pGroup == 0, FALSE, "Group passed to validateGroup is null");

	Node *pFirstChild = pGroup->FindFirstChild();

	ERROR2IF(pFirstChild == 0, FALSE, "Group without children passed to ValidateGroup - should have been deleted by EndGroup"); 

	if(pFirstChild->FindNext() == 0)
	{
		// there was only one object - delete this group.

		// if pFirstNodeInRange is this node, set it to the child
		if(pFirstNodeInRange == pGroup)
			pFirstNodeInRange = pFirstChild;
		
		// move the child to the parent of the group
		if (!ImportInfo.pOp->DoMoveNode(pFirstChild, pNode, LASTCHILD))
			return FALSE;

		// see EPSFilter::EndGroup for the reason why it's hidden rather than deleted
		if (!ImportInfo.pOp->DoHideNode(pGroup, TRUE))
			return FALSE;

	}

	return TRUE;
}
Beispiel #5
0
/********************************************************************************************

>	virtual BOOL WizOpStyleRefRecordHandler::HandleRecord(CXaraFileRecord* pRecord)

 	Author:		Colin_Barfoot (Xara Group Ltd) <*****@*****.**>
	Created:	27/06/97

	Purpose:	Handles the given TAG_WIZOP record.

	Inputs:		pCXaraFileRecord = ptr to record to handle

	Returns:	TRUE if handled successfuly
				FALSE otherwise

	Errors:		If pCXaraFileRecord isn't a TAG_WIZOP record

********************************************************************************************/
BOOL WizOpStyleRefRecordHandler::HandleRecord(CXaraFileRecord* pRecord)
{
	ERROR2IF(pRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
	ERROR2IF(pRecord->GetTag() != TAG_WIZOP_STYLEREF, FALSE, "I don't handle this tag type");

	XFileRef			StyleRecordRef;

	BOOL				Ok = pRecord->ReadINT32(&StyleRecordRef);
	if (Ok)
	{
		WizOpStyle* const pStyle = GetImportedStyles().FindStyleFromRecordReference(StyleRecordRef);
		if (pStyle != NULL)
		{
			// We managed to read it all OK so add a new StyleRefAttribute to the tree
		 	StyleReferenceAttribute* const pNewAttribute = new StyleReferenceAttribute(*pStyle);
		
			if (pNewAttribute != NULL)
			{
				Ok = InsertNode(pNewAttribute);
			}
			else
			{
				Ok = FALSE;
			}
		}
		else
		{
			BaseCamelotFilter* const pFilter = GetBaseCamelotFilter();
			ENSURE_NOT_NULL(pFilter);
			pFilter->AppendWarning(_R(IDS_STYLE_NOT_FOUND));
		}
	}

	return Ok;
}
Beispiel #6
0
BOOL PushTool::GetStatusLineText(String_256* pText, Spread*, DocCoord, ClickModifiers)
{
	ERROR2IF(this==NULL, FALSE,"PushTool::GetStatusLineText() - this==NULL");
	ERROR2IF(pText==NULL,FALSE,"PushTool::GetStatusLineText() - pText==NULL");

	return pText->Load(_R(IDS_PUSHTOOL_STATUSHELP));
}
Beispiel #7
0
/********************************************************************************************
>	BOOL OpMakeSegmentsLines::ProcessSegment(NodePath* pPath, INT32* Index, INT32 PrevIndex)

	Author:		Peter_Arnold (Xara Group Ltd) <*****@*****.**>
	Created:	16/8/95
	Inputs:		pPath - points to the path to process
				Index - index of the PT_BEZIERTO segment to change into lines
				PrevIndex - index of the previois endpoint (other end of the segment to process)
	Outputs:	Index is changed to point to the new index of the end of the segment
	Returns:	TRUE/FALSE for success/failure
	Purpose:	Performs the make selected segments into lines operation. 
	Errors:		-
	SeeAlso:	OpBaseConvertPathSegment::Do
********************************************************************************************/
BOOL OpMakeSegmentsLines::ProcessSegment(NodePath* pPath, INT32* Index, INT32 PrevIndex)
{
	// Get the path pointers
	PathVerb* Verbs;
	PathFlags* Flags;
	DocCoord* Coords;
	pPath->InkPath.GetPathArrays(&Verbs, &Coords, &Flags);

	// Quick check
	ERROR2IF(((Verbs[*Index] & ~PT_CLOSEFIGURE) != PT_BEZIERTO), FALSE, "Unknown segment encountered");
	ERROR2IF(((PrevIndex+3) != *Index), FALSE, "Not two points between segment start and end");

//	BOOL ok = TRUE;

	DocCoord EndCoord = Coords[*Index];
	PathFlags EndFlags = Flags[*Index];
	PathVerb NewEndVerb = Verbs[*Index];
	NewEndVerb = (NewEndVerb == PT_BEZIERTO) ? PT_LINETO : PT_LINETO | PT_CLOSEFIGURE;

	BOOL DoneOK = TRUE;

	// Insert a line segment
	if (DoneOK)
		DoneOK = DoInsertPathElement(pPath, PrevIndex, EndCoord, EndFlags, NewEndVerb, FALSE);

	// Remove the curve segment
	if (DoneOK)
		DoneOK = DoDeletePathSection(pPath, PrevIndex+2, 3, FALSE);

	*Index = PrevIndex+1;

	return DoneOK;
}
Beispiel #8
0
BOOL BfxPixelOpPseudo::SetBitmap(KernelBitmap * pKB, DWORD theCacheStateMask, DWORD theCacheValueMask,
								  BOOL theDefaultValue)
{
	Base = NULL;
	ERROR2IF( ((!pKB) || (pKB->ActualBitmap==NULL)) ,FALSE,"BfxALU can't find OIL bitmap");
	ERROR3IF( (!(pKB->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxALU Oil layer inconsistency");

	BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pKB->ActualBitmap))->BMInfo->bmiHeader);

	BPP=pBMI->biBitCount;
	ERROR2IF(BPP>8, FALSE,"Pseudo colour BMP not pseudo colour");
	switch (BPP)
	{
		case 1 : Log2BPP=0; break;
		case 2 : Log2BPP=1; break;
		case 4 : Log2BPP=2; break;
		case 8 : Log2BPP=3; break;
		default:
		ERROR2(FALSE, "Invalid BPP field");
	}

	if (!BfxPixelOp::SetBitmap(pKB, theCacheStateMask,theCacheValueMask, theDefaultValue)) return FALSE;

	BPPMask = (BPP==32)?0xFFFFFFFF:(1<<BPP)-1;
	XShift = 3-Log2BPP;
	XMask = (1<<XShift)-1;
	Size = (pBMI->biSizeImage<<3)>>Log2BPP;

	return TRUE;
}
Beispiel #9
0
BOOL CXaraFileNodeBitmap::WritePreChildrenNative(BaseCamelotFilter *pFilter, NodeBitmap *pNodeBitmap)
{
	ERROR2IF(pFilter==NULL, FALSE, "parameter pFilter==NULL");
	ERROR2IF(pNodeBitmap==NULL, FALSE, "parameter pNodeBitmap==NULL");

	return WriteNodeBitmap(pFilter, pNodeBitmap);
}
Beispiel #10
0
/********************************************************************************************

>	BOOL PNGFilter::ReadFromFile(OILBitmap* pOilBitmap)

	Author:		Neville_Humphrys (Xara Group Ltd) <*****@*****.**>
	Created:	26/4/96
	Inputs:		pOilBitmap	pointer to the oil bitmap data to be filled in
	Outputs:	Will have filled in BMInfo	pointer to the bitmap header to fill in
									BMBytes	pointer to the bitmap data to fill in
	Purpose:	Actually does the process of reading a bitmap from a file.
				Inherited classes override this to read in different file formats.
				
	Returns:	TRUE if worked, FALSE if failed.

********************************************************************************************/
BOOL PNGFilter::ReadFromFile(OILBitmap* pOilBitmap)
{
	ERROR2IF(pOilBitmap == NULL,FALSE,"PNGFilter::ReadFromFile null OilBitmap pointer");
	
	// Try to import the bitmap as a PNG file.		
	CCLexFile *pImportFile = GetImportFile();
	ERROR2IF(pImportFile==NULL,FALSE,"PNGFilter::ReadFromFile - No import file");

	UINT32 ImportMsgId = GetImportMsgID();		
	String_64 ProgressString(ImportMsgId);
	ProgressString = GetImportProgressString(pImportFile, ImportMsgId);

	CWxBitmap* pWBitmap = (CWxBitmap*)pOilBitmap;
	
	LPBITMAPINFO *pInfo = &(pWBitmap->BMInfo);
	LPBYTE *pBytes = &(pWBitmap->BMBytes);
	
	INT32 TransColour = -1;

	// The PNG filter liked it very much and so use it, showing progress bar
	if (!PNGUtil::ReadFromFile(pImportFile, pInfo, pBytes, &TransColour, &ProgressString))
		return FALSE;

	SetTransColour(TransColour);
	UINT32 Bpp = pWBitmap->GetBPP();
	if (TransColour != -1 && Bpp <= 8)
		pOilBitmap->SetTransparencyIndex(TransColour);

	SetLastBitmap();		// can only import one bitmap at the moment
	
	return TRUE;
}
Beispiel #11
0
BOOL MouldTransform::TransformPath(Path* const pSource, Path* pDestin)
{
	ERROR2IF(pSource==NULL,FALSE,"MouldTransform::TransformPath() called with a null source path");
	ERROR2IF(pDestin==NULL,FALSE,"MouldTransform::TransformPath() called with a null source path");

	return pMouldGeom->MouldPathToPath(pSource,pDestin);
}
Beispiel #12
0
BOOL EditTab::HandleMsg(DialogMsg* Msg)
{
TRACEUSER( "Neville", _T("HandleEditMsg\n"));
	ERROR2IF(Msg == NULL,FALSE,"EditTab::Message null message received");
	ERROR2IF(pPrefsDlg == NULL,FALSE,"EditTab::HandleMsg called with no dialog pointer");

	BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_EDIT));	// The edit page identifier
	if (!ok)
		return TRUE;		// no page present = handled message
	
	switch(Msg->DlgMsg)
	{
		case DIM_CREATE:	// Initialise controls
			GreyStatus = FALSE;	// we are ungreyed by default
			ok = InitSection();
			if (!ok)
				InformError();
			break;
		case DIM_SELECTION_CHANGED:
		case DIM_LFT_BN_CLICKED:
		case DIM_TEXT_CHANGED:
			OptionsTabs::SetApplyNowState(TRUE);
			break;
		default:
			break;
	}
	return TRUE;
}  
Beispiel #13
0
BOOL UnitListComponent::ExportUserUnits(BaseCamelotFilter *pFilter)
{
#ifdef DO_EXPORT
	ERROR2IF(pFilter == NULL,FALSE,"UnitListComponent::ExportUserUnits null pFilter");
	ERROR2IF(pDocUnitList == NULL,FALSE,"UnitListComponent::ExportUserUnits called with no doc unit list pointer");

	// Export any user defined units
	Unit* pUnit = NULL;
	BOOL ok = TRUE;
	INT32 RecNum = 0;

	pUnit = pDocUnitList->FindFirstUserUnit();
	while (pUnit != NULL)
	{
		RecNum = ExportUnitDefinition(pFilter, pUnit);
		if (RecNum == 0)
			break;

		pUnit = pDocUnitList->FindNextUserUnit(pUnit);
	}

	return ok;
#else
	return TRUE;
#endif
}
Beispiel #14
0
INT32 UnitListComponent::GetWriteUnitReference(UnitType type, BaseCamelotFilter *pFilter)
{
#ifdef DO_EXPORT
	ERROR2IF(pFilter == NULL,0L,"UnitListComponent::GetWriteUnitReference null pFilter");
	ERROR2IF(pDocUnitList == NULL,FALSE,"UnitListComponent::GetWriteUnitReference called with no doc unit list pointer");

	INT32 RecordNumber = 0L;

	// Get a pointer to the unit
	Unit* pUnit = NULL;
	pUnit = pDocUnitList->FindUnit(type);	

	// Is the unit a user defined unit or one of the defaults?
	if (pUnit->IsDefault())
	{
		// Its a default unit so convert the type into the default reference
		RecordNumber = GetExportUnitType(type);
	}
	else
	{
		// See if we have saved the unit definition out by checking our has table
		// Try and find the specified record number in our loaded user unit list
		if (pExpUserUnitMap->find(pUnit)==pExpUserUnitMap->end())
		{
			// We have not seen this unit before so save out the definition
			/*BOOL ok =*/ ExportUnitDefinition(pFilter, pUnit);
		}
	}

	return RecordNumber;
#else
	return 0;
#endif
}
Beispiel #15
0
BOOL OILPanose::Init(CDC *ptr)
{
	ERROR2IF(ptr==NULL, FALSE, "Parameter ptr == NULL");
	ERROR2IF(IsInitialised==TRUE, FALSE, "OILPanose::Init called when IsInitialised==TRUE.");

	pMyCDC = ptr;
	IsInitialised=TRUE;

	return TRUE;
}
Beispiel #16
0
BOOL NativePrefsDlg::InitDialog ()
{
	ERROR2IF ( mpParams == NULL, FALSE,
			   "NativePrefsDlg::InitDialog called after duff initialisation?!" );

	//First, do we have a selection?
	Application *pApp = GetApplication();

	ERROR2IF(pApp == NULL, FALSE,"NativePrefsDlg::InitDialog -  no application!");
	
	SelRange *pRange = pApp->FindSelection();
	
	ERROR2IF(pRange == NULL, FALSE,"NativePrefsDlg::InitDialog - no selection range!");
	DocRect ClipRect = pRange->GetBoundingRect();

	BOOL fThereIsASelection=!ClipRect.IsEmpty();

	//Now, is there a selection?
	if (fThereIsASelection)
	{
		// Yes. So ungrey both the buttons for selecting the nodes to export.
		EnableGadget(_R(IDC_NATIVEOPTS_SELECT), TRUE);
		EnableGadget(_R(IDC_NATIVEOPTS_DRAWING), TRUE);

		//Now, which of those buttons should be selected?
		switch ( mpParams->GetExportSel () )
		{
		case SELECTION:
			// Choose the export pair of buttons.
			SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), FALSE);
			SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), TRUE);
			break;

		default:
		case DRAWING:
			// Choose the export pair of buttons.
			SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), TRUE);
			SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), FALSE);
			break;
		}
	}
	else
	{
		//No. So grey the SELECTION button and ungrey
		//the DRAWING button
		EnableGadget(_R(IDC_NATIVEOPTS_SELECT), FALSE);
		EnableGadget(_R(IDC_NATIVEOPTS_DRAWING), TRUE);

		// And we must select the DRAWING button for the export area controls.
		SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), TRUE);
		SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), FALSE);
	}

	return TRUE;
}
Beispiel #17
0
Unit* UnitListComponent::GetReadUnitReference(INT32 UnitRef)
{
	ERROR2IF(pDocUnitList == NULL,FALSE,"UnitListComponent::GetReadUnitReference called with no doc unit list pointer");

TRACEUSER( "Neville", _T("GetReadUnitReference for ref %d\n"), UnitRef);
	// First check to see if the unit refers to any of the built in units.
	// These will have negative record numbers
	Unit			   *pUnit = NULL;
	if (UnitRef <= 0)
	{
		UnitType type = GetUnitType(UnitRef);

		// If we succesfully converted the unit into a type then find the unit
		if (type != NOTYPE)
		{
			// Find this unit type in the current document list
			pUnit = pDocUnitList->FindUnit(type);
		}
		else
			ERROR2(NULL,"BitmapListComponent::GetReadBitmapReference negative UnitRef is unknown");
	}
	else
	{
		// Try and find the specified record number in our loaded user unit list
		CMapLongToPtr::const_iterator iter = pImpUserUnitMap->find( UnitRef );
		/*BOOL			ok =*/ pImpUserUnitMap->end();/* != iter;*/
		pUnit = (Unit *)iter->second;
		// if ok then pUnit will be the pointer to the required unit
		// so return this.
		// if not ok then pUnit will still be null.
				
		// If not found then this is a problem as a bitmap must have been defined before its being
		// referenced 
		if (pUnit == NULL)
		{
			// If we have a pFilter then ask the default warning handle to append our message
			if (pCamFilter)
			{
				if (!WarnedBefore)
				{
					pCamFilter->AppendWarning(_R(IDS_NATIVE_UNITSWARNING));
					WarnedBefore = TRUE;
				}

				// Now use a default unit instead, we will use the default page display units
				UnitType PageUnits = pDocUnitList->GetPageUnits();	// The units used to display page measurements
				pUnit = pDocUnitList->FindUnit(PageUnits);	
			}
			else
				ERROR2IF(pUnit == NULL,NULL,"BitmapListComponent::GetReadUnitReference UnitRef cannot be found");
		}
	}

	return pUnit;
}
Beispiel #18
0
// FIXED16 version
BOOL PrintComponent::OutputValue(UINT32 Token,FIXED16 Value)
{
	ERROR2IF(pExportDC == NULL,FALSE,"NULL export DC in PrintComponent::OutputValue()");
	ERROR2IF(Token >= PCTOKEN_UNKNOWN,FALSE,"Token out of range");

	BOOL ok = TRUE;

	if (ok) ok = pExportDC->OutputToken(PCTokenStr[Token]);
	if (ok) ok = pExportDC->OutputReal(Value.MakeDouble());
	if (ok) ok = pExportDC->OutputNewLine();
	return ok;
}
Beispiel #19
0
KernelBitmap* NodeAnimatingBitmap::GetBitmap()
{
	KernelBitmap* pBitmap = m_pBmpRefs[m_nCurrentBmp].GetBitmap();
	if (pBitmap && pBitmap->HasBeenDeleted())
	{	
		// If necessary (due to the crud that is the bitmap system) use the default bitmap instead.
		ERROR2IF(pBitmap->GetParentBitmapList() == NULL, NULL, "Deleted bitmap has no parent list");
		pBitmap = pBitmap->GetParentBitmapList()->FindDefaultBitmap();

		// There should always be a default bitmap in the list
		ERROR2IF(pBitmap == NULL, 0L, "Couldn't find the default bitmap");
	}
	
	return pBitmap;
}
Beispiel #20
0
BOOL OpBackground::GetPageColour(Spread *pSpread, KernelBitmap **ppOutBitmap, 
														DocColour **ppOutColour)
{
	ERROR2IF(pSpread == NULL,FALSE,"OpBackground::GetPageColour Bad params error!");
	ERROR2IF(ppOutBitmap == NULL || ppOutColour == NULL,FALSE,"OpBackground::GetPageColour Bad params error!");

	// Search for our special page background layer
	Layer* pFoundLayer = pSpread->FindFirstPageBackgroundLayer();
	if (pFoundLayer == NULL)
		return FALSE;

	// search for our page node
	NodeRegularShape *pNode = DoFindPageRectangle(pSpread, pFoundLayer);

	if (!pNode)
		return FALSE;

	// find the fill attribute applied to the page
	NodeAttribute *pAppliedAttr = NULL;
	pNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrFillGeometry),&pAppliedAttr);

	if (pAppliedAttr != NULL)
	{
		if (IS_A(pAppliedAttr, AttrFlatColourFill)) // flat colour fill?
		{
			// get the colour attribute
			ColourFillAttribute *pColAttr = (ColourFillAttribute *)(pAppliedAttr->GetAttributeValue());

			// set the colour pointer to the doc colour, and the bitmap pointer to NULL
			*ppOutBitmap = NULL;
			*ppOutColour = pColAttr->GetStartColour();

		}
		else if (IS_A(pAppliedAttr, AttrBitmapColourFill)) // bitmap fill
		{

			// set the colour pointer to NULL, and the bitmap pointer to the kernel bitmap
			*ppOutBitmap = ((AttrFillGeometry *)pAppliedAttr)->GetBitmap();
			*ppOutColour = NULL;
		}
		else
			return FALSE;
	}
	else
		return FALSE;

	return TRUE;
}
Beispiel #21
0
BOOL RegularShapeRecordHandler::SetSecondaryCurvature(NodeRegularShape *pShape, const double & SecondaryCurvature)
{
	ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL");

	pShape->SetStellCurveToStell(SecondaryCurvature);
	return TRUE;
}
Beispiel #22
0
BOOL PlugInsContextMenu::BuildMenu(KernelBitmap * pBitmap, Document * pDocument,
								   ContextMenu * pContextMenu, MenuItem * pMainRoot,
								   BOOL AddSeparator, BOOL UseUndoable)
{
	ERROR2IF(pContextMenu == NULL,FALSE,"PlugInsContextMenu::BuildMenu null ContextMenu to add to");

	BOOL ok = TRUE;

	// As we are just about to invoke UI, check that the plug-in manager has its list
	// of available plug-ins otherwise, go and get it now as we are just about to need it.
//	PlugInManager* pManager = GetApplication()->GetPlugInManager();
//	if (pManager)
//		pManager->CheckHaveDetailsOnPlugIns();

//#ifndef WEBSTER
//#ifndef EXCLUDE_BFX
//	ok = ok && BfxPlugInContextMenu::BuildMenu(pBitmap, pDocument, pContextMenu, pMainRoot, TRUE, UseUndoable);
//#endif
//#endif // WEBSTER
//	ok = ok && PhotoShopContextMenu::BuildMenu(pBitmap, pDocument, pContextMenu, pMainRoot, FALSE, UseUndoable);

	ok = ok && BfxPlugInContextMenu::BuildMenu(pBitmap, pDocument, pContextMenu, pMainRoot, TRUE, UseUndoable);
	
	return ok;
}
Beispiel #23
0
BOOL GuidesPropertiesTab::BuildGuidelineList(Layer* pLayer)
{
	GuidelineList.DeleteAll();
	pPropertiesDlg->DeleteAllValues(_R(IDC_GUIDETAB_GUIDELINELIST));

	ERROR2IF(pLayer == NULL, FALSE,"pLayer is NULL");

	Node* pNode = pLayer->FindFirstChild(CC_RUNTIME_CLASS(NodeGuideline));
	while (pNode != NULL)
	{
		NodeGuideline* pGuideline = (NodeGuideline*) pNode;
		if (pGuideline->GetType() == GuideType)
		{
			GuidelineListItem* pItem = (GuidelineListItem*)GuidelineList.GetHead();
			while (pItem != NULL && (pItem->pGuideline->GetOrdinate() < pGuideline->GetOrdinate()))
				pItem = (GuidelineListItem*)GuidelineList.GetNext(pItem);

			GuidelineListItem* pNewItem = new GuidelineListItem(pGuideline);

			if (pNewItem != NULL)
			{
				if (pItem == NULL)
					GuidelineList.AddTail(pNewItem);
				else
					GuidelineList.InsertBefore(pItem,pNewItem);
			}
		}

		pNode = pNode->FindNext(CC_RUNTIME_CLASS(NodeGuideline));
	}

	return TRUE;
}
Beispiel #24
0
BOOL PluginOILFilter::GetExportFile(PathName* pPath, CCLexFile** ppNewFile)
{
	ERROR2IF(ppNewFile == NULL, FALSE,"PluginOILFilter::GetExportFile no newfile pointer");

	*ppNewFile = NULL;

	// Here we should run the plugin asynchronously with the following options
	// -e -g -f <filename> -x <xmlfilename>

	// The xmlfilename is a path to a user and filter specific file
	// e.g. ~/.XaraLX/filtername.xml
	// Create a CCLexFile derived object that sends its data to stdin
	// Check stderr during the Xar export and abort if an error is reported

	// However, this will not be trivial so intsead we will just create a 
	// CCDiskFile attached to a temporary filename and run the export process
	// in DoExport instead

	// Generate a temporary file name
	m_TempXarFile.SetPathName(_T("/tmp/xpftemp.xar"));

	CCDiskFile* pFile = new CCDiskFile();
	if (pFile)
	{
		if (pFile->open(m_TempXarFile, ios::out | ios::binary | ios::trunc))
		{
			*ppNewFile = pFile;
			return(TRUE);
		}

		delete pFile;
	}

	return(FALSE);
}
Beispiel #25
0
BOOL RegularShapeRecordHandler::SetNumberOfSides(NodeRegularShape *pShape, const INT32 & NumberOfSides)
{
	ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL");

	pShape->SetNumSides(NumberOfSides);
	return TRUE;
}
Beispiel #26
0
BOOL RegularShapeRecordHandler::SetPrimaryCurvature(NodeRegularShape *pShape, const double & PrimaryCurvature)
{
	ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL");

	pShape->SetPrimaryCurveToPrimary(PrimaryCurvature);
	return TRUE;
}
Beispiel #27
0
BOOL RegularShapeRecordHandler::SetIsStellated(NodeRegularShape *pShape, const BOOL & IsStellated)
{
	ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL");

	pShape->SetStellated(IsStellated);
	return TRUE;
}
Beispiel #28
0
BOOL RegularShapeRecordHandler::SetIsCircular(NodeRegularShape *pShape, const BOOL & IsCircular)
{
	ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL");

	pShape->SetCircular(IsCircular);
	return TRUE;
}
Beispiel #29
0
BOOL RegularShapeRecordHandler::SetStellationOffset(NodeRegularShape *pShape, const double & StellationOffset)
{
	ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL");

	pShape->SetStellationRatio(StellationOffset);
	return TRUE;
}
Beispiel #30
0
BOOL RegularShapeRecordHandler::SetStellationRadius(NodeRegularShape *pShape, const double & StellationRadius)
{
	ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL");

	pShape->SetStellRadiusToPrimary(StellationRadius);
	return TRUE;
}