diff options
author | Kurt Zenker <kz@openoffice.org> | 2009-11-13 19:04:43 +0100 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2009-11-13 19:04:43 +0100 |
commit | fae69df66d251563f2fd7bb64e8e2b4226504bd1 (patch) | |
tree | d0b055145e161cccf215152b6975e43b6d923c34 | |
parent | 3ccdb12a54b1945918cc340b41d3913d686d0232 (diff) | |
parent | 572bbcfbc00d994d3696001fc0e74be0bc507fe2 (diff) |
CWS-TOOLING: integrate CWS changehc02
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 3 | ||||
-rw-r--r-- | basctl/source/basicide/baside3.cxx | 814 | ||||
-rw-r--r-- | basctl/source/basicide/objdlg.cxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/tbxctl.cxx | 2 | ||||
-rw-r--r-- | extensions/source/bibliography/toolbar.cxx | 4 | ||||
-rw-r--r-- | extensions/source/dbpilots/commonpagesdbp.cxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/taborder.cxx | 2 | ||||
-rw-r--r-- | forms/source/solar/control/navtoolbar.cxx | 6 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/certificateviewer.cxx | 10 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 2 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/macrosecurity.cxx | 2 |
11 files changed, 423 insertions, 426 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 27dce8dccc2f..644bd85bcb4d 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 d89191803c9f..d33310b6e339 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 55bc15810a2b..d71f1b2929d7 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 e2af9e0346a1..3ebc749c30aa 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/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index 71de2963862b..416ff1e1845b 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 43d8c7af5889..1d02cac88a4b 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/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx index f8021b55229c..865a0074d457 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 37b9faf8a5f4..c5114fe4ea15 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/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 7f04872f7a63..765649ba3bf7 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 cf07edb7023e..e8a484f38944 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -216,7 +216,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 9d469a53a479..f7fa2c08eca5 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 ))); } |