thanks for the tip about Any. But that didn't work
either, I get the same result. Alrighty I guess I have
to raise an issue.
--- J�rgen Schmidt <[EMAIL PROTECTED]> wrote:
> Kent Gibson wrote:
> > I had a quick at open issues and nothing really
> fit. I
> > will look again.
>
> maybe the bug doesn't exist. But i remember that
> their is a problem when
> you set the property FRAME_IS_AUTOMATIC_HEIGHT to
> true, the height is
> not correct set and you can't get the current value.
> If you don' find an appropriate issue submit a new
> one.
>
> >
> > Regarding your idea, when i do this :
> >
> > Object writerShape =
> documentFactory.createInstance(
> > "com.sun.star.text.TextFrame" );
> >
> > XTextFrame theFrame = ( XTextFrame )
> > UnoRuntime.queryInterface( XTextFrame.class,
> > writerShape );
> >
> > XPropertySet theFramePropSet = ( XPropertySet )
> > UnoRuntime.queryInterface( XPropertySet.class,
> > theFrame );
> > Integer heightInteger = ( Integer )
> > theFramePropSet.getPropertyValue(
> > "FrameHeightAbsolute" );
>
> getPropertyValue() returns an any, you have to use
> the AnyConverter here.
>
>
AnyConverter.toLong(theFramePropSet.getPropertyValue("FrameHeightAbsolute"));
>
> > System.out.println( "heightInteger x1" +
> heightInteger
> > );
> >
> > I get illegal argument exception.
> >
> > If I do the same thing but after this statement:
> >
> > mxDocText.insertTextContent( xParaCursor,
> > xTextContentShape, false );
>
> of course, some objects need the context of a text
> document. Otherwise
> not all values are initialized (implementation
> detail, not really nice
> but it is as it is at the moment)
>
> Juergen
>
> >
> > then I get my mysterious 41.
> >
> > --- J�rgen Schmidt <[EMAIL PROTECTED]>
> wrote:
> >
> >> Hi Kent,
> >>
> >> i think that is a known bug, but i can't remember
> >> 100% and can't find
> >> the appropriate bug id.
> >> Maybe you can check if the API returns always the
> >> initial values when
> >> you have created the frame.
> >>
> >> Juergen
> >>
> >>
> >> Kent Gibson wrote:
> >>> Thanks. I tried that. And I always get "41"?!
> >>>
> >>> Unless of course I need to refresh the frame
> >> somehow.
> >>> Here is what I am doing:
> >>>
> >>> Object writerShape =
> >> documentFactory.createInstance(
> >>> "com.sun.star.text.TextFrame" );
> >>> XTextContent xTextContentShape = ( XTextContent
> )
> >>> UnoRuntime.queryInterface( XTextContent.class,
> >>> writerShape );
> >>>
> >>> XPropertySet xTextContentPropertySet = (
> >> XPropertySet
> >>> ) UnoRuntime.queryInterface( XPropertySet.class,
> >>>
>
> >>
> >>>
> >> xTextContentShape );
> >>> xTextContentPropertySet.setPropertyValue(
> "Width",
> >> new
> >>> Integer( width ) );
> >>> xTextContentPropertySet.setPropertyValue(
> >> ANCHOR_TYPE,
> >>> TextContentAnchorType.AT_FRAME );
> >>> xTextContentPropertySet.setPropertyValue(
> >> TEXT_WRAP,
> >>> WrapTextMode.NONE );
> >>> xTextContentPropertySet.setPropertyValue(
> >>> FRAME_IS_AUTOMATIC_HEIGHT, new Boolean( true )
> );
> >>>
> >>> XPropertySet xShapeProps = ( XPropertySet )
> >>> UnoRuntime.queryInterface( XPropertySet.class,
> >>> writerShape );
> >>>
> >>> // Setting the vertical position
> >>> xShapeProps.setPropertyValue( VERT_ORIENT, new
> >> Short(
> >>> VertOrientation.NONE ) );
> >>> xShapeProps.setPropertyValue( HORI_ORIENT, new
> >> Short(
> >>> HoriOrientation.NONE ) );
> >>>
> >>> // I need to recalculate x & y for the header
> >>> // Setting the vertical position
> >>> xShapeProps.setPropertyValue(
> >> HORI_ORIENT_POSITION,
> >>> new Integer( ( x.intValue() ) ) );
> >>> xShapeProps.setPropertyValue(
> >> VERT_ORIENT_POSITION,
> >>> new Integer( ( y.intValue() ) ) );
> >>> // making sure that text can overlap
> >>> xShapeProps.setPropertyValue( BACK_TRANSPARENT,
> >>> Boolean.TRUE );
> >>> xShapeProps.setPropertyValue( OPAQUE,
> >> Boolean.FALSE );
> >>> XText xShapeText = ( XText )
> >>> UnoRuntime.queryInterface( XText.class,
> >> writerShape );
> >>> mxDocText.insertTextContent( xParaCursor,
> >>> xTextContentShape, false );
> >>>
> >>> xShapeText.setString( textContentString +
> >>> getDebugString( x, y, width, height ) +
> >> getRNDString()
> >>> );
> >>>
> >>> // xTextContentPropertySet also gives me the
> same
> >>> result
> >>> Integer heightInteger =
> >>> (Integer)xShapeProps.getPropertyValue(
> >>> FRAME_HEIGHT_ABSOLUTE );
> >>>
> >>> System.out.println("heightInteger " +
> >> heightInteger);
> >>> --- Stephan Wunderlich
> >> <[EMAIL PROTECTED]>
> >>> wrote:
> >>>
> >>>> Hi Kent,
> >>>>
> >>>>> If you have a textframe and you it is
> autosized
> >> is
> >>>>> there no way of finding out how big it is
> after
> >>>> you
> >>>>> put the text content in it?
> >>>>>
> >>>>> I have tried everything. I have three text
> >> frames
> >>>> of
> >>>>> various sizes (due to various content) and
> they
> >>>> always
> >>>>> return the same size.
> >>>>>
> >>>>> I even tried going through the drawpage, but
> >> oddly
> >>>>> that didn't work.
> >>>>>
> >>>>> XDrawPage xDrawPage =
> >>>> xDrawPageSupplier.getDrawPage();
> >>>>> XShapes xShapes = ( XShapes )
> >>>>> UnoRuntime.queryInterface( XShapes.class,
> >>>> xDrawPage );
> >>>>> int shapeCount = xShapes.getCount();
> >>>>> for ( int i = 0; i < shapeCount; i++ )
> >>>>> {
> >>>>> Object shapeObj = xShapes.getByIndex( i );
> >>>>> XShape shape = ( XShape )
> >>>> UnoRuntime.queryInterface(
> >>>>> XShape.class, shapeObj );
> >>>>>
> >>>>> Size size = shape.getSize();
> >>>>>
> >>>>> }
> >>>> a TextFrame has the properties
> >> "FrameHeightAbsolute"
> >>>> and
> >>>> "FrameWidthAbsolute" which, as far as I know,
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]