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

List:       kde-commits
Subject:    koffice/lib/kotext
From:       David Faure <faure () kde ! org>
Date:       2004-09-13 22:12:21
Message-ID: 20040913221221.E1295175C () office ! kde ! org
[Download RAW message or body]

CVS commit by faure: 

Fixed copy/paste bugs due to unclear API (-1 can't mean both "no char" and "all \
chars" :)


  M +3 -2      kotextdocument.cc   1.71
  M +3 -7      kotextparag.cc   1.222
  M +1 -1      kotextparag.h   1.52


--- koffice/lib/kotext/kotextdocument.cc  #1.70:1.71
@@ -743,5 +743,5 @@ QString KoTextDocument::copySelection( K
         }
         text += c2.parag()->toString( 0, c2.index() );
-        c2.parag()->saveOasis( writer, context, 0, QMAX( 0, c2.index() - 1 ), true \
); +        c2.parag()->saveOasis( writer, context, 0, c2.index() - 1, true );
     }
     return text;
@@ -1643,5 +1643,6 @@ void KoTextDocument::saveOasisContent( K
     KoTextParag* parag = firstParag();
     while ( parag ) {
-        parag->saveOasis( writer, context );
+        // Save the whole parag, without the trailing space.
+        parag->saveOasis( writer, context, 0, parag->length() - 2 );
         parag = parag->next();
     }

--- koffice/lib/kotext/kotextparag.cc  #1.221:1.222
@@ -1812,5 +1812,5 @@ void KoTextParag::loadOasis( const QDomE
 
 void KoTextParag::saveOasis( KoXmlWriter& writer, KoSavingContext& context,
-                             int from /* default 0 */, int to /* default -1 i.e. \
length()-2 */, +                             int from /* default 0 */, int to /* \
                usually length()-2 */,
                              bool saveAnchorsFramesets /* default false */ ) const
 {
@@ -1857,9 +1857,4 @@ void KoTextParag::saveOasis( KoXmlWriter
     }
 
-    if ( to == -1 ) {
-        // Save the whole parag. If length() == 1 (only trailing space),
-        // then to will be set to -1, and we'll save no characters, as intended.
-        to = length() - 2;
-    }
     QString text = string()->toString();
     Q_ASSERT( text.right(1)[0] == ' ' );
@@ -1887,4 +1882,5 @@ void KoTextParag::saveOasis( KoXmlWriter
     // <text:span>foo</text:span> <text:span>bar</text:span> and lose the space \
between  // the two spans.
+    // ###### The above isn't true anymore, with the report-whitespace-only \
setting...  for ( int i = from; i <= to; ++i ) {
         KoTextStringChar & ch = string()->at(i);
@@ -1905,5 +1901,5 @@ void KoTextParag::saveOasis( KoXmlWriter
     //kdDebug() << k_funcinfo << "startPos=" << startPos << " to=" << to << " \
curFormat=" << curFormat << endl;  
-    if ( to > startPos ) { // Save last format
+    if ( to >= startPos ) { // Save last format
         WRITESPAN( to + 1 )
     }

--- koffice/lib/kotext/kotextparag.h  #1.51:1.52
@@ -152,5 +152,5 @@ public:
     /// The 'from' and 'to' characters are both included.
     void saveOasis( KoXmlWriter& writer, KoSavingContext& context,
-                    int from = 0, int to = -1, bool saveAnchorsFramesets = false ) \
const; +                    int from, int to, bool saveAnchorsFramesets = false ) \
const;  
     void loadOasisSpan( const QDomElement& parent, KoOasisContext& context, uint& \
pos );


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

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