DEV300: changesets OOO330 up to m8

This commit is contained in:
Hans-Joachim Lankenau 2010-09-17 13:32:40 +02:00
commit bcf6f062a0
122 changed files with 3549 additions and 1120 deletions

View File

@ -44,6 +44,7 @@ class SbProcedureProperty;
class SbIfaceMapperMethod;
class SbClassModuleObject;
struct ClassModuleRunInitItem;
struct SbClassData;
class SbModuleImpl;
@ -71,6 +72,7 @@ protected:
SbxObjectRef pDocObject; // an impl object ( used by Document Modules )
bool bIsProxyModule;
static void implProcessModuleRunInit( ClassModuleRunInitItem& rItem );
void StartDefinitions();
SbMethod* GetMethod( const String&, SbxDataType );
SbProperty* GetProperty( const String&, SbxDataType );
@ -134,7 +136,7 @@ public:
void SetVBACompat( BOOL bCompat );
INT32 GetModuleType() { return mnType; }
void SetModuleType( INT32 nType ) { mnType = nType; }
bool GetIsProxyModule() { return bIsProxyModule; }
bool isProxyModule() { return bIsProxyModule; }
void AddVarName( const String& aName );
void RemoveVars();
::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule();

View File

@ -178,7 +178,7 @@ struct SbxValues
sal_uInt64 uInt64;
int nInt;
unsigned int nUInt;
String* pString;
::rtl::OUString* pOUString;
SbxDecimal* pDecimal;
SbxBase* pObj;
@ -212,7 +212,7 @@ struct SbxValues
SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {}
SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {}
SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {}
SbxValues( const String* _pString ): pString( (String*) _pString ), eType(SbxSTRING) {}
SbxValues( const ::rtl::OUString* _pString ): pOUString( (::rtl::OUString*)_pString ), eType(SbxSTRING) {}
SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {}
SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {}
SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {}
@ -237,7 +237,8 @@ class SbxValue : public SbxBase
SbxValue* TheRealValue() const;
protected:
SbxValues aData; // Data
String aPic; // Picture-String
::rtl::OUString aPic; // Picture-String
String aToolString; // tool string copy
virtual void Broadcast( ULONG ); // Broadcast-Call
virtual ~SbxValue();
@ -303,6 +304,7 @@ public:
UINT16 GetErr() const;
const String& GetString() const;
const String& GetCoreString() const;
::rtl::OUString GetOUString() const;
SbxDecimal* GetDecimal() const;
SbxBase* GetObject() const;
BOOL HasObject() const;
@ -325,8 +327,8 @@ public:
BOOL PutDate( double );
BOOL PutBool( BOOL );
BOOL PutErr( USHORT );
BOOL PutStringExt( const String& ); // with extended analysis (International, "TRUE"/"FALSE")
BOOL PutString( const String& );
BOOL PutStringExt( const ::rtl::OUString& ); // with extended analysis (International, "TRUE"/"FALSE")
BOOL PutString( const ::rtl::OUString& );
BOOL PutString( const sal_Unicode* ); // Type = SbxSTRING
BOOL PutpChar( const sal_Unicode* ); // Type = SbxLPSTR
BOOL PutDecimal( SbxDecimal* pDecimal );

130
basic/source/classes/sb.cxx Executable file → Normal file
View File

@ -57,6 +57,7 @@
#include <vos/mutex.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include "errobject.hxx"
#include <hash_map>
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/ModuleInfo.hpp>
@ -552,6 +553,39 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
USHORT nFlags_ = pProp->GetFlags();
pProp->SetFlag( SBX_NO_BROADCAST );
SbxProperty* pNewProp = new SbxProperty( *pProp );
// Special handling for modules instances and collections, they need
// to be instantiated, otherwise all refer to the same base object
SbxDataType eVarType = pProp->GetType();
if( eVarType == SbxOBJECT )
{
SbxBase* pObjBase = pProp->GetObject();
SbxObject* pObj = PTR_CAST(SbxObject,pObjBase);
if( pObj != NULL )
{
String aObjClass = pObj->GetClassName();
(void)aObjClass;
SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase);
if( pClassModuleObj != NULL )
{
SbModule* pLclClassModule = pClassModuleObj->getClassModule();
SbClassModuleObject* pNewObj = new SbClassModuleObject( pLclClassModule );
pNewObj->SetName( pProp->GetName() );
pNewObj->SetParent( pLclClassModule->pParent );
pNewProp->PutObject( pNewObj );
}
else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) )
{
String aCollectionName( RTL_CONSTASCII_USTRINGPARAM("Collection") );
BasicCollection* pNewCollection = new BasicCollection( aCollectionName );
pNewCollection->SetName( pProp->GetName() );
pNewCollection->SetParent( pClassModule->pParent );
pNewProp->PutObject( pNewCollection );
}
}
}
pNewProp->ResetFlag( SBX_NO_BROADCAST );
pNewProp->SetParent( this );
pProps->PutDirect( pNewProp, i );
@ -726,6 +760,7 @@ SbClassData::SbClassData( void )
void SbClassData::clear( void )
{
mxIfaces->Clear();
maRequiredTypes.clear();
}
SbClassFactory::SbClassFactory( void )
@ -981,6 +1016,72 @@ SbModule* StarBASIC::FindModule( const String& rName )
return NULL;
}
struct ClassModuleRunInitItem
{
SbModule* m_pModule;
bool m_bProcessing;
bool m_bRunInitDone;
//ModuleVector m_vModulesDependingOnThisModule;
ClassModuleRunInitItem( void )
: m_pModule( NULL )
, m_bProcessing( false )
, m_bRunInitDone( false )
{}
ClassModuleRunInitItem( SbModule* pModule )
: m_pModule( pModule )
, m_bProcessing( false )
, m_bRunInitDone( false )
{}
};
typedef std::hash_map< ::rtl::OUString, ClassModuleRunInitItem,
::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInitDependencyMap;
static ModuleInitDependencyMap* GpMIDMap = NULL;
void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
{
ModuleInitDependencyMap& rMIDMap = *GpMIDMap;
rItem.m_bProcessing = true;
//bool bAnyDependencies = true;
SbModule* pModule = rItem.m_pModule;
if( pModule->pClassData != NULL )
{
StringVector& rReqTypes = pModule->pClassData->maRequiredTypes;
if( rReqTypes.size() > 0 )
{
for( StringVector::iterator it = rReqTypes.begin() ; it != rReqTypes.end() ; ++it )
{
String& rStr = *it;
// Is required type a class module?
ModuleInitDependencyMap::iterator itFind = rMIDMap.find( rStr );
if( itFind != rMIDMap.end() )
{
ClassModuleRunInitItem& rParentItem = itFind->second;
if( rParentItem.m_bProcessing )
{
// TODO: raise error?
DBG_ERROR( "Cyclic module dependency detected" );
continue;
}
if( !rParentItem.m_bRunInitDone )
implProcessModuleRunInit( rParentItem );
}
}
}
}
pModule->RunInit();
rItem.m_bRunInitDone = true;
rItem.m_bProcessing = false;
}
// Run Init-Code of all modules (including inserted libraries)
void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
{
@ -994,10 +1095,33 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
// compile modules first then RunInit ( otherwise there is
// can be order dependency, e.g. classmodule A has a member
// of of type classmodule B and classmodule B hasn't been compiled yet )
// Consider required types to init in right order. Class modules
// that are required by other modules have to be initialized first.
ModuleInitDependencyMap aMIDMap;
GpMIDMap = &aMIDMap;
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
pModule->RunInit();
String aModuleName = pModule->GetName();
if( pModule->isProxyModule() )
aMIDMap[aModuleName] = ClassModuleRunInitItem( pModule );
}
ModuleInitDependencyMap::iterator it;
for( it = aMIDMap.begin() ; it != aMIDMap.end(); ++it )
{
ClassModuleRunInitItem& rItem = it->second;
SbModule::implProcessModuleRunInit( rItem );
}
GpMIDMap = NULL;
// Call RunInit on standard modules
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
if( !pModule->isProxyModule() )
pModule->RunInit();
}
// Check all objects if they are BASIC,
@ -1962,7 +2086,7 @@ void BasicCollection::CollItem( SbxArray* pPar_ )
if( nIndex >= 0 && nIndex < (INT32)xItemArray->Count32() )
pRes = xItemArray->Get32( nIndex );
if( !pRes )
SetError( SbxERR_BAD_INDEX );
SetError( SbERR_BAD_ARGUMENT );
else
*(pPar_->Get(0)) = *pRes;
}
@ -1980,6 +2104,6 @@ void BasicCollection::CollRemove( SbxArray* pPar_ )
if( nIndex >= 0 && nIndex < (INT32)xItemArray->Count32() )
xItemArray->Remove32( nIndex );
else
SetError( SbxERR_BAD_INDEX );
SetError( SbERR_BAD_ARGUMENT );
}

View File

@ -71,6 +71,7 @@
#include <com/sun/star/bridge/oleautomation/Date.hpp>
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
#include <com/sun/star/bridge/oleautomation/Currency.hpp>
#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
using com::sun::star::uno::Reference;
@ -300,7 +301,12 @@ SbUnoObject* createOLEObject_Impl( const String& aType )
SbUnoObject* pUnoObj = NULL;
if( xOLEFactory.is() )
{
Reference< XInterface > xOLEObject = xOLEFactory->createInstance( aType );
// some type names available in VBA can not be directly used in COM
::rtl::OUString aOLEType = aType;
if ( aOLEType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SAXXMLReader30" ) ) ) )
aOLEType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Msxml2.SAXXMLReader.3.0" ) );
Reference< XInterface > xOLEObject = xOLEFactory->createInstance( aOLEType );
if( xOLEObject.is() )
{
Any aAny;
@ -1460,7 +1466,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
aRetVal.setValue( &c , getCharCppuType() );
break;
}
case TypeClass_STRING: aRetVal <<= ::rtl::OUString( pVar->GetString() ); break;
case TypeClass_STRING: aRetVal <<= pVar->GetOUString(); break;
case TypeClass_FLOAT: aRetVal <<= pVar->GetSingle(); break;
case TypeClass_DOUBLE: aRetVal <<= pVar->GetDouble(); break;
//case TypeClass_OCTET: break;
@ -2265,6 +2271,7 @@ Reference< XInvocation > createDynamicInvocationFor( const Any& aAny );
SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
: SbxObject( aName_ )
, bNeedIntrospection( TRUE )
, bIgnoreNativeCOMObjectMembers( FALSE )
{
static Reference< XIntrospection > xIntrospection;
@ -2310,6 +2317,12 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
bNeedIntrospection = FALSE;
return;
}
// Ignore introspection based members for COM objects to avoid
// hiding of equally named COM symbols, e.g. XInvocation::getValue
Reference< oleautomation::XAutomationObject > xAutomationObject( aUnoObj_, UNO_QUERY );
if( xAutomationObject.is() )
bIgnoreNativeCOMObjectMembers = TRUE;
}
maTmpUnoObj = aUnoObj_;
@ -2553,7 +2566,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
if( !pRes )
{
::rtl::OUString aUName( rName );
if( mxUnoAccess.is() )
if( mxUnoAccess.is() && !bIgnoreNativeCOMObjectMembers )
{
if( mxExactName.is() )
{
@ -2713,10 +2726,12 @@ void SbUnoObject::implCreateAll( void )
// Instrospection besorgen
Reference< XIntrospectionAccess > xAccess = mxUnoAccess;
if( !xAccess.is() )
if( !xAccess.is() || bIgnoreNativeCOMObjectMembers )
{
if( mxInvocation.is() )
xAccess = mxInvocation->getIntrospection();
else if( bIgnoreNativeCOMObjectMembers )
return;
}
if( !xAccess.is() )
return;

View File

@ -138,11 +138,10 @@ void SbiCodeGen::Save()
pCLASSFAC->AddClassModule( &rMod );
nIfaceCount = pParser->aIfaceVector.size();
if( !rMod.pClassData )
rMod.pClassData = new SbClassData;
if( nIfaceCount )
{
if( !rMod.pClassData )
rMod.pClassData = new SbClassData;
for( int i = 0 ; i < nIfaceCount ; i++ )
{
const String& rIfaceName = pParser->aIfaceVector[i];
@ -152,6 +151,8 @@ void SbiCodeGen::Save()
pIfaces->Insert( pIfaceVar, pIfaces->Count() );
}
}
rMod.pClassData->maRequiredTypes = pParser->aRequiredTypes;
}
else
{
@ -161,6 +162,7 @@ void SbiCodeGen::Save()
rMod.mnType = com::sun::star::script::ModuleType::NORMAL;
rMod.bIsProxyModule = false;
}
if( pParser->bText )
p->SetFlag( SBIMG_COMPARETEXT );
// GlobalCode-Flag
@ -257,6 +259,10 @@ void SbiCodeGen::Save()
if( !pProc->IsPublic() )
pMeth->SetFlag( SBX_PRIVATE );
// Declare? -> Hidden
if( pProc->GetLib().Len() > 0 )
pMeth->SetFlag( SBX_HIDDEN );
pMeth->nStart = pProc->GetAddr();
pMeth->nLine1 = pProc->GetLine1();
pMeth->nLine2 = pProc->GetLine2();

View File

@ -161,6 +161,9 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
// In den String-Pool uebernehmen
rDef.SetTypeId( aGblStrings.Add( aCompleteName ) );
if( rDef.IsNew() && pProc == NULL )
aRequiredTypes.push_back( aCompleteName );
}
eType = SbxOBJECT;
break;
@ -874,7 +877,7 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl )
}
if( bCompatible && Peek() == PARAMARRAY )
{
if( bByVal || bByVal || bOptional )
if( bByVal || bOptional )
Error( SbERR_UNEXPECTED, PARAMARRAY );
Next();
bParamArray = TRUE;
@ -946,6 +949,8 @@ void SbiParser::DefDeclare( BOOL bPrivate )
Error( SbERR_UNEXPECTED, eCurTok );
else
{
bool bFunction = (eCurTok == FUNCTION);
SbiProcDef* pDef = ProcDecl( TRUE );
if( pDef )
{
@ -970,7 +975,70 @@ void SbiParser::DefDeclare( BOOL bPrivate )
aPublics.Add( pDef );
if ( pDef )
{
pDef->SetPublic( !bPrivate );
// New declare handling
if( pDef->GetLib().Len() > 0 )
{
if( bNewGblDefs && nGblChain == 0 )
{
nGblChain = aGen.Gen( _JUMP, 0 );
bNewGblDefs = FALSE;
}
USHORT nSavLine = nLine;
aGen.Statement();
pDef->Define();
pDef->SetLine1( nSavLine );
pDef->SetLine2( nSavLine );
SbiSymPool& rPool = pDef->GetParams();
USHORT nParCount = rPool.GetSize();
SbxDataType eType = pDef->GetType();
if( bFunction )
aGen.Gen( _PARAM, 0, sal::static_int_cast< UINT16 >( eType ) );
if( nParCount > 1 )
{
aGen.Gen( _ARGC );
for( USHORT i = 1 ; i < nParCount ; ++i )
{
SbiSymDef* pParDef = rPool.Get( i );
SbxDataType eParType = pParDef->GetType();
aGen.Gen( _PARAM, i, sal::static_int_cast< UINT16 >( eParType ) );
aGen.Gen( _ARGV );
USHORT nTyp = sal::static_int_cast< USHORT >( pParDef->GetType() );
if( pParDef->IsByVal() )
{
// Reset to avoid additional byval in call to wrapper function
pParDef->SetByVal( FALSE );
nTyp |= 0x8000;
}
aGen.Gen( _ARGTYP, nTyp );
}
}
aGen.Gen( _LIB, aGblStrings.Add( pDef->GetLib() ) );
SbiOpcode eOp = pDef->IsCdecl() ? _CALLC : _CALL;
USHORT nId = pDef->GetId();
if( pDef->GetAlias().Len() )
nId = ( nId & 0x8000 ) | aGblStrings.Add( pDef->GetAlias() );
if( nParCount > 1 )
nId |= 0x8000;
aGen.Gen( eOp, nId, sal::static_int_cast< UINT16 >( eType ) );
if( bFunction )
aGen.Gen( _PUT );
aGen.Gen( _LEAVE );
}
}
}
}
}

View File

@ -115,13 +115,8 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
}
else
{
SbiProcDef* pProc = aVar.pDef->GetProcDef();
// per DECLARE definiert?
if( pProc && pProc->GetLib().Len() )
eOp = pProc->IsCdecl() ? _CALLC : _CALL;
else
eOp = ( aVar.pDef->GetScope() == SbRTL ) ? _RTL :
(aVar.pDef->IsGlobal() ? _FIND_G : _FIND);
eOp = ( aVar.pDef->GetScope() == SbRTL ) ? _RTL :
(aVar.pDef->IsGlobal() ? _FIND_G : _FIND);
}
if( eOp == _FIND )
@ -187,17 +182,6 @@ void SbiExprNode::GenElement( SbiOpcode eOp )
aVar.pPar->Gen();
}
SbiProcDef* pProc = aVar.pDef->GetProcDef();
// per DECLARE definiert?
if( pProc )
{
// Dann evtl. einen LIB-Befehl erzeugen
if( pProc->GetLib().Len() )
pGen->Gen( _LIB, pGen->GetParser()->aGblStrings.Add( pProc->GetLib() ) );
// und den Aliasnamen nehmen
if( pProc->GetAlias().Len() )
nId = ( nId & 0x8000 ) | pGen->GetParser()->aGblStrings.Add( pProc->GetAlias() );
}
pGen->Gen( eOp, nId, sal::static_int_cast< UINT16 >( GetType() ) );
if( aVar.pvMorePar )
@ -223,13 +207,8 @@ void SbiExprList::Gen()
{
pParser->aGen.Gen( _ARGC );
// AB 10.1.96: Typ-Anpassung bei DECLARE
USHORT nCount = 1, nParAnz = 0;
SbiSymPool* pPool = NULL;
if( pProc )
{
pPool = &pProc->GetParams();
nParAnz = pPool->GetSize();
}
USHORT nCount = 1 /*, nParAnz = 0*/;
// SbiSymPool* pPool = NULL;
for( SbiExpression* pExpr = pFirst; pExpr; pExpr = pExpr->pNext,nCount++ )
{
pExpr->Gen();
@ -239,6 +218,7 @@ void SbiExprList::Gen()
USHORT nSid = pParser->aGblStrings.Add( pExpr->GetName() );
pParser->aGen.Gen( _ARGN, nSid );
/* TODO: Check after Declare concept change
// AB 10.1.96: Typanpassung bei named -> passenden Parameter suchen
if( pProc )
{
@ -246,39 +226,26 @@ void SbiExprList::Gen()
pParser->Error( SbERR_NO_NAMED_ARGS );
// Spaeter, wenn Named Args bei DECLARE moeglich
/*
for( USHORT i = 1 ; i < nParAnz ; i++ )
{
SbiSymDef* pDef = pPool->Get( i );
const String& rName = pDef->GetName();
if( rName.Len() )
{
if( pExpr->GetName().ICompare( rName )
== COMPARE_EQUAL )
{
pParser->aGen.Gen( _ARGTYP, pDef->GetType() );
break;
}
}
}
*/
//for( USHORT i = 1 ; i < nParAnz ; i++ )
//{
// SbiSymDef* pDef = pPool->Get( i );
// const String& rName = pDef->GetName();
// if( rName.Len() )
// {
// if( pExpr->GetName().ICompare( rName )
// == COMPARE_EQUAL )
// {
// pParser->aGen.Gen( _ARGTYP, pDef->GetType() );
// break;
// }
// }
//}
}
*/
}
else
{
pParser->aGen.Gen( _ARGV );
// Funktion mit DECLARE -> Typ-Anpassung
if( pProc && nCount < nParAnz )
{
SbiSymDef* pDef = pPool->Get( nCount );
USHORT nTyp = sal::static_int_cast< USHORT >(
pDef->GetType() );
// Zusätzliches Flag für BYVAL einbauen
if( pDef->IsByVal() )
nTyp |= 0x8000;
pParser->aGen.Gen( _ARGTYP, nTyp );
}
}
}
}

View File

@ -338,15 +338,6 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
// damit erwischen wir n% = 5 : print n
eType = eDefType;
}
// Funktion?
if( pDef->GetProcDef() )
{
SbiProcDef* pProc = pDef->GetProcDef();
if( pPar && pProc->GetLib().Len() ) // DECLARE benutzt?
pPar->SetProc( pProc );
// Wenn keine Pars, vorerst nichts machen
// Pruefung auf Typ-Anzahl waere denkbar
}
// Typcheck bei Variablen:
// ist explizit im Scanner etwas anderes angegeben?
// Bei Methoden ist dies OK!
@ -868,7 +859,6 @@ SbiExprList::SbiExprList( SbiParser* p )
{
pParser = p;
pFirst = NULL;
pProc = NULL;
nExpr =
nDim = 0;
bError =

View File

@ -34,39 +34,26 @@ TARGET=comp
.INCLUDE : settings.mk
CXXFILES= \
sbcomp.cxx \
dim.cxx \
exprtree.cxx \
exprnode.cxx \
exprgen.cxx \
codegen.cxx \
io.cxx \
loops.cxx \
parser.cxx \
scanner.cxx \
token.cxx \
symtbl.cxx \
buffer.cxx
SLOFILES= \
$(SLO)$/sbcomp.obj \
$(SLO)$/dim.obj \
$(SLO)$/exprtree.obj \
$(SLO)$/exprnode.obj \
$(SLO)$/exprgen.obj \
$(SLO)$/buffer.obj \
$(SLO)$/codegen.obj \
$(SLO)$/dim.obj \
$(SLO)$/exprgen.obj \
$(SLO)$/exprnode.obj \
$(SLO)$/exprtree.obj \
$(SLO)$/io.obj \
$(SLO)$/loops.obj \
$(SLO)$/parser.obj \
$(SLO)$/sbcomp.obj \
$(SLO)$/scanner.obj \
$(SLO)$/token.obj \
$(SLO)$/symtbl.obj \
$(SLO)$/buffer.obj
$(SLO)$/token.obj
EXCEPTIONSFILES= \
$(SLO)$/parser.obj \
$(SLO)$/exprtree.obj
$(SLO)$/codegen.obj \
$(SLO)$/dim.obj \
$(SLO)$/exprtree.obj \
$(SLO)$/parser.obj
# --- Targets --------------------------------------------------------------

View File

@ -261,7 +261,7 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl,
{
aStr.AppendAscii( "Entering " );
}
String aModuleName = pModule->GetName();
String aModuleName = pTraceMod->GetName();
aStr += aModuleName;
if( pMethod != NULL )
{

View File

@ -234,7 +234,6 @@ class SbiExprList { // Basisklasse fuer Parameter und Dims
protected:
SbiParser* pParser; // Parser
SbiExpression* pFirst; // Expressions
SbiProcDef* pProc; // DECLARE-Funktion (Parameter-Anpassung)
short nExpr; // Anzahl Expressions
short nDim; // Anzahl Dimensionen
BOOL bError; // TRUE: Fehler
@ -249,8 +248,6 @@ public:
SbiExpression* Get( short );
BOOL Test( const SbiProcDef& ); // Parameter-Checks
void Gen(); // Code-Erzeugung
// Setzen einer Funktionsdefinition zum Abgleich der Parameter
void SetProc( SbiProcDef* p ) { pProc = p; }
void addExpression( SbiExpression* pExpr );
};

View File

@ -34,7 +34,7 @@
#include <vector>
typedef ::std::vector< String > IfaceVector;
typedef ::std::vector< String > StringVector;
struct SbiParseStack;
@ -81,7 +81,8 @@ public:
BOOL bText; // OPTION COMPARE TEXT
BOOL bExplicit; // TRUE: OPTION EXPLICIT
BOOL bClassModule; // TRUE: OPTION ClassModule
IfaceVector aIfaceVector; // Holds all interfaces implemented by a class module
StringVector aIfaceVector; // Holds all interfaces implemented by a class module
StringVector aRequiredTypes; // Types used in Dim As New <type> outside subs
SbxDataType eDefTypes[26]; // DEFxxx-Datentypen
SbiParser( StarBASIC*, SbModule* );

View File

@ -50,10 +50,16 @@ public:
virtual SbxObject* CreateObject( const String& );
};
typedef ::std::vector< String > StringVector;
struct SbClassData
{
SbxArrayRef mxIfaces;
// types this module depends on because of use in Dim As New <type>
// needed for initialization order of class modules
StringVector maRequiredTypes;
SbClassData( void );
~SbClassData( void )
{ clear(); }

View File

@ -52,6 +52,7 @@ class SbUnoObject: public SbxObject
::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactName;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactNameInvocation;
BOOL bNeedIntrospection;
BOOL bIgnoreNativeCOMObjectMembers;
::com::sun::star::uno::Any maTmpUnoObj; // Only to save obj for doIntrospection!
// Hilfs-Methode zum Anlegen der dbg_-Properties

View File

@ -159,7 +159,8 @@ public:
void SetOptional() { bOpt = TRUE; }
void SetParamArray() { bParamArray = TRUE; }
void SetWithEvents() { bWithEvents = TRUE; }
void SetByVal() { bByVal = TRUE; }
void SetByVal( BOOL bByVal_ = TRUE )
{ bByVal = bByVal_; }
void SetStatic( BOOL bAsStatic = TRUE ) { bStatic = bAsStatic; }
void SetNew() { bNew = TRUE; }
void SetDefinedAs() { bAs = TRUE; }

View File

@ -520,11 +520,13 @@ RTLFUNC(DoEvents)
(void)pBasic;
(void)bWrite;
(void)rPar;
Timer aTimer;
aTimer.SetTimeout( 1 );
aTimer.Start();
while ( aTimer.IsActive() )
Application::Yield();
// Dummy implementation as the following code leads
// to performance problems for unknown reasons
//Timer aTimer;
//aTimer.SetTimeout( 1 );
//aTimer.Start();
//while ( aTimer.IsActive() )
// Application::Reschedule();
}
RTLFUNC(GetGUIVersion)
@ -1553,8 +1555,6 @@ RTLFUNC(Join)
}
typedef ::std::vector< String > StringVector;
RTLFUNC(Split)
{
(void)pBasic;

View File

@ -424,144 +424,143 @@ void SbiRuntime::StepPUT()
void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp )
{
// #67733 Typen mit Array-Flag sind auch ok
SbxDataType eValType = refVal->GetType();
SbxDataType eVarType = refVar->GetType();
if( (eValType != SbxOBJECT
&& eValType != SbxEMPTY
// seems like when using the default method its possible for objects
// to be empty ( no broadcast has taken place yet ) or the actual value is
&& !bHandleDefaultProp
&& !(eValType & SbxARRAY)) ||
(eVarType != SbxOBJECT
&& eVarType != SbxEMPTY
&& !bHandleDefaultProp
&& !(eVarType & SbxARRAY) ) )
// Check var, !object is no error for sure if, only if type is fixed
SbxDataType eVarType = refVar->GetType();
if( !bHandleDefaultProp && eVarType != SbxOBJECT && !(eVarType & SbxARRAY) && refVar->IsFixed() )
{
Error( SbERR_INVALID_USAGE_OBJECT );
return;
}
// Check value, !object is no error for sure if, only if type is fixed
SbxDataType eValType = refVal->GetType();
// bool bGetValObject = false;
if( !bHandleDefaultProp && eValType != SbxOBJECT && !(eValType & SbxARRAY) && refVal->IsFixed() )
{
Error( SbERR_INVALID_USAGE_OBJECT );
return;
}
// Getting in here causes problems with objects with default properties
// if they are SbxEMPTY I guess
if ( !bHandleDefaultProp || ( bHandleDefaultProp && eValType == SbxOBJECT ) )
{
// Auf refVal GetObject fuer Collections ausloesen
SbxBase* pObjVarObj = refVal->GetObject();
if( pObjVarObj )
{
SbxVariableRef refObjVal = PTR_CAST(SbxObject,pObjVarObj);
// #67733 Typen mit Array-Flag sind auch ok
if( refObjVal )
refVal = refObjVal;
else if( !(eValType & SbxARRAY) )
refVal = NULL;
}
}
// #52896 Wenn Uno-Sequences bzw. allgemein Arrays einer als
// Object deklarierten Variable zugewiesen werden, kann hier
// refVal ungueltig sein!
if( !refVal )
{
Error( SbERR_INVALID_USAGE_OBJECT );
}
else
{
// Getting in here causes problems with objects with default properties
// if they are SbxEMPTY I guess
if ( !bHandleDefaultProp || ( bHandleDefaultProp && refVal->GetType() == SbxOBJECT ) )
// Store auf die eigene Methode (innerhalb einer Function)?
BOOL bFlagsChanged = FALSE;
USHORT n = 0;
if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
{
// Auf refVal GetObject fuer Collections ausloesen
SbxBase* pObjVarObj = refVal->GetObject();
if( pObjVarObj )
{
SbxVariableRef refObjVal = PTR_CAST(SbxObject,pObjVarObj);
bFlagsChanged = TRUE;
n = refVar->GetFlags();
refVar->SetFlag( SBX_WRITE );
}
SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty,(SbxVariable*)refVar);
if( pProcProperty )
pProcProperty->setSet( true );
// #67733 Typen mit Array-Flag sind auch ok
if( refObjVal )
refVal = refObjVal;
else if( !(eValType & SbxARRAY) )
refVal = NULL;
if ( bHandleDefaultProp )
{
// get default properties for lhs & rhs where necessary
// SbxVariable* defaultProp = NULL; unused variable
bool bLHSHasDefaultProp = false;
// LHS try determine if a default prop exists
if ( refVar->GetType() == SbxOBJECT )
{
SbxVariable* pDflt = getDefaultProp( refVar );
if ( pDflt )
{
refVar = pDflt;
bLHSHasDefaultProp = true;
}
}
// RHS only get a default prop is the rhs has one
if ( refVal->GetType() == SbxOBJECT )
{
// check if lhs is a null object
// if it is then use the object not the default property
SbxObject* pObj = NULL;
pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar);
// calling GetObject on a SbxEMPTY variable raises
// object not set errors, make sure its an Object
if ( !pObj && refVar->GetType() == SbxOBJECT )
{
SbxBase* pObjVarObj = refVar->GetObject();
pObj = PTR_CAST(SbxObject,pObjVarObj);
}
SbxVariable* pDflt = NULL;
if ( pObj || bLHSHasDefaultProp )
// lhs is either a valid object || or has a defaultProp
pDflt = getDefaultProp( refVal );
if ( pDflt )
refVal = pDflt;
}
}
// #52896 Wenn Uno-Sequences bzw. allgemein Arrays einer als
// Object deklarierten Variable zugewiesen werden, kann hier
// refVal ungueltig sein!
if( !refVal )
// Handle withevents
BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
if ( bWithEvents )
{
Error( SbERR_INVALID_USAGE_OBJECT );
Reference< XInterface > xComListener;
SbxBase* pObj = refVal->GetObject();
SbUnoObject* pUnoObj = (pObj != NULL) ? PTR_CAST(SbUnoObject,pObj) : NULL;
if( pUnoObj != NULL )
{
Any aControlAny = pUnoObj->getUnoAny();
String aDeclareClassName = refVar->GetDeclareClassName();
::rtl::OUString aVBAType = aDeclareClassName;
::rtl::OUString aPrefix = refVar->GetName();
SbxObjectRef xScopeObj = refVar->GetParent();
xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
refVal->SetDeclareClassName( aDeclareClassName );
refVal->SetComListener( xComListener ); // Hold reference
}
*refVar = *refVal;
}
else
{
// Store auf die eigene Methode (innerhalb einer Function)?
BOOL bFlagsChanged = FALSE;
USHORT n = 0;
if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
{
bFlagsChanged = TRUE;
n = refVar->GetFlags();
refVar->SetFlag( SBX_WRITE );
}
SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty,(SbxVariable*)refVar);
if( pProcProperty )
pProcProperty->setSet( true );
if ( bHandleDefaultProp )
{
// get default properties for lhs & rhs where necessary
// SbxVariable* defaultProp = NULL; unused variable
bool bLHSHasDefaultProp = false;
// LHS try determine if a default prop exists
if ( refVar->GetType() == SbxOBJECT )
{
SbxVariable* pDflt = getDefaultProp( refVar );
if ( pDflt )
{
refVar = pDflt;
bLHSHasDefaultProp = true;
}
}
// RHS only get a default prop is the rhs has one
if ( refVal->GetType() == SbxOBJECT )
{
// check if lhs is a null object
// if it is then use the object not the default property
SbxObject* pObj = NULL;
pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar);
// calling GetObject on a SbxEMPTY variable raises
// object not set errors, make sure its an Object
if ( !pObj && refVar->GetType() == SbxOBJECT )
{
SbxBase* pObjVarObj = refVar->GetObject();
pObj = PTR_CAST(SbxObject,pObjVarObj);
}
SbxVariable* pDflt = NULL;
if ( pObj || bLHSHasDefaultProp )
// lhs is either a valid object || or has a defaultProp
pDflt = getDefaultProp( refVal );
if ( pDflt )
refVal = pDflt;
}
}
// Handle withevents
BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
if ( bWithEvents )
{
Reference< XInterface > xComListener;
SbxBase* pObj = refVal->GetObject();
SbUnoObject* pUnoObj = (pObj != NULL) ? PTR_CAST(SbUnoObject,pObj) : NULL;
if( pUnoObj != NULL )
{
Any aControlAny = pUnoObj->getUnoAny();
String aDeclareClassName = refVar->GetDeclareClassName();
::rtl::OUString aVBAType = aDeclareClassName;
::rtl::OUString aPrefix = refVar->GetName();
SbxObjectRef xScopeObj = refVar->GetParent();
xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
refVal->SetDeclareClassName( aDeclareClassName );
refVal->SetComListener( xComListener ); // Hold reference
}
*refVar = *refVal;
}
else
{
*refVar = *refVal;
}
// lhs is a property who's value is currently (Empty e.g. no broadcast yet)
// in this case if there is a default prop involved the value of the
// default property may infact be void so the type will also be SbxEMPTY
// in this case we do not want to call checkUnoStructCopy 'cause that will
// cause an error also
if ( !bHandleDefaultProp || ( bHandleDefaultProp && ( refVar->GetType() != SbxEMPTY ) ) )
// #67607 Uno-Structs kopieren
checkUnoStructCopy( refVal, refVar );
if( bFlagsChanged )
refVar->SetFlags( n );
*refVar = *refVal;
}
// lhs is a property who's value is currently (Empty e.g. no broadcast yet)
// in this case if there is a default prop involved the value of the
// default property may infact be void so the type will also be SbxEMPTY
// in this case we do not want to call checkUnoStructCopy 'cause that will
// cause an error also
if ( !bHandleDefaultProp || ( bHandleDefaultProp && ( refVar->GetType() != SbxEMPTY ) ) )
// #67607 Uno-Structs kopieren
checkUnoStructCopy( refVal, refVar );
if( bFlagsChanged )
refVar->SetFlags( n );
}
}

View File

@ -87,21 +87,20 @@ enum SbxBOOL ImpGetBool( const SbxValues* p )
case SbxSTRING:
case SbxLPSTR:
nRes = SbxFALSE;
if( p->pString )
if ( p->pOUString )
{
if( p->pString->EqualsIgnoreCaseAscii( SbxRes( STRING_TRUE ) ) )
if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_TRUE ) ) )
nRes = SbxTRUE;
else if( !p->pString->EqualsIgnoreCaseAscii( SbxRes( STRING_FALSE ) ) )
else if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) )
{
// Jetzt kann es noch in eine Zahl konvertierbar sein
BOOL bError = TRUE;
double n;
SbxDataType t;
USHORT nLen = 0;
String s( *p->pString );
if( ImpScan( s, n, t, &nLen ) == SbxERR_OK )
if( ImpScan( *p->pOUString, n, t, &nLen ) == SbxERR_OK )
{
if( nLen == s.Len() )
if( nLen == p->pOUString->getLength() )
{
bError = FALSE;
if( n != 0.0 )
@ -202,9 +201,10 @@ void ImpPutBool( SbxValues* p, INT16 n )
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
p->pString = new XubString;
*p->pString = SbxRes( n ? STRING_TRUE : STRING_FALSE );
if ( !p->pOUString )
p->pOUString = new ::rtl::OUString( SbxRes( n ? STRING_TRUE : STRING_FALSE ) );
else
*p->pOUString = SbxRes( n ? STRING_TRUE : STRING_FALSE );
break;
case SbxOBJECT:

View File

@ -165,13 +165,13 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
if( !p->pOUString )
nRes = 0;
else
{
double d;
SbxDataType t;
if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXBYTE )
{
@ -279,9 +279,9 @@ void ImpPutByte( SbxValues* p, BYTE n )
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
p->pString = new XubString;
ImpCvtNum( (double) n, 0, *p->pString );
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
ImpCvtNum( (double) n, 0, *p->pOUString );
break;
case SbxOBJECT:
{

View File

@ -39,7 +39,7 @@ using namespace rtl;
xub_Unicode ImpGetChar( const SbxValues* p )
{
SbxValues aTmp;
xub_Unicode nRes;
xub_Unicode nRes = 0;
start:
switch( +p->eType )
{
@ -156,13 +156,11 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
nRes = 0;
else
if ( p->pOUString )
{
double d;
SbxDataType t;
if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXCHAR )
{
@ -274,9 +272,10 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
p->pString = new XubString;
*p->pString = n;
if ( !p->pOUString )
p->pOUString = new ::rtl::OUString( n );
else
*p->pOUString = ::rtl::OUString( n );
break;
case SbxOBJECT:
{

View File

@ -33,13 +33,13 @@
class SbxArray;
// SBXSCAN.CXX
extern void ImpCvtNum( double nNum, short nPrec, String& rRes, BOOL bCoreString=FALSE );
extern void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreString=FALSE );
extern SbxError ImpScan
( const String& rSrc, double& nVal, SbxDataType& rType, USHORT* pLen,
( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, USHORT* pLen,
BOOL bAllowIntntl=FALSE, BOOL bOnlyIntntl=FALSE );
// mit erweiterter Auswertung (International, "TRUE"/"FALSE")
extern BOOL ImpConvStringExt( String& rSrc, SbxDataType eTargetType );
extern BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType );
// SBXINT.CXX
@ -116,9 +116,9 @@ void ImpPutDate( SbxValues*, double );
// SBXSTR.CXX
String ImpGetString( const SbxValues* );
String ImpGetCoreString( const SbxValues* );
void ImpPutString( SbxValues*, const String* );
::rtl::OUString ImpGetString( const SbxValues* );
::rtl::OUString ImpGetCoreString( const SbxValues* );
void ImpPutString( SbxValues*, const ::rtl::OUString* );
// SBXCHAR.CXX
@ -145,7 +145,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* );
void ImpPutBool( SbxValues*, INT16 );
// ByteArry <--> String
SbxArray* StringToByteArray(const String& rStr);
String ByteArrayToString(SbxArray* pArr);
SbxArray* StringToByteArray(const ::rtl::OUString& rStr);
::rtl::OUString ByteArrayToString(SbxArray* pArr);
#endif

View File

@ -37,8 +37,8 @@
#include <basic/sbxvar.hxx>
#include "sbxconv.hxx"
static String ImpCurrencyToString( const SbxINT64& );
static SbxINT64 ImpStringToCurrency( const String& );
static ::rtl::OUString ImpCurrencyToString( const SbxINT64& );
static SbxINT64 ImpStringToCurrency( const ::rtl::OUString& );
SbxINT64 ImpGetCurrency( const SbxValues* p )
{
@ -121,10 +121,10 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
if( !p->pOUString )
nRes.SetNull();
else
nRes = ImpStringToCurrency( *p->pString );
nRes = ImpStringToCurrency( *p->pOUString );
break;
case SbxOBJECT:
{
@ -224,10 +224,10 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
p->pString = new XubString;
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
*p->pString = ImpCurrencyToString( r );
*p->pOUString = ImpCurrencyToString( r );
break;
case SbxOBJECT:
{
@ -319,7 +319,7 @@ start:
// Hilfs-Funktionen zur Wandlung
static String ImpCurrencyToString( const SbxINT64 &r )
static ::rtl::OUString ImpCurrencyToString( const SbxINT64 &r )
{
BigInt a10000 = 10000;
@ -331,20 +331,20 @@ static String ImpCurrencyToString( const SbxINT64 &r )
aFrac %= a10000;
aFrac += a10000;
String aString;
::rtl::OUString aString;
if( r.nHigh < 0 )
aString = '-';
aString = ::rtl::OUString( (sal_Unicode)'-' );
aString += aInt.GetString();
aString += '.';
aString += ::rtl::OUString( (sal_Unicode)'.' );
aString += aFrac.GetString().GetBuffer()+1;
return aString;
}
static SbxINT64 ImpStringToCurrency( const String &r )
static SbxINT64 ImpStringToCurrency( const ::rtl::OUString &r )
{
int nDec = 4;
String aStr;
const sal_Unicode* p = r.GetBuffer();
const sal_Unicode* p = r.getStr();
if( *p == '-' )
aStr += *p++;

View File

@ -86,7 +86,7 @@ double ImpGetDate( const SbxValues* p )
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
if( !p->pOUString )
nRes = 0;
else
{
@ -125,7 +125,7 @@ double ImpGetDate( const SbxValues* p )
pFormatter->PutandConvertEntry( aStr, nCheckPos, nType,
nIndex, LANGUAGE_GERMAN, eLangType );
BOOL bSuccess = pFormatter->IsNumberFormat( *p->pString, nIndex, nRes );
BOOL bSuccess = pFormatter->IsNumberFormat( *p->pOUString, nIndex, nRes );
if ( bSuccess )
{
short nType_ = pFormatter->GetType( nIndex );
@ -243,8 +243,8 @@ start:
case SbxSTRING:
case SbxLPSTR:
{
if( !p->pString )
p->pString = new XubString;
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
Color* pColor;
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
@ -294,7 +294,9 @@ start:
nIndex,
LANGUAGE_GERMAN,
eLangType );
pFormatter->GetOutputString( n, nIndex, *p->pString, &pColor );
String aTmpString;
pFormatter->GetOutputString( n, nIndex, aTmpString, &pColor );
*p->pOUString = aTmpString;
delete pFormatter;
break;
}

View File

@ -76,7 +76,7 @@ double ImpGetDouble( const SbxValues* p )
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
if( !p->pOUString )
{
nRes = 0;
if ( SbiRuntime::isVBAEnabled() )// VBA only behaviour
@ -86,7 +86,7 @@ double ImpGetDouble( const SbxValues* p )
{
double d;
SbxDataType t;
if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
{
nRes = 0;
if ( SbiRuntime::isVBAEnabled() )// VBA only behaviour
@ -188,9 +188,9 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
p->pString = new XubString;
ImpCvtNum( (double) n, 14, *p->pString, bCoreString );
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
ImpCvtNum( (double) n, 14, *p->pOUString, bCoreString );
break;
case SbxOBJECT:
{

View File

@ -211,7 +211,7 @@ void SbxDecimal::setUInt( unsigned int val )
// sbxscan.cxx
void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep );
bool SbxDecimal::setString( String* pString )
bool SbxDecimal::setString( ::rtl::OUString* pOUString )
{
static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
@ -224,11 +224,11 @@ bool SbxDecimal::setString( String* pString )
HRESULT hResult;
if( cDecimalSep != '.' || cThousandSep != ',' )
{
int nLen = pString->Len();
int nLen = pOUString->getLength();
sal_Unicode* pBuffer = new sal_Unicode[nLen + 1];
pBuffer[nLen] = 0;
const sal_Unicode* pSrc = pString->GetBuffer();
const sal_Unicode* pSrc = pOUString->getStr();
int i;
for( i = 0 ; i < nLen ; ++i )
pBuffer[i] = pSrc[i];
@ -248,7 +248,7 @@ bool SbxDecimal::setString( String* pString )
}
else
{
hResult = VarDecFromStr( (OLECHAR*)pString->GetBuffer(), nLANGID, 0, &maDec );
hResult = VarDecFromStr( (OLECHAR*)pOUString->getStr(), nLANGID, 0, &maDec );
}
bRet = ( hResult == S_OK );
return bRet;
@ -373,7 +373,7 @@ bool SbxDecimal::setSingle( float val ) { (void)val; return false; }
bool SbxDecimal::setDouble( double val ) { (void)val; return false; }
void SbxDecimal::setInt( int val ) { (void)val; }
void SbxDecimal::setUInt( unsigned int val ) { (void)val; }
bool SbxDecimal::setString( String* pString ) { (void)pString; return false; }
bool SbxDecimal::setString( ::rtl::OUString* pOUString ) { (void)pOUString; return false; }
bool SbxDecimal::getChar( sal_Unicode& rVal ) { (void)rVal; return false; }
bool SbxDecimal::getByte( BYTE& rVal ) { (void)rVal; return false; }
@ -388,7 +388,7 @@ bool SbxDecimal::getUInt( unsigned int& rVal ) { (void)rVal; return false; }
#endif
bool SbxDecimal::getString( String& rString )
bool SbxDecimal::getString( ::rtl::OUString& rString )
{
#ifdef WIN32
static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
@ -528,7 +528,7 @@ start:
case SbxLPSTR:
case SbxSTRING:
case SbxBYREF | SbxSTRING:
pnDecRes->setString( p->pString ); break;
pnDecRes->setString( p->pOUString ); break;
case SbxOBJECT:
{
SbxValue* pVal = PTR_CAST(SbxValue,p->pObj);
@ -670,10 +670,10 @@ start:
case SbxLPSTR:
case SbxSTRING:
case SbxBYREF | SbxSTRING:
if( !p->pString )
p->pString = new XubString;
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
// ImpCvtNum( (double) n, 0, *p->pString );
pDec->getString( *p->pString );
pDec->getString( *p->pOUString );
break;
case SbxOBJECT:
{

View File

@ -85,7 +85,7 @@ public:
bool setDouble( double val );
void setInt( int val );
void setUInt( unsigned int val );
bool setString( String* pString );
bool setString( ::rtl::OUString* pOUString );
void setDecimal( SbxDecimal* pDecimal )
{
#ifdef WIN32
@ -106,7 +106,7 @@ public:
bool getDouble( double& rVal );
bool getInt( int& rVal );
bool getUInt( unsigned int& rVal );
bool getString( String& rString );
bool getString( ::rtl::OUString& rString );
bool operator -= ( const SbxDecimal &r );
bool operator += ( const SbxDecimal &r );

View File

@ -154,13 +154,13 @@ start:
case SbxLPSTR:
case SbxSTRING:
case SbxBYREF | SbxSTRING:
if( !p->pString )
if( !p->pOUString )
nRes = 0;
else
{
double d;
SbxDataType t;
if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXINT )
{
@ -275,9 +275,9 @@ start:
case SbxLPSTR:
case SbxSTRING:
case SbxBYREF | SbxSTRING:
if( !p->pString )
p->pString = new XubString;
ImpCvtNum( (double) n, 0, *p->pString );
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
ImpCvtNum( (double) n, 0, *p->pOUString );
break;
case SbxOBJECT:
{
@ -456,20 +456,19 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
if( !p->pOUString )
nRes = 0;
else
{
::rtl::OUString aOUStr( *p->pString );
::rtl::OString aOStr = ::rtl::OUStringToOString
( aOUStr, RTL_TEXTENCODING_ASCII_US );
( *p->pOUString, RTL_TEXTENCODING_ASCII_US );
nRes = aOStr.toInt64();
if( nRes == 0 )
{
// Check if really 0 or invalid conversion
double d;
SbxDataType t;
if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else
nRes = ImpDoubleToSalInt64( d );
@ -575,13 +574,12 @@ start:
case SbxSTRING:
case SbxLPSTR:
{
if( !p->pString )
p->pString = new XubString;
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
::rtl::OString aOStr = ::rtl::OString::valueOf( n );
::rtl::OUString aOUStr = ::rtl::OStringToOUString
(*p->pOUString) = ::rtl::OStringToOUString
( aOStr, RTL_TEXTENCODING_ASCII_US );
(*p->pString) = aOUStr;
break;
}
case SbxOBJECT:
@ -745,20 +743,19 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
if( !p->pOUString )
nRes = 0;
else
{
::rtl::OUString aOUStr( *p->pString );
::rtl::OString aOStr = ::rtl::OUStringToOString
( aOUStr, RTL_TEXTENCODING_ASCII_US );
( *p->pOUString, RTL_TEXTENCODING_ASCII_US );
sal_Int64 n64 = aOStr.toInt64();
if( n64 == 0 )
{
// Check if really 0 or invalid conversion
double d;
SbxDataType t;
if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXSALUINT64 )
{
@ -879,16 +876,15 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
p->pString = new XubString;
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
if( n > SbxMAXSALINT64 )
SbxBase::SetError( SbxERR_CONVERSION );
else
{
::rtl::OString aOStr = ::rtl::OString::valueOf( (sal_Int64)n );
::rtl::OUString aOUStr = ::rtl::OStringToOUString
(*p->pOUString) = ::rtl::OStringToOUString
( aOStr, RTL_TEXTENCODING_ASCII_US );
(*p->pString) = aOUStr;
}
break;
case SbxOBJECT:

View File

@ -119,13 +119,13 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
if( !p->pOUString )
nRes = 0;
else
{
double d;
SbxDataType t;
if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXLNG )
{
@ -240,9 +240,9 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
p->pString = new XubString;
ImpCvtNum( (double) n, 0, *p->pString );
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
ImpCvtNum( (double) n, 0, *p->pOUString );
break;
case SbxOBJECT:
{

View File

@ -86,6 +86,6 @@ const char* GetSbxRes( USHORT nId )
}
SbxRes::SbxRes( USHORT nId )
: XubString( String::CreateFromAscii( GetSbxRes( nId ) ) )
: ::rtl::OUString( ::rtl::OUString::createFromAscii( GetSbxRes( nId ) ) )
{}

View File

@ -75,7 +75,7 @@
#define SBXRES_MAX 44
class SbxRes : public String
class SbxRes : public ::rtl::OUString
{
public:
SbxRes( USHORT );

View File

@ -71,10 +71,10 @@ void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep )
// Das ganze gibt auch noch einen Konversionsfehler, wenn der Datentyp
// Fixed ist und das ganze nicht hineinpasst!
SbxError ImpScan( const XubString& rWSrc, double& nVal, SbxDataType& rType,
SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType,
USHORT* pLen, BOOL bAllowIntntl, BOOL bOnlyIntntl )
{
ByteString aBStr( rWSrc, RTL_TEXTENCODING_ASCII_US );
::rtl::OString aBStr( ::rtl::OUStringToOString( rWSrc, RTL_TEXTENCODING_ASCII_US ) );
// Bei International Komma besorgen
char cIntntlComma, cIntntl1000;
@ -100,7 +100,7 @@ SbxError ImpScan( const XubString& rWSrc, double& nVal, SbxDataType& rType,
cIntntl1000 = (char)cThousandSep;
}
const char* pStart = aBStr.GetBuffer();
const char* pStart = aBStr.getStr();
const char* p = pStart;
char buf[ 80 ], *q = buf;
BOOL bRes = TRUE;
@ -391,7 +391,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
#pragma warning(disable: 4748) // "... because optimizations are disabled ..."
#endif
void ImpCvtNum( double nNum, short nPrec, XubString& rRes, BOOL bCoreString )
void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreString )
{
char *q;
char cBuf[ 40 ], *p = cBuf;
@ -415,18 +415,18 @@ void ImpCvtNum( double nNum, short nPrec, XubString& rRes, BOOL bCoreString )
if( *p == cDecimalSep ) p--;
while( *q ) *++p = *q++;
*++p = 0;
rRes = String::CreateFromAscii( cBuf );
rRes = ::rtl::OUString::createFromAscii( cBuf );
}
#ifdef _MSC_VER
#pragma optimize( "", on )
#endif
BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType )
BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType )
{
// Merken, ob ueberhaupt was geaendert wurde
BOOL bChanged = FALSE;
String aNewString;
::rtl::OUString aNewString;
// Nur Spezial-Fälle behandeln, als Default tun wir nichts
switch( eTargetType )
@ -436,7 +436,7 @@ BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType )
case SbxDOUBLE:
case SbxCURRENCY:
{
ByteString aBStr( rSrc, RTL_TEXTENCODING_ASCII_US );
::rtl::OString aBStr( ::rtl::OUStringToOString( rSrc, RTL_TEXTENCODING_ASCII_US ) );
// Komma besorgen
sal_Unicode cDecimalSep, cThousandSep;
@ -446,10 +446,11 @@ BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType )
// Ersetzen, wenn DecimalSep kein '.' (nur den ersten)
if( cDecimalSep != (sal_Unicode)'.' )
{
USHORT nPos = aNewString.Search( cDecimalSep );
if( nPos != STRING_NOTFOUND )
sal_Int32 nPos = aNewString.indexOf( cDecimalSep );
if( nPos != -1 )
{
aNewString.SetChar( nPos, '.' );
sal_Unicode* pStr = (sal_Unicode*)aNewString.getStr();
pStr[nPos] = (sal_Unicode)'.';
bChanged = TRUE;
}
}
@ -459,15 +460,15 @@ BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType )
// Bei BOOL TRUE und FALSE als String pruefen
case SbxBOOL:
{
if( rSrc.EqualsIgnoreCaseAscii( "true" ) )
if( rSrc.equalsIgnoreAsciiCaseAscii( "true" ) )
{
aNewString = String::CreateFromInt32(SbxTRUE);
aNewString = ::rtl::OUString::valueOf( (sal_Int32)SbxTRUE );
bChanged = TRUE;
}
else
if( rSrc.EqualsIgnoreCaseAscii( "false" ) )
if( rSrc.equalsIgnoreAsciiCaseAscii( "false" ) )
{
aNewString = String::CreateFromInt32(SbxFALSE);
aNewString = ::rtl::OUString::valueOf( (sal_Int32)SbxFALSE );
bChanged = TRUE;
}
break;
@ -935,7 +936,11 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
//old: printfmtnum( GetDouble(), rRes, *pFmt );
}
else
ImpCvtNum( GetDouble(), nComma, rRes );
{
::rtl::OUString aTmpString( rRes );
ImpCvtNum( GetDouble(), nComma, aTmpString );
rRes = aTmpString;
}
break;
case SbxSTRING:
if( pFmt )

View File

@ -112,13 +112,13 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
if( !p->pOUString )
nRes = 0;
else
{
double d;
SbxDataType t;
if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXSNG )
{
@ -237,9 +237,9 @@ start:
case SbxSTRING:
case SbxLPSTR:
{
if( !p->pString )
p->pString = new XubString;
ImpCvtNum( (double) n, 6, *p->pString );
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
ImpCvtNum( (double) n, 6, *p->pOUString );
break;
}
case SbxOBJECT:

View File

@ -44,12 +44,12 @@ using namespace rtl;
// Die Konversion eines Items auf String wird ueber die Put-Methoden
// der einzelnen Datentypen abgewickelt, um doppelten Code zu vermeiden.
XubString ImpGetString( const SbxValues* p )
::rtl::OUString ImpGetString( const SbxValues* p )
{
SbxValues aTmp;
XubString aRes;
::rtl::OUString aRes;
aTmp.eType = SbxSTRING;
aTmp.pString = &aRes;
aTmp.pOUString = &aRes;
switch( +p->eType )
{
case SbxNULL:
@ -86,8 +86,8 @@ XubString ImpGetString( const SbxValues* p )
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( p->pString )
aRes = *p->pString;
if ( p->pOUString )
*aTmp.pOUString = *p->pOUString;
break;
case SbxOBJECT:
{
@ -109,7 +109,7 @@ XubString ImpGetString( const SbxValues* p )
case SbxERROR:
// Hier wird der String "Error n" erzeugt
aRes = SbxRes( STRING_ERRORMSG );
aRes += p->nUShort; break;
aRes += ::rtl::OUString( p->nUShort ); break;
case SbxDATE:
ImpPutDate( &aTmp, p->nDouble ); break;
@ -145,7 +145,7 @@ XubString ImpGetString( const SbxValues* p )
}
// AB 10.4.97, neue Funktion fuer SbxValue::GetCoreString()
XubString ImpGetCoreString( const SbxValues* p )
::rtl::OUString ImpGetCoreString( const SbxValues* p )
{
// Vorerst nur fuer double
if( ( p->eType & (~SbxBYREF) ) == SbxDOUBLE )
@ -153,7 +153,6 @@ XubString ImpGetCoreString( const SbxValues* p )
SbxValues aTmp;
XubString aRes;
aTmp.eType = SbxSTRING;
aTmp.pString = &aRes;
if( p->eType == SbxDOUBLE )
ImpPutDouble( &aTmp, p->nDouble, /*bCoreString=*/TRUE );
else
@ -164,15 +163,15 @@ XubString ImpGetCoreString( const SbxValues* p )
return ImpGetString( p );
}
void ImpPutString( SbxValues* p, const XubString* n )
void ImpPutString( SbxValues* p, const ::rtl::OUString* n )
{
SbxValues aTmp;
aTmp.eType = SbxSTRING;
XubString* pTmp = NULL;
::rtl::OUString* pTmp = NULL;
// Sicherheitshalber, falls ein NULL-Ptr kommt
if( !n )
n = pTmp = new XubString;
aTmp.pString = (XubString*) n;
n = pTmp = new ::rtl::OUString;
aTmp.pOUString = (::rtl::OUString*)n;
switch( +p->eType )
{
case SbxCHAR:
@ -209,14 +208,15 @@ void ImpPutString( SbxValues* p, const XubString* n )
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( n->Len() )
if( n->getLength() )
{
if( !p->pString )
p->pString = new XubString;
*p->pString = *n;
if( !p->pOUString )
p->pOUString = new ::rtl::OUString( *n );
else
*p->pOUString = *n;
}
else
delete p->pString, p->pString = NULL;
delete p->pOUString, p->pOUString = NULL;
break;
case SbxOBJECT:
{
@ -258,18 +258,18 @@ void ImpPutString( SbxValues* p, const XubString* n )
}
// Convert string to an array of bytes, preserving unicode (2bytes per character)
SbxArray* StringToByteArray(const String& rStr)
SbxArray* StringToByteArray(const ::rtl::OUString& rStr)
{
USHORT nArraySize = rStr.Len() * 2;
const sal_Unicode* pSrc = rStr.GetBuffer();
sal_Int32 nArraySize = rStr.getLength() * 2;
const sal_Unicode* pSrc = rStr.getStr();
SbxDimArray* pArray = new SbxDimArray(SbxBYTE);
bool bIncIndex = ( IsBaseIndexOne() && SbiRuntime::isVBAEnabled() );
if( nArraySize )
{
if( bIncIndex )
pArray->AddDim( 1, nArraySize );
pArray->AddDim32( 1, nArraySize );
else
pArray->AddDim( 0, nArraySize-1 );
pArray->AddDim32( 0, nArraySize-1 );
}
else
{
@ -290,7 +290,7 @@ SbxArray* StringToByteArray(const String& rStr)
}
// Convert an array of bytes to string (2bytes per character)
String ByteArrayToString(SbxArray* pArr)
::rtl::OUString ByteArrayToString(SbxArray* pArr)
{
USHORT nCount = pArr->Count();
OUStringBuffer aStrBuf;
@ -315,7 +315,5 @@ String ByteArrayToString(SbxArray* pArr)
aStrBuf.append(aChar);
}
String aStr(aStrBuf.makeStringAndClear());
return aStr;
return aStrBuf.makeStringAndClear();
}

View File

@ -151,13 +151,13 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
if( !p->pOUString )
nRes = 0;
else
{
double d;
SbxDataType t;
if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXUINT )
{
@ -272,9 +272,9 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
p->pString = new XubString;
ImpCvtNum( (double) n, 0, *p->pString );
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
ImpCvtNum( (double) n, 0, *p->pOUString );
break;
case SbxOBJECT:
{

View File

@ -127,13 +127,13 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
if( !p->pOUString )
nRes = 0;
else
{
double d;
SbxDataType t;
if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXULNG )
{
@ -246,9 +246,9 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pString )
p->pString = new XubString;
ImpCvtNum( (double) n, 0, *p->pString );
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
ImpCvtNum( (double) n, 0, *p->pOUString );
break;
case SbxOBJECT:
{

View File

@ -236,7 +236,7 @@ SbxValue::SbxValue( SbxDataType t, void* p ) : SbxBase()
case SbxSINGLE: n |= SbxBYREF; aData.pSingle = (float*) p; break;
case SbxDATE:
case SbxDOUBLE: n |= SbxBYREF; aData.pDouble = (double*) p; break;
case SbxSTRING: n |= SbxBYREF; aData.pString = (XubString*) p; break;
case SbxSTRING: n |= SbxBYREF; aData.pOUString = (::rtl::OUString*) p; break;
case SbxERROR:
case SbxUSHORT:
case SbxBOOL: n |= SbxBYREF; aData.pUShort = (UINT16*) p; break;
@ -280,8 +280,8 @@ SbxValue::SbxValue( const SbxValue& r )
switch( aData.eType )
{
case SbxSTRING:
if( aData.pString )
aData.pString = new XubString( *aData.pString );
if( aData.pOUString )
aData.pOUString = new ::rtl::OUString( *aData.pOUString );
break;
case SbxOBJECT:
if( aData.pObj )
@ -309,7 +309,7 @@ SbxValue& SbxValue::operator=( const SbxValue& r )
&& aData.pObj && ( aData.pObj->GetType() == (SbxARRAY | SbxBYTE) )
&& (r.aData.eType == SbxSTRING) )
{
String aStr = r.GetString();
::rtl::OUString aStr = r.GetString();
SbxArray* pArr = StringToByteArray(aStr);
PutObject(pArr);
return *this;
@ -323,7 +323,7 @@ SbxValue& SbxValue::operator=( const SbxValue& r )
SbxArray* pArr = PTR_CAST(SbxArray, pObj);
if( pArr )
{
String aStr = ByteArrayToString( pArr );
::rtl::OUString aStr = ByteArrayToString( pArr );
PutString(aStr);
return *this;
}
@ -385,7 +385,7 @@ void SbxValue::Clear()
case SbxVOID:
break;
case SbxSTRING:
delete aData.pString; aData.pString = NULL;
delete aData.pOUString; aData.pOUString = NULL;
break;
case SbxOBJECT:
if( aData.pObj )
@ -551,9 +551,9 @@ BOOL SbxValue::Get( SbxValues& rRes ) const
case SbxULONG: rRes.nULong = ImpGetULong( &p->aData ); break;
case SbxLPSTR:
case SbxSTRING: p->aPic = ImpGetString( &p->aData );
rRes.pString = &p->aPic; break;
rRes.pOUString = &p->aPic; break;
case SbxCoreSTRING: p->aPic = ImpGetCoreString( &p->aData );
rRes.pString = &p->aPic; break;
rRes.pOUString = &p->aPic; break;
case SbxINT:
#if SAL_TYPES_SIZEOFINT == 2
rRes.nInt = (int) ImpGetInteger( &p->aData );
@ -618,13 +618,11 @@ const XubString& SbxValue::GetString() const
SbxValues aRes;
aRes.eType = SbxSTRING;
if( Get( aRes ) )
// Geht in Ordnung, da Ptr eine Kopie ist
return *aRes.pString;
((SbxValue*) this)->aToolString = *aRes.pOUString;
else
{
((SbxValue*) this)->aPic.Erase();
return aPic;
}
((SbxValue*) this)->aToolString.Erase();
return aToolString;
}
const XubString& SbxValue::GetCoreString() const
@ -632,13 +630,22 @@ const XubString& SbxValue::GetCoreString() const
SbxValues aRes;
aRes.eType = SbxCoreSTRING;
if( Get( aRes ) )
// Geht in Ordnung, da Ptr eine Kopie ist
return *aRes.pString;
((SbxValue*) this)->aToolString = *aRes.pOUString;
else
{
((SbxValue*) this)->aPic.Erase();
return aPic;
}
((SbxValue*) this)->aToolString.Erase();
return aToolString;
}
::rtl::OUString SbxValue::GetOUString() const
{
::rtl::OUString aResult;
SbxValues aRes;
aRes.eType = SbxSTRING;
if( Get( aRes ) )
aResult = *aRes.pOUString;
return aResult;
}
BOOL SbxValue::HasObject() const
@ -727,7 +734,7 @@ BOOL SbxValue::Put( const SbxValues& rVal )
case SbxUSHORT: ImpPutUShort( &p->aData, rVal.nUShort ); break;
case SbxULONG: ImpPutULong( &p->aData, rVal.nULong ); break;
case SbxLPSTR:
case SbxSTRING: ImpPutString( &p->aData, rVal.pString ); break;
case SbxSTRING: ImpPutString( &p->aData, rVal.pOUString ); break;
case SbxINT:
#if SAL_TYPES_SIZEOFINT == 2
ImpPutInteger( &p->aData, (INT16) rVal.nInt );
@ -803,10 +810,10 @@ BOOL SbxValue::Put( const SbxValues& rVal )
// werden koennen, wenn Floats mit ',' als Dezimaltrenner oder BOOLs
// explizit mit "TRUE" oder "FALSE" angegeben werden.
// Implementierung in ImpConvStringExt (SBXSCAN.CXX)
BOOL SbxValue::PutStringExt( const XubString& r )
BOOL SbxValue::PutStringExt( const ::rtl::OUString& r )
{
// Kopieren, bei Unicode gleich konvertieren
String aStr( r );
::rtl::OUString aStr( r );
// Eigenen Typ bestimmen (nicht wie in Put() mit TheRealValue(),
// Objekte werden sowieso nicht behandelt)
@ -820,9 +827,9 @@ BOOL SbxValue::PutStringExt( const XubString& r )
// sonst Original (Unicode bleibt erhalten)
BOOL bRet;
if( ImpConvStringExt( aStr, eTargetType ) )
aRes.pString = (XubString*)&aStr;
aRes.pOUString = (::rtl::OUString*)&aStr;
else
aRes.pString = (XubString*)&r;
aRes.pOUString = (::rtl::OUString*)&r;
// #34939: Bei Strings. die eine Zahl enthalten und wenn this einen
// Num-Typ hat, Fixed-Flag setzen, damit der Typ nicht veraendert wird
@ -851,10 +858,10 @@ BOOL SbxValue::PutStringExt( const XubString& r )
BOOL SbxValue::PutString( const xub_Unicode* p )
{
XubString aVal( p );
::rtl::OUString aVal( p );
SbxValues aRes;
aRes.eType = SbxSTRING;
aRes.pString = &aVal;
aRes.pOUString = &aVal;
Put( aRes );
return BOOL( !IsError() );
}
@ -909,19 +916,19 @@ BOOL SbxValue::fillAutomationDecimal
BOOL SbxValue::PutpChar( const xub_Unicode* p )
{
XubString aVal( p );
::rtl::OUString aVal( p );
SbxValues aRes;
aRes.eType = SbxLPSTR;
aRes.pString = &aVal;
aRes.pOUString = &aVal;
Put( aRes );
return BOOL( !IsError() );
}
BOOL SbxValue::PutString( const XubString& r )
BOOL SbxValue::PutString( const ::rtl::OUString& r )
{
SbxValues aRes;
aRes.eType = SbxSTRING;
aRes.pString = (XubString*) &r;
aRes.pOUString = (::rtl::OUString*) &r;
Put( aRes );
return BOOL( !IsError() );
}
@ -986,14 +993,14 @@ BOOL SbxValue::ImpIsNumeric( BOOL bOnlyIntntl ) const
SbxDataType t = GetType();
if( t == SbxSTRING )
{
if( aData.pString )
if( aData.pOUString )
{
XubString s( *aData.pString );
::rtl::OUString s( *aData.pOUString );
double n;
SbxDataType t2;
USHORT nLen = 0;
if( ImpScan( s, n, t2, &nLen, /*bAllowIntntl*/FALSE, bOnlyIntntl ) == SbxERR_OK )
return BOOL( nLen == s.Len() );
return BOOL( nLen == s.getLength() );
}
return FALSE;
}
@ -1046,7 +1053,7 @@ BOOL SbxValue::SetType( SbxDataType t )
switch( aData.eType )
{
case SbxSTRING:
delete aData.pString;
delete aData.pOUString;
break;
case SbxOBJECT:
if( aData.pObj && aData.pObj != this )
@ -1163,14 +1170,14 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
Get( aL );
// #30576: Erstmal testen, ob Wandlung geklappt hat
if( aL.pString != NULL && aR.pString != NULL )
if( aL.pOUString != NULL && aR.pOUString != NULL )
{
*aL.pString += *aR.pString;
*aL.pOUString += *aR.pOUString;
}
// Nicht einmal Left OK?
else if( aL.pString == NULL )
else if( aL.pOUString == NULL )
{
aL.pString = new String();
aL.pOUString = new ::rtl::OUString();
}
Put( aL );
}
@ -1493,17 +1500,17 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
if( Get( aL ) && rOp.Get( aR ) ) switch( eOp )
{
case SbxEQ:
bRes = BOOL( *aL.pString == *aR.pString ); break;
bRes = BOOL( *aL.pOUString == *aR.pOUString ); break;
case SbxNE:
bRes = BOOL( *aL.pString != *aR.pString ); break;
bRes = BOOL( *aL.pOUString != *aR.pOUString ); break;
case SbxLT:
bRes = BOOL( *aL.pString < *aR.pString ); break;
bRes = BOOL( *aL.pOUString < *aR.pOUString ); break;
case SbxGT:
bRes = BOOL( *aL.pString > *aR.pString ); break;
bRes = BOOL( *aL.pOUString > *aR.pOUString ); break;
case SbxLE:
bRes = BOOL( *aL.pString <= *aR.pString ); break;
bRes = BOOL( *aL.pOUString <= *aR.pOUString ); break;
case SbxGE:
bRes = BOOL( *aL.pString >= *aR.pString ); break;
bRes = BOOL( *aL.pOUString >= *aR.pOUString ); break;
default:
SetError( SbxERR_NOTIMP );
}
@ -1668,9 +1675,9 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT )
XubString aVal;
r.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US );
if( aVal.Len() )
aData.pString = new XubString( aVal );
aData.pOUString = new ::rtl::OUString( aVal );
else
aData.pString = NULL; // JSM 22.09.1995
aData.pOUString = NULL; // JSM 22.09.1995
break;
}
case SbxERROR:
@ -1781,9 +1788,9 @@ BOOL SbxValue::StoreData( SvStream& r ) const
break;
}
case SbxSTRING:
if( aData.pString )
if( aData.pOUString )
{
r.WriteByteString( *aData.pString, RTL_TEXTENCODING_ASCII_US );
r.WriteByteString( *aData.pOUString, RTL_TEXTENCODING_ASCII_US );
}
else
{

View File

@ -239,9 +239,9 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
if( i )
aTmp += ',';
if( q->nFlags & SBX_OPTIONAL )
aTmp += SbxRes( STRING_OPTIONAL );
aTmp += String( SbxRes( STRING_OPTIONAL ) );
if( q->eType & SbxBYREF )
aTmp += SbxRes( STRING_BYREF );
aTmp += String( SbxRes( STRING_BYREF ) );
aTmp += q->aName;
cType = ' ';
// Kurzer Typ? Dann holen, evtl. ist dieser 0.
@ -263,12 +263,12 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
// langer Typ?
if( t != SbxNAME_SHORT )
{
aTmp += SbxRes( STRING_AS );
aTmp += String( SbxRes( STRING_AS ) );
if( nt < 32 )
aTmp += SbxRes(
sal::static_int_cast< USHORT >( STRING_TYPES + nt ) );
aTmp += String( SbxRes(
sal::static_int_cast< USHORT >( STRING_TYPES + nt ) ) );
else
aTmp += SbxRes( STRING_ANY );
aTmp += String( SbxRes( STRING_ANY ) );
}
}
}
@ -276,15 +276,15 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
// Langer Typ? Dann holen
if( t == SbxNAME_LONG_TYPES && et != SbxEMPTY )
{
aTmp += SbxRes( STRING_AS );
aTmp += String( SbxRes( STRING_AS ) );
if( et < 32 )
aTmp += SbxRes(
sal::static_int_cast< USHORT >( STRING_TYPES + et ) );
aTmp += String( SbxRes(
sal::static_int_cast< USHORT >( STRING_TYPES + et ) ) );
else
aTmp += SbxRes( STRING_ANY );
aTmp += String( SbxRes( STRING_ANY ) );
}
((SbxVariable*) this)->aPic = aTmp;
return aPic;
((SbxVariable*) this)->aToolString = aTmp;
return aToolString;
}
// Einen simplen Hashcode erzeugen: Es werden die ersten 6 Zeichen gewertet.
@ -431,9 +431,10 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
if( nType == SbxNULL && GetClass() == SbxCLASS_METHOD )
nType = SbxEMPTY;
SbxValues aTmp;
XubString aVal;
String aTmpString;
::rtl::OUString aVal;
aTmp.eType = aData.eType = (SbxDataType) nType;
aTmp.pString = &aVal;
aTmp.pOUString = &aVal;
switch( nType )
{
case SbxBOOL:
@ -445,10 +446,10 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
case SbxSINGLE:
{
// Floats als ASCII
rStrm.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US );
rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US );
double d;
SbxDataType t;
if( ImpScan( aVal, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE )
if( ImpScan( aTmpString, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE )
{
aTmp.nSingle = 0;
return FALSE;
@ -460,9 +461,9 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
case SbxDOUBLE:
{
// Floats als ASCII
rStrm.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US );
rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US );
SbxDataType t;
if( ImpScan( aVal, aTmp.nDouble, t, NULL ) != SbxERR_OK )
if( ImpScan( aTmpString, aTmp.nDouble, t, NULL ) != SbxERR_OK )
{
aTmp.nDouble = 0;
return FALSE;
@ -470,7 +471,8 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
break;
}
case SbxSTRING:
rStrm.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US );
rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US );
aVal = aTmpString;
break;
case SbxEMPTY:
case SbxNULL:

View File

@ -70,6 +70,7 @@ writemodfile.cxx
broadcaster.cxx
Notification management.
additions.hxx
update.cxx
Extension manager interface.

View File

@ -798,13 +798,22 @@ void Access::initBroadcasterAndChanges(
css::uno::Any(), css::uno::Any()));
//TODO: non-void ReplacedElement
}
//TODO: if (allChanges != 0) {
// allChanges->push_back(
// css::util::ElementChange(
// css::uno::makeAny(...),
// css::uno::Any(), css::uno::Any()));
// //TODO: non-void ReplacedElement
//}
if (allChanges != 0) {
rtl::OUStringBuffer path(
getRelativePathRepresentation());
if (path.getLength() != 0) {
path.append(sal_Unicode('/'));
}
path.append(
Data::createSegment(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")),
i->first));
allChanges->push_back(
css::util::ElementChange(
css::uno::makeAny(path.makeStringAndClear()),
css::uno::Any(), css::uno::Any()));
//TODO: non-void ReplacedElement
}
}
// else: spurious Modifications::Node not representing a change
break;

View File

@ -0,0 +1,43 @@
/*************************************************************************
*
* 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 INCLUDED_CONFIGMGR_SOURCE_ADDITIONS_HXX
#define INCLUDED_CONFIGMGR_SOURCE_ADDITIONS_HXX
#include "sal/config.h"
#include <list>
#include "path.hxx"
namespace configmgr {
typedef std::list< Path > Additions;
}
#endif

View File

@ -32,13 +32,17 @@
#include "com/sun/star/beans/XPropertyChangeListener.hpp"
#include "com/sun/star/container/XContainerListener.hpp"
#include "com/sun/star/lang/DisposedException.hpp"
#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
#include "com/sun/star/lang/XEventListener.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/XInterface.hpp"
#include "com/sun/star/util/XChangesListener.hpp"
#include "cppuhelper/exc_hlp.hxx"
#include "osl/diagnose.hxx"
#include "rtl/string.h"
#include "rtl/ustrbuf.hxx"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
@ -50,6 +54,13 @@ namespace {
namespace css = com::sun::star;
void appendMessage(
rtl::OUStringBuffer & buffer, css::uno::Exception const & exception)
{
buffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("; "));
buffer.append(exception.Message);
}
}
void Broadcaster::addDisposeNotification(
@ -108,14 +119,16 @@ void Broadcaster::addChangesNotification(
}
void Broadcaster::send() {
bool exception = false;
css::uno::Any exception;
rtl::OUStringBuffer messages;
for (DisposeNotifications::iterator i(disposeNotifications_.begin());
i != disposeNotifications_.end(); ++i) {
try {
i->listener->disposing(i->event);
} catch (css::lang::DisposedException &) {
} catch (css::uno::Exception &) {
exception = true;
} catch (css::uno::Exception & e) {
exception = cppu::getCaughtException();
appendMessage(messages, e);
}
}
for (ContainerNotifications::iterator i(
@ -125,8 +138,9 @@ void Broadcaster::send() {
try {
i->listener->elementInserted(i->event);
} catch (css::lang::DisposedException &) {
} catch (css::uno::Exception &) {
exception = true;
} catch (css::uno::Exception & e) {
exception = cppu::getCaughtException();
appendMessage(messages, e);
}
}
for (ContainerNotifications::iterator i(
@ -136,8 +150,9 @@ void Broadcaster::send() {
try {
i->listener->elementRemoved(i->event);
} catch (css::lang::DisposedException &) {
} catch (css::uno::Exception &) {
exception = true;
} catch (css::uno::Exception & e) {
exception = cppu::getCaughtException();
appendMessage(messages, e);
}
}
for (ContainerNotifications::iterator i(
@ -147,8 +162,9 @@ void Broadcaster::send() {
try {
i->listener->elementReplaced(i->event);
} catch (css::lang::DisposedException &) {
} catch (css::uno::Exception &) {
exception = true;
} catch (css::uno::Exception & e) {
exception = cppu::getCaughtException();
appendMessage(messages, e);
}
}
for (PropertyChangeNotifications::iterator i(
@ -158,8 +174,9 @@ void Broadcaster::send() {
try {
i->listener->propertyChange(i->event);
} catch (css::lang::DisposedException &) {
} catch (css::uno::Exception &) {
exception = true;
} catch (css::uno::Exception & e) {
exception = cppu::getCaughtException();
appendMessage(messages, e);
}
}
for (PropertiesChangeNotifications::iterator i(
@ -169,8 +186,9 @@ void Broadcaster::send() {
try {
i->listener->propertiesChange(i->event);
} catch (css::lang::DisposedException &) {
} catch (css::uno::Exception &) {
exception = true;
} catch (css::uno::Exception & e) {
exception = cppu::getCaughtException();
appendMessage(messages, e);
}
}
for (ChangesNotifications::iterator i(changesNotifications_.begin());
@ -178,16 +196,19 @@ void Broadcaster::send() {
try {
i->listener->changesOccurred(i->event);
} catch (css::lang::DisposedException &) {
} catch (css::uno::Exception &) {
exception = true;
} catch (css::uno::Exception & e) {
exception = cppu::getCaughtException();
appendMessage(messages, e);
}
}
if (exception) { //TODO
throw css::uno::RuntimeException(
rtl::OUString(
if (exception.hasValue()) {
throw css::lang::WrappedTargetRuntimeException(
(rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"configmgr exceptions during listener notification")),
css::uno::Reference< css::uno::XInterface >());
"configmgr exceptions during listener notification")) +
messages.makeStringAndClear()),
css::uno::Reference< css::uno::XInterface >(),
exception);
}
}

View File

@ -54,10 +54,12 @@
#include "rtl/ustring.hxx"
#include "sal/types.h"
#include "additions.hxx"
#include "components.hxx"
#include "data.hxx"
#include "modifications.hxx"
#include "node.hxx"
#include "nodemap.hxx"
#include "parsemanager.hxx"
#include "partial.hxx"
#include "rootaccess.hxx"
@ -86,12 +88,12 @@ typedef std::list< UnresolvedListItem > UnresolvedList;
void parseXcsFile(
rtl::OUString const & url, int layer, Data & data, Partial const * partial,
Modifications * modifications)
Modifications * modifications, Additions * additions)
SAL_THROW((
css::container::NoSuchElementException, css::uno::RuntimeException))
{
OSL_ASSERT(partial == 0 && modifications == 0);
(void) partial; (void) modifications;
OSL_ASSERT(partial == 0 && modifications == 0 && additions == 0);
(void) partial; (void) modifications; (void) additions;
OSL_VERIFY(
rtl::Reference< ParseManager >(
new ParseManager(url, new XcsParser(layer, data)))->parse());
@ -99,14 +101,16 @@ void parseXcsFile(
void parseXcuFile(
rtl::OUString const & url, int layer, Data & data, Partial const * partial,
Modifications * modifications)
Modifications * modifications, Additions * additions)
SAL_THROW((
css::container::NoSuchElementException, css::uno::RuntimeException))
{
OSL_VERIFY(
rtl::Reference< ParseManager >(
new ParseManager(
url, new XcuParser(layer, data, partial, modifications)))->
url,
new XcuParser(
layer, data, partial, modifications, additions)))->
parse());
}
@ -116,6 +120,29 @@ rtl::OUString expand(rtl::OUString const & str) {
return s;
}
bool canRemoveFromLayer(int layer, rtl::Reference< Node > const & node) {
OSL_ASSERT(node.is());
if (node->getLayer() > layer && node->getLayer() < Data::NO_LAYER) {
return false;
}
switch (node->kind()) {
case Node::KIND_LOCALIZED_PROPERTY:
case Node::KIND_GROUP:
for (NodeMap::iterator i(node->getMembers().begin());
i != node->getMembers().end(); ++i)
{
if (!canRemoveFromLayer(layer, i->second)) {
return false;
}
}
return true;
case Node::KIND_SET:
return node->getMembers().empty();
default: // Node::KIND_PROPERTY, Node::KIND_LOCALIZED_VALUE
return true;
}
}
static bool singletonCreated = false;
static Components * singleton = 0;
@ -218,7 +245,7 @@ void Components::insertExtensionXcsFile(
bool shared, rtl::OUString const & fileUri)
{
try {
parseXcsFile(fileUri, shared ? 9 : 13, data_, 0, 0);
parseXcsFile(fileUri, shared ? 9 : 13, data_, 0, 0, 0);
} catch (css::container::NoSuchElementException & e) {
throw css::uno::RuntimeException(
(rtl::OUString(
@ -233,9 +260,12 @@ void Components::insertExtensionXcuFile(
bool shared, rtl::OUString const & fileUri, Modifications * modifications)
{
OSL_ASSERT(modifications != 0);
int layer = shared ? 10 : 14;
Additions * adds = data_.addExtensionXcuAdditions(fileUri, layer);
try {
parseXcuFile(fileUri, shared ? 10 : 14, data_, 0, modifications);
parseXcuFile(fileUri, layer, data_, 0, modifications, adds);
} catch (css::container::NoSuchElementException & e) {
data_.removeExtensionXcuAdditions(fileUri);
throw css::uno::RuntimeException(
(rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
@ -245,6 +275,58 @@ void Components::insertExtensionXcuFile(
}
}
void Components::removeExtensionXcuFile(
rtl::OUString const & fileUri, Modifications * modifications)
{
//TODO: Ideally, exactly the data coming from the specified xcu file would
// be removed. However, not enough information is recorded in the in-memory
// data structures to do so. So, as a workaround, all those set elements
// that were freshly added by the xcu and have afterwards been left
// unchanged or have only had their properties changed in the user layer are
// removed (and nothing else). The heuristic to determine
// whether a node has been left unchanged is to check the layer ID (as
// usual) and additionally to check that the node does not recursively
// contain any non-empty sets (multiple extension xcu files are merged into
// one layer, so checking layer ID alone is not enough). Since
// item->additions records all additions of set members in textual order,
// the latter check works well when iterating through item->additions in
// reverse order.
OSL_ASSERT(modifications != 0);
rtl::Reference< Data::ExtensionXcu > item(
data_.removeExtensionXcuAdditions(fileUri));
if (item.is()) {
for (Additions::reverse_iterator i(item->additions.rbegin());
i != item->additions.rend(); ++i)
{
rtl::Reference< Node > parent;
NodeMap const * map = &data_.components;
rtl::Reference< Node > node;
for (Path::const_iterator j(i->begin()); j != i->end(); ++j) {
parent = node;
node = Data::findNode(Data::NO_LAYER, *map, *j);
if (!node.is()) {
break;
}
map = &node->getMembers();
}
if (node.is()) {
OSL_ASSERT(parent.is());
if (parent->kind() == Node::KIND_SET) {
OSL_ASSERT(
node->kind() == Node::KIND_GROUP ||
node->kind() == Node::KIND_SET);
if (canRemoveFromLayer(item->layer, node)) {
parent->getMembers().erase(i->back());
data_.modifications.remove(*i);
modifications->add(*i);
}
}
}
}
writeModifications();
}
}
void Components::insertModificationXcuFile(
rtl::OUString const & fileUri,
std::set< rtl::OUString > const & includedPaths,
@ -254,7 +336,7 @@ void Components::insertModificationXcuFile(
OSL_ASSERT(modifications != 0);
try {
Partial part(includedPaths, excludedPaths);
parseXcuFile(fileUri, Data::NO_LAYER, data_, &part, modifications);
parseXcuFile(fileUri, Data::NO_LAYER, data_, &part, modifications, 0);
} catch (css::uno::Exception & e) { //TODO: more specific exception catching
OSL_TRACE(
"configmgr error inserting %s: %s",
@ -377,7 +459,8 @@ Components::Components(
"${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno")
":BUNDLED_EXTENSIONS_USER}/registry/"
"com.sun.star.comp.deployment.configuration."
"PackageRegistryBackend/configmgr.ini"))));
"PackageRegistryBackend/configmgr.ini"))),
false);
parseXcsXcuIniLayer(
9,
expand(
@ -386,8 +469,9 @@ Components::Components(
"${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno")
":SHARED_EXTENSIONS_USER}/registry/"
"com.sun.star.comp.deployment.configuration."
"PackageRegistryBackend/configmgr.ini"))));
parseXcsXcuLayer( //TODO: migrate
"PackageRegistryBackend/configmgr.ini"))),
true);
parseXcsXcuLayer(
11,
expand(
rtl::OUString(
@ -396,6 +480,8 @@ Components::Components(
":UNO_USER_PACKAGES_CACHE}/registry/"
"com.sun.star.comp.deployment.configuration."
"PackageRegistryBackend/registry"))));
// can be dropped once old UserInstallation format can no longer exist
// (probably OOo 4)
parseXcsXcuIniLayer(
13,
expand(
@ -404,7 +490,8 @@ Components::Components(
"${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno")
":UNO_USER_PACKAGES_CACHE}/registry/"
"com.sun.star.comp.deployment.configuration."
"PackageRegistryBackend/configmgr.ini"))));
"PackageRegistryBackend/configmgr.ini"))),
true);
try {
parseModificationLayer();
} catch (css::uno::Exception & e) { //TODO: more specific exception catching
@ -470,7 +557,7 @@ void Components::parseFiles(
file.match(extension, file.getLength() - extension.getLength()))
{
try {
(*parseFile)(stat.getFileURL(), layer, data_, 0, 0);
(*parseFile)(stat.getFileURL(), layer, data_, 0, 0, 0);
} catch (css::container::NoSuchElementException & e) {
throw css::uno::RuntimeException(
(rtl::OUString(
@ -486,19 +573,26 @@ void Components::parseFiles(
void Components::parseFileList(
int layer, FileParser * parseFile, rtl::OUString const & urls,
rtl::Bootstrap const & ini)
rtl::Bootstrap const & ini, bool recordAdditions)
{
for (sal_Int32 i = 0;;) {
rtl::OUString url(urls.getToken(0, ' ', i));
if (url.getLength() != 0) {
ini.expandMacrosFrom(url); //TODO: detect failure
Additions * adds = 0;
if (recordAdditions) {
adds = data_.addExtensionXcuAdditions(url, layer);
}
try {
(*parseFile)(url, layer, data_, 0, 0);
(*parseFile)(url, layer, data_, 0, 0, adds);
} catch (css::container::NoSuchElementException & e) {
OSL_TRACE(
"configmgr file does not exist: %s",
rtl::OUStringToOString(
e.Message, RTL_TEXTENCODING_UTF8).getStr());
if (adds != 0) {
data_.removeExtensionXcuAdditions(url);
}
}
}
if (i == -1) {
@ -610,18 +704,20 @@ void Components::parseXcsXcuLayer(int layer, rtl::OUString const & url) {
url + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/data")), false);
}
void Components::parseXcsXcuIniLayer(int layer, rtl::OUString const & url) {
void Components::parseXcsXcuIniLayer(
int layer, rtl::OUString const & url, bool recordAdditions)
{
//TODO: rtl::Bootstrap::getFrom "first trie[s] to retrieve the value via the
// global function"
rtl::Bootstrap ini(url);
rtl::OUString urls;
if (ini.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SCHEMA")), urls))
{
parseFileList(layer, &parseXcsFile, urls, ini);
parseFileList(layer, &parseXcsFile, urls, ini, false);
}
if (ini.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATA")), urls))
{
parseFileList(layer + 1, &parseXcuFile, urls, ini);
parseFileList(layer + 1, &parseXcuFile, urls, ini, recordAdditions);
}
}
@ -650,13 +746,13 @@ rtl::OUString Components::getModificationFileUrl() const {
void Components::parseModificationLayer() {
try {
parseXcuFile(getModificationFileUrl(), Data::NO_LAYER, data_, 0, 0);
parseXcuFile(getModificationFileUrl(), Data::NO_LAYER, data_, 0, 0, 0);
} catch (css::container::NoSuchElementException &) {
OSL_TRACE(
"configmgr user registrymodifications.xcu does not (yet) exist");
// Migrate old user layer data (can be removed once migration is no
// longer relevant; also see hack for xsi namespace in XmlReader
// constructor):
// longer relevant, probably OOo 4; also see hack for xsi namespace in
// XmlReader constructor):
parseFiles(
Data::NO_LAYER, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".xcu")),
&parseXcuFile,

View File

@ -38,7 +38,10 @@
#include "com/sun/star/uno/Reference.hxx"
#include "rtl/ref.hxx"
#include "additions.hxx"
#include "data.hxx"
#include "modifications.hxx"
#include "nodemap.hxx"
#include "path.hxx"
namespace com { namespace sun { namespace star {
@ -56,7 +59,6 @@ namespace rtl {
namespace configmgr {
class Broadcaster;
class Modifications;
class Node;
class Partial;
class RootAccess;
@ -98,6 +100,9 @@ public:
bool shared, rtl::OUString const & fileUri,
Modifications * modifications);
void removeExtensionXcuFile(
rtl::OUString const & fileUri, Modifications * modifications);
void insertModificationXcuFile(
rtl::OUString const & fileUri,
std::set< rtl::OUString > const & includedPaths,
@ -109,7 +114,8 @@ public:
private:
typedef void FileParser(
rtl::OUString const &, int, Data &, Partial const *, Modifications *);
rtl::OUString const &, int, Data &, Partial const *, Modifications *,
Additions *);
Components(
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
@ -123,13 +129,14 @@ private:
void parseFileList(
int layer, FileParser * parseFile, rtl::OUString const & urls,
rtl::Bootstrap const & ini);
rtl::Bootstrap const & ini, bool recordAdditions);
void parseXcdFiles(int layer, rtl::OUString const & url);
void parseXcsXcuLayer(int layer, rtl::OUString const & url);
void parseXcsXcuIniLayer(int layer, rtl::OUString const & url);
void parseXcsXcuIniLayer(
int layer, rtl::OUString const & url, bool recordAdditions);
void parseModuleLayer(int layer, rtl::OUString const & url);

View File

@ -36,11 +36,13 @@
#include "osl/diagnose.h"
#include "rtl/ref.hxx"
#include "rtl/string.h"
#include "rtl/textenc.h"
#include "rtl/ustrbuf.hxx"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
#include "sal/types.h"
#include "additions.hxx"
#include "data.hxx"
#include "groupnode.hxx"
#include "node.hxx"
@ -325,4 +327,46 @@ rtl::Reference< Node > Data::getTemplate(
return findNode(layer, templates, fullName);
}
Additions * Data::addExtensionXcuAdditions(
rtl::OUString const & url, int layer)
{
rtl::Reference< ExtensionXcu > item(new ExtensionXcu);
ExtensionXcuAdditions::iterator i(
extensionXcuAdditions_.insert(
ExtensionXcuAdditions::value_type(
url, rtl::Reference< ExtensionXcu >())).first);
if (i->second.is()) {
throw css::uno::RuntimeException(
(rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"already added extension xcu ")) +
url),
css::uno::Reference< css::uno::XInterface >());
}
i->second = item;
item->layer = layer;
return &item->additions;
}
rtl::Reference< Data::ExtensionXcu > Data::removeExtensionXcuAdditions(
rtl::OUString const & url)
{
ExtensionXcuAdditions::iterator i(extensionXcuAdditions_.find(url));
if (i == extensionXcuAdditions_.end()) {
// This can happen, as migration of pre OOo 3.3 UserInstallation
// extensions in dp_registry::backend::configuration::BackendImpl::
// PackageImpl::processPackage_ can cause just-in-time creation of
// extension xcu files that are never added via addExtensionXcuAdditions
// (also, there might be url spelling differences between calls to
// addExtensionXcuAdditions and removeExtensionXcuAdditions?):
OSL_TRACE(
"unknown configmgr::Data::removeExtensionXcuAdditions(%s)",
rtl::OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr());
return rtl::Reference< ExtensionXcu >();
}
rtl::Reference< ExtensionXcu > item(i->second);
extensionXcuAdditions_.erase(i);
return item;
}
}

View File

@ -31,18 +31,20 @@
#include "sal/config.h"
#include <climits>
#include <map>
#include <vector>
#include "boost/noncopyable.hpp"
#include "rtl/ref.hxx"
#include "rtl/ustring.hxx"
#include "sal/types.h"
#include "salhelper/simplereferenceobject.hxx"
#include "additions.hxx"
#include "modifications.hxx"
#include "nodemap.hxx"
#include "path.hxx"
namespace rtl { class OUString; }
namespace configmgr {
class Node;
@ -50,6 +52,11 @@ class Node;
struct Data: private boost::noncopyable {
enum { NO_LAYER = INT_MAX };
struct ExtensionXcu: public salhelper::SimpleReferenceObject {
int layer;
Additions additions;
};
NodeMap templates;
NodeMap components;
@ -80,6 +87,18 @@ struct Data: private boost::noncopyable {
rtl::Reference< Node > getTemplate(
int layer, rtl::OUString const & fullName) const;
Additions * addExtensionXcuAdditions(
rtl::OUString const & url, int layer);
rtl::Reference< ExtensionXcu > removeExtensionXcuAdditions(
rtl::OUString const & url);
private:
typedef std::map< rtl::OUString, rtl::Reference< ExtensionXcu > >
ExtensionXcuAdditions;
ExtensionXcuAdditions extensionXcuAdditions_;
};
}

View File

@ -59,6 +59,27 @@ void Modifications::add(Path const & path) {
p->children.clear();
}
void Modifications::remove(Path const & path) {
OSL_ASSERT(!path.empty());
Node * p = &root_;
for (Path::const_iterator i(path.begin());;) {
Node::Children::iterator j(p->children.find(*i));
if (j == p->children.end()) {
break;
}
if (++i == path.end()) {
p->children.erase(j);
if (p->children.empty()) {
Path parent(path);
parent.pop_back();
remove(parent);
}
break;
}
p = &j->second;
}
}
Modifications::Node const & Modifications::getRoot() const {
return root_;
}

View File

@ -54,6 +54,8 @@ public:
void add(Path const & path);
void remove(Path const & path);
Node const & getRoot() const;
private:

View File

@ -89,6 +89,9 @@ private:
sal_Bool shared, rtl::OUString const & fileUri)
throw (css::uno::RuntimeException);
virtual void SAL_CALL removeExtensionXcuFile(rtl::OUString const & fileUri)
throw (css::uno::RuntimeException);
virtual void SAL_CALL insertModificationXcuFile(
rtl::OUString const & fileUri,
css::uno::Sequence< rtl::OUString > const & includedPaths,
@ -120,6 +123,20 @@ void Service::insertExtensionXcuFile(
bc.send();
}
void Service::removeExtensionXcuFile(rtl::OUString const & fileUri)
throw (css::uno::RuntimeException)
{
Broadcaster bc;
{
osl::MutexGuard g(lock);
Modifications mods;
Components::getSingleton().removeExtensionXcuFile(fileUri, &mods);
Components::getSingleton().initGlobalBroadcaster(
mods, rtl::Reference< RootAccess >(), &bc);
}
bc.send();
}
void Service::insertModificationXcuFile(
rtl::OUString const & fileUri,
css::uno::Sequence< rtl::OUString > const & includedPaths,

View File

@ -137,7 +137,7 @@ bool XcdParser::startElement(
if (ns == XmlReader::NAMESPACE_OOR &&
name.equals(RTL_CONSTASCII_STRINGPARAM("component-data")))
{
nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0);
nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0, 0);
nesting_ = 1;
return nestedParser_->startElement(reader, ns, name);
}

View File

@ -321,15 +321,19 @@ void XcsParser::endElement(XmlReader const & reader) {
} else {
switch (state_) {
case STATE_COMPONENT_SCHEMA:
// To support old, broken extensions with .xcs files that contain
// empty <component-schema> elements:
state_ = STATE_COMPONENT_DONE;
break;
case STATE_TEMPLATES:
state_ = STATE_TEMPLATES_DONE;
break;
case STATE_TEMPLATES_DONE:
throw css::uno::RuntimeException(
(rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("no component element in ")) +
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >());
case STATE_TEMPLATES:
state_ = STATE_TEMPLATES_DONE;
break;
case STATE_COMPONENT_DONE:
break;
default:

View File

@ -68,12 +68,13 @@ namespace css = com::sun::star;
XcuParser::XcuParser(
int layer, Data & data, Partial const * partial,
Modifications * broadcastModifications):
Modifications * broadcastModifications, Additions * additions):
valueParser_(layer), data_(data),
partial_(partial), broadcastModifications_(broadcastModifications),
recordModifications_(layer == Data::NO_LAYER),
additions_(additions), recordModifications_(layer == Data::NO_LAYER),
trackPath_(
partial_ != 0 || broadcastModifications_ != 0 || recordModifications_)
partial_ != 0 || broadcastModifications_ != 0 || additions_ != 0 ||
recordModifications_)
{}
XcuParser::~XcuParser() {}
@ -624,7 +625,7 @@ void XcuParser::handleLocpropValue(
pop = true;
}
if (trackPath_) {
recordModification();
recordModification(false);
if (pop) {
path_.pop_back();
}
@ -638,7 +639,7 @@ void XcuParser::handleLocpropValue(
locprop->getMembers().erase(i);
}
state_.push(State(true));
recordModification();
recordModification(false);
break;
default:
throw css::uno::RuntimeException(
@ -750,7 +751,7 @@ void XcuParser::handleUnknownGroupProp(
prop->setFinalized(valueParser_.getLayer());
}
state_.push(State(prop, name, state_.top().locked));
recordModification();
recordModification(false);
break;
}
// fall through
@ -800,7 +801,7 @@ void XcuParser::handlePlainGroupProp(
property,
(state_.top().locked ||
finalizedLayer < valueParser_.getLayer())));
recordModification();
recordModification(false);
break;
case OPERATION_REMOVE:
if (!property->isExtension()) {
@ -814,7 +815,7 @@ void XcuParser::handlePlainGroupProp(
}
group->getMembers().erase(propertyIndex);
state_.push(State(true)); // ignore children
recordModification();
recordModification(false);
break;
}
}
@ -863,7 +864,7 @@ void XcuParser::handleLocalizedGroupProp(
replacement, name,
(state_.top().locked ||
finalizedLayer < valueParser_.getLayer())));
recordModification();
recordModification(false);
}
break;
case OPERATION_REMOVE:
@ -1070,7 +1071,7 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) {
member->setFinalized(finalizedLayer);
member->setMandatory(mandatoryLayer);
state_.push(State(member, name, false));
recordModification();
recordModification(i == set->getMembers().end());
}
break;
case OPERATION_FUSE:
@ -1084,7 +1085,7 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) {
member->setFinalized(finalizedLayer);
member->setMandatory(mandatoryLayer);
state_.push(State(member, name, false));
recordModification();
recordModification(true);
}
} else {
state_.push(
@ -1104,15 +1105,18 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) {
set->getMembers().erase(i);
}
state_.push(State(true));
recordModification();
recordModification(false);
break;
}
}
void XcuParser::recordModification() {
void XcuParser::recordModification(bool addition) {
if (broadcastModifications_ != 0) {
broadcastModifications_->add(path_);
}
if (addition && additions_ != 0) {
additions_->push_back(path_);
}
if (recordModifications_) {
data_.modifications.add(path_);
}

View File

@ -35,6 +35,7 @@
#include "rtl/ref.hxx"
#include "rtl/ustring.hxx"
#include "additions.hxx"
#include "node.hxx"
#include "nodemap.hxx"
#include "parser.hxx"
@ -59,7 +60,7 @@ class XcuParser: public Parser {
public:
XcuParser(
int layer, Data & data, Partial const * partial,
Modifications * broadcastModifications);
Modifications * broadcastModifications, Additions * additions);
private:
virtual ~XcuParser();
@ -108,7 +109,7 @@ private:
void handleSetNode(XmlReader & reader, SetNode * set);
void recordModification();
void recordModification(bool addition);
struct State {
rtl::Reference< Node > node; // empty iff ignore or <items>
@ -141,6 +142,7 @@ private:
Data & data_;
Partial const * partial_;
Modifications * broadcastModifications_;
Additions * additions_;
bool recordModifications_;
bool trackPath_;
rtl::OUString componentName_;

View File

@ -326,9 +326,16 @@ namespace dbtools
::rtl::OUString sStringValue;
if ( m_pData->m_xColumn.is() )
{
sStringValue = DBTypeConversion::getValue(
m_pData->m_xColumn, m_pData->m_xFormatter, m_pData->m_aNullDate, m_pData->m_nFormatKey, m_pData->m_nKeyType
);
if ( m_pData->m_bNumericField )
{
sStringValue = DBTypeConversion::getValue(
m_pData->m_xColumn, m_pData->m_xFormatter, m_pData->m_aNullDate, m_pData->m_nFormatKey, m_pData->m_nKeyType
);
}
else
{
sStringValue = m_pData->m_xColumn->getString();
}
}
return sStringValue;
}

View File

@ -578,7 +578,7 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
// StarView zu lang ist oder der Treiber kann die Laenge der
// Daten nicht im voraus bestimmen - also als MemoryStream
// speichern.
while ((pcbValue == SQL_NO_TOTAL ) || pcbValue > nMaxLen)
while ((pcbValue == SQL_NO_TOTAL ) || nLen > nMaxLen)
{
// Bei Strings wird der Puffer nie ganz ausgenutzt
// (das letzte Byte ist immer ein NULL-Byte, das

View File

@ -134,6 +134,9 @@ class Desktop : public Application
static sal_Bool IsFirstStartWizardNeeded();
static sal_Bool CheckExtensionDependencies();
static void DoRestartActionsIfNecessary( sal_Bool bQuickStart );
static void SetRestartState();
void SynchronizeExtensionRepositories();
void SetSplashScreenText( const ::rtl::OUString& rText );
void SetSplashScreenProgress( sal_Int32 );

View File

@ -1558,6 +1558,7 @@ void Desktop::Main()
std::auto_ptr<SvtLanguageOptions> pLanguageOptions;
std::auto_ptr<SvtPathOptions> pPathOptions;
Reference< ::com::sun::star::task::XRestartManager > xRestartManager;
sal_Bool bRestartRequested( sal_False );
sal_Bool bUseSystemFileDialog(sal_True);
int nAcquireCount( 0 );
@ -1761,7 +1762,6 @@ void Desktop::Main()
impl_checkRecoveryState(bCrashed, bExistsRecoveryData, bExistsSessionData);
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} impl_checkRecoveryState" );
Reference< ::com::sun::star::task::XRestartManager > xRestartManager;
{
::comphelper::ComponentContext aContext( xSMgr );
xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY );
@ -1922,6 +1922,10 @@ void Desktop::Main()
// The configuration error handler currently is only for startup
aConfigErrHandler.deactivate();
// Acquire solar mutex just before we enter our message loop
if ( nAcquireCount )
Application::AcquireSolarMutex( nAcquireCount );
// call Application::Execute to process messages in vcl message loop
RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" );
@ -1932,7 +1936,16 @@ void Desktop::Main()
com::sun::star::uno::ContextLayer layer2(
new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) );
Execute();
// check whether the shutdown is caused by restart just before entering the Execute
bRestartRequested = bRestartRequested || ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
if ( !bRestartRequested )
{
// if this run of the office is triggered by restart, some additional actions should be done
DoRestartActionsIfNecessary( !pCmdLineArgs->IsInvisible() && !pCmdLineArgs->IsNoQuickstart() );
Execute();
}
}
catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg)
{
@ -1946,6 +1959,9 @@ void Desktop::Main()
}
}
if ( bRestartRequested )
SetRestartState();
if (xGlobalBroadcaster.is())
{
css::document::EventObject aEvent;

View File

@ -36,12 +36,14 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
#include "app.hxx"
using rtl::OUString;
using namespace desktop;
using namespace com::sun::star::beans;
using ::rtl::OUString;
using namespace ::desktop;
using namespace ::com::sun::star;
using namespace ::com::sun::star::beans;
static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) );
static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) );
@ -128,24 +130,29 @@ sal_Bool Desktop::LicenseNeedsAcceptance()
*/
}
/* Local function - get access to the configuration */
static Reference< XPropertySet > impl_getConfigurationAccess( const OUString& rPath )
{
Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
// get configuration provider
Reference< XMultiServiceFactory > xConfigProvider = Reference< XMultiServiceFactory >(
xFactory->createInstance( sConfigSrvc ), UNO_QUERY_THROW );
Sequence< Any > aArgs( 1 );
NamedValue aValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NodePath" ) ), makeAny( rPath ) );
aArgs[0] <<= aValue;
return Reference< XPropertySet >(
xConfigProvider->createInstanceWithArguments( sAccessSrvc, aArgs ), UNO_QUERY_THROW );
}
/* Local function - was the wizard completed already? */
static sal_Bool impl_isFirstStart()
{
try {
Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) );
// get configuration provider
Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
Sequence< Any > theArgs(1);
NamedValue v(OUString::createFromAscii("NodePath"), makeAny(OUString::createFromAscii("org.openoffice.Setup/Office")));
theArgs[0] <<= v;
Reference< XPropertySet > pset = Reference< XPropertySet >(
theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW);
Any result = pset->getPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted"));
Any result = xPSet->getPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted"));
sal_Bool bCompleted = sal_False;
if ((result >>= bCompleted) && bCompleted)
return sal_False; // wizard was already completed
@ -219,20 +226,9 @@ static sal_Bool impl_isLicenseAccepted()
try
{
Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) );
// get configuration provider
Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
Sequence< Any > theArgs(1);
NamedValue v(OUString::createFromAscii("NodePath"),
makeAny(OUString::createFromAscii("org.openoffice.Setup/Office")));
theArgs[0] <<= v;
Reference< XPropertySet > pset = Reference< XPropertySet >(
theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW);
Any result = pset->getPropertyValue(OUString::createFromAscii("LicenseAcceptDate"));
Any result = xPSet->getPropertyValue(OUString::createFromAscii("LicenseAcceptDate"));
OUString aAcceptDate;
if (result >>= aAcceptDate)
@ -272,3 +268,51 @@ sal_Bool Desktop::IsFirstStartWizardNeeded()
return impl_isFirstStart() || !impl_isLicenseAccepted();
}
void Desktop::DoRestartActionsIfNecessary( sal_Bool bQuickStart )
{
if ( bQuickStart )
{
try
{
Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) );
OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "OfficeRestartInProgress" ) );
Any aRestart = xPSet->getPropertyValue( sPropName );
sal_Bool bRestart = sal_False;
if ( ( aRestart >>= bRestart ) && bRestart )
{
xPSet->setPropertyValue( sPropName, makeAny( sal_False ) );
Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges();
Sequence< Any > aSeq( 2 );
aSeq[0] <<= sal_True;
aSeq[1] <<= sal_True;
Reference < XInitialization > xQuickstart( ::comphelper::getProcessServiceFactory()->createInstance(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.Quickstart" ) ) ),UNO_QUERY_THROW );
xQuickstart->initialize( aSeq );
}
}
catch( uno::Exception& )
{
// this is no critical operation so it should not prevent office from starting
}
}
}
void Desktop::SetRestartState()
{
try
{
Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) );
OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "OfficeRestartInProgress" ) );
xPSet->setPropertyValue( sPropName, makeAny( sal_True ) );
Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges();
}
catch( uno::Exception& )
{
// this is no critical operation, ignore the exception
}
}

View File

@ -139,7 +139,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
void addDataToDb(OUString const & url, ConfigurationBackendDb::Data const & data);
::boost::optional<ConfigurationBackendDb::Data> readDataFromDb(OUString const & url);
void deleteDataFromDb(OUString const & url);
OUString deleteDataFromDb(OUString const & url);
::std::list<OUString> getAllIniEntries();
public:
@ -240,10 +240,18 @@ void BackendImpl::addDataToDb(
return data;
}
void BackendImpl::deleteDataFromDb(OUString const & url)
OUString BackendImpl::deleteDataFromDb(OUString const & url)
{
if (m_backendDb.get())
OUString url2(url);
if (m_backendDb.get()) {
boost::optional< ConfigurationBackendDb::Data > data(
m_backendDb->getEntry(url));
if (data) {
url2 = expandUnoRcTerm(data->iniEntry);
}
m_backendDb->removeEntry(url);
}
return url2;
}
::std::list<OUString> BackendImpl::getAllIniEntries()
@ -717,11 +725,11 @@ void BackendImpl::PackageImpl::processPackage_(
//rebuilding the directory structure.
rtl::OUString url2(
rtl::OStringToOUString(i->first, RTL_TEXTENCODING_UTF8));
ConfigurationBackendDb::Data data;
if (url2 != url) {
bool schema = i->second.equalsIgnoreAsciiCase(
"vnd.sun.star.configuration-schema");
OUString url_replaced(url2);
ConfigurationBackendDb::Data data;
if (!schema)
{
const OUString sModFolder = that->createFolder(OUString(), xCmdEnv);
@ -734,6 +742,7 @@ void BackendImpl::PackageImpl::processPackage_(
deleteTempFolder(sModFolder);
}
that->addToConfigmgrIni(schema, url_replaced, xCmdEnv);
data.iniEntry = dp_misc::makeRcTerm(url_replaced);
that->addDataToDb(url2, data);
}
that->m_registeredPackages->erase(i->first);
@ -750,9 +759,12 @@ void BackendImpl::PackageImpl::processPackage_(
OSL_ASSERT(0);
}
}
that->deleteDataFromDb(getURL());
//TODO: revoking at runtime, possible, sensible?
url = that->deleteDataFromDb(url);
if (!m_isSchema) {
com::sun::star::configuration::Update::get(
that->m_xComponentContext)->removeExtensionXcuFile(
expandUnoRcUrl(url));
}
}
}

View File

@ -80,6 +80,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
::rtl::Reference<AbortChannel> const & abortChannel,
Reference<XCommandEnvironment> const & xCmdEnv );
bool extensionContainsCompiledHelp();
public:
PackageImpl(
::rtl::Reference<PackageRegistryBackend> const & myBackend,
@ -100,7 +101,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
Reference<XCommandEnvironment> const & xCmdEnv );
void implProcessHelp( Reference< deployment::XPackage > xPackage, bool doRegisterPackage,
Reference<ucb::XCommandEnvironment> const & xCmdEnv);
bool compiledHelp, Reference<ucb::XCommandEnvironment> const & xCmdEnv);
void implCollectXhpFiles( const rtl::OUString& aDir,
std::vector< rtl::OUString >& o_rXhpFileVector );
@ -259,6 +260,57 @@ BackendImpl * BackendImpl::PackageImpl::getMyBackend() const
return pBackend;
}
bool BackendImpl::PackageImpl::extensionContainsCompiledHelp()
{
bool bCompiled = true;
rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl(getURL());
::osl::Directory helpFolder(aExpandedHelpURL);
if ( helpFolder.open() == ::osl::File::E_None)
{
//iterate over the contents of the help folder
//We assume that all folders withing the help folder contain language specific
//help files. If just one of them does not contain compiled help then this
//function returns false.
::osl::DirectoryItem item;
::osl::File::RC errorNext = ::osl::File::E_None;
while ((errorNext = helpFolder.getNextItem(item)) == ::osl::File::E_None)
{
//No find the language folders
::osl::FileStatus stat(FileStatusMask_Type | FileStatusMask_FileName |FileStatusMask_FileURL);
if (item.getFileStatus(stat) == ::osl::File::E_None)
{
if (stat.getFileType() != ::osl::FileStatus::Directory)
continue;
//look if there is the folder help.idxl in the language folder
OUString compUrl(stat.getFileURL() + OUSTR("/help.idxl"));
::osl::Directory compiledFolder(compUrl);
if (compiledFolder.open() != ::osl::File::E_None)
{
bCompiled = false;
break;
}
}
else
{
//Error
OSL_ASSERT(0);
bCompiled = false;
break;
}
}
if (errorNext != ::osl::File::E_NOENT
&& errorNext != ::osl::File::E_None)
{
//Error
OSL_ASSERT(0);
bCompiled = false;
}
}
return bCompiled;
}
//______________________________________________________________________________
beans::Optional< beans::Ambiguous<sal_Bool> >
BackendImpl::PackageImpl::isRegistered_(
@ -289,7 +341,8 @@ void BackendImpl::PackageImpl::processPackage_(
BackendImpl* that = getMyBackend();
Reference< deployment::XPackage > xThisPackage( this );
that->implProcessHelp( xThisPackage, doRegisterPackage, xCmdEnv);
that->implProcessHelp( xThisPackage, doRegisterPackage,
extensionContainsCompiledHelp(), xCmdEnv);
}
beans::Optional< OUString > BackendImpl::PackageImpl::getRegistrationDataURL()
@ -316,213 +369,220 @@ static rtl::OUString aHelpStr( rtl::OUString::createFromAscii( "help" ) );
void BackendImpl::implProcessHelp
( Reference< deployment::XPackage > xPackage, bool doRegisterPackage,
( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, bool compiledHelp,
Reference<ucb::XCommandEnvironment> const & xCmdEnv)
{
OSL_ASSERT(xPackage.is());
if (doRegisterPackage)
{
HelpBackendDb::Data data;
const OUString sHelpFolder = createFolder(OUString(), xCmdEnv);
data.dataUrl = sHelpFolder;
Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess();
rtl::OUString aHelpURL = xPackage->getURL();
rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL );
rtl::OUString aName = xPackage->getName();
if( !xSFA->isFolder( aExpandedHelpURL ) )
if (compiledHelp)
{
rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR );
aErrStr += rtl::OUString::createFromAscii( "No help folder" );
OWeakObject* oWeakThis = static_cast<OWeakObject *>(this);
throw deployment::DeploymentException( rtl::OUString(), oWeakThis,
makeAny( uno::Exception( aErrStr, oWeakThis ) ) );
data.dataUrl = xPackage->getURL();
}
Reference<XComponentContext> const & xContext = getComponentContext();
Reference< script::XInvocation > xInvocation;
if( xContext.is() )
else
{
try
const OUString sHelpFolder = createFolder(OUString(), xCmdEnv);
data.dataUrl = sHelpFolder;
Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess();
rtl::OUString aHelpURL = xPackage->getURL();
rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL );
rtl::OUString aName = xPackage->getName();
if( !xSFA->isFolder( aExpandedHelpURL ) )
{
xInvocation = Reference< script::XInvocation >(
xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii(
"com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY );
rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR );
aErrStr += rtl::OUString::createFromAscii( "No help folder" );
OWeakObject* oWeakThis = static_cast<OWeakObject *>(this);
throw deployment::DeploymentException( rtl::OUString(), oWeakThis,
makeAny( uno::Exception( aErrStr, oWeakThis ) ) );
}
catch (Exception &)
Reference<XComponentContext> const & xContext = getComponentContext();
Reference< script::XInvocation > xInvocation;
if( xContext.is() )
{
// i98680: Survive missing lucene
try
{
xInvocation = Reference< script::XInvocation >(
xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii(
"com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY );
}
catch (Exception &)
{
// i98680: Survive missing lucene
}
}
}
// Scan languages
Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true );
sal_Int32 nLangCount = aLanguageFolderSeq.getLength();
const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray();
for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang )
{
rtl::OUString aLangURL = pSeq[iLang];
if( xSFA->isFolder( aLangURL ) )
// Scan languages
Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true );
sal_Int32 nLangCount = aLanguageFolderSeq.getLength();
const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray();
for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang )
{
std::vector< rtl::OUString > aXhpFileVector;
// calculate jar file URL
sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/');
// for example "/en"
OUString langFolderURLSegment(
aLangURL.copy(
indexStartSegment + 1, aLangURL.getLength() - indexStartSegment - 1));
//create the folder in the "temporary folder"
::ucbhelper::Content langFolderContent;
const OUString langFolderDest = makeURL(sHelpFolder, langFolderURLSegment);
const OUString langFolderDestExpanded = ::dp_misc::expandUnoRcUrl(langFolderDest);
::dp_misc::create_folder(
&langFolderContent,
langFolderDest, xCmdEnv);
rtl::OUString aJarFile(
makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr +
OUSTR(".jar")));
aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile);
rtl::OUString aEncodedJarFilePath = rtl::Uri::encode(
aJarFile, rtl_UriCharClassPchar,
rtl_UriEncodeIgnoreEscapes,
RTL_TEXTENCODING_UTF8 );
rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" );
aDestBasePath += aEncodedJarFilePath;
aDestBasePath += rtl::OUString::createFromAscii( "/" );
sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1;
Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true );
sal_Int32 nSubLangCount = aSubLangSeq.getLength();
const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray();
for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang )
rtl::OUString aLangURL = pSeq[iLang];
if( xSFA->isFolder( aLangURL ) )
{
rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang];
if( !xSFA->isFolder( aSubFolderURL ) )
continue;
std::vector< rtl::OUString > aXhpFileVector;
implCollectXhpFiles( aSubFolderURL, aXhpFileVector );
// calculate jar file URL
sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/');
// for example "/en"
OUString langFolderURLSegment(
aLangURL.copy(
indexStartSegment + 1, aLangURL.getLength() - indexStartSegment - 1));
// Copy to package (later: move?)
rtl::OUString aDestPath = aDestBasePath;
rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL );
aDestPath += aPureFolderName;
xSFA->copy( aSubFolderURL, aDestPath );
}
//create the folder in the "temporary folder"
::ucbhelper::Content langFolderContent;
const OUString langFolderDest = makeURL(sHelpFolder, langFolderURLSegment);
const OUString langFolderDestExpanded = ::dp_misc::expandUnoRcUrl(langFolderDest);
::dp_misc::create_folder(
&langFolderContent,
langFolderDest, xCmdEnv);
// Call compiler
sal_Int32 nXhpFileCount = aXhpFileVector.size();
rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount];
for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp )
{
rtl::OUString aXhpFile = aXhpFileVector[iXhp];
rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL );
pXhpFiles[iXhp] = aXhpRelFile;
}
rtl::OUString aJarFile(
makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr +
OUSTR(".jar")));
aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile);
rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() );
rtl::OUString aOfficeHelpPathFileURL;
::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL );
rtl::OUString aEncodedJarFilePath = rtl::Uri::encode(
aJarFile, rtl_UriCharClassPchar,
rtl_UriEncodeIgnoreEscapes,
RTL_TEXTENCODING_UTF8 );
rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" );
aDestBasePath += aEncodedJarFilePath;
aDestBasePath += rtl::OUString::createFromAscii( "/" );
HelpProcessingErrorInfo aErrorInfo;
bool bSuccess = compileExtensionHelp(
aOfficeHelpPathFileURL, aHelpStr, aLangURL,
nXhpFileCount, pXhpFiles,
langFolderDestExpanded, aErrorInfo );
sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1;
if( bSuccess && xInvocation.is() )
{
Sequence<uno::Any> aParamsSeq( 6 );
aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) );
rtl::OUString aLang;
sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' );
if( nLastSlash != -1 )
aLang = aLangURL.copy( nLastSlash + 1 );
else
aLang = rtl::OUString::createFromAscii( "en" );
aParamsSeq[1] = uno::makeAny( aLang );
aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) );
aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) );
aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) );
rtl::OUString aSystemPath;
osl::FileBase::getSystemPathFromFileURL(
langFolderDestExpanded, aSystemPath );
aParamsSeq[5] = uno::makeAny( aSystemPath );
Sequence< sal_Int16 > aOutParamIndex;
Sequence< uno::Any > aOutParam;
uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ),
aParamsSeq, aOutParamIndex, aOutParam );
}
if( !bSuccess )
{
USHORT nErrStrId = 0;
switch( aErrorInfo.m_eErrorClass )
Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true );
sal_Int32 nSubLangCount = aSubLangSeq.getLength();
const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray();
for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang )
{
case HELPPROCESSING_GENERAL_ERROR:
case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break;
case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break;
default: ;
};
rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang];
if( !xSFA->isFolder( aSubFolderURL ) )
continue;
rtl::OUString aErrStr;
if( nErrStrId != 0 )
{
aErrStr = getResourceString( nErrStrId );
implCollectXhpFiles( aSubFolderURL, aXhpFileVector );
// Remoce CR/LF
rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg );
sal_Unicode nCR = 13, nLF = 10;
sal_Int32 nSearchCR = aErrMsg.indexOf( nCR );
sal_Int32 nSearchLF = aErrMsg.indexOf( nLF );
sal_Int32 nCopy;
if( nSearchCR != -1 || nSearchLF != -1 )
{
if( nSearchCR == -1 )
nCopy = nSearchLF;
else if( nSearchLF == -1 )
nCopy = nSearchCR;
else
nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF;
aErrMsg = aErrMsg.copy( 0, nCopy );
}
aErrStr += aErrMsg;
if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() )
{
aErrStr += rtl::OUString::createFromAscii( " in " );
rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile,
rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
aErrStr += aDecodedFile;
if( aErrorInfo.m_nXMLParsingLine != -1 )
{
aErrStr += rtl::OUString::createFromAscii( ", line " );
aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine );
}
}
// Copy to package (later: move?)
rtl::OUString aDestPath = aDestBasePath;
rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL );
aDestPath += aPureFolderName;
xSFA->copy( aSubFolderURL, aDestPath );
}
OWeakObject* oWeakThis = static_cast<OWeakObject *>(this);
throw deployment::DeploymentException( rtl::OUString(), oWeakThis,
makeAny( uno::Exception( aErrStr, oWeakThis ) ) );
// Call compiler
sal_Int32 nXhpFileCount = aXhpFileVector.size();
rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount];
for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp )
{
rtl::OUString aXhpFile = aXhpFileVector[iXhp];
rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL );
pXhpFiles[iXhp] = aXhpRelFile;
}
rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() );
rtl::OUString aOfficeHelpPathFileURL;
::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL );
HelpProcessingErrorInfo aErrorInfo;
bool bSuccess = compileExtensionHelp(
aOfficeHelpPathFileURL, aHelpStr, aLangURL,
nXhpFileCount, pXhpFiles,
langFolderDestExpanded, aErrorInfo );
if( bSuccess && xInvocation.is() )
{
Sequence<uno::Any> aParamsSeq( 6 );
aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) );
rtl::OUString aLang;
sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' );
if( nLastSlash != -1 )
aLang = aLangURL.copy( nLastSlash + 1 );
else
aLang = rtl::OUString::createFromAscii( "en" );
aParamsSeq[1] = uno::makeAny( aLang );
aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) );
aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) );
aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) );
rtl::OUString aSystemPath;
osl::FileBase::getSystemPathFromFileURL(
langFolderDestExpanded, aSystemPath );
aParamsSeq[5] = uno::makeAny( aSystemPath );
Sequence< sal_Int16 > aOutParamIndex;
Sequence< uno::Any > aOutParam;
uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ),
aParamsSeq, aOutParamIndex, aOutParam );
}
if( !bSuccess )
{
USHORT nErrStrId = 0;
switch( aErrorInfo.m_eErrorClass )
{
case HELPPROCESSING_GENERAL_ERROR:
case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break;
case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break;
default: ;
};
rtl::OUString aErrStr;
if( nErrStrId != 0 )
{
aErrStr = getResourceString( nErrStrId );
// Remoce CR/LF
rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg );
sal_Unicode nCR = 13, nLF = 10;
sal_Int32 nSearchCR = aErrMsg.indexOf( nCR );
sal_Int32 nSearchLF = aErrMsg.indexOf( nLF );
sal_Int32 nCopy;
if( nSearchCR != -1 || nSearchLF != -1 )
{
if( nSearchCR == -1 )
nCopy = nSearchLF;
else if( nSearchLF == -1 )
nCopy = nSearchCR;
else
nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF;
aErrMsg = aErrMsg.copy( 0, nCopy );
}
aErrStr += aErrMsg;
if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() )
{
aErrStr += rtl::OUString::createFromAscii( " in " );
rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile,
rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
aErrStr += aDecodedFile;
if( aErrorInfo.m_nXMLParsingLine != -1 )
{
aErrStr += rtl::OUString::createFromAscii( ", line " );
aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine );
}
}
}
OWeakObject* oWeakThis = static_cast<OWeakObject *>(this);
throw deployment::DeploymentException( rtl::OUString(), oWeakThis,
makeAny( uno::Exception( aErrStr, oWeakThis ) ) );
}
}
}
}
//Writing the data entry replaces writing the flag file. If we got to this
//point the registration was successful.
addDataToDb(xPackage->getURL(), data);
}
} //if (doRegisterPackage)
else
{
deleteDataFromDb(xPackage->getURL());

8
desktop/util/verinfo.rc Normal file → Executable file
View File

@ -68,25 +68,25 @@ VS_VERSION_INFO versioninfo
block "040704E4"
{
// German StringTable
value "CompanyName", "Oracle, Inc.\0"
value "CompanyName", "Oracle\0"
value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0"
value "FileVersion", PPS(VER_LEVEL) "\0"
value "ProductVersion", PPS(VER_LEVEL) "\0"
value "OriginalFilename", "SOFFICE.EXE\0"
value "InternalName", "SOFFICE\0"
value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0"
value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0"
}
#else
block "040904E4"
{
// International StringTable
value "CompanyName", "Oracle, Inc.\0"
value "CompanyName", "Oracle\0"
value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0"
value "FileVersion", PPS(VER_LEVEL) "\0"
value "ProductVersion", PPS(VER_LEVEL) "\0"
value "OriginalFilename", "SOFFICE.EXE\0"
value "InternalName", "SOFFICE\0"
value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0"
value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0"
}
#endif
}

4
desktop/win32/source/applauncher/ooo/verinfo.rc Normal file → Executable file
View File

@ -69,7 +69,7 @@ VS_VERSION_INFO versioninfo
value "ProductVersion", PPS(VER_LEVEL) "\0"
value "OriginalFilename", PPS(RES_APP_NAME) ".exe\0"
value "InternalName", PPS(RES_APP_NAME) "\0"
value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0"
value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0"
}
#else
block "040904E4"
@ -81,7 +81,7 @@ VS_VERSION_INFO versioninfo
value "ProductVersion", PPS(VER_LEVEL) "\0"
value "OriginalFilename", PPS(RES_APP_NAME) ".exe\0"
value "InternalName", PPS(RES_APP_NAME) "\0"
value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0"
value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0"
}
#endif
}

8
desktop/win32/source/applauncher/verinfo.rc Normal file → Executable file
View File

@ -68,25 +68,25 @@ VS_VERSION_INFO versioninfo
block "040704E4"
{
// German StringTable
value "CompanyName", "Sun Microsystems, Inc.\0"
value "CompanyName", "Oracle\0"
value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0"
value "FileVersion", PPS(VER_LEVEL) "\0"
value "ProductVersion", PPS(VER_LEVEL) "\0"
value "OriginalFilename", PPS(RES_APP_NAME) ".exe\0"
value "InternalName", PPS(RES_APP_NAME) "\0"
value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0"
value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0"
}
#else
block "040904E4"
{
// International StringTable
value "CompanyName", "Sun Microsystems, Inc.\0"
value "CompanyName", "Oracle\0"
value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0"
value "FileVersion", PPS(VER_LEVEL) "\0"
value "ProductVersion", PPS(VER_LEVEL) "\0"
value "OriginalFilename", PPS(RES_APP_NAME) ".exe\0"
value "InternalName", PPS(RES_APP_NAME) "\0"
value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0"
value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0"
}
#endif
}

View File

@ -339,6 +339,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
p = desktop_win32::commandLineAppend(p, argv[i]);
}
}
p = desktop_win32::commandLineAppend(
p, MY_STRING(L"\" \"-env:OOO_CWD="));
if (cwdLen == 0) {

View File

@ -1206,7 +1206,12 @@ namespace drawinglayer
mpOutputDevice->SetLineColor(Color(aHairlineColor));
mpOutputDevice->SetFillColor();
aHairLinePolyPolygon.transform(maCurrentTransformation);
LineInfo aLineInfo(LINE_SOLID, basegfx::fround(rLine.getWidth()));
// #i113922# LineWidth needs to be transformed, too
const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(rLine.getWidth(), 0.0));
const double fDiscreteLineWidth(aDiscreteUnit.getLength());
LineInfo aLineInfo(LINE_SOLID, basegfx::fround(fDiscreteLineWidth));
aLineInfo.SetLineJoin(rLine.getLineJoin());
for(sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++)

View File

@ -64,6 +64,7 @@ public:
sal_Bool AreThereOwnUsrAnys() const { return (pCombiList ? sal_True : sal_False); }
::com::sun::star::uno::Any* GetUsrAnyForID(sal_uInt16 nWID) const;
void AddUsrAnyForID(const ::com::sun::star::uno::Any& rAny, sal_uInt16 nWID);
void ClearAllUsrAny();
com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const;
const SfxItemPropertyMapEntry* getPropertyMapEntries() const {return _pMap;}

View File

@ -43,7 +43,7 @@
#include <editeng/wghtitem.hxx>
#include <svtools/htmltokn.h>
#include <svtools/htmlkywd.hxx>
#include <tools/tenccvt.hxx>
#define ACTION_INSERTTEXT 1
#define ACTION_INSERTPARABRK 2
@ -66,6 +66,16 @@ EditHTMLParser::EditHTMLParser( SvStream& rIn, const String& rBaseURL, SvKeyValu
nNumberingLevel = 0;
bFieldsInserted = FALSE;
DBG_ASSERT( RTL_TEXTENCODING_DONTKNOW == GetSrcEncoding( ), "EditHTMLParser::EditHTMLParser: Where does the encoding come from?" );
DBG_ASSERT( !IsSwitchToUCS2(), "EditHTMLParser::::EditHTMLParser: Switch to UCS2?" );
// Altough the real default encoding is ISO8859-1, we use MS-1252
// als default encoding.
SetSrcEncoding( GetExtendedCompatibilityTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ) );
// If the file starts with a BOM, switch to UCS2.
SetSwitchToUCS2( TRUE );
if ( pHTTPHeaderAttrs )
SetEncodingByHTTPHeader( pHTTPHeaderAttrs );
}

View File

@ -51,6 +51,7 @@
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
#include <com/sun/star/i18n/WordType.hpp>
#include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <i18npool/lang.h>
#include <vos/ref.hxx>
@ -1002,6 +1003,8 @@ public:
void SetAutoCompleteText( const String& rStr, sal_Bool bUpdateTipWindow );
EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode );
short ReplaceTextOnly( ContentNode* pNode, USHORT nCurrentStart, xub_StrLen nLen, const String& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rOffsets );
void SetAsianCompressionMode( USHORT n );
USHORT GetAsianCompressionMode() const { return nAsianCompressionMode; }

379
editeng/source/editeng/impedit4.cxx Normal file → Executable file
View File

@ -76,6 +76,9 @@
#include <com/sun/star/linguistic2/XThesaurus.hpp>
#include <com/sun/star/linguistic2/XMeaning.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/i18n/WordType.hpp>
#include <com/sun/star/i18n/TransliterationModules.hpp>
#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
#include <unotools/transliterationwrapper.hxx>
#include <unotools/textsearch.hxx>
#include <comphelper/processfactory.hxx>
@ -83,6 +86,8 @@
#include <svtools/rtfkeywd.hxx>
#include <editeng/edtdlg.hxx>
#include <vector>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@ -2811,8 +2816,23 @@ void ImpEditEngine::SetAutoCompleteText( const String& rStr, sal_Bool bClearTipW
#endif // !SVX_LIGHT
}
struct TransliterationChgData
{
USHORT nStart;
xub_StrLen nLen;
EditSelection aSelection;
String aNewText;
uno::Sequence< sal_Int32 > aOffsets;
};
EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode )
{
uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
if (!_xBI.is())
return rSelection;
EditSelection aSel( rSelection );
aSel.Adjust( aEditDoc );
@ -2821,8 +2841,8 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
EditSelection aNewSel( aSel );
USHORT nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
USHORT nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() );
const USHORT nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
const USHORT nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() );
BOOL bChanges = FALSE;
BOOL bLenChanged = FALSE;
@ -2845,83 +2865,266 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
USHORT nCurrentEnd = nEndPos;
sal_uInt16 nLanguage = LANGUAGE_SYSTEM;
do
// since we don't use Hiragana/Katakana or half-width/full-width transliterations here
// it is fine to use ANYWORD_IGNOREWHITESPACES. (ANY_WORD btw is broken and will
// occasionaly miss words in consecutive sentences). Also with ANYWORD_IGNOREWHITESPACES
// text like 'just-in-time' will be converted to 'Just-In-Time' which seems to be the
// proper thing to do.
const sal_Int16 nWordType = i18n::WordType::ANYWORD_IGNOREWHITESPACES;
//! In order to have less trouble with changing text size, e.g. because
//! of ligatures or <20> (German small sz) being resolved, we need to process
//! the text replacements from end to start.
//! This way the offsets for the yet to be changed words will be
//! left unchanged by the already replaced text.
//! For this we temporarily save the changes to be done in this vector
std::vector< TransliterationChgData > aChanges;
TransliterationChgData aChgData;
if (nTransliterationMode == i18n::TransliterationModulesExtra::TITLE_CASE)
{
if ( bConsiderLanguage )
// for 'capitalize every word' we need to iterate over each word
i18n::Boundary aSttBndry;
i18n::Boundary aEndBndry;
aSttBndry = _xBI->getWordBoundary(
*pNode, nStartPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ),
nWordType, TRUE /*prefer forward direction*/);
aEndBndry = _xBI->getWordBoundary(
*pNode, nEndPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ),
nWordType, FALSE /*prefer backward direction*/);
// prevent backtracking to the previous word if selection is at word boundary
if (aSttBndry.endPos <= nStartPos)
{
nLanguage = GetLanguage( EditPaM( pNode, nCurrentStart+1 ), &nCurrentEnd );
if ( nCurrentEnd > nEndPos )
nCurrentEnd = nEndPos;
aSttBndry = _xBI->nextWord(
*pNode, aSttBndry.endPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, aSttBndry.endPos + 1 ) ) ),
nWordType);
}
// prevent advancing to the next word if selection is at word boundary
if (aEndBndry.startPos >= nEndPos)
{
aEndBndry = _xBI->previousWord(
*pNode, aEndBndry.startPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, aEndBndry.startPos + 1 ) ) ),
nWordType);
}
xub_StrLen nLen = nCurrentEnd - nCurrentStart;
Sequence <sal_Int32> aOffsets;
String aNewText( aTranslitarationWrapper.transliterate( *pNode, nLanguage, nCurrentStart, nLen, &aOffsets ) );
if( ( nLen != aNewText.Len() ) || !pNode->Equals( aNewText, nCurrentStart, nLen ) )
i18n::Boundary aCurWordBndry( aSttBndry );
while (aCurWordBndry.startPos <= aEndBndry.startPos)
{
bChanges = TRUE;
if ( nLen != aNewText.Len() )
bLenChanged = TRUE;
#ifndef SVX_LIGHT
// Create UndoAction on Demand....
if ( !pUndo && IsUndoEnabled() && !IsInUndo() )
{
ESelection aESel( CreateESel( aSel ) );
pUndo = new EditUndoTransliteration( this, aESel, nTransliterationMode );
if ( ( nStartNode == nEndNode ) && !aSel.Min().GetNode()->GetCharAttribs().HasAttrib( aSel.Min().GetIndex(), aSel.Max().GetIndex() ) )
pUndo->SetText( aSel.Min().GetNode()->Copy( aSel.Min().GetIndex(), aSel.Max().GetIndex()-aSel.Min().GetIndex() ) );
else
pUndo->SetText( CreateBinTextObject( aSel, NULL ) );
}
nCurrentStart = (xub_StrLen)aCurWordBndry.startPos;
nCurrentEnd = (xub_StrLen)aCurWordBndry.endPos;
sal_Int32 nLen = nCurrentEnd - nCurrentStart;
DBG_ASSERT( nLen > 0, "invalid word length of 0" );
#if OSL_DEBUG_LEVEL > 1
String aText( pNode->Copy( nCurrentStart, nLen ) );
#endif
// Change text without loosing the attributes
USHORT nCharsAfterTransliteration =
sal::static_int_cast< USHORT >(aOffsets.getLength());
const sal_Int32* pOffsets = aOffsets.getConstArray();
short nDiffs = 0;
for ( USHORT n = 0; n < nCharsAfterTransliteration; n++ )
Sequence< sal_Int32 > aOffsets;
String aNewText( aTranslitarationWrapper.transliterate( *pNode,
GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ),
nCurrentStart, nLen, &aOffsets ));
if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
{
USHORT nCurrentPos = nCurrentStart+n;
sal_Int32 nDiff = (nCurrentPos-nDiffs) - pOffsets[n];
aChgData.nStart = nCurrentStart;
aChgData.nLen = nLen;
aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) );
aChgData.aNewText = aNewText;
aChgData.aOffsets = aOffsets;
aChanges.push_back( aChgData );
}
#if OSL_DEBUG_LEVEL > 1
String aSelTxt ( GetSelected( aChgData.aSelection ) );
(void) aSelTxt;
#endif
if ( !nDiff )
{
DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" );
pNode->SetChar( nCurrentPos, aNewText.GetChar(n) );
}
else if ( nDiff < 0 )
{
// Replace first char, delete the rest...
DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" );
pNode->SetChar( nCurrentPos, aNewText.GetChar(n) );
aCurWordBndry = _xBI->nextWord( *pNode, nCurrentEnd,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
nWordType);
}
DBG_ASSERT( nCurrentEnd >= aEndBndry.endPos, "failed to reach end of transliteration" );
}
else if (nTransliterationMode == i18n::TransliterationModulesExtra::SENTENCE_CASE)
{
// for 'sentence case' we need to iterate sentence by sentence
DBG_ASSERT( (nCurrentPos+1) < pNode->Len(), "TransliterateText - String smaller than expected!" );
GetEditDoc().RemoveChars( EditPaM( pNode, nCurrentPos+1 ), sal::static_int_cast< USHORT >(-nDiff) );
}
else
{
DBG_ASSERT( nDiff == 1, "TransliterateText - Diff other than expected! But should work..." );
GetEditDoc().InsertText( EditPaM( pNode, nCurrentPos ), aNewText.GetChar(n) );
sal_Int32 nLastStart = _xBI->beginOfSentence(
*pNode, nEndPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ) );
sal_Int32 nLastEnd = _xBI->endOfSentence(
*pNode, nLastStart,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ) );
}
nDiffs = sal::static_int_cast< short >(nDiffs + nDiff);
// extend nCurrentStart, nCurrentEnd to the current sentence boundaries
nCurrentStart = _xBI->beginOfSentence(
*pNode, nStartPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ) );
nCurrentEnd = _xBI->endOfSentence(
*pNode, nCurrentStart,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) );
// prevent backtracking to the previous sentence if selection starts at end of a sentence
if (nCurrentEnd <= nStartPos)
{
// now nCurrentStart is probably located on a non-letter word. (unless we
// are in Asian text with no spaces...)
// Thus to get the real sentence start we should locate the next real word,
// that is one found by DICTIONARY_WORD
i18n::Boundary aBndry = _xBI->nextWord( *pNode, nCurrentEnd,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
i18n::WordType::DICTIONARY_WORD);
// now get new current sentence boundaries
nCurrentStart = _xBI->beginOfSentence(
*pNode, aBndry.startPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) );
nCurrentEnd = _xBI->endOfSentence(
*pNode, nCurrentStart,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) );
}
// prevent advancing to the next sentence if selection ends at start of a sentence
if (nLastStart >= nEndPos)
{
// now nCurrentStart is probably located on a non-letter word. (unless we
// are in Asian text with no spaces...)
// Thus to get the real sentence start we should locate the previous real word,
// that is one found by DICTIONARY_WORD
i18n::Boundary aBndry = _xBI->previousWord( *pNode, nLastStart,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ),
i18n::WordType::DICTIONARY_WORD);
nLastEnd = _xBI->endOfSentence(
*pNode, aBndry.startPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) );
if (nCurrentEnd > nLastEnd)
nCurrentEnd = nLastEnd;
}
while (nCurrentStart < nLastEnd)
{
sal_Int32 nLen = nCurrentEnd - nCurrentStart;
DBG_ASSERT( nLen > 0, "invalid word length of 0" );
#if OSL_DEBUG_LEVEL > 1
String aText( pNode->Copy( nCurrentStart, nLen ) );
#endif
Sequence< sal_Int32 > aOffsets;
String aNewText( aTranslitarationWrapper.transliterate( *pNode,
GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ),
nCurrentStart, nLen, &aOffsets ));
if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
{
aChgData.nStart = nCurrentStart;
aChgData.nLen = nLen;
aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) );
aChgData.aNewText = aNewText;
aChgData.aOffsets = aOffsets;
aChanges.push_back( aChgData );
}
if ( nNode == nEndNode )
aNewSel.Max().GetIndex() =
aNewSel.Max().GetIndex() + nDiffs;
ParaPortion* pParaPortion = GetParaPortions()[nNode];
pParaPortion->MarkSelectionInvalid( nCurrentStart, std::max< USHORT >( nCurrentStart+nLen, nCurrentStart+aNewText.Len() ) );
i18n::Boundary aFirstWordBndry;
aFirstWordBndry = _xBI->nextWord(
*pNode, nCurrentEnd,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
nWordType);
nCurrentStart = aFirstWordBndry.startPos;
nCurrentEnd = _xBI->endOfSentence(
*pNode, nCurrentStart,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) );
}
nCurrentStart = nCurrentEnd;
} while( nCurrentEnd < nEndPos );
DBG_ASSERT( nCurrentEnd >= nLastEnd, "failed to reach end of transliteration" );
}
else
{
do
{
if ( bConsiderLanguage )
{
nLanguage = GetLanguage( EditPaM( pNode, nCurrentStart+1 ), &nCurrentEnd );
if ( nCurrentEnd > nEndPos )
nCurrentEnd = nEndPos;
}
xub_StrLen nLen = nCurrentEnd - nCurrentStart;
Sequence< sal_Int32 > aOffsets;
String aNewText( aTranslitarationWrapper.transliterate( *pNode, nLanguage, nCurrentStart, nLen, &aOffsets ) );
if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
{
aChgData.nStart = nCurrentStart;
aChgData.nLen = nLen;
aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) );
aChgData.aNewText = aNewText;
aChgData.aOffsets = aOffsets;
aChanges.push_back( aChgData );
}
nCurrentStart = nCurrentEnd;
} while( nCurrentEnd < nEndPos );
}
if (aChanges.size() > 0)
{
#ifndef SVX_LIGHT
// Create a single UndoAction on Demand for all the changes ...
if ( !pUndo && IsUndoEnabled() && !IsInUndo() )
{
// adjust selection to include all changes
for (size_t i = 0; i < aChanges.size(); ++i)
{
const EditSelection &rSel = aChanges[i].aSelection;
if (aSel.Min().GetNode() == rSel.Min().GetNode() &&
aSel.Min().GetIndex() > rSel.Min().GetIndex())
aSel.Min().SetIndex( rSel.Min().GetIndex() );
if (aSel.Max().GetNode() == rSel.Max().GetNode() &&
aSel.Max().GetIndex() < rSel.Max().GetIndex())
aSel.Max().SetIndex( rSel.Max().GetIndex() );
}
aNewSel = aSel;
ESelection aESel( CreateESel( aSel ) );
pUndo = new EditUndoTransliteration( this, aESel, nTransliterationMode );
const bool bSingleNode = aSel.Min().GetNode()== aSel.Max().GetNode();
const bool bHasAttribs = aSel.Min().GetNode()->GetCharAttribs().HasAttrib( aSel.Min().GetIndex(), aSel.Max().GetIndex() );
if (bSingleNode && !bHasAttribs)
pUndo->SetText( aSel.Min().GetNode()->Copy( aSel.Min().GetIndex(), aSel.Max().GetIndex()-aSel.Min().GetIndex() ) );
else
pUndo->SetText( CreateBinTextObject( aSel, NULL ) );
}
#endif
// now apply the changes from end to start to leave the offsets of the
// yet unchanged text parts remain the same.
for (size_t i = 0; i < aChanges.size(); ++i)
{
const TransliterationChgData &rData = aChanges[ aChanges.size() - 1 - i ];
bChanges = TRUE;
if (rData.nLen != rData.aNewText.Len())
bLenChanged = TRUE;
// Change text without loosing the attributes
USHORT nDiffs = ReplaceTextOnly( rData.aSelection.Min().GetNode(),
rData.nStart, rData.nLen, rData.aNewText, rData.aOffsets );
// adjust selection in end node to possibly changed size
if (aSel.Max().GetNode() == rData.aSelection.Max().GetNode())
aNewSel.Max().GetIndex() = aNewSel.Max().GetIndex() + nDiffs;
USHORT nSelNode = aEditDoc.GetPos( rData.aSelection.Min().GetNode() );
ParaPortion* pParaPortion = GetParaPortions()[nSelNode];
pParaPortion->MarkSelectionInvalid( rData.nStart,
std::max< USHORT >( rData.nStart + rData.nLen,
rData.nStart + rData.aNewText.Len() ) );
}
} // if (aChanges.size() > 0)
}
#ifndef SVX_LIGHT
@ -2945,6 +3148,52 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
return aNewSel;
}
short ImpEditEngine::ReplaceTextOnly(
ContentNode* pNode,
USHORT nCurrentStart, xub_StrLen nLen,
const String& rNewText,
const uno::Sequence< sal_Int32 >& rOffsets )
{
(void) nLen;
// Change text without loosing the attributes
USHORT nCharsAfterTransliteration =
sal::static_int_cast< USHORT >(rOffsets.getLength());
const sal_Int32* pOffsets = rOffsets.getConstArray();
short nDiffs = 0;
for ( USHORT n = 0; n < nCharsAfterTransliteration; n++ )
{
USHORT nCurrentPos = nCurrentStart+n;
sal_Int32 nDiff = (nCurrentPos-nDiffs) - pOffsets[n];
if ( !nDiff )
{
DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" );
pNode->SetChar( nCurrentPos, rNewText.GetChar(n) );
}
else if ( nDiff < 0 )
{
// Replace first char, delete the rest...
DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" );
pNode->SetChar( nCurrentPos, rNewText.GetChar(n) );
DBG_ASSERT( (nCurrentPos+1) < pNode->Len(), "TransliterateText - String smaller than expected!" );
GetEditDoc().RemoveChars( EditPaM( pNode, nCurrentPos+1 ), sal::static_int_cast< USHORT >(-nDiff) );
}
else
{
DBG_ASSERT( nDiff == 1, "TransliterateText - Diff other than expected! But should work..." );
GetEditDoc().InsertText( EditPaM( pNode, nCurrentPos ), rNewText.GetChar(n) );
}
nDiffs = sal::static_int_cast< short >(nDiffs + nDiff);
}
return nDiffs;
}
void ImpEditEngine::SetAsianCompressionMode( USHORT n )
{
if ( n != nAsianCompressionMode )

View File

@ -1243,27 +1243,25 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt,
else if ( bIsNextRun && !IsAutoCorrectChar( cChar ) )
{
// Remove the NBSP if it wasn't an autocorrection
if ( NeedsHardspaceAutocorr( rTxt.GetChar( nInsPos - 1 ) ) &&
if ( nInsPos != 0 && NeedsHardspaceAutocorr( rTxt.GetChar( nInsPos - 1 ) ) &&
cChar != ' ' && cChar != '\t' && cChar != CHAR_HARDBLANK )
{
// Look for the last HARD_SPACE
xub_StrLen nPos = nInsPos - 1;
bool bFound = false;
while ( nPos != STRING_NOTFOUND && !bFound )
bool bContinue = true;
while ( bContinue )
{
sal_Unicode cTmpChar = rTxt.GetChar( nPos );
const sal_Unicode cTmpChar = rTxt.GetChar( nPos );
if ( cTmpChar == CHAR_HARDBLANK )
bFound = true;
else if ( !NeedsHardspaceAutocorr( cTmpChar ) )
nPos = STRING_NOTFOUND;
{
rDoc.Delete( nPos, nPos + 1 );
nRet = AddNonBrkSpace;
bContinue = false;
}
else if ( !NeedsHardspaceAutocorr( cTmpChar ) || nPos == 0 )
bContinue = false;
nPos--;
}
if ( bFound && nPos != STRING_NOTFOUND )
{
rDoc.Delete( nPos + 1, nPos + 2 );
nRet = AddNonBrkSpace;
}
}
}
}

View File

@ -71,15 +71,7 @@ SvxItemPropertySet::SvxItemPropertySet( const SfxItemPropertyMapEntry* pMap, Sfx
//----------------------------------------------------------------------
SvxItemPropertySet::~SvxItemPropertySet()
{
/*
if(pItemPool)
delete pItemPool;
pItemPool = NULL;
*/
if(pCombiList)
delete pCombiList;
pCombiList = NULL;
ClearAllUsrAny();
}
//----------------------------------------------------------------------
@ -111,6 +103,17 @@ void SvxItemPropertySet::AddUsrAnyForID(const uno::Any& rAny, sal_uInt16 nWID)
pCombiList->Insert(pNew);
}
//----------------------------------------------------------------------
void SvxItemPropertySet::ClearAllUsrAny()
{
if(pCombiList)
delete pCombiList;
pCombiList = NULL;
}
//----------------------------------------------------------------------
sal_Bool SvxUnoCheckForPositiveValue( const uno::Any& rVal )
{
sal_Bool bConvert = sal_True; // the default is that all metric items must be converted

View File

@ -28,13 +28,6 @@
#ifndef __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_
#define __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_
//_______________________________________________
// my own includes
#include <threadhelp/threadhelpbase.hxx>
#include <macros/debug.hxx>
#include <general.h>
//_______________________________________________
// interface includes
#include <com/sun/star/frame/XFrame.hpp>
@ -88,10 +81,10 @@ class FrameListAnalyzer
public:
/** provides access to the frame container, which should be analyzed. */
const css::uno::Reference< css::frame::XFramesSupplier >& m_xSupplier;
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& m_xSupplier;
/** hold the reference frame, which is used e.g. to detect other frames with the same model. */
const css::uno::Reference< css::frame::XFrame >& m_xReferenceFrame;
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& m_xReferenceFrame;
/** enable/disable some special analyzing steps.
see impl_analyze() for further informations. */
@ -100,19 +93,19 @@ class FrameListAnalyzer
/** contains all frames, which uses the same model like the reference frame.
Will be filled only if m_eDetectMode has set the flag E_MODEL.
The reference frame is never part of this list! */
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > m_lModelFrames;
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lModelFrames;
/** contains all frames, which does not contain the same model like the reference frame.
Filling of it can't be supressed by m_eDetectMode.
The reference frame is never part of this list!
All frames inside this list are visible ones. */
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > m_lOtherVisibleFrames;
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherVisibleFrames;
/** contains all frames, which does not contain the same model like the reference frame.
Filling of it can't be supressed by m_eDetectMode.
The reference frame is never part of this list!
All frames inside this list are hidden ones. */
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > m_lOtherHiddenFrames;
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherHiddenFrames;
/** points to the help frame.
Will be set only, if any other frame (means different from the reference frame)
@ -137,7 +130,7 @@ class FrameListAnalyzer
Analyzing of the help frame ignores the visible state of any frame.
But note: a hidden help frame indicates a wrong state!
*/
css::uno::Reference< css::frame::XFrame > m_xHelp;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xHelp;
/** points to the frame, which contains the backing component.
Will be set only, if any other frame (means different from the reference frame)
@ -163,7 +156,7 @@ class FrameListAnalyzer
Analyzing of the help frame ignores the visible state of any frame.
But note: a hidden backing mode frame indicates a wrong state!
*/
css::uno::Reference< css::frame::XFrame > m_xBackingComponent;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xBackingComponent;
/** is set to true only, if the reference frame is a hidden one.
This value is undefined if m_eDetectMode doesn't have set the flag E_HIDDEN! */
@ -200,8 +193,8 @@ class FrameListAnalyzer
analyze steps. Note: Some member values will be undefined, if
an analyze step will be disabled.
*/
FrameListAnalyzer( const css::uno::Reference< css::frame::XFramesSupplier >& xSupplier ,
const css::uno::Reference< css::frame::XFrame >& xReferenceFrame ,
FrameListAnalyzer( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& xSupplier ,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xReferenceFrame ,
sal_uInt32 eDetectMode );
virtual ~FrameListAnalyzer();

View File

@ -219,6 +219,7 @@ namespace framework
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xModuleImageManager;
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xModuleAcceleratorManager;
};
}

View File

@ -42,6 +42,7 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\statusbar
..\inc\classes\menuextensionsupplier.hxx %_DEST%\inc%_EXT%\framework\menuextensionsupplier.hxx
..\inc\interaction\preventduplicateinteraction.hxx %_DEST%\inc%_EXT%\framework\preventduplicateinteraction.hxx
..\inc\helper\titlehelper.hxx %_DEST%\inc%_EXT%\framework\titlehelper.hxx
..\inc\classes\framelistanalyzer.hxx %_DEST%\inc%_EXT%\framework\framelistanalyzer.hxx
..\uiconfig\startmodule\menubar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\menubar\*.xml
..\uiconfig\startmodule\toolbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\toolbar\*.xml

View File

@ -1248,11 +1248,12 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util:
if (! xHAccess.is ())
return;
const sal_Int32 c = aEvent.Changes.getLength();
css::util::ChangesEvent aReceivedEvents( aEvent );
const sal_Int32 c = aReceivedEvents.Changes.getLength();
sal_Int32 i = 0;
for (i=0; i<c; ++i)
{
const css::util::ElementChange& aChange = aEvent.Changes[i];
const css::util::ElementChange& aChange = aReceivedEvents.Changes[i];
// Only path of form "PrimaryKeys/Modules/Module['<module_name>']/Key['<command_url>']/Command[<locale>]" will
// be interesting for use. Sometimes short path values are given also by the broadcaster ... but they must be ignored :-)

View File

@ -103,6 +103,7 @@
#include <unotools/moduleoptions.hxx>
#include <svtools/sfxecode.hxx>
#include <unotools/processfactory.hxx>
#include <unotools/ucbhelper.hxx>
#include <comphelper/configurationhelper.hxx>
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>
@ -1407,7 +1408,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded()
// don't check the complete URL here.
// use its main part - ignore optional jumpmarks!
const ::rtl::OUString sURL = xModel->getURL();
if (!m_aURL.Main.equals(sURL))
if (!::utl::UCBContentHelper::EqualURLs( m_aURL.Main, sURL ))
{
xTask.clear ();
continue;

View File

@ -776,26 +776,29 @@ void SAL_CALL ModuleUIConfigurationManager::dispose() throw (::com::sun::star::u
css::lang::EventObject aEvent( xThis );
m_aListenerContainer.disposeAndClear( aEvent );
{
ResetableGuard aGuard( m_aLock );
try
{
if ( m_xModuleImageManager.is() )
m_xModuleImageManager->dispose();
}
catch ( Exception& )
{
}
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
ResetableGuard aGuard( m_aLock );
Reference< XComponent > xModuleImageManager( m_xModuleImageManager );
m_xModuleImageManager.clear();
m_xModuleAcceleratorManager.clear();
m_aUIElements[LAYER_USERDEFINED].clear();
m_aUIElements[LAYER_DEFAULT].clear();
m_xDefaultConfigStorage.clear();
m_xUserConfigStorage.clear();
m_xUserRootCommit.clear();
m_bConfigRead = false;
m_bModified = false;
m_bDisposed = true;
aGuard.unlock();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
m_xModuleImageManager.clear();
m_aUIElements[LAYER_USERDEFINED].clear();
m_aUIElements[LAYER_DEFAULT].clear();
m_xDefaultConfigStorage.clear();
m_xUserConfigStorage.clear();
m_xUserRootCommit.clear();
m_bConfigRead = false;
m_bModified = false;
m_bDisposed = true;
try
{
if ( xModuleImageManager.is() )
xModuleImageManager->dispose();
}
catch ( Exception& )
{
}
}
@ -1370,30 +1373,35 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager()
}
return Reference< XInterface >( m_xModuleImageManager, UNO_QUERY );
// return Reference< XInterface >();
}
Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException)
{
ResetableGuard aGuard( m_aLock );
if ( m_bDisposed )
throw DisposedException();
Reference< XMultiServiceFactory > xSMGR = m_xServiceManager;
::rtl::OUString aModule = /*m_aModuleShortName*/m_aModuleIdentifier;
aGuard.unlock();
::rtl::OUString aModule = m_aModuleIdentifier;
Reference< XInterface > xManager = xSMGR->createInstance(SERVICENAME_MODULEACCELERATORCONFIGURATION);
Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW);
if ( !m_xModuleAcceleratorManager.is() )
{
Reference< XInterface > xManager = xSMGR->createInstance(SERVICENAME_MODULEACCELERATORCONFIGURATION);
Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW);
PropertyValue aProp;
aProp.Name = ::rtl::OUString::createFromAscii("ModuleIdentifier");
aProp.Value <<= aModule;
PropertyValue aProp;
aProp.Name = ::rtl::OUString::createFromAscii("ModuleIdentifier");
aProp.Value <<= aModule;
Sequence< Any > lArgs(1);
lArgs[0] <<= aProp;
Sequence< Any > lArgs(1);
lArgs[0] <<= aProp;
xInit->initialize(lArgs);
xInit->initialize(lArgs);
m_xModuleAcceleratorManager = Reference< XInterface >( xManager, UNO_QUERY );
}
return xManager;
return m_xModuleAcceleratorManager;
}
Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException)

View File

@ -50,7 +50,6 @@ LIB1OBJFILES= \
$(SLO)$/protocolhandlercache.obj \
$(SLO)$/networkdomain.obj \
$(SLO)$/configaccess.obj \
$(SLO)$/framelistanalyzer.obj \
$(SLO)$/shareablemutex.obj \
$(SLO)$/itemcontainer.obj \
$(SLO)$/rootitemcontainer.obj \
@ -99,6 +98,7 @@ LIB2OBJFILES= \
$(SLO)$/configimporter.obj \
$(SLO)$/menuextensionsupplier.obj \
$(SLO)$/preventduplicateinteraction.obj \
$(SLO)$/framelistanalyzer.obj \
$(SLO)$/titlehelper.obj
# --- import classes library ---------------------------------------------------

View File

@ -395,7 +395,14 @@
<author>AS</author>
<desc>Contains all of the document factories that were installed during setup.</desc>
</info>
</set>
</set>
<prop oor:name="OfficeRestartInProgress" oor:type="xs:boolean">
<info>
<author>MAV</author>
<desc>The entry specifies that we are in restart process</desc>
</info>
<value>false</value>
</prop>
</group>
<group oor:name="L10N">
<info>

View File

@ -42,6 +42,10 @@
#ifndef __ooo_vba_XAssistant_idl__
#include <ooo/vba/XAssistant.idl>
#endif
#ifndef __ooo_vba_excel_XApplication_idl__
#include <ooo/vba/excel/XApplication.idl>
#endif
module ooo { module vba { module excel {
interface XRange;
@ -55,6 +59,9 @@ interface XGlobals: com::sun::star::uno::XInterface
[attribute, readonly] ooo::vba::XAssistant Assistant;
[attribute, readonly] any Selection;
[attribute, readonly] XWorkbook ThisWorkbook;
[attribute, readonly] ooo::vba::excel::XApplication Excel;
[attribute, readonly] any Debug;
void Calculate() raises(com::sun::star::script::BasicErrorException);
XRange Cells([in] any RowIndex, [in] any ColumnIndex);

View File

@ -66,12 +66,14 @@ interface XWorksheet
[attribute, readonly] boolean ProtectionMode;
[attribute, readonly] boolean ProtectContents;
[attribute, readonly] boolean ProtectDrawingObjects;
[attribute, readonly] boolean ProtectScenarios;
[attribute, readonly] XRange UsedRange;
[attribute, readonly] XWorksheet Next;
[attribute, readonly] XWorksheet Previous;
[attribute, readonly] string CodeName;
[attribute, readonly] short Index;
[attribute] long EnableSelection;
[attribute] boolean AutoFilterMode;
void Activate();
void Calculate( );

View File

@ -97,14 +97,22 @@ namespace basprov
if ( pMethods )
{
sal_Int32 nCount = pMethods->Count();
aChildNodes.realloc( nCount );
Reference< browse::XBrowseNode >* pChildNodes = aChildNodes.getArray();
sal_Int32 nRealCount = 0;
for ( sal_Int32 i = 0; i < nCount; ++i )
{
SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Get( static_cast< USHORT >( i ) ) );
if ( pMethod )
pChildNodes[i] = static_cast< browse::XBrowseNode* >( new BasicMethodNodeImpl( m_xContext, m_sScriptingContext, pMethod, m_bIsAppScript ) );
if ( pMethod && !pMethod->IsHidden() )
++nRealCount;
}
aChildNodes.realloc( nRealCount );
Reference< browse::XBrowseNode >* pChildNodes = aChildNodes.getArray();
sal_Int32 iTarget = 0;
for ( sal_Int32 i = 0; i < nCount; ++i )
{
SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Get( static_cast< USHORT >( i ) ) );
if ( pMethod && !pMethod->IsHidden() )
pChildNodes[iTarget++] = static_cast< browse::XBrowseNode* >( new BasicMethodNodeImpl( m_xContext, m_sScriptingContext, pMethod, m_bIsAppScript ) );
}
}
}

View File

@ -412,7 +412,7 @@ namespace basprov
if ( pMethods )
{
SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( aMethod, SbxCLASS_METHOD ) );
if ( pMethod )
if ( pMethod && !pMethod->IsHidden() )
{
if ( m_pDocBasicManager == pBasicMgr )
xScript = new BasicScriptImpl( aDescription, pMethod, *m_pDocBasicManager, m_xInvocationContext );

View File

@ -94,7 +94,7 @@ public:
USHORT GetViewFactoryCount() const;
SfxViewFactory& GetViewFactory(USHORT i = 0) const;
/// returns the view factory whose GetViewName delivers the requested logical name
/// returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical name
SfxViewFactory* GetViewFactoryByViewName( const String& i_rViewName ) const;
// Filter

View File

@ -320,7 +320,6 @@ public:
static com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag > GetVersionList(
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
static sal_Bool EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL );
static ::rtl::OUString CreateTempCopyWithExt( const ::rtl::OUString& aURL );
static sal_Bool CallApproveHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler, ::com::sun::star::uno::Any aRequest, sal_Bool bAllowAbort );

View File

@ -253,6 +253,7 @@ public:
private:
SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE );
SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell );
SAL_DLLPRIVATE void SaveCurrentViewData_Impl( const USHORT i_nNewViewId );
/** loads the given existing document into the given frame

View File

@ -123,13 +123,13 @@ public: \
static SfxViewFactory&Factory() { return *pFactory; } \
static void InitFactory()
#define SFX_IMPL_VIEWFACTORY(Class, rResId) \
#define SFX_IMPL_NAMED_VIEWFACTORY(Class, AsciiViewName) \
SfxViewFactory* Class::pFactory; \
SfxViewShell* __EXPORT Class::CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView) \
{ return new Class(pFrame, pOldView); } \
void Class::RegisterFactory( USHORT nPrio ) \
{ \
pFactory = new SfxViewFactory(&CreateInstance,&InitFactory,nPrio,rResId);\
pFactory = new SfxViewFactory(&CreateInstance,&InitFactory,nPrio,AsciiViewName);\
InitFactory(); \
} \
void Class::InitFactory()

View File

@ -46,24 +46,29 @@ class SFX2_DLLPUBLIC SfxViewFactory
{
public:
SfxViewFactory( SfxViewCtor fnC, SfxViewInit fnI,
USHORT nOrdinal, const ResId& aDescrResId );
USHORT nOrdinal, const sal_Char* asciiViewName );
~SfxViewFactory();
SfxViewShell *CreateInstance(SfxViewFrame *pViewFrame, SfxViewShell *pOldSh);
void InitFactory();
String GetDescription() const
{ return String( aDescription ); }
USHORT GetOrdinal() const { return nOrd; }
/// returns an API-compatible view name. For the moment, this is "view" with an appended ordinal/ID
String GetViewName() const;
/// returns a legacy view name. This is "view" with an appended ordinal/ID.
String GetLegacyViewName() const;
/** returns a API-compatible view name.
For details on which view names are specified, see the XModel2.getAvailableViewControllerNames
documentation.
*/
String GetAPIViewName() const;
private:
SfxViewCtor fnCreate;
SfxViewInit fnInit;
USHORT nOrd;
ResId aDescription;
const String m_sViewName;
};
#endif

View File

@ -253,10 +253,11 @@ namespace sfx2
pWindow->SetHelpId( HID_TASKPANE_WINDOW );
pWindow->SetOutputSizePixel( Size( 300, 450 ) );
pWindow->Show();
dynamic_cast< SfxDockingWindow* >( pWindow )->Initialize( i_pInfo );
SetHideNotDelete( TRUE );
pWindow->Show();
}
//------------------------------------------------------------------------------------------------------------------
@ -584,6 +585,7 @@ namespace sfx2
return;
::rtl::OUString sFirstVisiblePanelResource;
::rtl::OUString sFirstPanelResource;
const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() );
for ( const ::rtl::OUString* resource = aUIElements.getConstArray();
@ -594,6 +596,8 @@ namespace sfx2
if ( !impl_isToolPanelResource( *resource ) )
continue;
sFirstPanelResource = *resource;
::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) );
::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) );
@ -620,6 +624,9 @@ namespace sfx2
sFirstVisiblePanelResource = *resource;
}
if ( sFirstVisiblePanelResource.getLength() == 0 )
sFirstVisiblePanelResource = sFirstPanelResource;
if ( sFirstVisiblePanelResource.getLength() )
{
::boost::optional< size_t > aPanelPos( GetPanelPos( sFirstVisiblePanelResource ) );

View File

@ -45,6 +45,8 @@
#include <rtl/uuid.h>
#include <rtl/ustrbuf.hxx>
#include <rtl/uri.hxx>
#include <rtl/bootstrap.hxx>
#include <comphelper/interaction.hxx>
#include <comphelper/makesequence.hxx>
@ -136,6 +138,24 @@ uno::Reference<rdf::XURI> createBaseURI(
throw uno::RuntimeException();
}
// #i108078# workaround non-hierarchical vnd.sun.star.expand URIs
// this really should be done somewhere else, not here.
::rtl::OUString pkgURI(i_rPkgURI);
if (pkgURI.matchIgnoreAsciiCaseAsciiL(
RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:")))
{
// expand it here (makeAbsolute requires hierarchical URI)
pkgURI = pkgURI.copy( RTL_CONSTASCII_LENGTH("vnd.sun.star.expand:") );
if (pkgURI.getLength() != 0) {
pkgURI = ::rtl::Uri::decode(
pkgURI, rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8);
if (pkgURI.getLength() == 0) {
throw uno::RuntimeException();
}
::rtl::Bootstrap::expandMacros(pkgURI);
}
}
const uno::Reference<lang::XMultiComponentFactory> xServiceFactory(
i_xContext->getServiceManager(), uno::UNO_SET_THROW);
const uno::Reference<uri::XUriReferenceFactory> xUriFactory(
@ -146,11 +166,12 @@ uno::Reference<rdf::XURI> createBaseURI(
uno::Reference< uri::XUriReference > xBaseURI;
const uno::Reference< uri::XUriReference > xPkgURI(
xUriFactory->parse(i_rPkgURI), uno::UNO_SET_THROW );
xUriFactory->parse(pkgURI), uno::UNO_SET_THROW );
xPkgURI->clearFragment();
// need to know whether the storage is a FileSystemStorage
// XServiceInfo would be better, but it is not implemented
// if ( i_rPkgURI.getLength() && ::utl::UCBContentHelper::IsFolder(i_rPkgURI) )
// if ( pkgURI.getLength() && ::utl::UCBContentHelper::IsFolder(pkgURI) )
if (true) {
xBaseURI.set( xPkgURI, uno::UNO_SET_THROW );
#if 0

View File

@ -159,6 +159,21 @@ void SfxObjectFactory::RegisterViewFactory
SfxViewFactory &rFactory
)
{
#if OSL_DEBUG_LEVEL > 0
{
const String sViewName( rFactory.GetAPIViewName() );
for ( sal_uInt16 i = 0; i < pImpl->aViewFactoryArr.Count(); ++i )
{
if ( !pImpl->aViewFactoryArr[i]->GetAPIViewName().Equals( sViewName ) )
continue;
ByteString sMessage( "SfxObjectFactory::RegisterViewFactory: duplicate view name '" );
sMessage += ByteString( sViewName, RTL_TEXTENCODING_ASCII_US );
sMessage += "'!";
OSL_ENSURE( false, sMessage.GetBuffer() );
break;
}
}
#endif
sal_uInt16 nPos;
for ( nPos = 0;
nPos < pImpl->aViewFactoryArr.Count() &&
@ -467,7 +482,9 @@ SfxViewFactory* SfxObjectFactory::GetViewFactoryByViewName( const String& i_rVie
)
{
SfxViewFactory& rViewFac( GetViewFactory( nViewNo ) );
if ( rViewFac.GetViewName() == i_rViewName )
if ( ( rViewFac.GetAPIViewName() == i_rViewName )
|| ( rViewFac.GetLegacyViewName() == i_rViewName )
)
return &rViewFac;
}
return NULL;

View File

@ -3717,53 +3717,6 @@ void SfxMedium::SetCachedSignatureState_Impl( sal_uInt16 nState )
pImp->m_nSignatureState = nState;
}
//----------------------------------------------------------------
sal_Bool SfxMedium::EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL )
{
sal_Bool bResult = sal_False;
if ( aFirstURL.getLength() && aSecondURL.getLength() )
{
INetURLObject aFirst( aFirstURL );
INetURLObject aSecond( aSecondURL );
if ( aFirst.GetProtocol() != INET_PROT_NOT_VALID && aSecond.GetProtocol() != INET_PROT_NOT_VALID )
{
try
{
::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
if ( !pBroker )
throw uno::RuntimeException();
uno::Reference< ::com::sun::star::ucb::XContentIdentifierFactory > xIdFac
= pBroker->getContentIdentifierFactoryInterface();
if ( !xIdFac.is() )
throw uno::RuntimeException();
uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdFirst
= xIdFac->createContentIdentifier( aFirst.GetMainURL( INetURLObject::NO_DECODE ) );
uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdSecond
= xIdFac->createContentIdentifier( aSecond.GetMainURL( INetURLObject::NO_DECODE ) );
if ( xIdFirst.is() && xIdSecond.is() )
{
uno::Reference< ::com::sun::star::ucb::XContentProvider > xProvider =
pBroker->getContentProviderInterface();
if ( !xProvider.is() )
throw uno::RuntimeException();
bResult = !xProvider->compareContentIds( xIdFirst, xIdSecond );
}
}
catch( uno::Exception& )
{
OSL_ENSURE( sal_False, "Can't compare URL's, treat as different!\n" );
}
}
}
return bResult;
}
BOOL SfxMedium::HasStorage_Impl() const
{
return pImp->xStorage.is();

View File

@ -1919,7 +1919,7 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName,
aStoreArgs[1].Value <<= rTemplateName;
::rtl::OUString aCurrentDocumentURL = rStorable->getLocation();
if( !SfxMedium::EqualURLs( aNewTemplateTargetURL, rStorable->getLocation() ))
if( !::utl::UCBContentHelper::EqualURLs( aNewTemplateTargetURL, rStorable->getLocation() ))
rStorable->storeToURL( aNewTemplateTargetURL, aStoreArgs );
else
rStorable->store();

2
sfx2/source/doc/objmisc.cxx Executable file → Normal file
View File

@ -732,7 +732,7 @@ void SfxObjectShell::FreeSharedFile( const ::rtl::OUString& aTempFileURL )
SetSharedXMLFlag( sal_False );
if ( IsDocShared() && aTempFileURL.getLength()
&& !SfxMedium::EqualURLs( aTempFileURL, GetSharedFileURL() ) )
&& !::utl::UCBContentHelper::EqualURLs( aTempFileURL, GetSharedFileURL() ) )
{
if ( pImp->m_bAllowShareControlFileClean )
{

View File

@ -1344,8 +1344,13 @@ sal_uInt16 SfxObjectShell::ImplGetSignatureState( sal_Bool bScriptingContent )
void SfxObjectShell::ImplSign( sal_Bool bScriptingContent )
{
// Check if it is stored in OASIS format...
if ( GetMedium() && GetMedium()->GetFilter()
&& ( !GetMedium()->GetFilter()->IsOwnFormat() || !GetMedium()->HasStorage_Impl() ) )
if ( GetMedium()
&& GetMedium()->GetFilter()
&& GetMedium()->GetName().Len()
&& ( !GetMedium()->GetFilter()->IsOwnFormat()
|| !GetMedium()->HasStorage_Impl()
)
)
{
// Only OASIS and OOo6.x formats will be handled further
InfoBox( NULL, SfxResId( RID_XMLSEC_INFO_WRONGDOCFORMAT ) ).Execute();

View File

@ -1189,7 +1189,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if ( pMedium
&& pMedium->GetName().CompareIgnoreCaseToAscii( "private:stream", 14 ) != COMPARE_EQUAL
&& rMedium.GetName().CompareIgnoreCaseToAscii( "private:stream", 14 ) != COMPARE_EQUAL
&& SfxMedium::EqualURLs( pMedium->GetName(), rMedium.GetName() ) )
&& ::utl::UCBContentHelper::EqualURLs( pMedium->GetName(), rMedium.GetName() ) )
{
bStoreToSameLocation = sal_True;
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save" ) ) );
@ -1917,7 +1917,25 @@ sal_Bool SfxObjectShell::ConnectTmpStorage_Impl(
bResult = SaveCompleted( xTmpStorage );
if ( bResult )
{
pImp->pBasicManager->setStorage( xTmpStorage );
// Get rid of this workaround after issue i113914 is fixed
try
{
uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImp->xBasicLibraries, uno::UNO_QUERY_THROW );
xBasicLibraries->setRootStorage( xTmpStorage );
}
catch( uno::Exception& )
{}
try
{
uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImp->xDialogLibraries, uno::UNO_QUERY_THROW );
xDialogLibraries->setRootStorage( xTmpStorage );
}
catch( uno::Exception& )
{}
}
}
catch( uno::Exception& )
{}
@ -2063,6 +2081,22 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed )
// TODO/LATER: may be this code will be replaced, but not sure
// Set storage in document library containers
pImp->pBasicManager->setStorage( xStorage );
// Get rid of this workaround after issue i113914 is fixed
try
{
uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImp->xBasicLibraries, uno::UNO_QUERY_THROW );
xBasicLibraries->setRootStorage( xStorage );
}
catch( uno::Exception& )
{}
try
{
uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImp->xDialogLibraries, uno::UNO_QUERY_THROW );
xDialogLibraries->setRootStorage( xStorage );
}
catch( uno::Exception& )
{}
}
else
{

View File

@ -95,6 +95,7 @@
#include <framework/titlehelper.hxx>
#include <comphelper/numberedcollection.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/ucbhelper.hxx>
//________________________________________________________________________________________________________
// includes of my own project
@ -2648,7 +2649,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
sal_Bool bSaved = sal_False;
if ( !bSaveTo && m_pData->m_pObjectShell && sURL.getLength()
&& sURL.compareToAscii( "private:stream", 14 ) != COMPARE_EQUAL
&& SfxMedium::EqualURLs( getLocation(), sURL ) )
&& ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) )
{
// this is the same file URL as the current document location, try to use storeOwn if possible
@ -3811,7 +3812,7 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getAvailableViewCon
Sequence< ::rtl::OUString > aViewNames( nViewFactoryCount );
for ( sal_Int32 nViewNo = 0; nViewNo < nViewFactoryCount; ++nViewNo )
aViewNames[nViewNo] = rDocumentFactory.GetViewFactory( nViewNo ).GetViewName();
aViewNames[nViewNo] = rDocumentFactory.GetViewFactory( nViewNo ).GetAPIViewName();
return aViewNames;
}
@ -3825,7 +3826,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDef
SfxModelGuard aGuard( *this );
const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory();
const ::rtl::OUString sDefaultViewName = rDocumentFactory.GetViewFactory( 0 ).GetViewName();
const ::rtl::OUString sDefaultViewName = rDocumentFactory.GetViewFactory( 0 ).GetAPIViewName();
aGuard.clear();

View File

@ -650,7 +650,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
// ensure the ID of the to-be-created view is in the descriptor, if possible
const sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor );
const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 );
const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetViewName() );
const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetAPIViewName() );
// if the document is created hidden, prevent it from being deleted until it is shown or disposed
impl_lockHiddenDocument( *xDoc, aDescriptor );

View File

@ -118,6 +118,7 @@ using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::lang::DisposedException;
using ::com::sun::star::awt::XWindow;
using ::com::sun::star::frame::XController;
@ -579,7 +580,7 @@ Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (Run
::rtl::OUString sViewName;
if ( nViewNo < rDocFac.GetViewFactoryCount() )
sViewName = rDocFac.GetViewFactory( nViewNo ).GetViewName();
sViewName = rDocFac.GetViewFactory( nViewNo ).GetAPIViewName();
return sViewName;
}
@ -1421,19 +1422,51 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect )
// if so, forward it to the view/shell.
if ( !bHasPluginMode && !bHasJumpMark )
{
// Note that this might not be the ideal place here. Restoring view data should, IMO, be the
// responsibility of the loader, not an implementation detail burried here deep within the controller's
// implementation.
// What I think should be done to replace the below code:
// - change SfxBaseController::restoreViewData to also accept a PropertyValue[] (it currently accepts
// a string only), and forward it to its ViewShell's ReadUserDataSequence
// - change the frame loader so that when a new document is loaded (as opposed to an existing
// document being loaded into a new frame), the model's view data is examine the very same
// way as below, and the proper view data is set via XController::restoreViewData
// - extend SfxViewFrame::SwitchToViewShell_Impl. Currently, it cares for the case where a non-PrintPreview
// view is exchanged, and sets the old view's data at the model. It should also care for the other
// way, were the PrintPreview view is left: in this case, the new view should also be initialized
// with the model's view data
try
{
Reference< XViewDataSupplier > xViewDataSupplier( getModel(), UNO_QUERY );
Reference< XIndexAccess > xViewData;
if ( xViewDataSupplier.is() )
xViewData = xViewDataSupplier->getViewData();
if ( xViewData.is() && xViewData->getCount() > 0 )
Reference< XViewDataSupplier > xViewDataSupplier( getModel(), UNO_QUERY_THROW );
Reference< XIndexAccess > xViewData( xViewDataSupplier->getViewData(), UNO_SET_THROW );
// find the view data item whose ViewId matches the ID of the view we're just connecting to
const SfxObjectFactory& rDocFactory( rDoc.GetFactory() );
const sal_Int32 nCount = xViewData->getCount();
sal_Int32 nViewDataIndex = 0;
for ( sal_Int32 i=0; i<nCount; ++i )
{
const ::comphelper::NamedValueCollection aViewData( xViewData->getByIndex(i) );
::rtl::OUString sViewId( aViewData.getOrDefault( "ViewId", ::rtl::OUString() ) );
if ( sViewId.getLength() == 0 )
continue;
const SfxViewFactory* pViewFactory = rDocFactory.GetViewFactoryByViewName( sViewId );
if ( pViewFactory == NULL )
continue;
if ( pViewFactory->GetOrdinal() == pViewFrame->GetCurViewId() )
{
nViewDataIndex = i;
break;
}
}
if ( nViewDataIndex < nCount )
{
Sequence< PropertyValue > aViewData;
if ( ( xViewData->getByIndex( 0 ) >>= aViewData ) && ( aViewData.getLength() ) )
{
OSL_VERIFY( xViewData->getByIndex( nViewDataIndex ) >>= aViewData );
if ( aViewData.getLength() > 0 )
m_pData->m_pViewShell->ReadUserDataSequence( aViewData, TRUE );
}
}
}
catch( const Exception& )

View File

@ -49,7 +49,7 @@ void SfxViewFactory::InitFactory()
(*fnInit)();
}
String SfxViewFactory::GetViewName() const
String SfxViewFactory::GetLegacyViewName() const
{
::rtl::OUStringBuffer aViewName;
aViewName.appendAscii( "view" );
@ -57,18 +57,27 @@ String SfxViewFactory::GetViewName() const
return aViewName.makeStringAndClear();
}
String SfxViewFactory::GetAPIViewName() const
{
if ( m_sViewName.Len() > 0 )
return m_sViewName;
if ( GetOrdinal() == 0 )
return String::CreateFromAscii( "Default" );
return GetLegacyViewName();
}
// CTOR / DTOR -----------------------------------------------------------
SfxViewFactory::SfxViewFactory( SfxViewCtor fnC, SfxViewInit fnI,
USHORT nOrdinal, const ResId& aDescrResId ):
USHORT nOrdinal, const sal_Char* asciiViewName ):
fnCreate(fnC),
fnInit(fnI),
nOrd(nOrdinal),
aDescription(aDescrResId.GetId(), *aDescrResId.GetResMgr())
m_sViewName( String::CreateFromAscii( asciiViewName ) )
{
aDescription.SetRT(aDescrResId.GetRT());
DBG_CTOR(SfxViewFactory, 0);
// SFX_APP()->RegisterViewFactory_Impl(*this);
}
SfxViewFactory::~SfxViewFactory()

View File

@ -75,6 +75,8 @@
#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/embed/EmbedStates.hpp>
#include <com/sun/star/document/XViewDataSupplier.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <rtl/ustrbuf.hxx>
#include <unotools/localfilehelper.hxx>
@ -96,6 +98,7 @@
#include <comphelper/storagehelper.hxx>
#include <svtools/asynclink.hxx>
#include <svl/sharecontrolfile.hxx>
#include <framework/framelistanalyzer.hxx>
#include <boost/optional.hpp>
@ -106,6 +109,8 @@ using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::lang;
using ::com::sun::star::awt::XWindow;
using ::com::sun::star::beans::PropertyValue;
using ::com::sun::star::document::XViewDataSupplier;
using ::com::sun::star::container::XIndexContainer;
namespace css = ::com::sun::star;
#ifndef GCC
@ -2085,7 +2090,25 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell
{
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW );
xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW );
if ( !i_bHidden )
{
try
{
// if there is a backing component, use it
Reference< XFramesSupplier > xTaskSupplier( xDesktop , css::uno::UNO_QUERY_THROW );
::framework::FrameListAnalyzer aAnalyzer( xTaskSupplier, Reference< XFrame >(), ::framework::FrameListAnalyzer::E_BACKINGCOMPONENT );
if ( aAnalyzer.m_xBackingComponent.is() )
xFrame = aAnalyzer.m_xBackingComponent;
}
catch( uno::Exception& )
{}
}
if ( !xFrame.is() )
xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW );
bOwnFrame = true;
}
@ -2235,6 +2258,72 @@ SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, c
//--------------------------------------------------------------------
void SfxViewFrame::SaveCurrentViewData_Impl( const USHORT i_nNewViewId )
{
SfxViewShell* pCurrentShell = GetViewShell();
ENSURE_OR_RETURN_VOID( pCurrentShell != NULL, "SfxViewFrame::SaveCurrentViewData_Impl: no current view shell -> no current view data!" );
// determine the logical (API) view name
const SfxObjectFactory& rDocFactory( pCurrentShell->GetObjectShell()->GetFactory() );
const sal_uInt16 nCurViewNo = rDocFactory.GetViewNo_Impl( GetCurViewId(), 0 );
const String sCurrentViewName = rDocFactory.GetViewFactory( nCurViewNo ).GetAPIViewName();
const sal_uInt16 nNewViewNo = rDocFactory.GetViewNo_Impl( i_nNewViewId, 0 );
const String sNewViewName = rDocFactory.GetViewFactory( nNewViewNo ).GetAPIViewName();
if ( ( sCurrentViewName.Len() == 0 ) || ( sNewViewName.Len() == 0 ) )
{
// can't say anything about the view, the respective application did not yet migrate its code to
// named view factories => bail out
OSL_ENSURE( false, "SfxViewFrame::SaveCurrentViewData_Impl: views without API names? Shouldn't happen anymore?" );
return;
}
OSL_ENSURE( !sNewViewName.Equals( sCurrentViewName ), "SfxViewFrame::SaveCurrentViewData_Impl: suspicious: new and old view name are identical!" );
// save the view data only when we're moving from a non-print-preview to the print-preview view
if ( !sNewViewName.EqualsAscii( "PrintPreview" ) )
return;
// retrieve the view data from the view
Sequence< PropertyValue > aViewData;
pCurrentShell->WriteUserDataSequence( aViewData );
try
{
// retrieve view data (for *all* views) from the model
const Reference< XController > xController( pCurrentShell->GetController(), UNO_SET_THROW );
const Reference< XViewDataSupplier > xViewDataSupplier( xController->getModel(), UNO_QUERY_THROW );
const Reference< XIndexContainer > xViewData( xViewDataSupplier->getViewData(), UNO_QUERY_THROW );
// look up the one view data item which corresponds to our current view, and remove it
const sal_Int32 nCount = xViewData->getCount();
for ( sal_Int32 i=0; i<nCount; ++i )
{
const ::comphelper::NamedValueCollection aCurViewData( xViewData->getByIndex(i) );
::rtl::OUString sViewId( aCurViewData.getOrDefault( "ViewId", ::rtl::OUString() ) );
if ( sViewId.getLength() == 0 )
continue;
const SfxViewFactory* pViewFactory = rDocFactory.GetViewFactoryByViewName( sViewId );
if ( pViewFactory == NULL )
continue;
if ( pViewFactory->GetOrdinal() == GetCurViewId() )
{
xViewData->removeByIndex(i);
break;
}
}
// then replace it with the most recent view data we just obtained
xViewData->insertByIndex( 0, makeAny( aViewData ) );
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
}
//--------------------------------------------------------------------
sal_Bool SfxViewFrame::SwitchToViewShell_Impl
(
sal_uInt16 nViewIdOrNo, /* > 0
@ -2297,6 +2386,9 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl
SfxObjectFactory& rDocFact = GetObjectShell()->GetFactory();
const USHORT nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : nViewIdOrNo;
// save the view data of the old view, so it can be restored later on (when needed)
SaveCurrentViewData_Impl( nViewId );
// create and load new ViewShell
SfxViewShell* pNewSh = LoadViewIntoFrame_Impl(
*GetObjectShell(),

Some files were not shown because too many files have changed in this diff Show More