Bug 45503 - Child panels do not scale on zooming
Summary: Child panels do not scale on zooming
Status: RESOLVED WORKSFORME
Alias: None
Product: calligrasheets
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Philipp Müller
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-19 22:33 UTC by J E Drews
Modified: 2004-05-11 06:36 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description J E Drews 2002-07-19 22:19:43 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kword
Version:           1.2 Beta2 (KDE 3.0.6 (using KDE 3.0.6 )
Severity:          normal
Installed from:    compiled sources
Compiler:          gcc version 2.95.3 20010315 (SuSE)
OS:                Linux (i686) release 2.4.18-4GB
OS/Compiler notes: 

I have a Kformula and Kchart panel embedded inside a Kspread panel. The Kspread panel is in turn embedded inside a Kword doc. If I change the zoom from 100% to 350% then the kChart and Kfromula panels do not scale up. Instead they stay fixed in both size and location and as a result obscure existing cell entries.The Kspread panel does scale up.

(Submitted via bugs.kde.org)
(Called from KBugReport dialog)
Comment 1 David Faure 2002-09-28 11:38:29 UTC
Those are KChart and KFormula bugs (missing zooming feature). 
Will reassign to, hmm, kchart - please move bug to kformula when kchart is 
fixed ;-) 
Comment 2 Philipp Müller 2002-10-25 13:54:04 UTC
David,
why didn't you move it to KSpread?

The childs of KSpread are here not transformed/zoomed correctly when KSpread
itself is embedded.
That's what I see here (and I was assuming to get such bugs already).

However,
Moved to KSpread, me as owner.
Comment 3 J E Drews 2003-04-13 16:07:45 UTC
I tested this again in koffice 1.2.1, in kde 3.1.0. The child panels do not zoom. I am 
using FreeBSD 4.8 RC. Koffice is compiled from ports.  gcc version 2.95.4 20020320 
[FreeBSD] 
Comment 4 Ariya Hidayat 2003-11-18 21:38:24 UTC
Subject: koffice/kspread

CVS commit by ariya: 

when embedded, use real zoom instead of scaling

CCMAIL: 45503@bugs.kde.org


  M +2 -1      kspread_canvas.cc   1.394
  M +22 -11    kspread_doc.cc   1.249


--- koffice/kspread/kspread_canvas.cc  #1.393:1.394
@@ -3557,5 +3557,6 @@ void KSpreadCanvas::paintChildren( QPain
       // #### todo: paint only if child is visible inside rect
       painter.save();
-      m_pDoc->paintChild( itChild.current(), painter, m_pView );
+      m_pDoc->paintChild( itChild.current(), painter, m_pView,
+        m_pDoc->zoomedResolutionX(), m_pDoc->zoomedResolutionY() );
       painter.restore();
     }

--- koffice/kspread/kspread_doc.cc  #1.248:1.249
@@ -790,13 +790,9 @@ void KSpreadDoc::paintContent( QPainter&
   //  ElapsedTime et( "KSpreadDoc::paintContent1" );
     //kdDebug(36001) << "KSpreadDoc::paintContent m_zoom=" << m_zoom << " zoomX=" << zoomX << " zoomY=" << zoomY << " transparent=" << transparent << endl;
+
+    // save current zoom
     int oldZoom = m_zoom;
-    setZoomAndResolution( 100, QPaintDevice::x11AppDpiX(), QPaintDevice::x11AppDpiY() );
-    if ( m_zoomedResolutionX != zoomX || m_zoomedResolutionY != zoomY )
-    {
-        setResolution( zoomX, zoomY );
-        bool forPrint = painter.device() && painter.device()->devType() == QInternal::Printer;
-        newZoomAndResolution( false, forPrint );
-    }
 
+    // choose sheet: the first or the active
     KSpreadSheet* table = 0L;
     if ( !m_activeTable )
@@ -807,11 +803,26 @@ void KSpreadDoc::paintContent( QPainter&
         return;
 
-    kdDebug(36001)<<"paintContent-------------------------------------\n";
-    painter.save();
+    // only one zoom is supported
+    double d_zoom = 1.0;
+    setZoomAndResolution( 100, QPaintDevice::x11AppDpiX(), QPaintDevice::x11AppDpiY() );
+    if ( m_zoomedResolutionX != zoomX )
+        d_zoom *= ( zoomX / m_zoomedResolutionX );
 
-    // painter.scale(zoomX, zoomY);
-    paintContent( painter, rect, transparent, table, false );
+    // KSpread support zoom, therefore no need to scale with worldMatrix
+    QWMatrix matrix = painter.worldMatrix();
+    matrix.setMatrix( 1, 0, 0, 1, matrix.dx(), matrix.dy() );
+    QRect prect = rect;
+    prect.setWidth( prect.width() * painter.worldMatrix().m11() );
+    prect.setHeight( prect.height() * painter.worldMatrix().m22() );
+    setZoomAndResolution( d_zoom * 100, QPaintDevice::x11AppDpiX(), QPaintDevice::x11AppDpiY() );
 
+    // paint the content, now zoom is correctly set
+    kdDebug(36001)<<"paintContent-------------------------------------\n";
+    painter.save();
+    painter.setWorldMatrix( matrix );
+    paintContent( painter, prect, transparent, table, false );
     painter.restore();
+
+    // restore zoom
     m_zoom = oldZoom;
     setZoomAndResolution( oldZoom, QPaintDevice::x11AppDpiX(), QPaintDevice::x11AppDpiY() );


Comment 5 J E Drews 2004-05-11 06:36:29 UTC
Close this -- it is 2 years old and I have no idea if it's fixed. I don't use Kde anymore.