[Libreoffice-commits] .: 11 commits - basic/source editeng/inc editeng/source scripting/source sfx2/source svx/source ucb/source vbahelper/source xmlhelp/source
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Jun 13 03:45:33 PDT 2011
basic/source/basmgr/basmgr.cxx | 8
basic/source/classes/sbunoobj.cxx | 6
editeng/inc/editeng/tstpitem.hxx | 17
editeng/source/editeng/impedit.hxx | 2
editeng/source/editeng/impedit4.cxx | 9
editeng/source/items/paraitem.cxx | 18
editeng/source/misc/svxacorr.cxx | 2
scripting/source/dlgprov/DialogModelProvider.cxx | 2
scripting/source/dlgprov/dlgprov.cxx | 2
scripting/source/storage/ScriptData.hxx | 93 --
scripting/source/storage/ScriptElement.cxx | 164 ---
scripting/source/storage/ScriptElement.hxx | 64 -
scripting/source/storage/ScriptInfo.cxx | 376 ---------
scripting/source/storage/ScriptInfo.hxx | 78 -
scripting/source/storage/ScriptInfoImpl.hxx | 95 --
scripting/source/storage/ScriptMetadataImporter.cxx | 509 ------------
scripting/source/storage/ScriptMetadataImporter.hxx | 254 ------
scripting/source/storage/ScriptSecurityManager.cxx | 528 ------------
scripting/source/storage/ScriptSecurityManager.hxx | 102 --
scripting/source/storage/ScriptStorage.cxx | 831 --------------------
scripting/source/storage/ScriptStorage.hxx | 208 -----
scripting/source/storage/ScriptStorageManager.cxx | 533 ------------
scripting/source/storage/ScriptStorageManager.hxx | 228 -----
scripting/source/storage/ScriptURI.cxx | 229 -----
scripting/source/storage/ScriptURI.hxx | 123 --
scripting/source/storage/XMLElement.cxx | 174 ----
scripting/source/storage/XMLElement.hxx | 143 ---
scripting/source/storage/exports.dxp | 2
scripting/source/storage/makefile.mk | 53 -
scripting/source/storage/storage.xml | 47 -
sfx2/source/appl/appmisc.cxx | 18
sfx2/source/doc/iframe.cxx | 2
svx/source/dialog/svxruler.cxx | 8
ucb/source/ucp/webdav/webdavcontent.cxx | 4
vbahelper/source/msforms/vbacontrol.cxx | 4
xmlhelp/source/cxxhelp/provider/databases.cxx | 6
36 files changed, 50 insertions(+), 4892 deletions(-)
New commits:
commit 53bf2cfa76d08ec5edde4571d9ae8e485fb87428
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jun 13 11:35:14 2011 +0100
lets make this sal_Int32 on all platforms
diff --git a/editeng/inc/editeng/tstpitem.hxx b/editeng/inc/editeng/tstpitem.hxx
index eb0411c..367e41a 100644
--- a/editeng/inc/editeng/tstpitem.hxx
+++ b/editeng/inc/editeng/tstpitem.hxx
@@ -45,7 +45,7 @@
class EDITENG_DLLPUBLIC SvxTabStop
{
private:
- long nTabPos;
+ sal_Int32 nTabPos;
SvxTabAdjust eAdjustment;
mutable sal_Unicode m_cDecimal;
@@ -57,20 +57,13 @@ private:
public:
SvxTabStop();
-#if (_MSC_VER < 1300)
- SvxTabStop( const long nPos,
+ SvxTabStop( const sal_Int32 nPos,
const SvxTabAdjust eAdjst = SVX_TAB_ADJUST_LEFT,
const sal_Unicode cDec = cDfltDecimalChar,
const sal_Unicode cFil = cDfltFillChar );
-#else
- SvxTabStop::SvxTabStop( const long nPos,
- const SvxTabAdjust eAdjst = SVX_TAB_ADJUST_LEFT,
- const sal_Unicode cDec = cDfltDecimalChar,
- const sal_Unicode cFil = cDfltFillChar );
-#endif
- long& GetTabPos() { return nTabPos; }
- long GetTabPos() const { return nTabPos; }
+ sal_Int32& GetTabPos() { return nTabPos; }
+ sal_Int32 GetTabPos() const { return nTabPos; }
SvxTabAdjust& GetAdjustment() { return eAdjustment; }
SvxTabAdjust GetAdjustment() const { return eAdjustment; }
@@ -135,7 +128,7 @@ public:
sal_uInt16 GetPos( const SvxTabStop& rTab ) const;
// Returns index of the tab at nPos, or TAB_NOTFOUND
- sal_uInt16 GetPos( const long nPos ) const;
+ sal_uInt16 GetPos( const sal_Int32 nPos ) const;
// unprivatized:
sal_uInt16 Count() const { return SvxTabStopArr::Count(); }
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index e2f6d91..b2038d0 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -650,7 +650,7 @@ private:
SvxFontTable& rFontTable, SvxColorList& rColorList );
sal_Bool WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, sal_uInt16 nPara, sal_uInt16 nPos,
SvxFontTable& rFontTable, SvxColorList& rColorList );
- long LogicToTwips( long n );
+ sal_Int32 LogicToTwips( sal_Int32 n );
inline short GetXValue( short nXValue ) const;
inline sal_uInt16 GetXValue( sal_uInt16 nXValue ) const;
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 6246ae9..affa46d 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -761,7 +761,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput,
case EE_PARA_SBL:
{
rOutput << OOO_STRING_SVTOOLS_RTF_SL;
- long nVal = ((const SvxLineSpacingItem&)rItem).GetLineHeight();
+ sal_Int32 nVal = ((const SvxLineSpacingItem&)rItem).GetLineHeight();
char cMult = '0';
if ( ((const SvxLineSpacingItem&)rItem).GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP )
{
@@ -822,7 +822,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput,
case EE_CHAR_FONTHEIGHT_CTL:
{
rOutput << OOO_STRING_SVTOOLS_RTF_FS;
- long nHeight = ((const SvxFontHeightItem&)rItem).GetHeight();
+ sal_Int32 nHeight = ((const SvxFontHeightItem&)rItem).GetHeight();
nHeight = LogicToTwips( nHeight );
// Twips => HalfPoints
nHeight /= 10;
@@ -3082,13 +3082,12 @@ sal_Bool ImpEditEngine::ImplHasText() const
return ( ( GetEditDoc().Count() > 1 ) || GetEditDoc().GetObject(0)->Len() );
}
-long ImpEditEngine::LogicToTwips( long n )
+sal_Int32 ImpEditEngine::LogicToTwips(sal_Int32 n)
{
- Size aSz( n, 0 );
+ Size aSz(n, 0);
MapMode aTwipsMode( MAP_TWIP );
aSz = pRefDev->LogicToLogic( aSz, NULL, &aTwipsMode );
return aSz.Width();
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
index 3ad8db0..bcc453e 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -869,7 +869,7 @@ SvxTabStop::SvxTabStop()
// -----------------------------------------------------------------------
-SvxTabStop::SvxTabStop( const long nPos, const SvxTabAdjust eAdjst,
+SvxTabStop::SvxTabStop( const sal_Int32 nPos, const SvxTabAdjust eAdjst,
const sal_Unicode cDec, const sal_Unicode cFil )
{
nTabPos = nPos;
@@ -961,7 +961,7 @@ sal_uInt16 SvxTabStopItem::GetPos( const SvxTabStop& rTab ) const
// -----------------------------------------------------------------------
-sal_uInt16 SvxTabStopItem::GetPos( const long nPos ) const
+sal_uInt16 SvxTabStopItem::GetPos( const sal_Int32 nPos ) const
{
sal_uInt16 nFound;
return Seek_Entry( SvxTabStop( nPos ), &nFound ) ? nFound : SVX_TAB_NOTFOUND;
@@ -1158,7 +1158,7 @@ SfxItemPresentation SvxTabStopItem::GetPresentation
if ( bComma )
rText += sal_Unicode(',');
rText += GetMetricText(
- (long)((*this)[i]).GetTabPos(), eCoreUnit, ePresUnit, pIntl );
+ ((*this)[i]).GetTabPos(), eCoreUnit, ePresUnit, pIntl );
if ( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
rText += EE_RESSTR(GetMetricId(ePresUnit));
bComma = sal_True;
@@ -1179,7 +1179,7 @@ SfxPoolItem* SvxTabStopItem::Create( SvStream& rStrm, sal_uInt16 ) const
for ( sal_Int8 i = 0; i < nTabs; i++ )
{
- long nPos;
+ sal_Int32 nPos(0);
sal_Int8 eAdjust;
unsigned char cDecimal, cFill;
rStrm >> nPos >> eAdjust >> cDecimal >> cFill;
@@ -1205,21 +1205,21 @@ SvStream& SvxTabStopItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ )
const short nTabs = Count();
sal_uInt16 nCount = 0, nDefDist = 0;
- long nNew = 0;
+ sal_Int32 nNew = 0;
if( bStoreDefTabs )
{
const SvxTabStopItem& rDefTab = (const SvxTabStopItem &)
pPool->GetDefaultItem( pPool->GetWhich( SID_ATTR_TABSTOP, sal_False ) );
nDefDist = sal_uInt16( rDefTab.GetStart()->GetTabPos() );
- const long nPos = nTabs > 0 ? (*this)[nTabs-1].GetTabPos() : 0;
+ const sal_Int32 nPos = nTabs > 0 ? (*this)[nTabs-1].GetTabPos() : 0;
nCount = (sal_uInt16)(nPos / nDefDist);
nNew = (nCount + 1) * nDefDist;
if( nNew <= nPos + 50 )
nNew += nDefDist;
- long lA3Width = SvxPaperInfo::GetPaperSize(PAPER_A3).Width();
+ sal_Int32 lA3Width = SvxPaperInfo::GetPaperSize(PAPER_A3).Width();
nCount = (sal_uInt16)(nNew < lA3Width ? ( lA3Width - nNew ) / nDefDist + 1 : 0);
}
@@ -1227,7 +1227,7 @@ SvStream& SvxTabStopItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ )
for ( short i = 0; i < nTabs; i++ )
{
const SvxTabStop& rTab = (*this)[ i ];
- rStrm << (long) rTab.GetTabPos()
+ rStrm << rTab.GetTabPos()
<< (sal_Int8) rTab.GetAdjustment()
<< (unsigned char) rTab.GetDecimal()
<< (unsigned char) rTab.GetFill();
@@ -1237,7 +1237,7 @@ SvStream& SvxTabStopItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ )
for( ; nCount; --nCount )
{
SvxTabStop aSwTabStop(nNew, SVX_TAB_ADJUST_DEFAULT);
- rStrm << (long) aSwTabStop.GetTabPos()
+ rStrm << aSwTabStop.GetTabPos()
<< (sal_Int8) aSwTabStop.GetAdjustment()
<< (unsigned char) aSwTabStop.GetDecimal()
<< (unsigned char) aSwTabStop.GetFill();
commit 27fcc1a4384589ffb6f0899cf6c80338860f6b8d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jun 13 00:13:57 2011 +0100
rename SetKey to informative SetCryptMaskKey
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 729ed52..ad53d22 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1360,7 +1360,7 @@ sal_Bool BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurSt
else
{
// Perhaps there are additional information in the stream...
- xBasicStream->SetKey( szCryptingKey );
+ xBasicStream->SetCryptMaskKey(szCryptingKey);
xBasicStream->RefreshBuffer();
sal_uInt32 nPasswordMarker = 0;
*xBasicStream >> nPasswordMarker;
@@ -1370,7 +1370,7 @@ sal_Bool BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurSt
xBasicStream->ReadByteString(aPassword);
pLibInfo->SetPassword( aPassword );
}
- xBasicStream->SetKey( ByteString() );
+ xBasicStream->SetCryptMaskKey(rtl::OString());
CheckModules( pLibInfo->GetLib(), pLibInfo->IsReference() );
}
return bLoaded;
@@ -1390,7 +1390,7 @@ sal_Bool BasicManager::ImplEncryptStream( SvStream& rStrm ) const
{
// Should only be the case for encrypted Streams
bProtected = sal_True;
- rStrm.SetKey( szCryptingKey );
+ rStrm.SetCryptMaskKey(szCryptingKey);
rStrm.RefreshBuffer();
}
return bProtected;
@@ -1426,7 +1426,7 @@ sal_Bool BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic )
}
}
if ( bProtected )
- rStrm.SetKey( ByteString() );
+ rStrm.SetCryptMaskKey(rtl::OString());
return bLoaded;
}
commit 65279066bf6425fce726db603500866729a3bea6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jun 11 00:23:56 2011 +0100
createFromAscii -> RTL_CONSTASCII_USTRINGPARAM
diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index d933541..d4c32fc 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -2922,8 +2922,8 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite )
if ( m_bTransient )
{
aURL = getParentURL();
- if ( aURL.lastIndexOf( '/' ) != ( aURL.getLength() - 1 ) )
- aURL += rtl::OUString::createFromAscii( "/" );
+ if ( aURL.lastIndexOf('/') != ( aURL.getLength() - 1 ) )
+ aURL += rtl::OUString(static_cast<sal_Unicode>('/'));
aURL += m_aEscapedTitle;
}
commit 34c1a7ab8df7162af37d683e3bf25e23c4a5ef49
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jun 11 00:12:33 2011 +0100
createFromAscii -> RTL_CONSTASCII_USTRINGPARAM
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 7c19b11..143db79 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -535,7 +535,7 @@ void SAL_CALL ScVbaControl::setTabIndex( sal_Int32 /*nTabIndex*/ ) throw (uno::R
case form::FormComponentType::IMAGECONTROL:
return new ScVbaImage( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
}
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control." ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unsupported control.")), uno::Reference< uno::XInterface >() );
}
/*static*/ uno::Reference< msforms::XControl > ScVbaControlFactory::createUserformControl(
@@ -597,7 +597,7 @@ void SAL_CALL ScVbaControl::setTabIndex( sal_Int32 /*nTabIndex*/ ) throw (uno::R
xVBAControl.set( new VbaSystemAXControl( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
if( xVBAControl.is() )
return xVBAControl;
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control." ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unsupported control.")), uno::Reference< uno::XInterface >() );
}
rtl::OUString&
commit 6b1b65a9241c7c4cbe5f997606ef37b8db29caf6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jun 11 00:11:05 2011 +0100
createFromAscii -> RTL_CONSTASCII_USTRINGPARAM
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 42c4950..9c1b9ca 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -1565,7 +1565,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextUserHelpPack
{
Reference< XExtensionManager > xExtensionManager = ExtensionManager::get(m_xContext);
m_aUserPackagesSeq = xExtensionManager->getDeployedExtensions
- ( rtl::OUString::createFromAscii("user"), Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
+ ( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")), Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
m_bUserPackagesLoaded = true;
}
@@ -1593,7 +1593,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa
{
Reference< XExtensionManager > xExtensionManager = ExtensionManager::get(m_xContext);
m_aSharedPackagesSeq = xExtensionManager->getDeployedExtensions
- ( rtl::OUString::createFromAscii("shared"), Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
+ ( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("shared")), Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
m_bSharedPackagesLoaded = true;
}
@@ -1621,7 +1621,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextBundledHelpP
{
Reference< XExtensionManager > xExtensionManager = ExtensionManager::get(m_xContext);
m_aBundledPackagesSeq = xExtensionManager->getDeployedExtensions
- ( rtl::OUString::createFromAscii("bundled"), Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
+ ( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bundled")), Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
m_bBundledPackagesLoaded = true;
}
commit 5d6c2b791c009d270724aacfce364e759fdee923
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jun 11 00:09:25 2011 +0100
createFromAscii -> RTL_CONSTASCII_USTRINGPARAM
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 2bf3e2f..d35f566 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -536,7 +536,7 @@ sal_Bool SvxAutoCorrect::FnChgOrdinalNumber(
sal_Int32 nNum = rTxt.Copy( nSttPos, nNumEnd - nSttPos + 1 ).ToInt32( );
// Check if the characters after that number correspond to the ordinal suffix
- rtl::OUString sServiceName = rtl::OUString::createFromAscii( "com.sun.star.i18n.OrdinalSuffix" );
+ rtl::OUString sServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.OrdinalSuffix"));
uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix(
comphelper::createProcessComponent( sServiceName ),
uno::UNO_QUERY );
commit f2b4e2d36c738a02e88f9349bebb7e0c6ef22eff
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jun 11 00:05:05 2011 +0100
entire storage dir is unused/unbuilt
diff --git a/scripting/source/storage/ScriptData.hxx b/scripting/source/storage/ScriptData.hxx
deleted file mode 100644
index 3374e21..0000000
--- a/scripting/source/storage/ScriptData.hxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SCRIPTING_STORAGE_SCRIPTDATA_HXX_
-#define _SCRIPTING_STORAGE_SCRIPTDATA_HXX_
-
-#include <vector>
-#include <boost/unordered_map.hpp>
-
-#include <cppu/macros.hxx>
-#include <rtl/ustring.hxx>
-
-
-
-namespace scripting_impl
-{
-
-typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > str_pair;
-typedef ::std::vector< str_pair > props_vec;
-typedef ::boost::unordered_map< ::rtl::OUString, props_vec, ::rtl::OUStringHash,
- ::std::equal_to< ::rtl::OUString > > strpairvec_map;
-typedef ::boost::unordered_map< ::rtl::OUString, ::std::pair< ::rtl::OUString,
- ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > strpair_map;
-typedef ::boost::unordered_map< ::rtl::OUString, ::std::pair< props_vec, strpairvec_map >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > filesets_map;
-
-struct ScriptData
-{
-
- inline ScriptData::ScriptData() SAL_THROW( () )
- : parcelURI()
- , language()
- , locales()
- , functionname()
- , logicalname()
- , languagedepprops()
- , filesets()
- {
- }
-
- inline ScriptData::ScriptData( const ::rtl::OUString __parcelURI,
- const ::rtl::OUString& __language,
- const strpair_map& __locales,
- const ::rtl::OUString& __functionname,
- const ::rtl::OUString& __logicalname,
- const props_vec& __languagedepprops,
- const filesets_map& __filesets ) SAL_THROW( () )
- : parcelURI( __parcelURI )
- , language( __language )
- , locales( __locales )
- , functionname( __functionname )
- , logicalname( __logicalname )
- , languagedepprops( __languagedepprops )
- , filesets( __filesets )
- {
- }
-
- ::rtl::OUString parcelURI;
- ::rtl::OUString language;
- strpair_map locales;
- ::rtl::OUString functionname;
- ::rtl::OUString logicalname;
- props_vec languagedepprops;
- filesets_map filesets;
-};
-} // namespace scripting_impl
-#endif // _SCRIPTING_STORAGE_ScriptData_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptElement.cxx b/scripting/source/storage/ScriptElement.cxx
deleted file mode 100644
index 6552bbd..0000000
--- a/scripting/source/storage/ScriptElement.cxx
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_scripting.hxx"
-
-#include "ScriptElement.hxx"
-#include <util/util.hxx>
-
-using namespace ::rtl;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-typedef ::std::vector < ::std::pair < ::rtl::OUString, bool > > dependencies_vec;
-typedef ::std::vector < ::std::pair < ::rtl::OUString, ::rtl::OUString > > deliveries_vec;
-
-namespace scripting_impl
-{
-
-//*************************************************************************
-/**
- Construct a ScriptElement from a ScriptData object
-
- @param sII
- the ScriptDataObject
-*/
-ScriptElement::ScriptElement( ScriptData & sII ) :
- XMLElement( OUSTR( "parcel" ) ),
- m_sII( sII )
-{
- OSL_TRACE( "ScriptElement ctor called\n" );
-
- addAttribute( OUSTR( "language" ), sII.language );
- addAttribute( OUSTR( "xmlns:parcel" ), OUSTR( "scripting.dtd" ) );
- XMLElement* xScriptElt = new XMLElement( OUSTR( "script" ) );
- xScriptElt->addAttribute( OUSTR( "language" ), sII.language );
- Reference < xml::sax::XAttributeList > xal( xScriptElt );
- addSubElement( xal );
-
- strpair_map::const_iterator mp_it = sII.locales.begin();
- strpair_map::const_iterator mp_itend = sII.locales.end();
-
- for( ; mp_it != mp_itend; ++mp_it )
- {
- XMLElement* xel = new XMLElement( OUSTR( "locale" ) );
- xel->addAttribute( OUSTR( "lang" ), mp_it->first );
-
- {
- XMLElement* subxel = new XMLElement( OUSTR( "displayname" ) );
- subxel->addAttribute( OUSTR( "value" ), mp_it->second.first );
- Reference < xml::sax::XAttributeList > subxattl( subxel );
- xel->addSubElement( subxattl );
- }
- {
- XMLElement* subxel = new XMLElement( OUSTR( "description" ),
- mp_it->second.second );
- Reference< xml::sax::XAttributeList > subxattl( subxel );
- xel->addSubElement( subxattl );
- }
-
- Reference < xml::sax::XAttributeList > xal( xel );
- xScriptElt->addSubElement( xal );
- }
-
- {
- XMLElement* xel = new XMLElement( OUSTR( "functionname" ) );
- xel->addAttribute( OUSTR( "value" ), sII.functionname );
- Reference < xml::sax::XAttributeList > xal( xel );
- xScriptElt->addSubElement( xal );
- }
-
- {
- XMLElement* xel = new XMLElement( OUSTR( "logicalname" ) );
- xel->addAttribute( OUSTR( "value" ), sII.logicalname );
- Reference < xml::sax::XAttributeList > xal( xel );
- xScriptElt->addSubElement( xal );
- }
-
- props_vec::const_iterator vp_it = sII.languagedepprops.begin();
- props_vec::const_iterator vp_itend = sII.languagedepprops.end();
-
- if ( vp_it != vp_itend )
- {
- XMLElement* xel = new XMLElement( OUSTR( "languagedepprops" ) );
-
- for( ; vp_it != vp_itend ; ++vp_it )
- {
- XMLElement* subxel = new XMLElement( OUSTR( "prop" ) );
- subxel->addAttribute( OUSTR( "name" ), vp_it->first );
- subxel->addAttribute( OUSTR( "value" ), vp_it->second );
- Reference < xml::sax::XAttributeList > subxattl( subxel );
- xel->addSubElement( subxattl );
- }
-
- Reference < xml::sax::XAttributeList > xal( xel );
- xScriptElt->addSubElement( xal );
- }
-
- filesets_map::const_iterator fm_it = sII.filesets.begin();
- filesets_map::const_iterator fm_itend = sII.filesets.end();
-
- for( ; fm_it != fm_itend; ++fm_it )
- {
- XMLElement* xel = new XMLElement( OUSTR( "fileset" ) );
- xel->addAttribute( OUSTR( "name" ), fm_it->first );
-
- vp_it = fm_it->second.first.begin();
- vp_itend = fm_it->second.first.end();
-
- for( ; vp_it != vp_itend; ++vp_it )
- {
- XMLElement* subxel = new XMLElement( OUSTR( "prop" ) );
- subxel->addAttribute( OUSTR( "name" ), vp_it->first );
- subxel->addAttribute( OUSTR("value"), vp_it->second );
- Reference < xml::sax::XAttributeList > subxattl( subxel );
- xel->addSubElement( subxattl );
- }
-
- strpairvec_map::const_iterator sm_it = fm_it->second.second.begin();
- strpairvec_map::const_iterator sm_itend = fm_it->second.second.end();
-
- if( sm_it != sm_itend )
- {
- // was there a purpose for contstructing this
- // XMLElement* subxel = new XMLElement( OUSTR( "file" ) );
- xel->addAttribute( OUSTR( "name" ), sm_it->first );
-
- }
- }
-}
-
-//*************************************************************************
-ScriptElement::~ScriptElement() SAL_THROW(())
-{
-}
-
-} // namespace scripting_impl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptElement.hxx b/scripting/source/storage/ScriptElement.hxx
deleted file mode 100644
index d0a5976..0000000
--- a/scripting/source/storage/ScriptElement.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SCRIPT_FRAMEWORK_STORAGE_SCRIPT_ELEMENT_HXX_
-#define _SCRIPT_FRAMEWORK_STORAGE_SCRIPT_ELEMENT_HXX_
-
-#include <osl/mutex.hxx>
-
-#include "ScriptData.hxx"
-
-#include "XMLElement.hxx"
-
-namespace scripting_impl
-{
-// for simplification
-#define css ::com::sun::star
-#define dcsssf ::drafts::com::sun::star::script::framework
-
-class ScriptElement : public ::scripting_impl::XMLElement
-{
-public:
- /**
- Construct a ScriptElement from a ScriptData object
-
- @param sII
- the ScriptData Object
- */
- explicit ScriptElement( ScriptData & sII );
- ~ScriptElement() SAL_THROW (());
-
-private:
- ScriptData m_sII;
-
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptInfo.cxx b/scripting/source/storage/ScriptInfo.cxx
deleted file mode 100644
index 02c9c1d..0000000
--- a/scripting/source/storage/ScriptInfo.cxx
+++ /dev/null
@@ -1,376 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_scripting.hxx"
-#include <cppuhelper/implementationentry.hxx>
-
-#include <boost/unordered_map.hpp>
-
-#include <osl/file.hxx>
-#include <cppuhelper/implbase1.hxx>
-
-#include <com/sun/star/beans/XPropertyContainer.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-
-#include <drafts/com/sun/star/script/framework/storage/XScriptStorageManager.hpp>
-
-#include <util/util.hxx>
-#include "ScriptInfo.hxx"
-
-using namespace ::rtl;
-using namespace com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::drafts::com::sun::star::script::framework;
-using namespace ::drafts::com::sun::star::script::framework::storage;
-
-namespace scripting_impl
-{
-
-typedef ::boost::unordered_map < ::rtl::OUString, css::uno::Any, ::rtl::OUStringHash,
- ::std::equal_to< ::rtl::OUString > > PropertySet_hash;
-
-class PropertySetImpl : public ::cppu::WeakImplHelper1< css::beans::XPropertySet >
-{
-
-public:
-
- PropertySetImpl();
- ~PropertySetImpl();
-
-// XPropertySet implementation
- virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
- getPropertySetInfo()
- throw ( css::uno::RuntimeException );
- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
- const css::uno::Any& aValue )
- throw ( css::beans::UnknownPropertyException,
- css::beans::PropertyVetoException,
- css::lang::IllegalArgumentException,
- css::lang::WrappedTargetException,
- css::uno::RuntimeException );
- virtual css::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
- throw ( css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException,
- css::uno::RuntimeException );
- virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
- const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener )
- throw ( css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException,
- css::uno::RuntimeException );
- virtual void SAL_CALL removePropertyChangeListener(
- const ::rtl::OUString& aPropertyName,
- const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener )
- throw ( css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException,
- css::uno::RuntimeException );
- virtual void SAL_CALL addVetoableChangeListener(
- const ::rtl::OUString& PropertyName,
- const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener )
- throw ( css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException,
- css::uno::RuntimeException );
- virtual void SAL_CALL removeVetoableChangeListener(
- const ::rtl::OUString& PropertyName,
- const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener )
- throw ( css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException,
- css::uno::RuntimeException );
-
-private:
- friend class ScriptInfo;
-
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- void PropertySetImpl::privateSetPropertyValue( const ::rtl::OUString& aPropertyName, const Any& aValue )
- throw ( beans::UnknownPropertyException, beans::PropertyVetoException,
- lang::IllegalArgumentException, lang::WrappedTargetException,
- RuntimeException );
-
- osl::Mutex m_mutex;
- PropertySet_hash m_propertyMap;
-};
-
-PropertySetImpl::PropertySetImpl()
-{
- OSL_TRACE( "<PropertySetImpl ctor called\n" );
-}
-
-PropertySetImpl::~PropertySetImpl()
-{
- OSL_TRACE( "<PropertySetImpl dtor called\n>" );
-}
-
-Reference< beans::XPropertySetInfo > SAL_CALL PropertySetImpl::getPropertySetInfo( )
- throw ( RuntimeException )
-{
- return Reference< beans::XPropertySetInfo > (); // Not supported
-}
-
-void SAL_CALL PropertySetImpl::setPropertyValue( const ::rtl::OUString& aPropertyName,
- const Any& aValue )
- throw ( beans::UnknownPropertyException, beans::PropertyVetoException,
- lang::IllegalArgumentException, lang::WrappedTargetException,
- RuntimeException )
-{
- throw RuntimeException(
- OUSTR( "PropertySetImpl::setPropertyValue: method not supported. Read-only PropertySet" ),
- Reference< XInterface >() );
-}
-
-void PropertySetImpl::privateSetPropertyValue( const ::rtl::OUString& aPropertyName,
- const Any& aValue )
- throw ( beans::UnknownPropertyException, beans::PropertyVetoException,
- lang::IllegalArgumentException, lang::WrappedTargetException,
- RuntimeException )
-{
- ::osl::Guard< osl::Mutex > aGuard( m_mutex );
- m_propertyMap[ aPropertyName ] = aValue;
-}
-
-//*************************************************************************
-Any SAL_CALL PropertySetImpl::getPropertyValue( const ::rtl::OUString& PropertyName )
- throw ( beans::UnknownPropertyException,
- lang::WrappedTargetException, RuntimeException )
-{
- if ( m_propertyMap.find( PropertyName ) == m_propertyMap.end() )
- {
- throw RuntimeException(
-
- OUSTR( "PropertySetImpl::getPropertyValue: invalid PropertyName ").concat(
- PropertyName),
- Reference< XInterface >() );
- }
-
- ::osl::Guard< osl::Mutex > aGuard( m_mutex );
- Any returnValue = m_propertyMap[ PropertyName ];
-
- return returnValue;
-}
-
-//*************************************************************************
-void SAL_CALL PropertySetImpl::addPropertyChangeListener(
- const ::rtl::OUString& aPropertyName,
- const Reference< beans::XPropertyChangeListener >& xListener )
- throw ( beans::UnknownPropertyException, lang::WrappedTargetException,
- RuntimeException )
-{
- throw RuntimeException(
- OUSTR( "PropertySetImpl::addPropertyChangeListener: method not supported" ),
- Reference< XInterface >() );
-}
-
-//*************************************************************************
-void SAL_CALL PropertySetImpl::removePropertyChangeListener(
- const ::rtl::OUString& aPropertyName,
- const Reference< beans::XPropertyChangeListener >& aListener )
- throw ( beans::UnknownPropertyException, lang::WrappedTargetException,
- RuntimeException )
-{
- throw RuntimeException(
- OUSTR( "PropertySetImpl::removePropertyChangeListener: method not supported" ),
- Reference< XInterface >() );
-}
-
-//*************************************************************************
-void SAL_CALL PropertySetImpl::addVetoableChangeListener(
- const ::rtl::OUString& PropertyName,
- const Reference< beans::XVetoableChangeListener >& aListener )
- throw ( beans::UnknownPropertyException, lang::WrappedTargetException,
- RuntimeException )
-{
- throw RuntimeException(
- OUSTR( "PropertySetImpl::addVetoableChangeListener: method not supported" ),
- Reference< XInterface >() );
-}
-
-//*************************************************************************
-void SAL_CALL PropertySetImpl::removeVetoableChangeListener(
- const ::rtl::OUString& PropertyName,
- const Reference< beans::XVetoableChangeListener >& aListener )
- throw ( beans::UnknownPropertyException, lang::WrappedTargetException,
- RuntimeException )
-{
- throw RuntimeException(
- OUSTR( "PropertySetImpl::removeVetoableChangeListener: method not supported" ),
- Reference< XInterface >() );
-}
-
-
-//*************************************************************************
-ScriptInfo::ScriptInfo( const ScriptData & scriptData, sal_Int32 storageID )
- : m_scriptData( scriptData ), m_storageID( storageID )
-{
- OSL_TRACE( "< ++++++ ScriptInfo ctor called >\n" );
- OSL_TRACE( "< ++++++ parcelURI=%s>\n",::rtl::OUStringToOString(m_scriptData.parcelURI , RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-}
-//*************************************************************************
-ScriptInfo::~ScriptInfo()
-{
- OSL_TRACE( "< ScriptInfo dtor called >\n" );
-}
-//*************************************************************************
-OUString SAL_CALL ScriptInfo::getLogicalName( ) throw ( RuntimeException )
-{
- OSL_TRACE( "ScriptInfo::getLogicalName() " );
- return m_scriptData.logicalname;
-}
-
-//*************************************************************************
-OUString SAL_CALL ScriptInfo::getDescription( ) throw ( RuntimeException )
-{
- OUString rs_desc;
- // TDB need to determine locale here, hardcoded at the moment
- // to english
-
- OUString localeLang(RTL_CONSTASCII_USTRINGPARAM("en"));
- strpair_map::const_iterator str_it =
- m_scriptData.locales.find( localeLang );
-
- if( str_it == m_scriptData.locales.end() )
- {
- OSL_TRACE( "No description set in meta-data" );
- return rs_desc;
- }
- rs_desc = str_it->second.second;
- return rs_desc;
-}
-
-//*************************************************************************
-OUString SAL_CALL ScriptInfo::getLanguage( ) throw ( RuntimeException )
-{
- OSL_TRACE( "ScriptInfo::getLanguage() " );
- return m_scriptData.language;
-}
-
-//*************************************************************************
-OUString SAL_CALL ScriptInfo::getFunctionName( ) throw ( RuntimeException )
-{
- OSL_TRACE( "ScriptInfo::getFunctionName() " );
- return m_scriptData.functionname;
-}
-
-//*************************************************************************
-OUString SAL_CALL ScriptInfo::getParcelURI( ) throw ( RuntimeException )
-{
- return m_scriptData.parcelURI;
-}
-
-//*************************************************************************
-Reference< beans::XPropertySet > SAL_CALL ScriptInfo::getLanguageProperties( )
- throw ( RuntimeException )
-{
- PropertySetImpl* propSetImpl = new PropertySetImpl();
- Reference< beans::XPropertySet > xPropSet = propSetImpl;
-
- props_vec::const_iterator pv_it = m_scriptData.languagedepprops.begin();
- props_vec::const_iterator pv_itend = m_scriptData.languagedepprops.end();
-
- for( ; pv_it != pv_itend; ++pv_it )
- {
- try
- {
- propSetImpl->privateSetPropertyValue( pv_it->first, makeAny( pv_it->second ) );
- }
- catch( Exception& e )
- {
- OUString msg = OUSTR(
- "ScriptInfo::getLanguage caught exception while setting property," );
- msg = msg.concat( OUSTR( " PropertryName: " ) ).concat( pv_it->first );
- msg = msg.concat( OUSTR( " \nException message is: " ) );
- msg = msg.concat( e.Message );
- throw RuntimeException( msg , Reference< XInterface >() );
- }
- }
-
- return xPropSet;
-}
-//*************************************************************************
-css::uno::Sequence< ::rtl::OUString > SAL_CALL ScriptInfo::getFileSetNames()
-throw ( css::uno::RuntimeException )
-{
- OSL_TRACE("ScriptInfo::getFileSetNames");
- Sequence< OUString > results;
- filesets_map::iterator fsm_it = m_scriptData.filesets.begin();
- filesets_map::iterator fsm_itend = m_scriptData.filesets.end();
- if( fsm_it == fsm_itend )
- {
- OSL_TRACE( "ScriptInfo::getFileSetNames: no filesets" );
- return results;
- }
- results.realloc( m_scriptData.filesets.size() );
- for ( sal_Int32 count = 0; fsm_it != fsm_itend; ++fsm_it )
- {
- OUString fileSetName = fsm_it->first;
- OSL_TRACE( "ScriptInfo::getFileSetNames: adding name %s",
- ::rtl::OUStringToOString( fileSetName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- results[ count++ ] = fileSetName;
- }
- return results;
-}
-//*************************************************************************
-css::uno::Sequence< ::rtl::OUString > SAL_CALL
-ScriptInfo::getFilesInFileSet( const ::rtl::OUString & fileSetName )
-throw ( css::uno::RuntimeException )
-{
- Sequence< OUString > results;
- filesets_map::iterator fsm_it = m_scriptData.filesets.find( fileSetName );
- filesets_map::iterator fsm_itend = m_scriptData.filesets.end();
- if( fsm_it == fsm_itend )
- {
- OSL_TRACE( "ScriptInfo::getFilesInFileSet: no fileset named %s",
- ::rtl::OUStringToOString( fileSetName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- return results;
- }
-
- strpairvec_map files = fsm_it->second.second;
- strpairvec_map::iterator spvm_it = files.begin();
- strpairvec_map::iterator spvm_itend = files.end();
- if( spvm_it == spvm_itend )
- {
- OSL_TRACE( "ScriptInfo::getFilesInFileSet: no files in fileset %s",
- ::rtl::OUStringToOString( fileSetName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- return results;
- }
- results.realloc( files.size() );
- for( sal_Int32 count = 0; spvm_it != spvm_itend ; ++spvm_it )
- {
- OUString fileName = spvm_it->first;
- OSL_TRACE( "ScriptInfo::getFilesInFileSet: adding file %s",
- ::rtl::OUStringToOString( fileName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- results[ count++ ] = fileName;
- }
- return results;
-}
-//*************************************************************************
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptInfo.hxx b/scripting/source/storage/ScriptInfo.hxx
deleted file mode 100644
index e87f244..0000000
--- a/scripting/source/storage/ScriptInfo.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __SCRIPT_FRAMEWORK_STORAGE_SCRIPTINFO_HXX_
-#define __SCRIPT_FRAMEWORK_STORAGE_SCRIPTINFO_HXX_
-
-#include <cppuhelper/implbase1.hxx> // helper for component factory
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include <drafts/com/sun/star/script/framework/storage/XScriptInfo.hpp>
-
-#include "ScriptData.hxx"
-
-namespace scripting_impl
-{
-// for simplification
-#define css ::com::sun::star
-#define dcsssf ::drafts::com::sun::star::script::framework
-
-class ScriptInfo : public ::cppu::WeakImplHelper1< dcsssf::storage::XScriptInfo >
-{
-public:
- explicit ScriptInfo( const ScriptData & scriptData, sal_Int32 storageID );
- virtual ~ScriptInfo();
-
- // XScriptInfo
- virtual ::rtl::OUString SAL_CALL getLogicalName()
- throw ( css::uno::RuntimeException );
- virtual ::rtl::OUString SAL_CALL getDescription()
- throw ( css::uno::RuntimeException ) ;
- virtual ::rtl::OUString SAL_CALL getLanguage() throw ( css::uno::RuntimeException );
- virtual ::rtl::OUString SAL_CALL getFunctionName()
- throw ( css::uno::RuntimeException );
- virtual ::rtl::OUString SAL_CALL getParcelURI()
- throw ( css::uno::RuntimeException );
- virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL
- getLanguageProperties() throw ( css::uno::RuntimeException );
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getFileSetNames()
- throw ( css::uno::RuntimeException );
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL
- getFilesInFileSet( const ::rtl::OUString & fileSetName )
- throw ( css::uno::RuntimeException );
-
-private:
- ScriptData m_scriptData;
- sal_Int32 m_storageID;
-};
-
-}
-#endif // define __SCRIPTING_STORAGE...
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptInfoImpl.hxx b/scripting/source/storage/ScriptInfoImpl.hxx
deleted file mode 100644
index ba033f2..0000000
--- a/scripting/source/storage/ScriptInfoImpl.hxx
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SCRIPTING_STORAGE_SCRIPTINFOIMPL_HXX_
-#define _SCRIPTING_STORAGE_SCRIPTINFOIMPL_HXX_
-
-#include <vector>
-#include <map>
-
-#include <cppu/macros.hxx>
-#include <rtl/ustring.hxx>
-
-
-typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > str_pair;
-typedef ::std::map< ::rtl::OUString, str_pair,
- ::std::equal_to< ::rtl::OUString > > strpair_map;
-typedef ::std::vector< str_pair > props_vec;
-typedef ::std::map< ::rtl::OUString, ::std::pair< props_vec, strpair_map >,
- ::std::equal_to< ::rtl::OUString > > filesets_map;
-
-namespace scripting_impl
-{
-
-struct ScriptInfoImpl
-{
-
- inline ScriptInfoImpl::ScriptInfoImpl() SAL_THROW( () )
- : parcelURI()
- , language()
- , locales()
- , functionname()
- , logicalname()
- , languagedepprops()
- , filesets()
- {
- }
-
- inline ScriptInfoImpl::ScriptInfoImpl( const ::rtl::OUString __parcelURI,
- const ::rtl::OUString& __language,
- const strpair_map& __locales,
- const ::rtl::OUString& __functionname,
- const ::rtl::OUString& __logicalname,
- const langdepprops_vec& __languagedepprops,
- const filesets_map& __filesets ) SAL_THROW( () )
- : parcelURI( __parcelURI )
- , language( __language )
- , locales( __locales )
- , functionname( __functionname )
- , logicalname( __logicalname )
- , languagedepprops( __languagedepprops )
- , filesets( __filesets )
- {
- }
-
- ::rtl::OUString parcelURI;
- ::rtl::OUString language;
- strpair_map locales;
- ::rtl::OUString functionname;
- ::rtl::OUString logicalname;
- props_vec languagedepprops;
- filesets_map filesets;
-
-};
-
-
-} // namespace scripting_impl
-
-#endif // _SCRIPTING_STORAGE_SCRIPTINFOIMPL_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptMetadataImporter.cxx b/scripting/source/storage/ScriptMetadataImporter.cxx
deleted file mode 100644
index 6a035ee..0000000
--- a/scripting/source/storage/ScriptMetadataImporter.cxx
+++ /dev/null
@@ -1,509 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_scripting.hxx"
-
-#ifdef _DEBUG
-#include <stdio.h>
-#endif
-
-#include "ScriptMetadataImporter.hxx"
-
-#include <osl/mutex.hxx>
-
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <rtl/string.h>
-#include <tools/diagnose_ex.h>
-
-#include <util/util.hxx>
-
-using namespace ::rtl;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-namespace scripting_impl
-{
-//*************************************************************************
-ScriptMetadataImporter::ScriptMetadataImporter(
- const Reference< XComponentContext > & xContext )
- : m_xContext( xContext )
-{
- OSL_TRACE( "< ScriptMetadataImporter ctor called >\n" );
- ms_localeDesc = new OUStringBuffer();
-}
-
-//*************************************************************************
-ScriptMetadataImporter::~ScriptMetadataImporter() SAL_THROW( () )
-{
- OSL_TRACE( "< ScriptMetadataImporter dtor called >\n" );
- delete ms_localeDesc;
-}
-
-
-//*************************************************************************
-void ScriptMetadataImporter::parseMetaData(
- Reference< io::XInputStream > const & xInput,
- const ::rtl::OUString & parcelURI,
- InfoImpls_vec & io_ScriptDatas )
- throw ( xml::sax::SAXException, io::IOException, RuntimeException )
-{
-
- ::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
-
- mpv_ScriptDatas = &io_ScriptDatas;
- mpv_ScriptDatas->clear();
-
- //Set the placeholder for the parcel URI
- ms_parcelURI = parcelURI;
-
- //Get the parser service
- ENSURE_OR_THROW( m_xContext.is(),
- "ScriptMetadataImporter::parseMetaData: No context available" );
-
- Reference< lang::XMultiComponentFactory > xMgr( m_xContext->getServiceManager(), UNO_SET_THROW );
-
- Reference< xml::sax::XParser > xParser(
- xMgr->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.xml.sax.Parser" ), m_xContext ),
- UNO_QUERY_THROW );
-
- // xxx todo: error handler, entity resolver omitted
- // This class is the document handler for the parser
- Reference< xml::sax::XDocumentHandler > t_smI( this );
- xParser->setDocumentHandler( t_smI );
-
- //Set up the input for the parser, the XInputStream
- xml::sax::InputSource source;
- source.aInputStream = xInput;
- source.sSystemId = OUSTR( "virtual file" );
-
- OSL_TRACE( "ScriptMetadataImporter: Start the parser\n" );
-
- try
- {
- xParser->parseStream( source );
- }
- catch ( xml::sax::SAXException & saxe )
- {
- OUString msg(RTL_CONSTASCII_USTRINGPARAM(
- "ScriptMetadata:Importer::parserMetaData SAXException" ));
- msg.concat( saxe.Message );
- throw xml::sax::SAXException( msg, Reference< XInterface > (),
- saxe.WrappedException );
- }
- catch ( io::IOException & ioe )
- {
- throw io::IOException( OUString(RTL_CONSTASCII_USTRINGPARAM(
- "ScriptMetadataImporter::parseMetaData IOException: " )) + ioe.Message,
- Reference< XInterface > () );
- }
-
-#ifdef _DEBUG
- catch ( ... )
- {
- throw RuntimeException( OUString(RTL_CONSTASCII_USTRINGPARAM(
- "ScriptMetadataImporter::parseMetadata UnknownException: " )),
- Reference< XInterface > () );
- }
-#endif
-
- OSL_TRACE( "ScriptMetadataImporter: Parser finished\n ");
-
- OSL_TRACE( "ScriptMetadataImporter: vector size is %d\n",
- mpv_ScriptDatas->size() );
-}
-
-//*************************************************************************
-// XExtendedDocumentHandler impl
-void ScriptMetadataImporter::startCDATA()
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: startCDATA()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::endCDATA()
- throw ( RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: endDATA()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::comment( const ::rtl::OUString & sComment )
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: comment()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::allowLineBreak()
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: allowLineBreak()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::unknown( const ::rtl::OUString & sString )
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: unknown()\n" );
-}
-
-//*************************************************************************
-// XDocumentHandler impl
-void ScriptMetadataImporter::startDocument()
- throw ( xml::sax::SAXException, RuntimeException )
-{
- // Ignore for now
- OSL_TRACE( "ScriptMetadataImporter: startDocument()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::endDocument()
- throw ( xml::sax::SAXException, RuntimeException )
-{
- // Ignore for now
- OSL_TRACE( "ScriptMetadataImporter: endDocument()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::startElement(
- const ::rtl::OUString& tagName,
- const Reference< xml::sax::XAttributeList >& xAttribs )
- throw ( xml::sax::SAXException, RuntimeException )
-{
-
- OSL_TRACE( "Trace Message : ScriptMetadataImporter: startElement() %s\n",
- ::rtl::OUStringToOString( tagName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- ::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
-
- //Set the state of the state machine
- setState( tagName );
-
- //Processing the elements
- switch( m_state )
- {
- case SCRIPT:
- m_ScriptData.parcelURI = ms_parcelURI;
- m_ScriptData.language = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("language")));
- OSL_TRACE( "Trace Message: language is %s\n",
- ::rtl::OUStringToOString( m_ScriptData.language,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case LOCALE:
- ms_localeLang = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("lang")) );
- OSL_TRACE( "Trace Message: Locale is %s\n",
- ::rtl::OUStringToOString( ms_localeLang,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case DISPLAYNAME:
- ms_localeDisName = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")));
- OSL_TRACE( "Trace Message: Displyaname is %s\n",
- ::rtl::OUStringToOString( ms_localeDisName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case FUNCTIONNAME:
- m_ScriptData.functionname = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) );
- OSL_TRACE( "Trace Message: Functionname is %s\n",
- ::rtl::OUStringToOString( m_ScriptData.functionname,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case LOGICALNAME:
- m_ScriptData.logicalname = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")));
-#ifdef _DEBUG
- fprintf(stderr, "Trace Message: logicalname is %s\n",
- ::rtl::OUStringToOString( m_ScriptData.logicalname,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-#endif
- break;
- case LANGDEPPROPS:
- m_ScriptData.languagedepprops.push_back(
- ::std::make_pair( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) ),
- xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) )
- ));
- OSL_TRACE( "Trace Message: Langdepprops is %s\t%s\n",
- ::rtl::OUStringToOString( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer,
- ::rtl::OUStringToOString( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case FILESET:
- ms_filesetname = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) );
- OSL_TRACE( "Trace Message: filesetname is %s\n",
- ::rtl::OUStringToOString(ms_filesetname,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case FILESETPROPS:
- mv_filesetprops.push_back( ::std::make_pair(
- xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) ),
- xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) )
- ));
- OSL_TRACE( "Trace Message: filesetprops is %s\t%s\n",
- ::rtl::OUStringToOString( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer,
- ::rtl::OUStringToOString( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case FILES:
- ms_filename = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) );
- OSL_TRACE( "Trace Message: filename is %s\n",
- ::rtl::OUStringToOString( ms_filename,
- RTL_TEXTENCODING_ASCII_US).pData->buffer );
- break;
- case FILEPROPS:
- mv_fileprops.push_back(str_pair( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) ),
- xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) ) ) );
- OSL_TRACE( "Trace Message: fileprops is %s\t%s\n",
- ::rtl::OUStringToOString( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer,
- ::rtl::OUStringToOString( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
-
- // to prevent compiler warnings
- case PARCEL:
- case DESCRIPTION:
- case LANGUAGEDEPPROPS:
- break;
- }
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::endElement( const ::rtl::OUString & aName )
- throw ( xml::sax::SAXException, RuntimeException )
-{
-
- //The end tag of an element
- OSL_TRACE( "ScriptMetadataImporter: endElement() %s\n",
- ::rtl::OUStringToOString( aName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- ::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
-
- //Set the state
- setState( aName );
-
-
- switch ( m_state )
- {
- case PARCEL:
- break;
- case SCRIPT:
- // np adjust logicalName to be equal to function name
- // as logical name concept has been removed
- m_ScriptData.logicalname = m_ScriptData.functionname;
- mpv_ScriptDatas->push_back( m_ScriptData );
- m_ScriptData = ScriptData();
- break;
- case LOCALE:
- m_ScriptData.locales[ ms_localeLang ] = ::std::make_pair(
- ms_localeDisName, ms_localeDesc->makeStringAndClear().trim() );
- break;
- case FILESET:
- OSL_TRACE("adding fileset %s to filesets map",
- ::rtl::OUStringToOString( ms_filesetname,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- m_ScriptData.filesets[ ms_filesetname ] = ::std::make_pair(
- mv_filesetprops, mm_files );
- mm_files.clear();
- mv_filesetprops.clear();
- break;
- case FILES:
- OSL_TRACE("adding files %s to files map",
- ::rtl::OUStringToOString( ms_filename,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- mm_files[ ms_filename ] = mv_fileprops;
- mv_fileprops.clear();
- break;
- //
- // to prevent compiler warnings
- case DISPLAYNAME:
- case DESCRIPTION:
- case FUNCTIONNAME:
- case LOGICALNAME:
- case LANGUAGEDEPPROPS:
- case LANGDEPPROPS:
- case FILESETPROPS:
- case FILEPROPS:
- break;
- }
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::characters( const ::rtl::OUString & aChars )
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: characters()\n");
-
- ::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
-
- switch ( m_state )
- {
- case DESCRIPTION:
- //Put description into the struct
- ms_localeDesc->append(aChars);
- break;
- case PARCEL:
- case SCRIPT:
- case LOCALE:
- case DISPLAYNAME:
- case FUNCTIONNAME:
- case LOGICALNAME:
- case LANGUAGEDEPPROPS:
- case LANGDEPPROPS:
- case FILESETPROPS:
- case FILEPROPS:
- break;
- }
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::ignorableWhitespace(
- const ::rtl::OUString & aWhitespaces )
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: ignorableWhiteSpace()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::processingInstruction(
- const ::rtl::OUString & aTarget, const ::rtl::OUString & aData )
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: processingInstruction()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::setDocumentLocator(
- const Reference< xml::sax::XLocator >& xLocator )
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: setDocumentLocator()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::setState( const ::rtl::OUString & tagName )
-{
- //Set the state depending on the tag name of the current
- //element the parser has arrived at
- ::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
-
- if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "parcel" ) ) )
- {
- //Parcel tag
- m_state = PARCEL;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "script" ) ) )
- {
- m_state = SCRIPT;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "locale" ) ) )
- {
- m_state = LOCALE;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "displayname" ) ) )
- {
- m_state = DISPLAYNAME;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "description" ) ) )
- {
- m_state = DESCRIPTION;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "functionname" ) ) )
- {
- m_state = FUNCTIONNAME;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "logicalname" ) ) )
- {
- m_state = LOGICALNAME;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "languagedepprops" ) ) )
- {
- m_state = LANGUAGEDEPPROPS;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "prop" ) ) )
- {
- if( m_state == LANGUAGEDEPPROPS )
- {
- m_state = LANGDEPPROPS;
- }
- else if( m_state == FILESET )
- {
- m_state = FILESETPROPS;
- }
- else if( m_state == FILES )
- {
- m_state = FILEPROPS;
- }
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "fileset" ) ) )
- {
- m_state = FILESET;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "file" ) ) )
- {
- m_state = FILES;
- }
- else
- {
- //If there is a tag we don't know about, throw a exception (wobbler) :)
- ::rtl::OUString str_sax(RTL_CONSTASCII_USTRINGPARAM("No Such Tag"));
-
- OSL_TRACE( "ScriptMetadataImporter: No Such Tag: %s\n",
- ::rtl::OUStringToOString(
- tagName, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- throw xml::sax::SAXException(
- str_sax, Reference< XInterface >(), Any() );
- }
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptMetadataImporter.hxx b/scripting/source/storage/ScriptMetadataImporter.hxx
deleted file mode 100644
index e9d968c..0000000
--- a/scripting/source/storage/ScriptMetadataImporter.hxx
+++ /dev/null
@@ -1,254 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SCRIPTING_STORAGE_SCRIPTMETADATAIMPORTER_HXX_
-#define _SCRIPTING_STORAGE_SCRIPTMETADATAIMPORTER_HXX_
-
-#include <vector>
-
-#include <rtl/ustring.h>
-#include <rtl/ustrbuf.hxx>
-#include <osl/mutex.hxx>
-#include <cppuhelper/implbase1.hxx> // helper for component factory
-
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-
-#include "ScriptData.hxx"
-
-namespace scripting_impl
-{
-// for simplification
-#define css ::com::sun::star
-#define dcsssf ::drafts::com::sun::star::script::framework
-
-typedef ::std::vector< ScriptData > InfoImpls_vec;
-typedef ::std::pair< ::rtl::OUString, ::std::pair< ::rtl::OUString,
- ::rtl::OUString > > strpair_pair;
-
-/**
- * Script Meta Data Importer
- */
-class ScriptMetadataImporter : public
- ::cppu::WeakImplHelper1< css::xml::sax::XExtendedDocumentHandler >
-{
-public:
-
- /**
- * This function will begin the parser and parse the meta data
- *
- * @param xInput The XInputStream for the parser which contains the XML
- * @param parcelURI The parcel's URI in the document or the application
- *
- * @see css::io::XInputStream
- */
- void parseMetaData( css::uno::Reference< css::io::XInputStream >
- const & xInput, const ::rtl::OUString & parcelURI,
- InfoImpls_vec & io_ScriptDatas )
- throw ( css::xml::sax::SAXException, css::io::IOException,
- css::uno::RuntimeException );
-
- /**
- * Constructor for the meta-data parser
- *
- * @param XComponentContext
- */
- explicit ScriptMetadataImporter(
- const css::uno::Reference< css::uno::XComponentContext >& );
-
- /**
- * Destructor for the parser
- */
- virtual ~ScriptMetadataImporter() SAL_THROW( () );
-
- // XExtendedDocumentHandler impl
- /**
- * Function to handle the start of CDATA in XML
- *
- * @see com::sun::star::xml::sax::XExtendedDocumentHandler
- */
- virtual void SAL_CALL startCDATA()
- throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle the end of CDATA in XML
- *
- * @see com::sun::star::xml::sax::XExtendedDocumentHandler
- */
- virtual void SAL_CALL endCDATA() throw ( css::uno::RuntimeException );
-
- /**
- * Function to handle comments in XML
- *
- * @see com::sun::star::xml::sax::XExtendedDocumentHandler
- */
- virtual void SAL_CALL comment( const ::rtl::OUString & sComment )
- throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle line breaks in XML
- *
- * @see com::sun::star::xml::sax::XExtendedDocumentHandler
- */
- virtual void SAL_CALL allowLineBreak()
- throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle unknowns in XML
- *
- * @see com::sun::star::xml::sax::XExtendedDocumentHandler
- */
- virtual void SAL_CALL unknown( const ::rtl::OUString & sString )
- throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle the start of XML document
- *
- * @see com::sun::star::xml::sax::XExtendedDocumentHandler
- */
- // XDocumentHandler impl
- virtual void SAL_CALL startDocument()
- throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle the end of the XML document
- *
- * @see com::sun::star::xml::sax::XDocumentHandler
- */
- virtual void SAL_CALL endDocument()
- throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle the start of an element
- *
- * @see com::sun::star::xml::sax::XDocumentHandler
- */
- virtual void SAL_CALL startElement( const ::rtl::OUString& aName,
- const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs )
- throw ( css::xml::sax::SAXException,
- css::uno::RuntimeException );
-
- /**
- * Function to handle the end of an element
- *
- * @see com::sun::star::xml::sax::XDocumentHandler
- */
- virtual void SAL_CALL endElement( const ::rtl::OUString & aName )
- throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle characters in elements
- *
- * @see com::sun::star::xml::sax::XDocumentHandler
- */
- virtual void SAL_CALL characters( const ::rtl::OUString & aChars )
- throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle whitespace
- *
- * @see com::sun::star::xml::sax::XDocumentHandler
- */
- virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString & aWhitespaces )
- throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle XML processing instructions
- *
- * @see com::sun::star::xml::sax::XDocumentHandler
- */
- virtual void SAL_CALL processingInstruction(
- const ::rtl::OUString & aTarget, const ::rtl::OUString & aData )
- throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to set the document locator
- *
- * @see com::sun::star::xml::sax::XDocumentHandler
- */
- virtual void SAL_CALL setDocumentLocator(
- const css::uno::Reference< css::xml::sax::XLocator >& xLocator )
- throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
-
-
-private:
-
- /** Vector contains the ScriptData structs */
- InfoImpls_vec* mpv_ScriptDatas;
-
- /** @internal */
- osl::Mutex m_mutex;
-
- /** @internal */
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
-
- /** Placeholder for the parcel URI */
- ::rtl::OUString ms_parcelURI;
-
- /** States for state machine during parsing */
- enum { PARCEL, SCRIPT, LOCALE, DISPLAYNAME, DESCRIPTION, FUNCTIONNAME,
- LOGICALNAME, LANGUAGEDEPPROPS, LANGDEPPROPS, FILESET, FILESETPROPS,
- FILES, FILEPROPS } m_state;
-
- /** Build up the struct during parsing the meta data */
- ScriptData m_ScriptData;
-
- /** @internal */
- ::rtl::OUString ms_localeLang;
- ::rtl::OUString ms_localeDisName;
- ::rtl::OUStringBuffer *ms_localeDesc;
-
- props_vec mv_filesetprops;
-
- ::rtl::OUString ms_filename;
- ::rtl::OUString ms_filesetname;
-
- props_vec mv_fileprops;
-
- strpairvec_map mm_files;
-
- InfoImpls_vec mv_ScriptDatas;
-
- /**
- * Helper function to set the state
- *
- * @param tagName
- * The current tag being processed
- */
- void setState(const ::rtl::OUString & tagName);
-}
-; // class ScriptMetadataImporter
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptSecurityManager.cxx b/scripting/source/storage/ScriptSecurityManager.cxx
deleted file mode 100644
index def3c63..0000000
--- a/scripting/source/storage/ScriptSecurityManager.cxx
+++ /dev/null
@@ -1,528 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_scripting.hxx"
-
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/WrappedTargetException.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/UnknownPropertyException.hpp>
-#include <com/sun/star/container/XNameReplace.hpp>
-#include <com/sun/star/util/XChangesBatch.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
-#include <com/sun/star/util/XStringSubstitution.hpp>
-#include <com/sun/star/awt/XDialog.hpp>
-#include <com/sun/star/security/AccessControlException.hpp>
-#include <com/sun/star/security/RuntimePermission.hpp>
-#include <drafts/com/sun/star/script/framework/storage/XScriptStorageManager.hpp>
-#include <drafts/com/sun/star/script/framework/storage/XScriptInfoAccess.hpp>
-#include "ScriptSecurityManager.hxx"
-#include <util/util.hxx>
-#include <util/scriptingconstants.hxx>
-#include <tools/diagnose_ex.h>
-
-using namespace ::rtl;
-using namespace ::osl;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::drafts::com::sun::star::script::framework;
-
-// is this in the utils?
-const char* const SCRIPTSTORAGEMANAGER_SERVICE =
- "/singletons/drafts.com.sun.star.script.framework.storage.theScriptStorageManager";
-
-namespace scripting_securitymgr
-{
-
-static OUString s_configProv(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider"));
-
-static OUString s_configAccess(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess"));
-
-static OUString s_configUpdate(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationUpdateAccess"));
-
-static OUString s_securityDialog(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.script.framework.security.SecurityDialog"));
-
-static const int PERMISSION_NEVER = 0;
-static const int PERMISSION_PATHLIST = 1;
-static const int PERMISSION_ALWAYS = 2;
-
-static const int ALLOW_RUN = 1;
-static const int ADD_TO_PATH = 2;
-
-//*************************************************************************
-// ScriptSecurityManager Constructor
-ScriptSecurityManager::ScriptSecurityManager(
- const Reference< XComponentContext > & xContext ) throw ( RuntimeException )
- : m_xContext( xContext, UNO_SET_THROW )
-{
- OSL_TRACE( "< ScriptSecurityManager ctor called >\n" );
-
- // get the service manager from the context
- Reference< lang::XMultiComponentFactory > xMgr( m_xContext->getServiceManager(), UNO_SET_THROW );
-
- // create an instance of the ConfigurationProvider
- m_xConfigProvFactory.set( xMgr->createInstanceWithContext( s_configProv, m_xContext ), UNO_QUERY_THROW );
-}
-
-void ScriptSecurityManager::addScriptStorage( rtl::OUString scriptStorageURL,
- sal_Int32 storageID)
-throw ( RuntimeException )
-{
- Permission_Hash::const_iterator ph_it = m_permissionSettings.find( scriptStorageURL );
- if ( ph_it != m_permissionSettings.end() )
- {
- OSL_TRACE( "ScriptSecurityManager::addScriptStorage: already called for %s",
- ::rtl::OUStringToOString( scriptStorageURL,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer);
- return;
- }
- StoragePerm newPerm;
- newPerm.scriptStorageURL=scriptStorageURL;
- newPerm.storageID=storageID;
-
- // we err on the side of caution!!
- newPerm.execPermission=sal_False;
-
- //need to check if storage has any scripts
- try
- {
- // we have some scripts so read config & decide on that basis
- // Setup flags: m_runMacroSetting, m_warning, m_confirmationRequired,
- readConfiguration();
- }
- catch ( RuntimeException & rte )
- {
- OSL_TRACE( "ScriptSecurityManager::addScriptStorage: caught RuntimeException: %s",
- ::rtl::OUStringToOString( rte.Message,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer);
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager::addScriptStorage: caught RuntimeException" ).concat( rte.Message ),
- Reference< XInterface >() );
- }
-
- switch( m_runMacroSetting )
- {
- case PERMISSION_NEVER: // never
- {
- OSL_TRACE("never run");
- break;
- }
- case PERMISSION_PATHLIST: // according to path list
- {
- OSL_TRACE("according to path");
- // check path
- rtl::OUString path = scriptStorageURL.copy( 0, scriptStorageURL.lastIndexOf( '/' ) );
- OSL_TRACE( "no of elts in path list = %d",
- (int)m_secureURL.getLength() );
- bool match = isSecureURL( path );
- if( match && ( m_warning == sal_True ) )
- {
- OSL_TRACE("path match & warning dialog");
- int result = (int)executeStandardDialog();
- OSL_TRACE("result = %d", (int)result);
- if ( (result&ALLOW_RUN) == ALLOW_RUN )
- {
- newPerm.execPermission=sal_True;
- }
- break;
- }
- else if ( match )
- {
- OSL_TRACE("path match & no warning dialog");
- newPerm.execPermission=sal_True;
- break;
- }
- else if( m_confirmationRequired == sal_True )
- {
- OSL_TRACE("no path match & confirmation dialog");
- int result = (int)executePathDialog( path );
- OSL_TRACE("result = %d", (int)result);
- if ( (result&ALLOW_RUN) == ALLOW_RUN )
- {
- newPerm.execPermission=sal_True;
- }
- if ( (result&ADD_TO_PATH) == ADD_TO_PATH )
- {
- /* if checkbox clicked then need to add path to registry*/
- addToSecurePaths(path);
- }
- }
- break;
- }
- case PERMISSION_ALWAYS: // always
- if( m_warning == sal_True )
- {
- OSL_TRACE("always & warning dialog");
- short result = executeStandardDialog();
- if ( (result&ALLOW_RUN) == ALLOW_RUN )
- {
- newPerm.execPermission=sal_True;
- }
- }
- else
- {
- OSL_TRACE("always & no warning dialog");
- newPerm.execPermission=sal_True;
- }
- break;
- default:
- //
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager::addScriptStorage got invalid OfficeBasic setting"),
- Reference< XInterface > ());
- }
-
- if ( newPerm.execPermission == sal_True )
- {
- OSL_TRACE("setting exec permission to true for %s",
- ::rtl::OUStringToOString( scriptStorageURL,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
- else
- {
- OSL_TRACE("setting exec permission to false for %s",
- ::rtl::OUStringToOString( scriptStorageURL,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
-
- m_permissionSettings[ scriptStorageURL ] = newPerm;
-}
-
-bool ScriptSecurityManager::isSecureURL( const OUString & path )
-{
- bool match = false;
- OSL_TRACE( "no of elts in path list = %d",
- (int)m_secureURL.getLength() );
- OSL_TRACE("document path: %s",
- ::rtl::OUStringToOString( path,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer);
- int length = m_secureURL.getLength();
- for( int j = 0; j < length ; j++ )
- {
- OSL_TRACE("path list element: %s",
- ::rtl::OUStringToOString( m_secureURL[j],
- RTL_TEXTENCODING_ASCII_US ).pData->buffer);
-#ifdef WIN32
- OSL_TRACE("case insensitive comparison");
- if( path.equalsIgnoreAsciiCase( m_secureURL[j] ) )
-#else
- OSL_TRACE("case sensitive comparison");
- if( path.equals( m_secureURL[j] ) )
-#endif
- {
- match = true;
- break;
- }
- }
- return match;
-}
-
-short ScriptSecurityManager::executeStandardDialog()
-throw ( RuntimeException )
-{
- OUString dummyString;
- return executeDialog( dummyString );
-}
-
-short ScriptSecurityManager::executePathDialog( const OUString & path )
-throw ( RuntimeException )
-{
- return executeDialog( path );
-}
-
-short ScriptSecurityManager::executeDialog( const OUString & path )
-throw ( RuntimeException )
-{
- Sequence < Any > aArgs;
- if( path.getLength() != 0 )
- {
- OSL_TRACE("reallocing");
- aArgs.realloc(1);
- aArgs[ 0 ] <<= path;
- }
- short result;
- try
- {
- Reference< lang::XMultiComponentFactory > xMgr( m_xContext->getServiceManager(), UNO_SET_THROW );
- Reference< awt::XDialog > xDialog(
- xMgr->createInstanceWithArgumentsAndContext( s_securityDialog, aArgs, m_xContext ),
- UNO_QUERY_THROW );
- result = xDialog->execute();
- Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY_THROW );
- xComponent->dispose();
- }
- catch ( RuntimeException & rte )
- {
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager::executeDialog: caught RuntimeException: ").concat( rte.Message ),
- Reference< XInterface > ());
- }
- catch ( Exception & e )
- {
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager::executeDialog: caught Exception: ").concat( e.Message ),
- Reference< XInterface > ());
- }
- return result;
-}
-
-/**
- * checks to see whether the requested ScriptPermission is allowed.
- * This was modelled after the Java AccessController, but at this time
- * we can't see a good reason not to return a bool, rather than throw
- * an exception if the request is not granted (as is the case in Java).
- */
-void ScriptSecurityManager::checkPermission( const OUString & scriptStorageURL,
- const OUString & permissionRequest )
- throw ( RuntimeException, lang::IllegalArgumentException, security::AccessControlException )
-{
- if( permissionRequest.equals( OUString(RTL_CONSTASCII_USTRINGPARAM("execute")) ) )
- {
- OSL_TRACE(
- "ScriptSecurityManager::checkPermission: execute permission request for %s",
- ::rtl::OUStringToOString( scriptStorageURL,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer);
- Permission_Hash::const_iterator ph_it = m_permissionSettings.find( scriptStorageURL );
- Permission_Hash::const_iterator ph_itend =
- m_permissionSettings.end();
- if ( ph_it != ph_itend )
- {
- if ( ph_it->second.execPermission )
- {
- return;
- }
- else
- {
- OSL_TRACE( "permission refused" );
- Any aPermission;
- security::RuntimePermission permission;
- permission.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("execute")).concat( scriptStorageURL );
- aPermission <<= permission;
- throw security::AccessControlException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("ScriptSecurityManager::checkPermission: no execute permission for URL")).concat( scriptStorageURL ),
- Reference< XInterface > (), aPermission );
- }
- }
- // we should never get here!!
- throw lang::IllegalArgumentException( OUString(RTL_CONSTASCII_USTRINGPARAM("ScriptSecurityManager::checkPermission: storageURL not found")), Reference< XInterface > (), 0 );
- }
- // inappropriate permission request
- throw lang::IllegalArgumentException( OUString(RTL_CONSTASCII_USTRINGPARAM("ScriptSecurityManager::checkPermission: storageURL not found")), Reference< XInterface > (), 1 );
-}
-
-void ScriptSecurityManager::removePermissionSettings ( ::rtl::OUString & scriptStorageURL )
-{
- Permission_Hash::const_iterator ph_it =
- m_permissionSettings.find( scriptStorageURL );
-
- if ( ph_it == m_permissionSettings.end() )
- {
- OSL_TRACE( "Entry for storage url %s doesn't exist in map",
- ::rtl::OUStringToOString( scriptStorageURL,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer);
- return;
- }
-
- // erase the entry from the hash
- m_permissionSettings.erase( scriptStorageURL );
-
-}
-
-void ScriptSecurityManager::readConfiguration()
- throw ( RuntimeException)
-{
- try
- {
- beans::PropertyValue configPath;
- configPath.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath"));
- configPath.Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/Security/Scripting"));
- Sequence < Any > aargs( 1 );
- aargs[ 0 ] <<= configPath;
- ENSURE_OR_THROW( m_xConfigProvFactory.is(),
- "ScriptSecurityManager::readConfiguration: ConfigProviderFactory no longer valid!" );
- // get the XPropertySet interface from the ConfigurationAccess service
- Reference < beans::XPropertySet > xPropSet( m_xConfigProvFactory->createInstanceWithArguments( s_configAccess, aargs ), UNO_QUERY_THROW );
-
- m_confirmationRequired = sal_True;
- OSL_VERIFY( xPropSet->getPropertyValue( OUSTR( "Confirmation" ) ) >>= m_confirmationRequired );
- if ( m_confirmationRequired == sal_True )
- {
- OSL_TRACE( "ScriptSecurityManager:readConfiguration: confirmation is true" );
- }
- else
- {
- OSL_TRACE( "ScriptSecurityManager:readConfiguration: confirmation is false" );
- }
-
- m_warning = true;
- OSL_VERIFY( xPropSet->getPropertyValue( OUSTR( "Warning" ) ) >>= m_warning );
-
- if ( m_warning == sal_True )
- {
- OSL_TRACE( "ScriptSecurityManager:readConfiguration: warning is true" );
- }
- else
- {
- OSL_TRACE( "ScriptSecurityManager:readConfiguration: warning is false" );
- }
-
- m_runMacroSetting = sal_True;
- OSL_VERIFY( xPropSet->getPropertyValue( OUSTR( "OfficeBasic" ) ) >>= m_runMacroSetting );
- OSL_TRACE( "ScriptSecurityManager:readConfiguration: OfficeBasic = %d", m_runMacroSetting );
-
- m_secureURL = ::rtl::OUString();
- OSL_VERIFY( xPropSet->getPropertyValue( OUSTR( "SecureURL" ) ) >>= m_secureURL );
- }
- catch ( beans::UnknownPropertyException & upe )
- {
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager:readConfiguration: Attempt to read unknown property: " ).concat( upe.Message ),
- Reference< XInterface > () );
- }
- catch ( lang::WrappedTargetException & wte )
- {
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager:readConfiguration: wrapped target exception? :" ).concat( wte.Message ),
- Reference< XInterface > () );
- }
- catch ( Exception & e )
- {
- OSL_TRACE( "Unknown exception in readconf: %s",
- ::rtl::OUStringToOString(e.Message ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager:readConfiguration: exception? :" ).concat( e.Message ),
- Reference< XInterface > () );
- }
-#ifdef _DEBUG
- catch ( ... )
- {
- OSL_TRACE( "Completely Unknown exception in readconf!!!!!!");
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager:readConfiguration: exception? :" ),
- Reference< XInterface > () );
- }
-#endif
-
- int length = m_secureURL.getLength();
-
- // PathSubstitution needed to interpret variables found in config
- Reference< lang::XMultiComponentFactory > xMgr( m_xContext->getServiceManager(), UNO_SET_THROW );
- Reference< XInterface > xInterface = );
- Reference< util::XStringSubstitution > xStringSubstitution(
- xMgr->createInstanceWithContext(
- ::rtl::OUString::createFromAscii( "com.sun.star.util.PathSubstitution" ), m_xContext
- ),
- UNO_QUERY_THROW
- );
- for( int i = 0; i < length; i++ )
- {
- OSL_TRACE( "ScriptSecurityManager:readConfiguration path = %s",
- ::rtl::OUStringToOString(m_secureURL[i] ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- OSL_TRACE( "ScriptSecurityManager: subpath = %s",
- ::rtl::OUStringToOString(
- xStringSubstitution->substituteVariables( m_secureURL[i], true ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- m_secureURL[i] = xStringSubstitution->substituteVariables( m_secureURL[i], true );
- }
-#ifdef _DEBUG
- int length2 = m_secureURL.getLength();
- for( int j = 0; j < length2 ; j++ )
- {
- OSL_TRACE( "ScriptSecurityManager: path = %s",
- ::rtl::OUStringToOString(m_secureURL[j] ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
-#endif
-}
-
-void ScriptSecurityManager::addToSecurePaths( const OUString & path )
-throw ( RuntimeException )
-{
- OSL_TRACE( "--->ScriptSecurityManager::addToSecurePaths" );
- beans::PropertyValue configPath;
- configPath.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath"));
- configPath.Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/Security/Scripting"));
- Sequence < Any > aargs( 1 );
- aargs[ 0 ] <<= configPath;
- Reference < container::XNameReplace > xNameReplace(
- m_xConfigProvFactory->createInstanceWithArguments( s_configUpdate, aargs ), UNO_QUERY_THROW );
- Reference < util::XChangesBatch > xChangesBatch( xNameReplace, UNO_QUERY_THROW );
-
- OSL_TRACE( "--->ScriptSecurityManager::addToSecurePaths: after if stuff" );
- Reference < beans::XPropertySet > xPropSet( xInterface, UNO_QUERY );
- css::uno::Sequence< rtl::OUString > newSecureURL;
- Any value;
- OUString pathListPropName = OUSTR ( "SecureURL" );
- value=xPropSet->getPropertyValue( pathListPropName );
- if ( sal_False == ( value >>= newSecureURL ) )
- {
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager::addToSecurePaths: can't get SecureURL setting" ),
- Reference< XInterface > () );
- }
- try
- {
- sal_Int32 length = newSecureURL.getLength();
- newSecureURL.realloc( length + 1 );
- newSecureURL[ length ] = path;
- Any aNewSecureURL;
- aNewSecureURL <<= newSecureURL;
- xNameReplace->replaceByName( pathListPropName, aNewSecureURL );
- xChangesBatch->commitChanges();
- m_secureURL = newSecureURL;
- }
- catch ( Exception & e )
- {
- OSL_TRACE( "Error updating secure paths: " );
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager::addToSecurePaths: error updating SecureURL setting" ).concat( e.Message ),
- Reference< XInterface > () );
- }
-}
-
-//*************************************************************************
-// ScriptSecurityManager Destructor
-ScriptSecurityManager::~ScriptSecurityManager()
-{
- OSL_TRACE( "< ScriptSecurityManager dtor called >\n" );
-}
-
-} // Namespace
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptSecurityManager.hxx b/scripting/source/storage/ScriptSecurityManager.hxx
deleted file mode 100644
index 92b6699..0000000
--- a/scripting/source/storage/ScriptSecurityManager.hxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
-*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list