summaryrefslogtreecommitdiff
path: root/source/dphierarchies.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'source/dphierarchies.cxx')
-rw-r--r--source/dphierarchies.cxx22
1 files changed, 19 insertions, 3 deletions
diff --git a/source/dphierarchies.cxx b/source/dphierarchies.cxx
index 6e49c43..9b4a6b6 100644
--- a/source/dphierarchies.cxx
+++ b/source/dphierarchies.cxx
@@ -1,5 +1,6 @@
#include "dphierarchies.hxx"
+#include "dphierarchy.hxx"
#include <com/sun/star/container/XNamed.hpp>
@@ -65,6 +66,14 @@ DPHierarchies::~DPHierarchies()
void DPHierarchies::init()
{
+ maHierarchies.clear();
+
+ // For now, only create a 'flat' hierarchy.
+ OUString aName = OUString::createFromAscii("flat");
+ Reference<XNamed> xFlatHier(new DPHierarchy);
+ xFlatHier->setName(aName);
+ maHierarchies.insert(
+ NamedObjMapType::value_type(aName, xFlatHier));
}
Any DPHierarchies::getByName(const OUString& aName)
@@ -72,6 +81,13 @@ Any DPHierarchies::getByName(const OUString& aName)
{
StackPrinter __stack_printer__("dpsource/DPHierarchies::getByName");
fprintf(stdout, "DPHierarchies::getByName: name = '%s'\n", rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
+ NamedObjMapType::const_iterator itr = maHierarchies.find(aName);
+ if (itr != maHierarchies.end())
+ {
+ Any any;
+ any <<= itr->second;
+ return any;
+ }
throw NoSuchElementException();
return Any();
}
@@ -85,7 +101,7 @@ Sequence<OUString> DPHierarchies::getElementNames() throw (RuntimeException)
sal_Bool DPHierarchies::hasByName(const OUString& aName) throw (RuntimeException)
{
- return false;
+ return maHierarchies.count(aName) > 0;
}
Type DPHierarchies::getElementType() throw (RuntimeException)
@@ -95,12 +111,12 @@ Type DPHierarchies::getElementType() throw (RuntimeException)
sal_Bool DPHierarchies::hasElements() throw (RuntimeException)
{
- return false;
+ return !maHierarchies.empty();
}
sal_Int32 DPHierarchies::getCount() throw (RuntimeException)
{
- return 0;
+ return maHierarchies.size();
}
Any DPHierarchies::getByIndex(sal_Int32 nIndex)