Commits

Christian Lippka  committed 9a5ba63 Merge

merge to m65

  • Participants
  • Parent commits e0d9929, f7fde85

Comments (0)

Files changed (314)

 ea7486fff61808306c4f767858eaa8c028a9511d DEV300_m44
 f816fc756802ccafe3540d56fdd63876f4174f4c DEV300_m50
 fe121e01e7b40ac96c6574f17487c1a9b3cc7662 DEV300_m41
+ccdb8c85656c5ff3cd1ac7b527eac0227cfd7ced DEV300_m63
+ccdb8c85656c5ff3cd1ac7b527eac0227cfd7ced DEV300_last_svn_milestone
+1bedb4abe3093a053182879856f436dd9b939846 DEV300_m64
+0d8650731e2fe04a3b67ec4e9728924544664187 DEV300_m65

File basctl/source/basicide/baside2b.cxx

 	pModulWindow = 0;
 	nCurYOffset = 0;
     setBackgroundColor(GetSettings().GetStyleSettings().GetFieldColor());
+    m_bHighContrastMode = GetSettings().GetStyleSettings().GetHighContrastMode();
 	nMarkerPos = MARKER_NOMARKER;
 
 	// nCurYOffset merken und nicht von EditEngine holen.
             != rDCEvt.GetOldSettings()->GetStyleSettings().GetFieldColor())
         {
             setBackgroundColor(aColor);
+            m_bHighContrastMode = GetSettings().GetStyleSettings().GetHighContrastMode();
             Invalidate();
         }
     }
 void BreakPointWindow::setBackgroundColor(Color aColor)
 {
 	SetBackground(Wallpaper(aColor));
-    m_bHighContrastMode = aColor.IsDark();
 }
 
 

File basctl/source/basicide/baside3.cxx

 #include <ide_pch.hxx>
 
 
-#include <vector>
+#include <vector>
 #include <basidesh.hrc>
 #include <baside3.hxx>
 #include <localizationmgr.hxx> 
 #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>
 #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>
 		case SID_EXPORT_DIALOG:
 			SaveDialog();
 			break;
-
-		case SID_IMPORT_DIALOG:
-			ImportDialog();
-			break;
+
+		case SID_IMPORT_DIALOG:
+			ImportDialog();
+			break;
 	}
 
 	rReq.Done();
 	return bDone;
 }
 
-extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft,
-							 const ::com::sun::star::lang::Locale& rLocaleRight );
+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;
-}
-
+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;	

File basctl/source/basicide/objdlg.cxx

 
 void ObjectCatalogToolBox_Impl::setImages()
 {
-    bool bHC = GetDisplayBackground().GetColor().IsDark();
+    bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
     if (bHC != m_bHighContrast)
     {
         SetImageList(bHC ? m_aImagesHighContrast : m_aImagesNormal);

File basctl/source/basicide/tbxctl.cxx

                 Image aImage = GetImage( m_xFrame, 
                                          aSlotURL,
                                          hasBigImages(),
-                                         GetToolBox().GetDisplayBackground().GetColor().IsDark() );
+                                         GetToolBox().GetSettings().GetStyleSettings().GetHighContrastMode() );
                 ToolBox& rBox = GetToolBox();
                 rBox.SetItemImage(GetId(), aImage);
 				nLastSlot = nLastEnum;

File basegfx/inc/basegfx/curve/b2dcubicbezier.hxx

 			sense to use reserve(4) at the vector as preparation.
 		*/
 		void getAllExtremumPositions(::std::vector< double >& rResults) const;
+
+		/** Get optimum-split position on this segment
+
+			This method calculates the positions of all points of the segment
+			that have the maximimum distance to the corresponding line from
+			startpoint-endpoint. This helps to approximate the bezier curve
+			with a minimum number of line segments
+
+			@param fResults
+ 			Result positions are in the range ]0.0 .. 1.0[
+			Cubic beziers have at most two of these positions
+
+			@return
+			Returns the number of split positions found
+		*/
+		int getMaxDistancePositions( double fResults[2]) const;
 	};
 } // end of namespace basegfx
 

File basegfx/inc/basegfx/polygon/b2dpolygon.hxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: b2dpolygon.hxx,v $
- * $Revision: 1.14 $
  *
  * This file is part of OpenOffice.org.
  *
 
 		/// Coordinate insert/append
 		void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1);
-		void append(const basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1);
+		void append(const basegfx::B2DPoint& rPoint, sal_uInt32 nCount);
+		void append(const basegfx::B2DPoint& rPoint);
+		void reserve(sal_uInt32 nCount);
 
 		/// Basic ControlPoint interface
 		basegfx::B2DPoint getPrevControlPoint(sal_uInt32 nIndex) const;

File basegfx/inc/basegfx/range/b1drange.hxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: b1drange.hxx,v $
- * $Revision: 1.15 $
  *
  * This file is part of OpenOffice.org.
  *
 			return maRange.overlaps(rRange.maRange); 
 		}
 
+		bool overlapsMore(const B1DRange& rRange) const 
+		{ 
+			return maRange.overlapsMore(rRange.maRange); 
+		}
+
 		void expand(double fValue) 
 		{ 
 			maRange.expand(fValue); 

File basegfx/inc/basegfx/range/b2drange.hxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: b2drange.hxx,v $
- * $Revision: 1.19 $
  *
  * This file is part of OpenOffice.org.
  *
 				);
 		}
 
+		bool overlapsMore(const B2DRange& rRange) const
+		{
+			return (
+				maRangeX.overlapsMore(rRange.maRangeX) 
+				&& maRangeY.overlapsMore(rRange.maRangeY)
+				);
+		}
+
 		void expand(const B2DTuple& rTuple)
 		{
 			maRangeX.expand(rTuple.getX());

File basegfx/inc/basegfx/range/basicrange.hxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: basicrange.hxx,v $
- * $Revision: 1.15 $
  *
  * This file is part of OpenOffice.org.
  *
 			}
 		}
 
+		bool overlapsMore(const BasicRange& rRange) const
+		{
+			if(isEmpty() || rRange.isEmpty())
+				return false;
+			// returns true if the overlap is more than just a touching at the limits
+			return ((rRange.mnMaximum > mnMinimum) && (rRange.mnMinimum < mnMaximum));
+		}
+
 		bool operator==( const BasicRange& rRange ) const 
 		{ 
 			return (mnMinimum == rRange.mnMinimum && mnMaximum == rRange.mnMaximum);

File basegfx/source/curve/b2dcubicbezier.cxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: b2dcubicbezier.cxx,v $
- * $Revision: 1.16 $
  *
  * This file is part of OpenOffice.org.
  *
 			impCheckExtremumResult(fCY / (2 * fBY), rResults);
 		}
 	}
+
+	int B2DCubicBezier::getMaxDistancePositions( double pResult[2]) const
+	{
+		// the distance from the bezier to a line through start and end
+		// is proportional to (ENDx-STARTx,ENDy-STARTy)*(+BEZIERy(t),-BEZIERx(t))
+		// this distance becomes zero for at least t==0 and t==1
+		// its extrema that are between 0..1 are interesting as split candidates
+		// its derived function has the form dD/dt = fA*t^2 + 2*fB*t + fC
+		const B2DPoint aRelativeEndPoint(maEndPoint-maStartPoint);
+		const double fA = 3 * (maEndPoint.getX() - maControlPointB.getX()) * aRelativeEndPoint.getY()
+				- 3 * (maEndPoint.getY() - maControlPointB.getY()) * aRelativeEndPoint.getX();
+		const double fB = (maControlPointB.getX() - maControlPointA.getX()) * aRelativeEndPoint.getY()
+				- (maControlPointB.getY() - maControlPointA.getY()) * aRelativeEndPoint.getX();
+		const double fC = (maControlPointA.getX() - maStartPoint.getX()) * aRelativeEndPoint.getY()
+				- (maControlPointA.getY() - maStartPoint.getY()) * aRelativeEndPoint.getX();
+
+		// test for degenerated case: non-cubic curve
+		if( fTools::equalZero(fA) )
+		{
+			// test for degenerated case: straight line
+			if( fTools::equalZero(fB) )
+				return 0;
+
+			// degenerated case: quadratic bezier
+			pResult[0] = -fC / (2*fB);
+
+			// test root: ignore it when it is outside the curve
+			int nCount = ((pResult[0] > 0) && (pResult[0] < 1));
+			return nCount;
+		}
+
+		// derivative is polynomial of order 2
+		// check if the polynomial has non-imaginary roots
+		const double fD = fB*fB - fA*fC;
+		if( fD >= 0.0 )	// TODO: is this test needed? geometrically not IMHO
+		{
+			// calculate the first root
+			const double fS = sqrt(fD);
+			const double fQ = fB + ((fB >= 0) ? +fS : -fS);
+			pResult[0] = fQ / fA;
+			// test root: ignore it when it is outside the curve
+			int nCount = ((pResult[0] > 0) && (pResult[0] < 1));
+
+			// ignore multiplicit roots
+			if( !fTools::equalZero(fD) )
+			{
+ 				// calculate the second root
+				const double fRoot = fC / fQ;
+				pResult[ nCount ] = fC / fQ;
+				// test root: ignore it when it is outside the curve
+				nCount += ((fRoot > 0) && (fRoot < 1));
+			}
+
+			return nCount;
+		}
+
+		return 0;
+	}
+
 } // end of namespace basegfx
 
 // eof

File basegfx/source/polygon/b2dpolygon.cxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: b2dpolygon.cxx,v $
- * $Revision: 1.22 $
  *
  * This file is part of OpenOffice.org.
  *
 		maVector[nIndex].setCoordinate(rValue);
 	}
 
+	void reserve(sal_uInt32 nCount)
+	{
+		maVector.reserve(nCount);
+	}
+
+	void append(const CoordinateData2D& rValue)
+	{
+		maVector.push_back(rValue);
+	}
+
 	void insert(sal_uInt32 nIndex, const CoordinateData2D& rValue, sal_uInt32 nCount)
 	{
 		if(nCount)
 		}
 	}
 
+	void append(const ControlVectorPair2D& rValue)
+	{
+		maVector.push_back(rValue);
+
+		if(!rValue.getPrevVector().equalZero())
+			mnUsedVectors += 1;
+
+		if(!rValue.getNextVector().equalZero())
+			mnUsedVectors += 1;
+	}
+
 	void insert(sal_uInt32 nIndex, const ControlVectorPair2D& rValue, sal_uInt32 nCount)
 	{
 		if(nCount)
 		maPoints.setCoordinate(nIndex, rValue);
 	}
 
+	void reserve(sal_uInt32 nCount)
+	{
+		maPoints.reserve(nCount);
+	}
+
+	void append(const basegfx::B2DPoint& rPoint)
+	{
+		mpBufferedData.reset(); // TODO: is this needed?
+		const CoordinateData2D aCoordinate(rPoint);
+		maPoints.append(aCoordinate);
+
+		if(mpControlVector)
+		{
+			const ControlVectorPair2D aVectorPair;
+			mpControlVector->append(aVectorPair);
+		}
+	}
+
 	void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 nCount)
 	{
 		if(nCount)
 		}
 	}
 
+	void B2DPolygon::reserve(sal_uInt32 nCount)
+	{
+		mpPolygon->reserve(nCount);
+	}
+
 	void B2DPolygon::insert(sal_uInt32 nIndex, const B2DPoint& rPoint, sal_uInt32 nCount)
 	{
 		OSL_ENSURE(nIndex <= mpPolygon->count(), "B2DPolygon Insert outside range (!)");
 		}
 	}
 
+	void B2DPolygon::append(const B2DPoint& rPoint)
+	{
+		mpPolygon->append(rPoint);
+	}
+
 	B2DPoint B2DPolygon::getPrevControlPoint(sal_uInt32 nIndex) const
 	{
 		OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)");

File basegfx/source/polygon/b2dpolygoncutandtouch.cxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: b2dpolygoncutandtouch.cxx,v $
- * $Revision: 1.8 $
  *
  * This file is part of OpenOffice.org.
  *
 
 			// create subdivided polygons and find cuts between them
             // Keep adaptiveSubdivideByCount due to needed quality
+			aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); 
 			aTempPolygonA.append(rCubicA.getStartPoint());
 			rCubicA.adaptiveSubdivideByCount(aTempPolygonA, SUBDIVIDE_FOR_CUT_TEST_COUNT);
 			aTempPolygonEdge.append(rCurrB);
 
 			// create subdivided polygons and find cuts between them
             // Keep adaptiveSubdivideByCount due to needed quality
+			aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); 
 			aTempPolygonA.append(rCubicA.getStartPoint());
 			rCubicA.adaptiveSubdivideByCount(aTempPolygonA, SUBDIVIDE_FOR_CUT_TEST_COUNT);
+			aTempPolygonB.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); 
 			aTempPolygonB.append(rCubicB.getStartPoint());
 			rCubicB.adaptiveSubdivideByCount(aTempPolygonB, SUBDIVIDE_FOR_CUT_TEST_COUNT);
 
 			const B2DCubicBezier& rCubicA,
 			sal_uInt32 nInd, temporaryPointVector& rTempPoints)
 		{
+			// avoid expensive part of this method if possible
+			// TODO: use hasAnyExtremum() method instead when it becomes available
+			double fDummy;
+			const bool bHasAnyExtremum = rCubicA.getMinimumExtremumPosition( fDummy );
+			if( !bHasAnyExtremum )
+				return;
+
 			// find all self-intersections on the given bezier segment. Add an entry to the tempPoints
 			// for each self intersection point with the cut value describing the relative position on given
 			// bezier segment.
 
 			// create subdivided polygon and find cuts on it
             // Keep adaptiveSubdivideByCount due to needed quality
+			aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); 
 			aTempPolygon.append(rCubicA.getStartPoint());
 			rCubicA.adaptiveSubdivideByCount(aTempPolygon, SUBDIVIDE_FOR_CUT_TEST_COUNT);
 			findCuts(aTempPolygon, aTempPointVector);
 								const bool bEdgeBIsCurve(aCubicB.isBezier());
 								const B2DRange aRangeB(aCubicB.getRange());
 
-								if(aRangeA.overlaps(aRangeB))
+								// only overlapping segments need to be tested
+								// consecutive segments touch of course
+								bool bOverlap = false;
+								if( b > a+1)
+									bOverlap = aRangeA.overlaps(aRangeB);
+								else
+									bOverlap = aRangeA.overlapsMore(aRangeB);
+								if( bOverlap)
 								{
 									if(bEdgeAIsCurve && bEdgeBIsCurve)
 									{
 								const B2DPoint aNextB(rCandidate.getB2DPoint(b + 1L == nPointCount ? 0L : b + 1L));
 								const B2DRange aRangeB(aCurrB, aNextB);
 								
-								if(aRangeA.overlaps(aRangeB))
+								// consecutive segments touch of course
+								bool bOverlap = false;
+								if( b > a+1)
+									bOverlap = aRangeA.overlaps(aRangeB);
+								else
+									bOverlap = aRangeA.overlapsMore(aRangeB);
+								if( bOverlap)
 								{
 									findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPoints, rTempPoints);
 								}
 
 			// create subdivided polygon and find cuts on it
             // Keep adaptiveSubdivideByCount due to needed quality
+			aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); 
 			aTempPolygon.append(rCubicA.getStartPoint());
 			rCubicA.adaptiveSubdivideByCount(aTempPolygon, SUBDIVIDE_FOR_CUT_TEST_COUNT);
 			findTouches(aTempPolygon, rPointPolygon, aTempPointVector);
 								const bool bEdgeBIsCurve(aCubicB.isBezier());
 								const B2DRange aRangeB(aCubicB.getRange());
 
-								if(aRangeA.overlaps(aRangeB))
+								// consecutive segments touch of course
+								bool bOverlap = false;
+								if( b > a+1)
+									bOverlap = aRangeA.overlaps(aRangeB);
+								else
+									bOverlap = aRangeA.overlapsMore(aRangeB);
+								if( bOverlap)
 								{
 									if(bEdgeAIsCurve && bEdgeBIsCurve)
 									{
 								const B2DPoint aNextB(rCandidateB.getB2DPoint(b + 1L == nPointCountB ? 0L : b + 1L));
 								const B2DRange aRangeB(aCurrB, aNextB);
 
-								if(aRangeA.overlaps(aRangeB))
+								// consecutive segments touch of course
+								bool bOverlap = false;
+								if( b > a+1)
+									bOverlap = aRangeA.overlaps(aRangeB);
+								else
+									bOverlap = aRangeA.overlapsMore(aRangeB);
+								if( bOverlap)
 								{
 									// test for simple edge-edge cuts
 									findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPointsA, rTempPointsB);

File basegfx/source/polygon/b2dpolygontools.cxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: b2dpolygontools.cxx,v $
- * $Revision: 1.29.4.1 $
  *
  * This file is part of OpenOffice.org.
  *
 					B2DCubicBezier aBezier;
 					aBezier.setStartPoint(rCandidate.getB2DPoint(0));
 					
+					// perf: try to avoid too many realloctions by guessing the result's pointcount
+					aRetval.reserve(nPointCount*4);
+					
 					// add start point (always)
 					aRetval.append(aBezier.getStartPoint());
 					
 					B2DCubicBezier aBezier;
 					aBezier.setStartPoint(rCandidate.getB2DPoint(0));
 					
+					// perf: try to avoid too many realloctions by guessing the result's pointcount
+					aRetval.reserve(nPointCount*4);
+					
 					// add start point (always)
 					aRetval.append(aBezier.getStartPoint());
 					
 					const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1);
 					B2DCubicBezier aBezier;
 					aBezier.setStartPoint(rCandidate.getB2DPoint(0));
+	
+					// perf: try to avoid too many realloctions by guessing the result's pointcount
+					aRetval.reserve(nPointCount*4);
 					
 					// add start point (always)
 					aRetval.append(aBezier.getStartPoint());
 				B2DCubicBezier aBezier;
 				aBezier.setStartPoint(rCandidate.getB2DPoint(0));
 
+				// try to avoid costly reallocations
+				aRetval.reserve( nEdgeCount+1);
+
 				// add start point
 				aRetval.append(aBezier.getStartPoint());
 

File binfilter/bf_sc/source/core/data/sc_column.cxx

 /*N*/ 			}
 /*N*/ 		}
 /*N*/ 
-/*N*/ 		delete pDelRows;
-/*N*/ 		delete ppDelCells;
+/*N*/ 		delete[] pDelRows;
+/*N*/ 		delete[] ppDelCells;
 /*N*/ 	}
 /*N*/ 
 /*N*/ 	pDocument->SetAutoCalc( bOldAutoCalc );

File binfilter/bf_sfx2/source/config/sfx2_cfgmgr.cxx

 /*N*/ 	pBuf[nLen] = 0;
 /*N*/ 	if( strcmp( pBuf, pHeader ) )
 /*N*/ 	{
-/*N*/ 		delete pBuf;
+/*N*/ 		delete[] pBuf;
 /*?*/ 		return SfxConfigManager::ERR_FILETYPE;
 /*N*/ 	}
 /*N*/ 
-/*N*/ 	delete pBuf;
+/*N*/ 	delete[] pBuf;
 /*N*/ 
 /*N*/ 	// compare version
 /*N*/ 	char c;

File binfilter/bf_sfx2/source/doc/sfx2_docinf.cxx

 /*N*/                     aString = String();
 /*N*/             }
 /*N*/
-/*N*/             delete pString;
+/*N*/             delete[] pString;
 /*N*/         }
 /*N*/         else
 /*N*/         {

File binfilter/bf_so3/source/inplace/outplace.cxx

 				}
 
 				DeleteMetaFile( hMet );
-				delete pBuf;
+				delete[] pBuf;
 			}
 		}
 
 				}
 
 				DeleteMetaFile( hMet );
-				delete pBuf;
+				delete[] pBuf;
 			}
 		}
 

File binfilter/bf_so3/source/inplace/rmapplet.cxx

     strcpy( aBuf, RMAPPLET_PACKAGE ); // #100211# - checked
     strcat( aBuf, pClassName );       // #100211# - checked
 	createObject( DCA_NAMESPACE(OObjectBroker, dca)::getBroker("dcabroker"), aBuf );
-    delete aBuf;
+    delete[] aBuf;
 
 	DBG_TRACE( "Rm: Window::Create() - After createObject()" );
 
     strcpy( aBuf, RMAPPLET_PACKAGE ); // #100211# - checked
     strcat( aBuf, pClassName );       // #100211# - checked
     createObject( DCA_NAMESPACE(OObjectBroker, dca)::getBroker("dcabroker"), aBuf );
-    delete aBuf;
+    delete[] aBuf;
 
 	DBG_TRACE( "Rm: Window::Create() - After createObject()" );
 
     strcpy( aBuf, RMAPPLET_PACKAGE ); // #100211# - checked
     strcat( aBuf, pClassName );       // #100211# - checked
     createObject( DCA_NAMESPACE(OObjectBroker, dca)::getBroker("dcabroker"), aBuf );
-    delete aBuf;
+    delete[] aBuf;
 
 	DBG_TRACE( "Rm: Window::Create() - After createObject()" );
 	DCA_NAMESPACE(OCallMethodMsg, dca) aMsg( this, MSG_APPLET_CREATE );

File binfilter/bf_svtools/source/filter.vcl/wmf/svt_wmfwr.cxx

 
 	Polygon aSimplePoly;
 	if ( rPoly.HasFlags() )
-		rPoly.GetSimple( aSimplePoly );
+		rPoly.AdaptiveSubdivide( aSimplePoly );
 	else
 		aSimplePoly = rPoly;
 	nSize = aSimplePoly.GetSize();
 	USHORT nSize,i;
 	Polygon aSimplePoly;
 	if ( rPoly.HasFlags() )
-		rPoly.GetSimple( aSimplePoly );
+		rPoly.AdaptiveSubdivide( aSimplePoly );
 	else
 		aSimplePoly = rPoly;
 	nSize=aSimplePoly.GetSize();
 		if ( aSimplePolyPoly[ i ].HasFlags() )
 		{
 			Polygon aSimplePoly;
-			aSimplePolyPoly[ i ].GetSimple( aSimplePoly );
+			aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly );
 			aSimplePolyPoly[ i ] = aSimplePoly;
 		}
 	}

File binfilter/bf_svtools/source/items1/svt_nranges.cxx

 	NUMTYPE nThisSize = Count_Impl(_pRanges);
 	NUMTYPE nTargetSize = 1 + (  nThisSize + Count_Impl(rRanges._pRanges) );
 	NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ];
-	memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 );
+	memset( pTarget, 0, sizeof(NUMTYPE)*nTargetSize );
 	memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize );
 
 	NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0;
 	NUMTYPE nThisSize = Count_Impl(_pRanges);
 	NUMTYPE nTargetSize = 1 + (  nThisSize + Count_Impl(rRanges._pRanges) );
 	NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ];
-	memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 );
+	memset( pTarget, 0, sizeof(NUMTYPE)*nTargetSize );
 	memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize );
 
 	NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0;

File binfilter/bf_svtools/source/svdde/svt_ddeml1.cxx

 	String aStr( (ULONG)hWndServer );
 	aStr += pBuf;
 	HSZ hszInstServ = DdeCreateStringHandle( (PSZ)(const char*)pBuf, 850 );
-	delete pBuf;
+	delete[] pBuf;
 
 	pPtr->hBaseServName = hszService;
 	pPtr->hInstServName = hszInstServ;

File binfilter/bf_svtools/source/svdde/svt_ddesvr.cxx

 							pInst->hDdeInstSvr, (LPBYTE) pPairs,
 							sizeof(HSZPAIR) * (nTopics+1),
 							0, NULL, nCbType, 0);
-			delete pPairs;
+			delete[] pPairs;
 			return h;
 		}
 

File binfilter/bf_svx/source/xoutdev/svx_xfontmac.cxx

 	/* was wir angefordert haben, muessen wir auch wieder freigeben!
 	*/
 	GXDisposeShape( aOutlineShape );
-	delete pPathData;
+	delete[] pPathData;
 
 	rOut.SetFont( aFont );
 

File binfilter/bf_sw/source/core/sw3io/sw_sw3num.cxx

 /*N*/ 		CloseRec( SWG_OUTLINEEXT );
 /*N*/ 	}
 /*N*/ 
-/*N*/ 	delete ppTxtColls;
+/*N*/ 	delete[] ppTxtColls;
 /*N*/ #endif
 /*N*/ }
 

File binfilter/bf_sw/source/filter/excel/sw_excimpop.cxx

 	pIn->Read( pStr, nLaenge );
 	pStr[ nLaenge ] = 0;
 	aString = String(pStr, eZielChar);
-	delete pStr;
+	delete[] pStr;
 
 	return aString;
 	}

File binfilter/bf_sw/source/filter/w4w/sw_w4wgraf.cxx