diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-18 15:39:21 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-18 15:39:21 +0000 |
commit | a23ed3ec29baf8fe0900d7c7b5c456339407b4c5 (patch) | |
tree | 49034407958763f163ef7549d4fa6b7eb4dc55a8 /canvas/source | |
parent | a82083128b2a4c6538ef5bff38dcc21e620b7a2c (diff) |
CWS-TOOLING: integrate CWS impressaccessibility3
2009-09-18 16:10:59 +0200 af r276289 : #i102525# Fixed some minor compilation problems.
2009-09-17 14:11:23 +0200 af r276243 : #i102525# Fixed F1 shortcut for help view.
2009-09-16 16:20:58 +0200 af r276205 : #i102525# Removing const to make Solaris linker happy.
2009-09-16 16:13:25 +0200 af r276204 : #i90690# Initializing variable to avoid compilation problem.
2009-09-15 19:10:04 +0200 af r276186 : #i90825# Replace edit source proxy when an outliner object is set.
2009-09-15 11:12:07 +0200 af r276160 : #i90690# Broadcast accessibility events when the current slide is changed.
2009-09-15 09:37:48 +0200 af r276148 : #i102525# Fixed Solaris compilation problem.
2009-09-14 18:12:40 +0200 af r276142 : #i102525# Added missing implementation for some font related functions.
2009-09-14 18:02:05 +0200 af r276139 : #i102525# Added accessibility support.
2009-09-14 17:30:13 +0200 af r276136 : #i102525# Added support for interface XPane2 to panes.
2009-09-14 17:00:27 +0200 af r276133 : #i102525# Added XPane2 interface.
2009-09-14 16:13:04 +0200 af r276131 : #i50376# Make the focus indicator visible when the slide sorter has the focus.
Diffstat (limited to 'canvas/source')
-rw-r--r-- | canvas/source/vcl/canvasfont.cxx | 15 | ||||
-rw-r--r-- | canvas/source/vcl/textlayout.cxx | 100 |
2 files changed, 108 insertions, 7 deletions
diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx index b049e1e4f317..d5b276901594 100644 --- a/canvas/source/vcl/canvasfont.cxx +++ b/canvas/source/vcl/canvasfont.cxx @@ -127,8 +127,19 @@ namespace vclcanvas { tools::LocalGuard aGuard; - // TODO(F1) - return rendering::FontMetrics(); + OutputDevice& rOutDev = mpOutDevProvider->getOutDev(); + VirtualDevice aVDev( rOutDev ); + aVDev.SetFont(getVCLFont()); + const ::FontMetric& aMetric( aVDev.GetFontMetric() ); + + return rendering::FontMetrics( + aMetric.GetAscent(), + aMetric.GetDescent(), + aMetric.GetIntLeading(), + aMetric.GetExtLeading(), + 0, + aMetric.GetDescent() / 2.0, + aMetric.GetAscent() / 2.0); } uno::Sequence< double > SAL_CALL CanvasFont::getAvailableSizes( ) throw (uno::RuntimeException) diff --git a/canvas/source/vcl/textlayout.cxx b/canvas/source/vcl/textlayout.cxx index f9fa6f6dc4d2..5787f32cf4bf 100644 --- a/canvas/source/vcl/textlayout.cxx +++ b/canvas/source/vcl/textlayout.cxx @@ -35,6 +35,7 @@ #include <tools/diagnose_ex.h> #include <canvas/canvastools.hxx> +#include <com/sun/star/rendering/CompositeOperation.hpp> #include <com/sun/star/rendering/TextDirection.hpp> #include <vcl/metric.hxx> @@ -42,6 +43,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/tools/canvastools.hxx> #include "impltools.hxx" #include "textlayout.hxx" @@ -116,16 +118,104 @@ namespace vclcanvas { tools::LocalGuard aGuard; - // TODO(F1) - return uno::Sequence< uno::Reference< rendering::XPolyPolygon2D > >(); + OutputDevice& rOutDev = mpOutDevProvider->getOutDev(); + VirtualDevice aVDev( rOutDev ); + aVDev.SetFont( mpFont->getVCLFont() ); + + setupLayoutMode( aVDev, mnTextDirection ); + + const rendering::ViewState aViewState( + geometry::AffineMatrix2D(1,0,0, 0,1,0), + NULL); + + rendering::RenderState aRenderState ( + geometry::AffineMatrix2D(1,0,0,0,1,0), + NULL, + uno::Sequence<double>(4), + rendering::CompositeOperation::SOURCE); + + ::boost::scoped_array< sal_Int32 > aOffsets(new sal_Int32[maLogicalAdvancements.getLength()]); + setupTextOffsets(aOffsets.get(), maLogicalAdvancements, aViewState, aRenderState); + + uno::Sequence< uno::Reference< rendering::XPolyPolygon2D> > aOutlineSequence; + ::basegfx::B2DPolyPolygonVector aOutlines; + if (aVDev.GetTextOutlines( + aOutlines, + maText.Text, + ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition), + ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition), + ::canvas::tools::numeric_cast<USHORT>(maText.Length), + FALSE, + 0, + aOffsets.get())) + { + aOutlineSequence.realloc(aOutlines.size()); + sal_Int32 nIndex (0); + for (::basegfx::B2DPolyPolygonVector::const_iterator + iOutline(aOutlines.begin()), + iEnd(aOutlines.end()); + iOutline!=iEnd; + ++iOutline) + { + aOutlineSequence[nIndex++] = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( + mxDevice, + *iOutline); + } + } + + return aOutlineSequence; } uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryInkMeasures( ) throw (uno::RuntimeException) { tools::LocalGuard aGuard; - // TODO(F1) - return uno::Sequence< geometry::RealRectangle2D >(); + + OutputDevice& rOutDev = mpOutDevProvider->getOutDev(); + VirtualDevice aVDev( rOutDev ); + aVDev.SetFont( mpFont->getVCLFont() ); + + setupLayoutMode( aVDev, mnTextDirection ); + + const rendering::ViewState aViewState( + geometry::AffineMatrix2D(1,0,0, 0,1,0), + NULL); + + rendering::RenderState aRenderState ( + geometry::AffineMatrix2D(1,0,0,0,1,0), + NULL, + uno::Sequence<double>(4), + rendering::CompositeOperation::SOURCE); + + ::boost::scoped_array< sal_Int32 > aOffsets(new sal_Int32[maLogicalAdvancements.getLength()]); + setupTextOffsets(aOffsets.get(), maLogicalAdvancements, aViewState, aRenderState); + + MetricVector aMetricVector; + uno::Sequence<geometry::RealRectangle2D> aBoundingBoxes; + if (aVDev.GetGlyphBoundRects( + Point(0,0), + maText.Text, + ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition), + ::canvas::tools::numeric_cast<USHORT>(maText.Length), + ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition), + aMetricVector)) + { + aBoundingBoxes.realloc(aMetricVector.size()); + sal_Int32 nIndex (0); + for (MetricVector::const_iterator + iMetric(aMetricVector.begin()), + iEnd(aMetricVector.end()); + iMetric!=iEnd; + ++iMetric) + { + aBoundingBoxes[nIndex++] = geometry::RealRectangle2D( + iMetric->getX(), + iMetric->getY(), + iMetric->getX() + iMetric->getWidth(), + iMetric->getY() + iMetric->getHeight()); + } + } + return aBoundingBoxes; } uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryMeasures( ) throw (uno::RuntimeException) @@ -171,7 +261,7 @@ namespace vclcanvas setupLayoutMode( aVDev, mnTextDirection ); - const sal_Int32 nAboveBaseline( -aMetric.GetIntLeading() - aMetric.GetAscent() ); + const sal_Int32 nAboveBaseline( /*-aMetric.GetIntLeading()*/ - aMetric.GetAscent() ); const sal_Int32 nBelowBaseline( aMetric.GetDescent() ); if( maLogicalAdvancements.getLength() ) |