+1 for having such functionality. But I am not sure if I like to have two functions for the same thing - Size and Point are basically the same.
So it's just for convenience. Conclusion might be to have a function using long, instead of point/size, but having two calls for one size/point conversion is also not nice. I don't know - TBD. Malte. Lars Langhans wrote, On 07.04.08 11:51: > Hi all, > > currently, it is not possible to get a length of a well known string in > a well > known font descriptor in a usable unit like 1/100mm. > > We try to use such information for automatically adjustments of text box > width/heights in the new report wizard. > > At the moment it is only possible to get the size of such string/font > composition as pixels which depends on the background output device. > To get such values, use the interface: > > Size com.sun.star.awt.XLayoutConstrains.getPreferredSize(); > > Due to the fact it is not possible to get access to the background > output device > I plan to add a new interface, like > > com::sun::star::awt::Size convertSizeToLogic(com::sun::star::awt::Size > const& aSize, sal_Int16 TargetUnit); > > which knows the background output device because it will be implemented > in the > XWindowPeer. > So it is possible to calculate the 'getPreferredSize()' pixels to usable > 1/100mm values. > > With this new function it is very easy to get the length of a string > with a well > known font descriptor as 1/100mm or any other target unit. > > The type TargetUnit is something out of > com::sun::star::util::MeasureUnit. If the TargetUnit is not usable or > convertable the function returns an IllegalArgumentException. > > > For completeness there will also implement the reverse interface, to convert > size to pixel of a well known target unit, like 1/100mm to pixel. > > com::sun::star::awt::Size convertSizeToPixel(com::sun::star::awt::Size > const& aSize, sal_Int16 SourceUnit); > > The type SourceUnit is something out of com::sun::star::util::MeasureUnit. > > > There will also the two interfaces for awt::Point types. > > com::sun::star::awt::Point convertPointToLogic( [in] > com::sun::star::awt::Point aPoint, [in] short TargetUnit ) > raises ( com::sun::star::lang::IllegalArgumentException ); > > com::sun::star::awt::Point convertPointToPixel( [in] > com::sun::star::awt::Point aPoint, [in] short SourceUnit ) > raises ( com::sun::star::lang::IllegalArgumentException ); > > Any comments/suggestions? > > -Lars > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
