Exemple #1
0
void range::GetFormulaName(char *outString, cell inLocation) const
{
	TopLeft().GetFormulaName(outString, inLocation);
	if (!(TopLeft() == BotRight()))
	{
		char t[12];
		BotRight().GetFormulaName(t, inLocation);
		strcat(outString, "..");
		strcat(outString, t);
	}
} /* GetFormulaName */
Exemple #2
0
void range::GetName(char *outString) const
{
	TopLeft().GetName(outString);
	if (!(TopLeft() == BotRight()))
	{
		char t[12];
		BotRight().GetName(t);
		strcat(outString, "..");
		strcat(outString, t);
	}
} /* range::GetName */
Exemple #3
0
void range::GetRCName(char *name) const
{
	TopLeft().GetRCName(name);
	if (!(TopLeft() == BotRight()))
	{
		char t[12];
		BotRight().GetRCName(t);
		strcat(name, ":");
		strcat(name, t);
	}
} // range::GetRCName
Exemple #4
0
range range::GetRefRange(cell loc) const
{
	range result;
	result.TopLeft() = TopLeft().GetRefCell(loc);
	result.BotRight() = BotRight().GetRefCell(loc);
	return result;
} /* range::GetRefRange */
/////////////////////////////////////////////////////////////////////
// TPreferencesDialog
// ------------------
//   Look if the dialog control 'resid' window contains the point
//   'clientPoint', which is a dialog client coord. of the point
BOOL TPreferencesDialog::IsPointInDlgItem (int itemId, TPoint &clientPoint)
{
	HWND hWnd = GetDlgItem (itemId);
	if ( hWnd == (HWND)NULL )
		return FALSE;

	TWindow wnd(hWnd);
	TRect wRect;
	wnd.GetWindowRect (wRect);
	TPoint TopLeft (wRect.left, wRect.top);
	TPoint BotRight(wRect.right, wRect.bottom);
	ScreenToClient (TopLeft);
	ScreenToClient (BotRight);
	TRect cRect (TopLeft, BotRight);

	return cRect.Contains (clientPoint);
}
Exemple #6
0
void range::Offset(cell inLocation, bool horizontal, int first, int count)
{
	bool wasSpecial = false;
	range rf = GetFlatRange(inLocation);
	
	if (horizontal)
		if (count < 0)
		{
			if (rf.left > first + count && rf.right <= first)
			{
				TopLeft() = cell::InvalidCell;
				BotRight() = cell::InvalidCell;
				wasSpecial = true;
			}
			else if (rf.left > first + count && rf.left <= first)
			{
				int dx = first - rf.left + 1;
				if (inLocation.h < first)
					dx += count;
				TopLeft().OffsetRefBy(dx, 0);
				BotRight().Offset(inLocation, true, first, count);
				wasSpecial = true;
			}
			else if (rf.right > first + count && rf.right <= first)
			{
				int dx = first - rf.right;
				if (inLocation.h < first)
					dx += count;
				BotRight().OffsetRefBy(dx, 0);
				TopLeft().Offset(inLocation, true, first, count);
				wasSpecial = true;
			}
		}
		else
		{
			if (rf.left < first && rf.right >= first)
			{
				if (inLocation.h < first)
					BotRight().OffsetRefBy(count, 0);
				else
					TopLeft().OffsetRefBy(-count, 0);
				wasSpecial = true;
			}
		}
	else
		if (count < 0)
		{
			if (rf.top > first + count && rf.bottom <= first)
			{
				TopLeft() = cell::InvalidCell;
				BotRight() = cell::InvalidCell;
				wasSpecial = true;
			}
			else if (rf.top > first + count && rf.top <= first)
			{
				int dy = first - rf.top + 1;
				if (inLocation.v < first)
					dy += count;
				TopLeft().OffsetRefBy(0, dy);
				BotRight().Offset(inLocation, true, first, count);
				wasSpecial = true;
			}
			else if (rf.bottom > first + count && rf.bottom <= first)
			{
				int dy = first - rf.bottom;
				if (inLocation.v < first)
					dy += count;
				BotRight().OffsetRefBy(0, dy);
				TopLeft().Offset(inLocation, true, first, count);
				wasSpecial = true;
			}
		}
		else
		{
			if (rf.top < first && rf.bottom >= first)
			{
				if (inLocation.v < first)
					BotRight().OffsetRefBy(0, count);
				else
					TopLeft().OffsetRefBy(0, -count);
				wasSpecial = true;
			}
		}

	if (!wasSpecial)
	{
		TopLeft().Offset(inLocation, horizontal, first, count);
		BotRight().Offset(inLocation, horizontal, first, count);
	}
} /* range::Offset */