[ooo-build-commit] Branch 'ooo/master' - 6 commits - desktop/prj desktop/win32 fpicker/source framework/source sfx2/inc sfx2/source svx/source sysui/util xmloff/inc xmloff/source

Jan Holesovsky kendy at kemper.freedesktop.org
Tue Jul 28 18:03:22 PDT 2009


 desktop/prj/build.lst                                   |    3 
 desktop/prj/d.lst                                       |    2 
 desktop/win32/source/rebase/Resource.h                  |   41 ++
 desktop/win32/source/rebase/makefile.mk                 |   93 ++++++
 desktop/win32/source/rebase/rcfooter.txt                |    2 
 desktop/win32/source/rebase/rcheader.txt                |   39 ++
 desktop/win32/source/rebase/rctmpl.txt                  |    9 
 desktop/win32/source/rebase/rebase.cxx                  |  190 +++++++++++++
 desktop/win32/source/rebase/rebasegui.cxx               |  200 +++++++++++++
 desktop/win32/source/rebase/rebasegui.ulf               |   11 
 fpicker/source/win32/filepicker/FPentry.cxx             |    4 
 fpicker/source/win32/filepicker/SolarMutex.cxx          |   58 ++++
 fpicker/source/win32/filepicker/SolarMutex.hxx          |   33 ++
 fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx |    1 
 fpicker/source/win32/filepicker/asynceventnotifier.cxx  |    5 
 fpicker/source/win32/filepicker/asyncrequests.cxx       |    2 
 fpicker/source/win32/filepicker/makefile.mk             |    3 
 fpicker/source/win32/folderpicker/MtaFop.cxx            |   36 --
 fpicker/source/win32/misc/WinImplHelper.cxx             |   46 ++-
 fpicker/source/win32/misc/WinImplHelper.hxx             |    2 
 framework/source/uielement/toolbarmanager.cxx           |   16 -
 sfx2/inc/sfx2/filedlghelper.hxx                         |    8 
 sfx2/source/dialog/filedlghelper.cxx                    |   50 +++
 sfx2/source/doc/docinsert.cxx                           |   26 -
 svx/source/sdr/contact/viewcontactofe3dpolygon.cxx      |   17 -
 svx/source/svdraw/svdotextdecomposition.cxx             |   31 +-
 sysui/util/checksize.pl                                 |    4 
 xmloff/inc/SchXMLImport.hxx                             |    1 
 xmloff/inc/xmlkywd.hxx                                  |    7 
 xmloff/inc/xmloff/SchXMLExportHelper.hxx                |    7 
 xmloff/inc/xmloff/SchXMLImportHelper.hxx                |    7 
 xmloff/inc/xmloff/xmltoken.hxx                          |    7 
 xmloff/source/chart/SchXMLChartContext.cxx              |  231 +++++++++-------
 xmloff/source/chart/SchXMLChartContext.hxx              |    7 
 xmloff/source/chart/SchXMLExport.cxx                    |   51 +--
 xmloff/source/chart/SchXMLImport.cxx                    |   37 --
 xmloff/source/chart/SchXMLPlotAreaContext.cxx           |   28 +
 xmloff/source/chart/SchXMLPlotAreaContext.hxx           |    6 
 xmloff/source/chart/SchXMLSeries2Context.cxx            |    4 
 xmloff/source/chart/SchXMLTableContext.cxx              |   60 +---
 xmloff/source/chart/SchXMLTableContext.hxx              |    6 
 xmloff/source/chart/SchXMLTools.cxx                     |  105 +++++++
 xmloff/source/chart/SchXMLTools.hxx                     |   10 
 xmloff/source/core/xmltoken.cxx                         |    7 
 44 files changed, 1203 insertions(+), 310 deletions(-)

New commits:
commit ec4d71ddcf07740aef057540acea4ec34dfbe1ac
Author: Ivo Hinkelmann <ihi at openoffice.org>
Date:   Tue Jul 28 17:47:41 2009 +0000

    #i10000# #i103809# don't test for empty localize.sdf files

diff --git a/sysui/util/checksize.pl b/sysui/util/checksize.pl
index 9fc6a27..3ecea2c 100644
--- a/sysui/util/checksize.pl
+++ b/sysui/util/checksize.pl
@@ -82,8 +82,8 @@ sub check       #04.02.2005 13:40
     my $path = shift;
     my $file = shift;
     print "$path$file\n" if ((-e "$path$file") && $is_debug);
-    # don't check dpc,flag,rpmflag, [obj for UNX] files, or etc subdirectory
-    return if ( ($file =~ /.+\.(dpc|\w*?flag)/) || ($file =~ /.+\.obj/ && $ENV{GUI} eq 'UNX') || ($path =~ /.+etc/) || ($path =~ /.+logs/) );
+    # don't check dpc,flag,rpmflag,sdf [obj for UNX] files, or etc subdirectory
+    return if ( ($file =~ /.+\.(dpc|\w*?flag)/) || ($file =~ /.+\.obj/ && $ENV{GUI} eq 'UNX') || ($path =~ /.+etc/) || ($path =~ /.+logs/) || ($path =~ /.+sdf/) );
     if ( -z "$path$file" ) {
         print "Error: $path$file 0 Bytes!\n";
         $err++;
commit ec016b7b5b1967a775c06e941d7219f5098be2ae
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Tue Jul 28 17:06:33 2009 +0000

    CWS-TOOLING: integrate CWS aw076_DEV300
    2009-07-16 15:59:57 +0200 aw  r274058 : #i103454# added grow possibility for block text in the 'other' direction

diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index ff322aa..cd760c7 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -773,17 +773,40 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive(
     }
     else
     {
+        // check if block text is used (only one of them can be true)
+        const bool bHorizontalIsBlock(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg);
+        const bool bVerticalIsBlock(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg);
+
         if((rSdrBlockTextPrimitive.getWordWrap() || IsTextFrame()) && !rSdrBlockTextPrimitive.getUnlimitedPage())
         {
-            rOutliner.SetMaxAutoPaperSize(aAnchorTextSize);
+            // #i103454# maximal paper size hor/ver needs to be limited to text
+            // frame size. If it's block text, still allow the 'other' direction
+            // to grow to get a correct real text size when using GetPaperSize(). 
+            // When just using aAnchorTextSize as maximum, GetPaperSize()
+            // would just return aAnchorTextSize again: this means, the wanted 
+            // 'measurement' of the real size of block text would not work
+            Size aMaxAutoPaperSize(aAnchorTextSize);
+
+            if(bHorizontalIsBlock)
+            {
+                // allow to grow vertical for horizontal blocks
+                aMaxAutoPaperSize.setHeight(1000000);
+            }
+            else if(bVerticalIsBlock)
+            {
+                // allow to grow horizontal for vertical blocks
+                aMaxAutoPaperSize.setWidth(1000000);
+            }
+            
+            rOutliner.SetMaxAutoPaperSize(aMaxAutoPaperSize);
         }
 
-        if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg)
+        // set minimal paper size hor/ver if needed
+        if(bHorizontalIsBlock)
         {
             rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0));
         }
-
-        if(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg)
+        else if(bVerticalIsBlock)
         {
             rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight));
         }
commit ef6e9fa48cf077cc4161870a2ac81cd17a811c0b
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Tue Jul 28 16:11:04 2009 +0000

    CWS-TOOLING: integrate CWS filepicker01
    2009-07-03 13:21:25 +0200 cd  r273690 : #i102319# Use GetSelectedFiles() instead of GetMPath() to retrieve a set of selected files
    2009-07-01 14:27:56 +0200 cd  r273582 : #i64800# Use ParseDisplayName correctly and don't allocate memory for an output parameter
    2009-07-01 10:47:47 +0200 cd  r273553 : #i102701# Make P1 fix for CWS filepicker01, too.
    2009-06-29 11:58:09 +0200 cd  r273463 : i102319# File picker should NOT set multi selection as a default.
    2009-06-29 11:49:10 +0200 cd  r273461 : #i102319# Use XFilePicker2 interface to retrieve files from multi selection
    2009-06-26 15:42:43 +0200 cd  r273423 : #i99759# Release solar mutex before blocking on execute() when using system file picker
    2009-06-26 15:35:50 +0200 cd  r273422 : #i99759# Don't release solar mutex in shutdown(). Must be done before calling execute()
    2009-06-23 11:40:02 +0200 cd  r273267 : #i95425# Fixed wrong initialization of TimeValue members
    2009-06-23 10:35:20 +0200 cd  r273262 : #i99759# Fix deadlock on Windows XP/2000 because of removing Picker Thread from sfx2. Now CAsyncEventNotifierThread releases the solar mutex before blocking
    2009-06-22 11:59:15 +0200 cd  r273209 : #i102948# Remove links from toolbar object when using lazy delete as the toolbar manager is now destroyed before the toolbar
    2009-06-22 11:22:14 +0200 cd  r273204 : #i99759# Don't use a new thread to call the file picker. As a consequence this thread is also calling Application::Yield() and therefore is fighting with the main thread for messages
    2009-06-22 11:13:32 +0200 cd  r273203 : #i99759# Solar mutex must be locked before calling Application::Yield()
    2009-06-19 15:23:01 +0200 cd  r273161 : #i102948# Remove/add decorated window from/into old/new parent decorated window list
    2009-06-19 12:49:37 +0200 cd  r273156 : #i101843# Use new COM based dialog implementation from Windows Vista on

diff --git a/fpicker/source/win32/filepicker/FPentry.cxx b/fpicker/source/win32/filepicker/FPentry.cxx
index 90d6a47..7d2d9d9 100644
--- a/fpicker/source/win32/filepicker/FPentry.cxx
+++ b/fpicker/source/win32/filepicker/FPentry.cxx
@@ -66,9 +66,9 @@ static Reference< XInterface > SAL_CALL createInstance(
     const Reference< XMultiServiceFactory >& rServiceManager )
 {
     Reference< XInterface > xDlg;
-    bool					bVista = IsWindowsVista();
+    bool					bVistaOrNewer = IsWindowsVistaOrNewer();
 
-    if (bVista)
+    if (bVistaOrNewer)
     {
         fprintf(stdout, "use special (vista) system file picker ...\n");
         xDlg.set( 
diff --git a/fpicker/source/win32/filepicker/SolarMutex.cxx b/fpicker/source/win32/filepicker/SolarMutex.cxx
new file mode 100644
index 0000000..3c446f4
--- /dev/null
+++ b/fpicker/source/win32/filepicker/SolarMutex.cxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: asynceventnotifier.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_fpicker.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <osl/thread.hxx>
+
+int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId)
+{
+    int nAcquireCount = 0;
+    vos::IMutex& rSolarMutex = Application::GetSolarMutex();
+    vos::OThread::TThreadIdentifier nMainThreadId = Application::GetMainThreadIdentifier();
+    
+    if ( nMainThreadId == nThreadId )
+    {
+        ::vos::IMutex& rMutex = Application::GetSolarMutex();
+        if ( rMutex.tryToAcquire() )
+            nAcquireCount = Application::ReleaseSolarMutex() - 1;
+    }
+    
+    return nAcquireCount;
+}
+
+void AcquireSolarMutex(int nAcquireCount)
+{
+    if ( nAcquireCount )
+        Application::AcquireSolarMutex( nAcquireCount );
+}
diff --git a/fpicker/source/win32/filepicker/SolarMutex.hxx b/fpicker/source/win32/filepicker/SolarMutex.hxx
new file mode 100644
index 0000000..95dcf13
--- /dev/null
+++ b/fpicker/source/win32/filepicker/SolarMutex.hxx
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: asynceventnotifier.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId);
+
+void AcquireSolarMutex(int nAcquireCount);
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
index a04c611..70c906a 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
@@ -401,7 +401,6 @@ void VistaFilePickerImpl::impl_sta_CreateOpenDialog(const RequestRef& rRequest)
     nFlags |=  FOS_FILEMUSTEXIST;
     nFlags |=  FOS_OVERWRITEPROMPT;
     nFlags |=  FOS_DONTADDTORECENT;
-    nFlags |=  FOS_ALLOWMULTISELECT;
 
     iDialog->SetOptions ( nFlags );
 
diff --git a/fpicker/source/win32/filepicker/asynceventnotifier.cxx b/fpicker/source/win32/filepicker/asynceventnotifier.cxx
index 4afee83..ba847f1 100644
--- a/fpicker/source/win32/filepicker/asynceventnotifier.cxx
+++ b/fpicker/source/win32/filepicker/asynceventnotifier.cxx
@@ -41,6 +41,7 @@
 
 #include <process.h>
 #include <memory>
+#include "SolarMutex.hxx"
 
 //------------------------------------------------
 //
@@ -159,7 +160,9 @@ bool SAL_CALL CAsyncEventNotifier::startup(bool bCreateSuspended)
 
 void SAL_CALL CAsyncEventNotifier::shutdown()
 {
-    OSL_PRECOND(GetCurrentThreadId() != m_ThreadId, "Method called in wrong thread context!");
+    unsigned nThreadId = GetCurrentThreadId();
+    
+    OSL_PRECOND(nThreadId != m_ThreadId, "Method called in wrong thread context!");
 
     osl::ResettableMutexGuard aGuard(m_Mutex);
     
diff --git a/fpicker/source/win32/filepicker/asyncrequests.cxx b/fpicker/source/win32/filepicker/asyncrequests.cxx
index 704ffd9..bc4515c 100644
--- a/fpicker/source/win32/filepicker/asyncrequests.cxx
+++ b/fpicker/source/win32/filepicker/asyncrequests.cxx
@@ -30,6 +30,7 @@
 
 #include "asyncrequests.hxx"
 #include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
 
 //-----------------------------------------------------------------------------
 // namespace
@@ -68,6 +69,7 @@ void Request::wait(::sal_Int32 nMilliSeconds)
 
 void Request::waitProcessMessages()
 {
+    ::vos::OGuard aGuard( Application::GetSolarMutex() );
     while (!m_aJoiner.check())
         Application::Yield();
 }
diff --git a/fpicker/source/win32/filepicker/makefile.mk b/fpicker/source/win32/filepicker/makefile.mk
index c23c081..de19287 100644
--- a/fpicker/source/win32/filepicker/makefile.mk
+++ b/fpicker/source/win32/filepicker/makefile.mk
@@ -79,7 +79,8 @@ SLOFILES=$(SLO)$/FileOpenDlg.obj\
          $(SLO)$/asyncrequests.obj\
          $(SLO)$/VistaFilePickerEventHandler.obj\
          $(SLO)$/VistaFilePickerImpl.obj\
-         $(SLO)$/VistaFilePicker.obj
+         $(SLO)$/VistaFilePicker.obj\
+         $(SLO)$/SolarMutex.obj
 
 # --- Targets ------------------------------------------------------
 
diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx
index d4e9330..d63ca14 100644
--- a/fpicker/source/win32/folderpicker/MtaFop.cxx
+++ b/fpicker/source/win32/folderpicker/MtaFop.cxx
@@ -448,34 +448,22 @@ LPITEMIDLIST SAL_CALL CMtaFolderPicker::getItemIdListFromPath( const rtl::OUStri
     if ( !aDirectory.getLength( ) )
         return NULL;
 
-    IMallocPtr pIMalloc;
-    SHGetMalloc(&pIMalloc);
-
-    LPITEMIDLIST lpItemIdList = static_cast<LPITEMIDLIST>( 
-        pIMalloc->Alloc(sizeof(ITEMIDLIST)));
+    LPITEMIDLIST lpItemIdList(NULL);
     
-    if (lpItemIdList)
-    {
-        IShellFolderPtr pIShellFolder;
-        SHGetDesktopFolder(&pIShellFolder);
+    IShellFolderPtr pIShellFolder;
+    SHGetDesktopFolder(&pIShellFolder);
 
-        if (pIShellFolder.is())
-        {
-            pIShellFolder->ParseDisplayName(
-                NULL,
-                NULL,
-                reinterpret_cast<LPOLESTR>(const_cast< sal_Unicode* >( aDirectory.getStr( ) )),
-                NULL,
-                &lpItemIdList,
-                NULL );
-        }
+    if (pIShellFolder.is())
+    {
+        pIShellFolder->ParseDisplayName(
+            NULL,
+            NULL,
+            reinterpret_cast<LPWSTR>(const_cast< sal_Unicode* >( aDirectory.getStr( ) )),
+            NULL,
+            &lpItemIdList,
+            NULL );
     }
     
-    if (pIMalloc.is())
-        pIMalloc->Free(lpItemIdList);
-
-    lpItemIdList = NULL;
-    
     return lpItemIdList;
 }
 
diff --git a/fpicker/source/win32/misc/WinImplHelper.cxx b/fpicker/source/win32/misc/WinImplHelper.cxx
index fe14d95..8d41da1 100644
--- a/fpicker/source/win32/misc/WinImplHelper.cxx
+++ b/fpicker/source/win32/misc/WinImplHelper.cxx
@@ -69,6 +69,7 @@ const sal_Unicode   AMPERSAND_SIGN = L'&';
 // Windows 2000		VER_PLATFORM_WIN32_NT		5		0
 // Windows XP		VER_PLATFORM_WIN32_NT		5		1
 // Windows Vista    VER_PLATFORM_WIN32_NT		6		0
+// Windows 7		VER_PLATFORM_WIN32_NT		6		1
 // Windows 95		VER_PLATFORM_WIN32_WINDOWS	4		0
 // Windows 98		VER_PLATFORM_WIN32_WINDOWS	4		10
 // Windows ME		VER_PLATFORM_WIN32_WINDOWS	4		90
@@ -94,25 +95,47 @@ bool SAL_CALL IsWindowsVersion(unsigned int PlatformId, unsigned int MajorVersio
 }
 
 //------------------------------------------------------------
-// determine if we are running under Win2000
+// determine if we are running under Vista or newer OS
 //------------------------------------------------------------
 
-bool SAL_CALL IsWindowsVista()
+bool SAL_CALL IsWindowsVistaOrNewer()
 {
-    return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 6, 0);	
+    OSVERSIONINFO osvi;	
+    osvi.dwOSVersionInfoSize = sizeof(osvi);
+        
+    if(!GetVersionEx(&osvi)) 			
+        return false;
+    
+    bool bRet = (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId) && 
+                (osvi.dwMajorVersion >= 6);
+
+    bRet = bRet &&
+        (osvi.dwMinorVersion >= 
+         sal::static_int_cast< unsigned int >(0));	
+    
+    return bRet;
 }
 
 //------------------------------------------------------------
-// determine if we are running under Win2000
+// determine if we are running under Windows 7
 //------------------------------------------------------------
 
-bool SAL_CALL IsWindows2000()
+bool SAL_CALL IsWindows7()
 {
-    return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 5, 0);	
+    return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 6, 1);	
 }
 
 //------------------------------------------------------------
-//
+// determine if we are running under Windows Vista
+//------------------------------------------------------------
+
+bool SAL_CALL IsWindowsVista()
+{
+    return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 6, 0);	
+}
+
+//------------------------------------------------------------
+// determine if we are running under Windows XP
 //------------------------------------------------------------
 
 bool SAL_CALL IsWindowsXP()
@@ -121,6 +144,15 @@ bool SAL_CALL IsWindowsXP()
 }
 
 //------------------------------------------------------------
+// determine if we are running under Windows 2000
+//------------------------------------------------------------
+
+bool SAL_CALL IsWindows2000()
+{
+    return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 5, 0);	
+}
+
+//------------------------------------------------------------
 //
 //------------------------------------------------------------
 
diff --git a/fpicker/source/win32/misc/WinImplHelper.hxx b/fpicker/source/win32/misc/WinImplHelper.hxx
index e8b66bd..494cbd6 100644
--- a/fpicker/source/win32/misc/WinImplHelper.hxx
+++ b/fpicker/source/win32/misc/WinImplHelper.hxx
@@ -53,6 +53,8 @@
 // deklarations
 //------------------------------------------------------------------------
 
+bool SAL_CALL IsWindowsVistaOrNewer();
+bool SAL_CALL IsWindows7();
 bool SAL_CALL IsWindowsVista();
 bool SAL_CALL IsWindows2000();
 bool SAL_CALL IsWindowsXP();
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index b5c1dd8..d6d9ff3 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -336,11 +336,21 @@ void ToolBarManager::Destroy()
             delete static_cast< AddonsParams* >( m_pToolBar->GetItemData( nItemId ));
     }
 
-    /* #i99167# removed change for i93173 since there is some weird crash
+    /* #i99167# removed change for i93173 since there is some weird crash */
         // #i93173# delete toolbar lazily as we can still be in one of its handlers
         m_pToolBar->doLazyDelete();
-    */
-    delete m_pToolBar;
+    
+    Link aEmpty;
+    m_pToolBar->SetSelectHdl( aEmpty );
+    m_pToolBar->SetActivateHdl( aEmpty );
+    m_pToolBar->SetDeactivateHdl( aEmpty );
+    m_pToolBar->SetClickHdl( aEmpty );
+    m_pToolBar->SetDropdownClickHdl( aEmpty );
+    m_pToolBar->SetDoubleClickHdl( aEmpty );
+    m_pToolBar->SetStateChangedHdl( aEmpty );
+    m_pToolBar->SetDataChangedHdl( aEmpty );
+
+//    delete m_pToolBar;
     m_pToolBar = 0;
 }
 
diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx
index cccf27a..84e6ebb 100644
--- a/sfx2/inc/sfx2/filedlghelper.hxx
+++ b/sfx2/inc/sfx2/filedlghelper.hxx
@@ -229,7 +229,15 @@ public:
     void                    SetTitle( const String&  rNewTitle );
     String                  GetPath() const;
 
+    /** @deprected: Don't use this method to retrieve the selected files 
+        There are file picker which can provide multiple selected file which belong
+        to different folders. As this method always provides the root folder for all selected
+        files this cannot work.
+    */
     ::com::sun::star::uno::Sequence< ::rtl::OUString > GetMPath() const;
+    
+    /** Provides the selected files with full path information */
+    ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSelectedFiles() const;
 
     void                     AddFilter( const String& rFilterName, const String& rExtension );
     void                     SetCurrentFilter( const String& rFilter );
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index c183698..ef6b5b3 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1358,6 +1358,7 @@ sal_Int16 FileDialogHelper_Impl::implDoExecute()
 //On MacOSX the native file picker has to run in the primordial thread because of drawing issues
 //On Linux the native gtk file picker, when backed by gnome-vfs2, needs to be run in the same
 //primordial thread as the ucb gnome-vfs2 provider was initialized in.
+/*
 #ifdef WNT
     if ( mbSystemPicker )
     {
@@ -1371,9 +1372,18 @@ sal_Int16 FileDialogHelper_Impl::implDoExecute()
     }
     else
 #endif
+*/
     {
         try
         {
+#ifdef WNT
+            if ( mbSystemPicker )
+            {
+                OReleaseSolarMutex aSolarMutex;
+                nRet = mxFileDlg->execute();
+            }
+            else
+#endif
             nRet = mxFileDlg->execute();
         }
         catch( const Exception& )
@@ -2582,6 +2592,46 @@ Sequence < OUString > FileDialogHelper::GetMPath() const
 }
 
 // ------------------------------------------------------------------------
+Sequence< ::rtl::OUString > FileDialogHelper::GetSelectedFiles() const
+{
+    // a) the new way (optional!)
+    uno::Sequence< ::rtl::OUString > aResultSeq;
+    uno::Reference< XFilePicker2 > xPickNew(mpImp->mxFileDlg, UNO_QUERY);
+    if (xPickNew.is())
+    {
+        aResultSeq = xPickNew->getSelectedFiles();
+    }
+    // b) the olde way ... non optional.
+    else
+    {
+        uno::Reference< XFilePicker > xPickOld(mpImp->mxFileDlg, UNO_QUERY_THROW);
+        Sequence< OUString > lFiles = xPickOld->getFiles();
+        ::sal_Int32          nFiles = lFiles.getLength();
+        if ( nFiles > 1 )
+        {
+            aResultSeq = Sequence< ::rtl::OUString >( nFiles-1 );
+            
+            INetURLObject aPath( lFiles[0] );
+            aPath.setFinalSlash();
+
+            for (::sal_Int32 i = 1; i < nFiles; i++)
+            {
+                if (i == 1)
+                    aPath.Append( lFiles[i] );
+                else
+                    aPath.setName( lFiles[i] );
+
+                aResultSeq[i-1] = ::rtl::OUString(aPath.GetMainURL( INetURLObject::NO_DECODE ));
+            }
+        }
+        else
+            aResultSeq = lFiles;
+    }
+    
+    return aResultSeq;
+}
+
+// ------------------------------------------------------------------------
 String FileDialogHelper::GetDisplayDirectory() const
 {
     return mpImp->getPath();
diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx
index ad6335d..5e2f377 100644
--- a/sfx2/source/doc/docinsert.cxx
+++ b/sfx2/source/doc/docinsert.cxx
@@ -177,33 +177,17 @@ void impl_FillURLList( sfx2::FileDialogHelper* _pFileDlg, SvStringsDtor*& _rpURL
 {
     DBG_ASSERT( _pFileDlg, "DocumentInserter::fillURLList(): invalid file dialog" );
     DBG_ASSERT( !_rpURLList, "DocumentInserter::fillURLList(): URLList already exists" );
-    Sequence < ::rtl::OUString > aPathSeq = _pFileDlg->GetMPath();
+    Sequence < ::rtl::OUString > aPathSeq = _pFileDlg->GetSelectedFiles();
 
     if ( aPathSeq.getLength() )
     {
         _rpURLList = new SvStringsDtor;
 
-        if ( aPathSeq.getLength() == 1 )
+        for ( USHORT i = 0; i < aPathSeq.getLength(); ++i )
         {
-            ::rtl::OUString sFileURL( aPathSeq[0] );
-            String* pURL = new String( sFileURL );
-            _rpURLList->Insert( pURL, 0 );
-        }
-        else
-        {
-            INetURLObject aPathObj( aPathSeq[0] );
-            aPathObj.setFinalSlash();
-
-            for ( USHORT i = 1; i < aPathSeq.getLength(); ++i )
-            {
-                if ( i == 1 )
-                    aPathObj.Append( aPathSeq[i] );
-                else
-                    aPathObj.setName( aPathSeq[i] );
-
-                String* pURL = new String( aPathObj.GetMainURL( INetURLObject::NO_DECODE ) );
-                _rpURLList->Insert( pURL, _rpURLList->Count() );
-            }
+            INetURLObject aPathObj( aPathSeq[i] );
+            String* pURL = new String( aPathObj.GetMainURL( INetURLObject::NO_DECODE ) );
+            _rpURLList->Insert( pURL, _rpURLList->Count() );
         }
     }
 }
commit 95f06f82c2d55e254a268e1e2409b2fda68dfddc
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Tue Jul 28 10:25:31 2009 +0000

    CWS-TOOLING: integrate CWS chart39
    2009-06-30 16:55:46 +0200 iha  r273522 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming
    2009-06-30 16:45:59 +0200 iha  r273521 : #i102701# apply patch for P1 issue on dev300m50 to be able to save again
    2009-06-30 16:32:32 +0200 iha  r273520 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming
    2009-06-29 10:04:34 +0200 iha  r273454 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area
    2009-06-26 19:31:16 +0200 iha  r273437 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area
    2009-06-25 10:36:28 +0200 iha  r273367 : #i101968# text values in data range cause incorrect x values
    2009-06-24 17:34:18 +0200 iha  r273357 : #i102428# x values are wrong in xy-scatter-chart with own data table if empty cells are contained in x values
    2009-06-24 10:16:25 +0200 iha  r273317 : #i99915# wrong matrix translation causes broken chart display for small values
    2009-06-19 17:20:06 +0200 iha  r273174 : #i78025# charts own borders are not completely visible
    2009-06-19 17:18:41 +0200 iha  r273172 : #i102950# don't paint additional borders for charts
    2009-06-11 16:27:54 +0200 iha  r272884 : CWS-TOOLING: rebase CWS chart39 to trunk at 272827 (milestone: DEV300:m50)
    2009-06-09 17:50:10 +0200 iha  r272790 : #i97222# when converting a chart via API to 3D categories get lost and for line,area&xy the stacking mode is wrong
    2009-06-09 16:00:27 +0200 iha  r272775 : #i98319# data point properties get lost while copying charts from calc to impress
    2009-06-09 10:26:51 +0200 iha  r272755 : #i98392# correct orienation of gradient fillings on 3D walls
    2009-05-29 10:35:16 +0200 iha  r272436 : #i100529# Plot missing values - leave gap fails for smoothed lines
    2009-05-04 18:20:31 +0200 iha  r271478 : #i99841# Title with Vertically stacked attribute is wrong after editing
    2009-05-04 18:03:01 +0200 iha  r271477 : #i101050# avoid a corner in closed lines, which are smoothed by spline
    2009-05-04 16:45:18 +0200 iha  r271472 : #i101050# avoid crash in case the normals sequence has less points than the polygon

diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
index 61d5cc7..e61c73c 100644
--- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
@@ -75,8 +75,8 @@ namespace sdr
             basegfx::B3DPolyPolygon aPolyPolygon3D(GetE3dPolygonObj().GetPolyPolygon3D());
             const basegfx::B3DPolyPolygon aPolyNormals3D(GetE3dPolygonObj().GetPolyNormals3D());
             const basegfx::B2DPolyPolygon aPolyTexture2D(GetE3dPolygonObj().GetPolyTexture2D());
-            const bool bNormals(aPolyNormals3D.count());
-            const bool bTexture(aPolyTexture2D.count());
+            const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count());
+            const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count());
 
             if(bNormals || bTexture)
             {
@@ -100,12 +100,19 @@ namespace sdr
                     {
                         if(bNormals)
                         {
-                            aCandidate3D.setNormal(b, aNormals3D.getB3DPoint(b));
+                            sal_uInt32 nNormalCount = aNormals3D.count();
+                            if( b < nNormalCount )
+                                aCandidate3D.setNormal(b, aNormals3D.getB3DPoint(b));
+                            else if( nNormalCount > 0 )
+                                aCandidate3D.setNormal(b, aNormals3D.getB3DPoint(0));
                         }
-                        
                         if(bTexture)
                         {
-                            aCandidate3D.setTextureCoordinate(b, aTexture2D.getB2DPoint(b));
+                            sal_uInt32 nTextureCount = aTexture2D.count();
+                            if( b < nTextureCount )
+                                aCandidate3D.setTextureCoordinate(b, aTexture2D.getB2DPoint(b));
+                            else if( nTextureCount > 0 )
+                                aCandidate3D.setTextureCoordinate(b, aTexture2D.getB2DPoint(0));
                         }
                     }
 
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index ed1c501..396a2ba 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -102,6 +102,7 @@ enum SchXMLAxisElemTokenMap
 
 enum SchXMLChartAttrMap
 {
+    XML_TOK_CHART_HREF,
     XML_TOK_CHART_CLASS,
     XML_TOK_CHART_WIDTH,
     XML_TOK_CHART_HEIGHT,
diff --git a/xmloff/inc/xmloff/SchXMLExportHelper.hxx b/xmloff/inc/xmloff/SchXMLExportHelper.hxx
index 284c6d9..37b7af0 100644
--- a/xmloff/inc/xmloff/SchXMLExportHelper.hxx
+++ b/xmloff/inc/xmloff/SchXMLExportHelper.hxx
@@ -233,13 +233,6 @@ public:
         const ::com::sun::star::uno::Reference<
             ::com::sun::star::chart2::XChartDocument > & xChartDoc );
 
-    // if no data provider exists by, now the model (as XChild) is asked for its
-    // parent which creates the data provider that is finally set at the chart
-    // document
-    static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider >
-        GetDataProvider( const ::com::sun::star::uno::Reference<
-                             ::com::sun::star::chart2::XChartDocument > & xChartDoc );
-
     ::com::sun::star::awt::Size getPageSize(
         const ::com::sun::star::uno::Reference<
             ::com::sun::star::chart2::XChartDocument > & xChartDoc ) const;
diff --git a/xmloff/inc/xmloff/SchXMLImportHelper.hxx b/xmloff/inc/xmloff/SchXMLImportHelper.hxx
index 7630c8e..e89c1d6 100644
--- a/xmloff/inc/xmloff/SchXMLImportHelper.hxx
+++ b/xmloff/inc/xmloff/SchXMLImportHelper.hxx
@@ -143,13 +143,6 @@ public:
     sal_Int32	GetLengthOfSeries();
     void		ResizeChartData( sal_Int32 nSeries, sal_Int32 nDataPoints = -1 );
 
-    // if no data provider exists by, now the model (as XChild) is asked for its
-    // parent which creates the data provider that is finally set at the chart
-    // document
-    static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider >
-        GetDataProvider( const ::com::sun::star::uno::Reference<
-                             ::com::sun::star::chart2::XChartDocument > & xChartDoc );
-
     /** @param bPushLastChartType If </FALSE>, in case a new chart type has to
                be added (because it does not exist yet), it is appended at the
                end of the chart-type container.  When </TRUE>, a new chart type
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index 281f591..f44f23a 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -228,6 +228,57 @@ void lcl_removeEmptyChartTypeGroups( const uno::Reference< chart2::XChartDocumen
     }
 }
 
+uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const ::rtl::OUString& rStr, bool bAddOneToEachOldIndex )
+{
+    const sal_Unicode aSpace( ' ' );
+
+    // count number of entries
+    ::std::vector< sal_Int32 > aVec;
+    sal_Int32 nLastPos = 0;
+    sal_Int32 nPos = 0;
+    while( nPos != -1 )
+    {
+        nPos = rStr.indexOf( aSpace, nLastPos );
+        if( nPos > nLastPos )
+        {
+            aVec.push_back( rStr.copy( nLastPos, (nPos - nLastPos) ).toInt32() );
+        }
+        if( nPos != -1 )
+            nLastPos = nPos + 1;
+    }
+    // last entry
+    if( nLastPos != 0 &&
+        rStr.getLength() > nLastPos )
+    {
+        aVec.push_back( rStr.copy( nLastPos, (rStr.getLength() - nLastPos) ).toInt32() );
+    }
+
+    const sal_Int32 nVecSize = aVec.size();
+    uno::Sequence< sal_Int32 > aSeq( nVecSize );
+
+    if(!bAddOneToEachOldIndex)
+    {
+        sal_Int32* pSeqArr = aSeq.getArray();
+        for( nPos = 0; nPos < nVecSize; ++nPos )
+        {
+            pSeqArr[ nPos ] = aVec[ nPos ];
+        }
+    }
+    else if( bAddOneToEachOldIndex )
+    {
+        aSeq.realloc( nVecSize+1 );
+        aSeq[0]=0;
+
+        sal_Int32* pSeqArr = aSeq.getArray();
+        for( nPos = 0; nPos < nVecSize; ++nPos )
+        {
+            pSeqArr[ nPos+1 ] = aVec[ nPos ]+1;
+        }
+    }
+
+    return aSeq;
+}
+
 } // anonymous namespace
 
 static __FAR_DATA SvXMLEnumMapEntry aXMLLegendAlignmentMap[] =
@@ -249,7 +300,8 @@ SchXMLChartContext::SchXMLChartContext( SchXMLImportHelper& rImpHelper,
                                         SvXMLImport& rImport, const rtl::OUString& rLocalName ) :
         SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
         mrImportHelper( rImpHelper ),
-        mbHasOwnTable( sal_True ),
+        m_bHasRangeAtPlotArea( false ),
+        m_bHasTableElement( false ),
         mbAllRangeAddressesAvailable( sal_True ),
         mbColHasLabels( sal_False ),
         mbRowHasLabels( sal_False ),
@@ -283,6 +335,10 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut
 
         switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
         {
+            case XML_TOK_CHART_HREF:
+                m_aXLinkHRefAttributeToIndicateDataProvider = aValue;
+                break;
+
             case XML_TOK_CHART_CLASS:
                 {
                     rtl::OUString sClassName;
@@ -606,14 +662,21 @@ bool lcl_SpecialHandlingForDonutChartNeeded(
 
 } // anonymous namespace
 
-void SchXMLChartContext::ChangeDiagramAccordingToTemplate(
-        const uno::Reference< chart2::XChartDocument >& xNewDoc )
+
+void lcl_ApplyDataFromRectangularRangeToDiagram(
+        const uno::Reference< chart2::XChartDocument >& xNewDoc
+        , const rtl::OUString& rRectangularRange
+        , ::com::sun::star::chart::ChartDataRowSource eDataRowSource
+        , bool bRowHasLabels, bool bColHasLabels
+        , bool bSwitchOnLabelsAndCategoriesForOwnData
+        , const rtl::OUString& sColTrans
+        , const rtl::OUString& sRowTrans )
 {
     if( !xNewDoc.is() )
         return;
 
     uno::Reference< chart2::XDiagram > xNewDia( xNewDoc->getFirstDiagram());
-    uno::Reference< chart2::data::XDataProvider > xDataProvider( mrImportHelper.GetDataProvider( xNewDoc ) );        
+    uno::Reference< chart2::data::XDataProvider > xDataProvider( xNewDoc->getDataProvider() );
     if( !xNewDia.is() || !xDataProvider.is() )
         return;
 
@@ -622,11 +685,11 @@ void SchXMLChartContext::ChangeDiagramAccordingToTemplate(
         return;
 
     sal_Bool bFirstCellAsLabel =
-        (meDataRowSource==chart::ChartDataRowSource_COLUMNS)? mbRowHasLabels : mbColHasLabels;
+        (eDataRowSource==chart::ChartDataRowSource_COLUMNS)? bRowHasLabels : bColHasLabels;
     sal_Bool bHasCateories =
-        (meDataRowSource==chart::ChartDataRowSource_COLUMNS)? mbColHasLabels : mbRowHasLabels;
+        (eDataRowSource==chart::ChartDataRowSource_COLUMNS)? bColHasLabels : bRowHasLabels;
 
-    if( mbHasOwnTable )
+    if( bSwitchOnLabelsAndCategoriesForOwnData )
     {
         bFirstCellAsLabel = true;
         bHasCateories = true;
@@ -635,25 +698,25 @@ void SchXMLChartContext::ChangeDiagramAccordingToTemplate(
     uno::Sequence< beans::PropertyValue > aArgs( 3 );
     aArgs[0] = beans::PropertyValue(
         ::rtl::OUString::createFromAscii("CellRangeRepresentation"),
-        -1, uno::makeAny( msChartAddress ),
+        -1, uno::makeAny( rRectangularRange ),
         beans::PropertyState_DIRECT_VALUE );
     aArgs[1] = beans::PropertyValue(
         ::rtl::OUString::createFromAscii("DataRowSource"),
-        -1, uno::makeAny( meDataRowSource ),
+        -1, uno::makeAny( eDataRowSource ),
         beans::PropertyState_DIRECT_VALUE );
     aArgs[2] = beans::PropertyValue(
         ::rtl::OUString::createFromAscii("FirstCellAsLabel"),
         -1, uno::makeAny( bFirstCellAsLabel ),
         beans::PropertyState_DIRECT_VALUE );
 
-    if( msColTrans.getLength() || msRowTrans.getLength() )
+    if( sColTrans.getLength() || sRowTrans.getLength() )
     {
         aArgs.realloc( aArgs.getLength() + 1 );
         aArgs[ aArgs.getLength() - 1 ] = beans::PropertyValue(
             ::rtl::OUString::createFromAscii("SequenceMapping"),
-            -1, uno::makeAny( msColTrans.getLength()
-                ? GetNumberSequenceFromString( msColTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() )
-                : GetNumberSequenceFromString( msRowTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() ) ),
+            -1, uno::makeAny( sColTrans.getLength()
+                ? lcl_getNumberSequenceFromString( sColTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() )
+                : lcl_getNumberSequenceFromString( sRowTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() ) ),
         beans::PropertyState_DIRECT_VALUE );
     }
 
@@ -766,21 +829,36 @@ void SchXMLChartContext::EndElement()
     if(!xNewDoc.is())
         return;
 
-    // if we already have an internal data provider, we know that we cannot have
-    // external data here.  If we can have external data but know that we have
-    // internal data due to missing ranges, we must create an internal data
-    // provider
+    bool bHasOwnData = false;
+    if( m_aXLinkHRefAttributeToIndicateDataProvider.equalsAscii( "." ) ) //data comes from the chart itself
+        bHasOwnData = true;
+    else if( m_aXLinkHRefAttributeToIndicateDataProvider.equalsAscii( ".." ) ) //data comes from the parent application
+        bHasOwnData = false;
+    else if( m_aXLinkHRefAttributeToIndicateDataProvider.getLength() ) //not supported so far to get the data by sibling objects -> fall back to chart itself if data are available
+        bHasOwnData = m_bHasTableElement;
+    else
+        bHasOwnData = !m_bHasRangeAtPlotArea;
+
     if( xNewDoc->hasInternalDataProvider())
-        mbHasOwnTable = true;
-    else if( mbHasOwnTable )
+    {
+        if( !m_bHasTableElement && !m_aXLinkHRefAttributeToIndicateDataProvider.equalsAscii( "." ) )
+        {
+            //#i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area
+            bool bSwitchSuccessful = SchXMLTools::switchBackToDataProviderFromParent( xNewDoc, maLSequencesPerIndex );
+            bHasOwnData = !bSwitchSuccessful;
+        }
+        else
+            bHasOwnData = true;//e.g. in case of copy->paste from calc to impress
+    }
+    else if( bHasOwnData )
     {
         xNewDoc->createInternalDataProvider( sal_False /* bCloneExistingData */ );
     }
-    if( mbHasOwnTable )
+    if( bHasOwnData )
         msChartAddress = ::rtl::OUString::createFromAscii("all");
 
-    bool bPostProcessTable = false;
-    if( !mbHasOwnTable && mbAllRangeAddressesAvailable )
+    bool bSwitchRangesFromOuterToInternalIfNecessary = false;
+    if( !bHasOwnData && mbAllRangeAddressesAvailable )
     {
         // special handling for stock chart (merge series together)
         if( mbIsStockChart )
@@ -788,24 +866,28 @@ void SchXMLChartContext::EndElement()
     }
     else if( msChartAddress.getLength() )
     {
-        // in this case there are range addresses that are simply wrong.
+        //own data or only rectangular range available
+
         bool bOlderThan2_3 = SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( Reference< frame::XModel >( xNewDoc, uno::UNO_QUERY ));
-        bool bOldFileWithOwnDataFromRows = (bOlderThan2_3 && mbHasOwnTable && (meDataRowSource==chart::ChartDataRowSource_ROWS));
+        bool bOldFileWithOwnDataFromRows = (bOlderThan2_3 && bHasOwnData && (meDataRowSource==chart::ChartDataRowSource_ROWS)); // in this case there are range addresses that are simply wrong.
+
         if( mbAllRangeAddressesAvailable && !bSpecialHandlingForDonutChart && !mbIsStockChart &&
             !bOldFileWithOwnDataFromRows )
         {
-            // note: mbRowHasLabels means the first row contains labels, that
-            // means we have "column-descriptions", (analogously mbColHasLabels
-            // means we have "row-descriptions")
-            SchXMLTableHelper::applyTable( maTable, xNewDoc );
-            bPostProcessTable = true;
+            //bHasOwnData is true in this case!
+            //e.g. for normal files with own data or also in case of copy paste scenario (e.g. calc to impress)
+            if( xNewDoc->hasInternalDataProvider() )
+                SchXMLTableHelper::applyTableToInternalDataProvider( maTable, xNewDoc );
+            bSwitchRangesFromOuterToInternalIfNecessary = true;
         }
         else
         {
+            //apply data from rectangular range
+
             // apply data read from the table sub-element to the chart
             // if the data provider supports the XChartDataArray interface like
             // the internal data provider
-            uno::Reference< chart::XChartDataArray > xChartData( mrImportHelper.GetDataProvider( xNewDoc ), uno::UNO_QUERY );
+            uno::Reference< chart::XChartDataArray > xChartData( xNewDoc->getDataProvider(), uno::UNO_QUERY );
             if( xChartData.is())
                 SchXMLTableHelper::applyTableSimple( maTable, xChartData );
 
@@ -815,29 +897,32 @@ void SchXMLChartContext::EndElement()
             {
                 if( bOlderThan2_3 && xDiaProp.is() )//for older charts the hidden cells were removed by calc on the fly
                     xDiaProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IncludeHiddenCells")),uno::makeAny(false));
-                ChangeDiagramAccordingToTemplate( xNewDoc );
+
+                // note: mbRowHasLabels means the first row contains labels, that means we have "column-descriptions",
+                // (analogously mbColHasLabels means we have "row-descriptions")
+                lcl_ApplyDataFromRectangularRangeToDiagram( xNewDoc, msChartAddress, meDataRowSource, mbRowHasLabels, mbColHasLabels, bHasOwnData, msColTrans, msRowTrans );
             }
             catch( uno::Exception & )
             {
                 //try to fallback to internal data
-                DBG_ERROR( "Exception during import SchXMLChartContext::ChangeDiagramAccordingToTemplate try to fallback to internal data" );
-                if(!mbHasOwnTable)
+                DBG_ERROR( "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram try to fallback to internal data" );
+                if(!bHasOwnData)
                 {
-                    mbHasOwnTable = true;
+                    bHasOwnData = true;
                     msChartAddress = ::rtl::OUString::createFromAscii("all");
                     if( !xNewDoc->hasInternalDataProvider() )
                     {
                         xNewDoc->createInternalDataProvider( sal_False /* bCloneExistingData */ );
-                        xChartData = uno::Reference< chart::XChartDataArray >( mrImportHelper.GetDataProvider( xNewDoc ), uno::UNO_QUERY );
+                        xChartData = uno::Reference< chart::XChartDataArray >( xNewDoc->getDataProvider(), uno::UNO_QUERY );
                         if( xChartData.is())
                             SchXMLTableHelper::applyTableSimple( maTable, xChartData );
                         try
                         {
-                            ChangeDiagramAccordingToTemplate( xNewDoc );
+                            lcl_ApplyDataFromRectangularRangeToDiagram( xNewDoc, msChartAddress, meDataRowSource, mbRowHasLabels, mbColHasLabels, bHasOwnData, msColTrans, msRowTrans );
                         }
                         catch( uno::Exception & )
                         {
-                            DBG_ERROR( "Exception during import SchXMLChartContext::ChangeDiagramAccordingToTemplate fallback to internal data failed also" );
+                            DBG_ERROR( "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram fallback to internal data failed also" );
                         }
                     }
                 }
@@ -893,16 +978,23 @@ void SchXMLChartContext::EndElement()
                 SchXMLSeries2Context::setStylesToStatisticsObjects( maSeriesDefaultsAndStyles
                             , pStylesCtxt, pStyle, sCurrStyleName );
             }
+        }
 
+        //#i98319# call switchRangesFromOuterToInternalIfNecessary before the data point styles are applied, otherwise in copy->paste scenario the data point styles do get lost
+        if( bSwitchRangesFromOuterToInternalIfNecessary )
+        {
+            if( xNewDoc->hasInternalDataProvider() )
+                SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( maTable, maLSequencesPerIndex, xNewDoc, meDataRowSource );
+        }
+
+        if( pStylesCtxt )
+        {
             // ... then iterate over data-point attributes, so the latter are not overwritten
             SchXMLSeries2Context::setStylesToDataPoints( maSeriesDefaultsAndStyles
                             , pStylesCtxt, pStyle, sCurrStyleName, mrImportHelper, GetImport(), mbIsStockChart, bSpecialHandlingForDonutChart, bSwitchOffLinesForScatter );
         }
     }
 
-    if( bPostProcessTable )
-        SchXMLTableHelper::postProcessTable( maTable, maLSequencesPerIndex, xNewDoc, meDataRowSource );
-
     if( xProp.is())
         xProp->setPropertyValue( rtl::OUString::createFromAscii( "RefreshAddInAllowed" ) , uno::makeAny( sal_True) );
 }
@@ -1003,8 +1095,9 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext(
     {
         case XML_TOK_CHART_PLOT_AREA:
             pContext = new SchXMLPlotAreaContext( mrImportHelper, GetImport(), rLocalName,
+                                                  m_aXLinkHRefAttributeToIndicateDataProvider,
                                                   maSeriesAddresses, msCategoriesAddress,
-                                                  msChartAddress, mbHasOwnTable, mbAllRangeAddressesAvailable,
+                                                  msChartAddress, m_bHasRangeAtPlotArea, mbAllRangeAddressesAvailable,
                                                   mbColHasLabels, mbRowHasLabels,
                                                   meDataRowSource,
                                                   maSeriesDefaultsAndStyles,
@@ -1046,6 +1139,7 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext(
             {
                 SchXMLTableContext * pTableContext =
                     new SchXMLTableContext( mrImportHelper, GetImport(), rLocalName, maTable );
+                m_bHasTableElement = true;
                 // #i85913# take into account column- and row- mapping for
                 // charts with own data only for those which were not copied
                 // from a place where they got data from the container.  Note,
@@ -1060,12 +1154,12 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext(
                     if( msColTrans.getLength() > 0 )
                     {
                         OSL_ASSERT( msRowTrans.getLength() == 0 );
-                        pTableContext->setColumnPermutation( GetNumberSequenceFromString( msColTrans, true ));
+                        pTableContext->setColumnPermutation( lcl_getNumberSequenceFromString( msColTrans, true ));
                         msColTrans = OUString();
                     }
                     else if( msRowTrans.getLength() > 0 )
                     {
-                        pTableContext->setRowPermutation( GetNumberSequenceFromString( msRowTrans, true ));
+                        pTableContext->setRowPermutation( lcl_getNumberSequenceFromString( msRowTrans, true ));
                         msRowTrans = OUString();
                     }
                 }
@@ -1143,57 +1237,6 @@ void SchXMLChartContext::InitChart(
     }
 }
 
-uno::Sequence< sal_Int32 > SchXMLChartContext::GetNumberSequenceFromString( const ::rtl::OUString& rStr, bool bAddOneToEachOldIndex )
-{
-    const sal_Unicode aSpace( ' ' );
-
-    // count number of entries
-    ::std::vector< sal_Int32 > aVec;
-    sal_Int32 nLastPos = 0;
-    sal_Int32 nPos = 0;
-    while( nPos != -1 )
-    {
-        nPos = rStr.indexOf( aSpace, nLastPos );
-        if( nPos > nLastPos )
-        {
-            aVec.push_back( rStr.copy( nLastPos, (nPos - nLastPos) ).toInt32() );
-        }
-        if( nPos != -1 )
-            nLastPos = nPos + 1;
-    }
-    // last entry
-    if( nLastPos != 0 &&
-        rStr.getLength() > nLastPos )
-    {
-        aVec.push_back( rStr.copy( nLastPos, (rStr.getLength() - nLastPos) ).toInt32() );
-    }
-
-    const sal_Int32 nVecSize = aVec.size();
-    uno::Sequence< sal_Int32 > aSeq( nVecSize );
-
-    if(!bAddOneToEachOldIndex)
-    {
-        sal_Int32* pSeqArr = aSeq.getArray();
-        for( nPos = 0; nPos < nVecSize; ++nPos )
-        {
-            pSeqArr[ nPos ] = aVec[ nPos ];
-        }
-    }
-    else if( bAddOneToEachOldIndex )
-    {
-        aSeq.realloc( nVecSize+1 );
-        aSeq[0]=0;
-
-        sal_Int32* pSeqArr = aSeq.getArray();
-        for( nPos = 0; nPos < nVecSize; ++nPos )
-        {
-            pSeqArr[ nPos+1 ] = aVec[ nPos ]+1;
-        }
-    }
-
-    return aSeq;
-}
-
 // ----------------------------------------
 
 SchXMLTitleContext::SchXMLTitleContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport,
diff --git a/xmloff/source/chart/SchXMLChartContext.hxx b/xmloff/source/chart/SchXMLChartContext.hxx
index 573cac8..bfb823f 100644
--- a/xmloff/source/chart/SchXMLChartContext.hxx
+++ b/xmloff/source/chart/SchXMLChartContext.hxx
@@ -114,7 +114,9 @@ private:
 
     ::rtl::OUString maMainTitle, maSubTitle;
     com::sun::star::awt::Point maMainTitlePos, maSubTitlePos, maLegendPos;
-    sal_Bool mbHasOwnTable;
+    ::rtl::OUString m_aXLinkHRefAttributeToIndicateDataProvider;
+    bool m_bHasRangeAtPlotArea;
+    bool m_bHasTableElement;
     sal_Bool mbAllRangeAddressesAvailable;
     sal_Bool mbColHasLabels;
     sal_Bool mbRowHasLabels;
@@ -147,9 +149,6 @@ private:
                         const ::rtl::OUString & rChartTypeServiceName,
                         sal_Bool bSetSwitchData);
 
-    void ChangeDiagramAccordingToTemplate(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xNewDoc );
-    ::com::sun::star::uno::Sequence< sal_Int32 > GetNumberSequenceFromString( const ::rtl::OUString& rStr, bool bAddOneToEachOldIndex );
     void MergeSeriesForStockChart();
 };
 
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index b4d5f9c..25bcf43 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -353,8 +353,10 @@ bool lcl_isSeriesAttachedToFirstAxis(
 OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const Reference< chart2::XChartDocument > & xDoc )
 {
     OUString aResult = rRange;
+    if( !xDoc.is() )
+        return aResult;
     Reference< chart2::data::XRangeXMLConversion > xConversion(
-        SchXMLExportHelper::GetDataProvider( xDoc ), uno::UNO_QUERY );
+        xDoc->getDataProvider(), uno::UNO_QUERY );
     if( xConversion.is())
         aResult = xConversion->convertRangeToXML( rRange );
     return aResult;
@@ -1114,6 +1116,16 @@ void SchXMLExportHelper::parseDocument( Reference< chart::XChartDocument >& rCha
 
     if( bExportContent )
     {
+        //export data provider in xlink:href attribute
+        const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+        if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 )
+        {
+            OUString aDataProviderURL( RTL_CONSTASCII_USTRINGPARAM( ".." ) );
+            if( xNewDoc->hasInternalDataProvider() )
+                aDataProviderURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) );
+            mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aDataProviderURL );
+        }
+
         OUString sChartType( xDiagram->getDiagramType() );
 
         // attributes
@@ -3521,7 +3533,7 @@ void SchXMLExport::_ExportContent()
             // check if we have own data.  If so we must not export the complete
             // range string, as this is our only indicator for having own or
             // external data. @todo: fix this in the file format!
-            Reference< lang::XServiceInfo > xDPServiceInfo( maExportHelper.GetDataProvider( xNewDoc ), uno::UNO_QUERY );
+            Reference< lang::XServiceInfo > xDPServiceInfo( xNewDoc->getDataProvider(), uno::UNO_QUERY );
             if( ! (xDPServiceInfo.is() &&
                    xDPServiceInfo->getImplementationName().equalsAsciiL(
                        RTL_CONSTASCII_STRINGPARAM( "com.sun.star.comp.chart.InternalDataProvider" ))))
@@ -3581,45 +3593,12 @@ void SchXMLExport::SetProgress( sal_Int32 nPercentage )
         mxStatusIndicator->setValue( nPercentage );
 }
 
-// static
-Reference< chart2::data::XDataProvider > SchXMLExportHelper::GetDataProvider(
-    const Reference< chart2::XChartDocument > & xDoc )
-{
-    Reference< chart2::data::XDataProvider > xResult;
-    if( xDoc.is())
-    {
-        xResult.set( xDoc->getDataProvider());
-        // allowed to attach a new data provider in export?
-//         if( ! xResult.is())
-//         {
-//             Reference< container::XChild > xChild( xDoc, uno::UNO_QUERY );
-//             if( xChild.is())
-//             {
-//                 Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY );
-//                 if( xFact.is())
-//                 {
-//                     xResult.set(
-//                         xFact->createInstance( OUString::createFromAscii("com.sun.star.chart2.data.DataProvider")),
-//                         uno::UNO_QUERY );
-//                     if( xResult.is())
-//                     {
-//                         Reference< chart2::data::XDataReceiver > xReceiver( xDoc, uno::UNO_QUERY );
-//                         if( xReceiver.is())
-//                             xReceiver->attachDataProvider( xResult );
-//                     }
-//                 }
-//             }
-//         }
-    }
-    return xResult;
-}
-
 void SchXMLExportHelper::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc )
 {
     if( xChartDoc.is())
         try
         {
-            Reference< chart2::data::XDataProvider > xDataProvider( GetDataProvider( xChartDoc ));
+            Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
             OSL_ENSURE( xDataProvider.is(), "No DataProvider" );
             if( xDataProvider.is())
             {
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index 1576bd2..7dde79f 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -346,6 +346,7 @@ const SvXMLTokenMap& SchXMLImportHelper::GetChartAttrTokenMap()
     {
         static __FAR_DATA SvXMLTokenMapEntry aChartAttrTokenMap[] =
 {
+    { XML_NAMESPACE_XLINK,  XML_HREF,                   XML_TOK_CHART_HREF          },
     { XML_NAMESPACE_CHART,	XML_CLASS,					XML_TOK_CHART_CLASS			},
     { XML_NAMESPACE_SVG,	XML_WIDTH,					XML_TOK_CHART_WIDTH			},
     { XML_NAMESPACE_SVG,	XML_HEIGHT,				    XML_TOK_CHART_HEIGHT		},
@@ -614,38 +615,6 @@ void SchXMLImportHelper::ResizeChartData( sal_Int32 nSeries, sal_Int32 nDataPoin
     }
 }
 
-// static
-Reference< chart2::data::XDataProvider > SchXMLImportHelper::GetDataProvider(
-    const Reference< chart2::XChartDocument > & xDoc )
-{
-    Reference< chart2::data::XDataProvider > xResult;
-    if( xDoc.is())
-    {
-        try
-        {
-            xResult.set( xDoc->getDataProvider());
-//             if( ! xResult.is())
-//             {
-//                 Reference< container::XChild > xChild( xDoc, uno::UNO_QUERY_THROW );
-//                 Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY );
-//                 if( xFact.is())
-//                 {
-//                     Reference< chart2::data::XDataReceiver > xReceiver( xDoc, uno::UNO_QUERY_THROW );
-//                     xResult.set(
-//                         xFact->createInstance( OUString::createFromAscii("com.sun.star.chart2.data.DataProvider")),
-//                         uno::UNO_QUERY_THROW );
-//                     xReceiver->attachDataProvider( xResult );
-//                 }
-//             }
-        }
-        catch( const uno::Exception & )
-        {
-            // didn't get a data provider from  the container
-        }
-    }
-    return xResult;
-}
-
 //static
 void SchXMLImportHelper::DeleteDataSeries(
                     const Reference< chart2::XDataSeries > & xSeries,
@@ -796,6 +765,8 @@ SchXMLImport::SchXMLImport(
     sal_uInt16 nImportFlags ) :
         SvXMLImport( xServiceFactory, nImportFlags )
 {
+    GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+
     mbIsGraphicLoadOnDemandSupported = false;
 }
 
@@ -807,6 +778,8 @@ SchXMLImport::SchXMLImport(
     sal_Bool /*bLoadDoc*/, sal_Bool bShowProgress )
 :	SvXMLImport( xServiceFactory, xModel, rGrfContainer )
 {
+    GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+
     // get status indicator (if requested)
     if( bShowProgress )
     {
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 81affca..3d8a849 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -108,8 +108,10 @@ struct lcl_AxisHasCategories : public ::std::unary_function< SchXMLAxis, bool >
 OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const uno::Reference< chart2::XChartDocument > & xDoc )
 {
     OUString aResult = rRange;
+    if(!xDoc.is())
+        return aResult;
     uno::Reference< chart2::data::XRangeXMLConversion > xConversion(
-        SchXMLImportHelper::GetDataProvider( xDoc ), uno::UNO_QUERY );
+        xDoc->getDataProvider(), uno::UNO_QUERY );
     if( xConversion.is())
         aResult = xConversion->convertRangeFromXML( rRange );
     return aResult;
@@ -177,10 +179,11 @@ SchXML3DSceneAttributesHelper::~SchXML3DSceneAttributesHelper()
 SchXMLPlotAreaContext::SchXMLPlotAreaContext(
     SchXMLImportHelper& rImpHelper,
     SvXMLImport& rImport, const rtl::OUString& rLocalName,
+    const rtl::OUString& rXLinkHRefAttributeToIndicateDataProvider,
     uno::Sequence< chart::ChartSeriesAddress >& rSeriesAddresses,
     ::rtl::OUString& rCategoriesAddress,
     ::rtl::OUString& rChartAddress,
-    sal_Bool & rHasOwnTable,
+    bool& rbHasRangeAtPlotArea,
     sal_Bool & rAllRangeAddressesAvailable,
     sal_Bool & rColHasLabels,
     sal_Bool & rRowHasLabels,
@@ -203,8 +206,9 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext(
         mbHasPosition(false),
         mbPercentStacked(false),
         m_bAxisPositionAttributeImported(false),
+        m_rXLinkHRefAttributeToIndicateDataProvider(rXLinkHRefAttributeToIndicateDataProvider),
         mrChartAddress( rChartAddress ),
-        mrHasOwnTable( rHasOwnTable ),
+        m_rbHasRangeAtPlotArea( rbHasRangeAtPlotArea ),
         mrColHasLabels( rColHasLabels ),
         mrRowHasLabels( rRowHasLabels ),
         mrDataRowSource( rDataRowSource ),
@@ -213,6 +217,8 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext(
         mbGlobalChartTypeUsedBySeries( false ),
         maChartSize( rChartSize )
 {
+    m_rbHasRangeAtPlotArea = false;
+
     // get Diagram
     uno::Reference< chart::XChartDocument > xDoc( rImpHelper.GetChartDocument(), uno::UNO_QUERY );
     if( xDoc.is())
@@ -338,7 +344,7 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri
             case XML_TOK_PA_CHART_ADDRESS:
                 mrChartAddress = lcl_ConvertRange( aValue, xNewDoc );
                 // indicator for getting data from the outside
-                mrHasOwnTable = sal_False;
+                m_rbHasRangeAtPlotArea = true;
                 break;
             case XML_TOK_PA_DS_HAS_LABELS:
                 {
@@ -514,7 +520,17 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri
     }
     //
 
-    if( mrHasOwnTable && mxNewDoc.is())
+    bool bCreateInternalDataProvider = false;
+    if( m_rXLinkHRefAttributeToIndicateDataProvider.equalsAscii( "." ) ) //data comes from the chart itself
+        bCreateInternalDataProvider = true;
+    else if( m_rXLinkHRefAttributeToIndicateDataProvider.equalsAscii( ".." ) ) //data comes from the parent application
+        bCreateInternalDataProvider = false;
+    else if( m_rXLinkHRefAttributeToIndicateDataProvider.getLength() ) //not supported so far to get the data by sibling objects -> fall back to chart itself
+        bCreateInternalDataProvider = true;
+    else if( !m_rbHasRangeAtPlotArea )
+        bCreateInternalDataProvider = true;
+        
+    if( bCreateInternalDataProvider && mxNewDoc.is() )
     {
         // we have no complete range => we have own data, so switch the data
         // provider to internal. Clone is not necessary, as we don't have any
@@ -625,7 +641,7 @@ void SchXMLPlotAreaContext::EndElement()
     if( mrCategoriesAddress.getLength() && mxNewDoc.is())
     {
         uno::Reference< chart2::data::XDataProvider > xDataProvider(
-            mrImportHelper.GetDataProvider( mxNewDoc ));
+            mxNewDoc->getDataProvider()  );
         // @todo: correct coordinate system index
         sal_Int32 nDimension( 0 );
         ::std::vector< SchXMLAxis >::const_iterator aIt(
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
index 0a4a1ba..9ec09f3 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
@@ -74,11 +74,12 @@ class SchXMLPlotAreaContext : public SvXMLImportContext
 public:
     SchXMLPlotAreaContext( SchXMLImportHelper& rImpHelper,
                            SvXMLImport& rImport, const rtl::OUString& rLocalName,
+                           const rtl::OUString& rXLinkHRefAttributeToIndicateDataProvider,
                            ::com::sun::star::uno::Sequence<
                                ::com::sun::star::chart::ChartSeriesAddress >& rSeriesAddresses,
                            ::rtl::OUString& rCategoriesAddress,
                            ::rtl::OUString& rChartAddress,
-                           sal_Bool & rHasOwnTable,
+                           bool& bHasRangeAtPlotArea,
                            sal_Bool & rAllRangeAddressesAvailable,
                            sal_Bool & rColHasLabels,
                            sal_Bool & rRowHasLabels,
@@ -119,8 +120,9 @@ private:
     bool mbPercentStacked;
     bool m_bAxisPositionAttributeImported;
     ::rtl::OUString msAutoStyleName;
+    const ::rtl::OUString& m_rXLinkHRefAttributeToIndicateDataProvider;
     ::rtl::OUString& mrChartAddress;
-    sal_Bool & mrHasOwnTable;
+    bool& m_rbHasRangeAtPlotArea;
     sal_Bool & mrColHasLabels;
     sal_Bool & mrRowHasLabels;
     ::com::sun::star::chart::ChartDataRowSource & mrDataRowSource;
diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx
index d37e920..2702ec9 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.cxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.cxx
@@ -341,7 +341,7 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib
 
     Reference< chart2::data::XRangeXMLConversion > xRangeConversion;
     if( mxNewDoc.is())
-        xRangeConversion.set( mrImportHelper.GetDataProvider( mxNewDoc ), uno::UNO_QUERY );
+        xRangeConversion.set( mxNewDoc->getDataProvider(), uno::UNO_QUERY );
 
     for( sal_Int16 i = 0; i < nAttrCount; i++ )
     {
@@ -409,7 +409,7 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib
             if( m_rGlobalSeriesImportInfo.rbAllRangeAddressesAvailable && ! bHasRange )
                 m_rGlobalSeriesImportInfo.rbAllRangeAddressesAvailable = sal_False;
 
-            Reference< chart2::data::XDataProvider > xDataProvider( mrImportHelper.GetDataProvider( mxNewDoc ));
+            Reference< chart2::data::XDataProvider > xDataProvider( mxNewDoc->getDataProvider() );
             if( xDataProvider.is())
             {
                 bool bIsCandleStick = maGlobalChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.CandleStickChartType"));
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index cacdc13..8681ece 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -343,37 +343,6 @@ void lcl_fillRangeMapping(
     }
 }
 
-void lcl_copyProperties(
-    const Reference< beans::XPropertySet > & xSource,
-    const Reference< beans::XPropertySet > & xDestination )
-{
-    if( ! (xSource.is() && xDestination.is()))
-        return;
-
-    try
-    {
-        Reference< beans::XPropertySetInfo > xSrcInfo( xSource->getPropertySetInfo(), uno::UNO_QUERY_THROW );
-        Reference< beans::XPropertySetInfo > xDestInfo( xDestination->getPropertySetInfo(), uno::UNO_QUERY_THROW );
-        Sequence< beans::Property > aProperties( xSrcInfo->getProperties());
-        const sal_Int32 nLength = aProperties.getLength();
-        for( sal_Int32 i = 0; i < nLength; ++i )
-        {
-            OUString aName( aProperties[i].Name);
-            if( xDestInfo->hasPropertyByName( aName ))
-            {
-                beans::Property aProp( xDestInfo->getPropertyByName( aName ));
-                if( (aProp.Attributes & beans::PropertyAttribute::READONLY) == 0 )
-                    xDestination->setPropertyValue(
-                        aName, xSource->getPropertyValue( aName ));
-            }
-        }
-    }
-    catch( const uno::Exception & )
-    {
-        OSL_ENSURE( false, "Copying property sets failed!" );
-    }
-}
-
 Reference< chart2::data::XDataSequence >
     lcl_reassignDataSequence(
         const Reference< chart2::data::XDataSequence > & xSequence,
@@ -1016,7 +985,7 @@ void SchXMLTableHelper::applyTableSimple(
 
 // ----------------------------------------
 
-void SchXMLTableHelper::applyTable(
+void SchXMLTableHelper::applyTableToInternalDataProvider(
     const SchXMLTable& rTable,
     uno::Reference< chart2::XChartDocument > xChartDoc )
 {
@@ -1031,19 +1000,12 @@ void SchXMLTableHelper::applyTable(
     // prerequisite for this method: all objects (data series, domains, etc.)
     // need their own range string.
 
-    // If the range-strings are valid (starting with "local-table") they should
-    // be interpreted like given, otherwise (when the ranges refer to Calc- or
-    // Writer-ranges, but the container is not available like when pasting a
-    // chart from Calc to Impress) the range is ignored, and every object gets
-    // one table column in the order of appearance, which is: 1. categories,
-    // 2. data series: 2.a) domains, 2.b) values (main-role, usually y-values)
-
     // apply all data read in the table to the chart data-array of the internal
     // data provider
     lcl_applyXMLTableToInternalDataprovider( rTable, xDataArray );
 }
 
-void SchXMLTableHelper::postProcessTable(
+void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary(
     const SchXMLTable& rTable,
     const tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
     uno::Reference< chart2::XChartDocument > xChartDoc,
@@ -1051,6 +1013,14 @@ void SchXMLTableHelper::postProcessTable(
 {
     if( ! (xChartDoc.is() && xChartDoc->hasInternalDataProvider()))
         return;
+
+    // If the range-strings are valid (starting with "local-table") they should
+    // be interpreted like given, otherwise (when the ranges refer to Calc- or
+    // Writer-ranges, but the container is not available like when pasting a
+    // chart from Calc to Impress) the range is ignored, and every object gets
+    // one table column in the order of appearance, which is: 1. categories,
+    // 2. data series: 2.a) domains, 2.b) values (main-role, usually y-values)
+
     Reference< chart2::data::XDataProvider >  xDataProv( xChartDoc->getDataProvider());
 
     // create a mapping from original ranges to new ranges
@@ -1079,7 +1049,7 @@ void SchXMLTableHelper::postProcessTable(
                         lcl_reassignDataSequence( xSeq, xDataProv, aRangeMap, aRange ));
                     if( xNewSeq != xSeq )
                     {
-                        lcl_copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
+                        SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
                                             Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY ));
                         aLSeqIt->second->setValues( xNewSeq );
                     }
@@ -1099,7 +1069,7 @@ void SchXMLTableHelper::postProcessTable(
                             Reference< chart2::data::XDataSequence > xNewSequence(
                                 xDataProv->createDataSequenceByRangeRepresentation(
                                     OUString(RTL_CONSTASCII_USTRINGPARAM("categories"))));
-                            lcl_copyProperties(
+                            SchXMLTools::copyProperties(
                                 xOldSequenceProp, Reference< beans::XPropertySet >( xNewSequence, uno::UNO_QUERY ));
                             aLSeqIt->second->setValues( xNewSequence );
                             bCategoriesApplied = true;
@@ -1110,7 +1080,7 @@ void SchXMLTableHelper::postProcessTable(
                             OUString aRep( OUString::valueOf( aLSeqIt->first.first ));
                             Reference< chart2::data::XDataSequence > xNewSequence(
                                 xDataProv->createDataSequenceByRangeRepresentation( aRep ));
-                            lcl_copyProperties(
+                            SchXMLTools::copyProperties(
                                 xOldSequenceProp, Reference< beans::XPropertySet >( xNewSequence, uno::UNO_QUERY ));
                             aLSeqIt->second->setValues( xNewSequence );
                         }
@@ -1131,7 +1101,7 @@ void SchXMLTableHelper::postProcessTable(
                         lcl_reassignDataSequence( xSeq, xDataProv, aRangeMap, aRange ));
                     if( xNewSeq != xSeq )
                     {
-                        lcl_copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
+                        SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
                                             Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY ));
                         aLSeqIt->second->setLabel( xNewSeq );
                     }
@@ -1143,7 +1113,7 @@ void SchXMLTableHelper::postProcessTable(
 
                     Reference< chart2::data::XDataSequence > xNewSeq(
                         xDataProv->createDataSequenceByRangeRepresentation( aRep ));
-                    lcl_copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
+                    SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
                                         Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY ));
                     aLSeqIt->second->setLabel( xNewSeq );
                 }
diff --git a/xmloff/source/chart/SchXMLTableContext.hxx b/xmloff/source/chart/SchXMLTableContext.hxx
index 461426f..a49c70b 100644
--- a/xmloff/source/chart/SchXMLTableContext.hxx
+++ b/xmloff/source/chart/SchXMLTableContext.hxx
@@ -108,14 +108,14 @@ public:
         table, the addresses of series, the addresses of labels,
         the cell-range-address for the categories
      */
-    static void applyTable( const SchXMLTable& rTable,
+    static void applyTableToInternalDataProvider( const SchXMLTable& rTable,
                             com::sun::star::uno::Reference< com::sun::star::chart2::XChartDocument > xChartDoc );
 
-    /** Second part of applyTable that has to be called after the data series
+    /** Second part of applyTableToInternalDataProvider that has to be called after the data series
         got their styles set.  This function reorders local data to fit the
         correct data structure.
      */
-    static void postProcessTable( const SchXMLTable& rTable,
+    static void switchRangesFromOuterToInternalIfNecessary( const SchXMLTable& rTable,
                                   const tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
                                   com::sun::star::uno::Reference< com::sun::star::chart2::XChartDocument > xChartDoc,
                                   ::com::sun::star::chart::ChartDataRowSource eDataRowSource );
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index a453cd5..b1db2ec 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -54,8 +54,10 @@
 #include <xmloff/xmlexp.hxx>
 #include "xmlnmspe.hxx"
 
+#include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
 #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
@@ -123,6 +125,24 @@ sal_Int32 lcl_getBuildIDFromGenerator( const ::rtl::OUString& rGenerator )
     return nBuildId;
 }
 
+Reference< chart2::data::XDataSequence > lcl_createNewSequenceFromCachedXMLRange( const Reference< chart2::data::XDataSequence >& xSeq, const Reference< chart2::data::XDataProvider >& xDataProvider )
+{
+    Reference< chart2::data::XDataSequence > xRet;
+    OUString aRange;
+    Reference< chart2::data::XRangeXMLConversion > xRangeConversion( xDataProvider, uno::UNO_QUERY );
+    if( xRangeConversion.is() )
+    {
+        if( xSeq.is() && SchXMLTools::getXMLRangePropertyFromDataSequence( xSeq, aRange, /* bClearProp = */ true ) )
+        {
+            xRet.set( xDataProvider->createDataSequenceByRangeRepresentation( 
+                xRangeConversion->convertRangeFromXML( aRange )) );
+            SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
+                Reference< beans::XPropertySet >( xRet, uno::UNO_QUERY ));
+        }
+    }
+    return xRet;
+}
+
 } // anonymous namespace
 
 // ----------------------------------------
@@ -591,6 +611,68 @@ bool getXMLRangePropertyFromDataSequence(
     return bResult;
 }
 
+void copyProperties(
+    const Reference< beans::XPropertySet > & xSource,
+    const Reference< beans::XPropertySet > & xDestination )
+{
+    if( ! (xSource.is() && xDestination.is()) )
+        return;
+
+    try
+    {
+        Reference< beans::XPropertySetInfo > xSrcInfo( xSource->getPropertySetInfo(), uno::UNO_QUERY_THROW );
+        Reference< beans::XPropertySetInfo > xDestInfo( xDestination->getPropertySetInfo(), uno::UNO_QUERY_THROW );
+        Sequence< beans::Property > aProperties( xSrcInfo->getProperties());
+        const sal_Int32 nLength = aProperties.getLength();
+        for( sal_Int32 i = 0; i < nLength; ++i )
+        {
+            OUString aName( aProperties[i].Name);
+            if( xDestInfo->hasPropertyByName( aName ))
+            {
+                beans::Property aProp( xDestInfo->getPropertyByName( aName ));
+                if( (aProp.Attributes & beans::PropertyAttribute::READONLY) == 0 )
+                    xDestination->setPropertyValue(
+                        aName, xSource->getPropertyValue( aName ));
+            }
+        }
+    }
+    catch( const uno::Exception & )
+    {
+        OSL_ENSURE( false, "Copying property sets failed!" );
+    }
+}
+
+bool switchBackToDataProviderFromParent( const Reference< chart2::XChartDocument >& xChartDoc, const tSchXMLLSequencesPerIndex & rLSequencesPerIndex )
+{
+    //return whether the switch is successful
+    if( !xChartDoc.is() || !xChartDoc->hasInternalDataProvider() )
+        return false;
+    Reference< chart2::data::XDataProvider > xDataProviderFromParent( SchXMLTools::getDataProviderFromParent( xChartDoc ) );
+    if( !xDataProviderFromParent.is() )
+        return false;
+    uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartDoc, uno::UNO_QUERY );
+    if( !xDataReceiver.is() )
+        return false;
+    
+    xDataReceiver->attachDataProvider( xDataProviderFromParent );
+    
+    for( tSchXMLLSequencesPerIndex::const_iterator aLSeqIt( rLSequencesPerIndex.begin() );
+         aLSeqIt != rLSequencesPerIndex.end(); ++aLSeqIt )
+    {
+        Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( aLSeqIt->second );
+        if( !xLabeledSeq.is() )
+            continue;
+        Reference< chart2::data::XDataSequence > xNewSeq;
+        xNewSeq = lcl_createNewSequenceFromCachedXMLRange( xLabeledSeq->getValues(), xDataProviderFromParent );
+        if( xNewSeq.is() )
+            xLabeledSeq->setValues( xNewSeq );
+        xNewSeq = lcl_createNewSequenceFromCachedXMLRange( xLabeledSeq->getLabel(), xDataProviderFromParent );
+        if( xNewSeq.is() )
+            xLabeledSeq->setLabel( xNewSeq );
+    }
+    return true;
+}
+
 bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const uno::Reference< frame::XModel >& xChartModel )
 {
     bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan2_3( xChartModel );
@@ -649,4 +731,27 @@ bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const uno::Reference< frame:
     return bResult;
 }
 
+Reference< chart2::data::XDataProvider > getDataProviderFromParent( const Reference< chart2::XChartDocument >& xChartDoc )
+{
+    Reference< chart2::data::XDataProvider > xRet;
+    uno::Reference< container::XChild > xChild( xChartDoc, uno::UNO_QUERY );
+    if( xChild.is() )
+    {
+        Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY );
+        if( xFact.is() )
+        {
+            const OUString aDataProviderServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"));
+            const uno::Sequence< OUString > aServiceNames( xFact->getAvailableServiceNames());
+            const OUString * pBegin = aServiceNames.getConstArray();
+            const OUString * pEnd = pBegin + aServiceNames.getLength();
+            if( ::std::find( pBegin, pEnd, aDataProviderServiceName ) != pEnd )
+            {
+                xRet = Reference< chart2::data::XDataProvider >(
+                    xFact->createInstance( aDataProviderServiceName ), uno::UNO_QUERY );
+            }
+        }
+    }
+    return xRet;
+}
+
 } // namespace SchXMLTools
diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx
index 60a7139..eba5a69 100644
--- a/xmloff/source/chart/SchXMLTools.hxx
+++ b/xmloff/source/chart/SchXMLTools.hxx
@@ -127,6 +127,16 @@ namespace SchXMLTools
             ::com::sun::star::chart2::data::XDataSequence > & xDataSequence,
         ::rtl::OUString & rOutXMLRange,
         bool bClearProp = false );
+
+    ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > getDataProviderFromParent( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc );
+
+    bool switchBackToDataProviderFromParent( const ::com::sun::star::uno::Reference<
+        ::com::sun::star::chart2::XChartDocument >& xChartDoc
+        , const tSchXMLLSequencesPerIndex & rLSequencesPerIndex );
+
+    void copyProperties(
+        const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xSource,
+        const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xDestination );
 }
 
 #endif	// SCH_XML_TOOLS_HXX_
commit 75b528862b759700fe14367d9a64c48123e9703a
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Tue Jul 28 10:04:47 2009 +0000

    CWS-TOOLING: integrate CWS calc51
    2009-07-17 15:47:46 +0200 er  r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access.
    2009-07-16 14:20:11 +0200 er  r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions
    2009-07-07 10:11:40 +0200 nn  r273776 : #i35579# don't use long instead of sal_Int32
    2009-07-03 16:41:39 +0200 nn  r273711 : msvc warnings
    2009-07-03 14:18:45 +0200 nn  r273698 : msvc warning
    2009-07-03 11:30:41 +0200 nn  r273685 : #i35579# move new tokens to the end
    2009-07-03 10:12:55 +0200 nn  r273681 : CWS-TOOLING: rebase CWS calc51 to trunk at 273468 (milestone: DEV300:m51)
    2009-06-30 17:57:30 +0200 nn  r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo
    2009-06-29 14:31:18 +0200 er  r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311
    2009-06-29 10:30:20 +0200 nn  r273457 : #i103161# DeleteCells: always leave list action
    2009-06-24 16:16:34 +0200 nn  r273353 : gcc warnings
    2009-06-17 11:50:28 +0200 tbe  r273055 : #i35579# Standard filter requires more options
    2009-06-17 11:44:22 +0200 tbe  r273054 : #i35579# Standard filter requires more options
    2009-06-17 11:22:23 +0200 tbe  r273052 : #i35579# Standard filter requires more options
    2009-06-15 18:29:32 +0200 nn  r273006 : #160063# UseFormulaData: check parenthesis position
    2009-06-12 15:41:16 +0200 nn  r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon)
    2009-06-11 15:07:05 +0200 nn  r272874 : #i86943# GetNextPos: skip overlapped cells
    2009-06-11 11:17:37 +0200 nn  r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action
    2009-06-10 20:45:07 +0200 nn  r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc)
    2009-06-10 20:22:02 +0200 nn  r272838 : #i69524# PasteFile: specify target for SID_OPENDOC
    2009-06-09 17:33:08 +0200 nn  r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)

diff --git a/xmloff/inc/xmlkywd.hxx b/xmloff/inc/xmlkywd.hxx
index b398007..fbc8165 100644
--- a/xmloff/inc/xmlkywd.hxx
+++ b/xmloff/inc/xmlkywd.hxx
@@ -1991,4 +1991,11 @@ XML_CONSTASCII_ACTION( sXML_readonly, "readonly" );
 
 XML_CONSTASCII_ACTION( sXML_page_continuation, "page-continuation" );
 
+XML_CONSTASCII_ACTION( sXML_contains, "contains" );
+XML_CONSTASCII_ACTION( sXML_does_not_contain, "does-not-contain" );
+XML_CONSTASCII_ACTION( sXML_begins_with, "begins-with" );
+XML_CONSTASCII_ACTION( sXML_does_not_begin_with, "does-not-begin-with" );
+XML_CONSTASCII_ACTION( sXML_ends_with, "ends-with" );
+XML_CONSTASCII_ACTION( sXML_does_not_end_with, "does-not-end-with" );
+
 #endif
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index 2620e3d..a2e2aa9 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -3081,6 +3081,13 @@ namespace xmloff { namespace token {
         XML_MATHWEIGHT, 
         XML_MATHCOLOR,
 
+        XML_CONTAINS,
+        XML_DOES_NOT_CONTAIN,
+        XML_BEGINS_WITH,
+        XML_DOES_NOT_BEGIN_WITH,
+        XML_ENDS_WITH,
+        XML_DOES_NOT_END_WITH,
+
         XML_TOKEN_END
     };
 
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 900e730..f056a5a 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3082,6 +3082,13 @@ namespace xmloff { namespace token {
         TOKEN( "mathweight",            XML_MATHWEIGHT ),
         TOKEN( "mathcolor",             XML_MATHCOLOR ),
 
+        TOKEN( "contains",              XML_CONTAINS ),
+        TOKEN( "does-not-contain",      XML_DOES_NOT_CONTAIN ),
+        TOKEN( "begins-with",           XML_BEGINS_WITH ),
+        TOKEN( "does-not-begin-with",   XML_DOES_NOT_BEGIN_WITH ),
+        TOKEN( "ends-with",             XML_ENDS_WITH ),
+        TOKEN( "does-not-end-with",     XML_DOES_NOT_END_WITH ),
+
 #if OSL_DEBUG_LEVEL > 0
         { 0, NULL, NULL,                       XML_TOKEN_END }
 #else
commit fa130464ffc8e3910df39cfc556e3659b4e4f0e4
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Tue Jul 28 09:21:19 2009 +0000

    CWS-TOOLING: integrate CWS fwk112
    2009-07-17 08:54:15 +0200 cd  r274075 : #i102094# MinGW needs additional path info for linking
    2009-07-13 15:09:07 +0200 cd  r273938 : #i102094# Add special part for MinGW linking to imagehlp.lib
    2009-07-10 08:05:14 +0200 cd  r273871 : #i102094# Use size_t for constant values to fix warnings
    2009-07-09 13:45:27 +0200 cd  r273859 : #i102094# MinGW needs include malloc.h for function alloca
    2009-07-09 12:37:39 +0200 cd  r273856 : #i102094# Fix problem with signed/unsigned comparision warning
    2009-06-19 11:34:40 +0200 cd  r273154 : #i102094# Added comment for future maintenance
    2009-06-19 11:34:11 +0200 cd  r273153 : #i102094# Added comment for future maintenance
    2009-06-16 17:25:03 +0200 cd  r273032 : #i102094# Extend md5.cxx to detect Windows PE images and ignore PE header date+time/checksum to have the same MD5 checksum
    2009-06-16 17:22:47 +0200 cd  r273031 : #i102094# Added rebase custom action
    2009-06-16 17:01:12 +0200 cd  r273030 : #i102094# Use rebaseoo.exe instead of rebase.exe to prevent clash with build tool
    2009-06-16 17:00:34 +0200 cd  r273029 : #i102094# Execute rebase custom action for administrative installations
    2009-06-16 16:59:11 +0200 cd  r273028 : #i102094# Small changes for rebaseoo/rebasegui tools
    2009-06-16 16:58:29 +0200 cd  r273027 : i102094# Deliver rebase tool as rebaseoo.exe as build env already use a rebase.exe
    2009-06-16 16:57:15 +0200 cd  r273026 : i102094# Crash reporter should not use PE header date+time/checksum data for MD5 checksum
    2009-05-29 17:03:26 +0200 cd  r272474 : #i102094# Fix wrong deliver statement
    2009-05-29 14:55:35 +0200 cd  r272459 : #i102904# Make executables more robust. Add error message if installation cannot be found
    2009-05-28 17:41:07 +0200 cd  r272422 : CWS-TOOLING: rebase CWS fwk112 to trunk at 272291 (milestone: DEV300:m49)
    2009-05-28 17:31:27 +0200 cd  r272421 : #i10000# Resolve conflict on merge
    2009-05-28 15:32:09 +0200 cd  r272409 : #i102094# Added resource and localization files for rebasegui tool
    2009-05-27 13:56:33 +0200 cd  r272341 : #i102094# Added new command line tool to rebase libraries to a default virtual load address. Additional GUI tool to check the state of an installation
    2009-05-26 10:49:20 +0200 cd  r272285 : #i102094# New command line tool to rebase libraries to a default virtual load address
    2009-05-26 10:40:02 +0200 cd  r272282 : #i102094# New command line tool to rebase libraries to a default virtual load address
    2009-05-26 08:57:24 +0200 cd  r272280 : #i102094# Fixed wrong variable usage
    2009-05-26 08:41:29 +0200 cd  r272278 : #i102094# New command line tool to rebase libraries to a default virtual load address
    2009-05-20 16:47:24 +0200 cd  r272141 : #102094# Added missing include statement for debug build
    2009-05-20 15:39:21 +0200 is  r272136 : #102094# rebase to default value in installation
    2009-05-20 15:38:38 +0200 is  r272135 : #102094# rebase to default value in installation
    2009-05-20 15:37:45 +0200 is  r272134 : #102094# rebase to default value in installation

diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst
index 4b6a566..3aa56e2 100644
--- a/desktop/prj/build.lst
+++ b/desktop/prj/build.lst
@@ -16,6 +16,7 @@ dt	desktop\win32\source\guiloader			nmake	-	w	dt_guiloader dt_wrapper.w dt_inc N
 dt  desktop\win32\source\guistdio           nmake   -   w   dt_guistdio dt_inc NULL
 dt	desktop\win32\source\applauncher		nmake	-	w	dt_applauncher dt_inc NULL
 dt	desktop\win32\source\applauncher\ooo	nmake	-	w	dt_applauncher_ooo dt_applauncher.w dt_inc NULL
+dt	desktop\win32\source\rebase				nmake	-	w	dt_rebase dt_inc NULL
 dt	desktop\os2\source\applauncher			nmake	-	p	dt_applauncher dt_inc NULL
 dt	desktop\unx\source\officeloader		nmake	-	u	dt_officeloader_unx dt_inc NULL
 dt	desktop\source\pagein					nmake	-	u	dt_pagein dt_inc NULL
@@ -35,5 +36,5 @@ dt	desktop\source\deployment\registry\configuration	nmake	-	all	dt_dp_registry_c
 dt	desktop\source\deployment\registry\help			nmake	-	all	dt_dp_registry_help dt_inc NULL
 dt	desktop\source\deployment\registry\executable		nmake	-	all	dt_dp_registry_executable dt_inc NULL
 dt	desktop\scripts 						nmake	-	u	dt_scripts dt_inc NULL
-dt	desktop\util							nmake	-	all	dt_util dt_app dt_so_comp dt_spl dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr NULL
+dt	desktop\util							nmake	-	all	dt_util dt_app dt_so_comp dt_spl dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr dt_rebase.w NULL
 dt	desktop\zipintro							nmake	-	all	dt_zipintro NULL
diff --git a/desktop/prj/d.lst b/desktop/prj/d.lst
index 7889721..eb0d938 100644
--- a/desktop/prj/d.lst
+++ b/desktop/prj/d.lst
@@ -82,6 +82,8 @@ mkdir: %_DEST%\bin%_EXT%\odf4ms
 ..\%__SRC%\bin\unopkga*.dll %_DEST%\bin%_EXT%\unopkga*.dll
 ..\%__SRC%\lib\libunopkgapp.dylib %_DEST%\lib%_EXT%\libunopkgapp.dylib
 ..\%__SRC%\lib\libunopkgapp.so %_DEST%\lib%_EXT%\libunopkgapp.so
+..\%__SRC%\bin\rebasegui.exe %_DEST%\bin%_EXT%\rebasegui.exe
+..\%__SRC%\bin\rebaseoo.exe %_DEST%\bin%_EXT%\rebaseoo.exe
 
 ..\%__SRC%\bin\pagein %_DEST%\bin%_EXT%\pagein
 ..\%__SRC%\misc\pagein-* %_DEST%\bin%_EXT%\pagein-*
diff --git a/desktop/win32/source/rebase/Resource.h b/desktop/win32/source/rebase/Resource.h
new file mode 100644
index 0000000..03ec1d4
--- /dev/null
+++ b/desktop/win32/source/rebase/Resource.h
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Resource.h,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _RESOURCE_H
+#define _RESOURCE_H
+
+#define IDS_APP_TITLE					10
+#define	IDS_MSG_OPTIMIZED_FOR_CLIENT	11
+#define	IDS_MSG_OPTIMIZED_FOR_SERVER	12
+#define IDS_MSG_NO_INSTALLATION_FOUND	13
+
+#define IDI_REBASEGUI                   99
+
+#endif
diff --git a/desktop/win32/source/rebase/makefile.mk b/desktop/win32/source/rebase/makefile.mk
new file mode 100644
index 0000000..8114403
--- /dev/null
+++ b/desktop/win32/source/rebase/makefile.mk
@@ -0,0 +1,93 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.4 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org.  If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=desktop
+TARGET=rebasegui
+LIBTARGET=NO
+TARGETTYPE=GUI
+UWINAPILIB=
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE :  settings.mk
+
+# --- Files --------------------------------------------------------
+
+OBJFILES = \
+    $(OBJ)$/rebase.obj	\
+    $(OBJ)$/rebasegui.obj
+
+ULFFILES=	rebasegui.ulf
+
+.IF "$(WITH_LANG)"!=""
+ULFDIR:=$(COMMONMISC)$/$(TARGET)
+.ELSE			# "$(WITH_LANG)"!=""
+ULFDIR:=.
+.ENDIF			# "$(WITH_LANG)"!=""
+
+RCFILES=		$(RES)$/$(TARGET).rc
+
+# --- Targets ------------------------------------------------------
+
+APP1NOSAL=		TRUE
+APP1TARGET=		rebaseoo
+
+APP1STDLIBS=	$(SHELL32LIB) $(SOLARLIBDIR)$/pathutils-obj.obj
+.IF "$(COM)"=="GCC"
+    APP1STDLIBS+=$(PSDK_HOME)$/lib$/imagehlp.lib
+.ELSE
+    APP1STDLIBS+=imagehlp.lib
+.ENDIF
+
+APP1OBJS=		$(OBJ)$/rebase.obj
+
+APP1RPATH=		BRAND
+
+APP2NOSAL=		TRUE
+APP2TARGET=		rebasegui 
+APP2STDLIBS=	$(SHELL32LIB) $(SOLARLIBDIR)$/pathutils-obj.obj
+
+APP2OBJS=		$(OBJ)$/rebasegui.obj
+
+APP2DEF=		$(MISC)$/$(TARGET).def
+APP2RPATH=		BRAND
+
+APP2RES=		$(RES)$/$(TARGET).res
+APP2NOSVRES=	$(RES)$/$(TARGET).res
+
+# --- setup --------------------------------------------------------------
+
+.INCLUDE :  target.mk
+
+$(RCFILES) : $(ULFDIR)$/rebasegui.ulf makefile.mk rcfooter.txt rcheader.txt rctmpl.txt
+    $(WRAPCMD) lngconvex.exe -ulf $(ULFDIR)$/rebasegui.ulf -rc $(RCFILES) -rct rctmpl.txt -rch rcheader.txt -rcf rcfooter.txt
diff --git a/desktop/win32/source/rebase/rcfooter.txt b/desktop/win32/source/rebase/rcfooter.txt
new file mode 100644
index 0000000..3237729
--- /dev/null
+++ b/desktop/win32/source/rebase/rcfooter.txt
@@ -0,0 +1,2 @@
+
+// The end
diff --git a/desktop/win32/source/rebase/rcheader.txt b/desktop/win32/source/rebase/rcheader.txt
new file mode 100644
index 0000000..56afc53
--- /dev/null
+++ b/desktop/win32/source/rebase/rcheader.txt
@@ -0,0 +1,39 @@
+#if defined(_MSC_VER) && (_MSC_VER < 1500)
+#include <winres.h>
+#else
+#define WINVER 0x0500
+#include <winresrc.h>
+#define IDC_STATIC		(-1)
+#endif
+#include "resource.h"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,1,1,0
+ PRODUCTVERSION 1,1,1,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x9L
+#else
+ FILEFLAGS 0x8L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
diff --git a/desktop/win32/source/rebase/rctmpl.txt b/desktop/win32/source/rebase/rctmpl.txt
new file mode 100644
index 0000000..97a2775
--- /dev/null
+++ b/desktop/win32/source/rebase/rctmpl.txt
@@ -0,0 +1,9 @@
+// String Table
+
+STRINGTABLE DISCARDABLE 
+BEGIN
+	IDS_APP_TITLE					%APP_TITLE%
+	IDS_MSG_OPTIMIZED_FOR_CLIENT	%MSG_OPTIMIZED_FOR_CLIENT%
+	IDS_MSG_OPTIMIZED_FOR_SERVER	%MSG_OPTIMIZED_FOR_SERVER%
+	IDS_MSG_NO_INSTALLATION_FOUND	%MSG_NO_INSTALLATION_FOUND%
+END
diff --git a/desktop/win32/source/rebase/rebase.cxx b/desktop/win32/source/rebase/rebase.cxx
new file mode 100644
index 0000000..633e747
--- /dev/null
+++ b/desktop/win32/source/rebase/rebase.cxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: md5.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_desktop.hxx"
+#define UNICODE
+#define _UNICODE
+
+#define WIN32_LEAN_AND_MEAN
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#include <windows.h>
+#include <shellapi.h>
+#include <imagehlp.h>
+#include <wchar.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+#include <time.h>
+#include "sal/config.h"
+#include "tools/pathutils.hxx"
+
+#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
+#define MY_STRING(s) (s), MY_LENGTH(s)
+
+const int   FORMAT_MESSAGE_SIZE = 4096;
+const DWORD PE_Signature        = 0x00004550;
+const DWORD BASEVIRTUALADDRESS	= 0x10000000;
+
+namespace
+{
+
+bool IsValidHandle( HANDLE handle )
+{
+    return ((NULL != handle) && (INVALID_HANDLE_VALUE != handle));
+}
+
+void fail() 
+{
+    LPWSTR buf = NULL;
+    FormatMessageW(
+        FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
+        GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
+    MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
+    LocalFree(buf);
+    TerminateProcess(GetCurrentProcess(), 255);
+}
+
+bool rebaseImage( wchar_t* pszFilePath, ULONG nNewImageBase)
+{
+    ULONG ulOldImageSize;
+    ULONG_PTR lpOldImageBase;
+    ULONG ulNewImageSize;
+    ULONG_PTR lpNewImageBase  = nNewImageBase;
+    ULONG	  ulDateTimeStamp = 0;
+    bool      bResult(false);
+    
+    char cszFilePath[_MAX_PATH+1] = {0};
+    int nResult = WideCharToMultiByte(CP_ACP, 0, pszFilePath, -1, cszFilePath, _MAX_PATH, NULL, NULL);
+    
+    if (nResult != 0)
+    {
+        BOOL bResult = ReBaseImage(
+            cszFilePath,
+            "",
+            TRUE,
+            FALSE,
+            FALSE,
+            0,
+            &ulOldImageSize,
+            &lpOldImageBase,
+            &ulNewImageSize,
+            &lpNewImageBase,
+            ulDateTimeStamp );
+    }
+
+    return bResult;
+}
+
+wchar_t* getBrandPath(wchar_t * path)
+{
+    DWORD n = GetModuleFileNameW(NULL, path, MAX_PATH);
+    if (n == 0 || n >= MAX_PATH) {
+        exit(EXIT_FAILURE);
+    }
+    return tools::filename(path);
+}
+
+void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase )
+{
+    wchar_t szPattern[MAX_PATH];
+    wchar_t	*lpLastSlash = wcsrchr( pszFolder, '\\' );
+    if ( lpLastSlash )
+    {
+        size_t len = lpLastSlash - pszFolder + 1;
+        wcsncpy( szPattern, pszFolder, len );
+        wcsncpy( szPattern + len, TEXT("*.dll"), sizeof(szPattern)/sizeof(szPattern[0]) - len );
+    }
+
+    WIN32_FIND_DATA	aFindFileData;
+    HANDLE	hFind = FindFirstFile( szPattern, &aFindFileData );
+
+    if ( IsValidHandle(hFind) )
+    {
+        BOOL fSuccess = false;
+
+        do
+        {
+            wchar_t szLibFilePath[MAX_PATH];
+            wchar_t	*lpLastSlash = wcsrchr( pszFolder, '\\' );
+            if ( lpLastSlash )
+            {
+                size_t len = lpLastSlash - pszFolder + 1;
+                wcsncpy( szLibFilePath, pszFolder, len );
+                wcsncpy( szLibFilePath + len, aFindFileData.cFileName, sizeof(szLibFilePath)/sizeof(szLibFilePath[0]) - len );
+            }
+
+            rebaseImage( szLibFilePath, nNewImageBase );
+            fSuccess = FindNextFile( hFind, &aFindFileData );
+        }
+        while ( fSuccess );
+
+        FindClose( hFind );
+    }
+}
+
+}
+
+extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
+{
+    wchar_t path[MAX_PATH];
+    
+    wchar_t * pathEnd = getBrandPath(path);
+    
+    if (tools::buildPath(path, path, pathEnd, MY_STRING(L"")) == NULL)
+        fail();
+    rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
+    
+    if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL)
+        fail();
+    pathEnd = tools::resolveLink(path);
+    
+    if ( pathEnd == NULL )
+        return 0;
+
+    if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\")) == NULL)
+        fail();
+    rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
+    
+    if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
+        fail();
+    pathEnd = tools::resolveLink(path);
+    
+    if ( pathEnd == NULL )
+        return 0;
+    
+    if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\")) == NULL)
+        fail();
+    rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
+
+    return 0;
+}
diff --git a/desktop/win32/source/rebase/rebasegui.cxx b/desktop/win32/source/rebase/rebasegui.cxx
new file mode 100644
index 0000000..3cb36cb
--- /dev/null
+++ b/desktop/win32/source/rebase/rebasegui.cxx
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: md5.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_desktop.hxx"
+
+#define  UNICODE    1
+#define _UNICODE    1
+
+#ifndef _WINDOWS_
+#	define WIN32_LEAN_AND_MEAN
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#	include <windows.h>
+#	include <shellapi.h>
+#	include <wchar.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+#endif
+
+#include "Resource.h"
+#include <time.h>
+#include "sal/config.h"
+#include "tools/pathutils.hxx"
+
+const DWORD PE_Signature = 0x00004550;
+
+#define MY_LENGTH(s)		(sizeof (s) / sizeof *(s) - 1)
+#define MY_STRING(s)		(s), MY_LENGTH(s)
+#define MAX_STR_CAPTION		256
+#define MAX_TEXT_LENGTH     1024
+
+static void failPath(wchar_t* pszAppTitle, wchar_t* pszMsg)
+{
+    MessageBoxW(NULL, pszMsg, pszAppTitle, MB_OK | MB_ICONERROR);
+    TerminateProcess(GetCurrentProcess(), 255);
+}
+
+static void fail() 
+{
+    LPWSTR buf = NULL;
+    FormatMessageW(
+        FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
+        GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
+    MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
+    LocalFree(buf);
+    TerminateProcess(GetCurrentProcess(), 255);
+}
+
+static LPVOID getVirtualBaseAddress( wchar_t* pszFilePath )
+{
+    HANDLE                hFile;
+    HANDLE                hFileMapping;
+    LPVOID				  lpFileBase = 0;
+    PIMAGE_DOS_HEADER     lpDosHeader;
+    PIMAGE_NT_HEADERS     lpNTHeader;
+
+    hFile = CreateFile(pszFilePath, 
+                       GENERIC_READ, FILE_SHARE_READ, NULL,
+                       OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
+                       0);
+                    
+    if ( hFile == INVALID_HANDLE_VALUE )
+    {   
+        return NULL;
+    }
+    
+    hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+    if ( hFileMapping == 0 )
+    {   
+        CloseHandle(hFile);
+        return NULL;
+    }
+    
+    lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
+    if ( lpFileBase == 0 )
+    {
+        CloseHandle(hFileMapping);
+        CloseHandle(hFile);
+        return NULL;
+    }
+
+    lpDosHeader = (PIMAGE_DOS_HEADER)lpFileBase;
+    if ( lpDosHeader->e_magic == IMAGE_DOS_SIGNATURE )
+    { 
+        lpNTHeader = (PIMAGE_NT_HEADERS)((char*)lpDosHeader + lpDosHeader->e_lfanew);
+        if (lpNTHeader->Signature == PE_Signature )
+            lpFileBase = reinterpret_cast<LPVOID>( lpNTHeader->OptionalHeader.ImageBase );
+    }
+    
+    UnmapViewOfFile(lpFileBase);
+    CloseHandle(hFileMapping);
+    CloseHandle(hFile);
+    
+    return lpFileBase;
+}
+
+static bool checkImageVirtualBaseAddress(wchar_t* pszFilePath, LPVOID lpVBA)
+{
+    LPVOID lpImageVBA = getVirtualBaseAddress(pszFilePath);
+    if ( lpImageVBA == lpVBA )
+        return true;
+    else
+        return false;
+}
+
+static wchar_t* getBrandPath(wchar_t * pszPath)
+{
+    DWORD n = GetModuleFileNameW(NULL, pszPath, MAX_PATH);
+    if (n == 0 || n >= MAX_PATH) {
+        exit(EXIT_FAILURE);
+    }
+    return tools::filename(pszPath);
+}
+
+extern "C" int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, int )
+{
+    wchar_t* pAppTitle = new wchar_t[ MAX_STR_CAPTION ];
+             pAppTitle[0]  = '\0';
+    LoadString( hInst, IDS_APP_TITLE, pAppTitle, MAX_STR_CAPTION );
+
+    wchar_t* pTextServer = new wchar_t[ MAX_TEXT_LENGTH ];
+             pTextServer[0]  = '\0';
+    LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_SERVER, pTextServer, MAX_TEXT_LENGTH );
+
+    wchar_t* pTextClient = new wchar_t[ MAX_TEXT_LENGTH ];
+             pTextClient[0]  = '\0';
+    LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_CLIENT, pTextClient, MAX_TEXT_LENGTH );
+
+    wchar_t* pTextNoInstallation = new wchar_t[ MAX_TEXT_LENGTH ];
+             pTextNoInstallation[0]  = '\0';
+    LoadString( hInst, IDS_MSG_NO_INSTALLATION_FOUND, pTextNoInstallation, MAX_TEXT_LENGTH );
+    
+    LPVOID  VBA = (void*)0x10000000;
+    wchar_t path[MAX_PATH];
+    
+    wchar_t * pathEnd = getBrandPath(path);
+    
+    if (tools::buildPath(path, path, pathEnd, MY_STRING(L"libxml2.dll")) == NULL)
+        fail();
+    bool bFast = checkImageVirtualBaseAddress(path, VBA);
+    
+    if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL)
+        fail();
+    pathEnd = tools::resolveLink(path);
+
+    if (pathEnd == NULL)
+        failPath(pAppTitle, pTextNoInstallation);
+
+    if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\vclmi.dll")) == NULL)
+        fail();
+    bFast &= checkImageVirtualBaseAddress(path, VBA);
+
+    if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
+        fail();
+    pathEnd = tools::resolveLink(path);
+    
+    if (pathEnd == NULL)
+        failPath(pAppTitle, pTextNoInstallation);
+    
+    if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\sal3.dll")) == NULL)
+        fail();
+    bFast &= checkImageVirtualBaseAddress(path, VBA);
+
+    const wchar_t* pOutput = pTextClient;
+    if (!bFast)
+        pOutput = pTextServer;
+        
+    MessageBoxW( NULL, pOutput, pAppTitle, MB_OK );
+    
+    return 0;
+}
diff --git a/desktop/win32/source/rebase/rebasegui.ulf b/desktop/win32/source/rebase/rebasegui.ulf
new file mode 100644
index 0000000..ee6b6e8
--- /dev/null
+++ b/desktop/win32/source/rebase/rebasegui.ulf
@@ -0,0 +1,11 @@
+[%APP_TITLE%]
+en-US = "Installation Status"
+
+[%MSG_OPTIMIZED_FOR_CLIENT%]
+en-US = "Installation is optimized for clients."
+
+[%MSG_OPTIMIZED_FOR_SERVER%]
+en-US = "Installation is optimized for servers."
+
+[%MSG_NO_INSTALLATION_FOUND%]
+en-US = "Cannot find Office installation."


More information about the ooo-build-commit mailing list