[Libreoffice-commits] core.git: sdext/source

Vort vvort at yandex.ru
Sun Mar 23 04:43:05 PDT 2014


 sdext/source/pdfimport/tree/pdfiprocessor.cxx |   63 +++-----------------------
 sdext/source/pdfimport/tree/pdfiprocessor.hxx |    3 -
 2 files changed, 9 insertions(+), 57 deletions(-)

New commits:
commit 53cbca6ee1b8e72144310147c88585a4f4b854c8
Author: Vort <vvort at yandex.ru>
Date:   Sun Mar 23 12:56:37 2014 +0200

    fdo#44710 PDF Import: Correction of position of rotated text
    
    Change-Id: Ie53b25a6cec88c07a317c50bd0965282fac64ff0
    Reviewed-on: https://gerrit.libreoffice.org/8725
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
index 72cb753..d5faf25 100644
--- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
@@ -317,7 +317,7 @@ GraphicsContext& PDFIProcessor::getTransformGlyphContext( CharGlyph& rGlyph )
     rGlyph.getGC().Transformation = rGlyph.getGC().Transformation * aFontTransform;
     getGCId(rGlyph.getGC());
 
-  return rGlyph.getGC();
+    return rGlyph.getGC();
 }
 
 void PDFIProcessor::drawCharGlyphs( OUString&             rGlyphs,
@@ -327,17 +327,9 @@ void PDFIProcessor::drawCharGlyphs( OUString&             rGlyphs,
                                     FrameElement* pFrame,
                                     bool bSpaceFlag )
 {
-
-
     OUString tempStr( 32 );
-    geometry::RealRectangle2D aRect(rRect);
-
-    ::basegfx::B2DRange aRect2;
-    calcTransformedRectBounds( aRect2,
-                                              ::basegfx::unotools::b2DRectangleFromRealRectangle2D(aRect),
-                                              aGC.Transformation );
-   // check whether there was a previous draw frame
 
+    // check whether there was a previous draw frame
     TextElement* pText = m_pElFactory->createTextElement( pPara,
                                                           getGCId(aGC),
                                                           aGC.FontId );
@@ -346,16 +338,18 @@ void PDFIProcessor::drawCharGlyphs( OUString&             rGlyphs,
 
     pText->Text.append( rGlyphs );
 
-    pText->x = aRect2.getMinX() ;
-    pText->y = aRect2.getMinY() ;
-    pText->w = 0.0;  // ToDO P2: 1.1 is a hack for solving of size auto-grow problem
-    pText->h = aRect2.getHeight(); // ToDO P2: 1.1 is a hack for solving of size auto-grow problem
+    ::basegfx::B2DPoint point(rRect.X1, rRect.Y1);
+    point *= aGC.Transformation;
+
+    pText->x = point.getX();
+    pText->y = point.getY();
+    pText->w = 0.0001; // hack for solving of size auto-grow problem
+    pText->h = 0.0001;
 
     pPara->updateGeometryWith( pText );
 
     if( pFrame )
       pFrame->updateGeometryWith( pPara );
-
 }
 
 void PDFIProcessor::drawGlyphs( const OUString&             rGlyphs,
@@ -804,45 +798,6 @@ void PDFIProcessor::sortElements( Element* pEle, bool bDeep )
         pEle->Children.push_back( aChildren[i] );
 }
 
-
-::basegfx::B2DRange& PDFIProcessor::calcTransformedRectBounds( ::basegfx::B2DRange&         outRect,
-                                                        const ::basegfx::B2DRange&      inRect,
-                                                        const ::basegfx::B2DHomMatrix&  transformation )
-        {
-            outRect.reset();
-
-            if( inRect.isEmpty() )
-                return outRect;
-
-            // transform all four extremal points of the rectangle,
-            // take bounding rect of those.
-
-            // transform left-top point
-            outRect.expand( transformation * inRect.getMinimum() );
-
-            // transform bottom-right point
-            outRect.expand( transformation * inRect.getMaximum() );
-
-            ::basegfx::B2DPoint aPoint;
-
-            // transform top-right point
-            aPoint.setX( inRect.getMaxX() );
-            aPoint.setY( inRect.getMinY() );
-
-            aPoint *= transformation;
-            outRect.expand( aPoint );
-
-            // transform bottom-left point
-            aPoint.setX( inRect.getMinX() );
-            aPoint.setY( inRect.getMaxY() );
-
-            aPoint *= transformation;
-            outRect.expand( aPoint );
-
-            // over and out.
-            return outRect;
-        }
-
 // helper method: get a mirrored string
 OUString PDFIProcessor::mirrorString( const OUString& i_rString ) const
 {
diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.hxx b/sdext/source/pdfimport/tree/pdfiprocessor.hxx
index 23861fa..98236d4 100644
--- a/sdext/source/pdfimport/tree/pdfiprocessor.hxx
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.hxx
@@ -196,9 +196,6 @@ namespace pdfi
 
         typedef std::vector<GraphicsContext> GraphicsContextStack;
 
-        ::basegfx::B2DRange& calcTransformedRectBounds( ::basegfx::B2DRange&            outRect,
-                                                        const ::basegfx::B2DRange&      inRect,
-                                                        const ::basegfx::B2DHomMatrix&  transformation );
         std::vector<CharGlyph>             m_GlyphsList;
 
         boost::shared_ptr<ElementFactory>  m_pElFactory;


More information about the Libreoffice-commits mailing list