summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2009-07-08 23:37:34 -0400
committerKohei Yoshida <kyoshida@novell.com>2009-07-08 23:37:34 -0400
commitcca16968ff3c807b13729b565c50572e73754950 (patch)
treee7a453a6bbfd4567ad3fbb5fd880eb1eadcdfdc6
parent0b1faa284cd715cd82952c7beb39669fed4c88ba (diff)
More work on dimensions and hierarchies.
-rw-r--r--cmake/CMakeLists.txt1
-rw-r--r--inc/dpdimension.hxx63
-rw-r--r--inc/dphierarchies.hxx71
-rw-r--r--source/dpdimension.cxx108
-rw-r--r--source/dphierarchies.cxx113
5 files changed, 354 insertions, 2 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index e7a6552..4e51731 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -29,6 +29,7 @@ set(SRC_FILES
../source/dpsource.cxx
../source/dpdimensions.cxx
../source/dpdimension.cxx
+ ../source/dphierarchies.cxx
)
add_library(${TARGET_NAME} SHARED ${SRC_FILES})
diff --git a/inc/dpdimension.hxx b/inc/dpdimension.hxx
index f8a3350..de699f6 100644
--- a/inc/dpdimension.hxx
+++ b/inc/dpdimension.hxx
@@ -1,13 +1,17 @@
#ifndef __DPDIMENSION_HXX__
#define __DPDIMENSION_HXX__
-#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/sheet/XHierarchiesSupplier.hpp>
namespace dpsource {
-class DPDimension : public cppu::WeakImplHelper1<
+class DPDimension : public cppu::WeakImplHelper3<
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::sheet::XHierarchiesSupplier,
::com::sun::star::container::XNamed >
{
public:
@@ -21,7 +25,62 @@ public:
void SAL_CALL setName(const ::rtl::OUString& aName)
throw (::com::sun::star::uno::RuntimeException);
+ // XHierarchiesSupplier
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameAccess > SAL_CALL
+ getHierarchies() throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getPropertyValue(const ::rtl::OUString& aPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ mxHierarchies;
::rtl::OUString maName;
};
diff --git a/inc/dphierarchies.hxx b/inc/dphierarchies.hxx
new file mode 100644
index 0000000..08bd84f
--- /dev/null
+++ b/inc/dphierarchies.hxx
@@ -0,0 +1,71 @@
+#ifndef __DPHIEARCHIES_HXX__
+#define __DPHIEARCHIES_HXX__
+
+#include <cppuhelper/implbase2.hxx>
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+
+#include <hash_map>
+
+namespace com { namespace sun { namespace star {
+ namespace container {
+ class XNamed;
+ }
+}}}
+
+namespace dpsource {
+
+class DPHierarchies : public ::cppu::WeakImplHelper2<
+ ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::container::XIndexAccess >
+{
+public:
+ DPHierarchies();
+ ~DPHierarchies();
+
+ // XNameAccess
+
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const ::rtl::OUString& aName)
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getElementNames() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& aName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+
+ virtual sal_Int32 SAL_CALL getCount()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+private:
+ void init();
+
+private:
+ typedef ::__gnu_cxx::hash_map<
+ ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed >, ::rtl::OUStringHash >
+ HierarchyMapType;
+ HierarchyMapType maHierarchies;
+};
+
+
+}
+
+
+
+#endif
diff --git a/source/dpdimension.cxx b/source/dpdimension.cxx
index 1cf7716..097778d 100644
--- a/source/dpdimension.cxx
+++ b/source/dpdimension.cxx
@@ -1,19 +1,72 @@
#include "dpdimension.hxx"
+#include "dphierarchies.hxx"
+using ::com::sun::star::beans::XPropertyChangeListener;
+using ::com::sun::star::beans::XVetoableChangeListener;
+using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::lang::WrappedTargetException;
+using ::com::sun::star::beans::PropertyVetoException;
+using ::com::sun::star::beans::UnknownPropertyException;
+using ::com::sun::star::beans::XPropertySetInfo;
+using ::com::sun::star::container::XNameAccess;
using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
using ::rtl::OUString;
+
+#include <stdio.h>
+#include <string>
+#include <sys/time.h>
+
+namespace {
+
+class StackPrinter
+{
+public:
+ explicit StackPrinter(const char* msg) :
+ msMsg(msg)
+ {
+ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
+ mfStartTime = getTime();
+ }
+
+ ~StackPrinter()
+ {
+ double fEndTime = getTime();
+ fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
+ }
+
+private:
+ double getTime() const
+ {
+ timeval tv;
+ gettimeofday(&tv, NULL);
+ return tv.tv_sec + tv.tv_usec / 1000000.0;
+ }
+
+ ::std::string msMsg;
+ double mfStartTime;
+};
+
+}
+
namespace dpsource {
DPDimension::DPDimension()
{
+ fprintf(stdout, "DPDimension::DPDimension: ctor\n");
}
DPDimension::~DPDimension()
{
+ fprintf(stdout, "DPDimension::~DPDimension: dtor\n");
}
+// XNamed
+
OUString DPDimension::getName() throw (RuntimeException)
{
return maName;
@@ -24,4 +77,59 @@ void DPDimension::setName(const OUString& aName) throw (RuntimeException)
maName = aName;
}
+// XHierarchiesSupplier
+
+Reference<XNameAccess> DPDimension::getHierarchies() throw (RuntimeException)
+{
+ StackPrinter __stack_printer__("dpsource/DPDimension::getHierarchies");
+ if (!mxHierarchies.is())
+ mxHierarchies.set(new DPHierarchies);
+ return mxHierarchies;
+}
+
+// XPropertySet
+
+Reference<XPropertySetInfo> DPDimension::getPropertySetInfo() throw (RuntimeException)
+{
+ return Reference<XPropertySetInfo>();
+}
+
+void DPDimension::setPropertyValue(const OUString& aPropertyName, const Any& aValue)
+ throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ StackPrinter __stack_printer__("dpsource/DPDimension::setPropertyValue");
+ fprintf(stdout, "DPDimension::setPropertyValue: prop name = '%s'\n", rtl::OUStringToOString(aPropertyName, RTL_TEXTENCODING_UTF8).getStr());
+}
+
+Any DPDimension::getPropertyValue(const OUString& aPropertyName)
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ fprintf(stdout, "DPDimension::getPropertyValue: prop name = '%s'\n", rtl::OUStringToOString(aPropertyName, RTL_TEXTENCODING_UTF8).getStr());
+ return Any();
+}
+
+void DPDimension::addPropertyChangeListener(
+ const OUString& aPropertyName, const Reference<XPropertyChangeListener>& xListener)
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void DPDimension::removePropertyChangeListener(
+ const OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener)
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void DPDimension::addVetoableChangeListener(
+ const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener)
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void DPDimension::removeVetoableChangeListener(
+ const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener)
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
}
diff --git a/source/dphierarchies.cxx b/source/dphierarchies.cxx
new file mode 100644
index 0000000..6e49c43
--- /dev/null
+++ b/source/dphierarchies.cxx
@@ -0,0 +1,113 @@
+
+#include "dphierarchies.hxx"
+
+#include <com/sun/star/container/XNamed.hpp>
+
+using ::com::sun::star::container::NoSuchElementException;
+using ::com::sun::star::container::XNameAccess;
+using ::com::sun::star::container::XNamed;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+using ::com::sun::star::lang::WrappedTargetException;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Type;
+using ::rtl::OUString;
+
+
+#include <stdio.h>
+#include <string>
+#include <sys/time.h>
+
+namespace {
+
+class StackPrinter
+{
+public:
+ explicit StackPrinter(const char* msg) :
+ msMsg(msg)
+ {
+ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
+ mfStartTime = getTime();
+ }
+
+ ~StackPrinter()
+ {
+ double fEndTime = getTime();
+ fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
+ }
+
+private:
+ double getTime() const
+ {
+ timeval tv;
+ gettimeofday(&tv, NULL);
+ return tv.tv_sec + tv.tv_usec / 1000000.0;
+ }
+
+ ::std::string msMsg;
+ double mfStartTime;
+};
+
+}
+
+namespace dpsource {
+
+DPHierarchies::DPHierarchies()
+{
+ init();
+}
+
+DPHierarchies::~DPHierarchies()
+{
+}
+
+void DPHierarchies::init()
+{
+}
+
+Any DPHierarchies::getByName(const OUString& aName)
+ throw (NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ StackPrinter __stack_printer__("dpsource/DPHierarchies::getByName");
+ fprintf(stdout, "DPHierarchies::getByName: name = '%s'\n", rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
+ throw NoSuchElementException();
+ return Any();
+}
+
+Sequence<OUString> DPHierarchies::getElementNames() throw (RuntimeException)
+{
+ Sequence<OUString> aNames(1);
+ aNames[0] = OUString::createFromAscii("flat");
+ return aNames;
+}
+
+sal_Bool DPHierarchies::hasByName(const OUString& aName) throw (RuntimeException)
+{
+ return false;
+}
+
+Type DPHierarchies::getElementType() throw (RuntimeException)
+{
+ return getCppuType(static_cast< Reference<XNamed>* >(NULL));
+}
+
+sal_Bool DPHierarchies::hasElements() throw (RuntimeException)
+{
+ return false;
+}
+
+sal_Int32 DPHierarchies::getCount() throw (RuntimeException)
+{
+ return 0;
+}
+
+Any DPHierarchies::getByIndex(sal_Int32 nIndex)
+ throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ StackPrinter __stack_printer__("dpsource/DPHierarchies::getByIndex");
+ return Any();
+}
+
+}