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

List:       koffice-devel
Subject:    kword's libexport
From:       "Johannes Wilm" <j () indymedia ! no>
Date:       2003-06-26 0:14:56
[Download RAW message or body]

Hi,
I have gotten table support working at least partially in the RTF-export
filter. Now I really don't know much about C++ but I need some more info
about the FRAME-tag through libexport as I mentioned earlier. The
following patch gives me that information, but it is done totally wrong
(handing me a QValueList with one element) so if someone who knows
libexport can fix it to give the same information in a sane I would be
very pleased. Also, the RTF-export filter would then immediatly gain
table-support.

Johannes Wilm

--- KWEFKWordLeader.cc	2003-06-26 01:58:58.000000000 +0200
+++ KWEFKWordLeader.cc.new	2003-06-25 21:28:37.000000000 +0200
@@ -133,6 +133,74 @@
 }


+static void ProcessTableFrameTag ( QDomNode myNode, void *tagData, +
KWEFKWordLeader *leader )
+{
+
+    QValueList<FrameData> *frameList = (QValueList<FrameData> *)
tagData; +//    FrameData* frameData = (FrameData*) tagData;
+    //TableFrameData frameData;
+    FrameData frameData;
+
+    QValueList<AttrProcessing> attrProcessingList;
+    attrProcessingList
+        << AttrProcessing ( "runaround", "double",
&frameData.frame.runaround )
+	<< AttrProcessing ( "min-height", "double",
&frameData.frame.minDASHheight )
+	<< AttrProcessing ( "runaroundSide", "double",
&frameData.frame.runaroundSide )
+	<< AttrProcessing ( "runaroundGap", "double",
&frameData.frame.runaroundGap )
+	<< AttrProcessing ( "autoCreateNewFrame", "double",
&frameData.frame.autoCreateNewFrame )
+	<< AttrProcessing ( "newFrameBehavior", "double",
&frameData.frame.newFrameBehavior )
+	<< AttrProcessing ( "copy", "double",  &frameData.frame.copy )
+	<< AttrProcessing ( "sheetSide", "double",  &frameData.frame.sheetSide
) +
+        << AttrProcessing ( "top",       "double",
&frameData.frame.top
  )
+        << AttrProcessing ( "bottom",    "double",
&frameData.frame.bottom )
+        << AttrProcessing ( "left",      "double",
&frameData.frame.left
  )
+        << AttrProcessing ( "right",     "double",
&frameData.frame.right  )
+
+	<< AttrProcessing ( "bbottompt",     "double",
&frameData.frame.bbottompt  )
+        << AttrProcessing ( "btoppt",     "double",
&frameData.frame.btoppt  )
+        << AttrProcessing ( "brightpt",     "double",
&frameData.frame.brightpt  )
+	<< AttrProcessing ( "bleftpt",     "double",  &frameData.frame.bleftpt
 ) +
+	<< AttrProcessing ( "lWidth",     "double",  &frameData.frame.lWidth
) +	<< AttrProcessing ( "rWidth",     "double",  &frameData.frame.rWidth
 ) +	<< AttrProcessing ( "tWidth",     "double",
&frameData.frame.tWidth  ) +	<< AttrProcessing ( "bWidth",     "double",
 &frameData.frame.bWidth  ) +
+	<< AttrProcessing ( "lRed",     "double",  &frameData.frame.lRed  )
+	<< AttrProcessing ( "rRed",     "double",  &frameData.frame.rRed  )
+	<< AttrProcessing ( "tRed",     "double",  &frameData.frame.tRed  )
+	<< AttrProcessing ( "bRed",     "double",  &frameData.frame.bRed  ) +
+	<< AttrProcessing ( "lBlue",     "double",  &frameData.frame.lBlue  )
+	<< AttrProcessing ( "rBlue",     "double",  &frameData.frame.rBlue  )
+	<< AttrProcessing ( "tBlue",     "double",  &frameData.frame.tBlue  )
+	<< AttrProcessing ( "bBlue",     "double",  &frameData.frame.bBlue  )
+
+	<< AttrProcessing ( "lGreen",     "double",  &frameData.frame.lGreen
) +	<< AttrProcessing ( "rGreen",     "double",  &frameData.frame.rGreen
 ) +	<< AttrProcessing ( "tGreen",     "double",
&frameData.frame.tGreen  ) +	<< AttrProcessing ( "bGreen",     "double",
 &frameData.frame.bGreen  ) +
+	<< AttrProcessing ( "lStyle",     "double",  &frameData.frame.lStyle
) +	<< AttrProcessing ( "rStyle",     "double",  &frameData.frame.rStyle
 ) +	<< AttrProcessing ( "tStyle",     "double",
&frameData.frame.tStyle  ) +	<< AttrProcessing ( "bStyle",     "double",
 &frameData.frame.bStyle  ) +
+	<< AttrProcessing ( "bkRed",     "double",  &frameData.frame.bkRed  )
+	<< AttrProcessing ( "bkBlue",     "double",  &frameData.frame.bkBlue
) +	<< AttrProcessing ( "bkGreen",     "double",
&frameData.frame.bkGreen  ) +	<< AttrProcessing ( "bkStyle",
"double",  &frameData.frame.bkStyle  ) +	;
+    ProcessAttributes (myNode, attrProcessingList);
+
+    AllowNoSubtags (myNode, leader);
+
+    *frameList << frameData;
+
+}
+
 static void ProcessFrameTag ( QDomNode myNode, void *tagData,
     KWEFKWordLeader *leader )
 {

@@ -299,15 +367,15 @@
                         if ( frameAnchor )
                         {
                             frameAnchor->type = 6;
-
                             QValueList<ParaData> cellParaList;
+			    QValueList<FrameData> cellFrameList;

                             QValueList<TagProcessing>
tagProcessingList;
-                            tagProcessingList << TagProcessing (
"FRAME",
    ProcessFrameTag,     frameAnchor   )
+                            tagProcessingList << TagProcessing (
"FRAME",
    ProcessTableFrameTag, &cellFrameList )
                                               << TagProcessing (
"PARAGRAPH",
ProcessParagraphTag,
&cellParaList );
                             ProcessSubtags (myNode, tagProcessingList,
leader);

-                            frameAnchor->table.addCell (col, row,
cellParaList);
+                            frameAnchor->table.addCell (col, row,
cellParaList, cellFrameList);
                         }
                         else
                         {

--- KWEFStructures.h	2003-06-26 01:58:58.000000000 +0200
+++ KWEFStructures.h.new	2003-06-25 21:30:13.000000000 +0200
@@ -110,21 +110,24 @@


 class ParaData;
+class FrameData;

 class TableCell
 {
    public:
-      TableCell (): col( 0 ), row( 0 ), paraList( 0 ) {}
+      TableCell (): col( 0 ), row( 0 ), paraList( 0 ), frameList( 0 )
{}

       TableCell ( int                   c,
                   int                   r,
-                  QValueList<ParaData> *p  ) : col (c), row (r),
paraList (p) {}
+                  QValueList<ParaData> *p,
+		  QValueList<FrameData> *f ) : col (c), row (r), paraList (p),
frameList (f) {}

       ~TableCell ();

       int                   col;
       int                   row;
       QValueList<ParaData> *paraList;
+      QValueList<FrameData> *frameList;
 };


@@ -135,7 +138,8 @@

       void addCell ( int                   c,
                      int                   r,
-                     QValueList<ParaData> &p  );
+                     QValueList<ParaData> &p,
+		     QValueList<FrameData> &f );

       int                   cols;
       QValueList<TableCell> cellList;
@@ -389,6 +393,59 @@
     TabulatorList tabulatorList; // List of tabulators
 };

+// Frame data
+class TableFrameData
+{
+public:
+    TableFrameData():runaround(0.0), minDASHheight(0.0),
runaroundSide(0.0), runaroundGap(0.0), autoCreateNewFrame(0.0),
newFrameBehavior(0.0), copy(0.0), sheetSide(0.0), top(0.0), bottom(0.0),
left(0.0), right(0.0), bbottompt(0.0), btoppt(0.0), brightpt(0.0),
bleftpt(0.0), lWidth(0.0), rWidth(0.0), bWidth(0.0), tWidth(0.0),
lRed(0.0), rRed(0.0), bRed(0.0), tRed(0.0), lGreen(0.0), rGreen(0.0),
bGreen(0.0), tGreen(0.0), lBlue(0.0), rBlue(0.0), bBlue(0.0),
tBlue(0.0), lStyle(0.0), rStyle(0.0), bStyle(0.0), tStyle(0.0),
bkRed(0.0),
bkGreen(0.0), bkBlue(0.0), bkStyle(0.0)
+        { }
+
+
+    enum { LS_CUSTOM = 0, LS_SINGLE = 10, LS_ONEANDHALF = 15, LS_DOUBLE
= 20,
+      LS_ATLEAST = 30, LS_MULTIPLE = 40 };
+
+    double      runaround;
+    double      minDASHheight;
+    double      runaroundSide;
+    double      runaroundGap;
+    double      autoCreateNewFrame;
+    double      newFrameBehavior;
+    double      copy;
+    double      sheetSide;
+    double      top;
+    double      bottom;
+    double      left;
+    double      right;
+    double      bbottompt;
+    double      btoppt;
+    double      brightpt;
+    double      bleftpt;
+    double      lWidth;
+    double      rWidth;
+    double      bWidth;
+    double      tWidth;
+    double      lRed;
+    double      rRed;
+    double      bRed;
+    double      tRed;
+    double      lGreen;
+    double      rGreen;
+    double      bGreen;
+    double      tGreen;
+    double      lBlue;
+    double      rBlue;
+    double      bBlue;
+    double      tBlue;
+    double      lStyle;
+    double      rStyle;
+    double      bStyle;
+    double      tStyle;
+    double      bkRed;
+    double      bkGreen;
+    double      bkBlue;
+    double      bkStyle;
+
+};

 struct ParaData
 {
@@ -397,6 +454,11 @@
     LayoutData                 layout;
 };

+struct FrameData
+{
+    TableFrameData                 frame;
+};
+
 struct HeaderFooterData
 {
     enum HeaderFooterPage

--- KWEFStructures.cc	2003-06-26 01:58:58.000000000 +0200
+++ KWEFStructures.cc.new	2003-06-25 12:04:32.000000000 +0200
@@ -43,14 +43,15 @@

 void Table::addCell ( int                   c,
                       int                   r,
-                      QValueList<ParaData> &p  )
+                      QValueList<ParaData> &p,
+		      QValueList<FrameData> &f  )
 {
    if ( c + 1 > cols )
    {
       cols = c + 1;
    }

-   cellList << TableCell ( c, r, new QValueList<ParaData> (p) );
+   cellList << TableCell ( c, r, new QValueList<ParaData> (p), new
QValueList<FrameData> (f) );
 }

 bool TabulatorData::operator == (const TabulatorData& other) const


_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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