summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2010-02-12 16:56:44 +0100
committerJens-Heiner Rechtien <hr@openoffice.org>2010-02-12 16:56:44 +0100
commit96c3511b54e321367157c81af6160c014a77cfc4 (patch)
tree0e36bf0aece07630d566545d1e3174397ec89c81
parent01608c9ce4655250ce8c1c4ee21a126df67ce189 (diff)
changefileheader2: #i10000#: convert files with CR/LF characters to CR only
-rw-r--r--basic/source/classes/sbxmod.cxx2
-rw-r--r--basic/source/comp/dim.cxx102
-rw-r--r--basic/source/comp/scanner.cxx24
-rw-r--r--basic/source/inc/expr.hxx2
-rw-r--r--basic/source/inc/parser.hxx2
-rw-r--r--basic/source/runtime/methods.cxx4
-rw-r--r--basic/source/sbx/sbxexec.cxx4
-rw-r--r--basic/source/sbx/sbxvalue.cxx28
-rw-r--r--connectivity/source/drivers/mozab/MConnection.hxx16
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx414
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx2
-rwxr-xr-xconnectivity/util/makefile.mk12
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.cxx2304
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.hxx488
-rw-r--r--desktop/source/registration/com/sun/star/servicetag/RegistrationData.java1062
-rw-r--r--desktop/source/registration/com/sun/star/servicetag/RegistrationDocument.java880
-rw-r--r--desktop/source/registration/com/sun/star/servicetag/resources/product_registration.xsd732
-rw-r--r--desktop/win32/source/rebase/rebase.cxx322
-rw-r--r--desktop/win32/source/rebase/rebasegui.cxx342
-rw-r--r--fpicker/source/win32/filepicker/SolarMutex.cxx64
-rw-r--r--fpicker/source/win32/filepicker/SolarMutex.hxx14
-rw-r--r--framework/inc/dispatch/startmoduledispatcher.hxx24
-rw-r--r--framework/inc/dispatchcommands.h6
-rw-r--r--framework/inc/helper/mischelper.hxx80
-rw-r--r--framework/inc/stdtypes.h2
-rw-r--r--framework/source/dispatch/startmoduledispatcher.cxx100
-rw-r--r--framework/source/helper/mischelper.cxx88
-rw-r--r--framework/source/helper/statusindicatorfactory.cxx12
-rw-r--r--framework/source/loadenv/loadenv.cxx16
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Accelerators.xcs116
-rw-r--r--sfx2/inc/sfx2/mnumgr.hxx10
-rw-r--r--sfx2/inc/sfx2/tabdlg.hxx4
-rw-r--r--sfx2/sdi/sfx.sdi50
-rw-r--r--sfx2/sdi/sfxitems.sdi178
-rw-r--r--sfx2/source/doc/guisaveas.cxx4
-rw-r--r--shell/inc/internal/basereader.hxx2
-rw-r--r--shell/inc/internal/contentreader.hxx2
-rw-r--r--shell/inc/internal/metainforeader.hxx2
-rw-r--r--shell/inc/internal/types.hxx4
-rw-r--r--shell/inc/internal/zipfile.hxx12
-rw-r--r--shell/source/all/ooofilereader/basereader.cxx16
-rw-r--r--shell/source/all/ooofilereader/contentreader.cxx42
-rw-r--r--shell/source/all/ooofilereader/metainforeader.cxx84
-rw-r--r--shell/source/all/zipfile/makefile.mk2
-rw-r--r--shell/source/all/zipfile/zipfile.cxx32
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx400
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx52
-rw-r--r--svx/inc/svx/editview.hxx2
-rw-r--r--svx/inc/svx/exthelpid.hrc2
-rw-r--r--svx/inc/svx/outliner.hxx2
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx4
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx2
-rwxr-xr-xsvx/inc/svx/shapeproperty.hxx2
-rw-r--r--svx/inc/svx/shapepropertynotifier.hxx2
-rw-r--r--svx/inc/svx/svdoashp.hxx2
-rw-r--r--svx/source/editeng/editview.cxx100
-rw-r--r--svx/source/editeng/impedit2.cxx70
-rw-r--r--svx/source/form/fmPropBrw.cxx36
-rw-r--r--svx/source/form/legacyformcontroller.cxx2
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dpolygon.cxx4
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx14
-rw-r--r--svx/source/svdraw/svdmrkv.cxx6
-rw-r--r--svx/source/svdraw/svdoashp.cxx10
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx108
-rw-r--r--svx/source/unodraw/shapepropertynotifier.cxx2
-rw-r--r--xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx74
-rw-r--r--xmloff/source/chart/SchXMLTools.cxx36
-rw-r--r--xmloff/source/core/nmspmap.cxx22
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx90
-rw-r--r--xmloff/source/draw/ximpstyl.cxx28
71 files changed, 4392 insertions, 4392 deletions
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index fd0798230f..fb52d92c50 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -589,7 +589,7 @@ void ClearUnoObjectsInRTL_Impl( StarBASIC* pBasic )
{
// #67781 Rueckgabewerte der Uno-Methoden loeschen
clearUnoMethods();
- clearUnoServiceCtors();
+ clearUnoServiceCtors();
ClearUnoObjectsInRTL_Impl_Rek( pBasic );
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index e3efd59d68..36bbb8d551 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -238,12 +238,12 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
DefEnum( bPrivate );
return;
}
- else if( eCurTok == DECLARE )
- {
- Next();
- DefDeclare( bPrivate );
- return;
- }
+ else if( eCurTok == DECLARE )
+ {
+ Next();
+ DefDeclare( bPrivate );
+ return;
+ }
}
#ifdef SHARED
@@ -582,42 +582,42 @@ void SbiParser::DefType( BOOL bPrivate )
else
{
SbxProperty *pTypeElem = new SbxProperty (pElem->GetName(),pElem->GetType());
- if( pDim )
- {
- SbxDimArray* pArray = new SbxDimArray( pElem->GetType() );
- if ( pDim->GetSize() )
- {
- // Dimension the target array
-
- for ( short i=0; i<pDim->GetSize();++i )
- {
- INT32 ub = -1;
- INT32 lb = nBase;
- SbiExprNode* pNode = pDim->Get(i)->GetExprNode();
- ub = pNode->GetNumber();
- if ( !pDim->Get( i )->IsBased() ) // each dim is low/up
- {
- if ( ++i >= pDim->GetSize() ) // trouble
- StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
- pNode = pDim->Get(i)->GetExprNode();
- lb = ub;
- ub = pNode->GetNumber();
- }
- else if ( !bCompatible )
- ub += nBase;
- pArray->AddDim32( lb, ub );
- }
- pArray->setHasFixedSize( true );
- }
- else
- pArray->unoAddDim( 0, -1 ); // variant array
- USHORT nSavFlags = pTypeElem->GetFlags();
- // need to reset the FIXED flag
- // when calling PutObject ( because the type will not match Object )
- pTypeElem->ResetFlag( SBX_FIXED );
- pTypeElem->PutObject( pArray );
- pTypeElem->SetFlags( nSavFlags );
- }
+ if( pDim )
+ {
+ SbxDimArray* pArray = new SbxDimArray( pElem->GetType() );
+ if ( pDim->GetSize() )
+ {
+ // Dimension the target array
+
+ for ( short i=0; i<pDim->GetSize();++i )
+ {
+ INT32 ub = -1;
+ INT32 lb = nBase;
+ SbiExprNode* pNode = pDim->Get(i)->GetExprNode();
+ ub = pNode->GetNumber();
+ if ( !pDim->Get( i )->IsBased() ) // each dim is low/up
+ {
+ if ( ++i >= pDim->GetSize() ) // trouble
+ StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
+ pNode = pDim->Get(i)->GetExprNode();
+ lb = ub;
+ ub = pNode->GetNumber();
+ }
+ else if ( !bCompatible )
+ ub += nBase;
+ pArray->AddDim32( lb, ub );
+ }
+ pArray->setHasFixedSize( true );
+ }
+ else
+ pArray->unoAddDim( 0, -1 ); // variant array
+ USHORT nSavFlags = pTypeElem->GetFlags();
+ // need to reset the FIXED flag
+ // when calling PutObject ( because the type will not match Object )
+ pTypeElem->ResetFlag( SBX_FIXED );
+ pTypeElem->PutObject( pArray );
+ pTypeElem->SetFlags( nSavFlags );
+ }
delete pDim;
pTypeMembers->Insert( pTypeElem, pTypeMembers->Count() );
}
@@ -775,7 +775,7 @@ void SbiParser::DefEnum( BOOL bPrivate )
SbiProcDef* SbiParser::ProcDecl( BOOL bDecl )
{
BOOL bFunc = BOOL( eCurTok == FUNCTION );
- BOOL bProp = BOOL( eCurTok == GET || eCurTok == SET || eCurTok == LET );
+ BOOL bProp = BOOL( eCurTok == GET || eCurTok == SET || eCurTok == LET );
if( !TestSymbol() ) return NULL;
String aName( aSym );
SbxDataType eType = eScanType;
@@ -896,7 +896,7 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl )
// if( pDef->GetType() == SbxOBJECT )
// pDef->SetType( SbxVARIANT ),
// Error( SbERR_SYNTAX );
- if( pDef->GetType() == SbxVARIANT && !( bFunc || bProp ) )
+ if( pDef->GetType() == SbxVARIANT && !( bFunc || bProp ) )
pDef->SetType( SbxEMPTY );
return pDef;
}
@@ -905,11 +905,11 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl )
void SbiParser::Declare()
{
- DefDeclare( FALSE );
-}
-
-void SbiParser::DefDeclare( BOOL bPrivate )
-{
+ DefDeclare( FALSE );
+}
+
+void SbiParser::DefDeclare( BOOL bPrivate )
+{
Next();
if( eCurTok != SUB && eCurTok != FUNCTION )
Error( SbERR_UNEXPECTED, eCurTok );
@@ -938,8 +938,8 @@ void SbiParser::DefDeclare( BOOL bPrivate )
else
aPublics.Add( pDef );
- if ( pDef )
- pDef->SetPublic( !bPrivate );
+ if ( pDef )
+ pDef->SetPublic( !bPrivate );
}
}
}
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index d21abaffb8..61ca92108b 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -193,7 +193,7 @@ BOOL SbiScanner::NextSym()
}
// Leerstellen weg:
- while( *pLine && (( *pLine == ' ' ) || ( *pLine == '\t' ) || ( *pLine == '\f' )) )
+ while( *pLine && (( *pLine == ' ' ) || ( *pLine == '\t' ) || ( *pLine == '\f' )) )
pLine++, nCol++, bSpaces = TRUE;
nCol1 = nCol;
@@ -476,17 +476,17 @@ PrevLineCommentLbl:
eoln:
if( nCol && *--pLine == '_' )
{
- pLine = NULL;
- bool bRes = NextSym();
- if( bVBASupportOn && aSym.GetBuffer()[0] == '.' )
- {
- // object _
- // .Method
- // ^^^ <- spaces is legal in MSO VBA
- OSL_TRACE("*** resetting bSpaces***");
- bSpaces = FALSE;
- }
- return bRes;
+ pLine = NULL;
+ bool bRes = NextSym();
+ if( bVBASupportOn && aSym.GetBuffer()[0] == '.' )
+ {
+ // object _
+ // .Method
+ // ^^^ <- spaces is legal in MSO VBA
+ OSL_TRACE("*** resetting bSpaces***");
+ bSpaces = FALSE;
+ }
+ return bRes;
}
else
{
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
index adcc08cf47..712ae8b606 100644
--- a/basic/source/inc/expr.hxx
+++ b/basic/source/inc/expr.hxx
@@ -141,7 +141,7 @@ public:
SbiExprNode* GetRealNode(); // letzter Knoten in x.y.z
short GetDepth(); // Tiefe eines Baumes berechnen
const String& GetString() { return aStrVal; }
- short GetNumber() { return (short)nVal; }
+ short GetNumber() { return (short)nVal; }
SbiExprList* GetParameters() { return aVar.pPar; }
SbiExprListVector* GetMoreParameters() { return aVar.pvMorePar; }
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index 947d52ada9..04c0269388 100644
--- a/basic/source/inc/parser.hxx
+++ b/basic/source/inc/parser.hxx
@@ -63,7 +63,7 @@ class SbiParser : public SbiTokenizer
void StmntBlock( SbiToken ); // Statement-Block abarbeiten
void DefType( BOOL bPrivate ); // Parse type declaration
void DefEnum( BOOL bPrivate ); // Parse enum declaration
- void DefDeclare( BOOL bPrivate );
+ void DefDeclare( BOOL bPrivate );
void EnableCompatibility();
public:
SbxArrayRef rTypeArray; // das Type-Array
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index c7e508a07a..c32abbd1c3 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1783,9 +1783,9 @@ INT16 implGetDateYear( double aDate )
BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
{
- if ( nYear < 30 && SbiRuntime::isVBAEnabled() )
+ if ( nYear < 30 && SbiRuntime::isVBAEnabled() )
nYear += 2000;
- else if ( nYear < 100 )
+ else if ( nYear < 100 )
nYear += 1900;
Date aCurDate( nDay, nMonth, nYear );
if ((nYear < 100 || nYear > 9999) )
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index c2f6eb636b..1ee1090566 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -91,7 +91,7 @@ static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const S
{
rSym = p;
// Dann darf es Buchstaben, Zahlen oder Underlines enthalten
- while( *p && (rCharClass.isAlphaNumeric( *p ) || *p == '_') )
+ while( *p && (rCharClass.isAlphaNumeric( *p ) || *p == '_') )
p++, nLen++;
// BASIC-Standard-Suffixe werden ignoriert
if( *p && (*p == '%' || *p == '&' || *p == '!' || *p == '#' || *p == '$' ) )
@@ -115,7 +115,7 @@ static SbxVariable* QualifiedName
{
// Element einlesen
refVar = Element( pObj, pGbl, &p, t, aCharClass );
- while( refVar.Is() && (*p == '.' || *p == '!') )
+ while( refVar.Is() && (*p == '.' || *p == '!') )
{
// Es folgt noch ein Objektelement. Das aktuelle Element
// muss also ein SBX-Objekt sein oder liefern!
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index d8e91f48fd..34ca872679 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1570,9 +1570,9 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
{
aL.eType = aR.eType = SbxDOUBLE;
//if( Get( aL ) && rOp.Get( aR ) )
- bool bGetL = Get( aL );
- bool bGetR = rOp.Get( aR );
- if( bGetL && bGetR )
+ bool bGetL = Get( aL );
+ bool bGetR = rOp.Get( aR );
+ if( bGetL && bGetR )
switch( eOp )
{
case SbxEQ:
@@ -1590,17 +1590,17 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
default:
SetError( SbxERR_NOTIMP );
}
- // at least one value was got
- // if this is VBA then a conversion error for one
- // side will yield a false result of an equality test
- else if ( bGetR || bGetL )
- {
- if ( bVBAInterop && eOp == SbxEQ && GetError() == SbxERR_CONVERSION )
- {
- ResetError();
- bRes = FALSE;
- }
- }
+ // at least one value was got
+ // if this is VBA then a conversion error for one
+ // side will yield a false result of an equality test
+ else if ( bGetR || bGetL )
+ {
+ if ( bVBAInterop && eOp == SbxEQ && GetError() == SbxERR_CONVERSION )
+ {
+ ResetError();
+ bRes = FALSE;
+ }
+ }
}
}
if( eOld != SbxERR_OK )
diff --git a/connectivity/source/drivers/mozab/MConnection.hxx b/connectivity/source/drivers/mozab/MConnection.hxx
index cb0c28d943..494c7798ff 100644
--- a/connectivity/source/drivers/mozab/MConnection.hxx
+++ b/connectivity/source/drivers/mozab/MConnection.hxx
@@ -27,18 +27,18 @@
#ifndef CONNECTIVITY_SCONNECTION_HXX
#define CONNECTIVITY_SCONNECTION_HXX
-#include "connectivity/CommonTools.hxx"
-
-#include "MCatalog.hxx"
+#include "connectivity/CommonTools.hxx"
+
+#include "MCatalog.hxx"
#include "MColumnAlias.hxx"
-#include "OSubComponent.hxx"
-#include "TConnection.hxx"
+#include "OSubComponent.hxx"
+#include "TConnection.hxx"
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/mozilla/MozillaProductType.hpp>
#include <com/sun/star/sdbc/SQLWarning.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-
+
#include <cppuhelper/weakref.hxx>
#include <memory>
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
index 05b2bbd973..da7944910a 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
@@ -23,7 +23,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
+
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
@@ -89,44 +89,44 @@ namespace connectivity { namespace mozab {
CardPropertySetter PropSetter;
};
const MapEntry aEntries[] = {
- { "FirstName", "givenname", DEF_CARD_ACCESS( FirstName ) },
- { "LastName", "sn,surnname", DEF_CARD_ACCESS( LastName ) },
- { "DisplayName", "cn,commonname,displayname", DEF_CARD_ACCESS( DisplayName ) },
- { "NickName", "xmozillanickname", DEF_CARD_ACCESS( NickName ) },
- { "PrimaryEmail", "mail", DEF_CARD_ACCESS( PrimaryEmail ) },
- { "SecondEmail", "xmozillasecondemail", DEF_CARD_ACCESS( SecondEmail ) },
- { "WorkPhone", "telephonenumber", DEF_CARD_ACCESS( WorkPhone ) },
- { "HomePhone", "homephone", DEF_CARD_ACCESS( HomePhone ) },
- { "FaxNumber", "fax,facsimiletelephonenumber", DEF_CARD_ACCESS( FaxNumber ) },
- { "PagerNumber", "pager,pagerphone", DEF_CARD_ACCESS( PagerNumber ) },
- { "CellularNumber", "mobile,cellphone,carphone", DEF_CARD_ACCESS( CellularNumber ) },
- { "HomeAddress", "homepostaladdress,mozillaHomeStreet", DEF_CARD_ACCESS( HomeAddress ) },
- { "HomeAddress2", "mozillaHomeStreet2", DEF_CARD_ACCESS( HomeAddress2 ) },
- { "HomeCity", "homelocality,mozillaHomeLocalityName", DEF_CARD_ACCESS( HomeCity ) },
- { "HomeState", "homeregion,mozillaHomeState", DEF_CARD_ACCESS( HomeState ) },
- { "HomeZipCode", "homepostalcode,mozillaHomePostalCode", DEF_CARD_ACCESS( HomeZipCode ) },
- { "HomeCountry", "homecountryname,mozillaHomeCountryName", DEF_CARD_ACCESS( HomeCountry ) },
- { "WorkAddress", "postofficebox,streetaddress,streetaddress1", DEF_CARD_ACCESS( WorkAddress ) },
- { "WorkAddress2", "streetaddress2", DEF_CARD_ACCESS( WorkAddress2 ) },
- { "WorkCity", "l,locality", DEF_CARD_ACCESS( WorkCity ) },
- { "WorkState", "st,region", DEF_CARD_ACCESS( WorkState ) },
- { "WorkZipCode", "postalcode,zip", DEF_CARD_ACCESS( WorkZipCode ) },
- { "WorkCountry", "countryname", DEF_CARD_ACCESS( WorkCountry ) },
- { "JobTitle", "title", DEF_CARD_ACCESS( JobTitle ) },
- { "Department", "ou,orgunit,department,departmentnumber", DEF_CARD_ACCESS( Department ) },
- { "Company", "o,company", DEF_CARD_ACCESS( Company ) },
- { "WebPage1", "workurl", DEF_CARD_ACCESS( WebPage1 ) },
- { "WebPage2", "homeurl", DEF_CARD_ACCESS( WebPage2 ) },
- { "BirthYear", "birthyear", DEF_CARD_ACCESS( BirthYear ) },
- { "BirthMonth", "birthmonth", DEF_CARD_ACCESS( BirthMonth ) },
- { "BirthYear", "birthday", DEF_CARD_ACCESS( BirthDay ) },
- { "Custom1", "custom1", DEF_CARD_ACCESS( Custom1 ) },
- { "Custom2", "custom2", DEF_CARD_ACCESS( Custom2 ) },
- { "Custom3", "custom3", DEF_CARD_ACCESS( Custom3 ) },
- { "Custom4", "custom4", DEF_CARD_ACCESS( Custom4 ) },
- { "Notes", "notes,description", DEF_CARD_ACCESS( Notes ) },
- { "PreferMailFormat", "xmozillausehtmlmail", NULL, NULL },
- { NULL, NULL, NULL, NULL }
+ { "FirstName", "givenname", DEF_CARD_ACCESS( FirstName ) },
+ { "LastName", "sn,surnname", DEF_CARD_ACCESS( LastName ) },
+ { "DisplayName", "cn,commonname,displayname", DEF_CARD_ACCESS( DisplayName ) },
+ { "NickName", "xmozillanickname", DEF_CARD_ACCESS( NickName ) },
+ { "PrimaryEmail", "mail", DEF_CARD_ACCESS( PrimaryEmail ) },
+ { "SecondEmail", "xmozillasecondemail", DEF_CARD_ACCESS( SecondEmail ) },
+ { "WorkPhone", "telephonenumber", DEF_CARD_ACCESS( WorkPhone ) },
+ { "HomePhone", "homephone", DEF_CARD_ACCESS( HomePhone ) },
+ { "FaxNumber", "fax,facsimiletelephonenumber", DEF_CARD_ACCESS( FaxNumber ) },
+ { "PagerNumber", "pager,pagerphone", DEF_CARD_ACCESS( PagerNumber ) },
+ { "CellularNumber", "mobile,cellphone,carphone", DEF_CARD_ACCESS( CellularNumber ) },
+ { "HomeAddress", "homepostaladdress,mozillaHomeStreet", DEF_CARD_ACCESS( HomeAddress ) },
+ { "HomeAddress2", "mozillaHomeStreet2", DEF_CARD_ACCESS( HomeAddress2 ) },
+ { "HomeCity", "homelocality,mozillaHomeLocalityName", DEF_CARD_ACCESS( HomeCity ) },
+ { "HomeState", "homeregion,mozillaHomeState", DEF_CARD_ACCESS( HomeState ) },
+ { "HomeZipCode", "homepostalcode,mozillaHomePostalCode", DEF_CARD_ACCESS( HomeZipCode ) },
+ { "HomeCountry", "homecountryname,mozillaHomeCountryName", DEF_CARD_ACCESS( HomeCountry ) },
+ { "WorkAddress", "postofficebox,streetaddress,streetaddress1", DEF_CARD_ACCESS( WorkAddress ) },
+ { "WorkAddress2", "streetaddress2", DEF_CARD_ACCESS( WorkAddress2 ) },
+ { "WorkCity", "l,locality", DEF_CARD_ACCESS( WorkCity ) },
+ { "WorkState", "st,region", DEF_CARD_ACCESS( WorkState ) },
+ { "WorkZipCode", "postalcode,zip", DEF_CARD_ACCESS( WorkZipCode ) },
+ { "WorkCountry", "countryname", DEF_CARD_ACCESS( WorkCountry ) },
+ { "JobTitle", "title", DEF_CARD_ACCESS( JobTitle ) },
+ { "Department", "ou,orgunit,department,departmentnumber", DEF_CARD_ACCESS( Department ) },
+ { "Company", "o,company", DEF_CARD_ACCESS( Company ) },
+ { "WebPage1", "workurl", DEF_CARD_ACCESS( WebPage1 ) },
+ { "WebPage2", "homeurl", DEF_CARD_ACCESS( WebPage2 ) },
+ { "BirthYear", "birthyear", DEF_CARD_ACCESS( BirthYear ) },
+ { "BirthMonth", "birthmonth", DEF_CARD_ACCESS( BirthMonth ) },
+ { "BirthYear", "birthday", DEF_CARD_ACCESS( BirthDay ) },
+ { "Custom1", "custom1", DEF_CARD_ACCESS( Custom1 ) },
+ { "Custom2", "custom2", DEF_CARD_ACCESS( Custom2 ) },
+ { "Custom3", "custom3", DEF_CARD_ACCESS( Custom3 ) },
+ { "Custom4", "custom4", DEF_CARD_ACCESS( Custom4 ) },
+ { "Notes", "notes,description", DEF_CARD_ACCESS( Notes ) },
+ { "PreferMailFormat", "xmozillausehtmlmail", NULL, NULL },
+ { NULL, NULL, NULL, NULL }
};
const MapEntry* loop = aEntries;
while ( loop->pAsciiPropertyName )
@@ -138,8 +138,8 @@ namespace connectivity { namespace mozab {
}
return aMap;
}
- }
-
+ }
+
//====================================================================
//= AttributeMap_Data
//====================================================================
@@ -165,120 +165,120 @@ namespace connectivity { namespace mozab {
NS_IMPL_THREADSAFE_ISUPPORTS1( MLdapAttributeMap, nsIAbLDAPAttributeMap )
// -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetAttributeList(const nsACString & aProperty, nsACString & _retval)
- {
- ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
-
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
- MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
-
- if ( pos == rPropertyMap.end() )
- {
- _retval.SetIsVoid( PR_TRUE );
- }
- else
- {
- MTypeConverter::asciiToNsACString( pos->second.pLDAPAttributeList, _retval );
- }
-
- return NS_OK;
- }
-
+ NS_IMETHODIMP MLdapAttributeMap::GetAttributeList(const nsACString & aProperty, nsACString & _retval)
+ {
+ ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
+
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+ MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
+
+ if ( pos == rPropertyMap.end() )
+ {
+ _retval.SetIsVoid( PR_TRUE );
+ }
+ else
+ {
+ MTypeConverter::asciiToNsACString( pos->second.pLDAPAttributeList, _retval );
+ }
+
+ return NS_OK;
+ }
+
// -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetAttributes(const nsACString & aProperty, PRUint32* aCount, char*** aAttrs)
- {
- OSL_ENSURE( false, "MLdapAttributeMap::GetAttributes: not implemented!" );
- (void)aProperty;
- (void)aCount;
- (void)aAttrs;
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
+ NS_IMETHODIMP MLdapAttributeMap::GetAttributes(const nsACString & aProperty, PRUint32* aCount, char*** aAttrs)
+ {
+ OSL_ENSURE( false, "MLdapAttributeMap::GetAttributes: not implemented!" );
+ (void)aProperty;
+ (void)aCount;
+ (void)aAttrs;
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
// -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetFirstAttribute(const nsACString & aProperty, nsACString & _retval)
- {
- ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
-
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
- MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
-
- if ( pos == rPropertyMap.end() )
- {
- _retval.SetIsVoid( PR_TRUE );
- }
- else
- {
- sal_Int32 tokenPos(0);
- ::rtl::OString sAttributeList( pos->second.pLDAPAttributeList );
- MTypeConverter::asciiToNsACString( sAttributeList.getToken( 0, ',', tokenPos ).getStr(), _retval );
- }
-
- return NS_OK;
- }
-
+ NS_IMETHODIMP MLdapAttributeMap::GetFirstAttribute(const nsACString & aProperty, nsACString & _retval)
+ {
+ ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
+
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+ MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
+
+ if ( pos == rPropertyMap.end() )
+ {
+ _retval.SetIsVoid( PR_TRUE );
+ }
+ else
+ {
+ sal_Int32 tokenPos(0);
+ ::rtl::OString sAttributeList( pos->second.pLDAPAttributeList );
+ MTypeConverter::asciiToNsACString( sAttributeList.getToken( 0, ',', tokenPos ).getStr(), _retval );
+ }
+
+ return NS_OK;
+ }
+
// -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::SetAttributeList(const nsACString & aProperty, const nsACString & aAttributeList, PRBool allowInconsistencies)
- {
- OSL_ENSURE( false, "MLdapAttributeMap::SetAttributeList: not implemented!" );
- (void)aProperty;
- (void)aAttributeList;
- (void)allowInconsistencies;
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
+ NS_IMETHODIMP MLdapAttributeMap::SetAttributeList(const nsACString & aProperty, const nsACString & aAttributeList, PRBool allowInconsistencies)
+ {
+ OSL_ENSURE( false, "MLdapAttributeMap::SetAttributeList: not implemented!" );
+ (void)aProperty;
+ (void)aAttributeList;
+ (void)allowInconsistencies;
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
// -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetProperty(const nsACString & aAttribute, nsACString & _retval)
- {
- OSL_ENSURE( false, "MLdapAttributeMap::GetProperty: not implemented!" );
- (void)aAttribute;
- (void)_retval;
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
+ NS_IMETHODIMP MLdapAttributeMap::GetProperty(const nsACString & aAttribute, nsACString & _retval)
+ {
+ OSL_ENSURE( false, "MLdapAttributeMap::GetProperty: not implemented!" );
+ (void)aAttribute;
+ (void)_retval;
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
// -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetAllCardAttributes(nsACString & _retval)
- {
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
-
- ::rtl::OStringBuffer aAllAttributes;
- for ( MapPropertiesToAttributes::const_iterator loop = rPropertyMap.begin();
- loop != rPropertyMap.end();
- ++loop
- )
- {
- aAllAttributes.append( loop->second.pLDAPAttributeList );
- if ( loop != rPropertyMap.end() )
- aAllAttributes.append( ',' );
- }
-
- MTypeConverter::asciiToNsACString( aAllAttributes.getStr(), _retval );
- return NS_OK;
- }
-
+ NS_IMETHODIMP MLdapAttributeMap::GetAllCardAttributes(nsACString & _retval)
+ {
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+
+ ::rtl::OStringBuffer aAllAttributes;
+ for ( MapPropertiesToAttributes::const_iterator loop = rPropertyMap.begin();
+ loop != rPropertyMap.end();
+ ++loop
+ )
+ {
+ aAllAttributes.append( loop->second.pLDAPAttributeList );
+ if ( loop != rPropertyMap.end() )
+ aAllAttributes.append( ',' );
+ }
+
+ MTypeConverter::asciiToNsACString( aAllAttributes.getStr(), _retval );
+ return NS_OK;
+ }
+
// -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::CheckState(void)
- {
- // we do not allow modifying the map, so we're always in a valid state
- return NS_OK;
- }
-
+ NS_IMETHODIMP MLdapAttributeMap::CheckState(void)
+ {
+ // we do not allow modifying the map, so we're always in a valid state
+ return NS_OK;
+ }
+
// -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::SetFromPrefs(const nsACString & aPrefBranchName)
- {
- OSL_ENSURE( false, "MLdapAttributeMap::SetFromPrefs: not implemented!" );
- (void)aPrefBranchName;
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
+ NS_IMETHODIMP MLdapAttributeMap::SetFromPrefs(const nsACString & aPrefBranchName)
+ {
+ OSL_ENSURE( false, "MLdapAttributeMap::SetFromPrefs: not implemented!" );
+ (void)aPrefBranchName;
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
// -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::SetCardPropertiesFromLDAPMessage(nsILDAPMessage* aMessage, nsIAbCard* aCard)
- {
- NS_ENSURE_ARG_POINTER( aMessage );
- NS_ENSURE_ARG_POINTER( aCard );
-
- // in case that's not present in the LDAP message: set the "preferred mail format" to "none"
- aCard->SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
-
+ NS_IMETHODIMP MLdapAttributeMap::SetCardPropertiesFromLDAPMessage(nsILDAPMessage* aMessage, nsIAbCard* aCard)
+ {
+ NS_ENSURE_ARG_POINTER( aMessage );
+ NS_ENSURE_ARG_POINTER( aCard );
+
+ // in case that's not present in the LDAP message: set the "preferred mail format" to "none"
+ aCard->SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
+
const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
prop != rPropertyMap.end();
@@ -293,34 +293,34 @@ namespace connectivity { namespace mozab {
while ( tokenPos != -1 )
{
sAttribute = sAttributeList.getToken( 0, ',', tokenPos );
-
- // retrieve the values for the current attribute
- PRUint32 valueCount = 0;
- PRUnichar** values = NULL;
- nsresult rv = aMessage->GetValues( sAttribute.getStr(), &valueCount, &values );
- if ( NS_FAILED( rv ) )
- // try the next attribute
- continue;
-
- if ( valueCount )
- {
- CardPropertySetter propSetter = prop->second.PropSetter;
- OSL_ENSURE( propSetter,
- "MLdapAttributeMap::SetCardPropertiesFromLDAPMessage: "
- "unexpected: could retrieve an attribute value, but have no setter for it!" );
- if ( propSetter )
- {
- (aCard->*propSetter)( values[0] );
- }
-
- // we're done with this property - no need to handle the remaining attributes which
- // map to it
- break;
- }
+
+ // retrieve the values for the current attribute
+ PRUint32 valueCount = 0;
+ PRUnichar** values = NULL;
+ nsresult rv = aMessage->GetValues( sAttribute.getStr(), &valueCount, &values );
+ if ( NS_FAILED( rv ) )
+ // try the next attribute
+ continue;
+
+ if ( valueCount )
+ {
+ CardPropertySetter propSetter = prop->second.PropSetter;
+ OSL_ENSURE( propSetter,
+ "MLdapAttributeMap::SetCardPropertiesFromLDAPMessage: "
+ "unexpected: could retrieve an attribute value, but have no setter for it!" );
+ if ( propSetter )
+ {
+ (aCard->*propSetter)( values[0] );
+ }
+
+ // we're done with this property - no need to handle the remaining attributes which
+ // map to it
+ break;
+ }
}
- }
- return NS_OK;
- }
+ }
+ return NS_OK;
+ }
// -------------------------------------------------------------------
namespace
@@ -359,10 +359,10 @@ namespace connectivity { namespace mozab {
// -------------------------------------------------------------------
void MLdapAttributeMap::fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result )
{
- _card.SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
-
- ::rtl::OUString resultValue;
-
+ _card.SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
+
+ ::rtl::OUString resultValue;
+
const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
prop != rPropertyMap.end();
@@ -371,16 +371,16 @@ namespace connectivity { namespace mozab {
{
resultValue = _result.getValue( prop->first );
- CardPropertySetter propSetter = prop->second.PropSetter;
- if ( propSetter )
- {
- // PRUnichar != sal_Unicode in mingw
- (_card.*propSetter)( reinterpret_cast_mingw_only<const PRUnichar *>(resultValue.getStr()) );
- }
- else
- {
- if ( prop->first.equals( "PreferMailFormat" ) )
- {
+ CardPropertySetter propSetter = prop->second.PropSetter;
+ if ( propSetter )
+ {
+ // PRUnichar != sal_Unicode in mingw
+ (_card.*propSetter)( reinterpret_cast_mingw_only<const PRUnichar *>(resultValue.getStr()) );
+ }
+ else
+ {
+ if ( prop->first.equals( "PreferMailFormat" ) )
+ {
unsigned int format = nsIAbPreferMailFormat::unknown;
const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
while ( pMailFormatType->description )
@@ -393,10 +393,10 @@ namespace connectivity { namespace mozab {
++pMailFormatType;
}
_card.SetPreferMailFormat(format);
- }
- else
- OSL_ENSURE( false, "MLdapAttributeMap::fillCardFromResult: unexpected property without default setters!" );
- }
+ }
+ else
+ OSL_ENSURE( false, "MLdapAttributeMap::fillCardFromResult: unexpected property without default setters!" );
+ }
}
}
@@ -412,18 +412,18 @@ namespace connectivity { namespace mozab {
++prop
)
{
- CardPropertyGetter propGetter = prop->second.PropGetter;
- if ( propGetter )
- {
- (_card.*propGetter)( getter_Copies( value ) );
-
+ CardPropertyGetter propGetter = prop->second.PropGetter;
+ if ( propGetter )
+ {
+ (_card.*propGetter)( getter_Copies( value ) );
+
nsAutoString temp( value );
MTypeConverter::nsStringToOUString( temp, resultValue );
- }
- else
- {
- if ( prop->first.equals( "PreferMailFormat" ) )
- {
+ }
+ else
+ {
+ if ( prop->first.equals( "PreferMailFormat" ) )
+ {
unsigned int format = nsIAbPreferMailFormat::unknown;
_card.GetPreferMailFormat( &format );
const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
@@ -436,11 +436,11 @@ namespace connectivity { namespace mozab {
}
++pMailFormatType;
}
- }
- else
- OSL_ENSURE( false, "MLdapAttributeMap::fillResultFromCard: unexpected property without default getters!" );
- }
-
+ }
+ else
+ OSL_ENSURE( false, "MLdapAttributeMap::fillResultFromCard: unexpected property without default getters!" );
+ }
+
_result.insert( prop->first, resultValue );
}
}
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
index f46d00d5d9..ddada336ed 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
@@ -23,7 +23,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
+
#ifndef CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
#define CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
diff --git a/connectivity/util/makefile.mk b/connectivity/util/makefile.mk
index 06e3f704c5..93aaa5c4a7 100755
--- a/connectivity/util/makefile.mk
+++ b/connectivity/util/makefile.mk
@@ -54,12 +54,12 @@ PACKLANG_IN :=
PACKLANG_PARAM := --stringparam
PACKLANG_XSL :=
-$(REALFILTERPACKAGES_FILTERS_UI_LANGPACKS) :
- @echo ===================================================================
- @echo Building language package for driver $(@:b:s/Filter_//)
- @echo ===================================================================
- +-$(MKDIRHIER) $(@:d)
- $(PACKLANG) $(PACKLANG_PARAM) lang $(@:d:d:d:d:d:d:d:d:d:d:b) $(PACKLANG_XSL) langfilter.xsl $(PACKLANG_IN) $(DIR_LANG_SOURCE)$/org$/openoffice$/Office$/DataAccess$/$(@:f) > $@
+$(REALFILTERPACKAGES_FILTERS_UI_LANGPACKS) :
+ @echo ===================================================================
+ @echo Building language package for driver $(@:b:s/Filter_//)
+ @echo ===================================================================
+ +-$(MKDIRHIER) $(@:d)
+ $(PACKLANG) $(PACKLANG_PARAM) lang $(@:d:d:d:d:d:d:d:d:d:d:b) $(PACKLANG_XSL) langfilter.xsl $(PACKLANG_IN) $(DIR_LANG_SOURCE)$/org$/openoffice$/Office$/DataAccess$/$(@:f) > $@
$(MISC)$/$(TARGET)_delzip :
-$(RM) $(BIN)$/fcfg_drivers_{$(alllangiso)}.zip
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 096b7ec3bc..2852e67e7d 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -1,5 +1,5 @@
-/*************************************************************************
- *
+/*************************************************************************
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -23,1153 +23,1153 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_desktop.hxx"
-
-#include "svtools/controldims.hrc"
-
-#include "dp_gui.h"
-#include "dp_gui_extlistbox.hxx"
-#include "dp_gui_theextmgr.hxx"
-#include "dp_gui_dialog2.hxx"
-#include "dp_dependencies.hxx"
-
-#include "comphelper/processfactory.hxx"
-#include "com/sun/star/i18n/CollatorOptions.hpp"
-#include "com/sun/star/deployment/DependencyException.hpp"
-#include "com/sun/star/deployment/DeploymentException.hpp"
-
-
-#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
-
-using namespace ::com::sun::star;
-
-namespace dp_gui {
-
-//------------------------------------------------------------------------------
-// struct Entry_Impl
-//------------------------------------------------------------------------------
-Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
- PackageState eState ) :
- m_bActive( false ),
- m_bLocked( false ),
- m_bHasOptions( false ),
- m_bShared( false ),
- m_bNew( false ),
- m_bChecked( false ),
- m_bMissingDeps( false ),
- m_eState( eState ),
- m_pPublisher( NULL ),
- m_xPackage( xPackage ),
- m_xPackageManager( xPackageManager )
-{
- m_sTitle = xPackage->getDisplayName();
- m_sVersion = xPackage->getVersion();
- m_sDescription = xPackage->getDescription();
-
- beans::StringPair aInfo( m_xPackage->getPublisherInfo() );
- m_sPublisher = aInfo.First;
- m_sPublisherURL = aInfo.Second;
-
- // get the icons for the package if there are any
- uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false );
- if ( xGraphic.is() )
- m_aIcon = Image( xGraphic );
-
- xGraphic = xPackage->getIcon( true );
- if ( xGraphic.is() )
- m_aIconHC = Image( xGraphic );
- else
- m_aIconHC = m_aIcon;
-
- m_bLocked = m_xPackageManager->isReadOnly();
-
- if ( eState == AMBIGUOUS )
- m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
- else if ( eState == NOT_REGISTERED )
- checkDependencies();
-}
-
-//------------------------------------------------------------------------------
-Entry_Impl::~Entry_Impl()
-{}
-
-//------------------------------------------------------------------------------
-StringCompare Entry_Impl::CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const
-{
- StringCompare eCompare = (StringCompare) pCollator->compareString( m_sTitle, pEntry->m_sTitle );
- if ( eCompare == COMPARE_EQUAL )
- {
- eCompare = m_sVersion.CompareTo( pEntry->m_sVersion );
- if ( eCompare == COMPARE_EQUAL )
- {
- if ( m_xPackageManager != pEntry->m_xPackageManager )
- {
- sal_Int32 nCompare = m_xPackageManager->getContext().compareTo( pEntry->m_xPackageManager->getContext() );
- if ( nCompare < 0 )
- eCompare = COMPARE_LESS;
- else if ( nCompare > 0 )
- eCompare = COMPARE_GREATER;
- }
- }
- }
- return eCompare;
-}
-
-//------------------------------------------------------------------------------
-void Entry_Impl::checkDependencies()
-{
- try {
- m_xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
- }
- catch ( deployment::DeploymentException &e )
- {
- deployment::DependencyException depExc;
- if ( e.Cause >>= depExc )
- {
- rtl::OUString aMissingDep( DialogHelper::getResourceString( RID_STR_ERROR_MISSING_DEPENDENCIES ) );
- for ( sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i )
- {
- aMissingDep += OUSTR("\n");
- aMissingDep += dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]);
- }
- aMissingDep += OUSTR("\n");
- m_sErrorText = aMissingDep;
- m_bMissingDeps = true;
- }
- }
-}
-//------------------------------------------------------------------------------
-// ExtensionRemovedListener
-//------------------------------------------------------------------------------
-void ExtensionRemovedListener::disposing( lang::EventObject const & rEvt )
- throw ( uno::RuntimeException )
-{
- uno::Reference< deployment::XPackage > xPackage( rEvt.Source, uno::UNO_QUERY );
-
- if ( xPackage.is() )
- {
- m_pParent->removeEntry( xPackage );
- }
-}
-
-//------------------------------------------------------------------------------
-ExtensionRemovedListener::~ExtensionRemovedListener()
-{
-}
-
-//------------------------------------------------------------------------------
-// ExtensionBox_Impl
-//------------------------------------------------------------------------------
-ExtensionBox_Impl::ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager ) :
- IExtensionListBox( pParent, WB_BORDER | WB_TABSTOP | WB_CHILDDLGCTRL ),
- m_bHasScrollBar( false ),
- m_bHasActive( false ),
- m_bNeedsRecalc( true ),
- m_bHasNew( false ),
- m_bInCheckMode( false ),
- m_bAdjustActive( false ),
- m_bInDelete( false ),
- m_nActive( 0 ),
- m_nTopIndex( 0 ),
- m_nActiveHeight( 0 ),
- m_nExtraHeight( 2 ),
- m_aLockedImage( DialogHelper::getResId( RID_IMG_LOCKED ) ),
- m_aLockedImageHC( DialogHelper::getResId( RID_IMG_LOCKED_HC ) ),
- m_aWarningImage( DialogHelper::getResId( RID_IMG_WARNING ) ),
- m_aWarningImageHC( DialogHelper::getResId( RID_IMG_WARNING_HC ) ),
- m_aDefaultImage( DialogHelper::getResId( RID_IMG_EXTENSION ) ),
- m_aDefaultImageHC( DialogHelper::getResId( RID_IMG_EXTENSION_HC ) ),
- m_pScrollBar( NULL ),
- m_pManager( pManager )
-{
- SetHelpId( HID_EXTENSION_MANAGER_LISTBOX );
-
- m_pScrollBar = new ScrollBar( this, WB_VERT );
- m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) );
- m_pScrollBar->EnableDrag();
-
- SetPaintTransparent( true );
- SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) );
- long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
- long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
- if ( nIconHeight < nTitleHeight )
- m_nStdHeight = nTitleHeight;
- else
- m_nStdHeight = nIconHeight;
- m_nStdHeight += GetTextHeight() + TOP_OFFSET;
-
- nIconHeight = ICON_HEIGHT + 2*TOP_OFFSET + 1;
- if ( m_nStdHeight < nIconHeight )
- m_nStdHeight = nIconHeight;
-
- m_nActiveHeight = m_nStdHeight;
-
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( IsControlBackground() )
- SetBackground( GetControlBackground() );
- else
- SetBackground( rStyleSettings.GetFieldColor() );
-
- m_xRemoveListener = new ExtensionRemovedListener( this );
-
- m_pLocale = new lang::Locale( Application::GetSettings().GetLocale() );
- m_pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() );
- m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
-
- Show();
-}
-
-//------------------------------------------------------------------------------
-ExtensionBox_Impl::~ExtensionBox_Impl()
-{
- if ( ! m_bInDelete )
- DeleteRemoved();
-
- m_bInDelete = true;
-
- typedef std::vector< TEntry_Impl >::iterator ITER;
-
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- if ( (*iIndex)->m_pPublisher )
- {
- delete (*iIndex)->m_pPublisher;
- (*iIndex)->m_pPublisher = NULL;
- }
- (*iIndex)->m_xPackage->removeEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
- }
-
- m_vEntries.clear();
-
- delete m_pScrollBar;
-
- m_xRemoveListener.clear();
-
- delete m_pLocale;
- delete m_pCollator;
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 ExtensionBox_Impl::getItemCount() const
-{
- return static_cast< sal_Int32 >( m_vEntries.size() );
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 ExtensionBox_Impl::getSelIndex() const
-{
- if ( m_bHasActive )
- {
- OSL_ASSERT( m_nActive >= -1);
- return static_cast< sal_Int32 >( m_nActive );
- }
- else
- return static_cast< sal_Int32 >( EXTENSION_LISTBOX_ENTRY_NOTFOUND );
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::checkIndex( sal_Int32 nIndex ) const
-{
- if ( nIndex < 0 )
- throw lang::IllegalArgumentException( OUSTR("The list index starts with 0"),0, 0 );
- if ( static_cast< sal_uInt32 >( nIndex ) >= m_vEntries.size())
- throw lang::IllegalArgumentException( OUSTR("There is no element at the provided position."
- "The position exceeds the number of available list entries"),0, 0 );
-}
-
-//------------------------------------------------------------------------------
-rtl::OUString ExtensionBox_Impl::getItemName( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sTitle;
-}
-
-//------------------------------------------------------------------------------
-rtl::OUString ExtensionBox_Impl::getItemVersion( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sVersion;
-}
-
-//------------------------------------------------------------------------------
-rtl::OUString ExtensionBox_Impl::getItemDescription( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sDescription;
-}
-
-//------------------------------------------------------------------------------
-rtl::OUString ExtensionBox_Impl::getItemPublisher( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sPublisher;
-}
-
-//------------------------------------------------------------------------------
-rtl::OUString ExtensionBox_Impl::getItemPublisherLink( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sPublisherURL;
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::select( sal_Int32 nIndex )
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- selectEntry( nIndex );
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::select( const rtl::OUString & sName )
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- typedef ::std::vector< TEntry_Impl >::const_iterator It;
-
- for ( It iIter = m_vEntries.begin(); iIter < m_vEntries.end(); iIter++ )
- {
- if ( sName.equals( (*iIter)->m_sTitle ) )
- {
- long nPos = iIter - m_vEntries.begin();
- selectEntry( nPos );
- break;
- }
- }
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-// Title + description
-void ExtensionBox_Impl::CalcActiveHeight( const long nPos )
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
-
- // get title height
- long aTextHeight;
- long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
- long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
- if ( nIconHeight < nTitleHeight )
- aTextHeight = nTitleHeight;
- else
- aTextHeight = nIconHeight;
-
- // calc description height
- Size aSize = GetOutputSizePixel();
- if ( m_bHasScrollBar )
- aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
-
- aSize.Width() -= ICON_OFFSET;
- aSize.Height() = 10000;
-
- rtl::OUString aText( m_vEntries[ nPos ]->m_sErrorText );
- aText += m_vEntries[ nPos ]->m_sDescription;
-
- Rectangle aRect = GetTextRect( Rectangle( Point(), aSize ), aText,
- TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
- aTextHeight += aRect.GetHeight();
-
- if ( aTextHeight < m_nStdHeight )
- aTextHeight = m_nStdHeight;
-
- m_nActiveHeight = aTextHeight + m_nExtraHeight;
-}
-
-//------------------------------------------------------------------------------
-const Size ExtensionBox_Impl::GetMinOutputSizePixel() const
-{
- return Size( 200, 80 );
-}
-
-//------------------------------------------------------------------------------
-Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
-
- Size aSize( GetOutputSizePixel() );
-
- if ( m_bHasScrollBar )
- aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
-
- if ( m_vEntries[ nPos ]->m_bActive )
- aSize.Height() = m_nActiveHeight;
- else
- aSize.Height() = m_nStdHeight;
-
- Point aPos( 0, -m_nTopIndex + nPos * m_nStdHeight );
- if ( m_bHasActive && ( nPos < m_nActive ) )
- aPos.Y() += m_nActiveHeight - m_nStdHeight;
-
- return Rectangle( aPos, aSize );
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::DeleteRemoved()
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
-
- m_bInDelete = true;
-
- if ( ! m_vRemovedEntries.empty() )
- {
- typedef std::vector< TEntry_Impl >::iterator ITER;
-
- for ( ITER iIndex = m_vRemovedEntries.begin(); iIndex < m_vRemovedEntries.end(); ++iIndex )
- {
- if ( (*iIndex)->m_pPublisher )
- {
- delete (*iIndex)->m_pPublisher;
- (*iIndex)->m_pPublisher = NULL;
- }
- }
-
- m_vRemovedEntries.clear();
- }
-
- m_bInDelete = false;
-}
-
-//------------------------------------------------------------------------------
-//This function may be called with nPos < 0
-void ExtensionBox_Impl::selectEntry( const long nPos )
-{
- //ToDo whe should not use the guard at such a big scope here.
- //Currently it is used to gard m_vEntries and m_nActive. m_nActive will be
- //modified in this function.
- //It would be probably best to always use a copy of m_vEntries
- //and some other state variables from ExtensionBox_Impl for
- //the whole painting operation. See issue i86993
- ::osl::ClearableMutexGuard guard(m_entriesMutex);
-
- if ( m_bInCheckMode )
- return;
-
- if ( m_bHasActive )
- {
- if ( nPos == m_nActive )
- return;
-
- m_bHasActive = false;
- m_vEntries[ m_nActive ]->m_bActive = false;
- }
-
- if ( ( nPos >= 0 ) && ( nPos < (long) m_vEntries.size() ) )
- {
- m_bHasActive = true;
- m_nActive = nPos;
- m_vEntries[ nPos ]->m_bActive = true;
-
- if ( IsReallyVisible() )
- {
- m_bNeedsRecalc = true;
- m_bAdjustActive = true;
- }
- }
-
- if ( IsReallyVisible() )
- Invalidate();
-
- guard.clear();
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry )
-{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- if ( pEntry->m_bActive )
- SetTextColor( rStyleSettings.GetHighlightTextColor() );
- else if ( ( pEntry->m_eState != REGISTERED ) && ( pEntry->m_eState != NOT_AVAILABLE ) )
- SetTextColor( rStyleSettings.GetDisableColor() );
- else if ( IsControlForeground() )
- SetTextColor( GetControlForeground() );
- else
- SetTextColor( rStyleSettings.GetFieldTextColor() );
-
- if ( pEntry->m_bActive )
- {
- SetLineColor();
- SetFillColor( rStyleSettings.GetHighlightColor() );
- DrawRect( rRect );
- }
- else
- {
- if( IsControlBackground() )
- SetBackground( GetControlBackground() );
- else
- SetBackground( rStyleSettings.GetFieldColor() );
-
- SetTextFillColor();
- Erase( rRect );
- }
-
- // Draw extension icon
- Point aPos( rRect.TopLeft() );
- aPos += Point( TOP_OFFSET, TOP_OFFSET );
- Image aImage;
- if ( ! pEntry->m_aIcon )
- aImage = isHCMode() ? m_aDefaultImageHC : m_aDefaultImage;
- else
- aImage = isHCMode() ? pEntry->m_aIconHC : pEntry->m_aIcon;
- Size aImageSize = aImage.GetSizePixel();
- if ( ( aImageSize.Width() <= ICON_HEIGHT ) && ( aImageSize.Height() <= ICON_HEIGHT ) )
- DrawImage( Point( aPos.X()+((ICON_HEIGHT-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage );
- else
- DrawImage( aPos, Size( ICON_HEIGHT, ICON_HEIGHT ), aImage );
-
- // Setup fonts
- Font aStdFont( GetFont() );
- Font aBoldFont( aStdFont );
- aBoldFont.SetWeight( WEIGHT_BOLD );
- SetFont( aBoldFont );
- long aTextHeight = GetTextHeight();
-
- // Init publisher link here
- if ( !pEntry->m_pPublisher && pEntry->m_sPublisher.Len() )
- {
- pEntry->m_pPublisher = new svt::FixedHyperlink( this );
- pEntry->m_pPublisher->SetBackground();
- pEntry->m_pPublisher->SetPaintTransparent( true );
- pEntry->m_pPublisher->SetURL( pEntry->m_sPublisherURL );
- pEntry->m_pPublisher->SetDescription( pEntry->m_sPublisher );
- Size aSize = FixedText::CalcMinimumTextSize( pEntry->m_pPublisher );
- pEntry->m_pPublisher->SetSizePixel( aSize );
-
- if ( m_aClickHdl.IsSet() )
- pEntry->m_pPublisher->SetClickHdl( m_aClickHdl );
- }
-
- // Get max title width
- long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET;
- nMaxTitleWidth -= ( 2 * SMALL_ICON_SIZE ) + ( 4 * SPACE_BETWEEN );
- if ( pEntry->m_pPublisher )
- {
- nMaxTitleWidth -= pEntry->m_pPublisher->GetSizePixel().Width() + (2*SPACE_BETWEEN);
- }
-
- long aVersionWidth = GetTextWidth( pEntry->m_sVersion );
- long aTitleWidth = GetTextWidth( pEntry->m_sTitle ) + (aTextHeight / 3);
-
- aPos = rRect.TopLeft() + Point( ICON_OFFSET, TOP_OFFSET );
-
- if ( aTitleWidth > nMaxTitleWidth - aVersionWidth )
- {
- aTitleWidth = nMaxTitleWidth - aVersionWidth - (aTextHeight / 3);
- String aShortTitle = GetEllipsisString( pEntry->m_sTitle, aTitleWidth );
- DrawText( aPos, aShortTitle );
- aTitleWidth += (aTextHeight / 3);
- }
- else
- DrawText( aPos, pEntry->m_sTitle );
-
- SetFont( aStdFont );
- DrawText( Point( aPos.X() + aTitleWidth, aPos.Y() ), pEntry->m_sVersion );
-
- long nIconHeight = TOP_OFFSET + SMALL_ICON_SIZE;
- long nTitleHeight = TOP_OFFSET + GetTextHeight();
- if ( nIconHeight < nTitleHeight )
- aTextHeight = nTitleHeight;
- else
- aTextHeight = nIconHeight;
-
- // draw description
- String sDescription;
- if ( pEntry->m_sErrorText.Len() )
- {
- if ( pEntry->m_bActive )
- sDescription = pEntry->m_sErrorText + OUSTR("\n") + pEntry->m_sDescription;
- else
- sDescription = pEntry->m_sErrorText;
- }
- else
- sDescription = pEntry->m_sDescription;
-
- aPos.Y() += aTextHeight;
- if ( pEntry->m_bActive )
- {
- DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - m_nExtraHeight ),
- sDescription, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
- }
- else
- {
- const long nWidth = GetTextWidth( sDescription );
- if ( nWidth > rRect.GetWidth() - aPos.X() )
- sDescription = GetEllipsisString( sDescription, rRect.GetWidth() - aPos.X() );
- DrawText( aPos, sDescription );
- }
-
- // Draw publisher link
- if ( pEntry->m_pPublisher )
- {
- pEntry->m_pPublisher->Show();
- aPos = rRect.TopLeft() + Point( ICON_OFFSET + nMaxTitleWidth + (2*SPACE_BETWEEN), TOP_OFFSET );
- pEntry->m_pPublisher->SetPosPixel( aPos );
- }
-
- // Draw status icons
- if ( pEntry->m_bShared )
- {
- aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SMALL_ICON_SIZE), TOP_OFFSET );
- DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aLockedImageHC : m_aLockedImage );
- }
- if ( ( pEntry->m_eState == AMBIGUOUS ) || pEntry->m_bMissingDeps )
- {
- aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2*SMALL_ICON_SIZE), TOP_OFFSET );
- DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aWarningImageHC : m_aWarningImage );
- }
-
- SetLineColor( Color( COL_LIGHTGRAY ) );
- DrawLine( rRect.BottomLeft(), rRect.BottomRight() );
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::RecalcAll()
-{
- if ( m_bHasActive )
- CalcActiveHeight( m_nActive );
-
- SetupScrollBar();
-
- if ( m_bHasActive )
- {
- Rectangle aEntryRect = GetEntryRect( m_nActive );
-
- if ( m_bAdjustActive )
- {
- m_bAdjustActive = false;
-
- // If the top of the selected entry isn't visible, make it visible
- if ( aEntryRect.Top() < 0 )
- {
- m_nTopIndex += aEntryRect.Top();
- aEntryRect.Move( 0, -aEntryRect.Top() );
- }
-
- // If the bottom of the selected entry isn't visible, make it visible even if now the top
- // isn't visible any longer ( the buttons are more important )
- Size aOutputSize = GetOutputSizePixel();
- if ( aEntryRect.Bottom() > aOutputSize.Height() )
- {
- m_nTopIndex += ( aEntryRect.Bottom() - aOutputSize.Height() );
- aEntryRect.Move( 0, -( aEntryRect.Bottom() - aOutputSize.Height() ) );
- }
-
- // If there is unused space below the last entry but all entries don't fit into the box,
- // move the content down to use the whole space
- const long nTotalHeight = GetTotalHeight();
- if ( m_bHasScrollBar && ( aOutputSize.Height() + m_nTopIndex > nTotalHeight ) )
- {
- long nOffset = m_nTopIndex;
- m_nTopIndex = nTotalHeight - aOutputSize.Height();
- nOffset -= m_nTopIndex;
- aEntryRect.Move( 0, nOffset );
- }
-
- if ( m_bHasScrollBar )
- m_pScrollBar->SetThumbPos( m_nTopIndex );
- }
- }
-
- m_bNeedsRecalc = false;
-}
-
-// -----------------------------------------------------------------------
-bool ExtensionBox_Impl::HandleTabKey( bool )
-{
- return false;
-}
-
-// -----------------------------------------------------------------------
-bool ExtensionBox_Impl::HandleCursorKey( USHORT nKeyCode )
-{
- if ( m_vEntries.empty() )
- return true;
-
- long nSelect = 0;
-
- if ( m_bHasActive )
- {
- long nPageSize = GetOutputSizePixel().Height() / m_nStdHeight;
- if ( nPageSize < 2 )
- nPageSize = 2;
-
- if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_RIGHT ) )
- nSelect = m_nActive + 1;
- else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_LEFT ) )
- nSelect = m_nActive - 1;
- else if ( nKeyCode == KEY_HOME )
- nSelect = 0;
- else if ( nKeyCode == KEY_END )
- nSelect = m_vEntries.size() - 1;
- else if ( nKeyCode == KEY_PAGEUP )
- nSelect = m_nActive - nPageSize + 1;
- else if ( nKeyCode == KEY_PAGEDOWN )
- nSelect = m_nActive + nPageSize - 1;
- }
- else // when there is no selected entry, we will select the first or the last.
- {
- if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_PAGEDOWN ) || ( nKeyCode == KEY_HOME ) )
- nSelect = 0;
- else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_PAGEUP ) || ( nKeyCode == KEY_END ) )
- nSelect = m_vEntries.size() - 1;
- }
-
- if ( nSelect < 0 )
- nSelect = 0;
- if ( nSelect >= (long) m_vEntries.size() )
- nSelect = m_vEntries.size() - 1;
-
- selectEntry( nSelect );
-
- return true;
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::Paint( const Rectangle &/*rPaintRect*/ )
-{
- if ( !m_bInDelete )
- DeleteRemoved();
-
- if ( m_bNeedsRecalc )
- RecalcAll();
-
- Point aStart( 0, -m_nTopIndex );
- Size aSize( GetOutputSizePixel() );
-
- if ( m_bHasScrollBar )
- aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
-
- const ::osl::MutexGuard aGuard( m_entriesMutex );
-
- typedef std::vector< TEntry_Impl >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- aSize.Height() = (*iIndex)->m_bActive ? m_nActiveHeight : m_nStdHeight;
- Rectangle aEntryRect( aStart, aSize );
- DrawRow( aEntryRect, *iIndex );
- aStart.Y() += aSize.Height();
- }
-}
-
-// -----------------------------------------------------------------------
-long ExtensionBox_Impl::GetTotalHeight() const
-{
- long nHeight = m_vEntries.size() * m_nStdHeight;
-
- if ( m_bHasActive )
- {
- nHeight += m_nActiveHeight - m_nStdHeight;
- }
-
- return nHeight;
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::SetupScrollBar()
-{
- const Size aSize = GetOutputSizePixel();
- const long nScrBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
- const long nTotalHeight = GetTotalHeight();
- const bool bNeedsScrollBar = ( nTotalHeight > aSize.Height() );
-
- if ( bNeedsScrollBar )
- {
- if ( m_nTopIndex + aSize.Height() > nTotalHeight )
- m_nTopIndex = nTotalHeight - aSize.Height();
-
- m_pScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
- Size( nScrBarSize, aSize.Height() ) );
- m_pScrollBar->SetRangeMax( nTotalHeight );
- m_pScrollBar->SetVisibleSize( aSize.Height() );
- m_pScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 );
- m_pScrollBar->SetLineSize( m_nStdHeight );
- m_pScrollBar->SetThumbPos( m_nTopIndex );
-
- if ( !m_bHasScrollBar )
- m_pScrollBar->Show();
- }
- else if ( m_bHasScrollBar )
- {
- m_pScrollBar->Hide();
- m_nTopIndex = 0;
- }
-
- m_bHasScrollBar = bNeedsScrollBar;
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::Resize()
-{
- RecalcAll();
-}
-
-//------------------------------------------------------------------------------
-long ExtensionBox_Impl::PointToPos( const Point& rPos )
-{
- long nPos = ( rPos.Y() + m_nTopIndex ) / m_nStdHeight;
-
- if ( m_bHasActive && ( nPos > m_nActive ) )
- {
- if ( rPos.Y() + m_nTopIndex <= m_nActive*m_nStdHeight + m_nActiveHeight )
- nPos = m_nActive;
- else
- nPos = ( rPos.Y() + m_nTopIndex - (m_nActiveHeight - m_nStdHeight) ) / m_nStdHeight;
- }
-
- return nPos;
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt )
-{
- long nPos = PointToPos( rMEvt.GetPosPixel() );
-
- if ( rMEvt.IsLeft() )
- {
- if ( rMEvt.IsMod1() && m_bHasActive )
- selectEntry( m_vEntries.size() ); // Selecting an not existing entry will deselect the current one
- else
- selectEntry( nPos );
- }
-}
-
-//------------------------------------------------------------------------------
-long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt )
-{
- if ( !m_bInDelete )
- DeleteRemoved();
-
- bool bHandled = false;
-
- if ( rNEvt.GetType() == EVENT_KEYINPUT )
- {
- const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
- KeyCode aKeyCode = pKEvt->GetKeyCode();
- USHORT nKeyCode = aKeyCode.GetCode();
-
- if ( nKeyCode == KEY_TAB )
- bHandled = HandleTabKey( aKeyCode.IsShift() );
- else if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR )
- bHandled = HandleCursorKey( nKeyCode );
- }
-
- if ( rNEvt.GetType() == EVENT_COMMAND )
- {
- if ( m_bHasScrollBar &&
- ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL ) )
- {
- const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
- if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
- {
- long nThumbPos = m_pScrollBar->GetThumbPos();
- if ( pData->GetDelta() < 0 )
- m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight );
- else
- m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight );
- bHandled = true;
- }
- }
- }
-
- if ( !bHandled )
- return Control::Notify( rNEvt );
- else
- return true;
-}
-
-//------------------------------------------------------------------------------
-bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStart,
- const long nEnd, long &nPos )
-{
- nPos = nStart;
- if ( nStart > nEnd )
- return false;
-
- StringCompare eCompare;
-
- if ( nStart == nEnd )
- {
- eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] );
- if ( eCompare == COMPARE_LESS )
- return false;
- else if ( eCompare == COMPARE_EQUAL )
- {
- //Workaround. See i86963.
- if (pEntry->m_xPackage != m_vEntries[nStart]->m_xPackage)
- return false;
-
- if ( m_bInCheckMode )
- m_vEntries[ nStart ]->m_bChecked = true;
- return true;
- }
- else
- {
- nPos = nStart + 1;
- return false;
- }
- }
-
- const long nMid = nStart + ( ( nEnd - nStart ) / 2 );
- eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] );
-
- if ( eCompare == COMPARE_LESS )
- return FindEntryPos( pEntry, nStart, nMid-1, nPos );
- else if ( eCompare == COMPARE_GREATER )
- return FindEntryPos( pEntry, nMid+1, nEnd, nPos );
- else
- {
- //Workaround.See i86963.
- if (pEntry->m_xPackage != m_vEntries[nMid]->m_xPackage)
- return false;
-
- if ( m_bInCheckMode )
- m_vEntries[ nMid ]->m_bChecked = true;
- nPos = nMid;
- return true;
- }
-}
-
-//------------------------------------------------------------------------------
-long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager )
-{
- long nPos = 0;
- PackageState eState = m_pManager->getPackageState( xPackage );
-
- TEntry_Impl pEntry( new Entry_Impl( xPackage, xPackageManager, eState ) );
- xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
-
- ::osl::ClearableMutexGuard guard(m_entriesMutex);
- if ( m_vEntries.empty() )
- {
- pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
- pEntry->m_bNew = m_bInCheckMode;
- m_vEntries.push_back( pEntry );
- }
- else
- {
- if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) )
- {
- pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
- pEntry->m_bNew = m_bInCheckMode;
- m_vEntries.insert( m_vEntries.begin()+nPos, pEntry );
- }
- else if ( !m_bInCheckMode )
- {
- OSL_ENSURE( 0, "ExtensionBox_Impl::addEntry(): Will not add duplicate entries" );
- }
- }
- //access to m_nActive must be guarded
- if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) )
- m_nActive += 1;
-
- guard.clear();
-
- if ( IsReallyVisible() )
- Invalidate();
-
- m_bNeedsRecalc = true;
-
- return nPos;
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage > &xPackage )
-{
- typedef std::vector< TEntry_Impl >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- if ( (*iIndex)->m_xPackage == xPackage )
- {
- PackageState eState = m_pManager->getPackageState( xPackage );
- (*iIndex)->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- (*iIndex)->m_eState = eState;
- (*iIndex)->m_sTitle = xPackage->getDisplayName();
- (*iIndex)->m_sVersion = xPackage->getVersion();
- (*iIndex)->m_sDescription = xPackage->getDescription();
-
- if ( eState == AMBIGUOUS )
- (*iIndex)->m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
- else
- (*iIndex)->m_sErrorText = String();
-
- if ( IsReallyVisible() )
- Invalidate();
- break;
- }
- }
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::removeEntry( const uno::Reference< deployment::XPackage > &xPackage )
-{
- if ( ! m_bInDelete )
- {
- ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
-
- typedef std::vector< TEntry_Impl >::iterator ITER;
-
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- if ( (*iIndex)->m_xPackage == xPackage )
- {
- long nPos = iIndex - m_vEntries.begin();
-
- // Entries mustn't removed here, because they contain a hyperlink control
- // which can only be deleted when the thread has the solar mutex. Therefor
- // the entry will be moved into the m_vRemovedEntries list which will be
- // cleared on the next paint event
- m_vRemovedEntries.push_back( *iIndex );
- m_vEntries.erase( iIndex );
-
- m_bNeedsRecalc = true;
-
- if ( IsReallyVisible() )
- Invalidate();
-
- if ( m_bHasActive )
- {
- if ( nPos < m_nActive )
- m_nActive -= 1;
- else if ( ( nPos == m_nActive ) &&
- ( nPos == (long) m_vEntries.size() ) )
- m_nActive -= 1;
-
- m_bHasActive = false;
- //clear before calling out of this method
- aGuard.clear();
- selectEntry( m_nActive );
- }
- break;
- }
- }
- }
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::RemoveUnlocked()
-{
- bool bAllRemoved = false;
-
- while ( ! bAllRemoved )
- {
- bAllRemoved = true;
-
- ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
-
- typedef std::vector< TEntry_Impl >::iterator ITER;
-
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- if ( !(*iIndex)->m_bLocked )
- {
- bAllRemoved = false;
- uno::Reference< deployment::XPackage> xPackage = (*iIndex)->m_xPackage;
- aGuard.clear();
- removeEntry( xPackage );
- break;
- }
- }
- }
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr )
-{
- m_bInCheckMode = true;
- typedef std::vector< TEntry_Impl >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- if ( (*iIndex)->m_xPackageManager == xPackageMgr )
- (*iIndex)->m_bChecked = false;
- else
- (*iIndex)->m_bChecked = true;
- (*iIndex)->m_bNew = false;
- }
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::checkEntries()
-{
- long nNewPos = -1;
- long nPos = 0;
- bool bNeedsUpdate = false;
-
- ::osl::ClearableMutexGuard guard(m_entriesMutex);
- typedef std::vector< TEntry_Impl >::iterator ITER;
- ITER iIndex = m_vEntries.begin();
- while ( iIndex < m_vEntries.end() )
- {
- if ( (*iIndex)->m_bChecked == false )
- {
- bNeedsUpdate = true;
- nPos = iIndex-m_vEntries.begin();
- if ( (*iIndex)->m_bNew )
- {
- if ( nNewPos == - 1)
- nNewPos = nPos;
- if ( nPos <= m_nActive )
- m_nActive += 1;
- }
- }
- iIndex++;
- }
- guard.clear();
-
- m_bInCheckMode = false;
-
- if ( nNewPos != - 1)
- selectEntry( nNewPos );
-
- if ( bNeedsUpdate )
- {
- m_bNeedsRecalc = true;
- if ( IsReallyVisible() )
- Invalidate();
- }
-}
-//------------------------------------------------------------------------------
-bool ExtensionBox_Impl::isHCMode()
-{
- return (bool)GetSettings().GetStyleSettings().GetHighContrastMode();
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::SetScrollHdl( const Link& rLink )
-{
- if ( m_pScrollBar )
- m_pScrollBar->SetScrollHdl( rLink );
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::DoScroll( long nDelta )
-{
- m_nTopIndex += nDelta;
- Point aNewSBPt( m_pScrollBar->GetPosPixel() );
-
- Rectangle aScrRect( Point(), GetOutputSizePixel() );
- aScrRect.Right() -= m_pScrollBar->GetSizePixel().Width();
- Scroll( 0, -nDelta, aScrRect );
-
- m_pScrollBar->SetPosPixel( aNewSBPt );
-}
-
-// -----------------------------------------------------------------------
-IMPL_LINK( ExtensionBox_Impl, ScrollHdl, ScrollBar*, pScrBar )
-{
- DoScroll( pScrBar->GetDelta() );
-
- return 1;
-}
-
-} //namespace dp_gui
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_desktop.hxx"
+
+#include "svtools/controldims.hrc"
+
+#include "dp_gui.h"
+#include "dp_gui_extlistbox.hxx"
+#include "dp_gui_theextmgr.hxx"
+#include "dp_gui_dialog2.hxx"
+#include "dp_dependencies.hxx"
+
+#include "comphelper/processfactory.hxx"
+#include "com/sun/star/i18n/CollatorOptions.hpp"
+#include "com/sun/star/deployment/DependencyException.hpp"
+#include "com/sun/star/deployment/DeploymentException.hpp"
+
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+using namespace ::com::sun::star;
+
+namespace dp_gui {
+
+//------------------------------------------------------------------------------
+// struct Entry_Impl
+//------------------------------------------------------------------------------
+Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
+ const uno::Reference< deployment::XPackageManager > &xPackageManager,
+ PackageState eState ) :
+ m_bActive( false ),
+ m_bLocked( false ),
+ m_bHasOptions( false ),
+ m_bShared( false ),
+ m_bNew( false ),
+ m_bChecked( false ),
+ m_bMissingDeps( false ),
+ m_eState( eState ),
+ m_pPublisher( NULL ),
+ m_xPackage( xPackage ),
+ m_xPackageManager( xPackageManager )
+{
+ m_sTitle = xPackage->getDisplayName();
+ m_sVersion = xPackage->getVersion();
+ m_sDescription = xPackage->getDescription();
+
+ beans::StringPair aInfo( m_xPackage->getPublisherInfo() );
+ m_sPublisher = aInfo.First;
+ m_sPublisherURL = aInfo.Second;
+
+ // get the icons for the package if there are any
+ uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false );
+ if ( xGraphic.is() )
+ m_aIcon = Image( xGraphic );
+
+ xGraphic = xPackage->getIcon( true );
+ if ( xGraphic.is() )
+ m_aIconHC = Image( xGraphic );
+ else
+ m_aIconHC = m_aIcon;
+
+ m_bLocked = m_xPackageManager->isReadOnly();
+
+ if ( eState == AMBIGUOUS )
+ m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
+ else if ( eState == NOT_REGISTERED )
+ checkDependencies();
+}
+
+//------------------------------------------------------------------------------
+Entry_Impl::~Entry_Impl()
+{}
+
+//------------------------------------------------------------------------------
+StringCompare Entry_Impl::CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const
+{
+ StringCompare eCompare = (StringCompare) pCollator->compareString( m_sTitle, pEntry->m_sTitle );
+ if ( eCompare == COMPARE_EQUAL )
+ {
+ eCompare = m_sVersion.CompareTo( pEntry->m_sVersion );
+ if ( eCompare == COMPARE_EQUAL )
+ {
+ if ( m_xPackageManager != pEntry->m_xPackageManager )
+ {
+ sal_Int32 nCompare = m_xPackageManager->getContext().compareTo( pEntry->m_xPackageManager->getContext() );
+ if ( nCompare < 0 )
+ eCompare = COMPARE_LESS;
+ else if ( nCompare > 0 )
+ eCompare = COMPARE_GREATER;
+ }
+ }
+ }
+ return eCompare;
+}
+
+//------------------------------------------------------------------------------
+void Entry_Impl::checkDependencies()
+{
+ try {
+ m_xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
+ }
+ catch ( deployment::DeploymentException &e )
+ {
+ deployment::DependencyException depExc;
+ if ( e.Cause >>= depExc )
+ {
+ rtl::OUString aMissingDep( DialogHelper::getResourceString( RID_STR_ERROR_MISSING_DEPENDENCIES ) );
+ for ( sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i )
+ {
+ aMissingDep += OUSTR("\n");
+ aMissingDep += dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]);
+ }
+ aMissingDep += OUSTR("\n");
+ m_sErrorText = aMissingDep;
+ m_bMissingDeps = true;
+ }
+ }
+}
+//------------------------------------------------------------------------------
+// ExtensionRemovedListener
+//------------------------------------------------------------------------------
+void ExtensionRemovedListener::disposing( lang::EventObject const & rEvt )
+ throw ( uno::RuntimeException )
+{
+ uno::Reference< deployment::XPackage > xPackage( rEvt.Source, uno::UNO_QUERY );
+
+ if ( xPackage.is() )
+ {
+ m_pParent->removeEntry( xPackage );
+ }
+}
+
+//------------------------------------------------------------------------------
+ExtensionRemovedListener::~ExtensionRemovedListener()
+{
+}
+
+//------------------------------------------------------------------------------
+// ExtensionBox_Impl
+//------------------------------------------------------------------------------
+ExtensionBox_Impl::ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager ) :
+ IExtensionListBox( pParent, WB_BORDER | WB_TABSTOP | WB_CHILDDLGCTRL ),
+ m_bHasScrollBar( false ),
+ m_bHasActive( false ),
+ m_bNeedsRecalc( true ),
+ m_bHasNew( false ),
+ m_bInCheckMode( false ),
+ m_bAdjustActive( false ),
+ m_bInDelete( false ),
+ m_nActive( 0 ),
+ m_nTopIndex( 0 ),
+ m_nActiveHeight( 0 ),
+ m_nExtraHeight( 2 ),
+ m_aLockedImage( DialogHelper::getResId( RID_IMG_LOCKED ) ),
+ m_aLockedImageHC( DialogHelper::getResId( RID_IMG_LOCKED_HC ) ),
+ m_aWarningImage( DialogHelper::getResId( RID_IMG_WARNING ) ),
+ m_aWarningImageHC( DialogHelper::getResId( RID_IMG_WARNING_HC ) ),
+ m_aDefaultImage( DialogHelper::getResId( RID_IMG_EXTENSION ) ),
+ m_aDefaultImageHC( DialogHelper::getResId( RID_IMG_EXTENSION_HC ) ),
+ m_pScrollBar( NULL ),
+ m_pManager( pManager )
+{
+ SetHelpId( HID_EXTENSION_MANAGER_LISTBOX );
+
+ m_pScrollBar = new ScrollBar( this, WB_VERT );
+ m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) );
+ m_pScrollBar->EnableDrag();
+
+ SetPaintTransparent( true );
+ SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) );
+ long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
+ long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
+ if ( nIconHeight < nTitleHeight )
+ m_nStdHeight = nTitleHeight;
+ else
+ m_nStdHeight = nIconHeight;
+ m_nStdHeight += GetTextHeight() + TOP_OFFSET;
+
+ nIconHeight = ICON_HEIGHT + 2*TOP_OFFSET + 1;
+ if ( m_nStdHeight < nIconHeight )
+ m_nStdHeight = nIconHeight;
+
+ m_nActiveHeight = m_nStdHeight;
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetFieldColor() );
+
+ m_xRemoveListener = new ExtensionRemovedListener( this );
+
+ m_pLocale = new lang::Locale( Application::GetSettings().GetLocale() );
+ m_pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() );
+ m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
+
+ Show();
+}
+
+//------------------------------------------------------------------------------
+ExtensionBox_Impl::~ExtensionBox_Impl()
+{
+ if ( ! m_bInDelete )
+ DeleteRemoved();
+
+ m_bInDelete = true;
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_pPublisher )
+ {
+ delete (*iIndex)->m_pPublisher;
+ (*iIndex)->m_pPublisher = NULL;
+ }
+ (*iIndex)->m_xPackage->removeEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
+ }
+
+ m_vEntries.clear();
+
+ delete m_pScrollBar;
+
+ m_xRemoveListener.clear();
+
+ delete m_pLocale;
+ delete m_pCollator;
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 ExtensionBox_Impl::getItemCount() const
+{
+ return static_cast< sal_Int32 >( m_vEntries.size() );
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 ExtensionBox_Impl::getSelIndex() const
+{
+ if ( m_bHasActive )
+ {
+ OSL_ASSERT( m_nActive >= -1);
+ return static_cast< sal_Int32 >( m_nActive );
+ }
+ else
+ return static_cast< sal_Int32 >( EXTENSION_LISTBOX_ENTRY_NOTFOUND );
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::checkIndex( sal_Int32 nIndex ) const
+{
+ if ( nIndex < 0 )
+ throw lang::IllegalArgumentException( OUSTR("The list index starts with 0"),0, 0 );
+ if ( static_cast< sal_uInt32 >( nIndex ) >= m_vEntries.size())
+ throw lang::IllegalArgumentException( OUSTR("There is no element at the provided position."
+ "The position exceeds the number of available list entries"),0, 0 );
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemName( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sTitle;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemVersion( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sVersion;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemDescription( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sDescription;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemPublisher( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sPublisher;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemPublisherLink( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sPublisherURL;
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::select( sal_Int32 nIndex )
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ selectEntry( nIndex );
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::select( const rtl::OUString & sName )
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ typedef ::std::vector< TEntry_Impl >::const_iterator It;
+
+ for ( It iIter = m_vEntries.begin(); iIter < m_vEntries.end(); iIter++ )
+ {
+ if ( sName.equals( (*iIter)->m_sTitle ) )
+ {
+ long nPos = iIter - m_vEntries.begin();
+ selectEntry( nPos );
+ break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+// Title + description
+void ExtensionBox_Impl::CalcActiveHeight( const long nPos )
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ // get title height
+ long aTextHeight;
+ long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
+ long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
+ if ( nIconHeight < nTitleHeight )
+ aTextHeight = nTitleHeight;
+ else
+ aTextHeight = nIconHeight;
+
+ // calc description height
+ Size aSize = GetOutputSizePixel();
+ if ( m_bHasScrollBar )
+ aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+
+ aSize.Width() -= ICON_OFFSET;
+ aSize.Height() = 10000;
+
+ rtl::OUString aText( m_vEntries[ nPos ]->m_sErrorText );
+ aText += m_vEntries[ nPos ]->m_sDescription;
+
+ Rectangle aRect = GetTextRect( Rectangle( Point(), aSize ), aText,
+ TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ aTextHeight += aRect.GetHeight();
+
+ if ( aTextHeight < m_nStdHeight )
+ aTextHeight = m_nStdHeight;
+
+ m_nActiveHeight = aTextHeight + m_nExtraHeight;
+}
+
+//------------------------------------------------------------------------------
+const Size ExtensionBox_Impl::GetMinOutputSizePixel() const
+{
+ return Size( 200, 80 );
+}
+
+//------------------------------------------------------------------------------
+Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ Size aSize( GetOutputSizePixel() );
+
+ if ( m_bHasScrollBar )
+ aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+
+ if ( m_vEntries[ nPos ]->m_bActive )
+ aSize.Height() = m_nActiveHeight;
+ else
+ aSize.Height() = m_nStdHeight;
+
+ Point aPos( 0, -m_nTopIndex + nPos * m_nStdHeight );
+ if ( m_bHasActive && ( nPos < m_nActive ) )
+ aPos.Y() += m_nActiveHeight - m_nStdHeight;
+
+ return Rectangle( aPos, aSize );
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::DeleteRemoved()
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ m_bInDelete = true;
+
+ if ( ! m_vRemovedEntries.empty() )
+ {
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vRemovedEntries.begin(); iIndex < m_vRemovedEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_pPublisher )
+ {
+ delete (*iIndex)->m_pPublisher;
+ (*iIndex)->m_pPublisher = NULL;
+ }
+ }
+
+ m_vRemovedEntries.clear();
+ }
+
+ m_bInDelete = false;
+}
+
+//------------------------------------------------------------------------------
+//This function may be called with nPos < 0
+void ExtensionBox_Impl::selectEntry( const long nPos )
+{
+ //ToDo whe should not use the guard at such a big scope here.
+ //Currently it is used to gard m_vEntries and m_nActive. m_nActive will be
+ //modified in this function.
+ //It would be probably best to always use a copy of m_vEntries
+ //and some other state variables from ExtensionBox_Impl for
+ //the whole painting operation. See issue i86993
+ ::osl::ClearableMutexGuard guard(m_entriesMutex);
+
+ if ( m_bInCheckMode )
+ return;
+
+ if ( m_bHasActive )
+ {
+ if ( nPos == m_nActive )
+ return;
+
+ m_bHasActive = false;
+ m_vEntries[ m_nActive ]->m_bActive = false;
+ }
+
+ if ( ( nPos >= 0 ) && ( nPos < (long) m_vEntries.size() ) )
+ {
+ m_bHasActive = true;
+ m_nActive = nPos;
+ m_vEntries[ nPos ]->m_bActive = true;
+
+ if ( IsReallyVisible() )
+ {
+ m_bNeedsRecalc = true;
+ m_bAdjustActive = true;
+ }
+ }
+
+ if ( IsReallyVisible() )
+ Invalidate();
+
+ guard.clear();
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( pEntry->m_bActive )
+ SetTextColor( rStyleSettings.GetHighlightTextColor() );
+ else if ( ( pEntry->m_eState != REGISTERED ) && ( pEntry->m_eState != NOT_AVAILABLE ) )
+ SetTextColor( rStyleSettings.GetDisableColor() );
+ else if ( IsControlForeground() )
+ SetTextColor( GetControlForeground() );
+ else
+ SetTextColor( rStyleSettings.GetFieldTextColor() );
+
+ if ( pEntry->m_bActive )
+ {
+ SetLineColor();
+ SetFillColor( rStyleSettings.GetHighlightColor() );
+ DrawRect( rRect );
+ }
+ else
+ {
+ if( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetFieldColor() );
+
+ SetTextFillColor();
+ Erase( rRect );
+ }
+
+ // Draw extension icon
+ Point aPos( rRect.TopLeft() );
+ aPos += Point( TOP_OFFSET, TOP_OFFSET );
+ Image aImage;
+ if ( ! pEntry->m_aIcon )
+ aImage = isHCMode() ? m_aDefaultImageHC : m_aDefaultImage;
+ else
+ aImage = isHCMode() ? pEntry->m_aIconHC : pEntry->m_aIcon;
+ Size aImageSize = aImage.GetSizePixel();
+ if ( ( aImageSize.Width() <= ICON_HEIGHT ) && ( aImageSize.Height() <= ICON_HEIGHT ) )
+ DrawImage( Point( aPos.X()+((ICON_HEIGHT-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage );
+ else
+ DrawImage( aPos, Size( ICON_HEIGHT, ICON_HEIGHT ), aImage );
+
+ // Setup fonts
+ Font aStdFont( GetFont() );
+ Font aBoldFont( aStdFont );
+ aBoldFont.SetWeight( WEIGHT_BOLD );
+ SetFont( aBoldFont );
+ long aTextHeight = GetTextHeight();
+
+ // Init publisher link here
+ if ( !pEntry->m_pPublisher && pEntry->m_sPublisher.Len() )
+ {
+ pEntry->m_pPublisher = new svt::FixedHyperlink( this );
+ pEntry->m_pPublisher->SetBackground();
+ pEntry->m_pPublisher->SetPaintTransparent( true );
+ pEntry->m_pPublisher->SetURL( pEntry->m_sPublisherURL );
+ pEntry->m_pPublisher->SetDescription( pEntry->m_sPublisher );
+ Size aSize = FixedText::CalcMinimumTextSize( pEntry->m_pPublisher );
+ pEntry->m_pPublisher->SetSizePixel( aSize );
+
+ if ( m_aClickHdl.IsSet() )
+ pEntry->m_pPublisher->SetClickHdl( m_aClickHdl );
+ }
+
+ // Get max title width
+ long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET;
+ nMaxTitleWidth -= ( 2 * SMALL_ICON_SIZE ) + ( 4 * SPACE_BETWEEN );
+ if ( pEntry->m_pPublisher )
+ {
+ nMaxTitleWidth -= pEntry->m_pPublisher->GetSizePixel().Width() + (2*SPACE_BETWEEN);
+ }
+
+ long aVersionWidth = GetTextWidth( pEntry->m_sVersion );
+ long aTitleWidth = GetTextWidth( pEntry->m_sTitle ) + (aTextHeight / 3);
+
+ aPos = rRect.TopLeft() + Point( ICON_OFFSET, TOP_OFFSET );
+
+ if ( aTitleWidth > nMaxTitleWidth - aVersionWidth )
+ {
+ aTitleWidth = nMaxTitleWidth - aVersionWidth - (aTextHeight / 3);
+ String aShortTitle = GetEllipsisString( pEntry->m_sTitle, aTitleWidth );
+ DrawText( aPos, aShortTitle );
+ aTitleWidth += (aTextHeight / 3);
+ }
+ else
+ DrawText( aPos, pEntry->m_sTitle );
+
+ SetFont( aStdFont );
+ DrawText( Point( aPos.X() + aTitleWidth, aPos.Y() ), pEntry->m_sVersion );
+
+ long nIconHeight = TOP_OFFSET + SMALL_ICON_SIZE;
+ long nTitleHeight = TOP_OFFSET + GetTextHeight();
+ if ( nIconHeight < nTitleHeight )
+ aTextHeight = nTitleHeight;
+ else
+ aTextHeight = nIconHeight;
+
+ // draw description
+ String sDescription;
+ if ( pEntry->m_sErrorText.Len() )
+ {
+ if ( pEntry->m_bActive )
+ sDescription = pEntry->m_sErrorText + OUSTR("\n") + pEntry->m_sDescription;
+ else
+ sDescription = pEntry->m_sErrorText;
+ }
+ else
+ sDescription = pEntry->m_sDescription;
+
+ aPos.Y() += aTextHeight;
+ if ( pEntry->m_bActive )
+ {
+ DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - m_nExtraHeight ),
+ sDescription, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ }
+ else
+ {
+ const long nWidth = GetTextWidth( sDescription );
+ if ( nWidth > rRect.GetWidth() - aPos.X() )
+ sDescription = GetEllipsisString( sDescription, rRect.GetWidth() - aPos.X() );
+ DrawText( aPos, sDescription );
+ }
+
+ // Draw publisher link
+ if ( pEntry->m_pPublisher )
+ {
+ pEntry->m_pPublisher->Show();
+ aPos = rRect.TopLeft() + Point( ICON_OFFSET + nMaxTitleWidth + (2*SPACE_BETWEEN), TOP_OFFSET );
+ pEntry->m_pPublisher->SetPosPixel( aPos );
+ }
+
+ // Draw status icons
+ if ( pEntry->m_bShared )
+ {
+ aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SMALL_ICON_SIZE), TOP_OFFSET );
+ DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aLockedImageHC : m_aLockedImage );
+ }
+ if ( ( pEntry->m_eState == AMBIGUOUS ) || pEntry->m_bMissingDeps )
+ {
+ aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2*SMALL_ICON_SIZE), TOP_OFFSET );
+ DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aWarningImageHC : m_aWarningImage );
+ }
+
+ SetLineColor( Color( COL_LIGHTGRAY ) );
+ DrawLine( rRect.BottomLeft(), rRect.BottomRight() );
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::RecalcAll()
+{
+ if ( m_bHasActive )
+ CalcActiveHeight( m_nActive );
+
+ SetupScrollBar();
+
+ if ( m_bHasActive )
+ {
+ Rectangle aEntryRect = GetEntryRect( m_nActive );
+
+ if ( m_bAdjustActive )
+ {
+ m_bAdjustActive = false;
+
+ // If the top of the selected entry isn't visible, make it visible
+ if ( aEntryRect.Top() < 0 )
+ {
+ m_nTopIndex += aEntryRect.Top();
+ aEntryRect.Move( 0, -aEntryRect.Top() );
+ }
+
+ // If the bottom of the selected entry isn't visible, make it visible even if now the top
+ // isn't visible any longer ( the buttons are more important )
+ Size aOutputSize = GetOutputSizePixel();
+ if ( aEntryRect.Bottom() > aOutputSize.Height() )
+ {
+ m_nTopIndex += ( aEntryRect.Bottom() - aOutputSize.Height() );
+ aEntryRect.Move( 0, -( aEntryRect.Bottom() - aOutputSize.Height() ) );
+ }
+
+ // If there is unused space below the last entry but all entries don't fit into the box,
+ // move the content down to use the whole space
+ const long nTotalHeight = GetTotalHeight();
+ if ( m_bHasScrollBar && ( aOutputSize.Height() + m_nTopIndex > nTotalHeight ) )
+ {
+ long nOffset = m_nTopIndex;
+ m_nTopIndex = nTotalHeight - aOutputSize.Height();
+ nOffset -= m_nTopIndex;
+ aEntryRect.Move( 0, nOffset );
+ }
+
+ if ( m_bHasScrollBar )
+ m_pScrollBar->SetThumbPos( m_nTopIndex );
+ }
+ }
+
+ m_bNeedsRecalc = false;
+}
+
+// -----------------------------------------------------------------------
+bool ExtensionBox_Impl::HandleTabKey( bool )
+{
+ return false;
+}
+
+// -----------------------------------------------------------------------
+bool ExtensionBox_Impl::HandleCursorKey( USHORT nKeyCode )
+{
+ if ( m_vEntries.empty() )
+ return true;
+
+ long nSelect = 0;
+
+ if ( m_bHasActive )
+ {
+ long nPageSize = GetOutputSizePixel().Height() / m_nStdHeight;
+ if ( nPageSize < 2 )
+ nPageSize = 2;
+
+ if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_RIGHT ) )
+ nSelect = m_nActive + 1;
+ else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_LEFT ) )
+ nSelect = m_nActive - 1;
+ else if ( nKeyCode == KEY_HOME )
+ nSelect = 0;
+ else if ( nKeyCode == KEY_END )
+ nSelect = m_vEntries.size() - 1;
+ else if ( nKeyCode == KEY_PAGEUP )
+ nSelect = m_nActive - nPageSize + 1;
+ else if ( nKeyCode == KEY_PAGEDOWN )
+ nSelect = m_nActive + nPageSize - 1;
+ }
+ else // when there is no selected entry, we will select the first or the last.
+ {
+ if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_PAGEDOWN ) || ( nKeyCode == KEY_HOME ) )
+ nSelect = 0;
+ else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_PAGEUP ) || ( nKeyCode == KEY_END ) )
+ nSelect = m_vEntries.size() - 1;
+ }
+
+ if ( nSelect < 0 )
+ nSelect = 0;
+ if ( nSelect >= (long) m_vEntries.size() )
+ nSelect = m_vEntries.size() - 1;
+
+ selectEntry( nSelect );
+
+ return true;
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::Paint( const Rectangle &/*rPaintRect*/ )
+{
+ if ( !m_bInDelete )
+ DeleteRemoved();
+
+ if ( m_bNeedsRecalc )
+ RecalcAll();
+
+ Point aStart( 0, -m_nTopIndex );
+ Size aSize( GetOutputSizePixel() );
+
+ if ( m_bHasScrollBar )
+ aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ aSize.Height() = (*iIndex)->m_bActive ? m_nActiveHeight : m_nStdHeight;
+ Rectangle aEntryRect( aStart, aSize );
+ DrawRow( aEntryRect, *iIndex );
+ aStart.Y() += aSize.Height();
+ }
+}
+
+// -----------------------------------------------------------------------
+long ExtensionBox_Impl::GetTotalHeight() const
+{
+ long nHeight = m_vEntries.size() * m_nStdHeight;
+
+ if ( m_bHasActive )
+ {
+ nHeight += m_nActiveHeight - m_nStdHeight;
+ }
+
+ return nHeight;
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::SetupScrollBar()
+{
+ const Size aSize = GetOutputSizePixel();
+ const long nScrBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+ const long nTotalHeight = GetTotalHeight();
+ const bool bNeedsScrollBar = ( nTotalHeight > aSize.Height() );
+
+ if ( bNeedsScrollBar )
+ {
+ if ( m_nTopIndex + aSize.Height() > nTotalHeight )
+ m_nTopIndex = nTotalHeight - aSize.Height();
+
+ m_pScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
+ Size( nScrBarSize, aSize.Height() ) );
+ m_pScrollBar->SetRangeMax( nTotalHeight );
+ m_pScrollBar->SetVisibleSize( aSize.Height() );
+ m_pScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 );
+ m_pScrollBar->SetLineSize( m_nStdHeight );
+ m_pScrollBar->SetThumbPos( m_nTopIndex );
+
+ if ( !m_bHasScrollBar )
+ m_pScrollBar->Show();
+ }
+ else if ( m_bHasScrollBar )
+ {
+ m_pScrollBar->Hide();
+ m_nTopIndex = 0;
+ }
+
+ m_bHasScrollBar = bNeedsScrollBar;
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::Resize()
+{
+ RecalcAll();
+}
+
+//------------------------------------------------------------------------------
+long ExtensionBox_Impl::PointToPos( const Point& rPos )
+{
+ long nPos = ( rPos.Y() + m_nTopIndex ) / m_nStdHeight;
+
+ if ( m_bHasActive && ( nPos > m_nActive ) )
+ {
+ if ( rPos.Y() + m_nTopIndex <= m_nActive*m_nStdHeight + m_nActiveHeight )
+ nPos = m_nActive;
+ else
+ nPos = ( rPos.Y() + m_nTopIndex - (m_nActiveHeight - m_nStdHeight) ) / m_nStdHeight;
+ }
+
+ return nPos;
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ long nPos = PointToPos( rMEvt.GetPosPixel() );
+
+ if ( rMEvt.IsLeft() )
+ {
+ if ( rMEvt.IsMod1() && m_bHasActive )
+ selectEntry( m_vEntries.size() ); // Selecting an not existing entry will deselect the current one
+ else
+ selectEntry( nPos );
+ }
+}
+
+//------------------------------------------------------------------------------
+long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt )
+{
+ if ( !m_bInDelete )
+ DeleteRemoved();
+
+ bool bHandled = false;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ KeyCode aKeyCode = pKEvt->GetKeyCode();
+ USHORT nKeyCode = aKeyCode.GetCode();
+
+ if ( nKeyCode == KEY_TAB )
+ bHandled = HandleTabKey( aKeyCode.IsShift() );
+ else if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR )
+ bHandled = HandleCursorKey( nKeyCode );
+ }
+
+ if ( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ if ( m_bHasScrollBar &&
+ ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL ) )
+ {
+ const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
+ if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
+ {
+ long nThumbPos = m_pScrollBar->GetThumbPos();
+ if ( pData->GetDelta() < 0 )
+ m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight );
+ else
+ m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight );
+ bHandled = true;
+ }
+ }
+ }
+
+ if ( !bHandled )
+ return Control::Notify( rNEvt );
+ else
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStart,
+ const long nEnd, long &nPos )
+{
+ nPos = nStart;
+ if ( nStart > nEnd )
+ return false;
+
+ StringCompare eCompare;
+
+ if ( nStart == nEnd )
+ {
+ eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] );
+ if ( eCompare == COMPARE_LESS )
+ return false;
+ else if ( eCompare == COMPARE_EQUAL )
+ {
+ //Workaround. See i86963.
+ if (pEntry->m_xPackage != m_vEntries[nStart]->m_xPackage)
+ return false;
+
+ if ( m_bInCheckMode )
+ m_vEntries[ nStart ]->m_bChecked = true;
+ return true;
+ }
+ else
+ {
+ nPos = nStart + 1;
+ return false;
+ }
+ }
+
+ const long nMid = nStart + ( ( nEnd - nStart ) / 2 );
+ eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] );
+
+ if ( eCompare == COMPARE_LESS )
+ return FindEntryPos( pEntry, nStart, nMid-1, nPos );
+ else if ( eCompare == COMPARE_GREATER )
+ return FindEntryPos( pEntry, nMid+1, nEnd, nPos );
+ else
+ {
+ //Workaround.See i86963.
+ if (pEntry->m_xPackage != m_vEntries[nMid]->m_xPackage)
+ return false;
+
+ if ( m_bInCheckMode )
+ m_vEntries[ nMid ]->m_bChecked = true;
+ nPos = nMid;
+ return true;
+ }
+}
+
+//------------------------------------------------------------------------------
+long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage,
+ const uno::Reference< deployment::XPackageManager > &xPackageManager )
+{
+ long nPos = 0;
+ PackageState eState = m_pManager->getPackageState( xPackage );
+
+ TEntry_Impl pEntry( new Entry_Impl( xPackage, xPackageManager, eState ) );
+ xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
+
+ ::osl::ClearableMutexGuard guard(m_entriesMutex);
+ if ( m_vEntries.empty() )
+ {
+ pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
+ pEntry->m_bNew = m_bInCheckMode;
+ m_vEntries.push_back( pEntry );
+ }
+ else
+ {
+ if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) )
+ {
+ pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
+ pEntry->m_bNew = m_bInCheckMode;
+ m_vEntries.insert( m_vEntries.begin()+nPos, pEntry );
+ }
+ else if ( !m_bInCheckMode )
+ {
+ OSL_ENSURE( 0, "ExtensionBox_Impl::addEntry(): Will not add duplicate entries" );
+ }
+ }
+ //access to m_nActive must be guarded
+ if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) )
+ m_nActive += 1;
+
+ guard.clear();
+
+ if ( IsReallyVisible() )
+ Invalidate();
+
+ m_bNeedsRecalc = true;
+
+ return nPos;
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage > &xPackage )
+{
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_xPackage == xPackage )
+ {
+ PackageState eState = m_pManager->getPackageState( xPackage );
+ (*iIndex)->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ (*iIndex)->m_eState = eState;
+ (*iIndex)->m_sTitle = xPackage->getDisplayName();
+ (*iIndex)->m_sVersion = xPackage->getVersion();
+ (*iIndex)->m_sDescription = xPackage->getDescription();
+
+ if ( eState == AMBIGUOUS )
+ (*iIndex)->m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
+ else
+ (*iIndex)->m_sErrorText = String();
+
+ if ( IsReallyVisible() )
+ Invalidate();
+ break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::removeEntry( const uno::Reference< deployment::XPackage > &xPackage )
+{
+ if ( ! m_bInDelete )
+ {
+ ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_xPackage == xPackage )
+ {
+ long nPos = iIndex - m_vEntries.begin();
+
+ // Entries mustn't removed here, because they contain a hyperlink control
+ // which can only be deleted when the thread has the solar mutex. Therefor
+ // the entry will be moved into the m_vRemovedEntries list which will be
+ // cleared on the next paint event
+ m_vRemovedEntries.push_back( *iIndex );
+ m_vEntries.erase( iIndex );
+
+ m_bNeedsRecalc = true;
+
+ if ( IsReallyVisible() )
+ Invalidate();
+
+ if ( m_bHasActive )
+ {
+ if ( nPos < m_nActive )
+ m_nActive -= 1;
+ else if ( ( nPos == m_nActive ) &&
+ ( nPos == (long) m_vEntries.size() ) )
+ m_nActive -= 1;
+
+ m_bHasActive = false;
+ //clear before calling out of this method
+ aGuard.clear();
+ selectEntry( m_nActive );
+ }
+ break;
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::RemoveUnlocked()
+{
+ bool bAllRemoved = false;
+
+ while ( ! bAllRemoved )
+ {
+ bAllRemoved = true;
+
+ ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( !(*iIndex)->m_bLocked )
+ {
+ bAllRemoved = false;
+ uno::Reference< deployment::XPackage> xPackage = (*iIndex)->m_xPackage;
+ aGuard.clear();
+ removeEntry( xPackage );
+ break;
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr )
+{
+ m_bInCheckMode = true;
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_xPackageManager == xPackageMgr )
+ (*iIndex)->m_bChecked = false;
+ else
+ (*iIndex)->m_bChecked = true;
+ (*iIndex)->m_bNew = false;
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::checkEntries()
+{
+ long nNewPos = -1;
+ long nPos = 0;
+ bool bNeedsUpdate = false;
+
+ ::osl::ClearableMutexGuard guard(m_entriesMutex);
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ ITER iIndex = m_vEntries.begin();
+ while ( iIndex < m_vEntries.end() )
+ {
+ if ( (*iIndex)->m_bChecked == false )
+ {
+ bNeedsUpdate = true;
+ nPos = iIndex-m_vEntries.begin();
+ if ( (*iIndex)->m_bNew )
+ {
+ if ( nNewPos == - 1)
+ nNewPos = nPos;
+ if ( nPos <= m_nActive )
+ m_nActive += 1;
+ }
+ }
+ iIndex++;
+ }
+ guard.clear();
+
+ m_bInCheckMode = false;
+
+ if ( nNewPos != - 1)
+ selectEntry( nNewPos );
+
+ if ( bNeedsUpdate )
+ {
+ m_bNeedsRecalc = true;
+ if ( IsReallyVisible() )
+ Invalidate();
+ }
+}
+//------------------------------------------------------------------------------
+bool ExtensionBox_Impl::isHCMode()
+{
+ return (bool)GetSettings().GetStyleSettings().GetHighContrastMode();
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::SetScrollHdl( const Link& rLink )
+{
+ if ( m_pScrollBar )
+ m_pScrollBar->SetScrollHdl( rLink );
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::DoScroll( long nDelta )
+{
+ m_nTopIndex += nDelta;
+ Point aNewSBPt( m_pScrollBar->GetPosPixel() );
+
+ Rectangle aScrRect( Point(), GetOutputSizePixel() );
+ aScrRect.Right() -= m_pScrollBar->GetSizePixel().Width();
+ Scroll( 0, -nDelta, aScrRect );
+
+ m_pScrollBar->SetPosPixel( aNewSBPt );
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( ExtensionBox_Impl, ScrollHdl, ScrollBar*, pScrBar )
+{
+ DoScroll( pScrBar->GetDelta() );
+
+ return 1;
+}
+
+} //namespace dp_gui
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
index 8e85960bd5..2749db99ce 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
@@ -1,5 +1,5 @@
-/*************************************************************************
- *
+/*************************************************************************
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -23,245 +23,245 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/
-
-#include "rtl/ustring.hxx"
-#include "vcl/scrbar.hxx"
-#include "vcl/fixed.hxx"
-#include "vcl/dialog.hxx"
-
-#include "svtools/extensionlistbox.hxx"
-#include "svtools/fixedhyper.hxx"
-#include "cppuhelper/implbase1.hxx"
-#include "unotools/collatorwrapper.hxx"
-
-#include "com/sun/star/lang/Locale.hpp"
-#include "com/sun/star/lang/XEventListener.hpp"
-#include "com/sun/star/deployment/XPackage.hpp"
-#include "com/sun/star/deployment/XPackageManager.hpp"
-
-#include <boost/shared_ptr.hpp>
-
-namespace dp_gui {
-
-#define SMALL_ICON_SIZE 16
-#define TOP_OFFSET 3
-#define ICON_HEIGHT 42
-#define ICON_OFFSET 50
-#define RIGHT_ICON_OFFSET 5
-#define SPACE_BETWEEN 3
-
-class TheExtensionManager;
-
-typedef ::boost::shared_ptr< svt::FixedHyperlink > TFixedHyperlink;
-
-//------------------------------------------------------------------------------
-// struct Entry_Impl
-//------------------------------------------------------------------------------
-struct Entry_Impl;
-
-typedef ::boost::shared_ptr< Entry_Impl > TEntry_Impl;
-
-struct Entry_Impl
-{
- bool m_bActive;
- bool m_bLocked;
- bool m_bHasOptions;
- bool m_bShared;
- bool m_bNew;
- bool m_bChecked;
- bool m_bMissingDeps;
- PackageState m_eState;
- String m_sTitle;
- String m_sVersion;
- String m_sDescription;
- String m_sPublisher;
- String m_sPublisherURL;
- String m_sErrorText;
- Image m_aIcon;
- Image m_aIconHC;
- svt::FixedHyperlink *m_pPublisher;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage;
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager;
-
- Entry_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
- PackageState eState );
- ~Entry_Impl();
-
- StringCompare CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const;
- void checkDependencies();
-};
-
-//------------------------------------------------------------------------------
-// class ExtensionBox_Impl
-//------------------------------------------------------------------------------
-
-class ExtensionBox_Impl;
-
-//------------------------------------------------------------------------------
-class ExtensionRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
-{
- ExtensionBox_Impl *m_pParent;
-
-public:
-
- ExtensionRemovedListener( ExtensionBox_Impl *pParent ) { m_pParent = pParent; }
- ~ExtensionRemovedListener();
-
- //===================================================================================
- // XEventListener
- virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt )
- throw (::com::sun::star::uno::RuntimeException);
-};
-
-//------------------------------------------------------------------------------
-class ExtensionBox_Impl : public ::svt::IExtensionListBox
-{
- bool m_bHasScrollBar;
- bool m_bHasActive;
- bool m_bNeedsRecalc;
- bool m_bHasNew;
- bool m_bInCheckMode;
- bool m_bAdjustActive;
- bool m_bInDelete;
- //Must be guarded together with m_vEntries to ensure a valid index at all times.
- //Use m_entriesMutex as guard.
- long m_nActive;
- long m_nTopIndex;
- long m_nStdHeight;
- long m_nActiveHeight;
- long m_nExtraHeight;
- Size m_aOutputSize;
- Image m_aLockedImage;
- Image m_aLockedImageHC;
- Image m_aWarningImage;
- Image m_aWarningImageHC;
- Image m_aDefaultImage;
- Image m_aDefaultImageHC;
- Link m_aClickHdl;
-
- ScrollBar *m_pScrollBar;
-
- com::sun::star::uno::Reference< ExtensionRemovedListener > m_xRemoveListener;
-
- TheExtensionManager *m_pManager;
- //This mutex is used for synchronizing access to m_vEntries.
- //Currently it is used to synchronize adding, removing entries and
- //functions like getItemName, getItemDescription, etc. to prevent
- //that m_vEntries is accessed at an invalid index.
- //ToDo: There are many more places where m_vEntries is read and which may
- //fail. For example the Paint method is probable called from the main thread
- //while new entries are added / removed in a separate thread.
- mutable ::osl::Mutex m_entriesMutex;
- std::vector< TEntry_Impl > m_vEntries;
- std::vector< TEntry_Impl > m_vRemovedEntries;
-
- ::com::sun::star::lang::Locale *m_pLocale;
- CollatorWrapper *m_pCollator;
-
- void CalcActiveHeight( const long nPos );
- long GetTotalHeight() const;
- void SetupScrollBar();
- void DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry );
- bool HandleTabKey( bool bReverse );
- bool HandleCursorKey( USHORT nKeyCode );
- bool FindEntryPos( const TEntry_Impl pEntry, long nStart, long nEnd, long &nFound );
- bool isHCMode();
- void DeleteRemoved();
-
- //-----------------
- DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
-
- //Index starts with 1.
- //Throws an com::sun::star::lang::IllegalArgumentException, when the index is invalid.
- void checkIndex(sal_Int32 pos) const;
-
-
-public:
- ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager );
- ~ExtensionBox_Impl();
-
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void Paint( const Rectangle &rPaintRect );
- virtual void Resize();
- virtual long Notify( NotifyEvent& rNEvt );
-
- const Size GetMinOutputSizePixel() const;
- void SetExtraSize( long nSize ) { m_nExtraHeight = nSize; }
- TEntry_Impl GetEntryData( long nPos ) { return m_vEntries[ nPos ]; }
- long GetEntryCount() { return (long) m_vEntries.size(); }
- Rectangle GetEntryRect( const long nPos ) const;
- bool HasActive() { return m_bHasActive; }
- long PointToPos( const Point& rPos );
- void SetScrollHdl( const Link& rLink );
- void DoScroll( long nDelta );
- void SetHyperlinkHdl( const Link& rLink ){ m_aClickHdl = rLink; }
- virtual void RecalcAll();
- void RemoveUnlocked();
-
- //-----------------
- virtual void selectEntry( const long nPos );
- long addEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
- void updateEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- void removeEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
-
- void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageMgr );
- void checkEntries();
-
- TheExtensionManager* getExtensionManager() const { return m_pManager; }
-
- //===================================================================================
- //These functions are used for automatic testing
-
- /** @return The count of the entries in the list box. */
- virtual sal_Int32 getItemCount() const;
-
- /** @return The index of the first selected entry in the list box.
- When nothing is selected, which is the case when getItemCount returns '0',
- then this function returns EXTENSION_LISTBOX_ENTRY_NOTFOUND */
- virtual sal_Int32 getSelIndex() const;
-
- /** @return The item name of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemName( sal_Int32 index ) const;
-
- /** @return The version string of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemVersion( sal_Int32 index ) const;
-
- /** @return The description string of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemDescription( sal_Int32 index ) const;
-
- /** @return The publisher string of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemPublisher( sal_Int32 index ) const;
-
- /** @return The link behind the publisher text of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemPublisherLink( sal_Int32 index ) const;
-
- /** The entry at the given position will be selected
- Index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual void select( sal_Int32 pos );
-
- /** The first found entry with the given name will be selected
- When there was no entry found with the name, the selection doesn't change.
- Please note that there might be more than one entry with the same
- name, because:
- 1. the name is not unique
- 2. one extension can be installed as user and shared extension.
- */
- virtual void select( const ::rtl::OUString & sName );
-};
-
-}
+ ************************************************************************/
+
+#include "rtl/ustring.hxx"
+#include "vcl/scrbar.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/dialog.hxx"
+
+#include "svtools/extensionlistbox.hxx"
+#include "svtools/fixedhyper.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "unotools/collatorwrapper.hxx"
+
+#include "com/sun/star/lang/Locale.hpp"
+#include "com/sun/star/lang/XEventListener.hpp"
+#include "com/sun/star/deployment/XPackage.hpp"
+#include "com/sun/star/deployment/XPackageManager.hpp"
+
+#include <boost/shared_ptr.hpp>
+
+namespace dp_gui {
+
+#define SMALL_ICON_SIZE 16
+#define TOP_OFFSET 3
+#define ICON_HEIGHT 42
+#define ICON_OFFSET 50
+#define RIGHT_ICON_OFFSET 5
+#define SPACE_BETWEEN 3
+
+class TheExtensionManager;
+
+typedef ::boost::shared_ptr< svt::FixedHyperlink > TFixedHyperlink;
+
+//------------------------------------------------------------------------------
+// struct Entry_Impl
+//------------------------------------------------------------------------------
+struct Entry_Impl;
+
+typedef ::boost::shared_ptr< Entry_Impl > TEntry_Impl;
+
+struct Entry_Impl
+{
+ bool m_bActive;
+ bool m_bLocked;
+ bool m_bHasOptions;
+ bool m_bShared;
+ bool m_bNew;
+ bool m_bChecked;
+ bool m_bMissingDeps;
+ PackageState m_eState;
+ String m_sTitle;
+ String m_sVersion;
+ String m_sDescription;
+ String m_sPublisher;
+ String m_sPublisherURL;
+ String m_sErrorText;
+ Image m_aIcon;
+ Image m_aIconHC;
+ svt::FixedHyperlink *m_pPublisher;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager;
+
+ Entry_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
+ PackageState eState );
+ ~Entry_Impl();
+
+ StringCompare CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const;
+ void checkDependencies();
+};
+
+//------------------------------------------------------------------------------
+// class ExtensionBox_Impl
+//------------------------------------------------------------------------------
+
+class ExtensionBox_Impl;
+
+//------------------------------------------------------------------------------
+class ExtensionRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+{
+ ExtensionBox_Impl *m_pParent;
+
+public:
+
+ ExtensionRemovedListener( ExtensionBox_Impl *pParent ) { m_pParent = pParent; }
+ ~ExtensionRemovedListener();
+
+ //===================================================================================
+ // XEventListener
+ virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+//------------------------------------------------------------------------------
+class ExtensionBox_Impl : public ::svt::IExtensionListBox
+{
+ bool m_bHasScrollBar;
+ bool m_bHasActive;
+ bool m_bNeedsRecalc;
+ bool m_bHasNew;
+ bool m_bInCheckMode;
+ bool m_bAdjustActive;
+ bool m_bInDelete;
+ //Must be guarded together with m_vEntries to ensure a valid index at all times.
+ //Use m_entriesMutex as guard.
+ long m_nActive;
+ long m_nTopIndex;
+ long m_nStdHeight;
+ long m_nActiveHeight;
+ long m_nExtraHeight;
+ Size m_aOutputSize;
+ Image m_aLockedImage;
+ Image m_aLockedImageHC;
+ Image m_aWarningImage;
+ Image m_aWarningImageHC;
+ Image m_aDefaultImage;
+ Image m_aDefaultImageHC;
+ Link m_aClickHdl;
+
+ ScrollBar *m_pScrollBar;
+
+ com::sun::star::uno::Reference< ExtensionRemovedListener > m_xRemoveListener;
+
+ TheExtensionManager *m_pManager;
+ //This mutex is used for synchronizing access to m_vEntries.
+ //Currently it is used to synchronize adding, removing entries and
+ //functions like getItemName, getItemDescription, etc. to prevent
+ //that m_vEntries is accessed at an invalid index.
+ //ToDo: There are many more places where m_vEntries is read and which may
+ //fail. For example the Paint method is probable called from the main thread
+ //while new entries are added / removed in a separate thread.
+ mutable ::osl::Mutex m_entriesMutex;
+ std::vector< TEntry_Impl > m_vEntries;
+ std::vector< TEntry_Impl > m_vRemovedEntries;
+
+ ::com::sun::star::lang::Locale *m_pLocale;
+ CollatorWrapper *m_pCollator;
+
+ void CalcActiveHeight( const long nPos );
+ long GetTotalHeight() const;
+ void SetupScrollBar();
+ void DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry );
+ bool HandleTabKey( bool bReverse );
+ bool HandleCursorKey( USHORT nKeyCode );
+ bool FindEntryPos( const TEntry_Impl pEntry, long nStart, long nEnd, long &nFound );
+ bool isHCMode();
+ void DeleteRemoved();
+
+ //-----------------
+ DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
+
+ //Index starts with 1.
+ //Throws an com::sun::star::lang::IllegalArgumentException, when the index is invalid.
+ void checkIndex(sal_Int32 pos) const;
+
+
+public:
+ ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager );
+ ~ExtensionBox_Impl();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle &rPaintRect );
+ virtual void Resize();
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ const Size GetMinOutputSizePixel() const;
+ void SetExtraSize( long nSize ) { m_nExtraHeight = nSize; }
+ TEntry_Impl GetEntryData( long nPos ) { return m_vEntries[ nPos ]; }
+ long GetEntryCount() { return (long) m_vEntries.size(); }
+ Rectangle GetEntryRect( const long nPos ) const;
+ bool HasActive() { return m_bHasActive; }
+ long PointToPos( const Point& rPos );
+ void SetScrollHdl( const Link& rLink );
+ void DoScroll( long nDelta );
+ void SetHyperlinkHdl( const Link& rLink ){ m_aClickHdl = rLink; }
+ virtual void RecalcAll();
+ void RemoveUnlocked();
+
+ //-----------------
+ virtual void selectEntry( const long nPos );
+ long addEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ void updateEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+ void removeEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+
+ void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageMgr );
+ void checkEntries();
+
+ TheExtensionManager* getExtensionManager() const { return m_pManager; }
+
+ //===================================================================================
+ //These functions are used for automatic testing
+
+ /** @return The count of the entries in the list box. */
+ virtual sal_Int32 getItemCount() const;
+
+ /** @return The index of the first selected entry in the list box.
+ When nothing is selected, which is the case when getItemCount returns '0',
+ then this function returns EXTENSION_LISTBOX_ENTRY_NOTFOUND */
+ virtual sal_Int32 getSelIndex() const;
+
+ /** @return The item name of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemName( sal_Int32 index ) const;
+
+ /** @return The version string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemVersion( sal_Int32 index ) const;
+
+ /** @return The description string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemDescription( sal_Int32 index ) const;
+
+ /** @return The publisher string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemPublisher( sal_Int32 index ) const;
+
+ /** @return The link behind the publisher text of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemPublisherLink( sal_Int32 index ) const;
+
+ /** The entry at the given position will be selected
+ Index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual void select( sal_Int32 pos );
+
+ /** The first found entry with the given name will be selected
+ When there was no entry found with the name, the selection doesn't change.
+ Please note that there might be more than one entry with the same
+ name, because:
+ 1. the name is not unique
+ 2. one extension can be installed as user and shared extension.
+ */
+ virtual void select( const ::rtl::OUString & sName );
+};
+
+}
diff --git a/desktop/source/registration/com/sun/star/servicetag/RegistrationData.java b/desktop/source/registration/com/sun/star/servicetag/RegistrationData.java
index c58d83a33d..9323e5de7e 100644
--- a/desktop/source/registration/com/sun/star/servicetag/RegistrationData.java
+++ b/desktop/source/registration/com/sun/star/servicetag/RegistrationData.java
@@ -1,531 +1,531 @@
-
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License"). You
- * may not use this file except in compliance with the License. You can obtain
- * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
- * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
- * Sun designates this particular file as subject to the "Classpath" exception
- * as provided by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the License
- * Header, with the fields enclosed by brackets [] replaced by your own
- * identifying information: "Portions Copyrighted [year]
- * [name of copyright owner]"
- *
- * Contributor(s):
- *
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license." If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above. However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package com.sun.star.servicetag;
-
-import java.io.*;
-import java.net.UnknownHostException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-import static com.sun.star.servicetag.RegistrationDocument.*;
-
-/**
- * A {@code RegistrationData} object is a container of one or more
- * {@link #getServiceTags service tags} that identify the
- * components for product registration.
- * Each {@code RegistrationData} object has a {@link #getRegistrationURN
- * uniform resource name} (URN) as its identifier.
- * <a name="EnvMap"></a>
- * It also has an <i>environment map</i> with
- * the following elements:
- * <blockquote>
- * <table border=0>
- * <tr>
- * <td><tt>hostname</tt></td>
- * <td>Hostname of the system</td>
- * <td>e.g. woody</td>
- * </tr>
- * <tr>
- * <td><tt>hostId</tt></td>
- * <td>Host ID of the system</td>
- * <td>e.g. 83abc1ab</td>
- * </tr>
- * <tr>
- * <td><tt>osName</tt></td>
- * <td>Operating system name</td>
- * <td> e.g. SunOS</td>
- * </tr>
- * <tr>
- * <td><tt>osVersion</tt></td>
- * <td>Operating system version</td>
- * <td> e.g. 5.10</td>
- * </tr>
- * <tr>
- * <td><tt>osArchitecture</tt></td>
- * <td>Operating system architecture</td>
- * <td> e.g. sparc</td>
- * </tr>
- * <tr>
- * <td><tt>systemModel</tt></td>
- * <td>System model</td>
- * <td> e.g. SUNW,Sun-Fire-V440</td>
- * </tr>
- * <tr>
- * <td><tt>systemManufacturer</tt></td>
- * <td>System manufacturer</td>
- * <td> e.g. Sun Microsystems</td>
- * </tr>
- * <tr>
- * <td><tt>cpuManufacturer</tt></td>
- * <td>CPU manufacturer</td>
- * <td> e.g. Sun Microsystems</td>
- * </tr>
- * <tr>
- * <td><tt>serialNumber</tt></td>
- * <td>System serial number</td>
- * <td> e.g. BEL078932</td>
- * </tr>
- * <tr>
- * <td><tt>physmem</tt></td>
- * <td>Physical memory for the system (in MB)</td>
- * <td> e.g. 4096</td>
- * </tr>
- * </table>
- * </blockquote>
- * The <tt>hostname</tt> and <tt>osName</tt> element must have a non-empty value.
- * If an element is not available on a system and their value will be
- * empty.
- * <p>
- * <a name="XMLSchema">
- * <b>Registration XML Schema</b></a>
- * <p>
- * A {@code RegistrationData} object can be {@link #loadFromXML loaded} from
- * and {@link #storeToXML stored} into an XML file in the format described
- * by the
- * <a href="https://sn-tools.central.sun.com/twiki/pub/ServiceTags/RegistrationRelayService/product_registration.xsd">
- * registration data schema</a>. The registration data schema is defined by the
- * Service Tags Technology.
- * <p>
- * Typically the registration data is constructed at installation time
- * and stored in an XML file for later service tag lookup or registration.
- *
- * <p>
- * <b>Example Usage</b>
- * <p>
- * The examples below show how the {@code RegistrationData} can be
- * used for product registration.
- * Exception handling is not shown in these examples for clarity.
- * <ol>
- * <li>This example shows how the JDK creates a JDK service tag, installs it
- * in the system service tag registry and adds it to the registration data.
- * <br>
- * <blockquote><pre>
- * // create a service tag object with an instance_urn
- * ServiceTag st = ServiceTag.newInstance(ServiceTag.generateInstanceURN(),
- * ....);
- * // Adds to the system service tag registry if supported
- * if (Registry.isSupported()) {
- * Registry.getSystemRegistry().addServiceTag(st);
- * }
- *
- * // add to the registration data
- * RegistrationData registration = new RegistrationData();
- * registration.addServiceTag(st);
- * </pre></blockquote>
- * </li>
- * <li>At this point, the registration data is ready to
- * send to Sun Connection for registration. This example shows how to register
- * the JDK via the <i>Registration Relay Service</i>.
- * <p>
- * There are several registration services for Sun Connection. For example,
- * the <a href="https://sn-tools.central.sun.com/twiki/bin/view/ServiceTags/RegistrationRelayService">
- * Registration Relay Service</a> is a web application interface that
- * processes the registration data payload sent via HTTP post
- * and hosts the registration user interface for a specified
- * registration URL. Refer to the
- * Registration Relay Service Specification for details.
- * <p>
- * <blockquote><pre>
- * // Open the connection to the URL of the registration service
- * HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
- * con.setDoInput(true);
- * con.setDoOutput(true);
- * con.setUseCaches(false);
- * con.setAllowUserInteraction(false);
- * con.setRequestMethod("POST");
- * con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\"");
- * con.connect();
- *
- * // send the registration data to the registration service
- * OutputStream out = con.getOutputStream();
- * registration.storeToXML(out);
- * out.close();
- * </pre></blockquote>
- * </li>
- * <li>This example shows how to store the registration data in an XML file.
- * for later service tag lookup or registration.
- * <br>
- * <blockquote><pre>
- * BufferedOutputStream out = new BufferedOutputStream(
- * new FileOutputStream(""&lt;JAVA_HOME&gt;/lib/servicetag/registration.xml"));
- * registration.storeToXML(out);
- * out.close();
- * </pre></blockquote>
- * </li>
- * <li>This example shows how to install service tags that are in the
- * registration data in the system service tag registry when determined
- * to be available. The system service tag registry might not have existed
- * when the registration data was constructed.
- * <br>
- * <blockquote><pre>
- * if (Registry.isSupported()) {
- * Set&lt;ServiceTag&gt; svctags = registration.getServiceTags();
- * for (ServiceTag st : svctags) {
- * Registry.getSystemRegistry().addServiceTag(st);
- * }
- * }
- * </pre></blockquote>
- * </li>
- * </ol>
- *
- * @see <a href="https://sunconnection.sun.com/inventory">Sun Connection Inventory Channel</a>
- */
-public class RegistrationData {
- private final Map<String, String> environment;
- private final Map<String, String> cpuInfo;
- private final Map<String, ServiceTag> svcTagMap;
- private final String urn;
-
- /**
- * Creates a {@code RegistrationData} object with a generated
- * {@link #getRegistrationURN registration URN}.
- * The following keys in the {@link #getEnvironmentMap environment map}
- * will be initialized for the configuration of the
- * running system:
- * <blockquote>
- * <tt>hostname</tt>, <tt>osName</tt>, <tt>osVersion</tt> and
- * <tt>osArchitecture</tt>
- * </blockquote>
- * and the value of other keys may be empty.
- */
- public RegistrationData() {
- this(Util.generateURN());
- }
-
- // package private
- RegistrationData(String urn) {
- this.urn = urn;
- SystemEnvironment sysEnv = SystemEnvironment.getSystemEnvironment();
- this.environment = initEnvironment(sysEnv);
- this.cpuInfo = initCpuInfo(sysEnv);
- this.svcTagMap = new LinkedHashMap<String, ServiceTag>();
- }
-
- private Map<String, String> initEnvironment(SystemEnvironment sysEnv) {
- Map<String, String> map = new LinkedHashMap<String, String>();
- map.put(ST_NODE_HOSTNAME, sysEnv.getHostname());
- map.put(ST_NODE_HOST_ID, sysEnv.getHostId());
- map.put(ST_NODE_OS_NAME, sysEnv.getOsName());
- map.put(ST_NODE_OS_VERSION, sysEnv.getOsVersion());
- map.put(ST_NODE_OS_ARCH, sysEnv.getOsArchitecture());
- map.put(ST_NODE_SYSTEM_MODEL, sysEnv.getSystemModel());
- map.put(ST_NODE_SYSTEM_MANUFACTURER, sysEnv.getSystemManufacturer());
- map.put(ST_NODE_CPU_MANUFACTURER, sysEnv.getCpuManufacturer());
- map.put(ST_NODE_SERIAL_NUMBER, sysEnv.getSerialNumber());
- map.put(ST_NODE_PHYS_MEM, sysEnv.getPhysMem());
- return map;
- }
-
- private Map<String, String> initCpuInfo(SystemEnvironment sysEnv) {
- Map<String, String> map = new LinkedHashMap<String, String>();
- map.put(ST_NODE_SOCKETS, sysEnv.getSockets());
- map.put(ST_NODE_CORES, sysEnv.getCores());
- map.put(ST_NODE_VIRT_CPUS, sysEnv.getVirtCpus());
- map.put(ST_NODE_CPU_NAME, sysEnv.getCpuName());
- map.put(ST_NODE_CLOCK_RATE, sysEnv.getClockRate());
- return map;
- }
-
- /**
- * Returns the uniform resource name of this registration data
- * in this format:
- * <tt>urn:st:&lt;32-char {@link java.util.UUID uuid}&gt;</tt>
- *
- * @return the URN of this registration data.
- */
- public String getRegistrationURN() {
- return urn;
- }
-
- /**
- * Returns a map containing the environment information for this
- * registration data. See the set of <a href="#EnvMap">keys</a>
- * in the environment map. Subsequent update to the environment
- * map via the {@link #setEnvironment setEnvironment} method will not be reflected
- * in the returned map.
- *
- * @return an environment map for this registration data.
- */
- public Map<String, String> getEnvironmentMap() {
- return new LinkedHashMap<String,String>(environment);
- }
-
- /**
- * Returns a map containing the cpu information for this
- * registration data. Subsequent update to the cpu info
- * map via the {@link #setCpuInfo setCpuInfo} method will not be reflected
- * in the returned map.
- *
- * @return a cpu info map for this registration data.
- */
- public Map<String, String> getCpuInfoMap() {
- return new LinkedHashMap<String,String>(cpuInfo);
- }
-
- /**
- * Sets an element of the specified {@code name} in the environment map
- * with the given {@code value}.
- *
- * @throws IllegalArgumentException if {@code name} is not a valid key
- * in the environment map, or {@code value} is not valid.
- */
- public void setEnvironment(String name, String value) {
- if (name == null) {
- throw new NullPointerException("name is null");
- }
- if (value == null) {
- throw new NullPointerException("value is null");
- }
- if (environment.containsKey(name)) {
- if (name.equals(ST_NODE_HOSTNAME) || name.equals(ST_NODE_OS_NAME)) {
- if (value.length() == 0) {
- throw new IllegalArgumentException("\"" +
- name + "\" requires non-empty value.");
- }
- }
- environment.put(name, value);
- } else {
- throw new IllegalArgumentException("\"" +
- name + "\" is not an environment element.");
- }
- }
-
- /**
- * Sets an element of the specified {@code name} in the cpu info map
- * with the given {@code value}.
- *
- * @throws IllegalArgumentException if {@code name} is not a valid key
- * in the cpu info map, or {@code value} is not valid.
- */
- public void setCpuInfo(String name, String value) {
- if (name == null) {
- throw new NullPointerException("name is null");
- }
- if (value == null) {
- throw new NullPointerException("value is null");
- }
- if (cpuInfo.containsKey(name)) {
- cpuInfo.put(name, value);
- } else {
- throw new IllegalArgumentException("\"" +
- name + "\" is not an cpuinfo element.");
- }
- }
-
- /**
- * Returns all service tags in this registration data.
- *
- * @return a {@link Set Set} of the service tags
- * in this registration data.
- */
- public Set<ServiceTag> getServiceTags() {
- return new HashSet<ServiceTag>(svcTagMap.values());
- }
-
- /**
- * Adds a service tag to this registration data.
- * If the given service tag has an empty <tt>instance_urn</tt>,
- * this method will generate a URN and place it in the copy
- * of the service tag in this registration data.
- * This method will return the {@code ServiceTag} object
- * added to this registration data.
- *
- * @param st {@code ServiceTag} object to be added.
- * @return a {@code ServiceTag} object added to this registration data.
- *
- * @throws IllegalArgumentException if
- * a service tag of the same {@link ServiceTag#getInstanceURN
- * <tt>instance_urn</tt>} already exists in the registry.
- */
- public synchronized ServiceTag addServiceTag(ServiceTag st) {
- ServiceTag svcTag = ServiceTag.newInstanceWithUrnTimestamp(st);
-
- String instanceURN = svcTag.getInstanceURN();
- if (svcTagMap.containsKey(instanceURN)) {
- throw new IllegalArgumentException("Instance_urn = " + instanceURN +
- " already exists in the registration data.");
- } else {
- svcTagMap.put(instanceURN, svcTag);
- }
- return svcTag;
- }
-
- /**
- * Returns a service tag of the given <tt>instance_urn</tt> in this registration
- * data.
- *
- * @param instanceURN the <tt>instance_urn</tt> of the service tag
- * @return the {@code ServiceTag} object of the given <tt>instance_urn</tt>
- * if exists; otherwise return {@code null}.
- */
- public synchronized ServiceTag getServiceTag(String instanceURN) {
- if (instanceURN == null) {
- throw new NullPointerException("instanceURN is null");
- }
- return svcTagMap.get(instanceURN);
- }
-
- /**
- * Removes a service tag of the given <tt>instance_urn</tt> from this
- * registration data.
- *
- * @param instanceURN the <tt>instance_urn</tt> of
- * the service tag to be removed.
- *
- * @return the removed {@code ServiceTag} object;
- * or {@code null} if the service tag does not exist in this
- * registration data.
- */
- public synchronized ServiceTag removeServiceTag(String instanceURN) {
- if (instanceURN == null) {
- throw new NullPointerException("instanceURN is null");
- }
-
- ServiceTag svcTag = null;
- if (svcTagMap.containsKey(instanceURN)) {
- svcTag = svcTagMap.remove(instanceURN);
- }
- return svcTag;
- }
-
- /**
- * Updates the <tt>product_defined_instance_id</tt> in the service tag
- * of the given <tt>instance_urn</tt> in this registration data.
- *
- * @param instanceURN the <tt>instance_urn</tt> of the service tag to be updated.
- * @param productDefinedInstanceID the value of the
- * <tt>product_defined_instance_id</tt> to be set.
- *
- * @return the updated {@code ServiceTag} object;
- * or {@code null} if the service tag does not exist in this
- * registration data.
- */
- public synchronized ServiceTag updateServiceTag(String instanceURN,
- String productDefinedInstanceID) {
- ServiceTag svcTag = getServiceTag(instanceURN);
- if (svcTag == null) {
- return null;
- }
-
- svcTag = ServiceTag.newInstanceWithUrnTimestamp(svcTag);
- // update the product defined instance ID field
- svcTag.setProductDefinedInstanceID(productDefinedInstanceID);
- svcTagMap.put(instanceURN, svcTag);
- return svcTag;
- }
-
- /**
- * Reads the registration data from the XML document on the
- * specified input stream. The XML document must be
- * in the format described by the <a href="#XMLSchema">
- * registration data schema</a>.
- * The specified stream is closed after this method returns.
- *
- * @param in the input stream from which to read the XML document.
- * @return a {@code RegistrationData} object read from the input
- * stream.
- *
- * @throws IllegalArgumentException if the input stream
- * contains an invalid registration data.
- *
- * @throws IOException if an error occurred when reading from the input stream.
- */
- public static RegistrationData loadFromXML(InputStream in) throws IOException {
- try {
- return RegistrationDocument.load(in);
- } finally {
- in.close();
- }
- }
-
- /**
- * Writes the registration data to the specified output stream
- * in the format described by the <a href="#XMLSchema">
- * registration data schema</a> with "UTF-8" encoding.
- * The specified stream remains open after this method returns.
- *
- * @param os the output stream on which to write the XML document.
- *
- * @throws IOException if an error occurred when writing to the output stream.
- */
- public void storeToXML(OutputStream os) throws IOException {
- RegistrationDocument.store(os, this);
- os.flush();
- }
-
- /**
- * Returns a newly allocated byte array containing the registration
- * data in XML format.
- *
- * @return a newly allocated byte array containing the registration
- * data in XML format.
- */
- public byte[] toXML() {
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- storeToXML(out);
- return out.toByteArray();
- } catch (IOException e) {
- // should not reach here
- return new byte[0];
- }
- }
-
- /**
- * Returns a string representation of this registration data in XML
- * format.
- *
- * @return a string representation of this registration data in XML
- * format.
- */
- @Override
- public String toString() {
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- storeToXML(out);
- return out.toString("UTF-8");
- } catch (IOException e) {
- // should not reach here
- return "Error creating the return string.";
- }
- }
-}
+
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+
+package com.sun.star.servicetag;
+
+import java.io.*;
+import java.net.UnknownHostException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import static com.sun.star.servicetag.RegistrationDocument.*;
+
+/**
+ * A {@code RegistrationData} object is a container of one or more
+ * {@link #getServiceTags service tags} that identify the
+ * components for product registration.
+ * Each {@code RegistrationData} object has a {@link #getRegistrationURN
+ * uniform resource name} (URN) as its identifier.
+ * <a name="EnvMap"></a>
+ * It also has an <i>environment map</i> with
+ * the following elements:
+ * <blockquote>
+ * <table border=0>
+ * <tr>
+ * <td><tt>hostname</tt></td>
+ * <td>Hostname of the system</td>
+ * <td>e.g. woody</td>
+ * </tr>
+ * <tr>
+ * <td><tt>hostId</tt></td>
+ * <td>Host ID of the system</td>
+ * <td>e.g. 83abc1ab</td>
+ * </tr>
+ * <tr>
+ * <td><tt>osName</tt></td>
+ * <td>Operating system name</td>
+ * <td> e.g. SunOS</td>
+ * </tr>
+ * <tr>
+ * <td><tt>osVersion</tt></td>
+ * <td>Operating system version</td>
+ * <td> e.g. 5.10</td>
+ * </tr>
+ * <tr>
+ * <td><tt>osArchitecture</tt></td>
+ * <td>Operating system architecture</td>
+ * <td> e.g. sparc</td>
+ * </tr>
+ * <tr>
+ * <td><tt>systemModel</tt></td>
+ * <td>System model</td>
+ * <td> e.g. SUNW,Sun-Fire-V440</td>
+ * </tr>
+ * <tr>
+ * <td><tt>systemManufacturer</tt></td>
+ * <td>System manufacturer</td>
+ * <td> e.g. Sun Microsystems</td>
+ * </tr>
+ * <tr>
+ * <td><tt>cpuManufacturer</tt></td>
+ * <td>CPU manufacturer</td>
+ * <td> e.g. Sun Microsystems</td>
+ * </tr>
+ * <tr>
+ * <td><tt>serialNumber</tt></td>
+ * <td>System serial number</td>
+ * <td> e.g. BEL078932</td>
+ * </tr>
+ * <tr>
+ * <td><tt>physmem</tt></td>
+ * <td>Physical memory for the system (in MB)</td>
+ * <td> e.g. 4096</td>
+ * </tr>
+ * </table>
+ * </blockquote>
+ * The <tt>hostname</tt> and <tt>osName</tt> element must have a non-empty value.
+ * If an element is not available on a system and their value will be
+ * empty.
+ * <p>
+ * <a name="XMLSchema">
+ * <b>Registration XML Schema</b></a>
+ * <p>
+ * A {@code RegistrationData} object can be {@link #loadFromXML loaded} from
+ * and {@link #storeToXML stored} into an XML file in the format described
+ * by the
+ * <a href="https://sn-tools.central.sun.com/twiki/pub/ServiceTags/RegistrationRelayService/product_registration.xsd">
+ * registration data schema</a>. The registration data schema is defined by the
+ * Service Tags Technology.
+ * <p>
+ * Typically the registration data is constructed at installation time
+ * and stored in an XML file for later service tag lookup or registration.
+ *
+ * <p>
+ * <b>Example Usage</b>
+ * <p>
+ * The examples below show how the {@code RegistrationData} can be
+ * used for product registration.
+ * Exception handling is not shown in these examples for clarity.
+ * <ol>
+ * <li>This example shows how the JDK creates a JDK service tag, installs it
+ * in the system service tag registry and adds it to the registration data.
+ * <br>
+ * <blockquote><pre>
+ * // create a service tag object with an instance_urn
+ * ServiceTag st = ServiceTag.newInstance(ServiceTag.generateInstanceURN(),
+ * ....);
+ * // Adds to the system service tag registry if supported
+ * if (Registry.isSupported()) {
+ * Registry.getSystemRegistry().addServiceTag(st);
+ * }
+ *
+ * // add to the registration data
+ * RegistrationData registration = new RegistrationData();
+ * registration.addServiceTag(st);
+ * </pre></blockquote>
+ * </li>
+ * <li>At this point, the registration data is ready to
+ * send to Sun Connection for registration. This example shows how to register
+ * the JDK via the <i>Registration Relay Service</i>.
+ * <p>
+ * There are several registration services for Sun Connection. For example,
+ * the <a href="https://sn-tools.central.sun.com/twiki/bin/view/ServiceTags/RegistrationRelayService">
+ * Registration Relay Service</a> is a web application interface that
+ * processes the registration data payload sent via HTTP post
+ * and hosts the registration user interface for a specified
+ * registration URL. Refer to the
+ * Registration Relay Service Specification for details.
+ * <p>
+ * <blockquote><pre>
+ * // Open the connection to the URL of the registration service
+ * HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
+ * con.setDoInput(true);
+ * con.setDoOutput(true);
+ * con.setUseCaches(false);
+ * con.setAllowUserInteraction(false);
+ * con.setRequestMethod("POST");
+ * con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\"");
+ * con.connect();
+ *
+ * // send the registration data to the registration service
+ * OutputStream out = con.getOutputStream();
+ * registration.storeToXML(out);
+ * out.close();
+ * </pre></blockquote>
+ * </li>
+ * <li>This example shows how to store the registration data in an XML file.
+ * for later service tag lookup or registration.
+ * <br>
+ * <blockquote><pre>
+ * BufferedOutputStream out = new BufferedOutputStream(
+ * new FileOutputStream(""&lt;JAVA_HOME&gt;/lib/servicetag/registration.xml"));
+ * registration.storeToXML(out);
+ * out.close();
+ * </pre></blockquote>
+ * </li>
+ * <li>This example shows how to install service tags that are in the
+ * registration data in the system service tag registry when determined
+ * to be available. The system service tag registry might not have existed
+ * when the registration data was constructed.
+ * <br>
+ * <blockquote><pre>
+ * if (Registry.isSupported()) {
+ * Set&lt;ServiceTag&gt; svctags = registration.getServiceTags();
+ * for (ServiceTag st : svctags) {
+ * Registry.getSystemRegistry().addServiceTag(st);
+ * }
+ * }
+ * </pre></blockquote>
+ * </li>
+ * </ol>
+ *
+ * @see <a href="https://sunconnection.sun.com/inventory">Sun Connection Inventory Channel</a>
+ */
+public class RegistrationData {
+ private final Map<String, String> environment;
+ private final Map<String, String> cpuInfo;
+ private final Map<String, ServiceTag> svcTagMap;
+ private final String urn;
+
+ /**
+ * Creates a {@code RegistrationData} object with a generated
+ * {@link #getRegistrationURN registration URN}.
+ * The following keys in the {@link #getEnvironmentMap environment map}
+ * will be initialized for the configuration of the
+ * running system:
+ * <blockquote>
+ * <tt>hostname</tt>, <tt>osName</tt>, <tt>osVersion</tt> and
+ * <tt>osArchitecture</tt>
+ * </blockquote>
+ * and the value of other keys may be empty.
+ */
+ public RegistrationData() {
+ this(Util.generateURN());
+ }
+
+ // package private
+ RegistrationData(String urn) {
+ this.urn = urn;
+ SystemEnvironment sysEnv = SystemEnvironment.getSystemEnvironment();
+ this.environment = initEnvironment(sysEnv);
+ this.cpuInfo = initCpuInfo(sysEnv);
+ this.svcTagMap = new LinkedHashMap<String, ServiceTag>();
+ }
+
+ private Map<String, String> initEnvironment(SystemEnvironment sysEnv) {
+ Map<String, String> map = new LinkedHashMap<String, String>();
+ map.put(ST_NODE_HOSTNAME, sysEnv.getHostname());
+ map.put(ST_NODE_HOST_ID, sysEnv.getHostId());
+ map.put(ST_NODE_OS_NAME, sysEnv.getOsName());
+ map.put(ST_NODE_OS_VERSION, sysEnv.getOsVersion());
+ map.put(ST_NODE_OS_ARCH, sysEnv.getOsArchitecture());
+ map.put(ST_NODE_SYSTEM_MODEL, sysEnv.getSystemModel());
+ map.put(ST_NODE_SYSTEM_MANUFACTURER, sysEnv.getSystemManufacturer());
+ map.put(ST_NODE_CPU_MANUFACTURER, sysEnv.getCpuManufacturer());
+ map.put(ST_NODE_SERIAL_NUMBER, sysEnv.getSerialNumber());
+ map.put(ST_NODE_PHYS_MEM, sysEnv.getPhysMem());
+ return map;
+ }
+
+ private Map<String, String> initCpuInfo(SystemEnvironment sysEnv) {
+ Map<String, String> map = new LinkedHashMap<String, String>();
+ map.put(ST_NODE_SOCKETS, sysEnv.getSockets());
+ map.put(ST_NODE_CORES, sysEnv.getCores());
+ map.put(ST_NODE_VIRT_CPUS, sysEnv.getVirtCpus());
+ map.put(ST_NODE_CPU_NAME, sysEnv.getCpuName());
+ map.put(ST_NODE_CLOCK_RATE, sysEnv.getClockRate());
+ return map;
+ }
+
+ /**
+ * Returns the uniform resource name of this registration data
+ * in this format:
+ * <tt>urn:st:&lt;32-char {@link java.util.UUID uuid}&gt;</tt>
+ *
+ * @return the URN of this registration data.
+ */
+ public String getRegistrationURN() {
+ return urn;
+ }
+
+ /**
+ * Returns a map containing the environment information for this
+ * registration data. See the set of <a href="#EnvMap">keys</a>
+ * in the environment map. Subsequent update to the environment
+ * map via the {@link #setEnvironment setEnvironment} method will not be reflected
+ * in the returned map.
+ *
+ * @return an environment map for this registration data.
+ */
+ public Map<String, String> getEnvironmentMap() {
+ return new LinkedHashMap<String,String>(environment);
+ }
+
+ /**
+ * Returns a map containing the cpu information for this
+ * registration data. Subsequent update to the cpu info
+ * map via the {@link #setCpuInfo setCpuInfo} method will not be reflected
+ * in the returned map.
+ *
+ * @return a cpu info map for this registration data.
+ */
+ public Map<String, String> getCpuInfoMap() {
+ return new LinkedHashMap<String,String>(cpuInfo);
+ }
+
+ /**
+ * Sets an element of the specified {@code name} in the environment map
+ * with the given {@code value}.
+ *
+ * @throws IllegalArgumentException if {@code name} is not a valid key
+ * in the environment map, or {@code value} is not valid.
+ */
+ public void setEnvironment(String name, String value) {
+ if (name == null) {
+ throw new NullPointerException("name is null");
+ }
+ if (value == null) {
+ throw new NullPointerException("value is null");
+ }
+ if (environment.containsKey(name)) {
+ if (name.equals(ST_NODE_HOSTNAME) || name.equals(ST_NODE_OS_NAME)) {
+ if (value.length() == 0) {
+ throw new IllegalArgumentException("\"" +
+ name + "\" requires non-empty value.");
+ }
+ }
+ environment.put(name, value);
+ } else {
+ throw new IllegalArgumentException("\"" +
+ name + "\" is not an environment element.");
+ }
+ }
+
+ /**
+ * Sets an element of the specified {@code name} in the cpu info map
+ * with the given {@code value}.
+ *
+ * @throws IllegalArgumentException if {@code name} is not a valid key
+ * in the cpu info map, or {@code value} is not valid.
+ */
+ public void setCpuInfo(String name, String value) {
+ if (name == null) {
+ throw new NullPointerException("name is null");
+ }
+ if (value == null) {
+ throw new NullPointerException("value is null");
+ }
+ if (cpuInfo.containsKey(name)) {
+ cpuInfo.put(name, value);
+ } else {
+ throw new IllegalArgumentException("\"" +
+ name + "\" is not an cpuinfo element.");
+ }
+ }
+
+ /**
+ * Returns all service tags in this registration data.
+ *
+ * @return a {@link Set Set} of the service tags
+ * in this registration data.
+ */
+ public Set<ServiceTag> getServiceTags() {
+ return new HashSet<ServiceTag>(svcTagMap.values());
+ }
+
+ /**
+ * Adds a service tag to this registration data.
+ * If the given service tag has an empty <tt>instance_urn</tt>,
+ * this method will generate a URN and place it in the copy
+ * of the service tag in this registration data.
+ * This method will return the {@code ServiceTag} object
+ * added to this registration data.
+ *
+ * @param st {@code ServiceTag} object to be added.
+ * @return a {@code ServiceTag} object added to this registration data.
+ *
+ * @throws IllegalArgumentException if
+ * a service tag of the same {@link ServiceTag#getInstanceURN
+ * <tt>instance_urn</tt>} already exists in the registry.
+ */
+ public synchronized ServiceTag addServiceTag(ServiceTag st) {
+ ServiceTag svcTag = ServiceTag.newInstanceWithUrnTimestamp(st);
+
+ String instanceURN = svcTag.getInstanceURN();
+ if (svcTagMap.containsKey(instanceURN)) {
+ throw new IllegalArgumentException("Instance_urn = " + instanceURN +
+ " already exists in the registration data.");
+ } else {
+ svcTagMap.put(instanceURN, svcTag);
+ }
+ return svcTag;
+ }
+
+ /**
+ * Returns a service tag of the given <tt>instance_urn</tt> in this registration
+ * data.
+ *
+ * @param instanceURN the <tt>instance_urn</tt> of the service tag
+ * @return the {@code ServiceTag} object of the given <tt>instance_urn</tt>
+ * if exists; otherwise return {@code null}.
+ */
+ public synchronized ServiceTag getServiceTag(String instanceURN) {
+ if (instanceURN == null) {
+ throw new NullPointerException("instanceURN is null");
+ }
+ return svcTagMap.get(instanceURN);
+ }
+
+ /**
+ * Removes a service tag of the given <tt>instance_urn</tt> from this
+ * registration data.
+ *
+ * @param instanceURN the <tt>instance_urn</tt> of
+ * the service tag to be removed.
+ *
+ * @return the removed {@code ServiceTag} object;
+ * or {@code null} if the service tag does not exist in this
+ * registration data.
+ */
+ public synchronized ServiceTag removeServiceTag(String instanceURN) {
+ if (instanceURN == null) {
+ throw new NullPointerException("instanceURN is null");
+ }
+
+ ServiceTag svcTag = null;
+ if (svcTagMap.containsKey(instanceURN)) {
+ svcTag = svcTagMap.remove(instanceURN);
+ }
+ return svcTag;
+ }
+
+ /**
+ * Updates the <tt>product_defined_instance_id</tt> in the service tag
+ * of the given <tt>instance_urn</tt> in this registration data.
+ *
+ * @param instanceURN the <tt>instance_urn</tt> of the service tag to be updated.
+ * @param productDefinedInstanceID the value of the
+ * <tt>product_defined_instance_id</tt> to be set.
+ *
+ * @return the updated {@code ServiceTag} object;
+ * or {@code null} if the service tag does not exist in this
+ * registration data.
+ */
+ public synchronized ServiceTag updateServiceTag(String instanceURN,
+ String productDefinedInstanceID) {
+ ServiceTag svcTag = getServiceTag(instanceURN);
+ if (svcTag == null) {
+ return null;
+ }
+
+ svcTag = ServiceTag.newInstanceWithUrnTimestamp(svcTag);
+ // update the product defined instance ID field
+ svcTag.setProductDefinedInstanceID(productDefinedInstanceID);
+ svcTagMap.put(instanceURN, svcTag);
+ return svcTag;
+ }
+
+ /**
+ * Reads the registration data from the XML document on the
+ * specified input stream. The XML document must be
+ * in the format described by the <a href="#XMLSchema">
+ * registration data schema</a>.
+ * The specified stream is closed after this method returns.
+ *
+ * @param in the input stream from which to read the XML document.
+ * @return a {@code RegistrationData} object read from the input
+ * stream.
+ *
+ * @throws IllegalArgumentException if the input stream
+ * contains an invalid registration data.
+ *
+ * @throws IOException if an error occurred when reading from the input stream.
+ */
+ public static RegistrationData loadFromXML(InputStream in) throws IOException {
+ try {
+ return RegistrationDocument.load(in);
+ } finally {
+ in.close();
+ }
+ }
+
+ /**
+ * Writes the registration data to the specified output stream
+ * in the format described by the <a href="#XMLSchema">
+ * registration data schema</a> with "UTF-8" encoding.
+ * The specified stream remains open after this method returns.
+ *
+ * @param os the output stream on which to write the XML document.
+ *
+ * @throws IOException if an error occurred when writing to the output stream.
+ */
+ public void storeToXML(OutputStream os) throws IOException {
+ RegistrationDocument.store(os, this);
+ os.flush();
+ }
+
+ /**
+ * Returns a newly allocated byte array containing the registration
+ * data in XML format.
+ *
+ * @return a newly allocated byte array containing the registration
+ * data in XML format.
+ */
+ public byte[] toXML() {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ storeToXML(out);
+ return out.toByteArray();
+ } catch (IOException e) {
+ // should not reach here
+ return new byte[0];
+ }
+ }
+
+ /**
+ * Returns a string representation of this registration data in XML
+ * format.
+ *
+ * @return a string representation of this registration data in XML
+ * format.
+ */
+ @Override
+ public String toString() {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ storeToXML(out);
+ return out.toString("UTF-8");
+ } catch (IOException e) {
+ // should not reach here
+ return "Error creating the return string.";
+ }
+ }
+}
diff --git a/desktop/source/registration/com/sun/star/servicetag/RegistrationDocument.java b/desktop/source/registration/com/sun/star/servicetag/RegistrationDocument.java
index 93a1f25a6c..4bfa1aa16a 100644
--- a/desktop/source/registration/com/sun/star/servicetag/RegistrationDocument.java
+++ b/desktop/source/registration/com/sun/star/servicetag/RegistrationDocument.java
@@ -1,440 +1,440 @@
-
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License"). You
- * may not use this file except in compliance with the License. You can obtain
- * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
- * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
- * Sun designates this particular file as subject to the "Classpath" exception
- * as provided by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the License
- * Header, with the fields enclosed by brackets [] replaced by your own
- * identifying information: "Portions Copyrighted [year]
- * [name of copyright owner]"
- *
- * Contributor(s):
- *
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license." If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above. However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package com.sun.star.servicetag;
-
-import java.io.*;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-import org.xml.sax.InputSource;
-
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
-
-// For write operation
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-/**
- * XML Support Class for Product Registration.
- */
-class RegistrationDocument {
-
- private static final String REGISTRATION_DATA_SCHEMA =
- "/com/sun/star/servicetag/resources/product_registration.xsd";
- private static final String REGISTRATION_DATA_VERSION = "1.0";
- private static final String SERVICE_TAG_VERSION = "1.0";
- final static String ST_NODE_REGISTRATION_DATA = "registration_data";
- final static String ST_ATTR_REGISTRATION_VERSION = "version";
- final static String ST_NODE_ENVIRONMENT = "environment";
- final static String ST_NODE_HOSTNAME = "hostname";
- final static String ST_NODE_HOST_ID = "hostId";
- final static String ST_NODE_OS_NAME = "osName";
- final static String ST_NODE_OS_VERSION = "osVersion";
- final static String ST_NODE_OS_ARCH = "osArchitecture";
- final static String ST_NODE_SYSTEM_MODEL = "systemModel";
- final static String ST_NODE_SYSTEM_MANUFACTURER = "systemManufacturer";
- final static String ST_NODE_CPU_MANUFACTURER = "cpuManufacturer";
- final static String ST_NODE_SERIAL_NUMBER = "serialNumber";
- final static String ST_NODE_PHYS_MEM = "physmem";
- final static String ST_NODE_CPU_INFO = "cpuinfo";
- final static String ST_NODE_SOCKETS = "sockets";
- final static String ST_NODE_CORES = "cores";
- final static String ST_NODE_VIRT_CPUS = "virtcpus";
- final static String ST_NODE_CPU_NAME = "name";
- final static String ST_NODE_CLOCK_RATE = "clockrate";
- final static String ST_NODE_REGISTRY = "registry";
- final static String ST_ATTR_REGISTRY_URN = "urn";
- final static String ST_ATTR_REGISTRY_VERSION = "version";
- final static String ST_NODE_SERVICE_TAG = "service_tag";
- final static String ST_NODE_INSTANCE_URN = "instance_urn";
- final static String ST_NODE_PRODUCT_NAME = "product_name";
- final static String ST_NODE_PRODUCT_VERSION = "product_version";
- final static String ST_NODE_PRODUCT_URN = "product_urn";
- final static String ST_NODE_PRODUCT_PARENT_URN = "product_parent_urn";
- final static String ST_NODE_PRODUCT_PARENT = "product_parent";
- final static String ST_NODE_PRODUCT_DEFINED_INST_ID = "product_defined_inst_id";
- final static String ST_NODE_PRODUCT_VENDOR = "product_vendor";
- final static String ST_NODE_PLATFORM_ARCH = "platform_arch";
- final static String ST_NODE_TIMESTAMP = "timestamp";
- final static String ST_NODE_CONTAINER = "container";
- final static String ST_NODE_SOURCE = "source";
- final static String ST_NODE_INSTALLER_UID = "installer_uid";
-
- static RegistrationData load(InputStream in) throws IOException {
- Document document = initializeDocument(in);
-
- // Gets the registration URN
- Element root = getRegistrationDataRoot(document);
- Element registryRoot =
- getSingletonElementFromRoot(root, ST_NODE_REGISTRY);
- String urn = registryRoot.getAttribute(ST_ATTR_REGISTRY_URN);
-
- // Construct a new RegistrationData object from the DOM tree
- // Initialize the environment map and service tags
- RegistrationData regData = new RegistrationData(urn);
- addServiceTags(registryRoot, regData);
-
- Element envRoot = getSingletonElementFromRoot(root, ST_NODE_ENVIRONMENT);
- buildEnvironmentMap(envRoot, regData);
-
- Element cpuInfo = getSingletonElementFromRoot(envRoot, ST_NODE_CPU_INFO);
- buildCpuInfoMap(cpuInfo, regData);
- return regData;
- }
-
- static void store(OutputStream os, RegistrationData registration)
- throws IOException {
- // create a new document with the root node
- Document document = initializeDocument();
-
- // create the nodes for the environment map and the service tags
- // in the registration data
- addEnvironmentNodes(document,
- registration.getEnvironmentMap(),
- registration.getCpuInfoMap());
- addServiceTagRegistry(document,
- registration.getRegistrationURN(),
- registration.getServiceTags());
- transform(document, os);
- }
-
- // initialize a document from an input stream
- private static Document initializeDocument(InputStream in) throws IOException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- SchemaFactory sf = null;
- try {
- // Some Java versions (e.g., 1.5.0_06-b05) fail with a
- // NullPointerException if SchemaFactory.newInstance is called with
- // a null context class loader, so work around that here (and the
- // class loader of this class hopefully is not the null bootstrap
- // class loader):
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if (cl == null) {
- Thread.currentThread().setContextClassLoader(
- RegistrationDocument.class.getClassLoader());
- }
- try {
- sf = SchemaFactory.newInstance(
- XMLConstants.W3C_XML_SCHEMA_NS_URI);
- } finally {
- Thread.currentThread().setContextClassLoader(cl);
- }
-
- Schema schema = null;
- try {
- // Even using the workaround above is not enough on some
- // Java versions. Therefore try to workaround the validation
- // completely!
- URL xsdUrl = RegistrationDocument.class.getResource(REGISTRATION_DATA_SCHEMA);
- schema = sf.newSchema(xsdUrl);
- }
- catch (NullPointerException nex) {
- }
-
- Validator validator = null;
- if (schema != null)
- validator = schema.newValidator();
-
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.parse(new InputSource(in));
-
- if (validator != null)
- validator.validate(new DOMSource(doc));
-
- return doc;
- } catch (SAXException sxe) {
- IllegalArgumentException e = new IllegalArgumentException("Error generated in parsing");
- e.initCause(sxe);
- throw e;
- } catch (ParserConfigurationException pce) {
- // Parser with specific options can't be built
- // should not reach here
- InternalError x = new InternalError("Error in creating the new document");
- x.initCause(pce);
- throw x;
- }
- }
-
- // initialize a new document for the registration data
- private static Document initializeDocument() throws IOException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- try {
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.newDocument();
-
- // initialize the document with the registration_data root
- Element root = doc.createElement(ST_NODE_REGISTRATION_DATA);
- doc.appendChild(root);
- root.setAttribute(ST_ATTR_REGISTRATION_VERSION, REGISTRATION_DATA_VERSION);
-
- return doc;
- } catch (ParserConfigurationException pce) {
- // Parser with specified options can't be built
- // should not reach here
- InternalError x = new InternalError("Error in creating the new document");
- x.initCause(pce);
- throw x;
- }
- }
-
- // Transform the current DOM tree with the given output stream.
- private static void transform(Document document, OutputStream os) {
- try {
- // Use a Transformer for output
- TransformerFactory tFactory = TransformerFactory.newInstance();
- tFactory.setAttribute("indent-number", new Integer(3));
-
- Transformer transformer = tFactory.newTransformer();
-
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");
- transformer.transform(new DOMSource(document),
- new StreamResult(new BufferedWriter(new OutputStreamWriter(os, "UTF-8"))));
- } catch (UnsupportedEncodingException ue) {
- // Should not reach here
- InternalError x = new InternalError("Error generated during transformation");
- x.initCause(ue);
- throw x;
- } catch (TransformerConfigurationException tce) {
- // Error generated by the parser
- // Should not reach here
- InternalError x = new InternalError("Error in creating the new document");
- x.initCause(tce);
- throw x;
- } catch (TransformerException te) {
- // Error generated by the transformer
- InternalError x = new InternalError("Error generated during transformation");
- x.initCause(te);
- throw x;
- }
- }
-
- private static void addServiceTagRegistry(Document document,
- String registryURN,
- Set<ServiceTag> svcTags) {
- // add service tag registry node and its attributes
- Element reg = document.createElement(ST_NODE_REGISTRY);
- reg.setAttribute(ST_ATTR_REGISTRY_URN, registryURN);
- reg.setAttribute(ST_ATTR_REGISTRY_VERSION, SERVICE_TAG_VERSION);
-
- Element root = getRegistrationDataRoot(document);
- root.appendChild(reg);
-
- // adds the elements for the service tags
- for (ServiceTag st : svcTags) {
- addServiceTagElement(document, reg, st);
- }
- }
-
- private static void addServiceTagElement(Document document,
- Element registryRoot,
- ServiceTag st) {
- Element svcTag = document.createElement(ST_NODE_SERVICE_TAG);
- registryRoot.appendChild(svcTag);
- addChildElement(document, svcTag,
- ST_NODE_INSTANCE_URN, st.getInstanceURN());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_NAME, st.getProductName());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_VERSION, st.getProductVersion());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_URN, st.getProductURN());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_PARENT_URN, st.getProductParentURN());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_PARENT, st.getProductParent());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_DEFINED_INST_ID,
- st.getProductDefinedInstanceID());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_VENDOR, st.getProductVendor());
- addChildElement(document, svcTag,
- ST_NODE_PLATFORM_ARCH, st.getPlatformArch());
- addChildElement(document, svcTag,
- ST_NODE_TIMESTAMP, Util.formatTimestamp(st.getTimestamp()));
- addChildElement(document, svcTag,
- ST_NODE_CONTAINER, st.getContainer());
- addChildElement(document, svcTag,
- ST_NODE_SOURCE, st.getSource());
- addChildElement(document, svcTag,
- ST_NODE_INSTALLER_UID,
- String.valueOf(st.getInstallerUID()));
- }
-
- private static void addChildElement(Document document, Element root,
- String element, String text) {
- Element node = document.createElement(element);
- node.appendChild(document.createTextNode(text));
- root.appendChild(node);
- }
-
- // Constructs service tags from the document
- private static void addServiceTags(Element registryRoot,
- RegistrationData registration) {
- NodeList children = registryRoot.getElementsByTagName(ST_NODE_SERVICE_TAG);
- int length = (children == null ? 0 : children.getLength());
- for (int i = 0; i < length; i++) {
- Element svcTagElement = (Element) children.item(i);
- ServiceTag st = getServiceTag(svcTagElement);
- registration.addServiceTag(st);
- }
- }
-
- // build environment map from the document
- private static void buildEnvironmentMap(Element envRoot,
- RegistrationData registration) {
- registration.setEnvironment(ST_NODE_HOSTNAME, getTextValue(envRoot, ST_NODE_HOSTNAME));
- registration.setEnvironment(ST_NODE_HOST_ID, getTextValue(envRoot, ST_NODE_HOST_ID));
- registration.setEnvironment(ST_NODE_OS_NAME, getTextValue(envRoot, ST_NODE_OS_NAME));
- registration.setEnvironment(ST_NODE_OS_VERSION, getTextValue(envRoot, ST_NODE_OS_VERSION));
- registration.setEnvironment(ST_NODE_OS_ARCH, getTextValue(envRoot, ST_NODE_OS_ARCH));
- registration.setEnvironment(ST_NODE_SYSTEM_MODEL, getTextValue(envRoot, ST_NODE_SYSTEM_MODEL));
- registration.setEnvironment(ST_NODE_SYSTEM_MANUFACTURER, getTextValue(envRoot, ST_NODE_SYSTEM_MANUFACTURER));
- registration.setEnvironment(ST_NODE_CPU_MANUFACTURER, getTextValue(envRoot, ST_NODE_CPU_MANUFACTURER));
- registration.setEnvironment(ST_NODE_SERIAL_NUMBER, getTextValue(envRoot, ST_NODE_SERIAL_NUMBER));
- registration.setEnvironment(ST_NODE_PHYS_MEM, getTextValue(envRoot, ST_NODE_PHYS_MEM));
- }
-
- private static void buildCpuInfoMap(Element cpuInfoRoot,
- RegistrationData registration) {
- registration.setCpuInfo(ST_NODE_SOCKETS, getTextValue(cpuInfoRoot, ST_NODE_SOCKETS));
- registration.setCpuInfo(ST_NODE_CORES, getTextValue(cpuInfoRoot, ST_NODE_CORES));
- registration.setCpuInfo(ST_NODE_VIRT_CPUS, getTextValue(cpuInfoRoot, ST_NODE_VIRT_CPUS));
- registration.setCpuInfo(ST_NODE_CPU_NAME, getTextValue(cpuInfoRoot, ST_NODE_CPU_NAME));
- registration.setCpuInfo(ST_NODE_CLOCK_RATE, getTextValue(cpuInfoRoot, ST_NODE_CLOCK_RATE));
- }
-
- // add the nodes representing the environment map in the document
- private static void addEnvironmentNodes(Document document,
- Map<String, String> envMap,
- Map<String, String> cpuInfoMap) {
- Element root = getRegistrationDataRoot(document);
-
- Element env = document.createElement(ST_NODE_ENVIRONMENT);
- root.appendChild(env);
- Set<Map.Entry<String, String>> keys = envMap.entrySet();
- for (Map.Entry<String, String> entry : keys) {
- addChildElement(document, env, entry.getKey(), entry.getValue());
- }
-
- Element cpuInfo = document.createElement(ST_NODE_CPU_INFO);
- env.appendChild(cpuInfo);
- keys = cpuInfoMap.entrySet();
- for (Map.Entry<String, String> entry : keys) {
- addChildElement(document, cpuInfo, entry.getKey(), entry.getValue());
- }
- }
-
- private static Element getRegistrationDataRoot(Document doc) {
- Element root = doc.getDocumentElement();
- if (!root.getNodeName().equals(ST_NODE_REGISTRATION_DATA)) {
- throw new IllegalArgumentException("Not a " +
- ST_NODE_REGISTRATION_DATA +
- " node \"" + root.getNodeName() + "\"");
- }
- return root;
- }
-
- private static Element getSingletonElementFromRoot(Element root, String name) {
- NodeList children = root.getElementsByTagName(name);
- int length = (children == null ? 0 : children.getLength());
- if (length != 1) {
- throw new IllegalArgumentException("Invalid number of " + name +
- " nodes = " + length);
- }
- Element e = (Element) children.item(0);
- if (!e.getNodeName().equals(name)) {
- throw new IllegalArgumentException("Not a " + name +
- " node \"" + e.getNodeName() + "\"");
- }
- return e;
- }
-
- // Constructs one ServiceTag instance from a service tag element root
- private static ServiceTag getServiceTag(Element svcTagElement) {
- return new ServiceTag(
- getTextValue(svcTagElement, ST_NODE_INSTANCE_URN),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_NAME),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_VERSION),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_URN),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT_URN),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_DEFINED_INST_ID),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_VENDOR),
- getTextValue(svcTagElement, ST_NODE_PLATFORM_ARCH),
- getTextValue(svcTagElement, ST_NODE_CONTAINER),
- getTextValue(svcTagElement, ST_NODE_SOURCE),
- Util.getIntValue(getTextValue(svcTagElement, ST_NODE_INSTALLER_UID)),
- Util.parseTimestamp(getTextValue(svcTagElement, ST_NODE_TIMESTAMP))
- );
- }
-
- private static String getTextValue(Element e, String tagName) {
- String value = "";
- NodeList nl = e.getElementsByTagName(tagName);
- if (nl != null && nl.getLength() > 0) {
- Element el = (Element) nl.item(0);
- Node node = el.getFirstChild();
- if (node != null) {
- value = node.getNodeValue();
- }
- }
- return value;
- }
-}
+
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+
+package com.sun.star.servicetag;
+
+import java.io.*;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+import org.xml.sax.InputSource;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+// For write operation
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+/**
+ * XML Support Class for Product Registration.
+ */
+class RegistrationDocument {
+
+ private static final String REGISTRATION_DATA_SCHEMA =
+ "/com/sun/star/servicetag/resources/product_registration.xsd";
+ private static final String REGISTRATION_DATA_VERSION = "1.0";
+ private static final String SERVICE_TAG_VERSION = "1.0";
+ final static String ST_NODE_REGISTRATION_DATA = "registration_data";
+ final static String ST_ATTR_REGISTRATION_VERSION = "version";
+ final static String ST_NODE_ENVIRONMENT = "environment";
+ final static String ST_NODE_HOSTNAME = "hostname";
+ final static String ST_NODE_HOST_ID = "hostId";
+ final static String ST_NODE_OS_NAME = "osName";
+ final static String ST_NODE_OS_VERSION = "osVersion";
+ final static String ST_NODE_OS_ARCH = "osArchitecture";
+ final static String ST_NODE_SYSTEM_MODEL = "systemModel";
+ final static String ST_NODE_SYSTEM_MANUFACTURER = "systemManufacturer";
+ final static String ST_NODE_CPU_MANUFACTURER = "cpuManufacturer";
+ final static String ST_NODE_SERIAL_NUMBER = "serialNumber";
+ final static String ST_NODE_PHYS_MEM = "physmem";
+ final static String ST_NODE_CPU_INFO = "cpuinfo";
+ final static String ST_NODE_SOCKETS = "sockets";
+ final static String ST_NODE_CORES = "cores";
+ final static String ST_NODE_VIRT_CPUS = "virtcpus";
+ final static String ST_NODE_CPU_NAME = "name";
+ final static String ST_NODE_CLOCK_RATE = "clockrate";
+ final static String ST_NODE_REGISTRY = "registry";
+ final static String ST_ATTR_REGISTRY_URN = "urn";
+ final static String ST_ATTR_REGISTRY_VERSION = "version";
+ final static String ST_NODE_SERVICE_TAG = "service_tag";
+ final static String ST_NODE_INSTANCE_URN = "instance_urn";
+ final static String ST_NODE_PRODUCT_NAME = "product_name";
+ final static String ST_NODE_PRODUCT_VERSION = "product_version";
+ final static String ST_NODE_PRODUCT_URN = "product_urn";
+ final static String ST_NODE_PRODUCT_PARENT_URN = "product_parent_urn";
+ final static String ST_NODE_PRODUCT_PARENT = "product_parent";
+ final static String ST_NODE_PRODUCT_DEFINED_INST_ID = "product_defined_inst_id";
+ final static String ST_NODE_PRODUCT_VENDOR = "product_vendor";
+ final static String ST_NODE_PLATFORM_ARCH = "platform_arch";
+ final static String ST_NODE_TIMESTAMP = "timestamp";
+ final static String ST_NODE_CONTAINER = "container";
+ final static String ST_NODE_SOURCE = "source";
+ final static String ST_NODE_INSTALLER_UID = "installer_uid";
+
+ static RegistrationData load(InputStream in) throws IOException {
+ Document document = initializeDocument(in);
+
+ // Gets the registration URN
+ Element root = getRegistrationDataRoot(document);
+ Element registryRoot =
+ getSingletonElementFromRoot(root, ST_NODE_REGISTRY);
+ String urn = registryRoot.getAttribute(ST_ATTR_REGISTRY_URN);
+
+ // Construct a new RegistrationData object from the DOM tree
+ // Initialize the environment map and service tags
+ RegistrationData regData = new RegistrationData(urn);
+ addServiceTags(registryRoot, regData);
+
+ Element envRoot = getSingletonElementFromRoot(root, ST_NODE_ENVIRONMENT);
+ buildEnvironmentMap(envRoot, regData);
+
+ Element cpuInfo = getSingletonElementFromRoot(envRoot, ST_NODE_CPU_INFO);
+ buildCpuInfoMap(cpuInfo, regData);
+ return regData;
+ }
+
+ static void store(OutputStream os, RegistrationData registration)
+ throws IOException {
+ // create a new document with the root node
+ Document document = initializeDocument();
+
+ // create the nodes for the environment map and the service tags
+ // in the registration data
+ addEnvironmentNodes(document,
+ registration.getEnvironmentMap(),
+ registration.getCpuInfoMap());
+ addServiceTagRegistry(document,
+ registration.getRegistrationURN(),
+ registration.getServiceTags());
+ transform(document, os);
+ }
+
+ // initialize a document from an input stream
+ private static Document initializeDocument(InputStream in) throws IOException {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ SchemaFactory sf = null;
+ try {
+ // Some Java versions (e.g., 1.5.0_06-b05) fail with a
+ // NullPointerException if SchemaFactory.newInstance is called with
+ // a null context class loader, so work around that here (and the
+ // class loader of this class hopefully is not the null bootstrap
+ // class loader):
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null) {
+ Thread.currentThread().setContextClassLoader(
+ RegistrationDocument.class.getClassLoader());
+ }
+ try {
+ sf = SchemaFactory.newInstance(
+ XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ } finally {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
+
+ Schema schema = null;
+ try {
+ // Even using the workaround above is not enough on some
+ // Java versions. Therefore try to workaround the validation
+ // completely!
+ URL xsdUrl = RegistrationDocument.class.getResource(REGISTRATION_DATA_SCHEMA);
+ schema = sf.newSchema(xsdUrl);
+ }
+ catch (NullPointerException nex) {
+ }
+
+ Validator validator = null;
+ if (schema != null)
+ validator = schema.newValidator();
+
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.parse(new InputSource(in));
+
+ if (validator != null)
+ validator.validate(new DOMSource(doc));
+
+ return doc;
+ } catch (SAXException sxe) {
+ IllegalArgumentException e = new IllegalArgumentException("Error generated in parsing");
+ e.initCause(sxe);
+ throw e;
+ } catch (ParserConfigurationException pce) {
+ // Parser with specific options can't be built
+ // should not reach here
+ InternalError x = new InternalError("Error in creating the new document");
+ x.initCause(pce);
+ throw x;
+ }
+ }
+
+ // initialize a new document for the registration data
+ private static Document initializeDocument() throws IOException {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ try {
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.newDocument();
+
+ // initialize the document with the registration_data root
+ Element root = doc.createElement(ST_NODE_REGISTRATION_DATA);
+ doc.appendChild(root);
+ root.setAttribute(ST_ATTR_REGISTRATION_VERSION, REGISTRATION_DATA_VERSION);
+
+ return doc;
+ } catch (ParserConfigurationException pce) {
+ // Parser with specified options can't be built
+ // should not reach here
+ InternalError x = new InternalError("Error in creating the new document");
+ x.initCause(pce);
+ throw x;
+ }
+ }
+
+ // Transform the current DOM tree with the given output stream.
+ private static void transform(Document document, OutputStream os) {
+ try {
+ // Use a Transformer for output
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ tFactory.setAttribute("indent-number", new Integer(3));
+
+ Transformer transformer = tFactory.newTransformer();
+
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+ transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");
+ transformer.transform(new DOMSource(document),
+ new StreamResult(new BufferedWriter(new OutputStreamWriter(os, "UTF-8"))));
+ } catch (UnsupportedEncodingException ue) {
+ // Should not reach here
+ InternalError x = new InternalError("Error generated during transformation");
+ x.initCause(ue);
+ throw x;
+ } catch (TransformerConfigurationException tce) {
+ // Error generated by the parser
+ // Should not reach here
+ InternalError x = new InternalError("Error in creating the new document");
+ x.initCause(tce);
+ throw x;
+ } catch (TransformerException te) {
+ // Error generated by the transformer
+ InternalError x = new InternalError("Error generated during transformation");
+ x.initCause(te);
+ throw x;
+ }
+ }
+
+ private static void addServiceTagRegistry(Document document,
+ String registryURN,
+ Set<ServiceTag> svcTags) {
+ // add service tag registry node and its attributes
+ Element reg = document.createElement(ST_NODE_REGISTRY);
+ reg.setAttribute(ST_ATTR_REGISTRY_URN, registryURN);
+ reg.setAttribute(ST_ATTR_REGISTRY_VERSION, SERVICE_TAG_VERSION);
+
+ Element root = getRegistrationDataRoot(document);
+ root.appendChild(reg);
+
+ // adds the elements for the service tags
+ for (ServiceTag st : svcTags) {
+ addServiceTagElement(document, reg, st);
+ }
+ }
+
+ private static void addServiceTagElement(Document document,
+ Element registryRoot,
+ ServiceTag st) {
+ Element svcTag = document.createElement(ST_NODE_SERVICE_TAG);
+ registryRoot.appendChild(svcTag);
+ addChildElement(document, svcTag,
+ ST_NODE_INSTANCE_URN, st.getInstanceURN());
+ addChildElement(document, svcTag,
+ ST_NODE_PRODUCT_NAME, st.getProductName());
+ addChildElement(document, svcTag,
+ ST_NODE_PRODUCT_VERSION, st.getProductVersion());
+ addChildElement(document, svcTag,
+ ST_NODE_PRODUCT_URN, st.getProductURN());
+ addChildElement(document, svcTag,
+ ST_NODE_PRODUCT_PARENT_URN, st.getProductParentURN());
+ addChildElement(document, svcTag,
+ ST_NODE_PRODUCT_PARENT, st.getProductParent());
+ addChildElement(document, svcTag,
+ ST_NODE_PRODUCT_DEFINED_INST_ID,
+ st.getProductDefinedInstanceID());
+ addChildElement(document, svcTag,
+ ST_NODE_PRODUCT_VENDOR, st.getProductVendor());
+ addChildElement(document, svcTag,
+ ST_NODE_PLATFORM_ARCH, st.getPlatformArch());
+ addChildElement(document, svcTag,
+ ST_NODE_TIMESTAMP, Util.formatTimestamp(st.getTimestamp()));
+ addChildElement(document, svcTag,
+ ST_NODE_CONTAINER, st.getContainer());
+ addChildElement(document, svcTag,
+ ST_NODE_SOURCE, st.getSource());
+ addChildElement(document, svcTag,
+ ST_NODE_INSTALLER_UID,
+ String.valueOf(st.getInstallerUID()));
+ }
+
+ private static void addChildElement(Document document, Element root,
+ String element, String text) {
+ Element node = document.createElement(element);
+ node.appendChild(document.createTextNode(text));
+ root.appendChild(node);
+ }
+
+ // Constructs service tags from the document
+ private static void addServiceTags(Element registryRoot,
+ RegistrationData registration) {
+ NodeList children = registryRoot.getElementsByTagName(ST_NODE_SERVICE_TAG);
+ int length = (children == null ? 0 : children.getLength());
+ for (int i = 0; i < length; i++) {
+ Element svcTagElement = (Element) children.item(i);
+ ServiceTag st = getServiceTag(svcTagElement);
+ registration.addServiceTag(st);
+ }
+ }
+
+ // build environment map from the document
+ private static void buildEnvironmentMap(Element envRoot,
+ RegistrationData registration) {
+ registration.setEnvironment(ST_NODE_HOSTNAME, getTextValue(envRoot, ST_NODE_HOSTNAME));
+ registration.setEnvironment(ST_NODE_HOST_ID, getTextValue(envRoot, ST_NODE_HOST_ID));
+ registration.setEnvironment(ST_NODE_OS_NAME, getTextValue(envRoot, ST_NODE_OS_NAME));
+ registration.setEnvironment(ST_NODE_OS_VERSION, getTextValue(envRoot, ST_NODE_OS_VERSION));
+ registration.setEnvironment(ST_NODE_OS_ARCH, getTextValue(envRoot, ST_NODE_OS_ARCH));
+ registration.setEnvironment(ST_NODE_SYSTEM_MODEL, getTextValue(envRoot, ST_NODE_SYSTEM_MODEL));
+ registration.setEnvironment(ST_NODE_SYSTEM_MANUFACTURER, getTextValue(envRoot, ST_NODE_SYSTEM_MANUFACTURER));
+ registration.setEnvironment(ST_NODE_CPU_MANUFACTURER, getTextValue(envRoot, ST_NODE_CPU_MANUFACTURER));
+ registration.setEnvironment(ST_NODE_SERIAL_NUMBER, getTextValue(envRoot, ST_NODE_SERIAL_NUMBER));
+ registration.setEnvironment(ST_NODE_PHYS_MEM, getTextValue(envRoot, ST_NODE_PHYS_MEM));
+ }
+
+ private static void buildCpuInfoMap(Element cpuInfoRoot,
+ RegistrationData registration) {
+ registration.setCpuInfo(ST_NODE_SOCKETS, getTextValue(cpuInfoRoot, ST_NODE_SOCKETS));
+ registration.setCpuInfo(ST_NODE_CORES, getTextValue(cpuInfoRoot, ST_NODE_CORES));
+ registration.setCpuInfo(ST_NODE_VIRT_CPUS, getTextValue(cpuInfoRoot, ST_NODE_VIRT_CPUS));
+ registration.setCpuInfo(ST_NODE_CPU_NAME, getTextValue(cpuInfoRoot, ST_NODE_CPU_NAME));
+ registration.setCpuInfo(ST_NODE_CLOCK_RATE, getTextValue(cpuInfoRoot, ST_NODE_CLOCK_RATE));
+ }
+
+ // add the nodes representing the environment map in the document
+ private static void addEnvironmentNodes(Document document,
+ Map<String, String> envMap,
+ Map<String, String> cpuInfoMap) {
+ Element root = getRegistrationDataRoot(document);
+
+ Element env = document.createElement(ST_NODE_ENVIRONMENT);
+ root.appendChild(env);
+ Set<Map.Entry<String, String>> keys = envMap.entrySet();
+ for (Map.Entry<String, String> entry : keys) {
+ addChildElement(document, env, entry.getKey(), entry.getValue());
+ }
+
+ Element cpuInfo = document.createElement(ST_NODE_CPU_INFO);
+ env.appendChild(cpuInfo);
+ keys = cpuInfoMap.entrySet();
+ for (Map.Entry<String, String> entry : keys) {
+ addChildElement(document, cpuInfo, entry.getKey(), entry.getValue());
+ }
+ }
+
+ private static Element getRegistrationDataRoot(Document doc) {
+ Element root = doc.getDocumentElement();
+ if (!root.getNodeName().equals(ST_NODE_REGISTRATION_DATA)) {
+ throw new IllegalArgumentException("Not a " +
+ ST_NODE_REGISTRATION_DATA +
+ " node \"" + root.getNodeName() + "\"");
+ }
+ return root;
+ }
+
+ private static Element getSingletonElementFromRoot(Element root, String name) {
+ NodeList children = root.getElementsByTagName(name);
+ int length = (children == null ? 0 : children.getLength());
+ if (length != 1) {
+ throw new IllegalArgumentException("Invalid number of " + name +
+ " nodes = " + length);
+ }
+ Element e = (Element) children.item(0);
+ if (!e.getNodeName().equals(name)) {
+ throw new IllegalArgumentException("Not a " + name +
+ " node \"" + e.getNodeName() + "\"");
+ }
+ return e;
+ }
+
+ // Constructs one ServiceTag instance from a service tag element root
+ private static ServiceTag getServiceTag(Element svcTagElement) {
+ return new ServiceTag(
+ getTextValue(svcTagElement, ST_NODE_INSTANCE_URN),
+ getTextValue(svcTagElement, ST_NODE_PRODUCT_NAME),
+ getTextValue(svcTagElement, ST_NODE_PRODUCT_VERSION),
+ getTextValue(svcTagElement, ST_NODE_PRODUCT_URN),
+ getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT),
+ getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT_URN),
+ getTextValue(svcTagElement, ST_NODE_PRODUCT_DEFINED_INST_ID),
+ getTextValue(svcTagElement, ST_NODE_PRODUCT_VENDOR),
+ getTextValue(svcTagElement, ST_NODE_PLATFORM_ARCH),
+ getTextValue(svcTagElement, ST_NODE_CONTAINER),
+ getTextValue(svcTagElement, ST_NODE_SOURCE),
+ Util.getIntValue(getTextValue(svcTagElement, ST_NODE_INSTALLER_UID)),
+ Util.parseTimestamp(getTextValue(svcTagElement, ST_NODE_TIMESTAMP))
+ );
+ }
+
+ private static String getTextValue(Element e, String tagName) {
+ String value = "";
+ NodeList nl = e.getElementsByTagName(tagName);
+ if (nl != null && nl.getLength() > 0) {
+ Element el = (Element) nl.item(0);
+ Node node = el.getFirstChild();
+ if (node != null) {
+ value = node.getNodeValue();
+ }
+ }
+ return value;
+ }
+}
diff --git a/desktop/source/registration/com/sun/star/servicetag/resources/product_registration.xsd b/desktop/source/registration/com/sun/star/servicetag/resources/product_registration.xsd
index bb48ba9084..6681a563a0 100644
--- a/desktop/source/registration/com/sun/star/servicetag/resources/product_registration.xsd
+++ b/desktop/source/registration/com/sun/star/servicetag/resources/product_registration.xsd
@@ -1,366 +1,366 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
-<xs:element name="registration_data">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="environment"
- minOccurs="1"
- maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="hostname"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="hostId"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="osName"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="osVersion"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="osArchitecture"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="systemModel"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="systemManufacturer"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="cpuManufacturer"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="serialNumber"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="physmem"
- minOccurs='0'
- maxOccurs='1'/>
- <xs:element name="cpuinfo"
- minOccurs='0'
- maxOccurs='1'>
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="sockets"
- minOccurs='0'
- maxOccurs='1'/>
- <xs:element ref="cores"
- minOccurs='0'
- maxOccurs='1'/>
- <xs:element ref="virtcpus"
- minOccurs='0'
- maxOccurs='1'/>
- <xs:element ref="name"
- minOccurs='0'
- maxOccurs='1'/>
- <xs:element ref="clockrate"
- minOccurs='0'
- maxOccurs='1'/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="registry"
- minOccurs="1"
- maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="service_tag"
- minOccurs="0"
- maxOccurs="1024">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="instance_urn"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_name"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_version"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_urn"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_parent_urn"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_parent"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_defined_inst_id"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_vendor"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="platform_arch"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="timestamp"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="container"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="source"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="installer_uid"
- minOccurs='1'
- maxOccurs='1'/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="urn"
- type="xs:string"
- use="required"/>
- <xs:attribute name="version"
- type="xs:string"
- use="required"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="version"
- type="xs:string"
- use="required"/>
- </xs:complexType>
-</xs:element>
-
- <!-- definition of simple elements -->
- <xs:element name="hostname">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="hostId">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="16"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="osName">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="256"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="osVersion">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="50"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="osArchitecture">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="256"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="systemModel">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="50"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="systemManufacturer">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="50"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="cpuManufacturer">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="50"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="serialNumber">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="256"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="instance_urn">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_name">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_version">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_urn">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_parent_urn">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_parent">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_defined_inst_id">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_vendor">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="platform_arch">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="timestamp">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="24"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="container">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="source">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="installer_uid">
- <xs:simpleType>
- <xs:restriction base="xs:integer">
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="physmem">
- <xs:simpleType>
- <xs:restriction base="xs:integer"/>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="sockets">
- <xs:simpleType>
- <xs:restriction base="xs:integer"/>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="cores">
- <xs:simpleType>
- <xs:restriction base="xs:integer"/>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="virtcpus">
- <xs:simpleType>
- <xs:restriction base="xs:integer"/>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="name">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="128"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="clockrate">
- <xs:simpleType>
- <xs:restriction base="xs:integer"/>
- </xs:simpleType>
- </xs:element>
-
-</xs:schema>
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+<xs:element name="registration_data">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="environment"
+ minOccurs="1"
+ maxOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="hostname"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="hostId"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="osName"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="osVersion"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="osArchitecture"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="systemModel"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="systemManufacturer"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="cpuManufacturer"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="serialNumber"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="physmem"
+ minOccurs='0'
+ maxOccurs='1'/>
+ <xs:element name="cpuinfo"
+ minOccurs='0'
+ maxOccurs='1'>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="sockets"
+ minOccurs='0'
+ maxOccurs='1'/>
+ <xs:element ref="cores"
+ minOccurs='0'
+ maxOccurs='1'/>
+ <xs:element ref="virtcpus"
+ minOccurs='0'
+ maxOccurs='1'/>
+ <xs:element ref="name"
+ minOccurs='0'
+ maxOccurs='1'/>
+ <xs:element ref="clockrate"
+ minOccurs='0'
+ maxOccurs='1'/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="registry"
+ minOccurs="1"
+ maxOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="service_tag"
+ minOccurs="0"
+ maxOccurs="1024">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="instance_urn"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="product_name"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="product_version"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="product_urn"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="product_parent_urn"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="product_parent"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="product_defined_inst_id"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="product_vendor"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="platform_arch"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="timestamp"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="container"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="source"
+ minOccurs='1'
+ maxOccurs='1'/>
+ <xs:element ref="installer_uid"
+ minOccurs='1'
+ maxOccurs='1'/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="urn"
+ type="xs:string"
+ use="required"/>
+ <xs:attribute name="version"
+ type="xs:string"
+ use="required"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="version"
+ type="xs:string"
+ use="required"/>
+ </xs:complexType>
+</xs:element>
+
+ <!-- definition of simple elements -->
+ <xs:element name="hostname">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1"/>
+ <xs:maxLength value="255"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="hostId">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="16"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="osName">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1"/>
+ <xs:maxLength value="256"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="osVersion">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="50"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="osArchitecture">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="256"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="systemModel">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="50"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="systemManufacturer">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="50"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="cpuManufacturer">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="50"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="serialNumber">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="256"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="instance_urn">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1"/>
+ <xs:maxLength value="255"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="product_name">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="255"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="product_version">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="63"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="product_urn">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1"/>
+ <xs:maxLength value="255"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="product_parent_urn">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="255"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="product_parent">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="255"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="product_defined_inst_id">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="255"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="product_vendor">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="63"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="platform_arch">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="63"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="timestamp">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="24"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="container">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="63"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="source">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="63"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="installer_uid">
+ <xs:simpleType>
+ <xs:restriction base="xs:integer">
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="physmem">
+ <xs:simpleType>
+ <xs:restriction base="xs:integer"/>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="sockets">
+ <xs:simpleType>
+ <xs:restriction base="xs:integer"/>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="cores">
+ <xs:simpleType>
+ <xs:restriction base="xs:integer"/>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="virtcpus">
+ <xs:simpleType>
+ <xs:restriction base="xs:integer"/>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="name">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="128"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="clockrate">
+ <xs:simpleType>
+ <xs:restriction base="xs:integer"/>
+ </xs:simpleType>
+ </xs:element>
+
+</xs:schema>
diff --git a/desktop/win32/source/rebase/rebase.cxx b/desktop/win32/source/rebase/rebase.cxx
index ef860b3603..534d4615a3 100644
--- a/desktop/win32/source/rebase/rebase.cxx
+++ b/desktop/win32/source/rebase/rebase.cxx
@@ -24,164 +24,164 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
-#include "precompiled_desktop.hxx"
-#define UNICODE
-#define _UNICODE
-
-#define WIN32_LEAN_AND_MEAN
-#if defined _MSC_VER
-#pragma warning(push, 1)
-#endif
-#include <windows.h>
-#include <shellapi.h>
-#include <imagehlp.h>
-#include <wchar.h>
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
-
-#include <time.h>
-#include "sal/config.h"
-#include "tools/pathutils.hxx"
-
-#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
-#define MY_STRING(s) (s), MY_LENGTH(s)
-
-const int FORMAT_MESSAGE_SIZE = 4096;
-const DWORD PE_Signature = 0x00004550;
-const DWORD BASEVIRTUALADDRESS = 0x10000000;
-
-namespace
-{
-
-bool IsValidHandle( HANDLE handle )
-{
- return ((NULL != handle) && (INVALID_HANDLE_VALUE != handle));
-}
-
-void fail()
-{
- LPWSTR buf = NULL;
- FormatMessageW(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
- GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
- MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
- LocalFree(buf);
- TerminateProcess(GetCurrentProcess(), 255);
-}
-
-bool rebaseImage( wchar_t* pszFilePath, ULONG nNewImageBase)
-{
- ULONG ulOldImageSize;
- ULONG_PTR lpOldImageBase;
- ULONG ulNewImageSize;
- ULONG_PTR lpNewImageBase = nNewImageBase;
- ULONG ulDateTimeStamp = 0;
- bool bResult(false);
-
- char cszFilePath[_MAX_PATH+1] = {0};
- int nResult = WideCharToMultiByte(CP_ACP, 0, pszFilePath, -1, cszFilePath, _MAX_PATH, NULL, NULL);
-
- if (nResult != 0)
- {
- BOOL bResult = ReBaseImage(
- cszFilePath,
- "",
- TRUE,
- FALSE,
- FALSE,
- 0,
- &ulOldImageSize,
- &lpOldImageBase,
- &ulNewImageSize,
- &lpNewImageBase,
- ulDateTimeStamp );
- }
-
- return bResult;
-}
-
-wchar_t* getBrandPath(wchar_t * path)
-{
- DWORD n = GetModuleFileNameW(NULL, path, MAX_PATH);
- if (n == 0 || n >= MAX_PATH) {
- exit(EXIT_FAILURE);
- }
- return tools::filename(path);
-}
-
-void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase )
-{
- wchar_t szPattern[MAX_PATH];
- wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' );
- if ( lpLastSlash )
- {
- size_t len = lpLastSlash - pszFolder + 1;
- wcsncpy( szPattern, pszFolder, len );
- wcsncpy( szPattern + len, TEXT("*.dll"), sizeof(szPattern)/sizeof(szPattern[0]) - len );
- }
-
- WIN32_FIND_DATA aFindFileData;
- HANDLE hFind = FindFirstFile( szPattern, &aFindFileData );
-
- if ( IsValidHandle(hFind) )
- {
- BOOL fSuccess = false;
-
- do
- {
- wchar_t szLibFilePath[MAX_PATH];
- wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' );
- if ( lpLastSlash )
- {
- size_t len = lpLastSlash - pszFolder + 1;
- wcsncpy( szLibFilePath, pszFolder, len );
- wcsncpy( szLibFilePath + len, aFindFileData.cFileName, sizeof(szLibFilePath)/sizeof(szLibFilePath[0]) - len );
- }
-
- rebaseImage( szLibFilePath, nNewImageBase );
- fSuccess = FindNextFile( hFind, &aFindFileData );
- }
- while ( fSuccess );
-
- FindClose( hFind );
- }
-}
-
-}
-
-extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
-{
- wchar_t path[MAX_PATH];
-
- wchar_t * pathEnd = getBrandPath(path);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"")) == NULL)
- fail();
- rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL)
- fail();
- pathEnd = tools::resolveLink(path);
-
- if ( pathEnd == NULL )
- return 0;
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\")) == NULL)
- fail();
- rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
- fail();
- pathEnd = tools::resolveLink(path);
-
- if ( pathEnd == NULL )
- return 0;
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\")) == NULL)
- fail();
- rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
-
- return 0;
-}
+
+#include "precompiled_desktop.hxx"
+#define UNICODE
+#define _UNICODE
+
+#define WIN32_LEAN_AND_MEAN
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#include <windows.h>
+#include <shellapi.h>
+#include <imagehlp.h>
+#include <wchar.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+#include <time.h>
+#include "sal/config.h"
+#include "tools/pathutils.hxx"
+
+#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
+#define MY_STRING(s) (s), MY_LENGTH(s)
+
+const int FORMAT_MESSAGE_SIZE = 4096;
+const DWORD PE_Signature = 0x00004550;
+const DWORD BASEVIRTUALADDRESS = 0x10000000;
+
+namespace
+{
+
+bool IsValidHandle( HANDLE handle )
+{
+ return ((NULL != handle) && (INVALID_HANDLE_VALUE != handle));
+}
+
+void fail()
+{
+ LPWSTR buf = NULL;
+ FormatMessageW(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
+ GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
+ MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
+ LocalFree(buf);
+ TerminateProcess(GetCurrentProcess(), 255);
+}
+
+bool rebaseImage( wchar_t* pszFilePath, ULONG nNewImageBase)
+{
+ ULONG ulOldImageSize;
+ ULONG_PTR lpOldImageBase;
+ ULONG ulNewImageSize;
+ ULONG_PTR lpNewImageBase = nNewImageBase;
+ ULONG ulDateTimeStamp = 0;
+ bool bResult(false);
+
+ char cszFilePath[_MAX_PATH+1] = {0};
+ int nResult = WideCharToMultiByte(CP_ACP, 0, pszFilePath, -1, cszFilePath, _MAX_PATH, NULL, NULL);
+
+ if (nResult != 0)
+ {
+ BOOL bResult = ReBaseImage(
+ cszFilePath,
+ "",
+ TRUE,
+ FALSE,
+ FALSE,
+ 0,
+ &ulOldImageSize,
+ &lpOldImageBase,
+ &ulNewImageSize,
+ &lpNewImageBase,
+ ulDateTimeStamp );
+ }
+
+ return bResult;
+}
+
+wchar_t* getBrandPath(wchar_t * path)
+{
+ DWORD n = GetModuleFileNameW(NULL, path, MAX_PATH);
+ if (n == 0 || n >= MAX_PATH) {
+ exit(EXIT_FAILURE);
+ }
+ return tools::filename(path);
+}
+
+void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase )
+{
+ wchar_t szPattern[MAX_PATH];
+ wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' );
+ if ( lpLastSlash )
+ {
+ size_t len = lpLastSlash - pszFolder + 1;
+ wcsncpy( szPattern, pszFolder, len );
+ wcsncpy( szPattern + len, TEXT("*.dll"), sizeof(szPattern)/sizeof(szPattern[0]) - len );
+ }
+
+ WIN32_FIND_DATA aFindFileData;
+ HANDLE hFind = FindFirstFile( szPattern, &aFindFileData );
+
+ if ( IsValidHandle(hFind) )
+ {
+ BOOL fSuccess = false;
+
+ do
+ {
+ wchar_t szLibFilePath[MAX_PATH];
+ wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' );
+ if ( lpLastSlash )
+ {
+ size_t len = lpLastSlash - pszFolder + 1;
+ wcsncpy( szLibFilePath, pszFolder, len );
+ wcsncpy( szLibFilePath + len, aFindFileData.cFileName, sizeof(szLibFilePath)/sizeof(szLibFilePath[0]) - len );
+ }
+
+ rebaseImage( szLibFilePath, nNewImageBase );
+ fSuccess = FindNextFile( hFind, &aFindFileData );
+ }
+ while ( fSuccess );
+
+ FindClose( hFind );
+ }
+}
+
+}
+
+extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
+{
+ wchar_t path[MAX_PATH];
+
+ wchar_t * pathEnd = getBrandPath(path);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"")) == NULL)
+ fail();
+ rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL)
+ fail();
+ pathEnd = tools::resolveLink(path);
+
+ if ( pathEnd == NULL )
+ return 0;
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\")) == NULL)
+ fail();
+ rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
+ fail();
+ pathEnd = tools::resolveLink(path);
+
+ if ( pathEnd == NULL )
+ return 0;
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\")) == NULL)
+ fail();
+ rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
+
+ return 0;
+}
diff --git a/desktop/win32/source/rebase/rebasegui.cxx b/desktop/win32/source/rebase/rebasegui.cxx
index 0194c6e587..d512a872da 100644
--- a/desktop/win32/source/rebase/rebasegui.cxx
+++ b/desktop/win32/source/rebase/rebasegui.cxx
@@ -24,174 +24,174 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
-#include "precompiled_desktop.hxx"
-
-#define UNICODE 1
-#define _UNICODE 1
-
-#ifndef _WINDOWS_
-# define WIN32_LEAN_AND_MEAN
-#if defined _MSC_VER
-#pragma warning(push, 1)
-#endif
-# include <windows.h>
-# include <shellapi.h>
-# include <wchar.h>
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
-#endif
-
-#include "Resource.h"
-#include <time.h>
-#include "sal/config.h"
-#include "tools/pathutils.hxx"
-
-const DWORD PE_Signature = 0x00004550;
-
-#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
-#define MY_STRING(s) (s), MY_LENGTH(s)
-#define MAX_STR_CAPTION 256
-#define MAX_TEXT_LENGTH 1024
-
-static void failPath(wchar_t* pszAppTitle, wchar_t* pszMsg)
-{
- MessageBoxW(NULL, pszMsg, pszAppTitle, MB_OK | MB_ICONERROR);
- TerminateProcess(GetCurrentProcess(), 255);
-}
-
-static void fail()
-{
- LPWSTR buf = NULL;
- FormatMessageW(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
- GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
- MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
- LocalFree(buf);
- TerminateProcess(GetCurrentProcess(), 255);
-}
-
-static LPVOID getVirtualBaseAddress( wchar_t* pszFilePath )
-{
- HANDLE hFile;
- HANDLE hFileMapping;
- LPVOID lpFileBase = 0;
- PIMAGE_DOS_HEADER lpDosHeader;
- PIMAGE_NT_HEADERS lpNTHeader;
-
- hFile = CreateFile(pszFilePath,
- GENERIC_READ, FILE_SHARE_READ, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
- 0);
-
- if ( hFile == INVALID_HANDLE_VALUE )
- {
- return NULL;
- }
-
- hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
- if ( hFileMapping == 0 )
- {
- CloseHandle(hFile);
- return NULL;
- }
-
- lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
- if ( lpFileBase == 0 )
- {
- CloseHandle(hFileMapping);
- CloseHandle(hFile);
- return NULL;
- }
-
- lpDosHeader = (PIMAGE_DOS_HEADER)lpFileBase;
- if ( lpDosHeader->e_magic == IMAGE_DOS_SIGNATURE )
- {
- lpNTHeader = (PIMAGE_NT_HEADERS)((char*)lpDosHeader + lpDosHeader->e_lfanew);
- if (lpNTHeader->Signature == PE_Signature )
- lpFileBase = reinterpret_cast<LPVOID>( lpNTHeader->OptionalHeader.ImageBase );
- }
-
- UnmapViewOfFile(lpFileBase);
- CloseHandle(hFileMapping);
- CloseHandle(hFile);
-
- return lpFileBase;
-}
-
-static bool checkImageVirtualBaseAddress(wchar_t* pszFilePath, LPVOID lpVBA)
-{
- LPVOID lpImageVBA = getVirtualBaseAddress(pszFilePath);
- if ( lpImageVBA == lpVBA )
- return true;
- else
- return false;
-}
-
-static wchar_t* getBrandPath(wchar_t * pszPath)
-{
- DWORD n = GetModuleFileNameW(NULL, pszPath, MAX_PATH);
- if (n == 0 || n >= MAX_PATH) {
- exit(EXIT_FAILURE);
- }
- return tools::filename(pszPath);
-}
-
-extern "C" int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, int )
-{
- wchar_t* pAppTitle = new wchar_t[ MAX_STR_CAPTION ];
- pAppTitle[0] = '\0';
- LoadString( hInst, IDS_APP_TITLE, pAppTitle, MAX_STR_CAPTION );
-
- wchar_t* pTextServer = new wchar_t[ MAX_TEXT_LENGTH ];
- pTextServer[0] = '\0';
- LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_SERVER, pTextServer, MAX_TEXT_LENGTH );
-
- wchar_t* pTextClient = new wchar_t[ MAX_TEXT_LENGTH ];
- pTextClient[0] = '\0';
- LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_CLIENT, pTextClient, MAX_TEXT_LENGTH );
-
- wchar_t* pTextNoInstallation = new wchar_t[ MAX_TEXT_LENGTH ];
- pTextNoInstallation[0] = '\0';
- LoadString( hInst, IDS_MSG_NO_INSTALLATION_FOUND, pTextNoInstallation, MAX_TEXT_LENGTH );
-
- LPVOID VBA = (void*)0x10000000;
- wchar_t path[MAX_PATH];
-
- wchar_t * pathEnd = getBrandPath(path);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"libxml2.dll")) == NULL)
- fail();
- bool bFast = checkImageVirtualBaseAddress(path, VBA);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL)
- fail();
- pathEnd = tools::resolveLink(path);
-
- if (pathEnd == NULL)
- failPath(pAppTitle, pTextNoInstallation);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\vclmi.dll")) == NULL)
- fail();
- bFast &= checkImageVirtualBaseAddress(path, VBA);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
- fail();
- pathEnd = tools::resolveLink(path);
-
- if (pathEnd == NULL)
- failPath(pAppTitle, pTextNoInstallation);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\sal3.dll")) == NULL)
- fail();
- bFast &= checkImageVirtualBaseAddress(path, VBA);
-
- const wchar_t* pOutput = pTextClient;
- if (!bFast)
- pOutput = pTextServer;
-
- MessageBoxW( NULL, pOutput, pAppTitle, MB_OK );
-
- return 0;
-}
+
+#include "precompiled_desktop.hxx"
+
+#define UNICODE 1
+#define _UNICODE 1
+
+#ifndef _WINDOWS_
+# define WIN32_LEAN_AND_MEAN
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+# include <windows.h>
+# include <shellapi.h>
+# include <wchar.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+#endif
+
+#include "Resource.h"
+#include <time.h>
+#include "sal/config.h"
+#include "tools/pathutils.hxx"
+
+const DWORD PE_Signature = 0x00004550;
+
+#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
+#define MY_STRING(s) (s), MY_LENGTH(s)
+#define MAX_STR_CAPTION 256
+#define MAX_TEXT_LENGTH 1024
+
+static void failPath(wchar_t* pszAppTitle, wchar_t* pszMsg)
+{
+ MessageBoxW(NULL, pszMsg, pszAppTitle, MB_OK | MB_ICONERROR);
+ TerminateProcess(GetCurrentProcess(), 255);
+}
+
+static void fail()
+{
+ LPWSTR buf = NULL;
+ FormatMessageW(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
+ GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
+ MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
+ LocalFree(buf);
+ TerminateProcess(GetCurrentProcess(), 255);
+}
+
+static LPVOID getVirtualBaseAddress( wchar_t* pszFilePath )
+{
+ HANDLE hFile;
+ HANDLE hFileMapping;
+ LPVOID lpFileBase = 0;
+ PIMAGE_DOS_HEADER lpDosHeader;
+ PIMAGE_NT_HEADERS lpNTHeader;
+
+ hFile = CreateFile(pszFilePath,
+ GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
+ 0);
+
+ if ( hFile == INVALID_HANDLE_VALUE )
+ {
+ return NULL;
+ }
+
+ hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+ if ( hFileMapping == 0 )
+ {
+ CloseHandle(hFile);
+ return NULL;
+ }
+
+ lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
+ if ( lpFileBase == 0 )
+ {
+ CloseHandle(hFileMapping);
+ CloseHandle(hFile);
+ return NULL;
+ }
+
+ lpDosHeader = (PIMAGE_DOS_HEADER)lpFileBase;
+ if ( lpDosHeader->e_magic == IMAGE_DOS_SIGNATURE )
+ {
+ lpNTHeader = (PIMAGE_NT_HEADERS)((char*)lpDosHeader + lpDosHeader->e_lfanew);
+ if (lpNTHeader->Signature == PE_Signature )
+ lpFileBase = reinterpret_cast<LPVOID>( lpNTHeader->OptionalHeader.ImageBase );
+ }
+
+ UnmapViewOfFile(lpFileBase);
+ CloseHandle(hFileMapping);
+ CloseHandle(hFile);
+
+ return lpFileBase;
+}
+
+static bool checkImageVirtualBaseAddress(wchar_t* pszFilePath, LPVOID lpVBA)
+{
+ LPVOID lpImageVBA = getVirtualBaseAddress(pszFilePath);
+ if ( lpImageVBA == lpVBA )
+ return true;
+ else
+ return false;
+}
+
+static wchar_t* getBrandPath(wchar_t * pszPath)
+{
+ DWORD n = GetModuleFileNameW(NULL, pszPath, MAX_PATH);
+ if (n == 0 || n >= MAX_PATH) {
+ exit(EXIT_FAILURE);
+ }
+ return tools::filename(pszPath);
+}
+
+extern "C" int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, int )
+{
+ wchar_t* pAppTitle = new wchar_t[ MAX_STR_CAPTION ];
+ pAppTitle[0] = '\0';
+ LoadString( hInst, IDS_APP_TITLE, pAppTitle, MAX_STR_CAPTION );
+
+ wchar_t* pTextServer = new wchar_t[ MAX_TEXT_LENGTH ];
+ pTextServer[0] = '\0';
+ LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_SERVER, pTextServer, MAX_TEXT_LENGTH );
+
+ wchar_t* pTextClient = new wchar_t[ MAX_TEXT_LENGTH ];
+ pTextClient[0] = '\0';
+ LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_CLIENT, pTextClient, MAX_TEXT_LENGTH );
+
+ wchar_t* pTextNoInstallation = new wchar_t[ MAX_TEXT_LENGTH ];
+ pTextNoInstallation[0] = '\0';
+ LoadString( hInst, IDS_MSG_NO_INSTALLATION_FOUND, pTextNoInstallation, MAX_TEXT_LENGTH );
+
+ LPVOID VBA = (void*)0x10000000;
+ wchar_t path[MAX_PATH];
+
+ wchar_t * pathEnd = getBrandPath(path);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"libxml2.dll")) == NULL)
+ fail();
+ bool bFast = checkImageVirtualBaseAddress(path, VBA);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL)
+ fail();
+ pathEnd = tools::resolveLink(path);
+
+ if (pathEnd == NULL)
+ failPath(pAppTitle, pTextNoInstallation);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\vclmi.dll")) == NULL)
+ fail();
+ bFast &= checkImageVirtualBaseAddress(path, VBA);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
+ fail();
+ pathEnd = tools::resolveLink(path);
+
+ if (pathEnd == NULL)
+ failPath(pAppTitle, pTextNoInstallation);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\sal3.dll")) == NULL)
+ fail();
+ bFast &= checkImageVirtualBaseAddress(path, VBA);
+
+ const wchar_t* pOutput = pTextClient;
+ if (!bFast)
+ pOutput = pTextServer;
+
+ MessageBoxW( NULL, pOutput, pAppTitle, MB_OK );
+
+ return 0;
+}
diff --git a/fpicker/source/win32/filepicker/SolarMutex.cxx b/fpicker/source/win32/filepicker/SolarMutex.cxx
index 0dc27e4238..7b06e8c9ed 100644
--- a/fpicker/source/win32/filepicker/SolarMutex.cxx
+++ b/fpicker/source/win32/filepicker/SolarMutex.cxx
@@ -1,5 +1,5 @@
-/*************************************************************************
- *
+/*************************************************************************
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -23,33 +23,33 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_fpicker.hxx"
-
-#include <vcl/svapp.hxx>
-#include <vos/mutex.hxx>
-#include <osl/thread.hxx>
-
-int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId)
-{
- int nAcquireCount = 0;
- vos::IMutex& rSolarMutex = Application::GetSolarMutex();
- vos::OThread::TThreadIdentifier nMainThreadId = Application::GetMainThreadIdentifier();
-
- if ( nMainThreadId == nThreadId )
- {
- ::vos::IMutex& rMutex = Application::GetSolarMutex();
- if ( rMutex.tryToAcquire() )
- nAcquireCount = Application::ReleaseSolarMutex() - 1;
- }
-
- return nAcquireCount;
-}
-
-void AcquireSolarMutex(int nAcquireCount)
-{
- if ( nAcquireCount )
- Application::AcquireSolarMutex( nAcquireCount );
-}
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_fpicker.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <osl/thread.hxx>
+
+int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId)
+{
+ int nAcquireCount = 0;
+ vos::IMutex& rSolarMutex = Application::GetSolarMutex();
+ vos::OThread::TThreadIdentifier nMainThreadId = Application::GetMainThreadIdentifier();
+
+ if ( nMainThreadId == nThreadId )
+ {
+ ::vos::IMutex& rMutex = Application::GetSolarMutex();
+ if ( rMutex.tryToAcquire() )
+ nAcquireCount = Application::ReleaseSolarMutex() - 1;
+ }
+
+ return nAcquireCount;
+}
+
+void AcquireSolarMutex(int nAcquireCount)
+{
+ if ( nAcquireCount )
+ Application::AcquireSolarMutex( nAcquireCount );
+}
diff --git a/fpicker/source/win32/filepicker/SolarMutex.hxx b/fpicker/source/win32/filepicker/SolarMutex.hxx
index c785ed53dd..d3a8e6729e 100644
--- a/fpicker/source/win32/filepicker/SolarMutex.hxx
+++ b/fpicker/source/win32/filepicker/SolarMutex.hxx
@@ -1,5 +1,5 @@
-/*************************************************************************
- *
+/*************************************************************************
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -23,8 +23,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/
-
-int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId);
-
-void AcquireSolarMutex(int nAcquireCount);
+ ************************************************************************/
+
+int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId);
+
+void AcquireSolarMutex(int nAcquireCount);
diff --git a/framework/inc/dispatch/startmoduledispatcher.hxx b/framework/inc/dispatch/startmoduledispatcher.hxx
index 7bfa58f756..254ace4f04 100644
--- a/framework/inc/dispatch/startmoduledispatcher.hxx
+++ b/framework/inc/dispatch/startmoduledispatcher.hxx
@@ -83,14 +83,14 @@ class StartModuleDispatcher : public css::lang::XTypeProvider
uno resources. */
css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
- //---------------------------------------
- /** @short our "context" frame. */
- css::uno::WeakReference< css::frame::XFrame > m_xOwner;
+ //---------------------------------------
+ /** @short our "context" frame. */
+ css::uno::WeakReference< css::frame::XFrame > m_xOwner;
+
+ //---------------------------------------
+ /** @short the original queryDispatch() target. */
+ ::rtl::OUString m_sDispatchTarget;
- //---------------------------------------
- /** @short the original queryDispatch() target. */
- ::rtl::OUString m_sDispatchTarget;
-
//---------------------------------------
/** @short list of registered status listener */
ListenerHash m_lStatusListener;
@@ -101,7 +101,7 @@ class StartModuleDispatcher : public css::lang::XTypeProvider
public:
//---------------------------------------
- /** @short connect a new StartModuleDispatcher instance to its "owner frame".
+ /** @short connect a new StartModuleDispatcher instance to its "owner frame".
@descr Such "owner frame" is used as context for all related operations.
@@ -156,11 +156,11 @@ class StartModuleDispatcher : public css::lang::XTypeProvider
// internal helper
private:
-
- //---------------------------------------
- /** @short check if StartModule can be shown.
+
+ //---------------------------------------
+ /** @short check if StartModule can be shown.
*/
- ::sal_Bool implts_isBackingModePossible();
+ ::sal_Bool implts_isBackingModePossible();
//---------------------------------------
/** @short open the special BackingComponent (now StartModule)
diff --git a/framework/inc/dispatchcommands.h b/framework/inc/dispatchcommands.h
index 232121717f..404a13099f 100644
--- a/framework/inc/dispatchcommands.h
+++ b/framework/inc/dispatchcommands.h
@@ -41,11 +41,11 @@
namespace framework{
//_________________________________________________________________________________________________________________
-
-static ::rtl::OUString CMD_UNO_SHOWSTARTMODULE = ::rtl::OUString::createFromAscii(".uno:ShowStartModule");
+
+static ::rtl::OUString CMD_UNO_SHOWSTARTMODULE = ::rtl::OUString::createFromAscii(".uno:ShowStartModule");
static ::rtl::OUString CMD_UNO_CLOSEDOC = ::rtl::OUString::createFromAscii(".uno:CloseDoc" );
static ::rtl::OUString CMD_UNO_CLOSEWIN = ::rtl::OUString::createFromAscii(".uno:CloseWin" );
-static ::rtl::OUString CMD_UNO_CLOSEFRAME = ::rtl::OUString::createFromAscii(".uno:CloseFrame" );
+static ::rtl::OUString CMD_UNO_CLOSEFRAME = ::rtl::OUString::createFromAscii(".uno:CloseFrame" );
} // namespace framework
diff --git a/framework/inc/helper/mischelper.hxx b/framework/inc/helper/mischelper.hxx
index ac581e8e67..c23a38fb24 100644
--- a/framework/inc/helper/mischelper.hxx
+++ b/framework/inc/helper/mischelper.hxx
@@ -1,5 +1,5 @@
-/*************************************************************************
- *
+/*************************************************************************
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -23,47 +23,47 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/
-
-#ifndef __MISC_HELPER_HXX_
-#define __MISC_HELPER_HXX_
-
-#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-
-#include <i18npool/lang.h>
-#include <svl/languageoptions.hxx>
-
-namespace framework
-{
-
-inline bool IsScriptTypeMatchingToLanguage( sal_Int16 nScriptType, LanguageType nLang )
-{
- return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ));
-}
-
-
-class LanguageGuessingHelper
-{
- mutable ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > m_xLanguageGuesser;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
-
-public:
- LanguageGuessingHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager) : m_xServiceManager(_xServiceManager){}
-
- ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > GetGuesser() const;
-};
-
+ ************************************************************************/
+
+#ifndef __MISC_HELPER_HXX_
+#define __MISC_HELPER_HXX_
+
+#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <i18npool/lang.h>
+#include <svl/languageoptions.hxx>
+
+namespace framework
+{
+
+inline bool IsScriptTypeMatchingToLanguage( sal_Int16 nScriptType, LanguageType nLang )
+{
+ return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ));
+}
+
+
+class LanguageGuessingHelper
+{
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > m_xLanguageGuesser;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+
+public:
+ LanguageGuessingHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager) : m_xServiceManager(_xServiceManager){}
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > GetGuesser() const;
+};
+
::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL
,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory
,::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xUICommandLabels
,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame
,::rtl::OUString& _rModuleIdentifier
,sal_Bool& _rIni
- ,const sal_Char* _pName);
-
-} // namespace framework
-
-#endif // __MISC_HELPER_HXX_
-
+ ,const sal_Char* _pName);
+
+} // namespace framework
+
+#endif // __MISC_HELPER_HXX_
+
diff --git a/framework/inc/stdtypes.h b/framework/inc/stdtypes.h
index aa432888da..5bc781d3fe 100644
--- a/framework/inc/stdtypes.h
+++ b/framework/inc/stdtypes.h
@@ -87,7 +87,7 @@ struct Int32HashCode
{
return (size_t)nValue;
}
-};
+};
struct KeyEventHashCode
{
diff --git a/framework/source/dispatch/startmoduledispatcher.cxx b/framework/source/dispatch/startmoduledispatcher.cxx
index cb14edfa35..48096762ec 100644
--- a/framework/source/dispatch/startmoduledispatcher.cxx
+++ b/framework/source/dispatch/startmoduledispatcher.cxx
@@ -28,15 +28,15 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
-#include <dispatch/startmoduledispatcher.hxx>
-
+#include <dispatch/startmoduledispatcher.hxx>
+
//_______________________________________________
// my own includes
#include <pattern/frame.hxx>
#include <threadhelp/readguard.hxx>
#include <threadhelp/writeguard.hxx>
-#include <classes/framelistanalyzer.hxx>
+#include <classes/framelistanalyzer.hxx>
#include <dispatchcommands.h>
#include <targets.h>
#include <services.h>
@@ -92,8 +92,8 @@ StartModuleDispatcher::StartModuleDispatcher(const css::uno::Reference< css::lan
const ::rtl::OUString& sTarget)
: ThreadHelpBase (&Application::GetSolarMutex() )
, ::cppu::OWeakObject( )
- , m_xSMGR (xSMGR )
- , m_xOwner (xFrame )
+ , m_xSMGR (xSMGR )
+ , m_xOwner (xFrame )
, m_sDispatchTarget (sTarget )
, m_lStatusListener (m_aLock.getShareableOslMutex())
{
@@ -117,18 +117,18 @@ void SAL_CALL StartModuleDispatcher::dispatchWithNotification(const css::util::U
const css::uno::Sequence< css::beans::PropertyValue >& /*lArguments*/,
const css::uno::Reference< css::frame::XDispatchResultListener >& xListener )
throw(css::uno::RuntimeException)
-{
- ::sal_Int16 nResult = css::frame::DispatchResultState::DONTKNOW;
- if (aURL.Complete.equals (CMD_UNO_SHOWSTARTMODULE))
- {
- nResult = css::frame::DispatchResultState::FAILURE;
- if (implts_isBackingModePossible ())
- {
- if (implts_establishBackingMode ())
+{
+ ::sal_Int16 nResult = css::frame::DispatchResultState::DONTKNOW;
+ if (aURL.Complete.equals (CMD_UNO_SHOWSTARTMODULE))
+ {
+ nResult = css::frame::DispatchResultState::FAILURE;
+ if (implts_isBackingModePossible ())
+ {
+ if (implts_establishBackingMode ())
nResult = css::frame::DispatchResultState::SUCCESS;
- }
- }
-
+ }
+ }
+
implts_notifyResultListener(xListener, nResult, css::uno::Any());
}
@@ -160,39 +160,39 @@ void SAL_CALL StartModuleDispatcher::removeStatusListener(const css::uno::Refere
{
}
-//-----------------------------------------------
-::sal_Bool StartModuleDispatcher::implts_isBackingModePossible ()
-{
- if ( ! SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE))
- return sal_False;
-
+//-----------------------------------------------
+::sal_Bool StartModuleDispatcher::implts_isBackingModePossible ()
+{
+ if ( ! SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE))
+ return sal_False;
+
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
aReadLock.unlock();
// <- SAFE ----------------------------------
-
- css::uno::Reference< css::frame::XFramesSupplier > xDesktop(
- xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
-
- FrameListAnalyzer aCheck(
- xDesktop,
- css::uno::Reference< css::frame::XFrame >(),
- FrameListAnalyzer::E_HELP | FrameListAnalyzer::E_BACKINGCOMPONENT);
-
- ::sal_Bool bIsPossible = sal_False;
- ::sal_Int32 nVisibleFrames = aCheck.m_lOtherVisibleFrames.getLength ();
-
- if (
- ( ! aCheck.m_xBackingComponent.is ()) &&
- ( nVisibleFrames < 1 )
- )
- {
- bIsPossible = sal_True;
- }
-
+
+ css::uno::Reference< css::frame::XFramesSupplier > xDesktop(
+ xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
+
+ FrameListAnalyzer aCheck(
+ xDesktop,
+ css::uno::Reference< css::frame::XFrame >(),
+ FrameListAnalyzer::E_HELP | FrameListAnalyzer::E_BACKINGCOMPONENT);
+
+ ::sal_Bool bIsPossible = sal_False;
+ ::sal_Int32 nVisibleFrames = aCheck.m_lOtherVisibleFrames.getLength ();
+
+ if (
+ ( ! aCheck.m_xBackingComponent.is ()) &&
+ ( nVisibleFrames < 1 )
+ )
+ {
+ bIsPossible = sal_True;
+ }
+
return bIsPossible;
-}
+}
//-----------------------------------------------
::sal_Bool StartModuleDispatcher::implts_establishBackingMode()
@@ -202,16 +202,16 @@ void SAL_CALL StartModuleDispatcher::removeStatusListener(const css::uno::Refere
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
aReadLock.unlock();
// <- SAFE ----------------------------------
-
- css::uno::Reference< css::frame::XFrame > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
+
+ css::uno::Reference< css::frame::XFrame > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
css::uno::Reference< css::frame::XFrame > xFrame = xDesktop->findFrame (SPECIALTARGET_BLANK, 0);
- css::uno::Reference< css::awt::XWindow > xContainerWindow = xFrame->getContainerWindow ();
+ css::uno::Reference< css::awt::XWindow > xContainerWindow = xFrame->getContainerWindow ();
css::uno::Sequence< css::uno::Any > lArgs(1);
- lArgs[0] <<= xContainerWindow;
+ lArgs[0] <<= xContainerWindow;
- css::uno::Reference< css::frame::XController > xStartModule(
- xSMGR->createInstanceWithArguments(SERVICENAME_STARTMODULE, lArgs),
+ css::uno::Reference< css::frame::XController > xStartModule(
+ xSMGR->createInstanceWithArguments(SERVICENAME_STARTMODULE, lArgs),
css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::awt::XWindow > xComponentWindow(xStartModule, css::uno::UNO_QUERY);
@@ -236,6 +236,6 @@ void StartModuleDispatcher::implts_notifyResultListener(const css::uno::Referenc
aResult);
xListener->dispatchFinished(aEvent);
-}
+}
} // namespace framework
diff --git a/framework/source/helper/mischelper.cxx b/framework/source/helper/mischelper.cxx
index 83178d03ab..e70e79096e 100644
--- a/framework/source/helper/mischelper.cxx
+++ b/framework/source/helper/mischelper.cxx
@@ -1,5 +1,5 @@
-/*************************************************************************
- *
+/*************************************************************************
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -23,51 +23,51 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_framework.hxx"
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_framework.hxx"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
-
-#include <tools/debug.hxx>
-#include <comphelper/processfactory.hxx>
-#include <helper/mischelper.hxx>
-#include <services.h>
-
-
-using namespace ::com::sun::star;
+
+#include <tools/debug.hxx>
+#include <comphelper/processfactory.hxx>
+#include <helper/mischelper.hxx>
+#include <services.h>
+
+
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-
-namespace framework
-{
-
-uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGuesser() const
-{
- if (!m_xLanguageGuesser.is())
- {
- try
- {
- m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
- m_xServiceManager->createInstance(
- rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ),
- uno::UNO_QUERY );
- }
- catch (uno::Exception &r)
- {
- (void) r;
- DBG_ASSERT( 0, "failed to get language guessing component" );
- }
- }
- return m_xLanguageGuesser;
-}
-
+
+namespace framework
+{
+
+uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGuesser() const
+{
+ if (!m_xLanguageGuesser.is())
+ {
+ try
+ {
+ m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
+ m_xServiceManager->createInstance(
+ rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ),
+ uno::UNO_QUERY );
+ }
+ catch (uno::Exception &r)
+ {
+ (void) r;
+ DBG_ASSERT( 0, "failed to get language guessing component" );
+ }
+ }
+ return m_xLanguageGuesser;
+}
+
::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL
,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory
,::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xUICommandLabels
@@ -136,7 +136,7 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues
}
return aLabel;
-}
-
-} // namespace framework
-
+}
+
+} // namespace framework
+
diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx
index ec0ed73952..ecfe81a034 100644
--- a/framework/source/helper/statusindicatorfactory.cxx
+++ b/framework/source/helper/statusindicatorfactory.cxx
@@ -435,12 +435,12 @@ void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed()
Window* pWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( pWindow )
{
- bool bForceFrontAndFocus(false);
- ::comphelper::ConfigurationHelper::readDirectKey(
- xSMGR,
- ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/View"),
- ::rtl::OUString::createFromAscii("NewDocumentHandling"),
- ::rtl::OUString::createFromAscii("ForceFocusAndToFront"),
+ bool bForceFrontAndFocus(false);
+ ::comphelper::ConfigurationHelper::readDirectKey(
+ xSMGR,
+ ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/View"),
+ ::rtl::OUString::createFromAscii("NewDocumentHandling"),
+ ::rtl::OUString::createFromAscii("ForceFocusAndToFront"),
::comphelper::ConfigurationHelper::E_READONLY) >>= bForceFrontAndFocus;
pWindow->Show(sal_True, bForceFrontAndFocus ? SHOW_FOREGROUNDTASK : 0 );
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index f2a26f8917..c8cc2dd87f 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -1747,18 +1747,18 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X
Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
if ( pWindow )
{
- bool bForceFrontAndFocus(false);
- css::uno::Any a = ::comphelper::ConfigurationHelper::readDirectKey(
- xSMGR,
- ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/View"),
- ::rtl::OUString::createFromAscii("NewDocumentHandling"),
- ::rtl::OUString::createFromAscii("ForceFocusAndToFront"),
- ::comphelper::ConfigurationHelper::E_READONLY);
+ bool bForceFrontAndFocus(false);
+ css::uno::Any a = ::comphelper::ConfigurationHelper::readDirectKey(
+ xSMGR,
+ ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/View"),
+ ::rtl::OUString::createFromAscii("NewDocumentHandling"),
+ ::rtl::OUString::createFromAscii("ForceFocusAndToFront"),
+ ::comphelper::ConfigurationHelper::E_READONLY);
a >>= bForceFrontAndFocus;
pWindow->Show(sal_True, (bForceFrontAndFocus || bForceToFront) ? SHOW_FOREGROUNDTASK : 0 );
}
-
+
/* #i19976#
We tried to prevent a toFront() call in case the user putted the
loading document into the background ..
diff --git a/officecfg/registry/schema/org/openoffice/Office/Accelerators.xcs b/officecfg/registry/schema/org/openoffice/Office/Accelerators.xcs
index 1e9cd3927c..379f7cbb25 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Accelerators.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Accelerators.xcs
@@ -1,6 +1,6 @@
-<?xml version="1.0"?>
-<!--***********************************************************************
- *
+<?xml version="1.0"?>
+<!--***********************************************************************
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -24,58 +24,58 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************ -->
-<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="Accelerators" oor:package="org.openoffice.Office" xml:lang="en-US">
- <info>
- <desc>Configuration of Accelerators replacing the old not XCU-based configuration</desc>
- </info>
- <templates>
- <group oor:name="Key">
- <info>
- <desc>document the Key format</desc>
- </info>
- <prop oor:name="Command" oor:type="xs:string" oor:localized="true">
- <info>
- <desc>e.g..uno:About</desc>
- </info>
- </prop>
- </group>
- <set oor:name="Module" oor:node-type="Key">
- <info>
- <desc>point to a module of OOo</desc>
- </info>
- </set>
- </templates>
- <component>
- <group oor:name="PrimaryKeys">
- <info>
- <desc>contains the preferred keys</desc>
- </info>
- <set oor:name="Global" oor:node-type="Key">
- <info>
- <desc>Defined as key-values pairs</desc>
- </info>
- </set>
- <set oor:name="Modules" oor:node-type="Module">
- <info>
- <desc>containing the modules of OOo, defined as key-values pairs</desc>
- </info>
- </set>
- </group>
- <group oor:name="SecondaryKeys">
- <info>
- <desc>contains the secondary keys</desc>
- </info>
- <set oor:name="Global" oor:node-type="Key">
- <info>
- <desc>Defined as key-values pairs</desc>
- </info>
- </set>
- <set oor:name="Modules" oor:node-type="Module">
- <info>
- <desc>containing the modules of OOo, defined as key-values pairs</desc>
- </info>
- </set>
- </group>
- </component>
-</oor:component-schema>
+ ************************************************************************ -->
+<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="Accelerators" oor:package="org.openoffice.Office" xml:lang="en-US">
+ <info>
+ <desc>Configuration of Accelerators replacing the old not XCU-based configuration</desc>
+ </info>
+ <templates>
+ <group oor:name="Key">
+ <info>
+ <desc>document the Key format</desc>
+ </info>
+ <prop oor:name="Command" oor:type="xs:string" oor:localized="true">
+ <info>
+ <desc>e.g..uno:About</desc>
+ </info>
+ </prop>
+ </group>
+ <set oor:name="Module" oor:node-type="Key">
+ <info>
+ <desc>point to a module of OOo</desc>
+ </info>
+ </set>
+ </templates>
+ <component>
+ <group oor:name="PrimaryKeys">
+ <info>
+ <desc>contains the preferred keys</desc>
+ </info>
+ <set oor:name="Global" oor:node-type="Key">
+ <info>
+ <desc>Defined as key-values pairs</desc>
+ </info>
+ </set>
+ <set oor:name="Modules" oor:node-type="Module">
+ <info>
+ <desc>containing the modules of OOo, defined as key-values pairs</desc>
+ </info>
+ </set>
+ </group>
+ <group oor:name="SecondaryKeys">
+ <info>
+ <desc>contains the secondary keys</desc>
+ </info>
+ <set oor:name="Global" oor:node-type="Key">
+ <info>
+ <desc>Defined as key-values pairs</desc>
+ </info>
+ </set>
+ <set oor:name="Modules" oor:node-type="Module">
+ <info>
+ <desc>containing the modules of OOo, defined as key-values pairs</desc>
+ </info>
+ </set>
+ </group>
+ </component>
+</oor:component-schema>
diff --git a/sfx2/inc/sfx2/mnumgr.hxx b/sfx2/inc/sfx2/mnumgr.hxx
index a389e92a9b..b54047b3d5 100644
--- a/sfx2/inc/sfx2/mnumgr.hxx
+++ b/sfx2/inc/sfx2/mnumgr.hxx
@@ -102,11 +102,11 @@ private:
DECL_LINK( SelectHdl, void * );
Menu* pSVMenu;
-private:
- // only declared, but not defined: don't allow copying
- SfxPopupMenuManager( const SfxPopupMenuManager& );
- SfxPopupMenuManager& operator=( const SfxPopupMenuManager& );
-
+private:
+ // only declared, but not defined: don't allow copying
+ SfxPopupMenuManager( const SfxPopupMenuManager& );
+ SfxPopupMenuManager& operator=( const SfxPopupMenuManager& );
+
public:
SfxPopupMenuManager( const ResId&, SfxBindings& );
SfxPopupMenuManager( PopupMenu*, SfxBindings& );
diff --git a/sfx2/inc/sfx2/tabdlg.hxx b/sfx2/inc/sfx2/tabdlg.hxx
index 8117074cc3..6f84e0cc15 100644
--- a/sfx2/inc/sfx2/tabdlg.hxx
+++ b/sfx2/inc/sfx2/tabdlg.hxx
@@ -245,8 +245,8 @@ namespace sfx { class ItemConnectionBase; }
class SFX2_DLLPUBLIC SfxTabPage: public TabPage
{
friend class SfxTabDialog;
- #if ENABLE_LAYOUT
- friend class layout::SfxTabDialog;
+ #if ENABLE_LAYOUT
+ friend class layout::SfxTabDialog;
#endif
private:
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index a1aa60d64c..c035383f0d 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -5893,31 +5893,31 @@ SfxVoidItem ExportDialog SID_EXPORT_DIALOG
]
//--------------------------------------------------------------------------
-SfxVoidItem ImportDialog SID_IMPORT_DIALOG
-()
-[
- /* flags: */
- AutoUpdate = FALSE,
- Cachable = Cachable,
- FastCall = FALSE,
- HasCoreId = FALSE,
- HasDialog = FALSE,
- ReadOnlyDoc = TRUE,
- Toggle = FALSE,
- Container = TRUE,
- RecordAbsolute = FALSE,
- RecordPerSet;
- Asynchron;
-
- /* config: */
- AccelConfig = TRUE,
- MenuConfig = TRUE,
- StatusBarConfig = FALSE,
- ToolBoxConfig = TRUE,
- GroupId = GID_DOCUMENT;
-]
-
-//--------------------------------------------------------------------------
+SfxVoidItem ImportDialog SID_IMPORT_DIALOG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
SfxVoidItem SaveConfiguration SID_SAVECONFIG
(SfxStringItem FileName SID_CFGFILE)
[
diff --git a/sfx2/sdi/sfxitems.sdi b/sfx2/sdi/sfxitems.sdi
index b8501bcb07..e447b48a54 100644
--- a/sfx2/sdi/sfxitems.sdi
+++ b/sfx2/sdi/sfxitems.sdi
@@ -1,89 +1,89 @@
- item void SfxVoidItem;
- item BOOL SfxBoolItem;
- item INT32 SfxUInt16Item;
- item INT16 SfxInt16Item;
- item INT32 SfxUInt32Item;
- item INT32 SfxInt32Item;
- item String SfxStringItem;
- item BYTE SfxByteItem;
- item INT16 SfxEnumItem;
- item INT16 SfxAllEnumItem;
- item INT16 TbxImageItem;
-
- item String SbxItem; //! Dummy
- item String SfxObjectItem; //! Dummy
- item String SfxTemplateItem; //! Dummy
- item String SfxMacroInfoItem; //! Dummy
- item String SfxImageItem; //! Dummy
- item String SfxFrameItem; //! Dummy
- item String SfxObjectShellItem //! Dummy
- item String SfxUsrAnyItem //! Dummy
-
- struct Point
- {
- INT32 X MID_X;
- INT32 Y MID_Y;
- };
- item Point SfxPointItem;
-
- struct Rectangle
- {
- INT32 Left MID_RECT_LEFT;
- INT32 Top MID_RECT_TOP;
- INT32 Width MID_WIDTH;
- INT32 Height MID_HEIGHT;
- };
- item Rectangle SfxRectangleItem;
-
- struct DocInfo
- {
- BOOL UseUserData MID_DOCINFO_USEUSERDATA;
- BOOL DeleteUserData MID_DOCINFO_DELETEUSERDATA;
- String Title MID_DOCINFO_TITLE;
- String Subject MID_DOCINFO_SUBJECT;
- String KeyWords MID_DOCINFO_KEYWORDS;
- String Description MID_DOCINFO_DESCRIPTION;
- BOOL AutoReload MID_DOCINFO_AUTOLOADENABLED;
- INT32 AutoReloadTime MID_DOCINFO_AUTOLOADSECS;
- String AutoReloadURL MID_DOCINFO_AUTOLOADURL;
- String AutoReloadFrame MID_DOCINFO_DEFAULTTARGET;
- };
- item DocInfo SfxDocumentInfoItem;
-
- struct SvxSearch
- {
- INT16 StyleFamily MID_SEARCH_STYLEFAMILY;
- UINT16 CellType MID_SEARCH_CELLTYPE;
- BOOL RowDirection MID_SEARCH_ROWDIRECTION;
- BOOL AllTables MID_SEARCH_ALLTABLES;
- BOOL Backward MID_SEARCH_BACKWARD;
- BOOL Pattern MID_SEARCH_PATTERN;
- BOOL Content MID_SEARCH_CONTENT;
- BOOL AsianOptions MID_SEARCH_ASIANOPTIONS;
- INT16 AlgorithmType MID_SEARCH_ALGORITHMTYPE;
- INT32 SearchFlags MID_SEARCH_FLAGS;
- String SearchString MID_SEARCH_SEARCHSTRING;
- String ReplaceString MID_SEARCH_REPLACESTRING;
- INT16 Locale MID_SEARCH_LOCALE;
- INT32 ChangedChars MID_SEARCH_CHANGEDCHARS;
- INT32 DeletedChars MID_SEARCH_DELETEDCHARS;
- INT32 InsertedChars MID_SEARCH_INSERTEDCHARS;
- INT32 TransliterateFlags MID_SEARCH_TRANSLITERATEFLAGS;
- INT16 Command MID_SEARCH_COMMAND;
- };
- item SvxSearch SvxSearchItem;
-
- struct SvxSize
- {
- INT32 Width MID_SIZE_WIDTH;
- INT32 Height MID_SIZE_HEIGHT;
- };
- item SvxSize SvxSizeItem;
-
- struct SfxScriptOrganizer
- {
- String Language MID_SCRIPT_ORGANIZER_LANGUAGE;
- };
- item SfxScriptOrganizer SfxScriptOrganizerItem;
- item String SvxClipboardFmtItem; //! Dummy
-
+ item void SfxVoidItem;
+ item BOOL SfxBoolItem;
+ item INT32 SfxUInt16Item;
+ item INT16 SfxInt16Item;
+ item INT32 SfxUInt32Item;
+ item INT32 SfxInt32Item;
+ item String SfxStringItem;
+ item BYTE SfxByteItem;
+ item INT16 SfxEnumItem;
+ item INT16 SfxAllEnumItem;
+ item INT16 TbxImageItem;
+
+ item String SbxItem; //! Dummy
+ item String SfxObjectItem; //! Dummy
+ item String SfxTemplateItem; //! Dummy
+ item String SfxMacroInfoItem; //! Dummy
+ item String SfxImageItem; //! Dummy
+ item String SfxFrameItem; //! Dummy
+ item String SfxObjectShellItem //! Dummy
+ item String SfxUsrAnyItem //! Dummy
+
+ struct Point
+ {
+ INT32 X MID_X;
+ INT32 Y MID_Y;
+ };
+ item Point SfxPointItem;
+
+ struct Rectangle
+ {
+ INT32 Left MID_RECT_LEFT;
+ INT32 Top MID_RECT_TOP;
+ INT32 Width MID_WIDTH;
+ INT32 Height MID_HEIGHT;
+ };
+ item Rectangle SfxRectangleItem;
+
+ struct DocInfo
+ {
+ BOOL UseUserData MID_DOCINFO_USEUSERDATA;
+ BOOL DeleteUserData MID_DOCINFO_DELETEUSERDATA;
+ String Title MID_DOCINFO_TITLE;
+ String Subject MID_DOCINFO_SUBJECT;
+ String KeyWords MID_DOCINFO_KEYWORDS;
+ String Description MID_DOCINFO_DESCRIPTION;
+ BOOL AutoReload MID_DOCINFO_AUTOLOADENABLED;
+ INT32 AutoReloadTime MID_DOCINFO_AUTOLOADSECS;
+ String AutoReloadURL MID_DOCINFO_AUTOLOADURL;
+ String AutoReloadFrame MID_DOCINFO_DEFAULTTARGET;
+ };
+ item DocInfo SfxDocumentInfoItem;
+
+ struct SvxSearch
+ {
+ INT16 StyleFamily MID_SEARCH_STYLEFAMILY;
+ UINT16 CellType MID_SEARCH_CELLTYPE;
+ BOOL RowDirection MID_SEARCH_ROWDIRECTION;
+ BOOL AllTables MID_SEARCH_ALLTABLES;
+ BOOL Backward MID_SEARCH_BACKWARD;
+ BOOL Pattern MID_SEARCH_PATTERN;
+ BOOL Content MID_SEARCH_CONTENT;
+ BOOL AsianOptions MID_SEARCH_ASIANOPTIONS;
+ INT16 AlgorithmType MID_SEARCH_ALGORITHMTYPE;
+ INT32 SearchFlags MID_SEARCH_FLAGS;
+ String SearchString MID_SEARCH_SEARCHSTRING;
+ String ReplaceString MID_SEARCH_REPLACESTRING;
+ INT16 Locale MID_SEARCH_LOCALE;
+ INT32 ChangedChars MID_SEARCH_CHANGEDCHARS;
+ INT32 DeletedChars MID_SEARCH_DELETEDCHARS;
+ INT32 InsertedChars MID_SEARCH_INSERTEDCHARS;
+ INT32 TransliterateFlags MID_SEARCH_TRANSLITERATEFLAGS;
+ INT16 Command MID_SEARCH_COMMAND;
+ };
+ item SvxSearch SvxSearchItem;
+
+ struct SvxSize
+ {
+ INT32 Width MID_SIZE_WIDTH;
+ INT32 Height MID_SIZE_HEIGHT;
+ };
+ item SvxSize SvxSizeItem;
+
+ struct SfxScriptOrganizer
+ {
+ String Language MID_SCRIPT_ORGANIZER_LANGUAGE;
+ };
+ item SfxScriptOrganizer SfxScriptOrganizerItem;
+ item String SvxClipboardFmtItem; //! Dummy
+
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 30430b271d..cbbed369fc 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -837,8 +837,8 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
::rtl::OUString aAdjustToType;
// bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format
- if ( !(( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED )) &&
- ( bSetStandardName || GetStorable()->hasLocation() ))
+ if ( !(( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED )) &&
+ ( bSetStandardName || GetStorable()->hasLocation() ))
{
uno::Sequence< beans::PropertyValue > aOldFilterProps;
::rtl::OUString aOldFilterName = GetDocProps().getUnpackedValueOrDefault(
diff --git a/shell/inc/internal/basereader.hxx b/shell/inc/internal/basereader.hxx
index 9d3348a0d1..d481731892 100644
--- a/shell/inc/internal/basereader.hxx
+++ b/shell/inc/internal/basereader.hxx
@@ -47,7 +47,7 @@ public:
protected: // protected because its only an implementation relevant class
CBaseReader( const std::string& DocumentName );
- CBaseReader( void* stream, zlib_filefunc_def* fa );
+ CBaseReader( void* stream, zlib_filefunc_def* fa );
virtual void start_document();
diff --git a/shell/inc/internal/contentreader.hxx b/shell/inc/internal/contentreader.hxx
index 23143333d3..14dedc3439 100644
--- a/shell/inc/internal/contentreader.hxx
+++ b/shell/inc/internal/contentreader.hxx
@@ -40,7 +40,7 @@ public:
//CContentReader( const std::string& DocumentName );
CContentReader( const std::string& DocumentName, LocaleSet_t const & DocumentLocale );
- CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa );
+ CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa );
/** Get the chunkbuffer.
diff --git a/shell/inc/internal/metainforeader.hxx b/shell/inc/internal/metainforeader.hxx
index 0fbf25b812..417c69c656 100644
--- a/shell/inc/internal/metainforeader.hxx
+++ b/shell/inc/internal/metainforeader.hxx
@@ -43,7 +43,7 @@ public:
CMetaInfoReader( const std::string& DocumentName );
- CMetaInfoReader( void* stream, zlib_filefunc_def* fa);
+ CMetaInfoReader( void* stream, zlib_filefunc_def* fa);
/** check if the Tag is in the target meta.xml file.
diff --git a/shell/inc/internal/types.hxx b/shell/inc/internal/types.hxx
index 53e03c3695..e87e432340 100644
--- a/shell/inc/internal/types.hxx
+++ b/shell/inc/internal/types.hxx
@@ -33,8 +33,8 @@
#include <utility>
#include <vector>
#include <stack>
-#include <external/zlib/zlib.h>
-#include <external/zlib/ioapi.h>
+#include <external/zlib/zlib.h>
+#include <external/zlib/ioapi.h>
typedef std::vector<std::wstring> StringList_t;
diff --git a/shell/inc/internal/zipfile.hxx b/shell/inc/internal/zipfile.hxx
index 20b908bdc0..4a25208e80 100644
--- a/shell/inc/internal/zipfile.hxx
+++ b/shell/inc/internal/zipfile.hxx
@@ -32,9 +32,9 @@
#define _WINDOWS
#endif
-
-#include <external/zlib/unzip.h>
-
+
+#include <external/zlib/unzip.h>
+
#include <string>
#include <vector>
@@ -68,7 +68,7 @@ public:
*/
static bool IsZipFile(const std::string& FileName);
- static bool IsZipFile(void* stream);
+ static bool IsZipFile(void* stream);
/** Returns wheter the version of the specified zip file may be uncompressed with the
@@ -88,7 +88,7 @@ public:
*/
static bool IsValidZipFileVersionNumber(const std::string& FileName);
- static bool IsValidZipFileVersionNumber(void* stream);
+ static bool IsValidZipFileVersionNumber(void* stream);
public:
@@ -106,7 +106,7 @@ public:
*/
ZipFile(const std::string& FileName);
- ZipFile(void* stream, zlib_filefunc_def* fa);
+ ZipFile(void* stream, zlib_filefunc_def* fa);
/** Destroys a zip file
diff --git a/shell/source/all/ooofilereader/basereader.cxx b/shell/source/all/ooofilereader/basereader.cxx
index eafe95de51..65ce293fb4 100644
--- a/shell/source/all/ooofilereader/basereader.cxx
+++ b/shell/source/all/ooofilereader/basereader.cxx
@@ -47,14 +47,14 @@ m_ZipFile( DocumentName )
//
//------------------------------
-CBaseReader::CBaseReader(void * sw, zlib_filefunc_def* fa):
-m_ZipFile( sw , fa )
-{
-}
-
-//------------------------------
-//
-//------------------------------
+CBaseReader::CBaseReader(void * sw, zlib_filefunc_def* fa):
+m_ZipFile( sw , fa )
+{
+}
+
+//------------------------------
+//
+//------------------------------
CBaseReader::~CBaseReader()
{
diff --git a/shell/source/all/ooofilereader/contentreader.cxx b/shell/source/all/ooofilereader/contentreader.cxx
index 92f7650737..86786bbf80 100644
--- a/shell/source/all/ooofilereader/contentreader.cxx
+++ b/shell/source/all/ooofilereader/contentreader.cxx
@@ -58,27 +58,27 @@ CBaseReader( DocumentName )
}
}
-CContentReader::CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa ) :
-CBaseReader( stream, fa )
-{
-try
- {
- m_DefaultLocale = DocumentLocale;
- Initialize( DOC_CONTENT_NAME );
- }
- catch(xml_parser_exception&
- #if OSL_DEBUG_LEVEL > 0
- ex
- #endif
- )
- {
- ENSURE(false, ex.what());
- }
- catch(...)
- {
- ENSURE(false, "Unknown error");
- }
-}
+CContentReader::CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa ) :
+CBaseReader( stream, fa )
+{
+try
+ {
+ m_DefaultLocale = DocumentLocale;
+ Initialize( DOC_CONTENT_NAME );
+ }
+ catch(xml_parser_exception&
+ #if OSL_DEBUG_LEVEL > 0
+ ex
+ #endif
+ )
+ {
+ ENSURE(false, ex.what());
+ }
+ catch(...)
+ {
+ ENSURE(false, "Unknown error");
+ }
+}
/** destructor.
diff --git a/shell/source/all/ooofilereader/metainforeader.cxx b/shell/source/all/ooofilereader/metainforeader.cxx
index 0d32992391..fd5376c5c5 100644
--- a/shell/source/all/ooofilereader/metainforeader.cxx
+++ b/shell/source/all/ooofilereader/metainforeader.cxx
@@ -77,48 +77,48 @@ CBaseReader( DocumentName )
}
}
-CMetaInfoReader::CMetaInfoReader( void* stream, zlib_filefunc_def* fa) :
-CBaseReader( stream, fa)
-{
-try
- {
- m_pKeywords_Builder = new CKeywordsTag( );
- m_pSimple_Builder = new CSimpleTag( );
- m_pDummy_Builder = new CDummyTag( );
-
- //retrieve all infomation that is useful
- m_AllMetaInfo[META_INFO_AUTHOR] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_TITLE] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_SUBJECT] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_KEYWORDS] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_DESCRIPTION] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_DOCUMENT_STATISTIC] = EMPTY_XML_TAG;
-
- m_AllMetaInfo[META_INFO_GENERATOR] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_CREATION] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_CREATOR] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_MODIFIED] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_LANGUAGE] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_DOCUMENT_NUMBER] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_EDITING_TIME] = EMPTY_XML_TAG;
-
- Initialize( META_CONTENT_NAME );
- }
- catch(xml_parser_exception&
- #if OSL_DEBUG_LEVEL > 0
- ex
- #endif
- )
- {
- ENSURE(false, ex.what());
- }
- catch(...)
- {
- ENSURE(false, "Unknown error");
- }
-
-}
-
+CMetaInfoReader::CMetaInfoReader( void* stream, zlib_filefunc_def* fa) :
+CBaseReader( stream, fa)
+{
+try
+ {
+ m_pKeywords_Builder = new CKeywordsTag( );
+ m_pSimple_Builder = new CSimpleTag( );
+ m_pDummy_Builder = new CDummyTag( );
+
+ //retrieve all infomation that is useful
+ m_AllMetaInfo[META_INFO_AUTHOR] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_TITLE] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_SUBJECT] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_KEYWORDS] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_DESCRIPTION] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_DOCUMENT_STATISTIC] = EMPTY_XML_TAG;
+
+ m_AllMetaInfo[META_INFO_GENERATOR] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_CREATION] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_CREATOR] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_MODIFIED] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_LANGUAGE] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_DOCUMENT_NUMBER] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_EDITING_TIME] = EMPTY_XML_TAG;
+
+ Initialize( META_CONTENT_NAME );
+ }
+ catch(xml_parser_exception&
+ #if OSL_DEBUG_LEVEL > 0
+ ex
+ #endif
+ )
+ {
+ ENSURE(false, ex.what());
+ }
+ catch(...)
+ {
+ ENSURE(false, "Unknown error");
+ }
+
+}
+
/** destructor.
*/
diff --git a/shell/source/all/zipfile/makefile.mk b/shell/source/all/zipfile/makefile.mk
index 2b77e5c3ae..9e16a7afe4 100644
--- a/shell/source/all/zipfile/makefile.mk
+++ b/shell/source/all/zipfile/makefile.mk
@@ -29,7 +29,7 @@ PRJ=..$/..$/..
PRJNAME=shell
TARGET=zipfile
ENABLE_EXCEPTIONS=TRUE
-EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
diff --git a/shell/source/all/zipfile/zipfile.cxx b/shell/source/all/zipfile/zipfile.cxx
index 5e3d203490..e043b954fc 100644
--- a/shell/source/all/zipfile/zipfile.cxx
+++ b/shell/source/all/zipfile/zipfile.cxx
@@ -76,10 +76,10 @@ bool ZipFile::IsZipFile(const std::string& /*FileName*/)
return true;
}
-bool ZipFile::IsZipFile(void* /*stream*/)
-{
- return true;
-}
+bool ZipFile::IsZipFile(void* /*stream*/)
+{
+ return true;
+}
/** Returns wheter the version of the specified zip file may be uncompressed with the
@@ -102,10 +102,10 @@ bool ZipFile::IsValidZipFileVersionNumber(const std::string& /*FileName*/)
return true;
}
-bool ZipFile::IsValidZipFileVersionNumber(void* /* stream*/)
-{
- return true;
-}
+bool ZipFile::IsValidZipFileVersionNumber(void* /* stream*/)
+{
+ return true;
+}
/** Constructs a zip file from a zip file
@@ -128,14 +128,14 @@ ZipFile::ZipFile(const std::string& FileName)
throw IOException(-1);
}
-ZipFile::ZipFile(void* stream, zlib_filefunc_def* fa)
-{
- fa->opaque = stream;
- m_uzFile = unzOpen2((const char *)NULL, fa);
-
- if (0 == m_uzFile)
- throw IOException(-1);
-}
+ZipFile::ZipFile(void* stream, zlib_filefunc_def* fa)
+{
+ fa->opaque = stream;
+ m_uzFile = unzOpen2((const char *)NULL, fa);
+
+ if (0 == m_uzFile)
+ throw IOException(-1);
+}
/** Destroys a zip file
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
index 32c38a4ef8..2dfb4699ec 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
@@ -75,8 +75,8 @@
#include <ntquery.h>
#include "assert.h"
#include "ooofilt.hxx"
-#include <objidl.h>
-#include <stdio.h>
+#include <objidl.h>
+#include <stdio.h>
#include "propspec.hxx"
#ifdef __MINGW32__
#include <algorithm>
@@ -117,7 +117,7 @@ COooFilter::COooFilter() :
m_ChunkPosition(0),
m_cAttributes(0),
m_pAttributes(0),
- m_pStream(NULL)
+ m_pStream(NULL)
{
InterlockedIncrement( &g_lInstances );
@@ -173,8 +173,8 @@ SCODE STDMETHODCALLTYPE COooFilter::QueryInterface(
pUnkTemp = (IUnknown *)(IPersistFile *)this;
else if ( IID_IPersist == riid )
pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this;
- else if (IID_IPersistStream == riid)
- pUnkTemp = (IUnknown *)(IPersistStream *)this;
+ else if (IID_IPersistStream == riid)
+ pUnkTemp = (IUnknown *)(IPersistStream *)this;
else if ( IID_IUnknown == riid )
pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this;
else
@@ -717,99 +717,99 @@ SCODE STDMETHODCALLTYPE COooFilter::SaveCompleted(LPCWSTR /*pszFileName*/)
return S_OK;
}
-//M-------------------------------------------------------------------------
-//
-// Method: COooFilter::Load (IPersistStream::Load)
-//
-// Summary: Initializes an object from the stream where it was previously saved
-//
-// Arguments: pStm
-// [in] Pointer to stream from which object should be loaded
-//
-//
-// Returns: S_OK
-// E_OUTOFMEMORY
-// E_FAIL
-//
-//
-//--------------------------------------------------------------------------
-SCODE STDMETHODCALLTYPE COooFilter::Load(IStream *pStm)
-{
-
- // These next few lines work around the "Seek pointer" bug found on Vista.
-
- char buf[20];
- unsigned long count;
- HRESULT hr;
- ULARGE_INTEGER NewPosition;
- LARGE_INTEGER Move;
- Move.QuadPart = 0;
- hr = pStm->Seek (Move, STREAM_SEEK_SET, &NewPosition);
- hr = pStm->Read (buf, 20, &count);
-
- zlib_filefunc_def z_filefunc;
- fill_stream_filefunc (&z_filefunc);
- z_filefunc.opaque = (void*)pStm;
-
- m_pStream = pStm;
-
- try
- {
- if (m_pMetaInfoReader)
- delete m_pMetaInfoReader;
- m_pMetaInfoReader = new CMetaInfoReader((void*)m_pStream, &z_filefunc);
-
- if (m_pContentReader)
- delete m_pContentReader;
- m_pContentReader = new CContentReader((void*)m_pStream, m_pMetaInfoReader->getDefaultLocale(), &z_filefunc);
- }
- catch (const std::exception&)
- {
- return E_FAIL;
- }
- return S_OK;
-}
-
-//M-------------------------------------------------------------------------
-//
-// Method: COooFilter::GetSizeMax (IPersistStream::GetSizeMax)
-//
-// Summary: Returns the size in bytes of the stream neede to save the object.
-//
-// Arguments: pcbSize
-// [out] Pointer to a 64 bit unsigned int indicating the size needed
-//
-// Returns: E_NOTIMPL
-//
-//
-//--------------------------------------------------------------------------
-SCODE STDMETHODCALLTYPE COooFilter::GetSizeMax(ULARGE_INTEGER * /*pcbSize*/)
-{
- //
- return E_NOTIMPL;
-}
-
-//M-------------------------------------------------------------------------
-//
-// Method: COooFilter::Save (IPersistStream::Save)
-//
-// Summary: Save object to specified stream
-//
-// Arguments: pStm
-// [in] Pointer to stream
-//
-// fClearDirty
-// [in] Indicates whether to clear dirty flag
-//
-// Returns: E_NOTIMPL
-//
-//
-//--------------------------------------------------------------------------
-SCODE STDMETHODCALLTYPE COooFilter::Save(IStream * /*pStm*/, BOOL )
-{
- //
- return E_NOTIMPL;
-}
+//M-------------------------------------------------------------------------
+//
+// Method: COooFilter::Load (IPersistStream::Load)
+//
+// Summary: Initializes an object from the stream where it was previously saved
+//
+// Arguments: pStm
+// [in] Pointer to stream from which object should be loaded
+//
+//
+// Returns: S_OK
+// E_OUTOFMEMORY
+// E_FAIL
+//
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::Load(IStream *pStm)
+{
+
+ // These next few lines work around the "Seek pointer" bug found on Vista.
+
+ char buf[20];
+ unsigned long count;
+ HRESULT hr;
+ ULARGE_INTEGER NewPosition;
+ LARGE_INTEGER Move;
+ Move.QuadPart = 0;
+ hr = pStm->Seek (Move, STREAM_SEEK_SET, &NewPosition);
+ hr = pStm->Read (buf, 20, &count);
+
+ zlib_filefunc_def z_filefunc;
+ fill_stream_filefunc (&z_filefunc);
+ z_filefunc.opaque = (void*)pStm;
+
+ m_pStream = pStm;
+
+ try
+ {
+ if (m_pMetaInfoReader)
+ delete m_pMetaInfoReader;
+ m_pMetaInfoReader = new CMetaInfoReader((void*)m_pStream, &z_filefunc);
+
+ if (m_pContentReader)
+ delete m_pContentReader;
+ m_pContentReader = new CContentReader((void*)m_pStream, m_pMetaInfoReader->getDefaultLocale(), &z_filefunc);
+ }
+ catch (const std::exception&)
+ {
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+//M-------------------------------------------------------------------------
+//
+// Method: COooFilter::GetSizeMax (IPersistStream::GetSizeMax)
+//
+// Summary: Returns the size in bytes of the stream neede to save the object.
+//
+// Arguments: pcbSize
+// [out] Pointer to a 64 bit unsigned int indicating the size needed
+//
+// Returns: E_NOTIMPL
+//
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::GetSizeMax(ULARGE_INTEGER * /*pcbSize*/)
+{
+ //
+ return E_NOTIMPL;
+}
+
+//M-------------------------------------------------------------------------
+//
+// Method: COooFilter::Save (IPersistStream::Save)
+//
+// Summary: Save object to specified stream
+//
+// Arguments: pStm
+// [in] Pointer to stream
+//
+// fClearDirty
+// [in] Indicates whether to clear dirty flag
+//
+// Returns: E_NOTIMPL
+//
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::Save(IStream * /*pStm*/, BOOL )
+{
+ //
+ return E_NOTIMPL;
+}
//M-------------------------------------------------------------------------
//
@@ -1244,13 +1244,13 @@ namespace /* private */
if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist.c_str(), "", "OpenOffice.org Persistent Handler"))
return E_FAIL;
- // Add missing entry
- std::string ClsidEntry_Persist_Entry = CLSID_PERSIST_ENTRY;
- SubstitutePlaceholder(ClsidEntry_Persist_Entry,
- GUID_PLACEHOLDER,
- ClsidToString(PersistentGuid));
-
- if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist_Entry.c_str(), "", ClsidToString(PersistentGuid).c_str()));
+ // Add missing entry
+ std::string ClsidEntry_Persist_Entry = CLSID_PERSIST_ENTRY;
+ SubstitutePlaceholder(ClsidEntry_Persist_Entry,
+ GUID_PLACEHOLDER,
+ ClsidToString(PersistentGuid));
+
+ if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist_Entry.c_str(), "", ClsidToString(PersistentGuid).c_str()));
std::string ClsidEntry_Persist_Addin = CLSID_GUID_PERSIST_ADDIN_ENTRY;
@@ -1502,99 +1502,99 @@ STDAPI DllUnregisterServer()
return S_OK;
}
-extern "C" {
-
- // IStream callback
- voidpf ZCALLBACK cb_sopen (voidpf opaque, const char* filename, int mode) {
- return opaque;
- }
-
- uLong ZCALLBACK cb_sread (voidpf opaque, voidpf stream, void* buf, uLong size) {
- unsigned long newsize;
- HRESULT hr;
-
- hr = ((IStream *)stream)->Read (buf, size, &newsize);
- if (hr == S_OK){
- return (unsigned long)newsize;
- }
- else {
- return (uLong)0;
- }
- }
-
- long ZCALLBACK cb_sseek (voidpf opaque, voidpf stream, uLong offset, int origin) {
- // IStream::Seek parameters
- HRESULT hr;
- LARGE_INTEGER Move;
- DWORD dwOrigin;
- Move.QuadPart = (__int64)offset;
-
- switch (origin) {
- case SEEK_CUR:
- dwOrigin = STREAM_SEEK_CUR;
- break;
- case SEEK_END:
- dwOrigin = STREAM_SEEK_END;
- break;
- case SEEK_SET:
- dwOrigin = STREAM_SEEK_SET;
- break;
- default:
- return -1;
- }
-
- hr = ((IStream*)stream)->Seek (Move, dwOrigin, NULL);
- if (hr == S_OK){
- return 0;
- }
- else {
- return -1;
- }
- }
-
- long ZCALLBACK cb_stell (voidpf opaque, voidpf stream) {
- // IStream::Seek parameters
- HRESULT hr;
- LARGE_INTEGER Move;
- ULARGE_INTEGER NewPosition;
- Move.QuadPart = 0;
- NewPosition.QuadPart = 0;
-
- hr = ((IStream*)stream)->Seek (Move, STREAM_SEEK_CUR, &NewPosition);
- if (hr == S_OK){
- return (long) NewPosition.QuadPart;
- }
- else {
- return -1;
- }
- }
-
- int ZCALLBACK cb_sclose (voidpf opaque, voidpf stream) {
- return 0;
- }
-
- int ZCALLBACK cb_serror (voidpf opaque, voidpf stream) {
- return 0; //RJK - for now
- }
-
- uLong ZCALLBACK cb_swrite (voidpf opaque, voidpf stream, const void* buf, uLong size) {
- HRESULT hr;
- unsigned long writecount;
- hr = ((IStream*)stream)->Write (buf, size, &writecount);
- if (hr == S_OK)
- return (unsigned int)writecount;
- else
- return (uLong)0;
- }
-
- void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def) {
- pzlib_filefunc_def->zopen_file = cb_sopen;
- pzlib_filefunc_def->zread_file = cb_sread;
- pzlib_filefunc_def->zwrite_file = cb_swrite;
- pzlib_filefunc_def->ztell_file = cb_stell;
- pzlib_filefunc_def->zseek_file = cb_sseek;
- pzlib_filefunc_def->zclose_file = cb_sclose;
- pzlib_filefunc_def->zerror_file = cb_serror;
- }
-}
+extern "C" {
+
+ // IStream callback
+ voidpf ZCALLBACK cb_sopen (voidpf opaque, const char* filename, int mode) {
+ return opaque;
+ }
+
+ uLong ZCALLBACK cb_sread (voidpf opaque, voidpf stream, void* buf, uLong size) {
+ unsigned long newsize;
+ HRESULT hr;
+
+ hr = ((IStream *)stream)->Read (buf, size, &newsize);
+ if (hr == S_OK){
+ return (unsigned long)newsize;
+ }
+ else {
+ return (uLong)0;
+ }
+ }
+
+ long ZCALLBACK cb_sseek (voidpf opaque, voidpf stream, uLong offset, int origin) {
+ // IStream::Seek parameters
+ HRESULT hr;
+ LARGE_INTEGER Move;
+ DWORD dwOrigin;
+ Move.QuadPart = (__int64)offset;
+
+ switch (origin) {
+ case SEEK_CUR:
+ dwOrigin = STREAM_SEEK_CUR;
+ break;
+ case SEEK_END:
+ dwOrigin = STREAM_SEEK_END;
+ break;
+ case SEEK_SET:
+ dwOrigin = STREAM_SEEK_SET;
+ break;
+ default:
+ return -1;
+ }
+
+ hr = ((IStream*)stream)->Seek (Move, dwOrigin, NULL);
+ if (hr == S_OK){
+ return 0;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ long ZCALLBACK cb_stell (voidpf opaque, voidpf stream) {
+ // IStream::Seek parameters
+ HRESULT hr;
+ LARGE_INTEGER Move;
+ ULARGE_INTEGER NewPosition;
+ Move.QuadPart = 0;
+ NewPosition.QuadPart = 0;
+
+ hr = ((IStream*)stream)->Seek (Move, STREAM_SEEK_CUR, &NewPosition);
+ if (hr == S_OK){
+ return (long) NewPosition.QuadPart;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ int ZCALLBACK cb_sclose (voidpf opaque, voidpf stream) {
+ return 0;
+ }
+
+ int ZCALLBACK cb_serror (voidpf opaque, voidpf stream) {
+ return 0; //RJK - for now
+ }
+
+ uLong ZCALLBACK cb_swrite (voidpf opaque, voidpf stream, const void* buf, uLong size) {
+ HRESULT hr;
+ unsigned long writecount;
+ hr = ((IStream*)stream)->Write (buf, size, &writecount);
+ if (hr == S_OK)
+ return (unsigned int)writecount;
+ else
+ return (uLong)0;
+ }
+
+ void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def) {
+ pzlib_filefunc_def->zopen_file = cb_sopen;
+ pzlib_filefunc_def->zread_file = cb_sread;
+ pzlib_filefunc_def->zwrite_file = cb_swrite;
+ pzlib_filefunc_def->ztell_file = cb_stell;
+ pzlib_filefunc_def->zseek_file = cb_sseek;
+ pzlib_filefunc_def->zclose_file = cb_sclose;
+ pzlib_filefunc_def->zerror_file = cb_serror;
+ }
+}
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
index 10cb16210d..2ec96441fa 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
@@ -93,7 +93,7 @@ enum FilterState
FilteringContent, // Filtering the content property
FilteringProperty // Filtering the pseudo property
};
-class COooFilter : public IFilter, public IPersistFile, public IPersistStream
+class COooFilter : public IFilter, public IPersistFile, public IPersistStream
{
public:
// From IUnknown
@@ -140,16 +140,16 @@ public:
virtual SCODE STDMETHODCALLTYPE GetCurFile(
LPWSTR * ppszFileName);
- // From IPersistStream
- virtual SCODE STDMETHODCALLTYPE Load(
- IStream *pStm);
-
- virtual SCODE STDMETHODCALLTYPE Save(
- IStream *pStm,
- BOOL fClearDirty);
-
- virtual SCODE STDMETHODCALLTYPE GetSizeMax(
- ULARGE_INTEGER *pcbSize);
+ // From IPersistStream
+ virtual SCODE STDMETHODCALLTYPE Load(
+ IStream *pStm);
+
+ virtual SCODE STDMETHODCALLTYPE Save(
+ IStream *pStm,
+ BOOL fClearDirty);
+
+ virtual SCODE STDMETHODCALLTYPE GetSizeMax(
+ ULARGE_INTEGER *pcbSize);
private:
@@ -174,7 +174,7 @@ private:
ULONG m_ChunkPosition; // Chunk pointer to specify the current Chunk;
ULONG m_cAttributes; // Count of attributes
CFullPropSpec * m_pAttributes; // Attributes to filter
- IStream * m_pStream;
+ IStream * m_pStream;
};
@@ -217,20 +217,20 @@ private:
long m_lRefs; // Reference count
};
-extern "C" {
-
- voidpf ZCALLBACK cb_sopen OF((voidpf opaque, const char * filename, int mode));
- uLong ZCALLBACK cb_sread OF((voidpf opaque, voidpf stream, void* vuf, uLong size));
- uLong ZCALLBACK cb_swrite OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
- long ZCALLBACK cb_stell OF((voidpf opaque, voidpf stream));
- long ZCALLBACK cb_sseek OF((voidpf opaque, voidpf stream, uLong offset, int origin));
- int ZCALLBACK cb_sclose OF((voidpf opaque, voidpf stream));
- int ZCALLBACK cb_serror OF((voidpf opaque, voidpf stream));
-
- void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def);
-
-}
-
+extern "C" {
+
+ voidpf ZCALLBACK cb_sopen OF((voidpf opaque, const char * filename, int mode));
+ uLong ZCALLBACK cb_sread OF((voidpf opaque, voidpf stream, void* vuf, uLong size));
+ uLong ZCALLBACK cb_swrite OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
+ long ZCALLBACK cb_stell OF((voidpf opaque, voidpf stream));
+ long ZCALLBACK cb_sseek OF((voidpf opaque, voidpf stream, uLong offset, int origin));
+ int ZCALLBACK cb_sclose OF((voidpf opaque, voidpf stream));
+ int ZCALLBACK cb_serror OF((voidpf opaque, voidpf stream));
+
+ void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def);
+
+}
+
diff --git a/svx/inc/svx/editview.hxx b/svx/inc/svx/editview.hxx
index 07b7e7d196..8c3b2cf296 100644
--- a/svx/inc/svx/editview.hxx
+++ b/svx/inc/svx/editview.hxx
@@ -241,7 +241,7 @@ public:
static bool ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList );
- String GetSurroundingText() const;
+ String GetSurroundingText() const;
Selection GetSurroundingTextSelection() const;
};
diff --git a/svx/inc/svx/exthelpid.hrc b/svx/inc/svx/exthelpid.hrc
index 570d5f875d..2008375dde 100644
--- a/svx/inc/svx/exthelpid.hrc
+++ b/svx/inc/svx/exthelpid.hrc
@@ -38,7 +38,7 @@
// Help-Ids --------------------------------------------------------------
#define HID_GALLERY_ACTUALIZE (HID_SVX_EXT0_START + 0)
-#define HID_GALLERY_TITLE (HID_SVX_EXT0_START + 1)
+#define HID_GALLERY_TITLE (HID_SVX_EXT0_START + 1)
// please adjust ACT_SVX_EXT_HID_END2 below if you add entries here!
diff --git a/svx/inc/svx/outliner.hxx b/svx/inc/svx/outliner.hxx
index f9fc9a5a70..969ba61bff 100644
--- a/svx/inc/svx/outliner.hxx
+++ b/svx/inc/svx/outliner.hxx
@@ -385,7 +385,7 @@ public:
void SetInvalidateMore( USHORT nPixel );
USHORT GetInvalidateMore() const;
- String GetSurroundingText() const;
+ String GetSurroundingText() const;
Selection GetSurroundingTextSelection() const;
};
diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx
index f1c31e29c3..cb821091d1 100644
--- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx
+++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx
@@ -57,8 +57,8 @@ namespace drawinglayer
// making exceptions with shadow generation
unsigned mb3DShape : 1;
- // #SJ# Allow text clipping against TextBox in special cases (used for SC)
- unsigned mbForceTextClipToTextRange : 1;
+ // #SJ# Allow text clipping against TextBox in special cases (used for SC)
+ unsigned mbForceTextClipToTextRange : 1;
protected:
// local decomposition.
diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
index f13b3ff405..ad86cee04d 100644
--- a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
+++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
@@ -33,7 +33,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <svx/outlobj.hxx>
-#include <tools/color.hxx>
+#include <tools/color.hxx>
#include <svx/sdr/attribute/sdrformtextattribute.hxx>
#include <tools/weakbase.hxx>
#include <svx/sdtaitm.hxx>
diff --git a/svx/inc/svx/shapeproperty.hxx b/svx/inc/svx/shapeproperty.hxx
index 46ffdb1703..ccd041888a 100755
--- a/svx/inc/svx/shapeproperty.hxx
+++ b/svx/inc/svx/shapeproperty.hxx
@@ -23,7 +23,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
+
#ifndef SVX_SHAPEPROPERTY_HXX
#define SVX_SHAPEPROPERTY_HXX
diff --git a/svx/inc/svx/shapepropertynotifier.hxx b/svx/inc/svx/shapepropertynotifier.hxx
index b664d96062..01ceed36a8 100644
--- a/svx/inc/svx/shapepropertynotifier.hxx
+++ b/svx/inc/svx/shapepropertynotifier.hxx
@@ -23,7 +23,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
+
#ifndef SVX_PROPERTYCHANGENOTIFIER_HXX
#define SVX_PROPERTYCHANGENOTIFIER_HXX
diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx
index 68f64c215f..c2e10c8ba1 100644
--- a/svx/inc/svx/svdoashp.hxx
+++ b/svx/inc/svx/svdoashp.hxx
@@ -176,7 +176,7 @@ public:
virtual UINT16 GetObjIdentifier() const;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
- virtual void SetModel(SdrModel* pNewModel);
+ virtual void SetModel(SdrModel* pNewModel);
virtual void RecalcSnapRect();
diff --git a/svx/source/editeng/editview.cxx b/svx/source/editeng/editview.cxx
index e120f5f89e..fb8e8b8152 100644
--- a/svx/source/editeng/editview.cxx
+++ b/svx/source/editeng/editview.cxx
@@ -1544,53 +1544,53 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFo
return bRet;
}
-String EditView::GetSurroundingText() const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( PIMPEE->GetEditDoc() );
-
- if( HasSelection() )
- {
- XubString aStr = PIMPEE->GetSelected( aSel );
-
- // Stop reconversion if the selected text includes a line break.
- if ( aStr.Search( 0x0A ) == STRING_NOTFOUND )
- return aStr;
- else
- return String();
- }
- else
- {
- aSel.Min().SetIndex( 0 );
- aSel.Max().SetIndex( aSel.Max().GetNode()->Len() );
- return PIMPEE->GetSelected( aSel );
- }
-}
-
-Selection EditView::GetSurroundingTextSelection() const
-{
- DBG_CHKTHIS( EditView, 0 );
-
- ESelection aSelection( GetSelection() );
- aSelection.Adjust();
-
- if( HasSelection() )
- {
- EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( PIMPEE->GetEditDoc() );
- XubString aStr = PIMPEE->GetSelected( aSel );
-
- // Stop reconversion if the selected text includes a line break.
- if ( aStr.Search( 0x0A ) == STRING_NOTFOUND )
- return Selection( 0, aSelection.nEndPos - aSelection.nStartPos );
- else
- return Selection( 0, 0 );
- }
- else
- {
- return Selection( aSelection.nStartPos, aSelection.nEndPos );
- }
-}
+String EditView::GetSurroundingText() const
+{
+ DBG_CHKTHIS( EditView, 0 );
+ DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
+
+ EditSelection aSel( pImpEditView->GetEditSelection() );
+ aSel.Adjust( PIMPEE->GetEditDoc() );
+
+ if( HasSelection() )
+ {
+ XubString aStr = PIMPEE->GetSelected( aSel );
+
+ // Stop reconversion if the selected text includes a line break.
+ if ( aStr.Search( 0x0A ) == STRING_NOTFOUND )
+ return aStr;
+ else
+ return String();
+ }
+ else
+ {
+ aSel.Min().SetIndex( 0 );
+ aSel.Max().SetIndex( aSel.Max().GetNode()->Len() );
+ return PIMPEE->GetSelected( aSel );
+ }
+}
+
+Selection EditView::GetSurroundingTextSelection() const
+{
+ DBG_CHKTHIS( EditView, 0 );
+
+ ESelection aSelection( GetSelection() );
+ aSelection.Adjust();
+
+ if( HasSelection() )
+ {
+ EditSelection aSel( pImpEditView->GetEditSelection() );
+ aSel.Adjust( PIMPEE->GetEditDoc() );
+ XubString aStr = PIMPEE->GetSelected( aSel );
+
+ // Stop reconversion if the selected text includes a line break.
+ if ( aStr.Search( 0x0A ) == STRING_NOTFOUND )
+ return Selection( 0, aSelection.nEndPos - aSelection.nStartPos );
+ else
+ return Selection( 0, 0 );
+ }
+ else
+ {
+ return Selection( aSelection.nStartPos, aSelection.nEndPos );
+ }
+}
diff --git a/svx/source/editeng/impedit2.cxx b/svx/source/editeng/impedit2.cxx
index d1c67f4544..5ea07b9885 100644
--- a/svx/source/editeng/impedit2.cxx
+++ b/svx/source/editeng/impedit2.cxx
@@ -638,41 +638,41 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView )
pView->GetWindow()->SetCursorRect();
}
}
- else if ( rCEvt.GetCommand() == COMMAND_SELECTIONCHANGE )
- {
- const CommandSelectionChangeData *pData = rCEvt.GetSelectionChangeData();
-
- ESelection aSelection = pView->GetSelection();
- aSelection.Adjust();
-
- if( pView->HasSelection() )
- {
- aSelection.nEndPos = aSelection.nStartPos;
- aSelection.nStartPos += pData->GetStart();
- aSelection.nEndPos += pData->GetEnd();
- }
- else
- {
- aSelection.nStartPos = pData->GetStart();
- aSelection.nEndPos = pData->GetEnd();
- }
- pView->SetSelection( aSelection );
- }
- else if ( rCEvt.GetCommand() == COMMAND_PREPARERECONVERSION )
- {
- if ( pView->HasSelection() )
- {
- ESelection aSelection = pView->GetSelection();
- aSelection.Adjust();
-
- if ( aSelection.nStartPara != aSelection.nEndPara )
- {
- xub_StrLen aParaLen = pEditEngine->GetTextLen( aSelection.nStartPara );
- aSelection.nEndPara = aSelection.nStartPara;
- aSelection.nEndPos = aParaLen;
- pView->SetSelection( aSelection );
- }
- }
+ else if ( rCEvt.GetCommand() == COMMAND_SELECTIONCHANGE )
+ {
+ const CommandSelectionChangeData *pData = rCEvt.GetSelectionChangeData();
+
+ ESelection aSelection = pView->GetSelection();
+ aSelection.Adjust();
+
+ if( pView->HasSelection() )
+ {
+ aSelection.nEndPos = aSelection.nStartPos;
+ aSelection.nStartPos += pData->GetStart();
+ aSelection.nEndPos += pData->GetEnd();
+ }
+ else
+ {
+ aSelection.nStartPos = pData->GetStart();
+ aSelection.nEndPos = pData->GetEnd();
+ }
+ pView->SetSelection( aSelection );
+ }
+ else if ( rCEvt.GetCommand() == COMMAND_PREPARERECONVERSION )
+ {
+ if ( pView->HasSelection() )
+ {
+ ESelection aSelection = pView->GetSelection();
+ aSelection.Adjust();
+
+ if ( aSelection.nStartPara != aSelection.nEndPara )
+ {
+ xub_StrLen aParaLen = pEditEngine->GetTextLen( aSelection.nStartPara );
+ aSelection.nEndPara = aSelection.nStartPara;
+ aSelection.nEndPos = aParaLen;
+ pView->SetSelection( aSelection );
+ }
+ }
}
GetSelEngine().Command( rCEvt );
diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx
index e9718cb9d1..b190f888e7 100644
--- a/svx/source/form/fmPropBrw.cxx
+++ b/svx/source/form/fmPropBrw.cxx
@@ -28,20 +28,20 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-#include "fmhelp.hrc"
-#include "fmprop.hrc"
+#include "fmhelp.hrc"
+#include "fmprop.hrc"
#include "fmPropBrw.hxx"
#include "fmresids.hrc"
#include "fmservs.hxx"
-#include "fmshimp.hxx"
-#include "fmpgeimp.hxx"
+#include "fmshimp.hxx"
+#include "fmpgeimp.hxx"
-#include "svx/dialmgr.hxx"
-#include "svx/fmpage.hxx"
-#include "svx/fmshell.hxx"
-#include "svx/sdrpagewindow.hxx"
-#include "svx/svdpagv.hxx"
-#include "svx/svxids.hrc"
+#include "svx/dialmgr.hxx"
+#include "svx/fmpage.hxx"
+#include "svx/fmshell.hxx"
+#include "svx/sdrpagewindow.hxx"
+#include "svx/svdpagv.hxx"
+#include "svx/svxids.hrc"
/** === begin UNO includes === **/
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -60,20 +60,20 @@
/** === end UNO includes === **/
#include <comphelper/processfactory.hxx>
-#include <comphelper/property.hxx>
+#include <comphelper/property.hxx>
#include <cppuhelper/component_context.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/childwin.hxx>
-#include <sfx2/dispatch.hxx>
+#include <sfx2/dispatch.hxx>
#include <sfx2/objitem.hxx>
-#include <sfx2/objsh.hxx>
-#include <sfx2/viewfrm.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewfrm.hxx>
#include <toolkit/unohlp.hxx>
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <tools/shl.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/shl.hxx>
#include <unotools/confignode.hxx>
-#include <vcl/stdtext.hxx>
+#include <vcl/stdtext.hxx>
#include <algorithm>
diff --git a/svx/source/form/legacyformcontroller.cxx b/svx/source/form/legacyformcontroller.cxx
index 66ea6febcc..07451d5278 100644
--- a/svx/source/form/legacyformcontroller.cxx
+++ b/svx/source/form/legacyformcontroller.cxx
@@ -23,7 +23,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
+
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
index 48ca9dcff4..6d39d8eae9 100644
--- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
@@ -71,8 +71,8 @@ namespace sdr
basegfx::B3DPolyPolygon aPolyPolygon3D(GetE3dPolygonObj().GetPolyPolygon3D());
const basegfx::B3DPolyPolygon aPolyNormals3D(GetE3dPolygonObj().GetPolyNormals3D());
const basegfx::B2DPolyPolygon aPolyTexture2D(GetE3dPolygonObj().GetPolyTexture2D());
- const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count());
- const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count());
+ const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count());
+ const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count());
if(bNormals || bTexture)
{
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
index 462cafd5c8..645a980a1c 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -38,8 +38,8 @@
#include <drawinglayer/attribute/fillattribute.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <com/sun/star/embed/EmbedMisc.hpp>
-#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/embed/EmbedMisc.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
//////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
index cf795f41d1..e95a5663bc 100644
--- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
@@ -117,13 +117,13 @@ namespace drawinglayer
mbContainsOtherFields(false)
{
const EditTextObject& rETO = maOutlinerParaObject.GetTextObject();
-
- mbContainsPageField = rETO.HasField(SvxPageField::StaticType());
- mbContainsPageCountField = rETO.HasField(SvxPagesField::StaticType());
- mbContainsOtherFields = rETO.HasField(SvxHeaderField::StaticType())
- || rETO.HasField(SvxFooterField::StaticType())
- || rETO.HasField(SvxDateTimeField::StaticType())
- || rETO.HasField(SvxAuthorField::StaticType());
+
+ mbContainsPageField = rETO.HasField(SvxPageField::StaticType());
+ mbContainsPageCountField = rETO.HasField(SvxPagesField::StaticType());
+ mbContainsOtherFields = rETO.HasField(SvxHeaderField::StaticType())
+ || rETO.HasField(SvxFooterField::StaticType())
+ || rETO.HasField(SvxDateTimeField::StaticType())
+ || rETO.HasField(SvxAuthorField::StaticType());
}
bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index a8fa4474d5..658b63d6fa 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -206,9 +206,9 @@ void __EXPORT SdrMarkView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
bMarkedPointsRectsDirty=TRUE;
}
/* removed for now since this breaks existing code who iterates over the mark list and sequentially replaces objects
- if( eKind==HINT_OBJREMOVED && IsObjMarked( const_cast<SdrObject*>(pSdrHint->GetObject()) ) )
- {
- MarkObj( const_cast<SdrObject*>(pSdrHint->GetObject()), GetSdrPageView(), TRUE );
+ if( eKind==HINT_OBJREMOVED && IsObjMarked( const_cast<SdrObject*>(pSdrHint->GetObject()) ) )
+ {
+ MarkObj( const_cast<SdrObject*>(pSdrHint->GetObject()), GetSdrPageView(), TRUE );
}
*/
}
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 185cc08649..e24e27883c 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1671,11 +1671,11 @@ void SdrObjCustomShape::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
}
}
-void SdrObjCustomShape::SetModel(SdrModel* pNewModel)
-{
- SdrTextObj::SetModel(pNewModel);
- mXRenderedCustomShape.clear();
-}
+void SdrObjCustomShape::SetModel(SdrModel* pNewModel)
+{
+ SdrTextObj::SetModel(pNewModel);
+ mXRenderedCustomShape.clear();
+}
UINT16 SdrObjCustomShape::GetObjIdentifier() const
{
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index cc8a269ff2..1401be1059 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -90,10 +90,10 @@ namespace
// the visible area for contour text decomposition
basegfx::B2DVector maScale;
- // #SJ# ClipRange for BlockText decomposition; only text portions completely
- // inside are to be accepted, so this is different from geometric clipping
- // (which would allow e.g. upper parts of portions to remain). Only used for
- // BlockText (see there)
+ // #SJ# ClipRange for BlockText decomposition; only text portions completely
+ // inside are to be accepted, so this is different from geometric clipping
+ // (which would allow e.g. upper parts of portions to remain). Only used for
+ // BlockText (see there)
basegfx::B2DRange maClipRange;
DECL_LINK(decomposeContourTextPrimitive, DrawPortionInfo* );
@@ -115,12 +115,12 @@ namespace
public:
impTextBreakupHandler(SdrOutliner& rOutliner)
: maTextPortionPrimitives(),
- maLinePrimitives(),
- maParagraphPrimitives(),
- mrOutliner(rOutliner),
- maNewTransformA(),
- maNewTransformB(),
- maScale(),
+ maLinePrimitives(),
+ maParagraphPrimitives(),
+ mrOutliner(rOutliner),
+ maNewTransformA(),
+ maNewTransformB(),
+ maScale(),
maClipRange()
{
}
@@ -573,43 +573,43 @@ namespace
{
if(pInfo)
{
- // #SJ# Is clipping wanted? This is text clipping; only accept a portion
- // if it's completely in the range
- if(!maClipRange.isEmpty())
- {
- // Test start position first; this allows to not get the text range at
- // all if text is far outside
- const basegfx::B2DPoint aStartPosition(pInfo->mrStartPos.X(), pInfo->mrStartPos.Y());
-
- if(!maClipRange.isInside(aStartPosition))
- {
- return 0;
- }
-
- // Start position is inside. Get TextBoundRect and TopLeft next
- drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice;
- aTextLayouterDevice.setFont(pInfo->mrFont);
-
- const basegfx::B2DRange aTextBoundRect(
- aTextLayouterDevice.getTextBoundRect(
- pInfo->mrText, pInfo->mnTextStart, pInfo->mnTextLen));
- const basegfx::B2DPoint aTopLeft(aTextBoundRect.getMinimum() + aStartPosition);
-
- if(!maClipRange.isInside(aTopLeft))
- {
- return 0;
- }
-
- // TopLeft is inside. Get BottomRight and check
- const basegfx::B2DPoint aBottomRight(aTextBoundRect.getMaximum() + aStartPosition);
-
- if(!maClipRange.isInside(aBottomRight))
- {
- return 0;
- }
-
- // all inside, clip was successful
- }
+ // #SJ# Is clipping wanted? This is text clipping; only accept a portion
+ // if it's completely in the range
+ if(!maClipRange.isEmpty())
+ {
+ // Test start position first; this allows to not get the text range at
+ // all if text is far outside
+ const basegfx::B2DPoint aStartPosition(pInfo->mrStartPos.X(), pInfo->mrStartPos.Y());
+
+ if(!maClipRange.isInside(aStartPosition))
+ {
+ return 0;
+ }
+
+ // Start position is inside. Get TextBoundRect and TopLeft next
+ drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice;
+ aTextLayouterDevice.setFont(pInfo->mrFont);
+
+ const basegfx::B2DRange aTextBoundRect(
+ aTextLayouterDevice.getTextBoundRect(
+ pInfo->mrText, pInfo->mnTextStart, pInfo->mnTextLen));
+ const basegfx::B2DPoint aTopLeft(aTextBoundRect.getMinimum() + aStartPosition);
+
+ if(!maClipRange.isInside(aTopLeft))
+ {
+ return 0;
+ }
+
+ // TopLeft is inside. Get BottomRight and check
+ const basegfx::B2DPoint aBottomRight(aTextBoundRect.getMaximum() + aStartPosition);
+
+ if(!maClipRange.isInside(aBottomRight))
+ {
+ return 0;
+ }
+
+ // all inside, clip was successful
+ }
impHandleDrawPortionInfo(*pInfo);
}
@@ -918,13 +918,13 @@ void SdrTextObj::impDecomposeBlockTextPrimitive(
bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0,
fShearX, fRotate, aTranslate.getX(), aTranslate.getY()));
- // #SJ# create ClipRange (if needed)
- basegfx::B2DRange aClipRange;
-
- if(rSdrBlockTextPrimitive.getClipOnBounds())
- {
- aClipRange.expand(-aAdjOffset);
- aClipRange.expand(basegfx::B2DTuple(aAnchorTextSize.Width(), aAnchorTextSize.Height()) - aAdjOffset);
+ // #SJ# create ClipRange (if needed)
+ basegfx::B2DRange aClipRange;
+
+ if(rSdrBlockTextPrimitive.getClipOnBounds())
+ {
+ aClipRange.expand(-aAdjOffset);
+ aClipRange.expand(basegfx::B2DTuple(aAnchorTextSize.Width(), aAnchorTextSize.Height()) - aAdjOffset);
}
// now break up text primitives.
diff --git a/svx/source/unodraw/shapepropertynotifier.cxx b/svx/source/unodraw/shapepropertynotifier.cxx
index af00820a6e..3efda09cf7 100644
--- a/svx/source/unodraw/shapepropertynotifier.cxx
+++ b/svx/source/unodraw/shapepropertynotifier.cxx
@@ -23,7 +23,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
+
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
index 100baf7865..5e941a7664 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
@@ -43,8 +43,8 @@
#define INCLUDED_STL_SET
#endif
-#include <qe/Query.hxx>
-#include <qe/DocGenerator.hxx>
+#include <qe/Query.hxx>
+#include <qe/DocGenerator.hxx>
#include "resultsetforquery.hxx"
#include "databases.hxx"
@@ -158,8 +158,8 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< lang::XMultiServiceF
try
{
vector< vector<HitItem>* > aQueryListResultVectorVector;
- set< rtl::OUString > aSet,aCurrent,aResultSet;
-
+ set< rtl::OUString > aSet,aCurrent,aResultSet;
+
int nQueryListSize = queryList.size();
if( nQueryListSize > 1 )
hitCount = 2000;
@@ -178,25 +178,25 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< lang::XMultiServiceF
}
pQueryResultVector->reserve( hitCount );
- int nParamCount = bCaptionsOnly ? 7 : 6;
- Sequence<uno::Any> aParamsSeq( nParamCount );
-
- aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) );
- aParamsSeq[1] = uno::makeAny( m_aURLParameter.get_language() );
-
- aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-index" ) );
- rtl::OUString aSystemPath;
- osl::FileBase::getSystemPathFromFileURL( idxDir, aSystemPath );
- aParamsSeq[3] = uno::makeAny( aSystemPath );
-
- aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-query" ) );
-
- const std::vector< rtl::OUString >& aListItem = queryList[i];
- ::rtl::OUString aNewQueryStr = aListItem[0];
- aParamsSeq[5] = uno::makeAny( aNewQueryStr );
-
- if( bCaptionsOnly )
- aParamsSeq[6] = uno::makeAny( rtl::OUString::createFromAscii( "-caption" ) );
+ int nParamCount = bCaptionsOnly ? 7 : 6;
+ Sequence<uno::Any> aParamsSeq( nParamCount );
+
+ aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) );
+ aParamsSeq[1] = uno::makeAny( m_aURLParameter.get_language() );
+
+ aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-index" ) );
+ rtl::OUString aSystemPath;
+ osl::FileBase::getSystemPathFromFileURL( idxDir, aSystemPath );
+ aParamsSeq[3] = uno::makeAny( aSystemPath );
+
+ aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-query" ) );
+
+ const std::vector< rtl::OUString >& aListItem = queryList[i];
+ ::rtl::OUString aNewQueryStr = aListItem[0];
+ aParamsSeq[5] = uno::makeAny( aNewQueryStr );
+
+ if( bCaptionsOnly )
+ aParamsSeq[6] = uno::makeAny( rtl::OUString::createFromAscii( "-caption" ) );
Sequence< sal_Int16 > aOutParamIndex;
Sequence< uno::Any > aOutParam;
@@ -245,22 +245,22 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< lang::XMultiServiceF
}
}
- // intersect
+ // intersect
if( nQueryListSize > 1 )
{
- if( i == 0 )
- {
- aResultSet = aSet;
- }
- else
- {
- aCurrent = aResultSet;
- aResultSet.clear();
- set_intersection( aSet.begin(),aSet.end(),
- aCurrent.begin(),aCurrent.end(),
- inserter(aResultSet,aResultSet.begin()));
- }
- }
+ if( i == 0 )
+ {
+ aResultSet = aSet;
+ }
+ else
+ {
+ aCurrent = aResultSet;
+ aResultSet.clear();
+ set_intersection( aSet.begin(),aSet.end(),
+ aCurrent.begin(),aCurrent.end(),
+ inserter(aResultSet,aResultSet.begin()));
+ }
+ }
}
// Combine results in aIndexFolderResultVector
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index ab48a26f40..d88d8c7ee5 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -742,14 +742,14 @@ bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const uno::Reference< frame:
uno::Reference< container::XChild > xChild( xChartModel, uno::UNO_QUERY );
if( xChild.is() )
{
- aGenerator = lcl_getGeneratorFromModel( uno::Reference< frame::XModel >( xChild->getParent(), uno::UNO_QUERY) );
+ aGenerator = lcl_getGeneratorFromModel( uno::Reference< frame::XModel >( xChild->getParent(), uno::UNO_QUERY) );
if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project") ) ) != -1 )
{
- //the chart application has not created files without a meta stream since OOo 2.3 (OOo 2.3 has written a metastream already)
- //only the report builder extension has created some files with OOo 3.1 that do not have a meta stream
- if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/31") ) ) != -1 )
- bResult = false;//#i100102# probably generated with OOo 3.1 by the report designer
- else
+ //the chart application has not created files without a meta stream since OOo 2.3 (OOo 2.3 has written a metastream already)
+ //only the report builder extension has created some files with OOo 3.1 that do not have a meta stream
+ if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/31") ) ) != -1 )
+ bResult = false;//#i100102# probably generated with OOo 3.1 by the report designer
+ else
bResult= true; //in this case the OLE chart was created by an older version, as OLE objects are sometimes stream copied the version can differ from the parents version, so the parents version is not a reliable indicator
}
else if( isDocumentGeneratedWithOpenOfficeOlderThan2_0(xChartModel) )
@@ -759,18 +759,18 @@ bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const uno::Reference< frame:
return bResult;
}
-bool isDocumentGeneratedWithOpenOfficeOlderThan2_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel)
-{
- bool bResult = false;
- ::rtl::OUString aGenerator( lcl_getGeneratorFromModelOrItsParent(xChartModel) );
- if( ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org 1") ) ) == 0 )
- || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice 6") ) ) == 0 )
- || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice 7") ) ) == 0 )
- || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarSuite 6") ) ) == 0 )
- || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarSuite 7") ) ) == 0 )
- )
- bResult= true;
- return bResult;
+bool isDocumentGeneratedWithOpenOfficeOlderThan2_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel)
+{
+ bool bResult = false;
+ ::rtl::OUString aGenerator( lcl_getGeneratorFromModelOrItsParent(xChartModel) );
+ if( ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org 1") ) ) == 0 )
+ || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice 6") ) ) == 0 )
+ || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice 7") ) ) == 0 )
+ || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarSuite 6") ) ) == 0 )
+ || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarSuite 7") ) ) == 0 )
+ )
+ bResult= true;
+ return bResult;
}
Reference< chart2::data::XDataProvider > getDataProviderFromParent( const Reference< chart2::XChartDocument >& xChartDoc )
diff --git a/xmloff/source/core/nmspmap.cxx b/xmloff/source/core/nmspmap.cxx
index 49580c95bf..6367f5f160 100644
--- a/xmloff/source/core/nmspmap.cxx
+++ b/xmloff/source/core/nmspmap.cxx
@@ -196,12 +196,12 @@ OUString SvXMLNamespaceMap::GetAttrNameByKey( sal_uInt16 nKey ) const
if (aIter != aNameMap.end())
{
sAttrName.append( sXMLNS );
- const ::rtl::OUString & prefix( (*aIter).second->sPrefix );
- if (prefix.getLength()) // not default namespace
- {
- sAttrName.append( sal_Unicode(':') );
- sAttrName.append( prefix );
- }
+ const ::rtl::OUString & prefix( (*aIter).second->sPrefix );
+ if (prefix.getLength()) // not default namespace
+ {
+ sAttrName.append( sal_Unicode(':') );
+ sAttrName.append( prefix );
+ }
}
return sAttrName.makeStringAndClear();
}
@@ -226,11 +226,11 @@ OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 nKey,
// don't bother caching this, it rarely happens
OUStringBuffer sQName;
sQName.append ( sXMLNS );
- if (rLocalName.getLength()) // not default namespace
- {
- sQName.append ( sal_Unicode(':') );
- sQName.append ( rLocalName );
- }
+ if (rLocalName.getLength()) // not default namespace
+ {
+ sQName.append ( sal_Unicode(':') );
+ sQName.append ( rLocalName );
+ }
return sQName.makeStringAndClear();;
}
case XML_NAMESPACE_XML:
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 8f57772e9b..9f574d0048 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -1260,51 +1260,51 @@ void SdXMLExport::ImpWriteAutoLayoutInfos()
break;
}
- case 33 : // AUTOLAYOUT_4CLIPART
- {
- Rectangle aTopLeft(pInfo->GetPresRectangle());
- aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
- aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
- Rectangle aBottomLeft(aTopLeft);
- aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
- Rectangle aTopRight(aTopLeft);
- aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
- Rectangle aBottomRight(aTopRight);
- aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
-
- ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
- ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
- ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
- ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
- ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
- break;
- }
-
- case 34 : // AUTOLAYOUT_6CLIPART
- {
- Rectangle aTopLeft(pInfo->GetPresRectangle());
- aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
- aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.322));
- Rectangle aTopCenter(aTopLeft);
- aTopCenter.Left() = long(aTopCenter.Left() + aTopCenter.GetWidth() * 1.05);
- Rectangle aTopRight(aTopLeft);
- aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 2 * 1.05);
-
- Rectangle aBottomLeft(aTopLeft);
- aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
- Rectangle aBottomCenter(aTopCenter);
- aBottomCenter.Top() = long(aBottomCenter.Top() + aBottomCenter.GetHeight() * 1.095);
- Rectangle aBottomRight(aTopRight);
- aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
-
- ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
- ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
- ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopCenter);
- ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
- ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
- ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomCenter);
- ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
- break;
+ case 33 : // AUTOLAYOUT_4CLIPART
+ {
+ Rectangle aTopLeft(pInfo->GetPresRectangle());
+ aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
+ aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
+ Rectangle aBottomLeft(aTopLeft);
+ aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
+ Rectangle aTopRight(aTopLeft);
+ aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
+ Rectangle aBottomRight(aTopRight);
+ aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
+ break;
+ }
+
+ case 34 : // AUTOLAYOUT_6CLIPART
+ {
+ Rectangle aTopLeft(pInfo->GetPresRectangle());
+ aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
+ aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.322));
+ Rectangle aTopCenter(aTopLeft);
+ aTopCenter.Left() = long(aTopCenter.Left() + aTopCenter.GetWidth() * 1.05);
+ Rectangle aTopRight(aTopLeft);
+ aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 2 * 1.05);
+
+ Rectangle aBottomLeft(aTopLeft);
+ aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
+ Rectangle aBottomCenter(aTopCenter);
+ aBottomCenter.Top() = long(aBottomCenter.Top() + aBottomCenter.GetHeight() * 1.095);
+ Rectangle aBottomRight(aTopRight);
+ aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopCenter);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomCenter);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
+ break;
}
default:
{
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index 1f8b56480e..5eb108c5b3 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -729,24 +729,24 @@ void SdXMLPresentationPageLayoutContext::EndElement()
}
case 5:
{
- SdXMLPresentationPlaceholderContext* pObj1 = maList.GetObject(1);
-
- if(pObj1->GetName().equals(
- OUString(RTL_CONSTASCII_USTRINGPARAM("object"))))
- {
- mnTypeId = 18; // AUTOLAYOUT_4OBJ
- }
- else
- {
- mnTypeId = 33; // AUTOLAYOUT_4CLIPART
- }
- break;
+ SdXMLPresentationPlaceholderContext* pObj1 = maList.GetObject(1);
+
+ if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("object"))))
+ {
+ mnTypeId = 18; // AUTOLAYOUT_4OBJ
+ }
+ else
+ {
+ mnTypeId = 33; // AUTOLAYOUT_4CLIPART
+ }
+ break;
}
case 7:
{
- mnTypeId = 33; // AUTOLAYOUT_6CLIPART
- break;
+ mnTypeId = 33; // AUTOLAYOUT_6CLIPART
+ break;
}
default:
{