Spanish doc is found, if LANG is set. Fixed wrong position of floatimages
1 #include "ornamentedobj.h"
2 #include "texteditor.h"
4 #include "linkablemapobj.h"
6 extern TextEditor *textEditor;
7 extern FlagRowObj *systemFlagsDefault;
8 extern FlagRowObj *standardFlagsDefault;
11 /////////////////////////////////////////////////////////////////
13 /////////////////////////////////////////////////////////////////
15 OrnamentedObj::OrnamentedObj():LinkableMapObj()
17 // cout << "Const OrnamentedObj ()\n";
21 OrnamentedObj::OrnamentedObj(Q3Canvas* c) :LinkableMapObj(c)
23 // cout << "Const OrnamentedObj\n";
27 OrnamentedObj::OrnamentedObj (OrnamentedObj* lmo) : LinkableMapObj (lmo->canvas)
32 OrnamentedObj::~OrnamentedObj()
36 delete (standardFlags);
41 void OrnamentedObj::init ()
43 heading = new HeadingObj(canvas);
44 heading->move (absPos.x(), absPos.y());
47 note.setFontHint (textEditor->getFontHintDefault() );
49 systemFlags=new FlagRowObj(canvas);
50 systemFlags->clone(systemFlagsDefault);
51 systemFlags->setName ("systemFlags");
53 standardFlags=new FlagRowObj(canvas);
54 standardFlags->clone(standardFlagsDefault);
55 standardFlags->setName ("standardFlags");
65 void OrnamentedObj::copy (OrnamentedObj* other)
67 LinkableMapObj::copy(other);
68 heading->copy(other->heading);
69 setColor (other->heading->getColor());
71 note.copy (other->note);
72 systemFlags->copy (other->systemFlags);
73 standardFlags->copy (other->standardFlags);
75 ornamentsBBox=other->ornamentsBBox;
77 hideExport=other->hideExport;
79 vymLink=other->vymLink;
82 QString OrnamentedObj::getHeading()
84 return heading->text();
87 void OrnamentedObj::setLinkColor()
89 if (mapEditor->getLinkColorHint()==HeadingColor)
90 LinkableMapObj::setLinkColor (heading->getColor());
92 LinkableMapObj::setLinkColor (mapEditor->getDefLinkColor());
95 void OrnamentedObj::setColor (QColor col)
97 heading->setColor(col);
101 QColor OrnamentedObj::getColor ()
103 return heading->getColor();
107 void OrnamentedObj::positionContents()
109 double d=frame->getBorder()/2;
113 double ox,oy; // Offset due to padding
118 systemFlags-> move (ox +x , oy + y );
120 // vertical align heading to bottom
121 heading->move (ox + x + systemFlags->getBBox().width(),
122 oy + y + ornamentsBBox.height() - heading->getHeight()
124 standardFlags->move (ox +x + heading->getWidth() + systemFlags->getBBox().width() , oy + y );
126 ornamentsBBox.moveTopLeft ( QPoint ((int)(ox+x),(int)(oy+y)));
127 clickBox.moveTopLeft (QPoint ((int)(ox + x), (int)(oy + y)));
130 void OrnamentedObj::move (double x, double y)
138 void OrnamentedObj::move (QPoint p)
143 void OrnamentedObj::moveBy (double x, double y)
146 MapObj::moveBy (x,y);
148 systemFlags->moveBy (x,y);
149 standardFlags->moveBy (x,y);
150 heading->moveBy (x,y);
155 void OrnamentedObj::moveBy (QPoint p)
157 moveBy (p.x(), p.y());
160 void OrnamentedObj::move2RelPos(double x, double y)
162 setRelPos (QPoint((int)x,(int)y));
165 QPoint p=parObj->getChildPos();
166 move (p.x()+x, p.y() +y);
170 void OrnamentedObj::move2RelPos(QPoint p)
172 move2RelPos (p.x(),p.y());
175 void OrnamentedObj::setNote(QString s)
179 systemFlags->activate("note");
181 systemFlags->deactivate("note");
184 move (absPos.x(), absPos.y() );
188 void OrnamentedObj::setNote(NoteObj n)
192 systemFlags->activate("note");
194 systemFlags->deactivate("note");
197 move (absPos.x(), absPos.y() );
202 QString OrnamentedObj::getNote()
204 return note.getNote();
207 QString OrnamentedObj::getNoteASCII()
209 return note.getNoteASCII();
212 QString OrnamentedObj::getNoteOpenDoc()
214 return note.getNoteOpenDoc();
217 void OrnamentedObj::setURL(QString s)
221 systemFlags->activate("url");
223 systemFlags->deactivate("url");
224 calcBBoxSize(); // recalculate bbox
225 positionBBox(); // rearrange contents
229 QString OrnamentedObj::getURL()
234 void OrnamentedObj::setVymLink(QString s)
238 // We need the relative (from loading)
239 // or absolute path (from User event)
240 // and build the absolute path.
241 // Note: If we have relative, use path of
242 // current map to build absolute path
244 if (!d.path().startsWith ("/"))
246 QString p=mapEditor->getDestPath();
247 int i=p.findRev("/",-1);
248 d.setPath(p.left(i)+"/"+s);
252 systemFlags->activate("vymLink");
256 systemFlags->deactivate("vymLink");
259 calcBBoxSize(); // recalculate bbox
260 positionBBox(); // rearrange contents
264 QString OrnamentedObj::getVymLink()
270 void OrnamentedObj::toggleStandardFlag(QString f, bool exclusive)
272 standardFlags->toggle(f,exclusive);
275 move (absPos.x(), absPos.y() );
279 void OrnamentedObj::activateStandardFlag(QString f)
281 standardFlags->activate(f);
284 move (absPos.x(), absPos.y() );
288 void OrnamentedObj::deactivateStandardFlag(QString f)
290 standardFlags->deactivate(f);
293 move (absPos.x(), absPos.y() );
297 bool OrnamentedObj::isSetStandardFlag (QString f)
299 return standardFlags->isActive(f);
302 QString OrnamentedObj::getSystemFlagName(const QPoint &p)
304 return systemFlags->getFlagName(p);
307 bool OrnamentedObj::isActiveFlag (const QString & fname)
309 if (standardFlags->isActive (fname) ) return true;
313 void OrnamentedObj::updateNoteFlag()
317 // text in NoteEditor has changed, notify MapEditor
318 mapEditor->setChanged();
321 setNote( textEditor->getText() );
324 note.setFontHint (textEditor->getFontHint() );
328 void OrnamentedObj::updateFlagsToolbar()
330 standardFlags->updateToolbar();
333 void OrnamentedObj::setHideInExport(bool b)
337 // Don't allow to MapCenter to be hidden
340 systemFlags->activate("hideInExport");
342 systemFlags->deactivate("hideInExport");
349 bool OrnamentedObj::hideInExport()
354 bool OrnamentedObj::isHidden()
359 QString OrnamentedObj::getOrnAttr()
365 attribut("absPosX",QString().setNum(absPos.x(),10)) +
366 attribut("absPosY",QString().setNum(absPos.y(),10));
369 if (depth==1 || typeid (*this)==typeid (FloatImageObj))
371 attribut("relPosX",QString().setNum(relPos.x(),10)) +
372 attribut("relPosY",QString().setNum(relPos.y(),10));
379 urlAttr=attribut ("url",url);
382 if (!vymLink.isEmpty())
383 vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) );
387 hideExpAttr= attribut("hideInExport","true");
391 return posAttr +urlAttr +vymLinkAttr +getLinkAttr() +hideExpAttr;