summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
authorOliver Specht <os@openoffice.org>2001-02-21 11:07:20 +0000
committerOliver Specht <os@openoffice.org>2001-02-21 11:07:20 +0000
commita9d14a9d64ed1437ab25e9acec376f0c5f859fa4 (patch)
tree8366d760c5a90b6c92f8c2dd3941bd9a820f2d12 /sw/source/ui
parentb1e05f551329644d6da42bcca2022cca13d14774 (diff)
read address database configuration
Diffstat (limited to 'sw/source/ui')
-rw-r--r--sw/source/ui/config/dbconfig.cxx175
-rw-r--r--sw/source/ui/config/makefile.mk6
-rw-r--r--sw/source/ui/inc/dbconfig.hxx83
3 files changed, 262 insertions, 2 deletions
diff --git a/sw/source/ui/config/dbconfig.cxx b/sw/source/ui/config/dbconfig.cxx
new file mode 100644
index 000000000000..d3da892d4a69
--- /dev/null
+++ b/sw/source/ui/config/dbconfig.cxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * $RCSfile: dbconfig.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: os $ $Date: 2001-02-21 12:05:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "ui_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#ifndef _DBCONFIG_HXX
+#include <dbconfig.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+#ifndef _SWDBDATA_HXX
+#include <swdbdata.hxx>
+#endif
+using namespace utl;
+using namespace rtl;
+using namespace com::sun::star::uno;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor
+ --------------------------------------------------------------------*/
+
+const Sequence<OUString>& SwDBConfig::GetPropertyNames()
+{
+ static Sequence<OUString> aNames;
+ if(!aNames.getLength())
+ {
+ static const char* aPropNames[] =
+ {
+ "DataSourceName", // 0
+ "Command", // 1
+ "CommandType", // 2
+ };
+ const int nCount = 3;
+ aNames.realloc(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ }
+ return aNames;
+}
+/* -----------------------------06.09.00 16:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwDBConfig::SwDBConfig() :
+ ConfigItem(C2U("Office.DataAccess/AddressBook")),
+ pImpl(0)
+{
+};
+/* -----------------------------06.09.00 16:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwDBConfig::~SwDBConfig()
+{
+ delete pImpl;
+}
+/* -----------------------------20.02.01 12:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDBConfig::Load()
+{
+ const Sequence<OUString>& rNames = GetPropertyNames();
+ if(!pImpl)
+ {
+
+ pImpl = new SwDBData;
+ pImpl->nCommandType = 0;
+ EnableNotification(rNames);
+ }
+ Sequence<Any> aValues = GetProperties(rNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed")
+ if(aValues.getLength() == rNames.getLength())
+ {
+ for(int nProp = 0; nProp < rNames.getLength(); nProp++)
+ {
+ switch(nProp)
+ {
+ case 0: pValues[nProp] >>= pImpl->sDataSource; break;
+ case 1: pValues[nProp] >>= pImpl->sCommand; break;
+ case 3: pValues[nProp] >>= pImpl->nCommandType; break;
+ }
+ }
+ }
+}
+/* -----------------------------06.09.00 16:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDBConfig::Notify( const Sequence<rtl::OUString>& aPropertyNames)
+{
+ Load();
+}
+/* -----------------------------20.02.01 12:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const SwDBData& SwDBConfig::GetAddressSource()
+{
+ if(!pImpl)
+ Load();
+ return *pImpl;
+}
+
+
+
+
diff --git a/sw/source/ui/config/makefile.mk b/sw/source/ui/config/makefile.mk
index 6ba7db0684e7..af53d7789f43 100644
--- a/sw/source/ui/config/makefile.mk
+++ b/sw/source/ui/config/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.2 $
+# $Revision: 1.3 $
#
-# last change: $Author: os $ $Date: 2000-12-08 10:22:43 $
+# last change: $Author: os $ $Date: 2001-02-21 12:06:20 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -83,6 +83,7 @@ CXXFILES = \
barcfg.cxx \
caption.cxx \
cfgitems.cxx \
+ dbconfig.cxx \
fontcfg.cxx \
modcfg.cxx \
optins.cxx \
@@ -104,6 +105,7 @@ SLOFILES = \
$(SLO)$/barcfg.obj \
$(SLO)$/caption.obj \
$(SLO)$/cfgitems.obj \
+ $(SLO)$/dbconfig.obj \
$(SLO)$/fontcfg.obj \
$(SLO)$/modcfg.obj \
$(SLO)$/optins.obj \
diff --git a/sw/source/ui/inc/dbconfig.hxx b/sw/source/ui/inc/dbconfig.hxx
new file mode 100644
index 000000000000..4584fab6719f
--- /dev/null
+++ b/sw/source/ui/inc/dbconfig.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * $RCSfile: dbconfig.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: os $ $Date: 2001-02-21 12:05:23 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _DBCONFIG_HXX
+#define _DBCONFIG_HXX
+
+#ifndef _UTL_CONFIGITEM_HXX_
+#include <unotools/configitem.hxx>
+#endif
+struct SwDBData;
+class SwDBConfig : public utl::ConfigItem
+{
+ const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
+ SwDBData* pImpl;
+public:
+ SwDBConfig();
+ virtual ~SwDBConfig();
+
+ void Load();
+ virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
+
+ const SwDBData& GetAddressSource();
+};
+
+#endif
+