summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2009-12-10 18:31:30 +0100
committerVladimir Glazunov <vg@openoffice.org>2009-12-10 18:31:30 +0100
commit2ee1464936d571b6796dcd3336135a8283d56269 (patch)
tree77798f7572efd624c467693861039957ad004945
parent6faf78102859e7ddc05c762e1aebc47c784e2aa5 (diff)
parent2a00316c1cfb9fee87ed6b49b9e4565642f4be2b (diff)
CWS-TOOLING: integrate CWS vcl107
-rw-r--r--cui/source/options/optgdlg.cxx74
-rw-r--r--cui/source/options/optgdlg.hxx3
-rw-r--r--cui/source/options/optgdlg.src1
-rw-r--r--extensions/source/nsplugin/source/so_env.cxx3
-rw-r--r--extensions/source/plugin/unx/unxmgr.cxx20
5 files changed, 57 insertions, 44 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 2c069130c40d..656eca17fd22 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -769,6 +769,30 @@ OfaViewTabPage::OfaViewTabPage(Window* pParent, const SfxItemSet& rSet ) :
m_aSystemFont.Enable( FALSE );
}
+ const StyleSettings& aStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ // remove non-installed icon themes
+ if( aIconStyleLB.GetEntryCount() == STYLE_SYMBOLS_THEMES_MAX )
+ {
+ // do not check 0th item == auto; it is not a real theme
+ aIconStyleItemId[0] = 0;
+ ULONG nItem = 1;
+ for ( ULONG n=0; ++n < STYLE_SYMBOLS_THEMES_MAX; )
+ {
+ if ( aStyleSettings.CheckSymbolStyle( n ) )
+ {
+ // existing style => save the item id
+ aIconStyleItemId[n] = nItem++;
+ }
+ else
+ {
+ // non-existing style => remove item;
+ aIconStyleLB.RemoveEntry( nItem );
+ aIconStyleItemId[n] = 0;
+ }
+ }
+ }
+
// add real theme name to 'auto' theme, e.g. 'auto' => 'auto (classic)'
if( aIconStyleLB.GetEntryCount() > 1 )
{
@@ -776,19 +800,14 @@ OfaViewTabPage::OfaViewTabPage(Window* pParent, const SfxItemSet& rSet ) :
aAutoStr += ::rtl::OUString::createFromAscii( " (" );
- switch( Application::GetSettings().GetStyleSettings().GetAutoSymbolsStyle() )
- {
- case STYLE_SYMBOLS_DEFAULT: aAutoStr += aIconStyleLB.GetEntry( 1 ); break;
- case STYLE_SYMBOLS_INDUSTRIAL: aAutoStr += aIconStyleLB.GetEntry( 2 ); break;
- case STYLE_SYMBOLS_CRYSTAL: aAutoStr += aIconStyleLB.GetEntry( 3 ); break;
- case STYLE_SYMBOLS_TANGO: aAutoStr += aIconStyleLB.GetEntry( 4 ); break;
- case STYLE_SYMBOLS_CLASSIC: aAutoStr += aIconStyleLB.GetEntry( 5 ); break;
- case STYLE_SYMBOLS_HICONTRAST: aAutoStr += aIconStyleLB.GetEntry( 6 ); break;
- }
+ ULONG nAutoStyle = aStyleSettings.GetAutoSymbolsStyle();
+ if ( aIconStyleItemId[nAutoStyle] )
+ aAutoStr += aIconStyleLB.GetEntry( aIconStyleItemId[nAutoStyle] );
aIconStyleLB.RemoveEntry( 0 );
aIconStyleLB.InsertEntry( aAutoStr += ::rtl::OUString::createFromAscii( ")" ), 0 );
- aIconStyleLB.SetSeparatorPos( aIconStyleLB.GetEntryCount() - 2 );
+ // separate auto and other icon themes
+ aIconStyleLB.SetSeparatorPos( 0 );
}
}
@@ -867,20 +886,16 @@ BOOL OfaViewTabPage::FillItemSet( SfxItemSet& )
UINT16 nStyleLB_NewSelection = aIconStyleLB.GetSelectEntryPos();
if( nStyleLB_InitialSelection != nStyleLB_NewSelection )
{
- sal_Int16 eSet = SFX_SYMBOLS_STYLE_AUTO;
- switch( nStyleLB_NewSelection )
+ // find the style name in the aIconStyleItemId table
+ // items from the non-installed icon themes were removed
+ for ( ULONG n=0; n < STYLE_SYMBOLS_THEMES_MAX; n++ )
{
- case 0: eSet = SFX_SYMBOLS_STYLE_AUTO; break;
- case 1: eSet = SFX_SYMBOLS_STYLE_DEFAULT; break;
- case 2: eSet = SFX_SYMBOLS_STYLE_HICONTRAST; break;
- case 3: eSet = SFX_SYMBOLS_STYLE_INDUSTRIAL; break;
- case 4: eSet = SFX_SYMBOLS_STYLE_CRYSTAL; break;
- case 5: eSet = SFX_SYMBOLS_STYLE_TANGO; break;
- case 6: eSet = SFX_SYMBOLS_STYLE_CLASSIC; break;
- default:
- DBG_ERROR( "OfaViewTabPage::FillItemSet(): This state of aIconStyleLB should not be possible!" );
+ if ( aIconStyleItemId[n] == nStyleLB_NewSelection )
+ {
+ aMiscOptions.SetSymbolsStyle( n );
+ n = STYLE_SYMBOLS_THEMES_MAX;
+ }
}
- aMiscOptions.SetSymbolsStyle( eSet );
}
BOOL bAppearanceChanged = FALSE;
@@ -1051,19 +1066,8 @@ void OfaViewTabPage::Reset( const SfxItemSet& )
aIconSizeLB.SelectEntryPos( nSizeLB_InitialSelection );
aIconSizeLB.SaveValue();
- if( aMiscOptions.GetSymbolsStyle() != SFX_SYMBOLS_STYLE_AUTO )
- {
- switch ( aMiscOptions.GetCurrentSymbolsStyle() )
- {
- case SFX_SYMBOLS_STYLE_DEFAULT: nStyleLB_InitialSelection = 1; break;
- case SFX_SYMBOLS_STYLE_HICONTRAST: nStyleLB_InitialSelection = 2; break;
- case SFX_SYMBOLS_STYLE_INDUSTRIAL: nStyleLB_InitialSelection = 3; break;
- case SFX_SYMBOLS_STYLE_CRYSTAL: nStyleLB_InitialSelection = 4; break;
- case SFX_SYMBOLS_STYLE_TANGO: nStyleLB_InitialSelection = 5; break;
- case SFX_SYMBOLS_STYLE_CLASSIC: nStyleLB_InitialSelection = 6; break;
- default: nStyleLB_InitialSelection = 0; break;
- }
- }
+ if( aMiscOptions.GetSymbolsStyle() != STYLE_SYMBOLS_AUTO )
+ nStyleLB_InitialSelection = aIconStyleItemId[aMiscOptions.GetCurrentSymbolsStyle()];
aIconStyleLB.SelectEntryPos( nStyleLB_InitialSelection );
aIconStyleLB.SaveValue();
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index 4b86896fa58f..4813e23c4305 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -138,6 +138,9 @@ private:
UINT16 nStyleLB_InitialSelection;
BOOL bSfxSymbolsAuto;
+ // item ID for the given icon theme
+ // might be zero when the theme is not installed and the item is removed
+ ULONG aIconStyleItemId[STYLE_SYMBOLS_THEMES_MAX];
SvtTabAppearanceCfg* pAppearanceCfg;
CanvasSettings* pCanvasSettings;
SvtOptionsDrawinglayer* mpDrawinglayerOpt;
diff --git a/cui/source/options/optgdlg.src b/cui/source/options/optgdlg.src
index e8c8b9edf9a5..8318d4eccd10 100644
--- a/cui/source/options/optgdlg.src
+++ b/cui/source/options/optgdlg.src
@@ -250,6 +250,7 @@ TabPage OFA_TP_VIEW
< "Industrial" ; > ;
< "Crystal" ; > ;
< "Tango" ; > ;
+ < "Oxygen" ; > ;
< "Classic" ; > ;
};
};
diff --git a/extensions/source/nsplugin/source/so_env.cxx b/extensions/source/nsplugin/source/so_env.cxx
index df23100e3859..92bcab19bd59 100644
--- a/extensions/source/nsplugin/source/so_env.cxx
+++ b/extensions/source/nsplugin/source/so_env.cxx
@@ -310,7 +310,8 @@ char* NSP_getProductName()
char *pEnd = 0;
while(!feof(fp))
{
- fgets( line, sizeof(line), fp );
+ if (fgets( line, sizeof(line), fp ) == NULL)
+ continue;
if (NULL == (pStart = strstr( line, "ProductKey=" )))
continue;
pStart += strlen("ProductKey=");
diff --git a/extensions/source/plugin/unx/unxmgr.cxx b/extensions/source/plugin/unx/unxmgr.cxx
index 1f1d291daf8d..bce8cd76a7ac 100644
--- a/extensions/source/plugin/unx/unxmgr.cxx
+++ b/extensions/source/plugin/unx/unxmgr.cxx
@@ -175,6 +175,12 @@ static bool CheckPlugin( const ByteString& rPath, list< PluginDescription* >& rD
return nDescriptions > 0;
}
+union maxDirent
+{
+ char aBuffer[ sizeof( struct dirent ) + _PC_NAME_MAX +1 ];
+ struct dirent asDirent;
+};
+
static void CheckPluginRegistryFiles( const rtl::OString& rPath, list< PluginDescription* >& rDescriptions )
{
rtl::OStringBuffer aPath( 1024 );
@@ -200,14 +206,13 @@ static void CheckPluginRegistryFiles( const rtl::OString& rPath, list< PluginDes
}
// check subdirectories
- long aBuffer[ sizeof( struct dirent ) + _PC_NAME_MAX +1 ];
-
DIR* pDIR = opendir( rPath.getStr() );
struct dirent* pDirEnt = NULL;
struct stat aStat;
- while( pDIR && ! readdir_r( pDIR, (struct dirent*)aBuffer, &pDirEnt ) && pDirEnt )
+ maxDirent u;
+ while( pDIR && ! readdir_r( pDIR, &u.asDirent, &pDirEnt ) && pDirEnt )
{
- char* pBaseName = ((struct dirent*)aBuffer)->d_name;
+ char* pBaseName = u.asDirent.d_name;
if( rtl_str_compare( ".", pBaseName ) && rtl_str_compare( "..", pBaseName ) )
{
rtl::OStringBuffer aBuf( 1024 );
@@ -262,9 +267,8 @@ Sequence<PluginDescription> XPluginManager_Impl::impl_getPluginDescriptions() th
aSearchPath += ByteString( String( rPaths.getConstArray()[i] ), aEncoding );
}
-
- long aBuffer[ sizeof( struct dirent ) + _PC_NAME_MAX +1 ];
int nPaths = aSearchPath.GetTokenCount( ':' );
+ maxDirent u;
for( i = 0; i < nPaths; i++ )
{
ByteString aPath( aSearchPath.GetToken( i, ':' ) );
@@ -272,9 +276,9 @@ Sequence<PluginDescription> XPluginManager_Impl::impl_getPluginDescriptions() th
{
DIR* pDIR = opendir( aPath.GetBuffer() );
struct dirent* pDirEnt = NULL;
- while( pDIR && ! readdir_r( pDIR, (struct dirent*)aBuffer, &pDirEnt ) && pDirEnt )
+ while( pDIR && ! readdir_r( pDIR, &u.asDirent, &pDirEnt ) && pDirEnt )
{
- char* pBaseName = ((struct dirent*)aBuffer)->d_name;
+ char* pBaseName = u.asDirent.d_name;
if( pBaseName[0] != '.' ||
pBaseName[1] != '.' ||
pBaseName[2] != 0 )