Hello Malte,

Thank you for your anwser first!

2009/12/4 Malte Timmermann <malte.timmerm...@sun.com>

> Hi LiuTao...
>
> JiaXiang Liu wrote, On 12/04/09 03:19:
> > Hello Malte,
> >
> > 2009/12/3 Malte Timmermann <malte.timmerm...@sun.com>
> >
> >> Hi LiuTao,
> >>
> >> you don't need to touch VCL for this, because VCL can't help you with
> >> this feature.
> >>
> >> VCL only sees single text portions, so it can't calculate the correct
> >> positions when it comes to complete text lines.
> >>
> >> This needs to be done in the EditEngine.
> >>
> >> For TOP and BOTTOM it should be easy.
> >>
> >> No changes needed in calculation, only in output.
> >>
> >> In ImpEditEngine::Paint:
> >>
> >> TOP: Instead of adding nMaxAscent to Y postions, don't manipulate Y and
> >> tell VCL to use ALIGN_TOP.
> >>
> >> BOTTOM: Instead of adding nMaxAscent to Y postions, add line height and
> >> tell VCL to use ALIGN_BOTTOM.
> >>
> >> Please recognize the different manipulations needed for
> >> horizontal/vertical writing.
> >>
> >> CENTER: Can be more complicated, but also might be simple.
> >> One solution could be to calculate the font metrics for the portion that
> >> you want to draw, handle Y postions like for TOP, but now add
> >> (lineheight - textheight) to Y position.
> >>
> > I have already add codes in In ImpEditEngine::Paint like this:
> >
> >     enum TextAlign eTmpAline = ALIGN_BASELINE;
> >             SvxFontAlign eFontAlign =
> > ((SvxFontAlignItem&)pNode->GetContentAttribs().GetItem( EE_PARA_FONTALIGN
> > )).GetFontAlign();
> >             if (eFontAlign == SVX_FONT_ALIGN_TOP)
> >             {
> >                 eTmpAline = ALIGN_TOP;
> >             }
> >             else if (eFontAlign == SVX_FONT_ALIGN_BOTTOM)
> >             {
> >                 eTmpAline = ALIGN_BOTTOM;
> >             }
> >             else if (eFontAlign == SVX_FONT_ALIGN_CENTER)
> >             {
> >                 eTmpAline = ALIGN_CENTER;
>
> As I said: There is no ALIGN_CENTER in VCL, and your also shouldn't
> introduce it, because it makes no sense in that layer.
>
> >             }
> >             else
> >             {
> >                 eTmpAline = ALIGN_BASELINE;
> >             }
> >         rFont.SetAlign( eTmpAline );
> >
> > I think this is what you mean.
> >
> > In vcl\source\gdi\outdev3.cxx
> >
> >     TextAlign eAlign = maFont.GetAlign();
> >     if ( eAlign == ALIGN_BASELINE )
> >     {
> >         mnTextOffX = 0;
> >         mnTextOffY = 0;
> >     }
> >     else if ( eAlign == ALIGN_TOP )
> >     {
> >         mnTextOffX = 0;
> >         mnTextOffY = +pFontEntry->maMetric.mnAscent + mnEmphasisAscent;
> >         if ( pFontEntry->mnOrientation )
> >             ImplRotatePos( 0, 0, mnTextOffX, mnTextOffY,
> > pFontEntry->mnOrientation );
> >     }
> > ...
> > ...
> > ...
>
> Unfortunately you didn't show how you would implement CENTER here in a
> meaningful way. Also, as I said, VCL only gets portions of the text, so
> TOP and BOTTOM in VCL can't align your complete text line.
>
> Oh,I just add a caculate CENTER  like this:

+    else if (eAlign == ALIGN_CENTER)
+    {
+        mnTextOffX = 0;
+        mnTextOffY = (pFontEntry->maMetric.mnAscent -
pFontEntry->maMetric.mnDescent)/2 + (mnEmphasisAscent +
mnEmphasisDescent)/2;
+        if ( pFontEntry->mnOrientation )
+            ImplRotatePos( 0, 0, mnTextOffX, mnTextOffY,
pFontEntry->mnOrientation );
+    }

>
> > this is the calculation about ALIGN_BASELINE
> > ,ALIGN_TOP,ALIGN_BOTTOM,ALIGN_CENTER(I added this calculation).
> >
> >
> >
> >
> >> This should work in Draw/Impress only.
> >> Maybe even only in edit mode - it might be that Draw use some special
> >> routines for repainting text objects which are not in edit mode (not
> >> sure). I also can't say if it would automatically works in presentation
> >> mode.
> >>
> >>
> > it is OK in edit mode but it seems can not repaint not in edit mode.you
> can
> > see  the pictures I sent to you.
> > It is OK in Outline view but not in normal view. I think that is because
> > Outline view is also in edit mode.
> > What I want to know is how to repaint it not in edit mode in Impress?
>
> This is somewhere in the drawing layer - not sure where...
>
> This is my puzzle.I want to know how to set the text displayed OK in no
edit mode.
the different view in edit and no edit is my bigest problem.  :-(

> But I really don't understand why you completely ignored my hints how to
> implement the feature.
> - You have to do the calculations in the EditEngine - it will never look
> right with different font sizes if you rely on VCL's align mode only.
> - Fonts have the metrics like ascent and descent for good reasons. I am
> not sure if the VCL team will accept to have ALIGN_CENTER in VCL,
> because it doesn't make much sense.
>
> Yes,I did not ignore your hints how to implement the feature.
I do the calculations in the EditEngine like this:
+                                            TextAlign eAlign =
aTmpFont.GetAlign();
+                                            if ( eAlign == ALIGN_CENTER )
+                                            {
+                                                aRealOutPos.Y() +=
-pLine->GetHeight() * 2/5;// + pLine->GetMaxAscent();
+                                            }
+                                            else if ( eAlign == ALIGN_TOP )
+                                            {
+                                                aRealOutPos.Y() +=
-pLine->GetHeight() * 4/5;// + pLine->GetMaxAscent();
+                                            }
+                                            else if( eAlign ==
ALIGN_BOTTOM)
+                                            {
+                                                aRealOutPos.Y() +=
pLine->GetHeight() * 1/5;// + pLine->GetMaxAscent();
+                                            }

It can dispaly correctly in edit mode but not in unedit mode.

Last but not least: Make sure that ODF covers your new attribute, or
> bring a proposal for this to the OASIS TC. Otherwise you can't have
> persistence for your new feature w/o having invalid ODF documents.
>
> OK,Thank you.how to bring a proposal to the OASIS TC? Are there somebody in
OpenOffice team do this feature?


> Malte.
>
>
With Best Regards,
LiuTao

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@gsl.openoffice.org
> For additional commands, e-mail: dev-h...@gsl.openoffice.org
>
>

Reply via email to