summaryrefslogtreecommitdiff
path: root/unotools/source
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 16:07:07 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 16:07:07 +0000
commit8ab086b6cc054501bfbf7ef6fa509c393691e860 (patch)
tree324d51845d7f1a2f4e02a14db22fb5947137c822 /unotools/source
parent411e68cc54ae97eebd79ae3a9cb2971b74cb2a9e (diff)
initial import
Diffstat (limited to 'unotools/source')
-rw-r--r--unotools/source/config/configitem.cxx623
-rw-r--r--unotools/source/config/configmgr.cxx268
-rw-r--r--unotools/source/config/makefile.mk103
-rw-r--r--unotools/source/i18n/charclass.cxx575
-rw-r--r--unotools/source/i18n/makefile.mk102
-rw-r--r--unotools/source/misc/datetime.cxx162
-rw-r--r--unotools/source/misc/makefile.mk112
-rw-r--r--unotools/source/processfactory/componentfactory.cxx224
-rw-r--r--unotools/source/processfactory/makefile.mk97
-rw-r--r--unotools/source/processfactory/processfactory.cxx110
-rw-r--r--unotools/source/property/makefile.mk103
-rw-r--r--unotools/source/streaming/makefile.mk106
-rw-r--r--unotools/source/streaming/streamhelper.cxx234
-rw-r--r--unotools/source/streaming/streamwrap.cxx231
14 files changed, 3050 insertions, 0 deletions
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx
new file mode 100644
index 000000000000..d4544d9753a5
--- /dev/null
+++ b/unotools/source/config/configitem.cxx
@@ -0,0 +1,623 @@
+/*************************************************************************
+ *
+ * $RCSfile: configitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+ *
+ * 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 _UTL_CONFIGITEM_HXX_
+#include "unotools/configitem.hxx"
+#endif
+#ifndef _UTL_CONFIGMGR_HXX_
+#include "unotools/configmgr.hxx"
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XCHANGESLISTENER_HPP_
+#include <com/sun/star/util/XChangesListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XCHANGESNOTIFIER_HPP_
+#include <com/sun/star/util/XChangesNotifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UTIL_XCHANGESBATCH_HPP_
+#include <com/sun/star/util/XChangesBatch.hpp>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+using namespace utl;
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#endif
+
+namespace utl{
+ class ConfigChangeListener_Impl : public cppu::WeakImplHelper1
+ <
+ com::sun::star::util::XChangesListener
+ >
+ {
+ ConfigItem* pParent;
+ public:
+ ConfigChangeListener_Impl(ConfigItem& rItem);
+ ~ConfigChangeListener_Impl();
+
+ //XChangesListener
+ virtual void SAL_CALL changesOccurred( const ChangesEvent& Event ) throw(RuntimeException);
+
+ //XEventListener
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException);
+
+ };
+}
+/* -----------------------------29.08.00 16:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigChangeListener_Impl::ConfigChangeListener_Impl(ConfigItem& rItem) :
+ pParent(&rItem)
+{
+}
+/* -----------------------------29.08.00 16:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigChangeListener_Impl::~ConfigChangeListener_Impl()
+{
+}
+/* -----------------------------29.08.00 16:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+void ConfigChangeListener_Impl::changesOccurred( const ChangesEvent& rEvent ) throw(RuntimeException)
+{
+ const ElementChange* pElementChanges = rEvent.Changes.getConstArray();
+
+ Sequence<OUString> aChangedNames(rEvent.Changes.getLength());
+ OUString* pNames = aChangedNames.getArray();
+
+ const sal_Int32 nBaseTreeLen = ConfigManager::GetConfigBaseURL().getLength() +
+ pParent->GetSubTreeName().getLength() + 1;
+ for(int i = 0; i < aChangedNames.getLength(); i++)
+ {
+ pElementChanges[i].Accessor >>= pNames[i];
+ DBG_ASSERT(nBaseTreeLen < pNames[i].getLength(),"property name incorrect");
+ pNames[i] = pNames[i].copy(nBaseTreeLen);
+ }
+ pParent->CallNotify(aChangedNames);
+}
+/* -----------------------------29.08.00 16:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigChangeListener_Impl::disposing( const EventObject& Source ) throw(RuntimeException)
+{
+ DBG_ERROR("ConfigChangeListener_Impl::disposing")
+}
+/* -----------------------------29.08.00 12:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigItem::ConfigItem(const rtl::OUString rSubTree ) :
+ pManager(ConfigManager::GetConfigManager()),
+ sSubTree(rSubTree),
+ bIsModified(sal_False),
+ bInPutValues(sal_False),
+ bHasChangedProperties(sal_False)
+{
+ xMultPrSet = pManager->AddConfigItem(*this);
+ xHierarchyAccess = Reference<XHierarchicalNameAccess>(xMultPrSet, UNO_QUERY);
+}
+/* -----------------------------29.08.00 12:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigItem::~ConfigItem()
+{
+ if(pManager)
+ {
+ if(bHasChangedProperties && xMultPrSet.is())
+ {
+ Reference<XChangesBatch> xBatch(xMultPrSet, UNO_QUERY);
+ xBatch->commitChanges();
+ }
+ RemoveListener();
+ pManager->RemoveConfigItem(*this);
+ }
+}
+/* -----------------------------29.08.00 12:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigItem::Commit()
+{
+ DBG_ERROR("Base class called")
+}
+/* -----------------------------29.08.00 12:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigItem::ReleaseConfigMgr()
+{
+ if(bHasChangedProperties && xMultPrSet.is())
+ {
+ Reference<XChangesBatch> xBatch(xMultPrSet, UNO_QUERY);
+ xBatch->commitChanges();
+ bHasChangedProperties = FALSE;
+ }
+ RemoveListener();
+ DBG_ASSERT(pManager, "ConfigManager already released")
+ pManager = 0;
+}
+/* -----------------------------29.08.00 12:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigItem::CallNotify( const com::sun::star::uno::Sequence<rtl::OUString>& rPropertyNames )
+{
+ if(!bInPutValues)
+ Notify(rPropertyNames);
+ else
+ bHasChangedProperties = TRUE;
+}
+/* -----------------------------29.08.00 12:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigItem::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& rPropertyNames)
+{
+ DBG_ERROR("Base class called")
+}
+/* -----------------------------29.08.00 15:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< Any > ConfigItem::GetProperties(const Sequence< OUString >& rNames)
+{
+ Sequence< Any > aRet(rNames.getLength());
+ const OUString* pNames = rNames.getConstArray();
+ Any* pRet = aRet.getArray();
+ if(xHierarchyAccess.is())
+ {
+ for(int i = 0; i < rNames.getLength(); i++)
+ {
+ try
+ {
+ pRet[i] = xHierarchyAccess->getByHierarchicalName(pNames[i]);
+ }
+ #ifdef DBG_UTIL
+ catch(Exception& rEx)
+ {
+ ByteString sMsg("Exception from XHierarchicalNameAccess: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+ }
+#else
+ catch(Exception&){}
+#endif
+ }
+ }
+ return aRet;
+}
+/* -----------------------------29.08.00 17:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool ConfigItem::PutProperties( const Sequence< OUString >& rNames,
+ const Sequence< Any>& rValues)
+{
+ bInPutValues = sal_True;
+ Reference<XPropertySet> xPropSet(xMultPrSet, UNO_QUERY);
+ sal_Bool bRet = xHierarchyAccess.is() && xPropSet.is();
+ if(bRet)
+ {
+ const OUString* pNames = rNames.getConstArray();
+ const Any* pValues = rValues.getConstArray();
+ for(int i = 0; i < rNames.getLength(); i++)
+ {
+ try
+ {
+ sal_Int32 nLastIndex = pNames[i].lastIndexOf( '/', pNames[i].getLength());
+
+ if(nLastIndex > 0)
+ {
+ OUString sNode = pNames[i].copy( 0, nLastIndex );
+ OUString sProperty = pNames[i].copy( nLastIndex + 1, pNames[i].getLength() - nLastIndex - 1 );
+ Any aNode = xHierarchyAccess->getByHierarchicalName(sNode);
+ Reference<XNameAccess> xNodeAcc;
+ aNode >>= xNodeAcc;
+ Reference<XNameReplace> xNodeReplace(xNodeAcc, UNO_QUERY);
+ if(xNodeReplace.is())
+ {
+ xNodeReplace->replaceByName(sProperty, pValues[i]);
+ }
+ else
+ bRet = FALSE;
+ }
+ else //direct value
+ {
+ xPropSet->setPropertyValue(pNames[i], pValues[i]);
+ }
+ }
+#ifdef DBG_UTIL
+ catch(Exception& rEx)
+ {
+ ByteString sMsg("Exception from PutProperties: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+ }
+#else
+ catch(Exception&){}
+#endif
+ }
+#if SUPD<605
+ Reference<XChangesBatch> xBatch(xMultPrSet, UNO_QUERY);
+ xBatch->commitChanges();
+
+#else
+ DBG_ERROR("does setPropertyValue work correctly now?")
+#endif
+ }
+
+ bInPutValues = sal_False;
+ return bRet;
+}
+/* -----------------------------29.08.00 16:19--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool ConfigItem::EnableNotification(com::sun::star::uno::Sequence< rtl::OUString >& rNames)
+{
+ Reference<XChangesNotifier> xChgNot(xMultPrSet, UNO_QUERY);
+ if(!xChgNot.is())
+ return FALSE;
+ BOOL bRet = TRUE;
+
+ try
+ {
+ xChangeLstnr = new ConfigChangeListener_Impl(*this);
+ xChgNot->addChangesListener( xChangeLstnr );
+ }
+ catch(RuntimeException& )
+ {
+ bRet = FALSE;
+ }
+ return bRet;
+}
+/* -----------------------------29.08.00 16:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigItem::RemoveListener()
+{
+ Reference<XChangesNotifier> xChgNot(xMultPrSet, UNO_QUERY);
+ if(xChgNot.is() && xChangeLstnr.is())
+ {
+ try
+ {
+ xChgNot->removeChangesListener( xChangeLstnr );
+ xMultPrSet = 0;
+ }
+ catch(Exception & )
+ {
+ }
+ }
+}
+/* -----------------------------15.09.00 12:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > ConfigItem::GetNodeNames(rtl::OUString& rNode)
+{
+ Sequence< OUString > aRet;
+ if(xHierarchyAccess.is())
+ {
+ try
+ {
+ Any aNode = xHierarchyAccess->getByHierarchicalName(rNode);
+ Reference<XNameContainer> xCont;
+ aNode >>= xCont;
+ if(xCont.is())
+ {
+ aRet = xCont->getElementNames();
+ }
+ }
+#ifdef DBG_UTIL
+ catch(Exception& rEx)
+ {
+ ByteString sMsg("Exception from GetNodeNames: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+ }
+#else
+ catch(Exception&){}
+#endif
+ }
+ return aRet;
+}
+/* -----------------------------15.09.00 15:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool ConfigItem::ClearNodeSet(OUString& rNode)
+{
+ sal_Bool bRet;
+ if(xHierarchyAccess.is())
+ {
+ try
+ {
+ Any aNode = xHierarchyAccess->getByHierarchicalName(rNode);
+ Reference<XNameContainer> xCont;
+ aNode >>= xCont;
+ if(!xCont.is())
+ return sal_False;
+ Sequence< OUString > aNames = xCont->getElementNames();
+ const OUString* pNames = aNames.getConstArray();
+ Reference<XChangesBatch> xBatch(xMultPrSet, UNO_QUERY);
+ for(sal_Int32 i = 0; i < aNames.getLength(); i++)
+ {
+ xCont->removeByName(pNames[i]);
+ xBatch->commitChanges();
+ }
+ }
+ catch(Exception& rEx)
+ {
+#ifdef DBG_UTIL
+ ByteString sMsg("Exception from GetNodeNames: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+#endif
+ bRet = FALSE;
+ }
+ }
+ return bRet;
+}
+/* -----------------------------15.09.00 15:52--------------------------------
+ add or change properties
+ ---------------------------------------------------------------------------*/
+sal_Bool ConfigItem::SetSetProperties(
+ OUString& rNode, Sequence< PropertyValue > rValues)
+{
+ sal_Bool bRet;
+ if(xHierarchyAccess.is())
+ {
+ Reference<XChangesBatch> xBatch(xMultPrSet, UNO_QUERY);
+ try
+ {
+ Any aNode = xHierarchyAccess->getByHierarchicalName(rNode);
+ Reference<XNameContainer> xCont;
+ aNode >>= xCont;
+ if(!xCont.is())
+ return sal_False;
+ const PropertyValue* pProperties = rValues.getConstArray();
+ Sequence< OUString > aSubNodeNames(rValues.getLength());
+ OUString* pSubNodeNames = aSubNodeNames.getArray();
+ sal_Int32 nNodeLength = rNode.getLength() + 1;
+ OUString sLastSubNode;
+ sal_Int32 nSubIndex = 0;
+
+ for(sal_Int32 i = 0; i < rValues.getLength(); i++)
+ {
+ OUString sSubNode = pProperties[i].Name.copy(nNodeLength);
+ sSubNode = sSubNode.copy(0, sSubNode.indexOf('/'));
+ if(sLastSubNode != sSubNode)
+ {
+ pSubNodeNames[nSubIndex++] = sSubNode;
+ }
+ sLastSubNode = sSubNode;
+ }
+ aSubNodeNames.realloc(nSubIndex);
+ pSubNodeNames = aSubNodeNames.getArray();
+
+ Reference<XSingleServiceFactory> xFac(xCont, UNO_QUERY);
+ for(sal_Int32 j = 0; j < nSubIndex; j++)
+ {
+ if(!xCont->hasByName(pSubNodeNames[j]))
+ {
+ //create if not available
+ if(!xFac.is())
+ return FALSE;
+ Reference<XInterface> xInst = xFac->createInstance();
+ Any aVal; aVal <<= xInst;
+ xCont->insertByName(pSubNodeNames[j], aVal);
+ //node changes must be commited before values can be changed
+ xBatch->commitChanges();
+ }
+ //set values
+ }
+ Sequence< OUString > aSetNames(rValues.getLength());
+ OUString* pSetNames = aSetNames.getArray();
+ Sequence< Any> aSetValues(rValues.getLength());
+ Any* pSetValues = aSetValues.getArray();
+ for(sal_Int32 k = 0; k < rValues.getLength(); k++)
+ {
+ pSetNames[k] = pProperties[k].Name;
+ pSetValues[k] = pProperties[k].Value;
+ }
+
+ xBatch->commitChanges();
+ bRet = PutProperties(aSetNames, aSetValues);
+
+ }
+ catch(Exception& rEx)
+ {
+#ifdef DBG_UTIL
+ ByteString sMsg("Exception from GetNodeNames: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+#endif
+ bRet = FALSE;
+ }
+ }
+ return bRet;
+}
+/* -----------------------------15.09.00 15:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool ConfigItem::ReplaceSetProperties(
+ OUString& rNode, Sequence< PropertyValue > rValues)
+{
+ sal_Bool bRet;
+ if(xHierarchyAccess.is())
+ {
+ Reference<XChangesBatch> xBatch(xMultPrSet, UNO_QUERY);
+ try
+ {
+ Any aNode = xHierarchyAccess->getByHierarchicalName(rNode);
+ Reference<XNameContainer> xCont;
+ aNode >>= xCont;
+ if(!xCont.is())
+ return sal_False;
+ const PropertyValue* pProperties = rValues.getConstArray();
+ //remove unknown members first
+
+ Sequence< OUString > aSubNodeNames(rValues.getLength());
+ OUString* pSubNodeNames = aSubNodeNames.getArray();
+ sal_Int32 nNodeLength = rNode.getLength() + 1;
+ OUString sLastSubNode;
+ sal_Int32 nSubIndex = 0;
+
+ for(sal_Int32 i = 0; i < rValues.getLength(); i++)
+ {
+ OUString sSubNode = pProperties[i].Name.copy(nNodeLength);
+ sSubNode = sSubNode.copy(0, sSubNode.indexOf('/'));
+ if(sLastSubNode != sSubNode)
+ {
+ pSubNodeNames[nSubIndex++] = sSubNode;
+ }
+ sLastSubNode = sSubNode;
+ }
+ aSubNodeNames.realloc(nSubIndex);
+ pSubNodeNames = aSubNodeNames.getArray();
+
+ Sequence<OUString> aContainerSubNodes = xCont->getElementNames();
+ const OUString* pContainerSubNodes = aContainerSubNodes.getConstArray();
+ for(sal_Int32 nContSub = 0; nContSub < aContainerSubNodes.getLength(); nContSub++)
+ {
+ sal_Bool bFound = sal_False;
+ for(sal_Int32 j = 0; j < nSubIndex; j++)
+ if(pSubNodeNames[j] == pContainerSubNodes[nContSub])
+ {
+ bFound = sal_True;
+ break;
+ }
+ if(!bFound)
+ {
+ xCont->removeByName(pContainerSubNodes[nContSub]);
+ //node changes must be commited before values can be changed
+ xBatch->commitChanges();
+ }
+ }
+
+ Reference<XSingleServiceFactory> xFac(xCont, UNO_QUERY);
+ for(sal_Int32 j = 0; j < nSubIndex; j++)
+ {
+ if(!xCont->hasByName(pSubNodeNames[j]))
+ {
+ //create if not available
+ if(!xFac.is())
+ return FALSE;
+ Reference<XInterface> xInst = xFac->createInstance();
+ Any aVal; aVal <<= xInst;
+ xCont->insertByName(pSubNodeNames[j], aVal);
+ //node changes must be commited before values can be changed
+ xBatch->commitChanges();
+ }
+ //set values
+ }
+ Sequence< OUString > aSetNames(rValues.getLength());
+ OUString* pSetNames = aSetNames.getArray();
+ Sequence< Any> aSetValues(rValues.getLength());
+ Any* pSetValues = aSetValues.getArray();
+ for(sal_Int32 k = 0; k < rValues.getLength(); k++)
+ {
+ pSetNames[k] = pProperties[k].Name;
+ pSetValues[k] = pProperties[k].Value;
+ }
+
+ //node changes must be commited before values can be changed
+ xBatch->commitChanges();
+ bRet = PutProperties(aSetNames, aSetValues);
+
+ }
+ catch(Exception& rEx)
+ {
+#ifdef DBG_UTIL
+ ByteString sMsg("Exception from GetNodeNames: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+#endif
+ bRet = FALSE;
+ }
+ }
+ return bRet;
+}
+
+
+
diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx
new file mode 100644
index 000000000000..de24bfa59791
--- /dev/null
+++ b/unotools/source/config/configmgr.cxx
@@ -0,0 +1,268 @@
+/*************************************************************************
+ *
+ * $RCSfile: configmgr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+ *
+ * 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 _UTL_CONFIGMGR_HXX_
+#include "unotools/configmgr.hxx"
+#endif
+#ifndef _UTL_CONFIGITEM_HXX_
+#include "unotools/configitem.hxx"
+#endif
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+#include <list>
+
+//-----------------------------------------------------------------------------
+
+using namespace utl;
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+//-----------------------------------------------------------------------------
+const char* cConfigBaseURL = "/org.openoffice.";
+//const char* cConfigBaseURL = "/com.sun.star.";
+const char* cAccessSrvc = "com.sun.star.configuration.ConfigurationUpdateAccess";
+
+//-----------------------------------------------------------------------------
+struct ConfigItemListEntry_Impl
+{
+ ConfigItem* pConfigItem;
+
+ ConfigItemListEntry_Impl(ConfigItem* pItem ) :
+ pConfigItem(pItem){}
+};
+typedef std::list<ConfigItemListEntry_Impl> ConfigItemList;
+struct utl::ConfigMgr_Impl
+{
+ ConfigItemList aItemList;
+};
+
+/* -----------------------------28.08.00 15:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigManager::ConfigManager() :
+ pMgrImpl(new utl::ConfigMgr_Impl)
+{
+}
+/* -----------------------------28.08.00 15:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigManager::~ConfigManager()
+{
+ //check list content -> should be empty!
+ DBG_ASSERT(pMgrImpl->aItemList.empty(), "some ConfigItems are still alive")
+ if(!pMgrImpl->aItemList.empty())
+ {
+ ConfigItemList::iterator aListIter;
+ for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
+ {
+ ConfigItemListEntry_Impl& rEntry = *aListIter;
+ rEntry.pConfigItem->ReleaseConfigMgr();
+ }
+ pMgrImpl->aItemList.erase(pMgrImpl->aItemList.begin(), pMgrImpl->aItemList.end());
+ }
+ delete pMgrImpl;
+
+}
+/* -----------------------------28.08.00 16:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider()
+{
+ if(!xConfigurationProvider.is())
+ {
+ Reference< XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory();
+ xConfigurationProvider = Reference< XMultiServiceFactory >
+ (xMSF->createInstance(
+ C2U("com.sun.star.configuration.ConfigurationProvider")),
+ UNO_QUERY);
+ }
+ return xConfigurationProvider;
+}
+/* -----------------------------29.08.00 12:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XMultiPropertySet> ConfigManager::AddConfigItem(utl::ConfigItem& rCfgItem)
+{
+ ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
+#ifdef DBG_UTIL
+ for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
+ {
+ ConfigItemListEntry_Impl& rEntry = *aListIter;
+ if(rEntry.pConfigItem == &rCfgItem)
+ DBG_ERROR("AddConfigItem: already inserted!")
+ }
+#endif
+ OUString sPath = C2U(cConfigBaseURL);
+ sPath += rCfgItem.GetSubTreeName();
+ Sequence< Any > aArgs(1);
+ aArgs[0] <<= sPath;
+
+ Reference< XMultiServiceFactory > xCfgProvider = GetConfigurationProvider();
+ Reference< XInterface > xIFace;
+ try
+ {
+ xIFace = xCfgProvider->createInstanceWithArguments(
+ C2U(cAccessSrvc),
+ aArgs);
+ pMgrImpl->aItemList.insert(aListIter, ConfigItemListEntry_Impl(&rCfgItem));
+#ifdef DEBUG
+ Reference<XNameAccess> xNA(xIFace, UNO_QUERY);
+ Sequence<OUString> aNames = xNA->getElementNames();
+ const OUString* pNames = aNames.getConstArray();
+#endif
+ }
+#ifdef DBG_UTIL
+ catch(Exception& rEx)
+ {
+ ByteString sMsg("CreateInstance exception: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+ }
+#else
+ catch(Exception&){}
+#endif
+ return Reference<XMultiPropertySet>(xIFace, UNO_QUERY);
+}
+/* -----------------------------29.08.00 12:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigManager::RemoveConfigItem(utl::ConfigItem& rCfgItem)
+{
+ DBG_ASSERT(!pMgrImpl->aItemList.empty(), "no ConfigItems available")
+ ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
+ for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
+ {
+ ConfigItemListEntry_Impl& rEntry = *aListIter;
+ if(rEntry.pConfigItem == &rCfgItem)
+ {
+ pMgrImpl->aItemList.erase(aListIter);
+ break;
+ }
+ }
+}
+/* -----------------------------30.08.00 15:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigManager::StoreConfigItems()
+{
+ if(!pMgrImpl->aItemList.empty())
+ {
+ ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
+ for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
+ {
+ ConfigItemListEntry_Impl& rEntry = *aListIter;
+ if(rEntry.pConfigItem->IsModified())
+ rEntry.pConfigItem->Commit();
+ }
+ }
+}
+ConfigManager* ConfigManager::pConfigManager = 0;
+/* -----------------------------07.09.00 11:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigManager* ConfigManager::GetConfigManager()
+{
+ if(!pConfigManager)
+ {
+ pConfigManager = new ConfigManager();
+ }
+ return pConfigManager;
+}
+/* -----------------------------07.09.00 11:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigManager::RemoveConfigManager()
+{
+ if(pConfigManager)
+ {
+ delete pConfigManager;
+ pConfigManager = 0;
+ }
+}
+/* -----------------------------08.09.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+rtl::OUString ConfigManager::GetConfigBaseURL()
+{
+ return C2U(cConfigBaseURL);
+}
+
diff --git a/unotools/source/config/makefile.mk b/unotools/source/config/makefile.mk
new file mode 100644
index 000000000000..30f5f4c7872b
--- /dev/null
+++ b/unotools/source/config/makefile.mk
@@ -0,0 +1,103 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+#
+# 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): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJINC=..$/..$/inc
+PRJNAME=unotools
+TARGET=config
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings common for the whole project -----
+
+#UNOTYPES=
+#.INCLUDE : $(PRJINC)$/unotools$/unotools.mk
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+
+#UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+#UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+#UNOTYPES+= \
+# com.sun.star.container.XEnumeration \
+
+
+# --- Files -------------------------------------
+
+SLOFILES=\
+ $(SLO)$/configitem.obj \
+ $(SLO)$/configmgr.obj \
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx
new file mode 100644
index 000000000000..c9c68d04da8d
--- /dev/null
+++ b/unotools/source/i18n/charclass.cxx
@@ -0,0 +1,575 @@
+/*************************************************************************
+ *
+ * $RCSfile: charclass.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <unotools/charclass.hxx>
+
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _UNOTOOLS_COMPONENTFACTORY_HXX_
+#include <unotools/componentfactory.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
+#include <com/sun/star/uno/XInterface.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#pragma hdrstop
+
+
+#define CHARCLASS_LIBRARYNAME "int"
+#define CHARCLASS_SERVICENAME "com.sun.star.lang.CharacterClassification"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+
+CharClass::CharClass(
+ const Reference< XMultiServiceFactory > & xSF,
+ const Locale& rLocale
+ )
+ :
+ xSMgr( xSF )
+{
+ setLocale( rLocale );
+ if ( xSMgr.is() )
+ {
+ try
+ {
+ xCC = Reference< XCharacterClassification > ( xSMgr->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CHARCLASS_SERVICENAME ) ) ),
+ uno::UNO_QUERY );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "CharClass ctor: Exception caught!" );
+ }
+ }
+ else
+ { // try to get an instance somehow
+ getComponentInstance();
+ }
+}
+
+
+CharClass::CharClass(
+ const ::com::sun::star::lang::Locale& rLocale )
+{
+ setLocale( rLocale );
+ getComponentInstance();
+}
+
+
+CharClass::~CharClass()
+{
+}
+
+
+void CharClass::getComponentInstance()
+{
+ try
+ {
+ // CharClass may be needed by "small tools" like the Setup
+ // => maybe no service manager => loadLibComponentFactory
+ Reference < XInterface > xI = ::utl::getComponentInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( LLCF_LIBNAME( CHARCLASS_LIBRARYNAME ) ) ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CHARCLASS_SERVICENAME ) ) );
+ if ( xI.is() )
+ {
+ Any x = xI->queryInterface( ::getCppuType((const Reference< XCharacterClassification >*)0) );
+ x >>= xCC;
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getComponentInstance: Exception caught!" );
+ }
+}
+
+
+void CharClass::setLocale( const ::com::sun::star::lang::Locale& rLocale )
+{
+ aLocale.Language = rLocale.Language;
+ aLocale.Country = rLocale.Country;
+ aLocale.Variant = rLocale.Variant;
+}
+
+
+// static
+sal_Bool CharClass::isAsciiNumeric( const String& rStr )
+{
+ if ( !rStr.Len() )
+ return sal_False;
+ register const sal_Unicode* p = rStr.GetBuffer();
+ register const sal_Unicode* const pStop = p + rStr.Len();
+ do
+ {
+ if ( !isAsciiDigit( *p ) )
+ return sal_False;
+ } while ( ++p < pStop );
+ return sal_True;
+}
+
+
+// static
+sal_Bool CharClass::isAsciiAlpha( const String& rStr )
+{
+ if ( !rStr.Len() )
+ return sal_False;
+ register const sal_Unicode* p = rStr.GetBuffer();
+ register const sal_Unicode* const pStop = p + rStr.Len();
+ do
+ {
+ if ( !isAsciiAlpha( *p ) )
+ return sal_False;
+ } while ( ++p < pStop );
+ return sal_True;
+}
+
+
+// static
+sal_Bool CharClass::isAsciiAlphaNumeric( const String& rStr )
+{
+ if ( !rStr.Len() )
+ return sal_False;
+ register const sal_Unicode* p = rStr.GetBuffer();
+ register const sal_Unicode* const pStop = p + rStr.Len();
+ do
+ {
+ if ( !isAsciiAlphaNumeric( *p ) )
+ return sal_False;
+ } while ( ++p < pStop );
+ return sal_True;
+}
+
+
+sal_Bool CharClass::isAlpha( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return (xCC->getCharacterType( rStr, nPos, aLocale ) &
+ nCharClassAlphaType) != 0;
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isAlpha: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isAlpha( const String& rStr ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return isAlphaType( xCC->getStringType( rStr, 0, rStr.Len(), aLocale ) );
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isAlpha: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isLetter( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return (xCC->getCharacterType( rStr, nPos, aLocale ) &
+ nCharClassLetterType) != 0;
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isLetter: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isLetter( const String& rStr ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return isLetterType( xCC->getStringType( rStr, 0, rStr.Len(), aLocale ) );
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isLetter: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isDigit( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return (xCC->getCharacterType( rStr, nPos, aLocale ) &
+ KCharacterType::DIGIT) != 0;
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isDigit: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isNumeric( const String& rStr ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return isNumericType( xCC->getStringType( rStr, 0, rStr.Len(), aLocale ) );
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isNumeric: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isAlphaNumeric( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return (xCC->getCharacterType( rStr, nPos, aLocale ) &
+ (nCharClassAlphaType | KCharacterType::DIGIT)) != 0;
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isAlphaNumeric: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isAlphaNumeric( const String& rStr ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return isAlphaNumericType( xCC->getStringType( rStr, 0, rStr.Len(), aLocale ) );
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isAlphaNumeric: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isLetterNumeric( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return (xCC->getCharacterType( rStr, nPos, aLocale ) &
+ (nCharClassLetterType | KCharacterType::DIGIT)) != 0;
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isLetterNumeric: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isLetterNumeric( const String& rStr ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return isLetterNumericType( xCC->getStringType( rStr, 0, rStr.Len(), aLocale ) );
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isLetterNumeric: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+String CharClass::toUpper( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->toUpper( rStr, nPos, nCount, aLocale );
+ else
+ return rStr.Copy( nPos, nCount );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "toUpper: Exception caught!" );
+ return rStr.Copy( nPos, nCount );
+ }
+}
+
+
+String CharClass::toLower( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->toLower( rStr, nPos, nCount, aLocale );
+ else
+ return rStr.Copy( nPos, nCount );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "toLower: Exception caught!" );
+ return rStr.Copy( nPos, nCount );
+ }
+}
+
+
+String CharClass::toTitle( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->toTitle( rStr, nPos, nCount, aLocale );
+ else
+ return rStr.Copy( nPos, nCount );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "toTitle: Exception caught!" );
+ return rStr.Copy( nPos, nCount );
+ }
+}
+
+
+sal_Int16 CharClass::getType( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->getType( rStr, nPos );
+ else
+ return 0;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getType: Exception caught!" );
+ return 0;
+ }
+}
+
+
+sal_Int16 CharClass::getCharacterDirection( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->getCharacterDirection( rStr, nPos );
+ else
+ return 0;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getCharacterDirection: Exception caught!" );
+ return 0;
+ }
+}
+
+
+sal_Int16 CharClass::getScript( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->getScript( rStr, nPos );
+ else
+ return 0;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getScript: Exception caught!" );
+ return 0;
+ }
+}
+
+
+sal_Int32 CharClass::getCharacterType( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->getCharacterType( rStr, nPos, aLocale );
+ else
+ return 0;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getCharacterType: Exception caught!" );
+ return 0;
+ }
+}
+
+
+sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->getStringType( rStr, nPos, nCount, aLocale );
+ else
+ return 0;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getStringType: Exception caught!" );
+ return 0;
+ }
+}
+
+
+::com::sun::star::lang::ParseResult CharClass::parseAnyToken(
+ const String& rStr,
+ sal_Int32 nPos,
+ sal_Int32 nStartCharFlags,
+ const String& userDefinedCharactersStart,
+ sal_Int32 nContCharFlags,
+ const String& userDefinedCharactersCont ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->parseAnyToken( rStr, nPos, aLocale,
+ nStartCharFlags, userDefinedCharactersStart,
+ nContCharFlags, userDefinedCharactersCont );
+ else
+ return ParseResult();
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "parseAnyToken: Exception caught!" );
+ return ParseResult();
+ }
+}
+
+
+::com::sun::star::lang::ParseResult CharClass::parsePredefinedToken(
+ sal_Int32 nTokenType,
+ const String& rStr,
+ sal_Int32 nPos,
+ sal_Int32 nStartCharFlags,
+ const String& userDefinedCharactersStart,
+ sal_Int32 nContCharFlags,
+ const String& userDefinedCharactersCont ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->parsePredefinedToken( nTokenType, rStr, nPos, aLocale,
+ nStartCharFlags, userDefinedCharactersStart,
+ nContCharFlags, userDefinedCharactersCont );
+ else
+ return ParseResult();
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "parsePredefinedToken: Exception caught!" );
+ return ParseResult();
+ }
+}
+
+
+
diff --git a/unotools/source/i18n/makefile.mk b/unotools/source/i18n/makefile.mk
new file mode 100644
index 000000000000..373c83d063de
--- /dev/null
+++ b/unotools/source/i18n/makefile.mk
@@ -0,0 +1,102 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+#
+# 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): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJINC=..$/..$/inc
+PRJNAME=unotools
+TARGET=i18n
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings common for the whole project -----
+
+#UNOTYPES=
+#.INCLUDE : $(PRJINC)$/unotools$/unotools.mk
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+
+#UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+#UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+#UNOTYPES+= \
+# com.sun.star.lang.XCharacterClassification
+
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/charclass.obj
+
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx
new file mode 100644
index 000000000000..c756c6cb2442
--- /dev/null
+++ b/unotools/source/misc/datetime.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * $RCSfile: datetime.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+ *
+ * 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 _UNOTOOLS_DATETIME_HXX_
+#include <unotools/datetime.hxx>
+#endif
+
+#ifndef _DATE_HXX
+#include <tools/date.hxx>
+#endif
+#ifndef _TOOLS_TIME_HXX
+#include <tools/time.hxx>
+#endif
+#ifndef _DATETIME_HXX
+#include <tools/datetime.hxx>
+#endif
+
+//.........................................................................
+namespace utl
+{
+//.........................................................................
+
+//------------------------------------------------------------------
+void typeConvert(const Time& _rTime, starutil::Time& _rOut)
+{
+ _rOut.Hours = _rTime.GetHour();
+ _rOut.Minutes = _rTime.GetMin();
+ _rOut.Seconds = _rTime.GetSec();
+ _rOut.HundredthSeconds = _rTime.Get100Sec();
+}
+
+//------------------------------------------------------------------
+void typeConvert(const starutil::Time& _rTime, Time& _rOut)
+{
+ _rOut = Time(_rTime.Hours, _rTime.Minutes, _rTime.Seconds, _rTime.HundredthSeconds);
+}
+
+//------------------------------------------------------------------
+void typeConvert(const Date& _rDate, starutil::Date& _rOut)
+{
+ _rOut.Day = _rDate.GetDay();
+ _rOut.Month = _rDate.GetMonth();
+ _rOut.Year = _rDate.GetYear();
+}
+
+//------------------------------------------------------------------
+void typeConvert(const starutil::Date& _rDate, Date& _rOut)
+{
+ _rOut = Date(_rDate.Day, _rDate.Month, _rDate.Year);
+}
+
+//------------------------------------------------------------------
+void typeConvert(const DateTime& _rDateTime, starutil::DateTime& _rOut)
+{
+ _rOut.Year = _rDateTime.GetYear();
+ _rOut.Month = _rDateTime.GetMonth();
+ _rOut.Day = _rDateTime.GetDay();
+ _rOut.Hours = _rDateTime.GetHour();
+ _rOut.Minutes = _rDateTime.GetMin();
+ _rOut.Seconds = _rDateTime.GetSec();
+ _rOut.HundredthSeconds = _rDateTime.Get100Sec();
+}
+
+//------------------------------------------------------------------
+void typeConvert(const starutil::DateTime& _rDateTime, DateTime& _rOut)
+{
+ Date aDate(_rDateTime.Day, _rDateTime.Month, _rDateTime.Year);
+ Time aTime(_rDateTime.Hours, _rDateTime.Minutes, _rDateTime.Seconds, _rDateTime.HundredthSeconds);
+ _rOut = DateTime(aDate, aTime);
+}
+
+//-------------------------------------------------------------------------
+sal_Bool operator ==(const starutil::DateTime& _rLeft, const starutil::DateTime& _rRight)
+{
+ return ( _rLeft.HundredthSeconds == _rRight.HundredthSeconds) &&
+ ( _rLeft.Seconds == _rRight.Seconds) &&
+ ( _rLeft.Minutes == _rRight.Minutes) &&
+ ( _rLeft.Hours == _rRight.Hours) &&
+ ( _rLeft.Day == _rRight.Day) &&
+ ( _rLeft.Month == _rRight.Month) &&
+ ( _rLeft.Year == _rRight.Year) ;
+}
+
+//-------------------------------------------------------------------------
+sal_Bool operator ==(const starutil::Date& _rLeft, const starutil::Date& _rRight)
+{
+ return ( _rLeft.Day == _rRight.Day) &&
+ ( _rLeft.Month == _rRight.Month) &&
+ ( _rLeft.Year == _rRight.Year) ;
+}
+
+//-------------------------------------------------------------------------
+sal_Bool operator ==(const starutil::Time& _rLeft, const starutil::Time& _rRight)
+{
+ return ( _rLeft.HundredthSeconds == _rRight.HundredthSeconds) &&
+ ( _rLeft.Seconds == _rRight.Seconds) &&
+ ( _rLeft.Minutes == _rRight.Minutes) &&
+ ( _rLeft.Hours == _rRight.Hours) ;
+}
+
+//.........................................................................
+} // namespace utl
+//.........................................................................
+
diff --git a/unotools/source/misc/makefile.mk b/unotools/source/misc/makefile.mk
new file mode 100644
index 000000000000..474d193111e4
--- /dev/null
+++ b/unotools/source/misc/makefile.mk
@@ -0,0 +1,112 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+#
+# 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): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJINC=..$/..$/inc
+PRJNAME=unotools
+TARGET=misc
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings common for the whole project -----
+
+#UNOTYPES=
+#.INCLUDE : $(PRJINC)$/unotools$/unotools.mk
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+
+#UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+#UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+#UNOTYPES+= \
+# com.sun.star.util.XNumberFormatTypes \
+# com.sun.star.awt.FontDescriptor \
+# com.sun.star.awt.FontUnderline \
+# com.sun.star.awt.FontStrikeout \
+# com.sun.star.awt.FontSlant \
+
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/types.obj \
+ $(SLO)$/datetime.obj \
+ $(SLO)$/numbers.obj \
+ $(SLO)$/guarding.obj \
+ $(SLO)$/sequence.obj \
+ $(SLO)$/querydeep.obj \
+ $(SLO)$/regpathhelper.obj \
+
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unotools/source/processfactory/componentfactory.cxx b/unotools/source/processfactory/componentfactory.cxx
new file mode 100644
index 000000000000..98c648d48d12
--- /dev/null
+++ b/unotools/source/processfactory/componentfactory.cxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * $RCSfile: componentfactory.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <unotools/componentfactory.hxx>
+#include <unotools/processfactory.hxx>
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HDL_
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#endif
+
+#include <cppuhelper/factory.hxx>
+
+#include <uno/environment.h>
+#include <uno/mapping.hxx>
+
+#include <rtl/ustring.hxx>
+#include <osl/module.h>
+
+
+#pragma hdrstop
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using namespace ::rtl;
+
+
+namespace utl
+{
+
+Reference< XInterface > getComponentInstance(
+ const OUString & rLibraryName,
+ const OUString & rImplementationName
+ )
+{
+ Reference< XInterface > xI;
+ Reference< XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory();
+ if ( xMSF.is() )
+ xI = xMSF->createInstance( rImplementationName );
+ if( !xI.is() )
+ {
+ Reference< XSingleServiceFactory > xSSF =
+ loadLibComponentFactory( rLibraryName, rImplementationName,
+ Reference< XMultiServiceFactory >(), Reference< XRegistryKey >() );
+ xI = xSSF->createInstance();
+ }
+ return xI;
+}
+
+
+Reference< XSingleServiceFactory > loadLibComponentFactory(
+ const OUString & rLibName,
+ const OUString & rImplName,
+ const Reference< XMultiServiceFactory > & xSF,
+ const Reference< XRegistryKey > & xKey
+ )
+{
+ Reference< XSingleServiceFactory > xRet;
+
+ oslModule lib = osl_loadModule( rLibName.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
+ if (lib)
+ {
+ void * pSym;
+
+ // ========================= LATEST VERSION =========================
+ OUString aGetEnvName( RTL_CONSTASCII_USTRINGPARAM(COMPONENT_GETENV) );
+ if (pSym = osl_getSymbol( lib, aGetEnvName.pData ))
+ {
+ uno_Environment * pCurrentEnv = 0;
+ uno_Environment * pEnv = 0;
+ const sal_Char * pEnvTypeName = 0;
+ (*((component_getImplementationEnvironmentFunc)pSym))( &pEnvTypeName, &pEnv );
+
+ sal_Bool bNeedsMapping =
+ (pEnv || 0 != rtl_str_compare( pEnvTypeName, CPPU_CURRENT_LANGUAGE_BINDING_NAME ));
+
+ OUString aEnvTypeName( OUString::createFromAscii( pEnvTypeName ) );
+
+ if (bNeedsMapping)
+ {
+ if (! pEnv)
+ uno_getEnvironment( &pEnv, aEnvTypeName.pData, 0 );
+ if (pEnv)
+ {
+ OUString aCppEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) );
+ uno_getEnvironment( &pCurrentEnv, aCppEnvTypeName.pData, 0 );
+ if (pCurrentEnv)
+ bNeedsMapping = (pEnv != pCurrentEnv);
+ }
+ }
+
+ OUString aGetFactoryName( RTL_CONSTASCII_USTRINGPARAM(COMPONENT_GETFACTORY) );
+ if (pSym = osl_getSymbol( lib, aGetFactoryName.pData ))
+ {
+ OString aImplName( OUStringToOString( rImplName, RTL_TEXTENCODING_ASCII_US ) );
+
+ if (bNeedsMapping)
+ {
+ if (pEnv && pCurrentEnv)
+ {
+ Mapping aCurrent2Env( pCurrentEnv, pEnv );
+ Mapping aEnv2Current( pEnv, pCurrentEnv );
+
+ if (aCurrent2Env.is() && aEnv2Current.is())
+ {
+ void * pSMgr = aCurrent2Env.mapInterface(
+ xSF.get(), ::getCppuType( (const Reference< XMultiServiceFactory > *)0 ) );
+ void * pKey = aCurrent2Env.mapInterface(
+ xKey.get(), ::getCppuType( (const Reference< XRegistryKey > *)0 ) );
+
+ void * pSSF = (*((component_getFactoryFunc)pSym))(
+ aImplName.getStr(), pSMgr, pKey );
+
+ if (pKey)
+ (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pKey );
+ if (pSMgr)
+ (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pSMgr );
+
+ if (pSSF)
+ {
+ aEnv2Current.mapInterface(
+ reinterpret_cast< void ** >( &xRet ),
+ pSSF, ::getCppuType( (const Reference< XSingleServiceFactory > *)0 ) );
+ (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pSSF );
+ }
+ }
+ }
+ }
+ else
+ {
+ XSingleServiceFactory * pRet = (XSingleServiceFactory *)
+ (*((component_getFactoryFunc)pSym))(
+ aImplName.getStr(), xSF.get(), xKey.get() );
+ if (pRet)
+ {
+ xRet = pRet;
+ pRet->release();
+ }
+ }
+ }
+
+ if (pEnv)
+ (*pEnv->release)( pEnv );
+ if (pCurrentEnv)
+ (*pCurrentEnv->release)( pCurrentEnv );
+ }
+
+
+ if (! xRet.is())
+ osl_unloadModule( lib );
+ }
+
+ return xRet;
+}
+
+} // namespace utl
diff --git a/unotools/source/processfactory/makefile.mk b/unotools/source/processfactory/makefile.mk
new file mode 100644
index 000000000000..a0e4baf2567b
--- /dev/null
+++ b/unotools/source/processfactory/makefile.mk
@@ -0,0 +1,97 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+#
+# 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): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJINC=..$/..$/inc
+PRJNAME=unotools
+TARGET=procfact
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings common for the whole project -----
+
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+#UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+#UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+#UNOTYPES+= \
+# com.sun.star.uno.TypeClass \
+# com.sun.star.lang.XMultiServiceFactory
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/processfactory.obj \
+ $(SLO)$/componentfactory.obj
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unotools/source/processfactory/processfactory.cxx b/unotools/source/processfactory/processfactory.cxx
new file mode 100644
index 000000000000..42ca1ae1f25d
--- /dev/null
+++ b/unotools/source/processfactory/processfactory.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * $RCSfile: processfactory.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+ *
+ * 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 _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace osl;
+
+namespace utl
+{
+
+/*
+ This function preserves only that the xProcessFactory variable will not be create when
+ the library is loaded.
+*/
+Reference< XMultiServiceFactory > localProcessFactory( const Reference< XMultiServiceFactory >& xSMgr, sal_Bool bSet )
+{
+ Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+
+ static Reference< XMultiServiceFactory > xProcessFactory;
+ if ( bSet )
+ {
+ xProcessFactory = xSMgr;
+ }
+
+ return xProcessFactory;
+}
+
+
+void setProcessServiceFactory(const Reference< XMultiServiceFactory >& xSMgr)
+{
+ localProcessFactory( xSMgr, sal_True );
+}
+
+Reference< XMultiServiceFactory > getProcessServiceFactory()
+{
+ return localProcessFactory( Reference< XMultiServiceFactory >(), sal_False );
+}
+
+} // namesapce utl
+
diff --git a/unotools/source/property/makefile.mk b/unotools/source/property/makefile.mk
new file mode 100644
index 000000000000..88de50a1b134
--- /dev/null
+++ b/unotools/source/property/makefile.mk
@@ -0,0 +1,103 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+#
+# 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): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJINC=..$/..$/inc
+PRJNAME=unotools
+TARGET=property
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings common for the whole project -----
+
+#UNOTYPES=
+#.INCLUDE : $(PRJINC)$/unotools$/unotools.mk
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+
+#UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+#UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+#UNOTYPES+= \
+
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/property.obj \
+ $(SLO)$/propmultiplex.obj \
+ $(SLO)$/propstate.obj \
+ $(SLO)$/propagg.obj \
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unotools/source/streaming/makefile.mk b/unotools/source/streaming/makefile.mk
new file mode 100644
index 000000000000..7b9fbcb8d21a
--- /dev/null
+++ b/unotools/source/streaming/makefile.mk
@@ -0,0 +1,106 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+#
+# 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): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJINC=..$/..$/inc
+PRJNAME=unotools
+TARGET=streaming
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings common for the whole project -----
+
+#UNOTYPES=
+#.INCLUDE : $(PRJINC)$/unotools$/unotools.mk
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+
+#UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+#UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+#UNOTYPES+= \
+# com.sun.star.awt.FontDescriptor \
+
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/basicio.obj \
+ $(SLO)$/streamsection.obj \
+ $(SLO)$/streamhelper.obj \
+ $(SLO)$/streamwrap.obj \
+ $(SLO)$/seqstream.obj \
+ $(SLO)$/oslfile2streamwrap.obj
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unotools/source/streaming/streamhelper.cxx b/unotools/source/streaming/streamhelper.cxx
new file mode 100644
index 000000000000..ebbdd783ff21
--- /dev/null
+++ b/unotools/source/streaming/streamhelper.cxx
@@ -0,0 +1,234 @@
+/*************************************************************************
+ *
+ * $RCSfile: streamhelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <unotools/streamhelper.hxx>
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+namespace utl
+{
+
+//------------------------------------------------------------------------------
+void SAL_CALL OInputStreamHelper::acquire() throw (staruno::RuntimeException)
+{
+ InputStreamHelper_Base::acquire();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OInputStreamHelper::release() throw (staruno::RuntimeException)
+{
+ InputStreamHelper_Base::release();
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OInputStreamHelper::readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead)
+ throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException)
+{
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ if (nBytesToRead < 0)
+ throw stario::BufferSizeExceededException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+ aData.realloc(nBytesToRead);
+
+ sal_uInt32 nRead;
+ ErrCode nError = m_xLockBytes->ReadAt(m_nActPos, (void*)aData.getArray(), nBytesToRead, &nRead);
+ m_nActPos += nRead;
+
+ if (nError != ERRCODE_NONE)
+ throw stario::IOException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ // adjust sequence if data read is lower than the desired data
+ if (nRead < (sal_uInt32)nBytesToRead)
+ aData.realloc( nRead );
+
+ return nRead;
+}
+
+void SAL_CALL OInputStreamHelper::seek( sal_Int64 location ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_nActPos = location;
+}
+
+sal_Int64 SAL_CALL OInputStreamHelper::getPosition( ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ return m_nActPos;
+}
+
+sal_Int64 SAL_CALL OInputStreamHelper::getLength( ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ if (!m_xLockBytes.Is())
+ return 0;
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+ SvLockBytesStat aStat;
+ m_xLockBytes->Stat( &aStat, SVSTATFLAG_DEFAULT );
+ m_nActPos = aStat.nSize;
+ return m_nActPos;
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OInputStreamHelper::readSomeBytes(staruno::Sequence< sal_Int8 >& aData,
+ sal_Int32 nMaxBytesToRead)
+ throw (stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException)
+{
+ // read all data desired
+ return readBytes(aData, nMaxBytesToRead);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OInputStreamHelper::skipBytes(sal_Int32 nBytesToSkip)
+ throw (stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ if (nBytesToSkip < 0)
+ throw stario::BufferSizeExceededException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ m_nActPos += nBytesToSkip;
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OInputStreamHelper::available()
+ throw (stario::NotConnectedException, stario::IOException, staruno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ return m_nAvailable;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OInputStreamHelper::closeInput()
+ throw (stario::NotConnectedException, stario::IOException, staruno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ m_xLockBytes = NULL;
+}
+
+/*************************************************************************/
+//------------------------------------------------------------------------------
+void SAL_CALL OOutputStreamHelper::acquire() throw (staruno::RuntimeException)
+{
+ OutputStreamHelper_Base::acquire();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OOutputStreamHelper::release() throw (staruno::RuntimeException)
+{
+ OutputStreamHelper_Base::release();
+}
+// stario::XOutputStream
+//------------------------------------------------------------------------------
+void SAL_CALL OOutputStreamHelper::writeBytes(const staruno::Sequence< sal_Int8 >& aData)
+ throw (stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ ULONG nWritten;
+ ErrCode nError = m_xLockBytes->WriteAt( m_nActPos, aData.getConstArray(), aData.getLength(), &nWritten );
+ m_nActPos += nWritten;
+
+ if (nError != ERRCODE_NONE ||
+ nWritten != aData.getLength())
+ {
+ throw stario::IOException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+ }
+}
+
+//------------------------------------------------------------------
+void SAL_CALL OOutputStreamHelper::flush()
+ throw (stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ ErrCode nError = m_xLockBytes->Flush();
+ if (nError != ERRCODE_NONE)
+ throw stario::IOException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+}
+
+//------------------------------------------------------------------
+void SAL_CALL OOutputStreamHelper::closeOutput( )
+ throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ m_xLockBytes = NULL;
+}
+
+} // namespace utl
+
+
diff --git a/unotools/source/streaming/streamwrap.cxx b/unotools/source/streaming/streamwrap.cxx
new file mode 100644
index 000000000000..399e78e328e1
--- /dev/null
+++ b/unotools/source/streaming/streamwrap.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * $RCSfile: streamwrap.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+ *
+ * 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 _UTL_STREAM_WRAPPER_HXX_
+#include <unotools/streamwrap.hxx>
+#endif
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+namespace utl
+{
+
+DBG_NAME(OInputStreamWrapper)
+//------------------------------------------------------------------
+OInputStreamWrapper::OInputStreamWrapper( SvStream& _rStream )
+ :m_pSvStream(&_rStream)
+ ,m_bSvStreamOwner(sal_False)
+{
+ DBG_CTOR(OInputStreamWrapper,NULL);
+
+}
+
+//------------------------------------------------------------------
+OInputStreamWrapper::OInputStreamWrapper( SvStream* pStream, sal_Bool bOwner )
+ :m_pSvStream( pStream )
+ ,m_bSvStreamOwner( bOwner )
+{
+ DBG_CTOR(OInputStreamWrapper,NULL);
+
+}
+
+//------------------------------------------------------------------
+OInputStreamWrapper::~OInputStreamWrapper()
+{
+ if( m_bSvStreamOwner )
+ delete m_pSvStream;
+
+ DBG_DTOR(OInputStreamWrapper,NULL);
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OInputStreamWrapper::readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead)
+ throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+ if (!m_pSvStream)
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ if (nBytesToRead < 0)
+ throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ aData.realloc(nBytesToRead);
+
+ sal_uInt32 nRead = m_pSvStream->Read((void*)aData.getArray(), nBytesToRead);
+ if (m_pSvStream->SvStream::GetError() != ERRCODE_NONE)
+ throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+
+ // Wenn gelesene Zeichen < MaxLength, staruno::Sequence anpassen
+ if (nRead < (sal_uInt32)nBytesToRead)
+ aData.realloc( nRead );
+
+ return nRead;
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OInputStreamWrapper::readSomeBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+ if (!m_pSvStream)
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ if (nMaxBytesToRead < 0)
+ throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+
+ if (m_pSvStream->IsEof())
+ {
+ aData.realloc(0);
+ return 0;
+ }
+ else
+ return readBytes(aData, nMaxBytesToRead);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_pSvStream)
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+#ifdef DBG_UTIL
+ sal_uInt32 nCurrentPos = m_pSvStream->Tell();
+#endif
+
+ m_pSvStream->SeekRel(nBytesToSkip);
+ if (m_pSvStream->SvStream::GetError() != ERRCODE_NONE)
+ {
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+ }
+
+#ifdef DBG_UTIL
+ nCurrentPos = m_pSvStream->Tell();
+#endif
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OInputStreamWrapper::available() throw( stario::NotConnectedException, staruno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_pSvStream)
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ sal_uInt32 nPos = m_pSvStream->Tell();
+ if (m_pSvStream->SvStream::GetError())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ m_pSvStream->Seek(STREAM_SEEK_TO_END);
+ if (m_pSvStream->SvStream::GetError())
+ throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+
+ sal_Int32 nAvailable = (sal_Int32)m_pSvStream->Tell() - nPos;
+ m_pSvStream->Seek(nPos);
+ if (m_pSvStream->SvStream::GetError())
+ throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+ return nAvailable;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OInputStreamWrapper::closeInput() throw( stario::NotConnectedException, staruno::RuntimeException )
+{
+ if (!m_pSvStream)
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ if (m_bSvStreamOwner)
+ delete m_pSvStream;
+
+ m_pSvStream = NULL;
+}
+
+/*************************************************************************/
+// stario::XOutputStream
+//------------------------------------------------------------------------------
+void SAL_CALL OOutputStreamWrapper::writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+ sal_uInt32 nWritten = rStream.Write(aData.getConstArray(),aData.getLength());
+ ErrCode err = rStream.GetError();
+ if (err != ERRCODE_NONE || nWritten != aData.getLength())
+ {
+ throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+ }
+}
+
+//------------------------------------------------------------------
+void SAL_CALL OOutputStreamWrapper::flush() throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+ rStream.Flush();
+ if (rStream.GetError() != ERRCODE_NONE)
+ throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+}
+
+//------------------------------------------------------------------
+void SAL_CALL OOutputStreamWrapper::closeOutput() throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+}
+
+} // namespace utl
+
+