2 * Copyright 2006-2007, Haiku.
3 * Distributed under the terms of the MIT License.
6 * Stephan Aßmus <superstippi@gmx.de>
12 #include "CommandStack.h"
13 #include "DocumentSaver.h"
15 #include "PathContainer.h"
16 #include "Selection.h"
17 #include "ShapeContainer.h"
18 #include "StyleContainer.h"
31 Document::Document(const char* name
)
32 : RWLocker("document rw lock"),
33 fIcon(new (nothrow
) _ICON_NAMESPACE
Icon()),
34 fCommandStack(new (nothrow
) ::CommandStack()),
35 fSelection(new (nothrow
) ::Selection()),
49 fIcon
->ReleaseReference();
56 Document::SetName(const char* name
)
67 Document::Name() const
69 return fName
.String();
74 Document::SetNativeSaver(::DocumentSaver
* saver
)
82 Document::SetExportSaver(::DocumentSaver
* saver
)
90 Document::SetIcon(_ICON_NAMESPACE Icon
* icon
)
95 fIcon
->ReleaseReference();
99 // we don't acquire, since we own the icon
104 Document::MakeEmpty(bool includingSavers
)
106 fCommandStack
->Clear();
107 fSelection
->DeselectAll();
110 if (includingSavers
) {
120 Document::IsEmpty() const
122 return fIcon
->Styles()->CountStyles() == 0
123 && fIcon
->Paths()->CountPaths() == 0
124 && fIcon
->Shapes()->CountShapes() == 0;