[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:       2005-07-17 22:39:25
Message-ID: 1121639965.725081.27144.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 435717 by dfaure:

OASIS: support for saving and loading columns (count and spacing)


 M  +4 -0      OASIS  
 M  +30 -6     kwdoc.cc  


--- trunk/koffice/kword/OASIS #435716:435717
@@ -30,6 +30,10 @@
 Also OASIS doesn't allow a different style for header and header-left,
 so they must have the same min-size, border, margins...
 
+* Columns
+OASIS OpenDocument has "number of columns" and "space between columns", so it's OK \
for kword. +OOo however also supports columns of different sizes and with different \
spaces, we can't load that. +
 Notes about interoperability with OpenOffice.org-2.0:
 -----------------------------------------------------
 
--- trunk/koffice/kword/kwdoc.cc #435716:435717
@@ -1163,11 +1163,23 @@
                 m_footNoteSeparatorLinePos = SLP_LEFT;
         }
 
-        // TODO columns  (style:columns, attribute fo:column-count)
-        __columns.columns = 1; // TODO
-        // TODO columnspacing (style:column-sep ?)
-        __columns.ptColumnSpacing = 2; // TODO
+        __columns.columns = 1;
+        __columns.ptColumnSpacing = m_defaultColumnSpacing;
 
+        const QDomElement columnsElem = KoDom::namedItemNS( properties, \
KoXmlNS::style, "columns" ); +        if ( !columnsElem.isNull() )
+        {
+            __columns.columns = columnsElem.attributeNS( KoXmlNS::fo, \
"column-count", QString::null ).toInt(); +            if ( __columns.columns == 0 )
+                __columns.columns = 1;
+            // TODO OASIS OpenDocument supports columns of different sizes, using \
<style:column style:rel-width="..."> +            // (with \
fo:start-indent/fo:end-indent for per-column spacing) +            // But well, it \
also allows us to specify a single gap. +            if ( columnsElem.hasAttributeNS( \
KoXmlNS::fo, "column-gap" ) ) +                __columns.ptColumnSpacing = \
KoUnit::parseValue( columnsElem.attributeNS( KoXmlNS::fo, "column-gap", QString::null \
) ); +            // It also supports drawing a vertical line as a separator...
+        }
+
         m_headerVisible = false;
         m_footerVisible = false;
 
@@ -3027,20 +3039,32 @@
         footnoteSepTmpWriter.endElement();
         const QString elementContents = QString::fromUtf8( buffer.buffer(), \
buffer.buffer().size() );  pageLayout.addChildElement( "separator", elementContents \
); +        buffer.close();
 
+        if ( m_pageColumns.columns > 1 ) {
+            buffer.setBuffer( QByteArray() ); // clear data
+            buffer.open( IO_WriteOnly );
+            KoXmlWriter columnsTmpWriter( &buffer );  // TODO pass indentation level
+            columnsTmpWriter.startElement( "style:columns" );
+            columnsTmpWriter.addAttribute( "fo:column-count", m_pageColumns.columns \
); +            columnsTmpWriter.addAttributePt( "fo:column-gap", \
m_pageColumns.ptColumnSpacing ); +            columnsTmpWriter.endElement(); // \
style:columns +            buffer.close();
+            const QString elementContents = QString::fromUtf8( buffer.buffer(), \
buffer.buffer().size() ); +            pageLayout.addChildElement( "columns", \
elementContents ); +        }
+
         // This is a bit of a hack, which only works as long as we have only one \
                page master
         // if there's more than one pagemaster we need to rethink all this
 
         pageLayoutName = mainStyles.lookup( pageLayout, "pm" );
         pageLayout.writeStyle( stylesWriter, mainStyles, "style:page-layout", \
                pageLayoutName,
                                "style:page-layout-properties", false /*don't close*/ \
                );
-        //if ( m_pageLayout.columns > 1 ) TODO add columns element.
 
         // Header and footers save their content into master-styles/master-page, but \
                their
         // styles into the page-layout automatic-style. To avoid splitting that code
         // in two places (and inconsistent iteration), we save both here, the \
content  // going into
-        buffer.close();
         buffer.setBuffer( headerFooters );
         buffer.open( IO_WriteOnly );
         // Ouch another problem: there is only one header style in oasis


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

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