Exemplo n.º 1
0
void CWordAppUi::RunSelectBulletDialogL()
	{
	if (!iBullet)
		CreateDefaultBulletL();
	CParaFormat* paraFormat=CParaFormat::NewLC();
	TParaFormatMask paraUndeterminedMask;
	TCharFormat charFormat;
	TCharFormatMask charFormatMask;
	const TCursorSelection selection=iRichEd->TextView()->Selection();
	Text()->GetParaFormatL(paraFormat,paraUndeterminedMask,selection.LowerPos(),selection.Length());
	Text()->GetCharFormat(charFormat,charFormatMask,selection.LowerPos(),selection.Length());
	TRgb backColor=paraFormat->iFillColor;
	if (paraUndeterminedMask.AttribIsSet(EAttFillColor))
		backColor=KRgbWhite; // what else could be done ???
	if (paraFormat->iBullet)
		*iBullet=*paraFormat->iBullet;
	CEikDialog* dialog=new(ELeave) CWordBulletDialog(iBullet,backColor,NULL,charFormat.iFontSpec.iTypeface.iName);
	if (dialog->ExecuteLD(R_WORD_DIALOG_BULLET))
		{
		CEikButtonBase* but = (CEikButtonBase*)iEikonEnv->AppUiFactory()->ToolBand()->ControlById(EWordButtonBullets);
		but->SetState(CEikButtonBase::ESet);
		SetBulletL();
		but->DrawNow();
		}
	CleanupStack::PopAndDestroy();
	}
Exemplo n.º 2
0
void CWordStyleGallery::AppendDescriptionL(TTextFormatAttribute aAttribute,const CParaFormat& aFormat,const TParaFormatMask& aMask)
	{
	if (aMask.AttribIsSet(aAttribute) && 
	aFormat.ParaBorder((CParaFormat::TParaBorderSide)(aAttribute-EAttTopBorder)).iLineStyle!=TParaBorder::ENullLineStyle)
		{
		DoAppendDescriptionL((*iStyleDescriptor)[(TDescriptor)aAttribute]);
		}
	}
Exemplo n.º 3
0
void CWordAppUi::CmdChangeAlignmentL()
	{
	CParaFormat format;
	TParaFormatMask undeterminedMask;
	const TCursorSelection selection=iRichEd->Selection();
	Text()->GetParaFormatL(&format,undeterminedMask,selection.LowerPos(),selection.Length());
	//
	TInt index=format.iHorizontalAlignment+1;  // toggle the alignment
	//
	if (undeterminedMask.AttribIsSet(EAttAlignment))
		index=4;  // ...to force default case
	//
	if (index>=4)
		index=0;  // where alignment > justifed, make it left aligned.
	SetParaAlignmentL(index);
	}
Exemplo n.º 4
0
void CWordStyleGallery::AppendDescriptionL(TTextFormatAttribute aAttribute,const TParaFormatMask& aMask)
	{
	if (aMask.AttribIsSet(aAttribute))
		DoAppendDescriptionL((*iStyleDescriptor)[(TDescriptor)aAttribute]);
	}
Exemplo n.º 5
0
void CWordStyleGallery::FillBufferL(const CParaFormatLayer& aParaFormatLayer)
	{
	CEikGlobalTextEditor* edwin=(CEikGlobalTextEditor*)Control(EWordCidStyleInfo);
	TCharFormat charFormat;
	TCharFormatMask charMask;
	CParaFormat* paraFormat=CParaFormat::NewLC();
	TParaFormatMask paraMask;
	//
	//
	iCurrentDescription=HBufC::NewL(KDescriptionGranularity);
	TPtr buf=iCurrentDescription->Des();
	TBool isNormalStyle=(aParaFormatLayer.Type()==KNormalParagraphStyleUid);
	if (!isNormalStyle)
		{
		const CParagraphStyle* flayer=REINTERPRET_CAST(const CParagraphStyle*,aParaFormatLayer.SenseBase());
		TUid type=flayer->Type();
		if (type==KNormalParagraphStyleUid)
			buf.Append(iNormalName);
		else
			buf.Append(flayer->iName);
		buf.Append('+');
		}
	//
	if (isNormalStyle)
		iData.iText.GlobalCharFormatLayer()->Sense(charFormat,charMask);
	else
		REINTERPRET_CAST(const CParagraphStyle&,aParaFormatLayer).CharFormatLayer()->Sense(charFormat,charMask);
	aParaFormatLayer.SenseL(paraFormat,paraMask);
	//
	if (!charMask.IsNull())
		{
		if (charMask.AttribIsSet(EAttFontTypeface))
			DoAppendDescriptionL(charFormat.iFontSpec.iTypeface.iName);
		if (charMask.AttribIsSet(EAttFontHeight))
			{
			TInt height=charFormat.iFontSpec.iHeight;
			height=(height+10)/20;
			TBuf<20> num;
			num.Num(height);
			TBuf<10> unit;
			iCoeEnv->ReadResource(unit,R_WORD_FONT_UNITS);
			num.Append(unit);
			DoAppendDescriptionL(num);
			}
		if (charMask.AttribIsSet(EAttFontPosture))
			{
			if (charFormat.iFontSpec.iFontStyle.Posture()==EPostureItalic)
				DoAppendDescriptionL((*iStyleDescriptor)[EDesItalic]);
			}
		if (charMask.AttribIsSet(EAttFontStrokeWeight))
			{
			if (charFormat.iFontSpec.iFontStyle.StrokeWeight()==EStrokeWeightBold)
				DoAppendDescriptionL((*iStyleDescriptor)[EDesBold]);
			}
		if (charMask.AttribIsSet(EAttFontPrintPos))
			{
			TFontPrintPosition pos=charFormat.iFontSpec.iFontStyle.PrintPosition();
			switch(pos)
				{
			case EPrintPosSuperscript:
				DoAppendDescriptionL((*iStyleDescriptor)[EDesSuperscript]);
				break;
			case EPrintPosSubscript:
				DoAppendDescriptionL((*iStyleDescriptor)[EDesSubscript]);
				break;
			default:
				break;
				}
			}
		if (charMask.AttribIsSet(EAttFontUnderline))
			{
			if (charFormat.iFontPresentation.iUnderline==EUnderlineOn)
				DoAppendDescriptionL((*iStyleDescriptor)[EDesUnderline]);
			}
		if (charMask.AttribIsSet(EAttFontStrikethrough))
			{
			if (charFormat.iFontPresentation.iStrikethrough==EStrikethroughOn)
				DoAppendDescriptionL((*iStyleDescriptor)[EDesStrikethrough]);
			}
		}
	if (!paraMask.IsNull())
		{
		AppendDescriptionL(EAttLeftMargin,paraMask);
		AppendDescriptionL(EAttRightMargin,paraMask);
		AppendDescriptionL(EAttIndent,paraMask);
		if (paraMask.AttribIsSet(EAttAlignment))
			DoAppendDescriptionL((*iStyleDescriptor)[EDesLeftAlign+paraFormat->iHorizontalAlignment]);
		AppendDescriptionL(EAttLineSpacing,paraMask);
		AppendDescriptionL(EAttSpaceBefore,paraMask);
		AppendDescriptionL(EAttSpaceAfter,paraMask);
		AppendDescriptionL(EAttKeepTogether,paraMask);
		AppendDescriptionL(EAttKeepWithNext,paraMask);
		AppendDescriptionL(EAttStartNewPage,paraMask);
		AppendDescriptionL(EAttWidowOrphan,paraMask);
		AppendDescriptionL(EAttBorderMargin,paraMask);
		AppendDescriptionL(EAttTopBorder,*paraFormat,paraMask);
		AppendDescriptionL(EAttBottomBorder,*paraFormat,paraMask);
		AppendDescriptionL(EAttLeftBorder,*paraFormat,paraMask);
		AppendDescriptionL(EAttRightBorder,*paraFormat,paraMask);
		AppendDescriptionL(EAttBullet,paraMask);
		AppendDescriptionL(EAttTabStop,*paraFormat,paraMask);
		}
	CleanupStack::PopAndDestroy();  // paraFormat
	edwin->SetTextL(iCurrentDescription);
	delete iCurrentDescription;
	iCurrentDescription=NULL;
	DrawEdwinL();
	}