diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-11-23 17:39:22 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-11-23 17:39:22 +0100 |
commit | 094e60ee6a7b2d5b019ed2723231d8d9998bc9bd (patch) | |
tree | bcafb0edf3d2c4326c15177fce3ee4919b0412e5 | |
parent | c01d8ffde2ffe8a6cf83ca9450e45d38a51d2b19 (diff) | |
parent | 17e7971a872fb3b966d7e9e949bf18aa099991c7 (diff) |
merge commit for m65
31 files changed, 481 insertions, 462 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 011566200..ac3454fd9 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -944,6 +944,7 @@ BreakPointWindow::BreakPointWindow( Window* pParent ) : pModulWindow = 0; nCurYOffset = 0; setBackgroundColor(GetSettings().GetStyleSettings().GetFieldColor()); + m_bHighContrastMode = GetSettings().GetStyleSettings().GetHighContrastMode(); nMarkerPos = MARKER_NOMARKER; // nCurYOffset merken und nicht von EditEngine holen. @@ -1161,6 +1162,7 @@ void BreakPointWindow::DataChanged(DataChangedEvent const & rDCEvt) != rDCEvt.GetOldSettings()->GetStyleSettings().GetFieldColor()) { setBackgroundColor(aColor); + m_bHighContrastMode = GetSettings().GetStyleSettings().GetHighContrastMode(); Invalidate(); } } @@ -1169,7 +1171,6 @@ void BreakPointWindow::DataChanged(DataChangedEvent const & rDCEvt) void BreakPointWindow::setBackgroundColor(Color aColor) { SetBackground(Wallpaper(aColor)); - m_bHighContrastMode = aColor.IsDark(); } diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index caceda361..337aaff9a 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -46,7 +46,7 @@ #include <ide_pch.hxx> -#include <vector>
+#include <vector> #include <basidesh.hrc> #include <baside3.hxx> #include <localizationmgr.hxx> @@ -64,7 +64,7 @@ #include <helpid.hrc> #include <bastype2.hxx> #include <svx/svdview.hxx> -#include <svx/unolingu.hxx>
+#include <svx/unolingu.hxx> #include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <comphelper/processfactory.hxx> @@ -75,7 +75,7 @@ #include <com/sun/star/script/XLibraryContainer2.hpp> #endif #include <svtools/ehdl.hxx> -#include <svtools/langtab.hxx>
+#include <svtools/langtab.hxx> #include <com/sun/star/ui/dialogs/XFilePicker.hpp> #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> @@ -641,10 +641,10 @@ void __EXPORT DialogWindow::ExecuteCommand( SfxRequest& rReq ) case SID_EXPORT_DIALOG: SaveDialog(); break; -
- case SID_IMPORT_DIALOG:
- ImportDialog();
- break;
+ + case SID_IMPORT_DIALOG: + ImportDialog(); + break; } rReq.Done(); @@ -866,406 +866,406 @@ BOOL DialogWindow::SaveDialog() return bDone; } -extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft,
- const ::com::sun::star::lang::Locale& rLocaleRight );
- -std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq
- ( Sequence< lang::Locale > aFirstSeq, Sequence< lang::Locale > aSecondSeq )
-{
- std::vector< lang::Locale > avRet;
-
- const lang::Locale* pFirst = aFirstSeq.getConstArray();
- const lang::Locale* pSecond = aSecondSeq.getConstArray();
- sal_Int32 nFirstCount = aFirstSeq.getLength();
- sal_Int32 nSecondCount = aSecondSeq.getLength();
-
- for( sal_Int32 iFirst = 0 ; iFirst < nFirstCount ; iFirst++ )
- {
- const lang::Locale& rFirstLocale = pFirst[ iFirst ];
-
- bool bAlsoContainedInSecondSeq = false;
- for( sal_Int32 iSecond = 0 ; iSecond < nSecondCount ; iSecond++ )
- {
- const lang::Locale& rSecondLocale = pSecond[ iSecond ];
-
- bool bMatch = localesAreEqual( rFirstLocale, rSecondLocale );
- if( bMatch )
- {
- bAlsoContainedInSecondSeq = true;
- break;
- }
- }
-
- if( !bAlsoContainedInSecondSeq )
- avRet.push_back( rFirstLocale );
- }
-
- return avRet;
-}
-
-
-class NameClashQueryBox : public MessBox
-{
-public:
- NameClashQueryBox( Window* pParent,
- const XubString& rTitle, const XubString& rMessage );
-};
-
-NameClashQueryBox::NameClashQueryBox( Window* pParent,
- const XubString& rTitle, const XubString& rMessage )
- : MessBox( pParent, 0, rTitle, rMessage )
-{
- if ( rTitle.Len() )
- SetText( rTitle );
-
- maMessText = rMessage;
-
- AddButton( String( IDEResId( RID_STR_DLGIMP_CLASH_RENAME ) ), RET_YES,
- BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
- AddButton( String( IDEResId( RID_STR_DLGIMP_CLASH_REPLACE ) ), RET_NO, 0 );
- AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
-
- SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ?
- QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() );
-}
-
-
-class LanguageMismatchQueryBox : public MessBox
-{
-public:
- LanguageMismatchQueryBox( Window* pParent,
- const XubString& rTitle, const XubString& rMessage );
-};
-
-LanguageMismatchQueryBox::LanguageMismatchQueryBox( Window* pParent,
- const XubString& rTitle, const XubString& rMessage )
- : MessBox( pParent, 0, rTitle, rMessage )
-{
- if ( rTitle.Len() )
- SetText( rTitle );
-
- maMessText = rMessage;
- AddButton( String( IDEResId( RID_STR_DLGIMP_MISMATCH_ADD ) ), RET_YES,
- BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
- AddButton( String( IDEResId( RID_STR_DLGIMP_MISMATCH_OMIT ) ), RET_NO, 0 );
- AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
- AddButton( BUTTON_HELP, BUTTONID_HELP, BUTTONDIALOG_HELPBUTTON, 4 );
-
- SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ?
- QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() );
-}
-
-BOOL implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocument& rDocument, const String& aLibName )
-{
- BOOL bDone = FALSE;
-
- Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- Reference < XFilePicker > xFP;
- if( xMSF.is() )
- {
- Sequence <Any> aServiceType(1);
- aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE;
- xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY );
- }
-
- Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY);
- xFPControl->enableControl(ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, sal_False);
- Any aValue;
- aValue <<= (sal_Bool) sal_True;
- xFPControl->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue);
-
- String aCurPath( rCurPath );
- if ( aCurPath.Len() )
- xFP->setDisplayDirectory ( aCurPath );
-
- String aDialogStr( IDEResId( RID_STR_STDDIALOGNAME ) );
- Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY);
- xFltMgr->appendFilter( aDialogStr, String( RTL_CONSTASCII_USTRINGPARAM( "*.xdl" ) ) );
- xFltMgr->appendFilter( String( IDEResId( RID_STR_FILTER_ALLFILES ) ), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) );
- xFltMgr->setCurrentFilter( aDialogStr );
-
- if( xFP->execute() == RET_OK )
- {
- Sequence< ::rtl::OUString > aPaths = xFP->getFiles();
- aCurPath = aPaths[0];
-
- ::rtl::OUString aBasePath;
- ::rtl::OUString aOUCurPath( aCurPath );
- sal_Int32 iSlash = aOUCurPath.lastIndexOf( '/' );
- if( iSlash != -1 )
- aBasePath = aOUCurPath.copy( 0, iSlash + 1 );
-
- try
- {
- // create dialog model
- Reference< container::XNameContainer > xDialogModel( xMSF->createInstance
- ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY_THROW );
-
- Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
- ( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
-
- Reference< XInputStream > xInput;
- if( xSFI->exists( aCurPath ) )
- xInput = xSFI->openFileRead( aCurPath );
-
- Reference< XComponentContext > xContext;
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
-
- String aXmlDlgName;
- Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY );
- if( xDialogModelPropSet.is() )
- {
- try
- {
- Any aXmlDialogNameAny = xDialogModelPropSet->getPropertyValue( DLGED_PROP_NAME );
- ::rtl::OUString aOUXmlDialogName;
- aXmlDialogNameAny >>= aOUXmlDialogName;
- aXmlDlgName = aOUXmlDialogName;
- }
- catch( beans::UnknownPropertyException& )
- {}
- }
- bool bValidName = (aXmlDlgName.Len() != 0);
- OSL_ASSERT( bValidName );
- if( !bValidName )
- return bDone;
-
- bool bDialogAlreadyExists = rDocument.hasDialog( aLibName, aXmlDlgName );
-
- String aNewDlgName = aXmlDlgName;
- enum NameClashMode
- {
- NO_CLASH,
- CLASH_OVERWRITE_DIALOG,
- CLASH_RENAME_DIALOG,
- };
- NameClashMode eNameClashMode = NO_CLASH;
- if( bDialogAlreadyExists )
- {
- String aQueryBoxTitle( IDEResId( RID_STR_DLGIMP_CLASH_TITLE ) );
- String aQueryBoxText( IDEResId( RID_STR_DLGIMP_CLASH_TEXT ) );
- aQueryBoxText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "$(ARG1)" ) ), aXmlDlgName );
-
- NameClashQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
- USHORT nRet = aQueryBox.Execute();
- if( RET_YES == nRet )
- {
- // RET_YES == Rename, see NameClashQueryBox::NameClashQueryBox
- eNameClashMode = CLASH_RENAME_DIALOG;
-
- aNewDlgName = rDocument.createObjectName( E_DIALOGS, aLibName );
- }
- else if( RET_NO == nRet )
- {
- // RET_NO == Replace, see NameClashQueryBox::NameClashQueryBox
- eNameClashMode = CLASH_OVERWRITE_DIALOG;
- }
- else if( RET_CANCEL == nRet )
- {
- return bDone;
- }
- }
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if( pIDEShell == NULL )
- {
- OSL_ASSERT( pIDEShell != NULL );
- return bDone;
- }
-
- // Resource?
- ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
- Reference< task::XInteractionHandler > xDummyHandler;
- bool bReadOnly = true;
- Reference< XStringResourceWithLocation > xImportStringResource =
- StringResourceWithLocation::create( xContext, aBasePath, bReadOnly,
- aLocale, aXmlDlgName, ::rtl::OUString(), xDummyHandler );
-
- Sequence< lang::Locale > aImportLocaleSeq = xImportStringResource->getLocales();
- sal_Int32 nImportLocaleCount = aImportLocaleSeq.getLength();
-
- Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, TRUE ) );
- Reference< resource::XStringResourceManager > xLibStringResourceManager = LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
- sal_Int32 nLibLocaleCount = 0;
- Sequence< lang::Locale > aLibLocaleSeq;
- if( xLibStringResourceManager.is() )
- {
- aLibLocaleSeq = xLibStringResourceManager->getLocales();
- nLibLocaleCount = aLibLocaleSeq.getLength();
- }
-
- // Check language matches
- std::vector< lang::Locale > aOnlyInImportLanguages =
- implGetLanguagesOnlyContainedInFirstSeq( aImportLocaleSeq, aLibLocaleSeq );
- int nOnlyInImportLanguageCount = aOnlyInImportLanguages.size();
-
- // For now: Keep languages from lib
- bool bLibLocalized = (nLibLocaleCount > 0);
- bool bImportLocalized = (nImportLocaleCount > 0);
-
- bool bAddDialogLanguagesToLib = false;
- if( nOnlyInImportLanguageCount > 0 )
- {
- String aQueryBoxTitle( IDEResId( RID_STR_DLGIMP_MISMATCH_TITLE ) );
- String aQueryBoxText( IDEResId( RID_STR_DLGIMP_MISMATCH_TEXT ) );
- LanguageMismatchQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
- USHORT nRet = aQueryBox.Execute();
- if( RET_YES == nRet )
- {
- // RET_YES == Add, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
- bAddDialogLanguagesToLib = true;
- }
- // RET_NO == Omit, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
- // -> nothing to do here
- //else if( RET_NO == nRet )
- //{
- //}
- else if( RET_CANCEL == nRet )
- {
- return bDone;
- }
- }
-
- if( bImportLocalized )
- {
- bool bCopyResourcesForDialog = true;
- if( bAddDialogLanguagesToLib )
- {
- LocalizationMgr* pCurMgr = pIDEShell->GetCurLocalizationMgr();
-
- lang::Locale aFirstLocale;
- aFirstLocale = aOnlyInImportLanguages[0];
- if( nOnlyInImportLanguageCount > 1 )
- {
- // Check if import default belongs to only import languages and use it then
- lang::Locale aImportDefaultLocale = xImportStringResource->getDefaultLocale();
- lang::Locale aTmpLocale;
- for( int i = 0 ; i < nOnlyInImportLanguageCount ; ++i )
- {
- aTmpLocale = aOnlyInImportLanguages[i];
- if( localesAreEqual( aImportDefaultLocale, aTmpLocale ) )
- {
- aFirstLocale = aImportDefaultLocale;
- break;
- }
- }
- }
-
- Sequence< lang::Locale > aFirstLocaleSeq( 1 );
- aFirstLocaleSeq[0] = aFirstLocale;
- pCurMgr->handleAddLocales( aFirstLocaleSeq );
-
- if( nOnlyInImportLanguageCount > 1 )
- {
- Sequence< lang::Locale > aRemainingLocaleSeq( nOnlyInImportLanguageCount - 1 );
- lang::Locale aTmpLocale;
- int iSeq = 0;
- for( int i = 0 ; i < nOnlyInImportLanguageCount ; ++i )
- {
- aTmpLocale = aOnlyInImportLanguages[i];
- if( !localesAreEqual( aFirstLocale, aTmpLocale ) )
- aRemainingLocaleSeq[iSeq++] = aTmpLocale;
- }
- pCurMgr->handleAddLocales( aRemainingLocaleSeq );
- }
- }
- else if( !bLibLocalized )
- {
- Reference< resource::XStringResourceManager > xImportStringResourceManager( xImportStringResource, UNO_QUERY );
- LocalizationMgr::resetResourceForDialog( xDialogModel, xImportStringResourceManager );
- bCopyResourcesForDialog = false;
- }
-
- if( bCopyResourcesForDialog )
- {
- Reference< resource::XStringResourceResolver > xImportStringResourceResolver( xImportStringResource, UNO_QUERY );
- LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, aXmlDlgName,
- xLibStringResourceManager, xImportStringResourceResolver );
- }
- }
- else if( bLibLocalized )
- {
- LocalizationMgr::setResourceIDsForDialog( xDialogModel, xLibStringResourceManager );
- }
-
-
- LocalizationMgr::setStringResourceAtDialog( rDocument, aLibName, aNewDlgName, xDialogModel );
-
- if( eNameClashMode == CLASH_OVERWRITE_DIALOG )
- {
- if ( BasicIDE::RemoveDialog( rDocument, aLibName, aNewDlgName ) )
- {
- IDEBaseWindow* pDlgWin = pIDEShell->FindDlgWin( rDocument, aLibName, aNewDlgName, FALSE, TRUE );
- if( pDlgWin != NULL )
- pIDEShell->RemoveWindow( pDlgWin, TRUE );
- BasicIDE::MarkDocumentModified( rDocument );
- }
- else
- {
- // TODO: Assertion?
- return bDone;
- }
- }
-
- if( eNameClashMode == CLASH_RENAME_DIALOG )
- {
- bool bRenamed = false;
- if( xDialogModelPropSet.is() )
- {
- try
- {
- Any aXmlDialogNameAny;
- aXmlDialogNameAny <<= ::rtl::OUString( aNewDlgName );
- xDialogModelPropSet->setPropertyValue( DLGED_PROP_NAME, aXmlDialogNameAny );
- bRenamed = true;
- }
- catch( beans::UnknownPropertyException& )
- {}
- }
-
-
- if( bRenamed )
- {
- LocalizationMgr::renameStringResourceIDs( rDocument, aLibName, aNewDlgName, xDialogModel );
- }
- else
- {
- // TODO: Assertion?
- return bDone;
- }
- }
-
- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
- bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP );
- if( bSuccess )
- {
- DialogWindow* pNewDlgWin = pIDEShell->CreateDlgWin( rDocument, aLibName, aNewDlgName );
- pIDEShell->SetCurWindow( pNewDlgWin, TRUE );
- }
-
- bDone = TRUE;
- }
- catch( Exception& )
- {}
- }
-
- return bDone;
-}
-
-BOOL DialogWindow::ImportDialog()
-{
- DBG_CHKTHIS( DialogWindow, 0 );
-
- const ScriptDocument& rDocument = GetDocument();
- String aLibName = GetLibName();
- BOOL bRet = implImportDialog( this, aCurPath, rDocument, aLibName );
- return bRet;
-}
-
+extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft, + const ::com::sun::star::lang::Locale& rLocaleRight ); + +std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq + ( Sequence< lang::Locale > aFirstSeq, Sequence< lang::Locale > aSecondSeq ) +{ + std::vector< lang::Locale > avRet; + + const lang::Locale* pFirst = aFirstSeq.getConstArray(); + const lang::Locale* pSecond = aSecondSeq.getConstArray(); + sal_Int32 nFirstCount = aFirstSeq.getLength(); + sal_Int32 nSecondCount = aSecondSeq.getLength(); + + for( sal_Int32 iFirst = 0 ; iFirst < nFirstCount ; iFirst++ ) + { + const lang::Locale& rFirstLocale = pFirst[ iFirst ]; + + bool bAlsoContainedInSecondSeq = false; + for( sal_Int32 iSecond = 0 ; iSecond < nSecondCount ; iSecond++ ) + { + const lang::Locale& rSecondLocale = pSecond[ iSecond ]; + + bool bMatch = localesAreEqual( rFirstLocale, rSecondLocale ); + if( bMatch ) + { + bAlsoContainedInSecondSeq = true; + break; + } + } + + if( !bAlsoContainedInSecondSeq ) + avRet.push_back( rFirstLocale ); + } + + return avRet; +} + + +class NameClashQueryBox : public MessBox +{ +public: + NameClashQueryBox( Window* pParent, + const XubString& rTitle, const XubString& rMessage ); +}; + +NameClashQueryBox::NameClashQueryBox( Window* pParent, + const XubString& rTitle, const XubString& rMessage ) + : MessBox( pParent, 0, rTitle, rMessage ) +{ + if ( rTitle.Len() ) + SetText( rTitle ); + + maMessText = rMessage; + + AddButton( String( IDEResId( RID_STR_DLGIMP_CLASH_RENAME ) ), RET_YES, + BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON ); + AddButton( String( IDEResId( RID_STR_DLGIMP_CLASH_REPLACE ) ), RET_NO, 0 ); + AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON ); + + SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? + QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() ); +} + + +class LanguageMismatchQueryBox : public MessBox +{ +public: + LanguageMismatchQueryBox( Window* pParent, + const XubString& rTitle, const XubString& rMessage ); +}; + +LanguageMismatchQueryBox::LanguageMismatchQueryBox( Window* pParent, + const XubString& rTitle, const XubString& rMessage ) + : MessBox( pParent, 0, rTitle, rMessage ) +{ + if ( rTitle.Len() ) + SetText( rTitle ); + + maMessText = rMessage; + AddButton( String( IDEResId( RID_STR_DLGIMP_MISMATCH_ADD ) ), RET_YES, + BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON ); + AddButton( String( IDEResId( RID_STR_DLGIMP_MISMATCH_OMIT ) ), RET_NO, 0 ); + AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON ); + AddButton( BUTTON_HELP, BUTTONID_HELP, BUTTONDIALOG_HELPBUTTON, 4 ); + + SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? + QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() ); +} + +BOOL implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocument& rDocument, const String& aLibName ) +{ + BOOL bDone = FALSE; + + Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); + Reference < XFilePicker > xFP; + if( xMSF.is() ) + { + Sequence <Any> aServiceType(1); + aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE; + xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY ); + } + + Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY); + xFPControl->enableControl(ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, sal_False); + Any aValue; + aValue <<= (sal_Bool) sal_True; + xFPControl->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue); + + String aCurPath( rCurPath ); + if ( aCurPath.Len() ) + xFP->setDisplayDirectory ( aCurPath ); + + String aDialogStr( IDEResId( RID_STR_STDDIALOGNAME ) ); + Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); + xFltMgr->appendFilter( aDialogStr, String( RTL_CONSTASCII_USTRINGPARAM( "*.xdl" ) ) ); + xFltMgr->appendFilter( String( IDEResId( RID_STR_FILTER_ALLFILES ) ), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) ); + xFltMgr->setCurrentFilter( aDialogStr ); + + if( xFP->execute() == RET_OK ) + { + Sequence< ::rtl::OUString > aPaths = xFP->getFiles(); + aCurPath = aPaths[0]; + + ::rtl::OUString aBasePath; + ::rtl::OUString aOUCurPath( aCurPath ); + sal_Int32 iSlash = aOUCurPath.lastIndexOf( '/' ); + if( iSlash != -1 ) + aBasePath = aOUCurPath.copy( 0, iSlash + 1 ); + + try + { + // create dialog model + Reference< container::XNameContainer > xDialogModel( xMSF->createInstance + ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY_THROW ); + + Reference< XSimpleFileAccess > xSFI( xMSF->createInstance + ( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW ); + + Reference< XInputStream > xInput; + if( xSFI->exists( aCurPath ) ) + xInput = xSFI->openFileRead( aCurPath ); + + Reference< XComponentContext > xContext; + Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY ); + OSL_ASSERT( xProps.is() ); + OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); + ::xmlscript::importDialogModel( xInput, xDialogModel, xContext ); + + String aXmlDlgName; + Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY ); + if( xDialogModelPropSet.is() ) + { + try + { + Any aXmlDialogNameAny = xDialogModelPropSet->getPropertyValue( DLGED_PROP_NAME ); + ::rtl::OUString aOUXmlDialogName; + aXmlDialogNameAny >>= aOUXmlDialogName; + aXmlDlgName = aOUXmlDialogName; + } + catch( beans::UnknownPropertyException& ) + {} + } + bool bValidName = (aXmlDlgName.Len() != 0); + OSL_ASSERT( bValidName ); + if( !bValidName ) + return bDone; + + bool bDialogAlreadyExists = rDocument.hasDialog( aLibName, aXmlDlgName ); + + String aNewDlgName = aXmlDlgName; + enum NameClashMode + { + NO_CLASH, + CLASH_OVERWRITE_DIALOG, + CLASH_RENAME_DIALOG, + }; + NameClashMode eNameClashMode = NO_CLASH; + if( bDialogAlreadyExists ) + { + String aQueryBoxTitle( IDEResId( RID_STR_DLGIMP_CLASH_TITLE ) ); + String aQueryBoxText( IDEResId( RID_STR_DLGIMP_CLASH_TEXT ) ); + aQueryBoxText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "$(ARG1)" ) ), aXmlDlgName ); + + NameClashQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText ); + USHORT nRet = aQueryBox.Execute(); + if( RET_YES == nRet ) + { + // RET_YES == Rename, see NameClashQueryBox::NameClashQueryBox + eNameClashMode = CLASH_RENAME_DIALOG; + + aNewDlgName = rDocument.createObjectName( E_DIALOGS, aLibName ); + } + else if( RET_NO == nRet ) + { + // RET_NO == Replace, see NameClashQueryBox::NameClashQueryBox + eNameClashMode = CLASH_OVERWRITE_DIALOG; + } + else if( RET_CANCEL == nRet ) + { + return bDone; + } + } + + BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); + if( pIDEShell == NULL ) + { + OSL_ASSERT( pIDEShell != NULL ); + return bDone; + } + + // Resource? + ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); + Reference< task::XInteractionHandler > xDummyHandler; + bool bReadOnly = true; + Reference< XStringResourceWithLocation > xImportStringResource = + StringResourceWithLocation::create( xContext, aBasePath, bReadOnly, + aLocale, aXmlDlgName, ::rtl::OUString(), xDummyHandler ); + + Sequence< lang::Locale > aImportLocaleSeq = xImportStringResource->getLocales(); + sal_Int32 nImportLocaleCount = aImportLocaleSeq.getLength(); + + Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, TRUE ) ); + Reference< resource::XStringResourceManager > xLibStringResourceManager = LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib ); + sal_Int32 nLibLocaleCount = 0; + Sequence< lang::Locale > aLibLocaleSeq; + if( xLibStringResourceManager.is() ) + { + aLibLocaleSeq = xLibStringResourceManager->getLocales(); + nLibLocaleCount = aLibLocaleSeq.getLength(); + } + + // Check language matches + std::vector< lang::Locale > aOnlyInImportLanguages = + implGetLanguagesOnlyContainedInFirstSeq( aImportLocaleSeq, aLibLocaleSeq ); + int nOnlyInImportLanguageCount = aOnlyInImportLanguages.size(); + + // For now: Keep languages from lib + bool bLibLocalized = (nLibLocaleCount > 0); + bool bImportLocalized = (nImportLocaleCount > 0); + + bool bAddDialogLanguagesToLib = false; + if( nOnlyInImportLanguageCount > 0 ) + { + String aQueryBoxTitle( IDEResId( RID_STR_DLGIMP_MISMATCH_TITLE ) ); + String aQueryBoxText( IDEResId( RID_STR_DLGIMP_MISMATCH_TEXT ) ); + LanguageMismatchQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText ); + USHORT nRet = aQueryBox.Execute(); + if( RET_YES == nRet ) + { + // RET_YES == Add, see LanguageMismatchQueryBox::LanguageMismatchQueryBox + bAddDialogLanguagesToLib = true; + } + // RET_NO == Omit, see LanguageMismatchQueryBox::LanguageMismatchQueryBox + // -> nothing to do here + //else if( RET_NO == nRet ) + //{ + //} + else if( RET_CANCEL == nRet ) + { + return bDone; + } + } + + if( bImportLocalized ) + { + bool bCopyResourcesForDialog = true; + if( bAddDialogLanguagesToLib ) + { + LocalizationMgr* pCurMgr = pIDEShell->GetCurLocalizationMgr(); + + lang::Locale aFirstLocale; + aFirstLocale = aOnlyInImportLanguages[0]; + if( nOnlyInImportLanguageCount > 1 ) + { + // Check if import default belongs to only import languages and use it then + lang::Locale aImportDefaultLocale = xImportStringResource->getDefaultLocale(); + lang::Locale aTmpLocale; + for( int i = 0 ; i < nOnlyInImportLanguageCount ; ++i ) + { + aTmpLocale = aOnlyInImportLanguages[i]; + if( localesAreEqual( aImportDefaultLocale, aTmpLocale ) ) + { + aFirstLocale = aImportDefaultLocale; + break; + } + } + } + + Sequence< lang::Locale > aFirstLocaleSeq( 1 ); + aFirstLocaleSeq[0] = aFirstLocale; + pCurMgr->handleAddLocales( aFirstLocaleSeq ); + + if( nOnlyInImportLanguageCount > 1 ) + { + Sequence< lang::Locale > aRemainingLocaleSeq( nOnlyInImportLanguageCount - 1 ); + lang::Locale aTmpLocale; + int iSeq = 0; + for( int i = 0 ; i < nOnlyInImportLanguageCount ; ++i ) + { + aTmpLocale = aOnlyInImportLanguages[i]; + if( !localesAreEqual( aFirstLocale, aTmpLocale ) ) + aRemainingLocaleSeq[iSeq++] = aTmpLocale; + } + pCurMgr->handleAddLocales( aRemainingLocaleSeq ); + } + } + else if( !bLibLocalized ) + { + Reference< resource::XStringResourceManager > xImportStringResourceManager( xImportStringResource, UNO_QUERY ); + LocalizationMgr::resetResourceForDialog( xDialogModel, xImportStringResourceManager ); + bCopyResourcesForDialog = false; + } + + if( bCopyResourcesForDialog ) + { + Reference< resource::XStringResourceResolver > xImportStringResourceResolver( xImportStringResource, UNO_QUERY ); + LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, aXmlDlgName, + xLibStringResourceManager, xImportStringResourceResolver ); + } + } + else if( bLibLocalized ) + { + LocalizationMgr::setResourceIDsForDialog( xDialogModel, xLibStringResourceManager ); + } + + + LocalizationMgr::setStringResourceAtDialog( rDocument, aLibName, aNewDlgName, xDialogModel ); + + if( eNameClashMode == CLASH_OVERWRITE_DIALOG ) + { + if ( BasicIDE::RemoveDialog( rDocument, aLibName, aNewDlgName ) ) + { + IDEBaseWindow* pDlgWin = pIDEShell->FindDlgWin( rDocument, aLibName, aNewDlgName, FALSE, TRUE ); + if( pDlgWin != NULL ) + pIDEShell->RemoveWindow( pDlgWin, TRUE ); + BasicIDE::MarkDocumentModified( rDocument ); + } + else + { + // TODO: Assertion? + return bDone; + } + } + + if( eNameClashMode == CLASH_RENAME_DIALOG ) + { + bool bRenamed = false; + if( xDialogModelPropSet.is() ) + { + try + { + Any aXmlDialogNameAny; + aXmlDialogNameAny <<= ::rtl::OUString( aNewDlgName ); + xDialogModelPropSet->setPropertyValue( DLGED_PROP_NAME, aXmlDialogNameAny ); + bRenamed = true; + } + catch( beans::UnknownPropertyException& ) + {} + } + + + if( bRenamed ) + { + LocalizationMgr::renameStringResourceIDs( rDocument, aLibName, aNewDlgName, xDialogModel ); + } + else + { + // TODO: Assertion? + return bDone; + } + } + + Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext ); + bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP ); + if( bSuccess ) + { + DialogWindow* pNewDlgWin = pIDEShell->CreateDlgWin( rDocument, aLibName, aNewDlgName ); + pIDEShell->SetCurWindow( pNewDlgWin, TRUE ); + } + + bDone = TRUE; + } + catch( Exception& ) + {} + } + + return bDone; +} + +BOOL DialogWindow::ImportDialog() +{ + DBG_CHKTHIS( DialogWindow, 0 ); + + const ScriptDocument& rDocument = GetDocument(); + String aLibName = GetLibName(); + BOOL bRet = implImportDialog( this, aCurPath, rDocument, aLibName ); + return bRet; +} + DlgEdModel* DialogWindow::GetModel() const { return pEditor ? pEditor->GetModel() : NULL; diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx index d4eb16624..49afb2ab7 100644 --- a/basctl/source/basicide/objdlg.cxx +++ b/basctl/source/basicide/objdlg.cxx @@ -300,7 +300,7 @@ void ObjectCatalogToolBox_Impl::DataChanged(DataChangedEvent const & rDCEvt) void ObjectCatalogToolBox_Impl::setImages() { - bool bHC = GetDisplayBackground().GetColor().IsDark(); + bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); if (bHC != m_bHighContrast) { SetImageList(bHC ? m_aImagesHighContrast : m_aImagesNormal); diff --git a/basctl/source/basicide/tbxctl.cxx b/basctl/source/basicide/tbxctl.cxx index 3c7737a0d..0abb803f7 100644 --- a/basctl/source/basicide/tbxctl.cxx +++ b/basctl/source/basicide/tbxctl.cxx @@ -186,7 +186,7 @@ void TbxControls::StateChanged( USHORT nSID, SfxItemState eState, Image aImage = GetImage( m_xFrame, aSlotURL, hasBigImages(), - GetToolBox().GetDisplayBackground().GetColor().IsDark() ); + GetToolBox().GetSettings().GetStyleSettings().GetHighContrastMode() ); ToolBox& rBox = GetToolBox(); rBox.SetItemImage(GetId(), aImage); nLastSlot = nLastEnum; diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 4739170a1..5b697629c 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -403,7 +403,7 @@ void InitImageType() Window* topwin = Application::GetActiveTopWindow(); if ( topwin != NULL && - topwin->GetDisplayBackground().GetColor().IsDark() ) + topwin->GetSettings().GetStyleSettings().GetHighContrastMode() ) { theImageType |= css::ui::ImageType::COLOR_HIGHCONTRAST; } @@ -5114,7 +5114,7 @@ SvxToolbarEntriesListBox::SvxToolbarEntriesListBox( BuildCheckBoxButtonImages( m_pButtonData ); EnableCheckButton( m_pButtonData ); - m_bHiContrastMode = GetDisplayBackground().GetColor().IsDark(); + m_bHiContrastMode = GetSettings().GetStyleSettings().GetHighContrastMode(); } // -------------------------------------------------------- @@ -5189,11 +5189,8 @@ void SvxToolbarEntriesListBox::DataChanged( const DataChangedEvent& rDCEvt ) if (( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE )) { - if ( m_bHiContrastMode != GetDisplayBackground().GetColor().IsDark() ) - { - // We have to reset all images because we change to/from high contrast mode - m_bHiContrastMode = GetDisplayBackground().GetColor().IsDark(); - } + // We have to reset all images because we change to/from high contrast mode + m_bHiContrastMode = GetSettings().GetStyleSettings().GetHighContrastMode(); BuildCheckBoxButtonImages( m_pButtonData ); Invalidate(); diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index 33e6d9be9..2b90d1d03 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -486,9 +486,7 @@ void IconLBoxString::Paint( const Point& aPos, SvLBox& aDevice, sal_Int32 nIndex = aURL.indexOf( aVndSunStarUNO ); bool bUNO = nIndex == 0; - Wallpaper aBackground = aDevice.GetBackground(); - Color aColor = aBackground.GetColor(); - BOOL bHC = aColor.IsDark(); + BOOL bHC = aDevice.GetSettings().GetStyleSettings().GetHighContrastMode(); const Image* pImg; if( bHC ) pImg = bUNO ? m_pComponentImg_h : m_pMacroImg_h; diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 7cf160fe5..3f6d767aa 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -902,8 +902,8 @@ void SpellDialog::SetTitle_Impl(LanguageType nLang) const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); if( pSpellErrorDescription && pSpellErrorDescription->sServiceName.getLength() ) { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; - ::rtl::OUString sSuggestionImageUrl = + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); + ::rtl::OUString sSuggestionImageUrl = SvtLinguConfig().GetSpellAndGrammarDialogImage( pSpellErrorDescription->sServiceName, bHighContrast ); aVendorImageFI.SetImage( lcl_GetImageFromPngUrl( sSuggestionImageUrl ) ); uno::Reference< lang::XServiceDisplayName > xDisplayName( pSpellErrorDescription->xGrammarChecker, uno::UNO_QUERY ); @@ -912,7 +912,7 @@ void SpellDialog::SetTitle_Impl(LanguageType nLang) } else { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); aVendorImageFI.SetImage( bHighContrast ? aVendorImageHC : aVendorImage ); } @@ -923,7 +923,7 @@ void SpellDialog::SetTitle_Impl(LanguageType nLang) } else { - //bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + //bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); sTitle = m_sTitleSpellingGrammar; } } diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx index 2dadd632b..08f1806d4 100644 --- a/cui/source/options/optaccessibility.cxx +++ b/cui/source/options/optaccessibility.cxx @@ -148,8 +148,8 @@ BOOL SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet& ) aMiscSettings.SetEnableATToolSupport( m_aAccessibilityTool.IsChecked() ); #endif aAllSettings.SetMiscSettings(aMiscSettings); - Application::SetSettings(aAllSettings); Application::MergeSystemSettings( aAllSettings ); + Application::SetSettings(aAllSettings); return FALSE; } diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index 588e33bbf..719a27a08 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -753,9 +753,9 @@ ColorConfigWindow_Impl::ColorConfigWindow_Impl(Window* pParent, const ResId& rRe Wallpaper aTransparentWall(TempColor); sal_Int32 nWinWidth = GetSizePixel().Width(); sal_Int32 nFTHeight = aChapters[0]->GetSizePixel().Height(); - sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); Color aBackColor; const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + sal_Bool bHighContrast = rStyleSettings.GetHighContrastMode(); if ( bHighContrast ) aBackColor = rStyleSettings.GetShadowColor(); else diff --git a/cui/source/options/optimprove2.cxx b/cui/source/options/optimprove2.cxx index 797c0dce0..1509b88ce 100644 --- a/cui/source/options/optimprove2.cxx +++ b/cui/source/options/optimprove2.cxx @@ -145,7 +145,13 @@ IMPL_LINK( SvxImprovementOptionsPage, HandleShowData, PushButton*, EMPTYARG ) { ::rtl::OUString sLogFile( m_sLogPath ); sLogFile += C2S("/Current.csv"); - uno::Sequence< beans::PropertyValue > aArgs; + uno::Sequence< beans::PropertyValue > aArgs(3); + aArgs[0].Name = ::rtl::OUString::createFromAscii("FilterName"); + aArgs[0].Value = uno::makeAny(::rtl::OUString::createFromAscii("Text - txt - csv (StarCalc)")); + aArgs[1].Name = ::rtl::OUString::createFromAscii("FilterOptions"); + aArgs[1].Value = uno::makeAny(::rtl::OUString::createFromAscii("44,34,12,1,")); + aArgs[2].Name = ::rtl::OUString::createFromAscii("ReadOnly"); + aArgs[2].Value = uno::makeAny(true); uno::Reference< lang::XComponent > xDoc = ::comphelper::SynchronousDispatch::dispatch( xDesktop, sLogFile, C2S("_default"), 0, aArgs ); diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index 33f5de3e1..81f7fed64 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -229,7 +229,7 @@ SfxSaveTabPage::SfxSaveTabPage( Window* pParent, const SfxItemSet& rCoreSet ) : pImpl ( new SvxSaveTabPage_Impl ) { - sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + sal_Bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); aODFWarningFI.SetImage( Image( CUI_RES( bHighContrast ? IMG_ODF_WARNING_HC : IMG_ODF_WARNING ) ) ); diff --git a/cui/source/options/readonlyimage.cxx b/cui/source/options/readonlyimage.cxx index 2ab0ee515..738239330 100644 --- a/cui/source/options/readonlyimage.cxx +++ b/cui/source/options/readonlyimage.cxx @@ -42,8 +42,8 @@ ReadOnlyImage::ReadOnlyImage(Window* pParent, const ResId rResId) : FixedImage(pParent, rResId) { - sal_Bool bHighContrast = pParent->GetDisplayBackground().GetColor().IsDark(); - SetImage( Image(CUI_RES(bHighContrast ? RID_SVXBMP_LOCK_HC : RID_SVXBMP_LOCK ))); + sal_Bool bHighContrast = pParent->GetSettings().GetStyleSettings().GetHighContrastMode(); + SetImage( Image(SVX_RES(bHighContrast ? RID_SVXBMP_LOCK_HC : RID_SVXBMP_LOCK ))); } /*-- 26.02.2004 13:31:04--------------------------------------------------- diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index fd482ea0b..9eb725e25 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -1067,7 +1067,7 @@ void OfaTreeOptionsDialog::DataChanged( const DataChangedEvent& rDCEvt ) !aTreeLB.GetParent(pEntry)) { OptionsGroupInfo* pInfo = static_cast<OptionsGroupInfo*>(pEntry->GetUserData()); - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); ImageList* pImgLst = bHighContrast ? &aPageImagesHC : &aPageImages; for ( sal_uInt16 i = 0; i < aHelpTextsArr.Count(); ++i ) { @@ -1325,7 +1325,7 @@ IMPL_LINK( OfaTreeOptionsDialog, SelectHdl_Impl, Timer*, EMPTYARG ) OptionsGroupInfo* pTGInfo = (OptionsGroupInfo *)pEntry->GetUserData(); if ( pTGInfo->m_sPageURL.getLength() == 0 ) { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); ImageList* pImgLst = bHighContrast ? &aPageImagesHC : &aPageImages; //hier den Hilfetext anzeigen for ( sal_uInt16 i = 0; i < aHelpTextsArr.Count(); ++i ) diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index 853e6bf71..da9d2c6b2 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -244,7 +244,7 @@ void AlignmentTabPage::InitVsRefEgde() // remember selection - is deleted in call to ValueSet::Clear() USHORT nSel = maVsRefEdge.GetSelectItemId(); - ResId aResId( GetBackground().GetColor().IsDark() ? IL_LOCK_BMPS_HC : IL_LOCK_BMPS, CUI_MGR() ); + ResId aResId( GetSettings().GetStyleSettings().GetHighContrastMode() ? IL_LOCK_BMPS_HC : IL_LOCK_BMPS, DIALOG_MGR() ); ImageList aImageList( aResId ); Size aItemSize( aImageList.GetImage( IID_BOTTOMLOCK ).GetSizePixel() ); diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 9e29dd8dd..70d1bb63d 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -1029,8 +1029,8 @@ USHORT SvxBorderTabPage::GetPresetStringId( USHORT nValueSetIdx ) const void SvxBorderTabPage::FillPresetVS() { // find correct image list - bool bDark = aWndPresets.GetDisplayBackground().GetColor().IsDark(); - ImageList& rImgList = bDark ? aBorderImgLstH : aBorderImgLst; + bool bHC = aWndPresets.GetSettings().GetStyleSettings().GetHighContrastMode(); + ImageList& rImgList = bHC ? aBorderImgLstH : aBorderImgLst; Size aImgSize( rImgList.GetImage( IID_PRE_CELL_NONE ).GetSizePixel() ); // basic initialization of the ValueSet @@ -1056,8 +1056,8 @@ void SvxBorderTabPage::FillPresetVS() void SvxBorderTabPage::FillShadowVS() { // find correct image list - bool bDark = aWndShadows.GetDisplayBackground().GetColor().IsDark(); - ImageList& rImgList = bDark ? aShadowImgLstH : aShadowImgLst; + bool bHC = aWndPresets.GetSettings().GetStyleSettings().GetHighContrastMode(); + ImageList& rImgList = bHC ? aShadowImgLstH : aShadowImgLst; Size aImgSize( rImgList.GetImage( IID_SHADOWNONE ).GetSizePixel() ); // basic initialization of the ValueSet diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx index aea11f919..62a29eb5b 100644 --- a/cui/source/tabpages/labdlg.cxx +++ b/cui/source/tabpages/labdlg.cxx @@ -570,7 +570,7 @@ void SvxCaptionTabPage::DataChanged( const DataChangedEvent& rDCEvt ) void SvxCaptionTabPage::FillValueSet() { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); Image** ppBitmaps = bHighContrast ? mpBmpCapTypesH : mpBmpCapTypes; aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_1, *(ppBitmaps[0]) ); diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index 2212708e7..8c6af47fa 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -155,7 +155,7 @@ SvxHatchTabPage::SvxHatchTabPage aBtnLoad.SetClickHdl( LINK( this, SvxHatchTabPage, ClickLoadHdl_Impl ) ); aBtnSave.SetClickHdl( LINK( this, SvxHatchTabPage, ClickSaveHdl_Impl ) ); - aCtlPreview.SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + aCtlPreview.SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); } // ----------------------------------------------------------------------- @@ -889,7 +889,7 @@ void SvxHatchTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) void SvxHatchTabPage::DataChanged( const DataChangedEvent& rDCEvt ) { if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - aCtlPreview.SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + aCtlPreview.SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); SvxTabPage::DataChanged( rDCEvt ); } diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index 1c8a0ea28..47af0a528 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -288,6 +288,7 @@ void SvxLineTabPage::Construct() void SvxLineTabPage::FillListboxes() { + // Linienstile USHORT nOldSelect = aLbLineStyle.GetSelectEntryPos(); aLbLineStyle.FillStyles(); aLbLineStyle.Fill( pDashList ); diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index 22704cefb..81d491826 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -620,8 +620,8 @@ void BibToolBar::RebuildToolbar() void BibToolBar::ApplyImageList() { ImageList& rList = ( nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ) ? - ( GetDisplayBackground().GetColor().IsDark() ? aImgLstHC : aImgLst ) : - ( GetDisplayBackground().GetColor().IsDark() ? aBigImgLstHC : aBigImgLst ); + ( GetSettings().GetStyleSettings().GetHighContrastMode() ? aImgLstHC : aImgLst ) : + ( GetSettings().GetStyleSettings().GetHighContrastMode() ? aBigImgLstHC : aBigImgLst ); SetItemImage(TBC_BT_AUTOFILTER , rList.GetImage(SID_FM_AUTOFILTER)); SetItemImage(TBC_BT_FILTERCRIT , rList.GetImage(SID_FM_FILTERCRIT)); diff --git a/extensions/source/dbpilots/commonpagesdbp.cxx b/extensions/source/dbpilots/commonpagesdbp.cxx index d5fd41a84..ca153a200 100644 --- a/extensions/source/dbpilots/commonpagesdbp.cxx +++ b/extensions/source/dbpilots/commonpagesdbp.cxx @@ -376,7 +376,7 @@ namespace dbp { ::svt::OLocalResourceAccess aLocalResAccess( ModuleRes( RID_PAGE_TABLESELECTION ), RSC_TABPAGE ); - bool bIsHiContrast = m_aTable.GetBackground().GetColor().IsDark(); + bool bIsHiContrast = m_aTable.GetSettings().GetStyleSettings().GetHighContrastMode(); aTableImage = Image( ModuleRes( bIsHiContrast ? IMG_TABLE_HC : IMG_TABLE ) ); aQueryImage = Image( ModuleRes( bIsHiContrast ? IMG_QUERY_HC : IMG_QUERY ) ); } diff --git a/extensions/source/logging/filehandler.cxx b/extensions/source/logging/filehandler.cxx index 00d9bd5a8..c7f628e93 100644 --- a/extensions/source/logging/filehandler.cxx +++ b/extensions/source/logging/filehandler.cxx @@ -328,7 +328,16 @@ namespace logging void SAL_CALL FileHandler::flush( ) throw (RuntimeException) { MethodGuard aGuard( *this ); - // nothing to do, our ::osl::File implementation is not buffered + if(!m_pFile.get()) + { + OSL_PRECOND(false, "FileHandler::flush: no file!"); + return; + } + #if OSL_DEBUG_LEVEL > 0 + ::osl::FileBase::RC res = + #endif + m_pFile->sync(); + OSL_ENSURE(res == ::osl::FileBase::E_None, "FileHandler::flush: Could not sync logfile to filesystem."); } //-------------------------------------------------------------------- diff --git a/extensions/source/logging/logger.cxx b/extensions/source/logging/logger.cxx index 599f481a2..041f89b73 100644 --- a/extensions/source/logging/logger.cxx +++ b/extensions/source/logging/logger.cxx @@ -230,6 +230,8 @@ namespace logging m_aHandlers.forEach< XLogHandler >( ::boost::bind( &XLogHandler::publish, _1, ::boost::cref( _rRecord ) ) ); + m_aHandlers.forEach< XLogHandler >( + ::boost::bind( &XLogHandler::flush, _1 ) ); } //-------------------------------------------------------------------- diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx index 5b83a83ce..f0058ea89 100644 --- a/extensions/source/propctrlr/taborder.cxx +++ b/extensions/source/propctrlr/taborder.cxx @@ -114,7 +114,7 @@ namespace pcr aPB_OK.SetClickHdl( LINK( this, TabOrderDialog, OKClickHdl ) ); aPB_OK.Disable(); - sal_Bool bIsHighContrast = GetDisplayBackground().GetColor().IsDark(); + sal_Bool bIsHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); pImageList = new ImageList( PcrRes( bIsHighContrast ? RID_IL_FORMEXPLORER_HC : RID_IL_FORMEXPLORER ) ); diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx index 7843658c3..a79c8af55 100644 --- a/forms/source/solar/control/navtoolbar.cxx +++ b/forms/source/solar/control/navtoolbar.cxx @@ -72,10 +72,6 @@ namespace frm sLabel += String::CreateFromAscii( " " ); return sLabel; } - static bool lcl_isHighContrast( const Color& _rColor ) - { - return _rColor.IsDark(); - } } //===================================================================== @@ -346,7 +342,7 @@ namespace frm { m_eImageSize = _eSize; ::std::auto_ptr< SfxImageManager > pImageManager( new SfxImageManager( NULL ) ); - pImageManager->SetImagesForceSize( *m_pToolbar, lcl_isHighContrast( GetBackground().GetColor() ), m_eImageSize == eLarge ); + pImageManager->SetImagesForceSize( *m_pToolbar, GetSettings().GetStyleSettings().GetHighContrastMode(), m_eImageSize == eLarge ); // parts of our layout is dependent on the size of our icons Resize(); diff --git a/setup_native/prj/build.lst b/setup_native/prj/build.lst index fd3c4bb1f..05200fdf9 100644 --- a/setup_native/prj/build.lst +++ b/setup_native/prj/build.lst @@ -1,4 +1,4 @@ -pk setup_native : transex3 soltools xml2cmp sal unoil officecfg NULL +pk setup_native : l10n transex3 soltools sal xml2cmp NULL pk setup_native usr1 - all sn_mkout NULL pk setup_native\scripts\source nmake - u sn_source NULL pk setup_native\scripts nmake - u sn_scripts sn_source.u NULL diff --git a/setup_native/source/ulfconv/ulfconv.cxx b/setup_native/source/ulfconv/ulfconv.cxx index 28ecabb91..b5b332f2c 100644 --- a/setup_native/source/ulfconv/ulfconv.cxx +++ b/setup_native/source/ulfconv/ulfconv.cxx @@ -199,6 +199,8 @@ void read_encoding_table(char * file, EncodingMap& aEncodingMap) aEncodingMap.insert( EncodingMap::value_type(language, encoding->value) ); } } + + fclose(fp); } /************************************************************************ @@ -311,6 +313,7 @@ int main( int argc, char * const argv[] ) ostream = fopen(outfile, "w"); if ( ostream == NULL ) { fprintf(stderr, "ulfconv: %s : %s\n", outfile, strerror(errno)); + fclose(istream); exit(2); } } @@ -351,4 +354,7 @@ int main( int argc, char * const argv[] ) fputs(buffer, ostream); } } + + fclose(ostream); + fclose(istream); } diff --git a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx index 7b612abec..0fe8bbdae 100755 --- a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx +++ b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx @@ -257,6 +257,9 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle ) // When there is no program folder, there could be no running office if ( dwError == ERROR_FILE_NOT_FOUND ) return ERROR_SUCCESS; + if ( dwError == ERROR_PATH_NOT_FOUND ) + return ERROR_SUCCESS; + // The destination folder should never exist, don't know what to do here if ( dwError == ERROR_ALREADY_EXISTS ) return ERROR_SUCCESS; diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 4bc825147..90989c4df 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -122,7 +122,7 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, Certif ,maKeyImg ( this, XMLSEC_RES( IMG_KEY ) ) ,maHintCorrespPrivKeyFI ( this, XMLSEC_RES( FI_CORRPRIVKEY ) ) { - if ( GetSettings().GetStyleSettings().GetWindowColor().IsDark() ) + if ( GetSettings().GetStyleSettings().GetHighContrastMode() ) maKeyImg.SetImage( Image( XMLSEC_RES( IMG_KEY_HC ) ) ); //Verify the certificate @@ -139,14 +139,14 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, Certif sal_Int32 certErrors = certStatus & mask; bool bCertValid = certErrors > 0 ? false : true; - bool bIsDark = ( GetSettings().GetStyleSettings().GetWindowColor().IsDark() != FALSE ); + bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); if ( !bCertValid ) { maCertImg.SetImage( - Image( XMLSEC_RES( bIsDark ? IMG_STATE_NOT_VALIDATED_HC : IMG_STATE_NOT_VALIDATED ) ) ); + Image( XMLSEC_RES( bHC ? IMG_STATE_NOT_VALIDATED_HC : IMG_STATE_NOT_VALIDATED ) ) ); maHintNotTrustedFI.SetText( String( XMLSEC_RES( STR_CERTIFICATE_NOT_VALIDATED ) ) ); } - else if ( bIsDark ) + else if ( bHC ) maCertImg.SetImage( Image( XMLSEC_RES( IMG_STATE_CERIFICATED_HC ) ) ); FreeResource(); @@ -430,7 +430,7 @@ CertificateViewerCertPathTP::CertificateViewerCertPathTP( Window* _pParent, Cert ,msCertNotValidated ( XMLSEC_RES( STR_PATH_CERT_NOT_VALIDATED ) ) { - if ( GetSettings().GetStyleSettings().GetWindowColor().IsDark() ) + if ( GetSettings().GetStyleSettings().GetHighContrastMode() ) { maCertImage = Image( XMLSEC_RES( IMG_CERT_SMALL_HC ) ); maCertNotValidatedImage = Image( XMLSEC_RES( IMG_CERT_NOTVALIDATED_SMALL_HC ) ); diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 6e16682a7..118f15e37 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -221,7 +221,7 @@ DigitalSignaturesDialog::DigitalSignaturesDialog( maSigsNotvalidatedFI.SetText( String( XMLSEC_RES( STR_NO_INFO_TO_VERIFY ) ) ); - if ( GetBackground().GetColor().IsDark() ) + if ( GetSettings().GetStyleSettings().GetHighContrastMode() ) { // high contrast mode needs other images maSigsValidImg.SetImage( Image( XMLSEC_RES( IMG_STATE_VALID_HC ) ) ); diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx index 6797c5b84..e5307a8cc 100644 --- a/xmlsecurity/source/dialogs/macrosecurity.cxx +++ b/xmlsecurity/source/dialogs/macrosecurity.cxx @@ -429,7 +429,7 @@ void MacroSecurityTrustedSourcesTP::ClosePage( void ) ReadOnlyImage::ReadOnlyImage(Window* pParent, const ResId rResId) : FixedImage(pParent, rResId) { - sal_Bool bHighContrast = pParent->GetDisplayBackground().GetColor().IsDark(); + sal_Bool bHighContrast = pParent->GetSettings().GetStyleSettings().GetHighContrastMode(); SetImage( Image(XMLSEC_RES( bHighContrast ? RID_XMLSECTP_LOCK_HC : RID_XMLSECTP_LOCK ))); } diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx index fdc929c0f..19f8aee70 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx @@ -239,7 +239,7 @@ sal_Int16 SAL_CALL X509Certificate_MSCryptImpl :: getVersion() throw ( ::com::su ) ; if( cbIssuer <= 0 ) { - delete issuer ; + delete [] issuer ; throw RuntimeException() ; } @@ -252,7 +252,7 @@ sal_Int16 SAL_CALL X509Certificate_MSCryptImpl :: getVersion() throw ( ::com::su if(issuer[cbIssuer-1] == 0) cbIssuer--; //delimit the last 0x00; OUString xIssuer(issuer , cbIssuer ,encoding ) ; //By CP - delete issuer ; + delete [] issuer ; return replaceTagSWithTagST(xIssuer); } else { @@ -288,7 +288,7 @@ sal_Int16 SAL_CALL X509Certificate_MSCryptImpl :: getVersion() throw ( ::com::su ) ; if( cbSubject <= 0 ) { - delete subject ; + delete [] subject ; throw RuntimeException() ; } @@ -301,7 +301,7 @@ sal_Int16 SAL_CALL X509Certificate_MSCryptImpl :: getVersion() throw ( ::com::su if(subject[cbSubject-1] == 0) cbSubject--; //delimit the last 0x00; OUString xSubject(subject , cbSubject ,encoding ) ; //By CP - delete subject ; + delete [] subject ; return replaceTagSWithTagST(xSubject); } else { |