summaryrefslogtreecommitdiff
path: root/unotools/source
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-03-27 16:45:03 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-03-27 16:45:03 +0000
commit53d50f23228c3acfe75703b51c8832ac48f54270 (patch)
tree7096895bf857cb7cbf08067f96a60279225caa77 /unotools/source
parent832f7b267bcc52af248a5e72e6ebda14d92a19ee (diff)
MWS_SRX644: migrate branch mws_srx644 -> HEAD
Diffstat (limited to 'unotools/source')
-rw-r--r--unotools/source/config/configitem.cxx96
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx10
-rw-r--r--unotools/source/ucbhelper/makefile.mk12
-rw-r--r--unotools/source/ucbhelper/progresshandlerwrap.cxx132
-rw-r--r--unotools/source/ucbhelper/ucbhelper.cxx33
-rw-r--r--unotools/source/ucbhelper/ucblockbytes.cxx6
6 files changed, 256 insertions, 33 deletions
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx
index 59905c3fff68..eca98be035a7 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: configitem.cxx,v $
*
- * $Revision: 1.38 $
+ * $Revision: 1.39 $
*
- * last change: $Author: jb $ $Date: 2002-12-03 12:29:27 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:39:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -100,6 +100,9 @@
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
#ifndef _COM_SUN_STAR_UTIL_XSTRINGESCAPE_HPP_
#include <com/sun/star/util/XStringEscape.hpp>
@@ -112,6 +115,8 @@
#include <osl/diagnose.h>
#endif
+#include <rtl/ustrbuf.hxx>
+
using namespace utl;
using rtl::OUString;
using rtl::OString;
@@ -559,6 +564,91 @@ void ConfigItem::impl_unpackLocalizedProperties( const Sequence< OUString >
}
}
}
+/* -----------------------------03.02.2003 14:44------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Sequence< rtl::OUString >& rNames)
+{
+ // size of return list is fix!
+ // Every item must match to length of incoming name list.
+ sal_Int32 nCount = rNames.getLength();
+ Sequence< sal_Bool > lStates(nCount);
+
+ // We must be shure to return a valid information everytime!
+ // Set default to non readonly ... similar to the configuration handling of this property.
+ for (sal_Int32 i=0; i<nCount; ++i)
+ lStates[i] = sal_False;
+
+ // no access - no informations ...
+ Reference< XHierarchicalNameAccess > xHierarchyAccess = GetTree();
+ if (!xHierarchyAccess.is())
+ return lStates;
+
+ for (i=0; i<nCount; ++i)
+ {
+ try
+ {
+ if(pImpl->pManager->IsLocalConfigProvider() && lcl_IsLocalProperty(sSubTree, rNames[i]))
+ {
+ OSL_ENSURE(sal_False, "ConfigItem::IsReadonly()\nlocal mode seams to be used!?\n");
+ continue;
+ }
+
+ OUString sName = rNames[i];
+ OUString sPath;
+ OUString sProperty;
+
+ ::utl::splitLastFromConfigurationPath(sName,sPath,sProperty);
+ if (!sPath.getLength() && !sProperty.getLength())
+ {
+ OSL_ENSURE(sal_False, "ConfigItem::IsReadonly()\nsplitt failed\n");
+ continue;
+ }
+
+ Reference< XInterface > xNode;
+ Reference< XPropertySet > xSet ;
+ Reference< XPropertySetInfo > xInfo;
+ if (sPath.getLength())
+ {
+ Any aNode = xHierarchyAccess->getByHierarchicalName(sPath);
+ if (!(aNode >>= xNode) || !xNode.is())
+ {
+ OSL_ENSURE(sal_False, "ConfigItem::IsReadonly()\nno set available\n");
+ continue;
+ }
+ }
+ else
+ {
+ xNode = Reference< XInterface >(xHierarchyAccess, UNO_QUERY);
+ }
+
+ xSet = Reference< XPropertySet >(xNode, UNO_QUERY);
+ if (xSet.is())
+ {
+ xInfo = xSet->getPropertySetInfo();
+ OSL_ENSURE(xInfo.is(), "ConfigItem::IsReadonly()\ngetPropertySetInfo failed ...\n");
+ }
+ else
+ {
+ xInfo = Reference< XPropertySetInfo >(xNode, UNO_QUERY);
+ OSL_ENSURE(xInfo.is(), "ConfigItem::IsReadonly()\nUNO_QUERY failed ...\n");
+ }
+
+ if (!xInfo.is())
+ {
+ OSL_ENSURE(sal_False, "ConfigItem::IsReadonly()\nno prop info available\n");
+ continue;
+ }
+
+ Property aProp = xInfo->getPropertyByName(sProperty);
+ lStates[i] = ((aProp.Attributes & PropertyAttribute::READONLY) == PropertyAttribute::READONLY);
+ }
+ catch(Exception&){}
+ }
+
+ return lStates;
+}
+
/* -----------------------------29.08.00 15:10--------------------------------
---------------------------------------------------------------------------*/
@@ -1391,3 +1481,5 @@ void ConfigItem::UnlockTree()
m_xHierarchyAccess = 0;
}
+
+
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 5b243830c2e0..8f05c2d08e79 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: localedatawrapper.cxx,v $
*
- * $Revision: 1.27 $
+ * $Revision: 1.28 $
*
- * last change: $Author: er $ $Date: 2002-09-18 14:41:53 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:39:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -486,6 +486,12 @@ void LocaleDataWrapper::invalidateData()
DBG_ERRORFILE( aMsg.GetBuffer() );
}
#endif
+ switch ( eLang )
+ {
+ case LANGUAGE_NORWEGIAN : // no_NO, not Bokmal (nb_NO), not Nynorsk (nn_NO)
+ eLang = LANGUAGE_DONTKNOW; // don't offer "Unknown" language
+ break;
+ }
if ( eLang != LANGUAGE_DONTKNOW )
{
String aLanguage, aCountry;
diff --git a/unotools/source/ucbhelper/makefile.mk b/unotools/source/ucbhelper/makefile.mk
index 0ed474f7a3e4..868e99917577 100644
--- a/unotools/source/ucbhelper/makefile.mk
+++ b/unotools/source/ucbhelper/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.10 $
+# $Revision: 1.11 $
#
-# last change: $Author: mh $ $Date: 2001-11-06 21:09:39 $
+# last change: $Author: hr $ $Date: 2003-03-27 17:39:52 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -69,6 +69,7 @@ ENABLE_EXCEPTIONS=TRUE
# --- Settings common for the whole project -----
+#UNOTYPES=
#.INCLUDE : $(PRJINC)$/unotools$/unotools.mk
# --- Settings ----------------------------------
@@ -85,8 +86,8 @@ ENABLE_EXCEPTIONS=TRUE
# --- Types -------------------------------------
-UNOTYPES+= \
- com.sun.star.sdbc.XRow
+#UNOTYPES+= \
+# com.sun.star.container.XInputStream
# --- Files -------------------------------------
@@ -97,7 +98,8 @@ SLOFILES=\
$(SLO)$/ucbhelper.obj \
$(SLO)$/ucbstreamhelper.obj \
$(SLO)$/tempfile.obj \
- $(SLO)$/xtempfile.obj
+ $(SLO)$/xtempfile.obj \
+ $(SLO)$/progresshandlerwrap.obj
# --- Targets ----------------------------------
diff --git a/unotools/source/ucbhelper/progresshandlerwrap.cxx b/unotools/source/ucbhelper/progresshandlerwrap.cxx
new file mode 100644
index 000000000000..a1ecbb3d2d8f
--- /dev/null
+++ b/unotools/source/ucbhelper/progresshandlerwrap.cxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * $RCSfile: progresshandlerwrap.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2003-03-27 17:39:52 $
+ *
+ * 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_PROGRESSHANDLERWRAP_HXX_
+#include <unotools/progresshandlerwrap.hxx>
+#endif
+
+namespace utl
+{
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::ucb;
+
+ProgressHandlerWrap::ProgressHandlerWrap( ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > xSI )
+: m_xStatusIndicator( xSI )
+{
+}
+
+sal_Bool getStatusFromAny_Impl( const Any& aAny, ::rtl::OUString& aText, sal_Int32& nNum )
+{
+ sal_Bool bNumIsSet = sal_False;
+
+ Sequence< Any > aSetList;
+ if( ( aAny >>= aSetList ) && aSetList.getLength() )
+ for( int ind = 0; ind < aSetList.getLength(); ind++ )
+ {
+ if( !bNumIsSet && ( aSetList[ind] >>= nNum ) )
+ bNumIsSet = sal_True;
+ else
+ !aText.getLength() && ( aSetList[ind] >>= aText );
+ }
+
+ return bNumIsSet;
+}
+
+void SAL_CALL ProgressHandlerWrap::push( const Any& Status )
+ throw( RuntimeException )
+{
+ if( !m_xStatusIndicator.is() )
+ return;
+
+ ::rtl::OUString aText;
+ sal_Int32 nRange;
+
+ if( getStatusFromAny_Impl( Status, aText, nRange ) )
+ m_xStatusIndicator->start( aText, nRange );
+}
+
+void SAL_CALL ProgressHandlerWrap::update( const Any& Status )
+ throw( RuntimeException )
+{
+ if( !m_xStatusIndicator.is() )
+ return;
+
+ ::rtl::OUString aText;
+ sal_Int32 nValue;
+
+ if( getStatusFromAny_Impl( Status, aText, nValue ) )
+ {
+ if( aText.getLength() ) m_xStatusIndicator->setText( aText );
+ m_xStatusIndicator->setValue( nValue );
+ }
+}
+
+void SAL_CALL ProgressHandlerWrap::pop()
+ throw( RuntimeException )
+{
+ if( m_xStatusIndicator.is() )
+ m_xStatusIndicator->end();
+}
+
+} // namespace utl
+
diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx
index f508cd756a51..e53480ff3bc3 100644
--- a/unotools/source/ucbhelper/ucbhelper.cxx
+++ b/unotools/source/ucbhelper/ucbhelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ucbhelper.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: mav $ $Date: 2002-12-09 16:29:09 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:39:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -588,7 +588,7 @@ sal_Bool UCBContentHelper::CanMakeFolder( const String& rFolder )
// -----------------------------------------------------------------------
-sal_Bool UCBContentHelper::MakeFolder( const String& rFolder )
+sal_Bool UCBContentHelper::MakeFolder( const String& rFolder, sal_Bool bNewOnly )
{
INetURLObject aURL( rFolder );
DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
@@ -600,14 +600,14 @@ sal_Bool UCBContentHelper::MakeFolder( const String& rFolder )
Reference< XInteractionHandler > xInteractionHandler = Reference< XInteractionHandler > (
xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), UNO_QUERY );
if ( Content::create( aURL.GetMainURL( INetURLObject::NO_DECODE ), new CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ), aCnt ) )
- return MakeFolder( aCnt, aTitle, aNew );
+ return MakeFolder( aCnt, aTitle, aNew, bNewOnly );
else
return sal_False;
}
-sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Content& rNew )
+sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Content& rNew, sal_Bool bNewOnly )
{
- sal_Bool bRecover = sal_False;
+ sal_Bool bAlreadyExists = sal_False;
try
{
@@ -653,12 +653,12 @@ sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Cont
{
if ( r.Code == IOErrorCode_ALREADY_EXISTING )
{
- bRecover = sal_True;
+ bAlreadyExists = sal_True;
}
}
catch ( NameClashException& )
{
- bRecover = sal_True;
+ bAlreadyExists = sal_True;
}
catch( ::com::sun::star::ucb::CommandAbortedException& )
{
@@ -670,7 +670,7 @@ sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Cont
{
}
- if( bRecover )
+ if( bAlreadyExists && !bNewOnly )
{
INetURLObject aObj( aCnt.getURL() );
aObj.Append( aTitle );
@@ -806,19 +806,10 @@ sal_Bool UCBContentHelper::Exists( const String& rURL )
::rtl::OUString sIn( sObjectPhysicalName ), sOut;
if ( osl_File_E_None == osl_getFileURLFromSystemPath( sIn.pData, &sOut.pData ) )
{
- ::osl::FileBase::RC eResult = FileBase::E_None;
-
+ // #106526 osl_getDirectoryItem is an existence check
+ // no further osl_getFileStatus call necessary
DirectoryItem aItem;
- if ( FileBase::E_None == DirectoryItem::get( sOut, aItem ) )
- {
- FileStatus aStatus( FileStatusMask_FileName );
- eResult = aItem.getFileStatus( aStatus );
- if ( FileBase::E_NOENT == eResult )
- { // there is no such entry
- return sal_False;
- }
- return sal_True;
- }
+ return (FileBase::E_None == DirectoryItem::get(sOut, aItem));
}
return sal_False;
}
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx
index 383cbea15dc2..c31df0407e5e 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ucblockbytes.cxx,v $
*
- * $Revision: 1.41 $
+ * $Revision: 1.42 $
*
- * last change: $Author: mav $ $Date: 2002-08-15 15:34:27 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:39:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -708,7 +708,7 @@ ErrCode UcbLockBytes::SetSize (ULONG nNewSize)
ULONG nDiff = nNewSize-nSize, nCount=0;
BYTE* pBuffer = new BYTE[ nDiff ];
WriteAt( nSize, pBuffer, nDiff, &nCount );
- delete pBuffer;
+ delete[] pBuffer;
if ( nCount != nDiff )
return ERRCODE_IO_CANTWRITE;
}