34#include <tqiodevice.h>
36#include <tqtextstream.h>
43#include <KoPageLayout.h>
44#include <KoPictureKey.h>
47#include <KWEFStructures.h>
49#include <KWEFBaseWorker.h>
50#include <KWEFKWordLeader.h>
52#include "ExportFilter.h"
54OOWriterWorker::OOWriterWorker(
void) : m_streamOut(NULL),
55 m_paperBorderTop(0.0),m_paperBorderLeft(0.0),
56 m_paperBorderBottom(0.0),m_paperBorderRight(0.0), m_zip(NULL), m_pictureNumber(0),
57 m_automaticParagraphStyleNumber(0), m_automaticTextStyleNumber(0),
58 m_footnoteNumber(0), m_tableNumber(0), m_textBoxNumber( 0 ),
59 m_columnspacing( 36.0 ), m_columns( 1 )
63TQString OOWriterWorker::escapeOOText(
const TQString& strText)
const
67 return KWEFUtil::EscapeSgmlText(NULL,strText,
true,
true);
70TQString OOWriterWorker::escapeOOSpan(
const TQString& strText)
const
77 for (uint i=0; i<strText.length(); i++)
84 if ( spaceNumber > 0 )
88 if ( spaceNumber > 0 )
90 strReturn +=
"<text:s text:c=\"";
91 strReturn += TQString::number( spaceNumber );
103 strReturn+=
"<text:tab-stop/>";
108 strReturn+=
"<text:line-break/>";
113 if ( spaceNumber > 0 )
183 kdWarning(30518) <<
"Not allowed XML character: " << ch.unicode() << endl;
196 if ( spaceNumber > 0 )
201 if ( spaceNumber > 0 )
203 strReturn +=
"<text:s text:c=\"";
204 strReturn += TQString::number( spaceNumber );
213bool OOWriterWorker::doOpenFile(
const TQString& filenameOut,
const TQString& )
215 kdDebug(30518) <<
"Opening file: " << filenameOut
216 <<
" (in OOWriterWorker::doOpenFile)" << endl;
218 m_zip=
new KZip(filenameOut);
220 if (!m_zip->open(IO_WriteOnly))
222 kdError(30518) <<
"Could not open ZIP file for writing! Aborting!" << endl;
228 m_zip->setCompression( KZip::NoCompression );
229 m_zip->setExtraField( KZip::NoExtraField );
231 const TQCString appId(
"application/vnd.sun.xml.writer" );
233 m_zip->writeFile(
"mimetype", TQString(), TQString(), appId.length(), appId.data() );
235 m_zip->setCompression( KZip::DeflateCompression );
237 m_streamOut=
new TQTextStream(m_contentBody, IO_WriteOnly);
239 m_streamOut->setEncoding( TQTextStream::UnicodeUTF8 );
244bool OOWriterWorker::zipPrepareWriting(
const TQString& name)
249 return m_zip->prepareWriting(name, TQString(), TQString(), 0);
252bool OOWriterWorker::zipDoneWriting(
void)
256 return m_zip->doneWriting(m_size);
259bool OOWriterWorker::zipWriteData(
const char* str)
263 const uint size=strlen(str);
265 return m_zip->writeData(str,size);
268bool OOWriterWorker::zipWriteData(
const TQByteArray& array)
272 const uint size=array.size();
274 return m_zip->writeData(array.data(),size);
277bool OOWriterWorker::zipWriteData(
const TQCString& cstr)
281 const uint size=cstr.length();
283 return m_zip->writeData(cstr.data(),size);
286bool OOWriterWorker::zipWriteData(
const TQString& str)
288 return zipWriteData(str.utf8());
291void OOWriterWorker::writeStartOfFile(
const TQString& type)
293 const bool noType=type.isEmpty();
294 zipWriteData(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
296 zipWriteData(
"<!DOCTYPE office:document");
303 zipWriteData(
" PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\"");
304 zipWriteData(
" \"office.dtd\"");
307 zipWriteData(
"<office:document");
317 zipWriteData(
" xmlns:office=\"http://openoffice.org/2000/office\"");
318 zipWriteData(
" xmlns:xlink=\"http://www.w3.org/1999/xlink\"");
321 if ( type ==
"content" || type ==
"styles" || type.isEmpty() )
323 zipWriteData(
" xmlns:style=\"http://openoffice.org/2000/style\"");
324 zipWriteData(
" xmlns:text=\"http://openoffice.org/2000/text\"");
325 zipWriteData(
" xmlns:table=\"http://openoffice.org/2000/table\"");
326 zipWriteData(
" xmlns:draw=\"http://openoffice.org/2000/drawing\"");
327 zipWriteData(
" xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"");
330 zipWriteData(
" xmlns:svg=\"http://www.w3.org/2000/svg\"");
339 if ( type ==
"meta" || type.isEmpty() )
341 zipWriteData(
" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"");
342 zipWriteData(
" xmlns:meta=\"http://openoffice.org/2000/meta\"");
345 zipWriteData(
" office:class=\"text\"");
348#ifdef STRICT_OOWRITER_VERSION_1
349 zipWriteData(
" office:version=\"1.0\"");
358void OOWriterWorker::writeFontDeclaration(
void)
360 zipWriteData(
" <office:font-decls>\n");
361 TQMap<TQString,TQString>::ConstIterator end(m_fontNames.end());
362 for (TQMap<TQString,TQString>::ConstIterator it=m_fontNames.begin(); it!=end; ++it)
364 const bool space=(it.key().find(
' ')>=0);
365 const TQString fontName(escapeOOText(it.key()));
366 zipWriteData(
" <style:font-decl style:name=\"");
367 zipWriteData(fontName);
368 zipWriteData(
"\" fo:font-family=\"");
371 zipWriteData(
"'");
372 zipWriteData(fontName);
373 zipWriteData(
"'");
377 zipWriteData(fontName);
380 zipWriteData(it.data());
381 zipWriteData(
" />\n");
383 zipWriteData(
" </office:font-decls>\n");
386void OOWriterWorker::writeStylesXml(
void)
391 zipPrepareWriting(
"styles.xml");
393 writeStartOfFile(
"styles");
395 writeFontDeclaration();
397 zipWriteData(m_styles);
399 zipWriteData(
" <office:automatic-styles>\n");
400 zipWriteData(
" <style:page-master style:name=\"pm1\">\n");
402 zipWriteData(
" <style:properties ");
403 zipWriteData(
" style:page-usage=\"all\"" );
405 zipWriteData(
" fo:page-width=\"");
406 zipWriteData(TQString::number(m_paperWidth));
407 zipWriteData(
"pt\" fo:page-height=\"");
408 zipWriteData(TQString::number(m_paperHeight));
409 zipWriteData(
"pt\" ");
411 zipWriteData(
"style:print-orientation=\"");
412 if (1==m_paperOrientation)
414 zipWriteData(
"landscape");
418 zipWriteData(
"portrait");
421 zipWriteData(
"\" fo:margin-top=\"");
422 zipWriteData(TQString::number(m_paperBorderTop));
423 zipWriteData(
"pt\" fo:margin-bottom=\"");
424 zipWriteData(TQString::number(m_paperBorderBottom));
425 zipWriteData(
"pt\" fo:margin-left=\"");
426 zipWriteData(TQString::number(m_paperBorderLeft));
427 zipWriteData(
"pt\" fo:margin-right=\"");
428 zipWriteData(TQString::number(m_paperBorderRight));
429 zipWriteData(
"pt\" style:first-page-number=\"");
430 zipWriteData(TQString::number(m_varSet.startingPageNumber));
431 zipWriteData(
"\">\n" );
435 zipWriteData(
" <style:columns" );
436 zipWriteData(
" fo:column-count=\"" );
437 zipWriteData( TQString::number( m_columns ) );
438 zipWriteData(
"\" fo:column-gap=\"" );
439 zipWriteData( TQString::number( m_columnspacing ) );
440 zipWriteData(
"pt\">\n" );
442 for (
int i=0; i < m_columns; ++i)
444 zipWriteData(
" <style:column style:rel-width=\"1*\" fo:margin-left=\"0cm\" fo:margin-right=\"0cm\"/>\n" );
447 zipWriteData(
" </style:columns>\n" );
450 zipWriteData(
" </style:properties>\n");
452 zipWriteData(
" </style:page-master>\n");
453 zipWriteData(
" </office:automatic-styles>\n");
455 zipWriteData(
" <office:master-styles>\n");
456 zipWriteData(
" <style:master-page style:name=\"Standard\" style:page-master-name=\"pm1\" />\n");
457 zipWriteData(
" </office:master-styles>\n");
459 zipWriteData(
"</office:document-styles>\n" );
464void OOWriterWorker::writeContentXml(
void)
469 zipPrepareWriting(
"content.xml");
471 writeStartOfFile(
"content");
473 writeFontDeclaration();
475 zipWriteData(
" <office:automatic-styles>\n");
476 zipWriteData(m_contentAutomaticStyles);
477 m_contentAutomaticStyles = TQString();
479 zipWriteData(
" </office:automatic-styles>\n");
481 zipWriteData(m_contentBody);
482 m_contentBody.resize( 0 );
484 zipWriteData(
"</office:document-content>\n" );
489void OOWriterWorker::writeMetaXml(
void)
494 zipPrepareWriting(
"meta.xml");
496 writeStartOfFile(
"meta");
498 zipWriteData(
" <office:meta>\n");
501 zipWriteData(
" <meta:generator>KWord's OOWriter Export Filter");
502 zipWriteData(TQString(
"$Revision: 515673 $").mid(10).remove(
'$'));
504 zipWriteData(
"</meta:generator>\n");
506 if (!m_docInfo.title.isEmpty())
508 zipWriteData(
" <dc:title>");
509 zipWriteData(escapeOOText(m_docInfo.title));
510 zipWriteData(
"</dc:title>\n");
512 if (!m_docInfo.abstract.isEmpty())
514 zipWriteData(
" <dc:description>");
515 zipWriteData(escapeOOText(m_docInfo.abstract));
516 zipWriteData(
"</dc:description>\n");
519 if (m_varSet.creationTime.isValid())
521 zipWriteData(
" <meta:creation-date>");
522 zipWriteData(escapeOOText(m_varSet.creationTime.toString(TQt::ISODate)));
523 zipWriteData(
"</meta:creation-date>\n");
526 if (m_varSet.modificationTime.isValid())
528 zipWriteData(
" <dc:date>");
529 zipWriteData(escapeOOText(m_varSet.modificationTime.toString(TQt::ISODate)));
530 zipWriteData(
"</dc:date>\n");
533 if (m_varSet.printTime.isValid())
535 zipWriteData(
" <meta:print-date>");
536 zipWriteData(escapeOOText(m_varSet.printTime.toString(TQt::ISODate)));
537 zipWriteData(
"</meta:print-date>\n");
540 zipWriteData(
" <meta:document-statistic" );
543 if ( m_numPages > 0 )
545 zipWriteData(
" meta:page-count=\"" );
546 zipWriteData( TQString::number ( m_numPages ) );
547 zipWriteData(
"\"" );
550 zipWriteData(
" meta:image-count=\"" );
551 zipWriteData( TQString::number ( m_pictureNumber ) );
552 zipWriteData(
"\"" );
554 zipWriteData(
" meta:table-count=\"" );
555 zipWriteData( TQString::number ( m_tableNumber ) );
556 zipWriteData(
"\"" );
558 zipWriteData(
"/>\n" );
560 zipWriteData(
" </office:meta>\n");
561 zipWriteData(
"</office:document-meta>\n");
566bool OOWriterWorker::doCloseFile(
void)
568 kdDebug(30518)<<
"OOWriterWorker::doCloseFile" << endl;
582bool OOWriterWorker::doOpenDocument(
void)
584 kdDebug(30518)<<
"OOWriterWorker::doOpenDocument" << endl;
586 *m_streamOut <<
" <office:body>\n";
591bool OOWriterWorker::doCloseDocument(
void)
593 *m_streamOut <<
" </office:body>\n";
597bool OOWriterWorker::doOpenBody(
void)
599 TQValueList<FrameAnchor>::Iterator it;
602 kdDebug(30518) <<
"=== Processing non-inlined pictures ===" << endl;
603 for ( it = m_nonInlinedPictureAnchors.begin(); it != m_nonInlinedPictureAnchors.end(); ++it )
606 makePicture( *it, AnchorNonInlined );
607 *m_streamOut <<
"\n";
609 kdDebug(30518) <<
"=== Non-inlined pictures processed ===" << endl;
612 kdDebug(30518) <<
"=== Processing non-inlined tables ===" << endl;
613 for ( it = m_nonInlinedTableAnchors.begin(); it != m_nonInlinedTableAnchors.end(); ++it )
616 makeTable( *it, AnchorNonInlined );
617 *m_streamOut <<
"\n";
619 kdDebug(30518) <<
"=== Non-inlined tables processed ===" << endl;
624TQString OOWriterWorker::textFormatToStyle(
const TextFormatting& formatOrigin,
625 const TextFormatting& formatData,
const bool force, TQString& key)
631 TQString fontName = formatData.fontName;
632 declareFont(fontName);
633 if ( !fontName.isEmpty()
634 && (force || (formatOrigin.fontName!=formatData.fontName)))
636 strElement+=
"style:font-name=\"";
637 strElement+= escapeOOText(fontName);
644 if (force || (formatOrigin.italic!=formatData.italic))
647 strElement+=
"fo:font-style=\"";
648 if ( formatData.italic )
650 strElement+=
"italic";
655 strElement+=
"normal";
663 if (force || ((formatOrigin.weight>=75)!=(formatData.weight>=75)))
665 strElement+=
"fo:font-weight=\"";
666 if ( formatData.weight >= 75 )
673 strElement+=
"normal";
681 if (force || (formatOrigin.fontSize!=formatData.fontSize))
683 const int size=formatData.fontSize;
686 strElement+=
"fo:font-size=\"";
687 strElement+=TQString::number(size,10);
689 key+=TQString::number(size,10);
695 if (force || (formatOrigin.fgColor!=formatData.fgColor))
697 if ( formatData.fgColor.isValid() )
699 strElement+=
"fo:color=\"";
700 strElement+=formatData.fgColor.name();
702 key+=formatData.fgColor.name();
708 if (force || (formatOrigin.bgColor!=formatData.bgColor))
710 if ( formatData.bgColor.isValid() )
712 strElement+=
"style:text-background-color=\"";
713 strElement+=formatData.bgColor.name();
715 key+=formatData.bgColor.name();
726 strElement+=
"style:text-underline=\"";
732 if ( underlineStyle.isEmpty() )
733 underlineStyle =
"solid";
734 if ( underlineValue ==
"1" )
735 underlineValue =
"single";
737 if ( underlineValue ==
"single" )
739 if ( underlineStyle ==
"dash" )
741 strElement +=
"dash";
744 else if ( underlineStyle ==
"dot" )
746 strElement +=
"dotted";
749 else if ( underlineStyle ==
"dashdot" )
751 strElement +=
"dot-dash";
754 else if ( underlineStyle ==
"dashdotdot" )
756 strElement +=
"dot-dot-dash";
761 strElement +=
"single";
765 else if ( underlineValue ==
"double" )
767 strElement +=
"double";
770 else if ( underlineValue ==
"single-bold" )
772 strElement +=
"bold";
775 else if ( underlineValue ==
"wave" )
777 strElement +=
"wave";
782 strElement +=
"single";
796 strElement +=
"style:text-underline-color=\"";
797 strElement += colorName;
813 strElement+=
"style:text-crossing-out=\"";
816 strElement+=
"single-line";
821 strElement+=
"double-line";
846 strElement+=
"fo:score-spaces=\"";
849 strElement +=
"false";
854 strElement +=
"true";
864 const TQString lang ( formatData.
language );
865 if ( ! lang.isEmpty() )
867 const int res = lang.find(
'_' );
871 kdDebug(30518) <<
"Language: " << lang <<
" => " << lang.left( res ) <<
" - " << lang.mid( res + 1 ) << endl;
872 strElement +=
"fo:language=\"";
873 strElement += lang.left( res );
875 strElement +=
"fo:country=\"";
876 strElement += lang.mid( res + 1 );
881 kdDebug(30518) <<
"Language without country: " << lang << endl;
882 strElement +=
"fo:language=\"";
893 if ( force || ( formatOrigin.fontAttribute != formatData.fontAttribute ) )
897 if ( formatData.fontAttribute ==
"uppercase" )
899 strElement +=
"fo:text-transform=\"uppercase\" ";
902 else if ( formatData.fontAttribute ==
"lowercase" )
904 strElement +=
"fo:text-transform=\"lowercase\" ";
907 else if ( formatData.fontAttribute ==
"smallcaps" )
909 strElement +=
"fo:font-variant=\"small-caps\" ";
914 strElement +=
"fo:text-transform=\"none\" ";
915 strElement +=
"fo:font-variant=\"normal\" ";
922 if ( force || ( formatOrigin.verticalAlignment != formatData.verticalAlignment ) )
924 if ( 1 == formatData.verticalAlignment )
927 strElement +=
"style:text-position=\"sub\" ";
930 else if ( 2 == formatData.verticalAlignment )
933 strElement +=
"style:text-position=\"super\" ";
939 return strElement.stripWhiteSpace();
944TQString OOWriterWorker::cellToProperties(
const TableCell& cell, TQString& key)
const
951 key += frame.lColor.name();
953 key += TQString::number( frame.lWidth );
954 properties +=
" fo:border-left=\"";
955 if ( frame.lColor.isValid() && frame.lWidth > 0.0 )
957 properties += TQString::number( frame.lWidth );
959 properties +=
" solid ";
960 properties += frame.lColor.name();
964 properties +=
"0pt none #000000";
969 key += frame.rColor.name();
971 key += TQString::number( frame.rWidth );
972 properties +=
" fo:border-right=\"";
973 if ( frame.rColor.isValid() && frame.rWidth > 0.0 )
975 properties += TQString::number( frame.rWidth );
977 properties +=
" solid ";
978 properties += frame.rColor.name();
982 properties +=
"0pt none #000000";
987 key += frame.tColor.name();
989 key += TQString::number( frame.tWidth );
990 properties +=
" fo:border-top=\"";
991 if ( frame.tColor.isValid() && frame.tWidth > 0.0 )
993 properties += TQString::number( frame.tWidth );
995 properties +=
" solid ";
996 properties += frame.tColor.name();
1000 properties +=
"0pt none #000000";
1005 key += frame.bColor.name();
1007 key += TQString::number( frame.bWidth );
1008 properties +=
" fo:border-bottom=\"";
1009 if ( frame.bColor.isValid() && frame.bWidth > 0.0 )
1011 properties += TQString::number( frame.bWidth );
1013 properties +=
" solid ";
1014 properties += frame.bColor.name();
1018 properties +=
"0pt none #000000";
1028bool OOWriterWorker::makeTableRows(
const TQString& tableName,
const Table& table,
int firstRowNumber )
1036 *m_streamOut <<
"<table:table-row>\n";
1037 int rowCurrent = firstRowNumber;
1039 ulong cellNumber = 0L;
1041 TQMap<TQString,TQString> mapCellStyleKeys;
1043 for ( TQValueList<TableCell>::ConstIterator itCell ( table.cellList.begin() );
1044 itCell != table.cellList.end(); ++itCell)
1046 if ( rowCurrent != (*itCell).row )
1048 rowCurrent = (*itCell).row;
1049 *m_streamOut <<
"</table:table-row>\n";
1050 *m_streamOut <<
"<table:table-row>\n";
1054 const TQString props ( cellToProperties( (*itCell), key ) );
1056 TQString automaticCellStyle;
1057 TQMap<TQString,TQString>::ConstIterator it ( mapCellStyleKeys.find( key ) );
1058 if ( it == mapCellStyleKeys.end() )
1060 automaticCellStyle = makeAutomaticStyleName( tableName +
".Cell", cellNumber );
1061 mapCellStyleKeys [ key ] = automaticCellStyle;
1062 kdDebug(30518) <<
"Creating automatic cell style: " << automaticCellStyle <<
" key: " << key << endl;
1063 m_contentAutomaticStyles +=
" <style:style";
1064 m_contentAutomaticStyles +=
" style:name=\"" + escapeOOText( automaticCellStyle ) +
"\"";
1065 m_contentAutomaticStyles +=
" style:family=\"table-cell\"";
1066 m_contentAutomaticStyles +=
">\n";
1067 m_contentAutomaticStyles +=
" <style:properties ";
1068 m_contentAutomaticStyles += props;
1069 m_contentAutomaticStyles +=
"/>\n";
1070 m_contentAutomaticStyles +=
" </style:style>\n";
1074 automaticCellStyle = it.data();
1075 kdDebug(30518) <<
"Using automatic cell style: " << automaticCellStyle <<
" key: " << key << endl;
1078 *m_streamOut <<
"<table:table-cell table:value-type=\"string\" table:style-name=\""
1079 << escapeOOText( automaticCellStyle)
1084 *m_streamOut <<
" table:number-columns-spanned=\"" << (*itCell).m_cols <<
"\"";
1087 *m_streamOut <<
">\n";
1089 if (!doFullAllParagraphs(*(*itCell).paraList))
1094 *m_streamOut <<
"</table:table-cell>\n";
1096 if ( (*itCell).m_cols > 1 )
1099 for (
int i = 1; i < (*itCell).m_cols; ++i)
1101 *m_streamOut <<
"<table:covered-table-cell/>";
1106 *m_streamOut <<
"</table:table-row>\n";
1114static uint getColumnWidths(
const Table& table, TQMemArray<double>& widthArray,
int firstRowNumber )
1116 bool uniqueColumns =
true;
1117 uint currentColumn = 0;
1118 int tryingRow = firstRowNumber;
1119 TQValueList<TableCell>::ConstIterator itCell;
1121 for ( itCell = table.cellList.begin();
1122 itCell != table.cellList.end(); ++itCell )
1124 kdDebug(30518) <<
"Column: " << (*itCell).col <<
" (Row: " << (*itCell).row <<
")" << endl;
1126 if ( (*itCell).row != tryingRow )
1128 if ( uniqueColumns )
1131 return currentColumn;
1136 tryingRow = (*itCell).row;
1137 uniqueColumns =
true;
1142 if ( (*itCell).m_cols > 1 )
1145 uniqueColumns =
false;
1150 const double width = ( (*itCell).frame.right - (*itCell).frame.left );
1152 if ( currentColumn >= widthArray.size() )
1153 widthArray.resize( currentColumn + 4, TQGArray::SpeedOptim);
1155 widthArray.at( currentColumn ) = width;
1163 return uniqueColumns ? currentColumn : 0;
1168static uint getFirstRowColumnWidths(
const Table& table, TQMemArray<double>& widthArray,
int firstRowNumber )
1172 uint currentColumn = 0;
1173 TQValueList<TableCell>::ConstIterator itCell;
1175 for ( itCell = table.cellList.begin();
1176 itCell != table.cellList.end(); ++itCell )
1178 kdDebug(30518) <<
"Column: " << (*itCell).col <<
" (Row: " << (*itCell).row <<
")" << endl;
1179 if ( (*itCell).row != firstRowNumber )
1182 int cols = (*itCell).m_cols;
1187 const double width = ( (*itCell).frame.right - (*itCell).frame.left ) / cols;
1189 if ( currentColumn + cols > widthArray.size() )
1190 widthArray.resize( currentColumn + 4, TQGArray::SpeedOptim);
1192 for (
int i = 0; i < cols; ++i )
1194 widthArray.at( currentColumn ) = width;
1198 return currentColumn;
1202bool OOWriterWorker::makeTable(
const FrameAnchor& anchor,
const AnchorType anchorType )
1207 const TQString automaticTableStyle ( makeAutomaticStyleName(
"Table", m_tableNumber ) );
1208 const TQString tableName( TQString(
"Table" ) + TQString::number( m_tableNumber ) );
1209 const TQString translatedName( i18n(
"Object name",
"Table %1").arg( m_tableNumber ) );
1210 const TQString automaticFrameStyle ( makeAutomaticStyleName(
"TableFrame", m_textBoxNumber ) );
1211 const TQString translatedFrameName( i18n(
"Object name",
"Table Frame %1").arg( m_textBoxNumber ) );
1213 kdDebug(30518) <<
"Processing table " << anchor.
key.toString() <<
" => " << tableName << endl;
1215 const TQValueList<TableCell>::ConstIterator firstCell ( anchor.table.cellList.begin() );
1217 if ( firstCell == anchor.table.cellList.end() )
1219 kdError(30518) <<
"Table has not any cell!" << endl;
1223 const int firstRowNumber = (*firstCell).row;
1224 kdDebug(30518) <<
"First row: " << firstRowNumber << endl;
1226 TQMemArray<double> widthArray(4);
1228 uint numberColumns = getColumnWidths( anchor.table, widthArray, firstRowNumber );
1230 if ( numberColumns <= 0 )
1232 kdDebug(30518) <<
"Could not get correct column widths, so approximating" << endl;
1234 numberColumns = getFirstRowColumnWidths( anchor.table, widthArray, firstRowNumber );
1235 if ( numberColumns <= 0 )
1238 kdError(30518) <<
"Cannot get column widths of table " << anchor.
key.toString() << endl;
1243 kdDebug(30518) <<
"Number of columns: " << numberColumns << endl;
1246 double tableWidth = 0.0;
1248 for ( i=0; i < numberColumns; ++i )
1250 tableWidth += widthArray.at( i );
1252 kdDebug(30518) <<
"Table width: " << tableWidth << endl;
1255 *m_streamOut <<
"<draw:text-box";
1256 *m_streamOut <<
" style:name=\"" << escapeOOText( automaticFrameStyle ) <<
"\"";
1257 *m_streamOut <<
" draw:name=\"" << escapeOOText( translatedFrameName ) <<
"\"";
1258 if ( anchorType == AnchorNonInlined )
1261 *m_streamOut <<
" text:anchor-type=\"paragraph\"";
1265 *m_streamOut <<
" text:anchor-type=\"as-char\"";
1267 *m_streamOut <<
" svg:width=\"" << tableWidth <<
"pt\"";
1269 *m_streamOut <<
">\n";
1271 *m_streamOut <<
"<table:table table:name=\""
1272 << escapeOOText( translatedName )
1273 <<
"\" table:style-name=\""
1274 << escapeOOText( automaticTableStyle )
1280 kdDebug(30518) <<
"Creating automatic frame style: " << automaticFrameStyle << endl;
1281 m_contentAutomaticStyles +=
" <style:style";
1282 m_contentAutomaticStyles +=
" style:name=\"" + escapeOOText( automaticFrameStyle ) +
"\"";
1283 m_contentAutomaticStyles +=
" style:family=\"graphics\"";
1284 m_contentAutomaticStyles +=
" style:parent-style-name=\"Frame\"";
1285 m_contentAutomaticStyles +=
">\n";
1286 m_contentAutomaticStyles +=
" <style:properties ";
1287 m_contentAutomaticStyles +=
" text:anchor-type=\"as-char\"";
1288 m_contentAutomaticStyles +=
" fo:padding=\"0pt\" fo:border=\"none\"";
1289 m_contentAutomaticStyles +=
" fo:margin-left=\"0pt\"";
1290 m_contentAutomaticStyles +=
" fo:margin-top=\"0pt\"";
1291 m_contentAutomaticStyles +=
" fo:margin-bottom=\"0pt\"";
1292 m_contentAutomaticStyles +=
" fo:margin-right=\"0pt\"";
1293 m_contentAutomaticStyles +=
"/>\n";
1294 m_contentAutomaticStyles +=
" </style:style>\n";
1296 kdDebug(30518) <<
"Creating automatic table style: " << automaticTableStyle << endl;
1297 m_contentAutomaticStyles +=
" <style:style";
1298 m_contentAutomaticStyles +=
" style:name=\"" + escapeOOText( automaticTableStyle ) +
"\"";
1299 m_contentAutomaticStyles +=
" style:family=\"table\"";
1300 m_contentAutomaticStyles +=
">\n";
1301 m_contentAutomaticStyles +=
" <style:properties ";
1302 m_contentAutomaticStyles +=
" style:width=\"" + TQString::number( tableWidth ) +
"pt\" ";
1303 m_contentAutomaticStyles +=
"/>\n";
1304 m_contentAutomaticStyles +=
" </style:style>\n";
1306 TQValueList<TableCell>::ConstIterator itCell;
1308 ulong columnNumber = 0L;
1310 for ( i=0; i < numberColumns; ++i )
1312 const TQString automaticColumnStyle ( makeAutomaticStyleName( tableName +
".Column", columnNumber ) );
1313 kdDebug(30518) <<
"Creating automatic column style: " << automaticColumnStyle << endl;
1315 m_contentAutomaticStyles +=
" <style:style";
1316 m_contentAutomaticStyles +=
" style:name=\"" + escapeOOText( automaticColumnStyle ) +
"\"";
1317 m_contentAutomaticStyles +=
" style:family=\"table-column\"";
1318 m_contentAutomaticStyles +=
">\n";
1319 m_contentAutomaticStyles +=
" <style:properties ";
1322 m_contentAutomaticStyles +=
" style:column-width=\"" + TQString::number( widthArray.at( i ) ) +
"pt\" ";
1323 m_contentAutomaticStyles +=
"/>\n";
1324 m_contentAutomaticStyles +=
" </style:style>\n";
1327 *m_streamOut <<
"<table:table-column table:style-name=\""
1328 << escapeOOText( automaticColumnStyle )
1329 <<
"\" table:number-columns-repeated=\"1\"/>\n";
1332 makeTableRows( tableName, anchor.table, firstRowNumber );
1334 *m_streamOut <<
"</table:table>\n";
1336 *m_streamOut <<
"</draw:text-box>";
1342bool OOWriterWorker::makePicture(
const FrameAnchor& anchor,
const AnchorType anchorType )
1344 kdDebug(30518) <<
"New picture: " << anchor.picture.koStoreName
1345 <<
" , " << anchor.picture.key.toString() << endl;
1347 const TQString koStoreName(anchor.picture.koStoreName);
1351 TQString strExtension(koStoreName.lower());
1352 const int result=koStoreName.findRev(
".");
1355 strExtension=koStoreName.mid(result+1);
1358 bool isImageLoaded=
false;
1360 if (strExtension==
"png")
1362 isImageLoaded=loadSubFile(koStoreName,image);
1364 else if ((strExtension==
"jpg") || (strExtension==
"jpeg"))
1366 isImageLoaded=loadSubFile(koStoreName,image);
1369 else if ((strExtension==
"tif") || (strExtension==
"tiff"))
1371 isImageLoaded=loadSubFile(koStoreName,image);
1374 else if ((strExtension==
"gif") || (strExtension==
"wmf"))
1377 isImageLoaded=loadSubFile(koStoreName,image);
1382 isImageLoaded=loadAndConvertToImage(koStoreName,strExtension,
"PNG",image);
1388 kdWarning(30518) <<
"Unable to load picture: " << koStoreName << endl;
1392 kdDebug(30518) <<
"Picture loaded: " << koStoreName << endl;
1394 double height = 0.0;
1397 if ( anchorType == AnchorTextImage )
1400 TQBuffer buffer( image.copy() );
1402 buffer.open( IO_ReadOnly );
1403 if ( pic.load( &buffer, strExtension ) )
1405 const TQSize size ( pic.getOriginalSize() );
1406 height = size.height();
1407 width = size.width();
1411 kdWarning(30518) <<
"Could not load KoPicture: " << koStoreName << endl;
1418 height=anchor.frame.bottom - anchor.frame.top;
1419 width =anchor.frame.right - anchor.frame.left;
1424 kdWarning(30518) <<
"Silly height for " << koStoreName <<
" : " << height << endl;
1429 kdWarning(30518) <<
"Silly width for " << koStoreName <<
" : " << width << endl;
1436 number.fill(
'0',32);
1437 number += TQString::number(++m_pictureNumber,16);
1439 TQString ooName(
"Pictures/");
1440 ooName += number.right(32);
1442 ooName += strExtension;
1444 kdDebug(30518) <<
"Picture " << koStoreName <<
" => " << ooName << endl;
1448 *m_streamOut <<
"<draw:image draw:name=\"" << anchor.picture.key.filename() <<
"\"";
1449 *m_streamOut <<
" draw:style-name=\"Graphics\"";
1450 if ( anchorType == AnchorNonInlined )
1453 *m_streamOut <<
" text:anchor-type=\"paragraph\"";
1457 *m_streamOut <<
" text:anchor-type=\"as-char\"";
1459 *m_streamOut <<
" svg:height=\"" << height <<
"pt\" svg:width=\"" << width <<
"pt\"";
1460 *m_streamOut <<
" draw:z-index=\"0\" xlink:href=\"#" << ooName <<
"\"";
1461 *m_streamOut <<
" xlink:type=\"simple\" xlink:show=\"embed\" xlink:actuate=\"onLoad\"";
1462 *m_streamOut <<
"/>";
1468 m_zip->writeFile(ooName,TQString(), TQString(), image.size(), image.data());
1470 zipPrepareWriting(ooName);
1471 zipWriteData( image );
1479void OOWriterWorker::processNormalText (
const TQString ¶Text,
1481 const FormatData& formatData)
1484 const TQString partialText( escapeOOSpan( paraText.mid( formatData.pos, formatData.len ) ) );
1486 if (formatData.text.missing)
1489 *m_streamOut << partialText;
1493 *m_streamOut <<
"<text:span";
1496 const TQString props ( textFormatToStyle(formatLayout,formatData.text,
false,styleKey) );
1498 TQMap<TQString,TQString>::ConstIterator it ( m_mapTextStyleKeys.find(styleKey) );
1499 kdDebug(30518) <<
"Searching text key: " << styleKey << endl;
1501 TQString automaticStyle;
1502 if (it==m_mapTextStyleKeys.end())
1505 automaticStyle=makeAutomaticStyleName(
"T", m_automaticTextStyleNumber);
1506 kdDebug(30518) <<
"Creating automatic text style: " << automaticStyle <<
" key: " << styleKey << endl;
1507 m_mapTextStyleKeys[styleKey]=automaticStyle;
1509 m_contentAutomaticStyles +=
" <style:style";
1510 m_contentAutomaticStyles +=
" style:name=\"" + escapeOOText(automaticStyle) +
"\"";
1511 m_contentAutomaticStyles +=
" style:family=\"text\"";
1512 m_contentAutomaticStyles +=
">\n";
1513 m_contentAutomaticStyles +=
" <style:properties ";
1514 m_contentAutomaticStyles += props;
1515 m_contentAutomaticStyles +=
"/>\n";
1516 m_contentAutomaticStyles +=
" </style:style>\n";
1521 automaticStyle=it.data();
1522 kdDebug(30518) <<
"Using automatic text style: " << automaticStyle <<
" key: " << styleKey << endl;
1525 *m_streamOut <<
" text:style-name=\"" << escapeOOText(automaticStyle) <<
"\" ";
1527 *m_streamOut <<
">" << partialText <<
"</text:span>";
1531void OOWriterWorker::processFootnote(
const VariableData& variable )
1543 *m_streamOut <<
"<text:footnote text:id=\"ft";
1544 *m_streamOut << (++m_footnoteNumber);
1545 *m_streamOut <<
"\">";
1546 *m_streamOut <<
"<text:footnote-citation>" << escapeOOText( value ) <<
"</text:footnote-citation>";
1547 *m_streamOut <<
"<text:footnote-body>\n";
1549 doFullAllParagraphs( *paraList );
1551 *m_streamOut <<
"\n</text:footnote-body>";
1552 *m_streamOut <<
"</text:footnote>";
1556 *m_streamOut <<
"<text:endnote text:id=\"ft";
1557 *m_streamOut << (++m_footnoteNumber);
1558 *m_streamOut <<
"\">";
1559 *m_streamOut <<
"<text:endnote-citation>" << escapeOOText( value ) <<
"</text:endnote-citation>";
1560 *m_streamOut <<
"<text:endnote-body>\n";
1562 doFullAllParagraphs( *paraList );
1564 *m_streamOut <<
"\n</text:endnote-body>";
1565 *m_streamOut <<
"</text:endnote>";
1570void OOWriterWorker::processNote(
const VariableData& variable )
1575 *m_streamOut <<
"<office:annotation office:create-date=\"";
1579 if ( m_varSet.creationTime.isValid() )
1580 *m_streamOut << escapeOOText( m_varSet.creationTime.date().toString( TQt::ISODate ) );
1582 *m_streamOut <<
"1970-01-01";
1584 *m_streamOut <<
"\" office:author=\"";
1587 if ( m_docInfo.fullName.isEmpty() )
1588 *m_streamOut << escapeOOText( i18n(
"Pseudo-author for annotations",
"KWord 1.3" ) );
1590 *m_streamOut << escapeOOText( m_docInfo.fullName );
1592 *m_streamOut <<
"\">\n";
1593 *m_streamOut <<
"<text:p>"
1596 <<
"</office:annotation>";
1599void OOWriterWorker::processVariable (
const TQString&,
1601 const FormatData& formatData)
1603 if (0==formatData.variable.m_type)
1605 *m_streamOut <<
"<text:date/>";
1607 else if (2==formatData.variable.m_type)
1609 *m_streamOut <<
"<text:time/>";
1611 else if (4==formatData.variable.m_type)
1614 if (formatData.variable.isPageNumber())
1616 *m_streamOut <<
"<text:page-number text:select-page=\"current\"/>";
1618 else if (formatData.variable.isPageCount())
1620 *m_streamOut <<
"<text:page-count/>";
1625 *m_streamOut << formatData.variable.m_text;
1628 else if (9==formatData.variable.m_type)
1631 *m_streamOut <<
"<text:a xlink:href=\""
1632 << escapeOOText(formatData.variable.getHrefName())
1633 <<
"\" xlink:type=\"simple\">"
1634 << escapeOOText(formatData.variable.getLinkName())
1637 else if ( 10 == formatData.variable.m_type )
1639 processNote ( formatData.variable );
1641 else if (11==formatData.variable.m_type)
1644 processFootnote ( formatData.variable );
1649 *m_streamOut << formatData.variable.m_text;
1653void OOWriterWorker::processAnchor (
const TQString&,
1655 const FormatData& formatData)
1658 if ( (2==formatData.frameAnchor.type)
1659 || (5==formatData.frameAnchor.type) )
1661 makePicture( formatData.frameAnchor, AnchorInlined );
1663 else if (6==formatData.frameAnchor.type)
1665 makeTable( formatData.frameAnchor, AnchorInlined );
1669 kdWarning(30518) <<
"Unsupported anchor type: "
1670 << formatData.frameAnchor.type << endl;
1674void OOWriterWorker::processTextImage (
const TQString&,
1676 const FormatData& formatData)
1678 kdDebug(30518) <<
"Text Image: " << formatData.frameAnchor.key.toString() << endl;
1679 makePicture( formatData.frameAnchor, AnchorTextImage );
1682void OOWriterWorker::processParagraphData (
const TQString ¶Text,
1684 const ValueListFormatData ¶FormatDataList)
1686 if ( paraText.length () > 0 )
1688 ValueListFormatData::ConstIterator paraFormatDataIt;
1690 for ( paraFormatDataIt = paraFormatDataList.begin ();
1691 paraFormatDataIt != paraFormatDataList.end ();
1692 paraFormatDataIt++ )
1694 if (1==(*paraFormatDataIt).id)
1696 processNormalText(paraText, formatLayout, (*paraFormatDataIt));
1698 else if (2==(*paraFormatDataIt).id)
1700 processTextImage(paraText, formatLayout, (*paraFormatDataIt));
1702 else if ( 3 == (*paraFormatDataIt).id )
1705 *m_streamOut <<
"<text:tab-stop/>";
1707 else if (4==(*paraFormatDataIt).id)
1709 processVariable(paraText, formatLayout, (*paraFormatDataIt));
1711 else if (6==(*paraFormatDataIt).id)
1713 processAnchor(paraText, formatLayout, (*paraFormatDataIt));
1715 else if ( 1001 == (*paraFormatDataIt).id )
1717 *m_streamOut <<
"<text:bookmark-start text:name=\""
1718 << escapeOOText( (*paraFormatDataIt).variable.m_text )
1721 else if ( 1002 == (*paraFormatDataIt).id )
1723 *m_streamOut <<
"<text:bookmark-end text:name=\""
1724 << escapeOOText( (*paraFormatDataIt).variable.m_text )
1731TQString OOWriterWorker::layoutToParagraphStyle(
const LayoutData& layoutOrigin,
1732 const LayoutData& layout,
const bool force, TQString& styleKey)
1736 styleKey += layout.styleName;
1745 props +=
"fo:text-align=\"start\" ";
1750 props +=
"fo:text-align=\"end\" ";
1755 props +=
"fo:text-align=\"center\" ";
1760 props +=
"fo:text-align=\"justify\" ";
1765 props +=
"fo:text-align=\"start\" ";
1766#ifndef STRICT_OOWRITER_VERSION_1
1767 props +=
"style:text-auto-align=\"true\" ";
1773 kdWarning(30518) <<
"Unknown alignment: " << layout.
alignment << endl;
1782 props += TQString(
"fo:margin-left=\"%1pt\" ").arg(layout.
indentLeft);
1783 styleKey += TQString::number(layout.
indentLeft);
1791 props += TQString(
"fo:margin-right=\"%1pt\" ").arg(layout.
indentRight);
1799 props +=
"fo:text-indent=\"";
1810 props += TQString(
"fo:margin-bottom=\"%1pt\" ").arg(layout.
marginBottom);
1819 props += TQString(
"fo:margin-top=\"%1pt\" ").arg(layout.
marginTop);
1820 styleKey += TQString::number(layout.
marginTop);
1831 case LayoutData::LS_CUSTOM:
1834 const TQString height ( TQString::number(layout.
lineSpacing) );
1835 props +=
"style:line-spacing=\"";
1842 case LayoutData::LS_SINGLE:
1844 props +=
"fo:line-height=\"normal\" ";
1848 case LayoutData::LS_ONEANDHALF:
1850 props +=
"fo:line-height=\"150%\" ";
1854 case LayoutData::LS_DOUBLE:
1856 props +=
"fo:line-height=\"200%\" ";
1860 case LayoutData::LS_MULTIPLE:
1863 const TQString mult ( TQString::number( tqRound( layout.
lineSpacing * 100 ) ) );
1864 props +=
"fo:line-height=\"";
1871 case LayoutData::LS_FIXED:
1874 const TQString height ( TQString::number(layout.
lineSpacing) );
1875 props +=
"fo:line-height=\"";
1882 case LayoutData::LS_ATLEAST:
1885 const TQString height ( TQString::number(layout.
lineSpacing) );
1886 props +=
"style:line-height-at-least=\"";
1895 kdWarning(30518) <<
"Unsupported lineSpacingType: " << layout.
lineSpacingType <<
" (Ignoring!)" << endl;
1903 if ( layout.pageBreakBefore )
1906 props +=
"fo:page-break-before=\"page\" ";
1912 if ( layout.pageBreakAfter )
1915 props +=
"fo:page-break-after=\"page\" ";
1921 props += textFormatToStyle(layoutOrigin.formatData.text,layout.formatData.text,force,styleKey);
1931 props +=
"\n <style:tab-stops>\n";
1932 TabulatorList::ConstIterator it;
1933 TabulatorList::ConstIterator end(layout.
tabulatorList.end());
1936 props+=
" <style:tab-stop style:position=\"";
1937 props += TQString::number((*it).m_ptpos);
1939 styleKey += TQString::number((*it).m_ptpos);
1940 switch ((*it).m_type)
1942 case 0: props +=
" style:type=\"left\""; styleKey +=
"L";
break;
1943 case 1: props +=
" style:type=\"center\""; styleKey +=
"C";
break;
1944 case 2: props +=
" style:type=\"right\""; styleKey +=
"R";
break;
1945 case 3: props +=
" style:type=\"char\" style:char=\".\""; styleKey +=
"D";
break;
1946 default: props +=
" style:type=\"left\""; styleKey +=
"L";
break;
1948 switch ((*it).m_filling)
1950 case TabulatorData::TF_NONE:
break;
1951 case TabulatorData::TF_DOT: props +=
" style:leader-char=\".\"";
break;
1952 case TabulatorData::TF_LINE: props +=
" style:leader-char=\"_\"";
break;
1954 case TabulatorData::TF_DASH:
1955 case TabulatorData::TF_DASHDOT:
1956 case TabulatorData::TF_DASHDOTDOT: props +=
" style:leader-char=\"-\"";
break;
1963 props +=
" </style:tab-stops>\n ";
1969bool OOWriterWorker::doFullParagraph(
const TQString& paraText,
const LayoutData& layout,
1970 const ValueListFormatData& paraFormatDataList)
1973 && (layout.counter.depth<10) );
1977 *m_streamOut <<
" <text:h text:level=\"";
1978 *m_streamOut << TQString::number(layout.counter.depth+1,10);
1979 *m_streamOut <<
"\" ";
1982 *m_streamOut <<
" <text:p ";
1984 const LayoutData& styleLayout=m_styleMap[layout.styleName];
1987 const TQString props(layoutToParagraphStyle(styleLayout,layout,
false,styleKey));
1989 TQString actualStyle(layout.styleName);
1990 if (!props.isEmpty())
1992 TQMap<TQString,TQString>::ConstIterator it ( m_mapParaStyleKeys.find(styleKey) );
1993 kdDebug(30518) <<
"Searching paragraph key: " << styleKey << endl;
1995 TQString automaticStyle;
1997 if (it==m_mapParaStyleKeys.end())
2000 automaticStyle = makeAutomaticStyleName(
"P", m_automaticParagraphStyleNumber);
2001 kdDebug(30518) <<
"Creating automatic paragraph style: " << automaticStyle <<
" key: " << styleKey << endl;
2002 m_mapParaStyleKeys[styleKey]=automaticStyle;
2004 m_contentAutomaticStyles +=
" <style:style";
2005 m_contentAutomaticStyles +=
" style:name=\"" + escapeOOText(automaticStyle) +
"\"";
2006 m_contentAutomaticStyles +=
" style:parent-style-name=\"" + escapeOOText(layout.styleName) +
"\"";
2007 m_contentAutomaticStyles +=
" style:family=\"paragraph\" style:class=\"text\"";
2008 m_contentAutomaticStyles +=
">\n";
2009 m_contentAutomaticStyles +=
" <style:properties ";
2010 m_contentAutomaticStyles += props;
2011 m_contentAutomaticStyles +=
"</style:properties>\n";
2012 m_contentAutomaticStyles +=
" </style:style>\n";
2017 automaticStyle=it.data();
2018 kdDebug(30518) <<
"Using automatic paragraph style: " << automaticStyle <<
" key: " << styleKey << endl;
2021 actualStyle=automaticStyle;
2024 if (!actualStyle.isEmpty())
2026 *m_streamOut <<
"text:style-name=\"" << escapeOOText(actualStyle) <<
"\" ";
2030 kdWarning(30518) <<
"No style for a paragraph!" << endl;
2033 *m_streamOut <<
">";
2035 processParagraphData(paraText, layout.formatData.text, paraFormatDataList);
2038 *m_streamOut <<
"</text:h>\n";
2040 *m_streamOut <<
"</text:p>\n";
2045bool OOWriterWorker::doOpenStyles(
void)
2047 m_styles +=
" <office:styles>\n";
2048 m_styles +=
" <style:style style:name=\"Graphics\" style:family=\"graphics\">\n";
2049 m_styles +=
" <style:properties text:anchor-type=\"paragraph\" style:wrap=\"none\"/>\n";
2050 m_styles +=
" </style:style>\n";
2051 m_styles +=
" <style:style style:name=\"Frame\" style:family=\"graphics\">\n";
2052 m_styles +=
" <style:properties text:anchor-type=\"paragraph\" style:wrap=\"none\"/>\n";
2053 m_styles +=
" </style:style>\n";
2057bool OOWriterWorker::doFullDefineStyle(
LayoutData& layout)
2060 m_styleMap[layout.styleName]=layout;
2062 m_styles +=
" <style:style";
2064 m_styles +=
" style:name=\"" + escapeOOText( layout.styleName ) +
"\"";
2065 m_styles +=
" style:next-style-name=\"" + escapeOOText( layout.styleFollowing ) +
"\"";
2066 m_styles +=
" style:family=\"paragraph\" style:class=\"text\"";
2068 m_styles +=
" <style:properties ";
2071 m_styles += layoutToParagraphStyle(layout,layout,
true,debugKey);
2072 kdDebug(30518) <<
"Defining style: " << debugKey << endl;
2074 m_styles +=
"</style:properties>\n";
2075 m_styles +=
" </style:style>\n";
2080bool OOWriterWorker::doCloseStyles(
void)
2082 m_styles +=
" </office:styles>\n";
2086bool OOWriterWorker::doFullPaperFormat(
const int format,
2087 const double width,
const double height,
const int orientation)
2091 || ( height < 1.0 ) )
2093 kdWarning(30518) <<
"Page size problem: format: " << format <<
" width: " << width <<
" height: " << height << endl;
2095 KoFormat newFormat = KoFormat ( format );
2096 if ( ( format < 0 ) || ( format > PG_LAST_FORMAT ) )
2099 newFormat = PG_DIN_A4;
2101 m_paperWidth = KoPageFormat::width ( newFormat, KoOrientation( orientation ) ) * 72.0 / 25.4 ;
2102 m_paperHeight = KoPageFormat::height ( newFormat, KoOrientation( orientation ) ) * 72.0 / 25.4 ;
2103 m_paperFormat = newFormat;
2107 m_paperFormat=format;
2109 m_paperHeight=height;
2111 m_paperOrientation=orientation;
2115bool OOWriterWorker::doFullPaperBorders (
const double top,
const double left,
2116 const double bottom,
const double right)
2118 m_paperBorderTop=top;
2119 m_paperBorderLeft=left;
2120 m_paperBorderBottom=bottom;
2121 m_paperBorderRight=right;
2125bool OOWriterWorker::doFullPaperFormatOther (
const int columns,
const double columnspacing,
const int numPages )
2127 m_columns = columns;
2128 m_columnspacing = columnspacing;
2129 m_numPages = numPages;
2133bool OOWriterWorker::doFullDocumentInfo(
const KWEFDocumentInfo& docInfo)
2147bool OOWriterWorker::doDeclareNonInlinedFramesets( TQValueList<FrameAnchor>& pictureAnchors, TQValueList<FrameAnchor>& tableAnchors )
2149 m_nonInlinedPictureAnchors = pictureAnchors;
2150 m_nonInlinedTableAnchors = tableAnchors;
2154void OOWriterWorker::declareFont(
const TQString& fontName)
2156 if (fontName.isEmpty())
2159 if (m_fontNames.find(fontName)==m_fontNames.end())
2165 TQFont font(fontName);
2166 TQFontInfo info(font);
2167 props+=
"style:font-family-generic=\""
2168 switch (info.styleHint())
2170 case TQFont::SansSerif:
2181 case TQFont::Courier:
2186 case TQFont::OldEnglish:
2188 props +=
"decorative";
2195 props +=
"style:font-pitch=\"variable\"";
2197 m_fontNames[fontName]=props;
2201TQString OOWriterWorker::makeAutomaticStyleName(
const TQString& prefix, ulong& counter)
const
2203 const TQString str (prefix + TQString::number(++counter,10));
2208 if (m_styleMap.find(str)==m_styleMap.end())
2211 TQString str2(str+
"_bis");
2212 if (m_styleMap.find(str2)==m_styleMap.end())
2216 if (m_styleMap.find(str2)==m_styleMap.end())
2220 const TQDateTime dt(TQDateTime::currentDateTime(TQt::UTC));
2222 str2 = str +
"_" + TQString::number(dt.toTime_t(),16);
2223 if (m_styleMap.find(str2)==m_styleMap.end())
2226 kdWarning(30518) <<
"Could not make an unique style name: " << str2 << endl;
@ NUM_CHAPTER
Numbered as a heading.
This is basically <FRAMESET> tag.
KoPictureKey key
Picture key.
double lineSpacing
Space between lines in pt, if lineSpacingType==0.
TabulatorList tabulatorList
List of tabulators.
double indentFirst
indentation correction of first line (can be negative!)
double indentRight
right indentation (a negative value means invalid)
double indentLeft
left indentation (a negative value means invalid)
TQString alignment
left, right, center, justify
int lineSpacingType
0=custom, 10=one line, 15=one and half lines, 20= 2 lines
double marginTop
space before the paragraph (a negative value means invalid)
double marginBottom
space after the paragraph (a negative value means invalid)
TextFormatting is a container for data retrieved from the <FORMAT> tag and its subtags to be used in ...
bool underlineWord
true if word-by-word (i.e spaces are not underlined)
bool underline
Any underline? (If true, we do not know if simple or double or what else)
TQString language
Language code.
TQColor underlineColor
color of the line
bool strikeout
true if strikeout
TQString underlineStyle
underline style: solid, dash, dot dash, ....
TQString underlineValue
"value" of the underline: single, double, bold-single...
TQString strikeoutType
type of strikeout: single, bold, double
TQString getFootnoteValue(void) const
Get the value (counter) of the footnote.
bool getFootnoteType(void) const
Get type of footnote.
TQValueList< ParaData > * getFootnotePara(void) const
Paragrapgh of the footnote.
TQString getGenericData(const TQString &key) const
Get generic variable data.
see <VARIABLESETTINGS> in the KWord DTD