3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 05/28/2010 Added this text. :-)
15 // JLH 09/09/2010 Removed implementation from header (where it DOESN'T
16 // belong) and moved it here (where it DOES)
19 #include "clipboard.h"
25 Clipboard * Clipboard::uniqueInstance = NULL;
27 void Clipboard::clear()
30 graphic.clearBlocks();
31 graphic.clearLayers();
32 graphic.clearVariables();
35 void Clipboard::addBlock(Block * b)
38 graphic.addBlock(b, false);
41 bool Clipboard::hasBlock(const QString & name)
43 return (graphic.findBlock(name) != NULL);
46 void Clipboard::addLayer(Layer * l)
52 bool Clipboard::hasLayer(const QString & name)
54 return (graphic.findLayer(name) != NULL);
57 void Clipboard::addEntity(Entity * e)
62 e->reparent(&graphic);
67 * Dumps the clipboard contents to stdout.
69 std::ostream & operator<<(std::ostream & os, Clipboard & cb)
71 os << "Clipboard: " << cb.graphic << "\n";
75 Clipboard::Clipboard()
80 * @return Instance to the unique clipboard object.
82 /*static*/ Clipboard * Clipboard::instance()
84 if (uniqueInstance == NULL)
85 uniqueInstance = new Clipboard();
87 return uniqueInstance;
90 int Clipboard::countBlocks()
92 return graphic.countBlocks();
95 Block * Clipboard::blockAt(int i)
97 return graphic.blockAt(i);
100 int Clipboard::countLayers()
102 return graphic.countLayers();
105 Layer * Clipboard::layerAt(int i)
107 return graphic.layerAt(i);
110 uint Clipboard::count()
112 return graphic.count();
115 Entity * Clipboard::entityAt(uint i)
117 return graphic.entityAt(i);
120 Entity * Clipboard::firstEntity()
122 return graphic.firstEntity();
125 Entity * Clipboard::nextEntity()
127 return graphic.nextEntity();
130 Drawing * Clipboard::getGraphic()