[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kword
From:       David Faure <faure () kde ! org>
Date:       2006-09-18 11:22:45
Message-ID: 1158578565.974840.7032.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 585950 by dfaure:

The code is disabled, but forwardport the fix for #130811 just in case it serves as inspiration later.


 M  +1 -1      KWCanvas.cpp  
 M  +6 -9      KWViewMode.cpp  
 M  +1 -1      KWViewMode.h  


--- trunk/koffice/kword/KWCanvas.cpp #585949:585950
@@ -158,7 +158,7 @@
         fs = m_doc->frameSetByName( fsName );
     if ( !fs )
         fs = m_doc->frameSet( 0 );
-    Q_ASSERT( fs );
+    //Q_ASSERT( fs ); // empty page template -> no fs
     if ( fs && fs->isVisible( m_viewMode ) ) {
         checkCurrentEdit( fs );
         KWTextFrameSetEdit* textedit = dynamic_cast<KWTextFrameSetEdit *>(m_currentFrameSetEdit);
--- trunk/koffice/kword/KWViewMode.cpp #585949:585950
@@ -170,10 +170,8 @@
     }
     else if(viewModeType=="ModeText")
     {
-        KWTextFrameSet* fs = KWViewModeText::determineTextFrameSet( doc );
-        if ( fs )
-            return new KWViewModeText( doc, canvas, fs );
-        return new KWViewModeNormal( doc, canvas, doc->viewFrameBorders() );
+        KWTextFrameSet* fs = KWViewModeText::determineTextFrameSet( doc ); // could be 0
+        return new KWViewModeText( doc, canvas, fs );
     }
     else
     {
@@ -458,12 +456,13 @@
 KWViewModeText::KWViewModeText( KWDocument * doc, KWCanvas* canvas, KWTextFrameSet* fs )
     : KWViewMode( doc, canvas, false )
 {
-    Q_ASSERT( fs );
     m_textFrameSet = fs;
 }
 
 KWTextFrameSet * KWViewModeText::textFrameSet() const
 {
+    if ( !m_textFrameSet ) // e.g. when we set this mode before we had any frames (doc not loaded yet)
+        m_textFrameSet = determineTextFrameSet( m_doc );
     return m_textFrameSet;
 }
 
@@ -512,9 +511,7 @@
 QSize KWViewModeText::contentsSize()
 {
 #if 0
-    textFrameSet(); // init.
-
-    if (!m_textFrameSet)
+    if (!textFrameSet())
         return QSize();
 
     // The actual contents only depend on the amount of text.
@@ -606,7 +603,7 @@
 }
 
 bool KWViewModeText::isTextModeFrameset(KWFrameSet *fs) const {
-    return fs==m_textFrameSet;
+    return fs == textFrameSet();
 }
 
 
--- trunk/koffice/kword/KWViewMode.h #585949:585950
@@ -292,7 +292,7 @@
 
 
 private:
-    KWTextFrameSet *m_textFrameSet;
+    mutable KWTextFrameSet *m_textFrameSet;
 };
 
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic