Removed some FIXMEs. Added translations
2 #include <qtextstream.h>
3 #include <qmessagebox.h>
8 /////////////////////////////////////////////////////////////////
10 /////////////////////////////////////////////////////////////////
17 NoteObj::NoteObj(const QString &s)
23 void NoteObj::copy (NoteObj other)
26 fonthint=other.fonthint;
37 void NoteObj::setNote (const QString &s)
42 QString NoteObj::getNote()
47 QString NoteObj::getNoteASCII()
51 // convert all "<br*>" to "\n"
56 // convert all "</p>" to "\n"
57 re.setPattern ("</p>");
60 // remove all remaining tags
61 re.setPattern ("<.*>");
64 // If string starts with \n now, remove it.
65 // It would be wrong in an OOo export for example
66 while (r.at(0)=='\n') r.remove (0,1);
68 // convert "&", "<" and ">"
69 re.setPattern (">");
71 re.setPattern ("<");
73 re.setPattern ("&");
75 re.setPattern (""");
81 QString NoteObj::getNoteOpenDoc()
83 // Evil hack to transform QT Richtext into
84 // something which can be used in OpenDoc format
86 // TODO create clean XML transformation which also
87 // considers fonts, colors, ...
91 // convert all "<br*>"
94 r.replace (re,"<text:line-break/>");
97 re.setPattern ("<p>");
98 r.replace (re,"<text:line-break/>");
100 // Remove all other tags, e.g. paragraphs will be added in
101 // templates used during export
102 re.setPattern ("</?html.*>");
104 re.setPattern ("</?head.*>");
106 re.setPattern ("</?body.*>");
108 re.setPattern ("</?meta.*>");
110 re.setPattern ("</?span.*>");
112 re.setPattern ("</?p.*>");
115 r="<text:span text:style-name=\"vym-notestyle\">"+r+"</text:span>";
119 void NoteObj::setFontHint (const QString &s)
121 // only for backward compatibility (pre 1.5 )
125 QString NoteObj::getFontHint()
127 // only for backward compatibility (pre 1.5 )
131 void NoteObj::setFilenameHint (const QString &s)
136 QString NoteObj::getFilenameHint()
141 bool NoteObj::isEmpty ()
143 return note.isEmpty();
146 QString NoteObj::saveToDir ()
148 // QTextEdit may generate fontnames with unquoted &, like
149 // in "Lucida B&H". This is invalid in XML and thus would crash
152 bool inbracket=false;
155 while (pos<n.length())
157 if (n.mid(pos,1)=="<") inbracket=true;
158 if (n.mid(pos,1)==">") inbracket=false;
159 if (n.mid(pos,1)=="\"" && inbracket)
166 if (n.mid(pos,1)=="&" && inquot)
168 // Now we are inside < " " >
169 n.replace(pos,1,"&");
174 return beginElement ("htmlnote",attribut("fonthint",fonthint)) + "\n"+ n+ "\n" +endElement ("htmlnote");