[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 9 commits - cli_ure/source cli_ure/version cppuhelper/source odk/examples odk/source solenv/bin svx/inc svx/source unoil/climaker vcl/source xmloff/inc xmloff/source

Jürgen Schmidt jsc at apache.org
Fri Sep 20 02:02:58 PDT 2013


 cli_ure/source/native/native_bootstrap.cxx           |  100 +-------------
 cli_ure/version/version.txt                          |   24 +--
 cppuhelper/source/findsofficepath.c                  |   19 ++
 odk/examples/CLI/CSharp/Spreadsheet/Makefile         |    4 
 odk/source/unoapploader/unx/unoapploader.c           |    5 
 odk/source/unoapploader/win/unoapploader.c           |  130 -------------------
 solenv/bin/modules/installer/download.pm             |    2 
 solenv/bin/modules/installer/windows/sign.pm         |    4 
 svx/inc/svx/sdr/properties/customshapeproperties.hxx |    4 
 svx/inc/svx/svdoashp.hxx                             |    4 
 svx/inc/svx/svdotext.hxx                             |    7 -
 svx/source/sdr/properties/customshapeproperties.cxx  |  100 +++++++-------
 svx/source/svdraw/svdoashp.cxx                       |  102 ++++++++------
 svx/source/svdraw/svdotext.cxx                       |   69 +++++-----
 svx/source/svdraw/svdotxdr.cxx                       |   20 --
 svx/source/svdraw/svdotxtr.cxx                       |   43 ++++--
 unoil/climaker/version.txt                           |    6 
 vcl/source/gdi/pngread.cxx                           |    4 
 xmloff/inc/xmloff/xmlmultiimagehelper.hxx            |    2 
 xmloff/source/text/XMLTextFrameContext.cxx           |  126 ++++++++++++------
 20 files changed, 331 insertions(+), 444 deletions(-)

New commits:
commit 1bb48c93699ef4cbcaff9bb6a8dd33a45d238ba1
Author: Jürgen Schmidt <jsc at apache.org>
Date:   Fri Sep 20 08:05:42 2013 +0000

    #122869# fix problem to find office installation

diff --git a/cli_ure/source/native/native_bootstrap.cxx b/cli_ure/source/native/native_bootstrap.cxx
index 3255d91..8dfa92a 100644
--- a/cli_ure/source/native/native_bootstrap.cxx
+++ b/cli_ure/source/native/native_bootstrap.cxx
@@ -56,9 +56,6 @@ namespace cli_ure {
 // in main\scp2\source\ooo\registryitem_ooo.scp
 #define INSTALL_PATH L"Software\\OpenOffice\\UNO\\InstallPath"
 #define INSTALL_PATH_64 L"Software\\Wow6432Node\\OpenOffice\\UNO\\InstallPath"
-#define BASIS_LINK L"\\basis-link"
-#define URE_LINK L"\\ure-link"
-#define URE_BIN L"\\bin"
 #define UNO_PATH L"UNO_PATH"
 
 namespace
@@ -110,23 +107,6 @@ WCHAR* getPathFromRegistryKey( HKEY hroot, LPCWSTR subKeyName )
     return data;
 }
 
-/* If the path does not end with '\' the las segment will be removed.
-    path: C:\a\b
-    ->    C:\a
-    @param io_path
-        in/out parameter. The string is not reallocated. Simply a '\0'
-        will be inserted to shorten the string.
-*/
-void oneDirUp(LPTSTR io_path)
-{
-    WCHAR * pEnd = io_path + lstrlen(io_path) - 1;
-    while (pEnd > io_path //prevent crashing if provided string does not contain a backslash
-        && *pEnd != L'\\')
-        pEnd --;
-    *pEnd = L'\0';
-}
-
-
 /* Returns the path to the program folder of the brand layer,
     for example c:/openoffice.org 3/program
    This path is either obtained from the environment variable UNO_PATH
@@ -142,8 +122,8 @@ WCHAR * getInstallPath()
     DWORD  cChars = GetEnvironmentVariable(UNO_PATH, NULL, 0);
     if (cChars > 0)
     {
-        szInstallPath = new WCHAR[cChars];
-        cChars = GetEnvironmentVariable(UNO_PATH, szInstallPath, cChars);
+        szInstallPath = new WCHAR[cChars+1];
+        cChars = GetEnvironmentVariable(UNO_PATH, szInstallPath, cChars+1);
         //If PATH is not set then it is no error
         if (cChars == 0)
         {
@@ -158,14 +138,14 @@ WCHAR * getInstallPath()
         if ( szInstallPath == NULL )
         {
             /* read the key's default value from HKEY_LOCAL_USER */
-            szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH_64 );
+            szInstallPath = getPathFromRegistryKey( HKEY_CURRENT_USER, INSTALL_PATH_64 );
         }
-        else if ( szInstallPath == NULL )
+        if ( szInstallPath == NULL )
         {
             /* read the key's default value from HKEY_LOCAL_MACHINE */
             szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH );
         }
-        else if ( szInstallPath == NULL )
+        if ( szInstallPath == NULL )
         {
             /* read the key's default value from HKEY_LOCAL_MACHINE */
             szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH_64 );
@@ -174,67 +154,6 @@ WCHAR * getInstallPath()
     return szInstallPath;
 }
 
-/* Returns the path to the URE/bin path, where cppuhelper lib resides.
-    The returned string must be freed with delete[]
-*/
-WCHAR* getUnoPath()
-{
-    WCHAR * szLinkPath = NULL;
-    WCHAR * szUrePath = NULL;
-    WCHAR * szUreBin = NULL; //the return value
-
-    WCHAR * szInstallPath = getInstallPath();
-    if (szInstallPath)
-    {
-        //build the path tho the basis-link file
-        oneDirUp(szInstallPath);
-        int sizeLinkPath = lstrlen(szInstallPath) + lstrlen(INSTALL_PATH) + 1;
-        if (sizeLinkPath < MAX_PATH)
-            sizeLinkPath = MAX_PATH;
-        szLinkPath = new WCHAR[sizeLinkPath];
-        szLinkPath[0] = L'\0';
-        lstrcat(szLinkPath, szInstallPath);
-        lstrcat(szLinkPath, BASIS_LINK);
-
-        //get the path to the actual Basis folder
-        if (cli_ure::resolveLink(szLinkPath))
-        {
-            //build the path to the ure-link file
-            int sizeUrePath = lstrlen(szLinkPath) + lstrlen(URE_LINK) + 1;
-            if (sizeUrePath < MAX_PATH)
-                sizeUrePath = MAX_PATH;
-            szUrePath = new WCHAR[sizeUrePath];
-            szUrePath[0] = L'\0';
-            lstrcat(szUrePath, szLinkPath);
-            lstrcat(szUrePath, URE_LINK);
-
-            //get the path to the actual Ure folder
-            if (cli_ure::resolveLink(szUrePath))
-            {
-                //build the path to the URE/bin directory
-                szUreBin = new WCHAR[lstrlen(szUrePath) + lstrlen(URE_BIN) + 1];
-                 szUreBin[0] = L'\0';
-                lstrcat(szUreBin, szUrePath);
-                 lstrcat(szUreBin, URE_BIN);
-            }
-        }
-    }
-#if OSL_DEBUG_LEVEL >=2
-    if (szUreBin)
-    {
-        fwprintf(stdout,L"[cli_cppuhelper]: Path to URE libraries:\n %s \n", szUreBin);
-    }
-    else
-    {
-        fwprintf(stdout,L"[cli_cppuhelper]: Failed to determine location of URE.\n");
-    }
-#endif
-    delete[] szInstallPath;
-    delete[] szLinkPath;
-    delete[] szUrePath;
-    return szUreBin;
-}
-
 
 /*We extend the path to contain the Ure/bin folder,
   so that components can use osl_loadModule with arguments, such as
@@ -280,7 +199,6 @@ HMODULE loadFromPath(LPCWSTR sLibName)
     if (sLibName == NULL)
         return NULL;
 
-//  WCHAR * szUreBinPath =  getUnoPath();
     WCHAR * szUreBinPath =  getInstallPath();
     if (!szUreBinPath)
         return NULL;
@@ -344,10 +262,10 @@ namespace util
 
     Bootstrapping requires the existence of many libraries which are contained
     in an URE installation. To find and load these libraries the Windows
-    registry keys HKEY_CURRENT_USER\Software\OpenOffice\Layer\URE\1
-    and HKEY_LOCAL_MACHINE\Software\OpenOffice\Layer\URE\1 are examined.
-    These contain a named value UREINSTALLLOCATION which holds a path to the URE
-    installation folder.
+    registry keys HKEY_CURRENT_USER\Software\OpenOffice\UNO\InstallPath
+    and HKEY_LOCAL_MACHINE\Software\OpenOffice\UNO\InstallPath are examined.
+    The default value contain the path to the office prgoram dir. No seaparate URE
+    anymore.
 */
 public __sealed __gc class Bootstrap
 {
diff --git a/cli_ure/version/version.txt b/cli_ure/version/version.txt
index 9c46b25..11d0038 100644
--- a/cli_ure/version/version.txt
+++ b/cli_ure/version/version.txt
@@ -19,23 +19,23 @@
 #  
 #**************************************************************
 
-CLI_URETYPES_NEW_VERSION=1.0.8.0
-CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.7.0
-CLI_URETYPES_POLICY_VERSION=8.0.0.0	
+CLI_URETYPES_NEW_VERSION=1.0.9.0
+CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.8.0
+CLI_URETYPES_POLICY_VERSION=9.0.0.0	
 CLI_URETYPES_POLICY_ASSEMBLY=policy.1.0.cli_uretypes
 
-CLI_BASETYPES_NEW_VERSION=1.0.19.0
-CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.18.0
-CLI_BASETYPES_POLICY_VERSION=19.0.0.0
+CLI_BASETYPES_NEW_VERSION=1.0.20.0
+CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.19.0
+CLI_BASETYPES_POLICY_VERSION=20.0.0.0
 CLI_BASETYPES_POLICY_ASSEMBLY=policy.1.0.cli_basetypes
 
-CLI_URE_NEW_VERSION=1.0.22.0
-CLI_URE_OLD_VERSION=1.0.0.0-1.0.21.0    
-CLI_URE_POLICY_VERSION=22.0.0.0
+CLI_URE_NEW_VERSION=1.0.23.0
+CLI_URE_OLD_VERSION=1.0.0.0-1.0.22.0    
+CLI_URE_POLICY_VERSION=23.0.0.0
 CLI_URE_POLICY_ASSEMBLY=policy.1.0.cli_ure
 
-CLI_CPPUHELPER_NEW_VERSION=1.0.22.0
-CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.21.0
-CLI_CPPUHELPER_POLICY_VERSION=22.0.0.0
+CLI_CPPUHELPER_NEW_VERSION=1.0.23.0
+CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.22.0
+CLI_CPPUHELPER_POLICY_VERSION=23.0.0.0
 CLI_CPPUHELPER_POLICY_ASSEMBLY=policy.1.0.cli_cppuhelper
  
diff --git a/odk/examples/CLI/CSharp/Spreadsheet/Makefile b/odk/examples/CLI/CSharp/Spreadsheet/Makefile
index 9a597e2..bb03ccd 100644
--- a/odk/examples/CLI/CSharp/Spreadsheet/Makefile
+++ b/odk/examples/CLI/CSharp/Spreadsheet/Makefile
@@ -52,7 +52,7 @@ include $(SETTINGS)/stdtarget.mk
 
 
 # build executables
-#csc -lib:"d:\StarOffice 8" does not work. csc does not understand the quotes. 
+#csc -lib:"d:\OpenOffice 4" does not work. csc does not understand the quotes. 
 #but they are needed if the path contains a space. Therefore we use full path 
 #with the -reference switch
 $(SPREADSHEET_OUT)/%.exe : %.cs SpreadsheetDocHelper.cs
@@ -75,7 +75,7 @@ ViewSample : $(SPREADSHEET_OUT)/ViewSample.exe
 
 .PHONY : Info
 ifeq "$(OS)" "WIN"
-Info : SpreadsheetSample GenerateTableSample ViewSample
+Info : SpreadsheetSample GeneralTableSample ViewSample
 	@echo -------------------------------------------------------------------------------
 	@echo Please use one of the following commands to execute the examples!
 	@echo -
diff --git a/unoil/climaker/version.txt b/unoil/climaker/version.txt
index e401869..b4f6c18 100644
--- a/unoil/climaker/version.txt
+++ b/unoil/climaker/version.txt
@@ -19,8 +19,8 @@
 #  
 #**************************************************************
 
-CLI_OOOTYPES_NEW_VERSION=1.0.8.0
-CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.7.0
-CLI_OOOTYPES_POLICY_VERSION=8.0.0.0	
+CLI_OOOTYPES_NEW_VERSION=1.0.9.0
+CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.8.0
+CLI_OOOTYPES_POLICY_VERSION=9.0.0.0	
 CLI_OOOTYPES_POLICY_ASSEMBLY=policy.1.0.cli_oootypes
 
commit 473a118a62842270b85713d0ab0dc247b5778439
Author: Armin Le Grand <alg at apache.org>
Date:   Thu Sep 19 11:34:41 2013 +0000

    i115391 corected from isLocked to IsPasteResize which was used in modifiers for CustomShape and TextShape

diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 7e9346c..76f2e38 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -648,7 +648,7 @@ FASTBOOL SdrTextObj::NbcSetAutoGrowHeight(bool bAuto)
 // states of IsAutoGrowWidth/Height to correctly set TextMinFrameWidth/Height
 void SdrTextObj::AdaptTextMinSize()
 {
-    if(bTextFrame && (!pModel || !pModel->isLocked()))
+    if(bTextFrame && (!pModel || !pModel->IsPasteResize()))
     {
         const bool bW(IsAutoGrowWidth());
         const bool bH(IsAutoGrowHeight());
commit 832e39ab057d07425a179e5eb8534581cfefe8b4
Author: Armin Le Grand <alg at apache.org>
Date:   Thu Sep 19 11:21:03 2013 +0000

    i115391 corected from SetObejctItem to usage of local SfxItemSet

diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 716c7a7..7e9346c 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -681,7 +681,7 @@ void SdrTextObj::AdaptTextMinSize()
                 if(IsVerticalWriting() && bDisableAutoWidthOnDragging)
                 {
                     bDisableAutoWidthOnDragging = false;
-                    SetObjectItem(SdrTextAutoGrowHeightItem(false));
+                    aSet.Put(SdrTextAutoGrowHeightItem(false));
                 }
             }
 
commit 14f325fd3b64ab3ff9ead9ce0e28a9b5755189df
Author: Jürgen Schmidt <jsc at apache.org>
Date:   Thu Sep 19 10:24:42 2013 +0000

    #123283# improve finding default office path for Mac (no /usr/bin/soffice link), on Windows drop unoinfo and use the path from the registry directly

diff --git a/cppuhelper/source/findsofficepath.c b/cppuhelper/source/findsofficepath.c
index b0481ea..341a06b 100644
--- a/cppuhelper/source/findsofficepath.c
+++ b/cppuhelper/source/findsofficepath.c
@@ -117,7 +117,7 @@ static char* platformSpecific()
 
 #include <unistd.h>
 #include <limits.h>
-
+#include <stdio.h>
 /*
  * Gets the installation path from the PATH environment variable.
  *
@@ -145,7 +145,21 @@ static char* platformSpecific()
     char buffer[PATH_MAX];
     int pos;
 
-    /* get the value of the PATH environment variable */
+#ifdef MACOSX
+    /* On MacOS we have no soffice link under /usr/bin but the default office location is known
+       and we check this only
+     */
+    const char* MACDEFAULTOFFICEPATH = "/Applications/OpenOffice.app/Contents/MacOS";
+    const char* MACDEFAULTSOFFICE = "/Applications/OpenOffice.app/Contents/MacOS/soffice";
+
+    if ( !access( MACDEFAULTSOFFICE, F_OK ) )
+    {
+        path = (char*) malloc( MACDEFAULTOFFICEPATH + 1 );
+        strcpy( path, MACDEFAULTOFFICEPATH);
+    }
+    return path;
+#else
+/* get the value of the PATH environment variable */
     env = getenv( PATHVARNAME );
     str = (char*) malloc( strlen( env ) + 1 );
     strcpy( str, env );
@@ -190,6 +204,7 @@ static char* platformSpecific()
     free( str );
 
     return path;
+#endif
 }
 
 #endif
diff --git a/odk/source/unoapploader/unx/unoapploader.c b/odk/source/unoapploader/unx/unoapploader.c
index 4e5240f..44b7970 100644
--- a/odk/source/unoapploader/unx/unoapploader.c
+++ b/odk/source/unoapploader/unx/unoapploader.c
@@ -206,8 +206,6 @@ int main( int argc, char *argv[] )
             strcat( envstr, value );
         }
         putenv( envstr );
-        fprintf( stderr, "DYLD_LIBRARY_PATH=%s\n", envstr );
-
     }
     else
     {
@@ -242,8 +240,7 @@ char const* getPath()
 
     if ( path == NULL )
     {
-        fprintf( stderr, "Warning: getting path from PATH environment "
-                 "variable failed!\n" );
+        fprintf( stderr, "Warning: getting path from PATH environment variable failed!\n" );
         fflush( stderr );
     }
 
diff --git a/odk/source/unoapploader/win/unoapploader.c b/odk/source/unoapploader/win/unoapploader.c
index 2f6605c..abcd0e7 100644
--- a/odk/source/unoapploader/win/unoapploader.c
+++ b/odk/source/unoapploader/win/unoapploader.c
@@ -72,7 +72,6 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
     const char* PATHSEPARATOR = ";";
 
     char const* path = NULL;
-    char path2[MAX_PATH];
     char* value = NULL;
     char* envstr = NULL;
     char* cmdline = NULL;
@@ -90,130 +89,11 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
 
     if ( path != NULL )
     {
-        wchar_t cmd[
-            MY_LENGTH(L"\"") + MAX_PATH +
-            MY_LENGTH(L"\\unoinfo.exe\" c++")];
-            /* hopefully does not overflow */
-        int pathsize;
-        SECURITY_ATTRIBUTES sec;
-        HANDLE temp;
-        HANDLE stdoutRead;
-        HANDLE stdoutWrite;
-        STARTUPINFOW startinfo;
-        PROCESS_INFORMATION procinfo;
-        int ret;
-        cmd[0] = L'"';
-        pathsize = MultiByteToWideChar(CP_ACP, 0, path, -1, cmd + 1, MAX_PATH);
-        if (pathsize == 0) {
-            writeError("Error: MultiByteToWideChar failed!\n");
-            closeErrorFile();
-            return 1;
-        }
-        if (wcschr(cmd + 1, L'"') != NULL) {
-            writeError("Error: bad characters in UNO installation path!\n");
-            closeErrorFile();
-            return 1;
-        }
-        wcscpy(
-            cmd + pathsize,
-            (L"\\unoinfo.exe\" c++" +
-             (pathsize == 1 || cmd[pathsize - 1] != L'\\' ? 0 : 1)));
-        sec.nLength = sizeof (SECURITY_ATTRIBUTES);
-        sec.lpSecurityDescriptor = NULL;
-        sec.bInheritHandle = TRUE;
-        if (CreatePipe(&temp, &stdoutWrite, &sec, 0) == 0 ||
-            DuplicateHandle(
-                GetCurrentProcess(), temp, GetCurrentProcess(), &stdoutRead, 0,
-                FALSE, DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS) == 0)
-        {
-            writeError("Error: CreatePipe/DuplicateHandle failed!\n");
-            closeErrorFile();
-            return 1;
-        }
-        memset(&startinfo, 0, sizeof (STARTUPINFOW));
-        startinfo.cb = sizeof (STARTUPINFOW);
-        startinfo.lpDesktop = L"";
-        startinfo.dwFlags = STARTF_USESTDHANDLES;
-        startinfo.hStdOutput = stdoutWrite;
-        ret = CreateProcessW(
-            NULL, cmd, NULL, NULL, TRUE, 0, NULL, NULL, &startinfo, &procinfo);
-        if (ret != 0) {
-            char * buf = NULL;
-            size_t n = 1000;
-            size_t k = 0;
-            DWORD exitcode;
-            int path2size;
-            CloseHandle(stdoutWrite);
-            CloseHandle(procinfo.hThread);
-            for (;;) {
-                DWORD m;
-                buf = realloc(buf, n);
-                if (buf == NULL) {
-                    writeError(
-                        "Error: out of memory reading unoinfo output!\n");
-                    closeErrorFile();
-                    return 1;
-                }
-                if (!ReadFile(stdoutRead, buf + k, n - k, &m, NULL))
-                {
-                    DWORD err = GetLastError();
-                    if (err == ERROR_HANDLE_EOF || err == ERROR_BROKEN_PIPE) {
-                        break;
-                    }
-                    writeError("Error: cannot read unoinfo output!\n");
-                    closeErrorFile();
-                    return 1;
-                }
-                if (m == 0) {
-                    break;
-                }
-                k += m;
-                if (k >= n) {
-                    if (n >= SAL_MAX_SIZE / 2) {
-                        writeError(
-                            "Error: out of memory reading unoinfo output!\n");
-                        closeErrorFile();
-                        return 1;
-                    }
-                    n *= 2;
-                }
-            }
-            if ((k & 1) == 1) {
-                writeError("Error: bad unoinfo output!\n");
-                closeErrorFile();
-                return 1;
-            }
-            CloseHandle(stdoutRead);
-            if (!GetExitCodeProcess(procinfo.hProcess, &exitcode) ||
-                exitcode != 0)
-            {
-                writeError("Error: executing unoinfo failed!\n");
-                closeErrorFile();
-                return 1;
-            }
-            if (k == 0) {
-                path2size = 0;
-            } else {
-                path2size = WideCharToMultiByte(
-                    CP_ACP, 0, (wchar_t *) buf, k / 2, path2, MAX_PATH - 1,
-                    NULL, NULL);
-                if (path2size == 0) {
-                    writeError("Error: converting unoinfo output failed!\n");
-                    closeErrorFile();
-                    return 1;
-                }
-            }
-            path2[path2size] = '\0';
-            path = path2;
-        } else {
-            if (GetLastError() != ERROR_FILE_NOT_FOUND) {
-                writeError("Error: calling unoinfo failed!\n");
-                closeErrorFile();
-                return 1;
-            }
-            CloseHandle(stdoutRead);
-            CloseHandle(stdoutWrite);
-        }
+        /* The former code to call unoinfo first is removed because we can use the office path
+           from the registry or from the UNO_PATH variable directly.
+           Further cleanup can remove unoinfo from the installation when all places where it is
+           used are checked.
+          */
 
         /* get the value of the PATH environment variable */
         value = getenv( ENVVARNAME );
commit 39fe8aa1f225ac52342fc6d63df8636db902b340
Author: Armin Le Grand <alg at apache.org>
Date:   Thu Sep 19 10:11:03 2013 +0000

    i115391 better support for MinTextSize settings for TextShapes and CustomShapes

diff --git a/svx/inc/svx/sdr/properties/customshapeproperties.hxx b/svx/inc/svx/sdr/properties/customshapeproperties.hxx
index 6786e1f..e4f3caa 100644
--- a/svx/inc/svx/sdr/properties/customshapeproperties.hxx
+++ b/svx/inc/svx/sdr/properties/customshapeproperties.hxx
@@ -49,6 +49,10 @@ namespace sdr
             // react on Item change
             virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem);
 
+            // Called after ItemChange() is done for all items. Allows local reactions on
+            // specific item changes
+            virtual void PostItemChange(const sal_uInt16 nWhich);
+
             // clear single item
             virtual void ClearObjectItem(const sal_uInt16 nWhich = 0);
 
diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx
index 13422b4..bd4dd2b 100644
--- a/svx/inc/svx/svdoashp.hxx
+++ b/svx/inc/svx/svdoashp.hxx
@@ -131,6 +131,10 @@ public:
     static basegfx::B2DPolyPolygon GetLineGeometry( const SdrObjCustomShape* pCustomShape, const sal_Bool bBezierAllowed );
 
 protected:
+    // #115391# new method for SdrObjCustomShape and SdrTextObj to correctly handle and set
+    // SdrTextMinFrameWidthItem and SdrTextMinFrameHeightItem based on all settings, necessities
+    // and object sizes
+    virtual void AdaptTextMinSize();
 
     String      aName;
 
diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx
index 0a3c70f..c5645f9 100644
--- a/svx/inc/svx/svdotext.hxx
+++ b/svx/inc/svx/svdotext.hxx
@@ -289,13 +289,16 @@ protected:
     virtual void RestGeoData(const SdrObjGeoData& rGeo);
     FASTBOOL NbcSetEckenradius(long nRad);
     FASTBOOL NbcSetAutoGrowHeight(bool bAuto);
-    FASTBOOL NbcSetMinTextFrameHeight(long nHgt);
     FASTBOOL NbcSetMaxTextFrameHeight(long nHgt);
     FASTBOOL NbcSetAutoGrowWidth(bool bAuto);
-    FASTBOOL NbcSetMinTextFrameWidth(long nWdt);
     FASTBOOL NbcSetMaxTextFrameWidth(long nWdt);
     FASTBOOL NbcSetFitToSize(SdrFitToSizeType eFit);
 
+    // #115391# new method for SdrObjCustomShape and SdrTextObj to correctly handle and set
+    // SdrTextMinFrameWidthItem and SdrTextMinFrameHeightItem based on all settings, necessities
+    // and object sizes
+    virtual void AdaptTextMinSize();
+
     // Konstruktoren fuer beschriftete Zeichenobjekte
     SdrTextObj();
     SdrTextObj(const Rectangle& rNewRect);
diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx
index 4eb6dc0..be8fe35 100644
--- a/svx/source/sdr/properties/customshapeproperties.cxx
+++ b/svx/source/sdr/properties/customshapeproperties.cxx
@@ -41,13 +41,19 @@ namespace sdr
     {
         void CustomShapeProperties::UpdateTextFrameStatus()
         {
-            SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
-            SdrTextAutoGrowHeightItem& rAutoGrowHeightItem =
-                (SdrTextAutoGrowHeightItem&)rObj.GetMergedItem( SDRATTR_TEXT_AUTOGROWHEIGHT );
-            rObj.bTextFrame = rAutoGrowHeightItem.GetValue() != 0;
+            SdrObjCustomShape& rObj = static_cast< SdrObjCustomShape& >(GetSdrObject());
+            const bool bOld(rObj.bTextFrame);
 
-            if ( rObj.bTextFrame )
-                rObj.NbcAdjustTextFrameWidthAndHeight();
+            rObj.bTextFrame = 0 != static_cast< const SdrTextAutoGrowHeightItem& >(GetObjectItemSet().Get(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue();
+
+            if(rObj.bTextFrame != bOld)
+            {
+                rObj.InvalidateRenderGeometry();
+
+                // #115391# Potential recursuin, since it calls SetObjectItemSet again, but rObj.bTextFrame
+                // will not change again, thus it will be only one level and terminate
+                rObj.AdaptTextMinSize();
+            }
         }
 
         SfxItemSet& CustomShapeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
@@ -74,6 +80,7 @@ namespace sdr
                 // end
                 0, 0));
         }
+
         sal_Bool CustomShapeProperties::AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem ) const
         {
             sal_Bool bAllowItemChange = sal_True;
@@ -86,6 +93,7 @@ namespace sdr
                 bAllowItemChange = TextProperties::AllowItemChange( nWhich, pNewItem );
             return bAllowItemChange;
         }
+
         void CustomShapeProperties::ClearObjectItem(const sal_uInt16 nWhich)
         {
             if ( !nWhich )
@@ -103,6 +111,7 @@ namespace sdr
             else
                 TextProperties::ClearObjectItem( nWhich );
         }
+
         void CustomShapeProperties::ClearObjectItemDirect(const sal_uInt16 nWhich)
         {
             if ( !nWhich )
@@ -118,66 +127,63 @@ namespace sdr
             else
                 TextProperties::ClearObjectItemDirect( nWhich );
         }
+
         void CustomShapeProperties::ItemSetChanged(const SfxItemSet& rSet)
         {
-            SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject();
+            // call parent
+            TextProperties::ItemSetChanged(rSet);
+
+            // update bTextFrame and RenderGeometry
+            UpdateTextFrameStatus();
+        }
 
-            if( SFX_ITEM_SET == rSet.GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) )
+        void CustomShapeProperties::PostItemChange(const sal_uInt16 nWhich)
+        {
+            switch(nWhich)
             {
-                rObj.bTextFrame = ((SdrTextAutoGrowHeightItem&)rSet.Get( SDRATTR_TEXT_AUTOGROWHEIGHT )).GetValue() != 0;
+                case SDRATTR_TEXT_AUTOGROWHEIGHT:
+                {
+                    // #115391#  update bTextFrame and RenderGeometry using AdaptTextMinSize()
+                    UpdateTextFrameStatus();
+                    break;
+                }
+                default:
+                {
+                    break;
+                }
             }
 
             // call parent
-            TextProperties::ItemSetChanged(rSet);
-
-            // local changes, removing cached objects
-            rObj.InvalidateRenderGeometry();
+            TextProperties::PostItemChange(nWhich);
         }
+
         void CustomShapeProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
         {
-            SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject();
-            //OutlinerParaObject* pParaObj = rObj.GetOutlinerParaObject();
-
-            if( pNewItem && ( SDRATTR_TEXT_AUTOGROWHEIGHT == nWhich ) )
-            {
-                rObj.bTextFrame = ((SdrTextAutoGrowHeightItem*)pNewItem)->GetValue() != 0;
-            }
             // call parent
             TextProperties::ItemChange( nWhich, pNewItem );
 
-            rObj.InvalidateRenderGeometry();
+            // update bTextFrame and RenderGeometry
+            UpdateTextFrameStatus();
         }
+
         void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
         {
+            // call parent
             TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
+
+            // update bTextFrame and RenderGeometry
             UpdateTextFrameStatus();
         }
+
         void CustomShapeProperties::ForceDefaultAttributes()
         {
+            // update bTextFrame and RenderGeometry
             UpdateTextFrameStatus();
 
-/* SJ: Following is no good if creating customshapes, leading to objects that are white after loading via xml
-
-            SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
-            sal_Bool bTextFrame(rObj.IsTextFrame());
-
-            // force ItemSet
-            GetObjectItemSet();
-
-            if(bTextFrame)
-            {
-                mpItemSet->Put(XLineStyleItem(XLINE_NONE));
-                mpItemSet->Put(XFillColorItem(String(), Color(COL_WHITE)));
-                mpItemSet->Put(XFillStyleItem(XFILL_NONE));
-            }
-            else
-            {
-                mpItemSet->Put(SvxAdjustItem(SVX_ADJUST_CENTER));
-                mpItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
-                mpItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
-            }
-*/
+            // SJ: Following is no good if creating customshapes, leading to objects that are white after loading via xml
+            // This means: Do *not* call parent here is by purpose...
         }
+
         CustomShapeProperties::CustomShapeProperties(SdrObject& rObj)
         :   TextProperties(rObj)
         {
@@ -196,14 +202,15 @@ namespace sdr
         {
             return *(new CustomShapeProperties(*this, rObj));
         }
+
         void CustomShapeProperties::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
         {
             TextProperties::Notify( rBC, rHint );
 
             sal_Bool bRemoveRenderGeometry = sal_False;
-
             const SfxStyleSheetHint *pStyleHint = PTR_CAST( SfxStyleSheetHint, &rHint );
             const SfxSimpleHint *pSimpleHint = PTR_CAST( SfxSimpleHint, &rHint );
+
             if ( pStyleHint && pStyleHint->GetStyleSheet() == GetStyleSheet() )
             {
                 switch( pStyleHint->GetHint() )
@@ -218,15 +225,12 @@ namespace sdr
             {
                 bRemoveRenderGeometry = sal_True;
             }
+
             if ( bRemoveRenderGeometry )
             {
+                // update bTextFrame and RenderGeometry
                 UpdateTextFrameStatus();
-
-                // local changes, removing cached objects
-                SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject();
-                rObj.InvalidateRenderGeometry();
             }
-
         }
     } // end of namespace properties
 } // end of namespace sdr
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 4a74a9b..7c6904e 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1719,27 +1719,61 @@ const Rectangle& SdrObjCustomShape::GetLogicRect() const
 {
     return SdrTextObj::GetLogicRect();
 }
-void SdrObjCustomShape::NbcSetSnapRect( const Rectangle& rRect )
+
+// #115391# This implementation is based on the TextFrame size of the CustomShape and the
+// state of the ResizeShapeToFitText flag to correctly set TextMinFrameWidth/Height
+void SdrObjCustomShape::AdaptTextMinSize()
 {
-    aRect=rRect;
-    ImpJustifyRect(aRect);
-    InvalidateRenderGeometry();
-    Rectangle aTextBound( aRect );
-    if ( GetTextBounds( aTextBound ) )
+    if(!pModel || !pModel->IsPasteResize())
     {
-        if ( pModel==NULL || !pModel->IsPasteResize() )
+        const bool bResizeShapeToFitText(0 != static_cast< const SdrTextAutoGrowHeightItem& >(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue());
+        SfxItemSet aSet(GetObjectItemSet());
+        bool bChanged(false);
+
+        if(bResizeShapeToFitText)
         {
-            long nHDist=GetTextLeftDistance()+GetTextRightDistance();
-            long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
-            long nTWdt=aTextBound.GetWidth ()-1-nHDist; if (nTWdt<0) nTWdt=0;
-            long nTHgt=aTextBound.GetHeight()-1-nVDist; if (nTHgt<0) nTHgt=0;
-            if ( IsAutoGrowWidth() )
-                NbcSetMinTextFrameWidth( nTWdt );
-            if ( IsAutoGrowHeight() )
-                NbcSetMinTextFrameHeight( nTHgt );
+            // always reset MinWidthHeight to zero to only rely on text size and frame size
+            // to allow resizing being completely dependent on text size only
+            aSet.Put(SdrTextMinFrameWidthItem(0));
+            aSet.Put(SdrTextMinFrameHeightItem(0));
+            bChanged = true;
+        }
+        else
+        {
+            // recreate from CustomShape-specific TextBounds
+            Rectangle aTextBound(aRect);
+
+            if(GetTextBounds(aTextBound))
+            {
+                const long nHDist(GetTextLeftDistance() + GetTextRightDistance());
+                const long nVDist(GetTextUpperDistance() + GetTextLowerDistance());
+                const long nTWdt(std::max(long(0), (long)(aTextBound.GetWidth() - 1 - nHDist)));
+                const long nTHgt(std::max(long(0), (long)(aTextBound.GetHeight() - 1 - nVDist)));
+                SfxItemSet aSet(GetObjectItemSet());
+
+                aSet.Put(SdrTextMinFrameWidthItem(nTWdt));
+                aSet.Put(SdrTextMinFrameHeightItem(nTHgt));
+                bChanged = true;
+            }
+        }
+
+        if(bChanged)
+        {
+            SetObjectItemSet(aSet);
             NbcAdjustTextFrameWidthAndHeight();
         }
     }
+}
+
+void SdrObjCustomShape::NbcSetSnapRect( const Rectangle& rRect )
+{
+    aRect=rRect;
+    ImpJustifyRect(aRect);
+    InvalidateRenderGeometry();
+
+    // #115391#
+    AdaptTextMinSize();
+
     ImpCheckShear();
     SetRectsDirty();
     SetChanged();
@@ -1758,20 +1792,10 @@ void SdrObjCustomShape::NbcSetLogicRect( const Rectangle& rRect )
     aRect = rRect;
     ImpJustifyRect( aRect );
     InvalidateRenderGeometry();
-    Rectangle aTextBound( aRect );
-    if ( GetTextBounds( aTextBound ) )
-    {
-        long nHDist=GetTextLeftDistance()+GetTextRightDistance();
-        long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
 
-        long nTWdt=aTextBound.GetWidth()-1-nHDist; if (nTWdt<0) nTWdt=0;
-        long nTHgt=aTextBound.GetHeight()-1-nVDist; if (nTHgt<0) nTHgt=0;
-        if ( IsAutoGrowWidth() )
-            NbcSetMinTextFrameWidth( nTWdt );
-        if ( IsAutoGrowHeight() )
-            NbcSetMinTextFrameHeight( nTHgt );
-        NbcAdjustTextFrameWidthAndHeight();
-    }
+    // #115391#
+    AdaptTextMinSize();
+
     SetRectsDirty();
     SetChanged();
 }
@@ -2487,25 +2511,9 @@ FASTBOOL SdrObjCustomShape::EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd )
 {
     DragCreateObject( rStat );
 
-    if ( bTextFrame )
-    {
-        if ( IsAutoGrowHeight() )
-        {
-            // MinTextHeight
-            long nHgt=aRect.GetHeight()-1;
-            if (nHgt==1) nHgt=0;
-            NbcSetMinTextFrameHeight( nHgt );
-        }
-        if ( IsAutoGrowWidth() )
-        {
-            // MinTextWidth
-            long nWdt=aRect.GetWidth()-1;
-            if (nWdt==1) nWdt=0;
-            NbcSetMinTextFrameWidth( nWdt );
-        }
-        // Textrahmen neu berechnen
-        NbcAdjustTextFrameWidthAndHeight();
-    }
+    // #115391#
+    AdaptTextMinSize();
+
     SetRectsDirty();
     return ( eCmd == SDRCREATE_FORCEEND || rStat.GetPointAnz() >= 2 );
 }
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 315979b..716c7a7 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -644,23 +644,51 @@ FASTBOOL SdrTextObj::NbcSetAutoGrowHeight(bool bAuto)
     return sal_False;
 }
 
-FASTBOOL SdrTextObj::NbcSetMinTextFrameHeight(long nHgt)
+// #115391# This implementation is based on the object size (aRect) and the
+// states of IsAutoGrowWidth/Height to correctly set TextMinFrameWidth/Height
+void SdrTextObj::AdaptTextMinSize()
 {
-    if( bTextFrame && ( !pModel || !pModel->isLocked() ) )          // SJ: #i44922#
+    if(bTextFrame && (!pModel || !pModel->isLocked()))
     {
-        SetObjectItem(SdrTextMinFrameHeightItem(nHgt));
+        const bool bW(IsAutoGrowWidth());
+        const bool bH(IsAutoGrowHeight());
 
-        // #84974# use bDisableAutoWidthOnDragging as
-        // bDisableAutoHeightOnDragging if vertical.
-        if(IsVerticalWriting() && bDisableAutoWidthOnDragging)
+        if(bW || bH)
         {
-            bDisableAutoWidthOnDragging = sal_False;
-            SetObjectItem(SdrTextAutoGrowHeightItem(sal_False));
-        }
+            SfxItemSet aSet(GetObjectItemSet());
 
-        return sal_True;
+            if(bW)
+            {
+                const long nDist(GetTextLeftDistance() + GetTextRightDistance());
+                const long nW(std::max(long(0), (long)(aRect.GetWidth() - 1 - nDist)));
+
+                aSet.Put(SdrTextMinFrameWidthItem(nW));
+
+                if(!IsVerticalWriting() && bDisableAutoWidthOnDragging)
+                {
+                    bDisableAutoWidthOnDragging = true;
+                    aSet.Put(SdrTextAutoGrowWidthItem(false));
+                }
+            }
+
+            if(bH)
+            {
+                const long nDist(GetTextUpperDistance() + GetTextLowerDistance());
+                const long nH(std::max(long(0), (long)(aRect.GetHeight() - 1 - nDist)));
+
+                aSet.Put(SdrTextMinFrameHeightItem(nH));
+
+                if(IsVerticalWriting() && bDisableAutoWidthOnDragging)
+                {
+                    bDisableAutoWidthOnDragging = false;
+                    SetObjectItem(SdrTextAutoGrowHeightItem(false));
+                }
+            }
+
+            SetObjectItemSet(aSet);
+            NbcAdjustTextFrameWidthAndHeight();
+        }
     }
-    return sal_False;
 }
 
 FASTBOOL SdrTextObj::NbcSetMaxTextFrameHeight(long nHgt)
@@ -683,25 +711,6 @@ FASTBOOL SdrTextObj::NbcSetAutoGrowWidth(bool bAuto)
     return sal_False;
 }
 
-FASTBOOL SdrTextObj::NbcSetMinTextFrameWidth(long nWdt)
-{
-    if( bTextFrame && ( !pModel || !pModel->isLocked() ) )          // SJ: #i44922#
-    {
-        SetObjectItem(SdrTextMinFrameWidthItem(nWdt));
-
-        // #84974# use bDisableAutoWidthOnDragging only
-        // when not vertical.
-        if(!IsVerticalWriting() && bDisableAutoWidthOnDragging)
-        {
-            bDisableAutoWidthOnDragging = sal_False;
-            SetObjectItem(SdrTextAutoGrowWidthItem(sal_False));
-        }
-
-        return sal_True;
-    }
-    return sal_False;
-}
-
 FASTBOOL SdrTextObj::NbcSetMaxTextFrameWidth(long nWdt)
 {
     if(bTextFrame)
diff --git a/svx/source/svdraw/svdotxdr.cxx b/svx/source/svdraw/svdotxdr.cxx
index ccb6bd0..bc91211 100644
--- a/svx/source/svdraw/svdotxdr.cxx
+++ b/svx/source/svdraw/svdotxdr.cxx
@@ -229,22 +229,10 @@ FASTBOOL SdrTextObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
 {
     rStat.TakeCreateRect(aRect);
     ImpJustifyRect(aRect);
-    if (bTextFrame) {
-        if (IsAutoGrowHeight()) {
-            // MinTextHeight
-            long nHgt=aRect.GetHeight()-1;
-            if (nHgt==1) nHgt=0;
-            NbcSetMinTextFrameHeight(nHgt);
-        }
-        if (IsAutoGrowWidth()) {
-            // MinTextWidth
-            long nWdt=aRect.GetWidth()-1;
-            if (nWdt==1) nWdt=0;
-            NbcSetMinTextFrameWidth(nWdt);
-        }
-        // Textrahmen neu berechnen
-        NbcAdjustTextFrameWidthAndHeight();
-    }
+
+    // #115391#
+    AdaptTextMinSize();
+
     SetRectsDirty();
     if (HAS_BASE(SdrRectObj,this)) {
         ((SdrRectObj*)this)->SetXPolyDirty();
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index e23bc2f..140b039 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -77,14 +77,20 @@ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
         long nTHgt1=rRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0;
         aRect=rRect;
         ImpJustifyRect(aRect);
-        if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139#
-            if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
-            if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
-            if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {
+
+        // #115391#
+        AdaptTextMinSize();
+
+        if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize()))
+        {
+            if(SDRTEXTFIT_RESIZEATTR == GetFitToSize())
+            {
                 NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0));
             }
+
             NbcAdjustTextFrameWidthAndHeight();
         }
+
         ImpCheckShear();
         SetRectsDirty();
     }
@@ -105,14 +111,20 @@ void SdrTextObj::NbcSetLogicRect(const Rectangle& rRect)
     long nTHgt1=rRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0;
     aRect=rRect;
     ImpJustifyRect(aRect);
-    if (bTextFrame) {
-        if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
-        if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
-        if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {
+
+    // #115391#
+    AdaptTextMinSize();
+
+    if(bTextFrame)
+    {
+        if(SDRTEXTFIT_RESIZEATTR == GetFitToSize())
+        {
             NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0));
         }
+
         NbcAdjustTextFrameWidthAndHeight();
     }
+
     SetRectsDirty();
 }
 
@@ -219,16 +231,23 @@ void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
     }
 
     ImpJustifyRect(aRect);
+
     long nTWdt1=aRect.GetWidth ()-1-nHDist; if (nTWdt1<0) nTWdt1=0;
     long nTHgt1=aRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0;
-    if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139#
-        if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
-        if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
-        if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {
+
+    // #115391#
+    AdaptTextMinSize();
+
+    if(bTextFrame && (!pModel || !pModel->IsPasteResize()))
+    {
+        if(SDRTEXTFIT_RESIZEATTR == GetFitToSize())
+        {
             NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0));
         }
+
         NbcAdjustTextFrameWidthAndHeight();
     }
+
     ImpCheckShear();
     SetRectsDirty();
 }
commit 112710dafb2bec3f02e5c578372cf18c561dd880
Author: Armin Le Grand <alg at apache.org>
Date:   Tue Sep 17 09:58:39 2013 +0000

    i123261 corrected name clashes on writer graphic import with multi image support

diff --git a/xmloff/inc/xmloff/xmlmultiimagehelper.hxx b/xmloff/inc/xmloff/xmlmultiimagehelper.hxx
index ea5edc9..6058afd 100644
--- a/xmloff/inc/xmloff/xmlmultiimagehelper.hxx
+++ b/xmloff/inc/xmloff/xmlmultiimagehelper.hxx
@@ -40,7 +40,7 @@ protected:
 
 public:
     multiImageImportHelper();
-    ~multiImageImportHelper();
+    virtual ~multiImageImportHelper();
 
     /// solve multiple imported images. The most valuable one is choosen,
     /// see imlementation for evtl. changing weights and/or adding filetypes.
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index c5e9f72..549dda7 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -425,6 +425,7 @@ class XMLTextFrameContext_Impl : public SvXMLImportContext
     sal_Bool    bSyncHeight : 1;
     sal_Bool    bCreateFailed : 1;
     sal_Bool    bOwnBase64Stream : 1;
+    bool        mbSetNameForFrame : 1; // #123261# remember if to set the NameForFrame
 
     void Create( sal_Bool bHRefOrBase64 );
 
@@ -436,14 +437,14 @@ public:
     const OUString& GetHRef() const { return sHRef; }
 
     XMLTextFrameContext_Impl( SvXMLImport& rImport,
-            sal_uInt16 nPrfx,
-            const ::rtl::OUString& rLName,
-            const ::com::sun::star::uno::Reference<
-                ::com::sun::star::xml::sax::XAttributeList > & rAttrList,
-            ::com::sun::star::text::TextContentAnchorType eAnchorType,
-            sal_uInt16 nType,
-            const ::com::sun::star::uno::Reference<
-                ::com::sun::star::xml::sax::XAttributeList > & rFrameAttrList );
+        sal_uInt16 nPrfx,
+        const ::rtl::OUString& rLName,
+        const ::com::sun::star::uno::Reference<
+        ::com::sun::star::xml::sax::XAttributeList > & rAttrList,
+        ::com::sun::star::text::TextContentAnchorType eAnchorType,
+        sal_uInt16 nType,
+        const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & rFrameAttrList,
+        bool bSetNameForFrame); // #123261# control if to set the NameForFrame
     virtual ~XMLTextFrameContext_Impl();
 
     virtual void EndElement();
@@ -468,10 +469,40 @@ public:
 
     const ::com::sun::star::uno::Reference <
         ::com::sun::star::beans::XPropertySet >& GetPropSet() const { return xPropSet; }
+
+    // #123261# helper to set the NameForFrame
+    void SetNameForFrameFromPropSet();
 };
 
 TYPEINIT1( XMLTextFrameContext_Impl, SvXMLImportContext );
 
+void XMLTextFrameContext_Impl::SetNameForFrameFromPropSet()
+{
+    // set name
+    UniReference < XMLTextImportHelper > xTextImportHelper = GetImport().GetTextImport();
+    Reference < XNamed > xNamed( xPropSet, UNO_QUERY );
+
+    if( xNamed.is() && xTextImportHelper.is() )
+    {
+        OUString sOrigName( xNamed->getName() );
+        if( !sOrigName.getLength() ||
+            (sName.getLength() && sOrigName != sName) )
+        {
+            OUString sOldName( sName );
+            sal_Int32 i = 0;
+            while( xTextImportHelper->HasFrameByName( sName ) )
+            {
+                sName = sOldName;
+                sName += OUString::valueOf( ++i );
+            }
+            xNamed->setName( sName );
+            if( sName != sOldName )
+                xTextImportHelper->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME,
+                                             sOldName, sName );
+        }
+    }
+}
+
 void XMLTextFrameContext_Impl::Create( sal_Bool /*bHRefOrBase64*/ )
 {
     UniReference < XMLTextImportHelper > xTextImportHelper =
@@ -581,26 +612,12 @@ void XMLTextFrameContext_Impl::Create( sal_Bool /*bHRefOrBase64*/ )
 
     Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
 
-    // set name
-    Reference < XNamed > xNamed( xPropSet, UNO_QUERY );
-    if( xNamed.is() )
+    // #123261# set name, but only if wanted, e.g. for MultiImageSupport, it will be set after
+    // it is decided which image will be used. This is done e.g. to avoid double stuff and effects
+    // for the target to avoid double names
+    if(mbSetNameForFrame)
     {
-        OUString sOrigName( xNamed->getName() );
-        if( !sOrigName.getLength() ||
-            (sName.getLength() && sOrigName != sName) )
-        {
-            OUString sOldName( sName );
-            sal_Int32 i = 0;
-            while( xTextImportHelper->HasFrameByName( sName ) )
-            {
-                sName = sOldName;
-                sName += OUString::valueOf( ++i );
-            }
-            xNamed->setName( sName );
-            if( sName != sOldName )
-                xTextImportHelper->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME,
-                                             sOldName, sName );
-        }
+        SetNameForFrameFromPropSet();
     }
 
     // frame style
@@ -805,12 +822,13 @@ sal_Bool XMLTextFrameContext_Impl::CreateIfNotThere()
 }
 
 XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
-        SvXMLImport& rImport,
-        sal_uInt16 nPrfx, const OUString& rLName,
-        const Reference< XAttributeList > & rAttrList,
-        TextContentAnchorType eATyp,
-        sal_uInt16 nNewType,
-        const Reference< XAttributeList > & rFrameAttrList )
+    SvXMLImport& rImport,
+    sal_uInt16 nPrfx, const OUString& rLName,
+    const Reference< XAttributeList > & rAttrList,
+    TextContentAnchorType eATyp,
+    sal_uInt16 nNewType,
+    const Reference< XAttributeList > & rFrameAttrList,
+    bool bSetNameForFrame)
 :   SvXMLImportContext( rImport, nPrfx, rLName )
 ,   mbListContextPushed( false )
 ,   sWidth(RTL_CONSTASCII_USTRINGPARAM("Width"))
@@ -841,6 +859,7 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
 ,   sGraphicServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GraphicObject"))
 ,   nType( nNewType )
 ,   eAnchorType( eATyp )
+,   mbSetNameForFrame(bSetNameForFrame)
 {
     nX = 0;
     nY = 0;
@@ -1441,10 +1460,22 @@ void XMLTextFrameContext::EndElement()
 {
     /// solve if multiple image child contexts were imported
     /// the winner is returned, if something has yet to be done with it
-    /*const SvXMLImportContext* pWinner =*/ solveMultipleImages();
+    const SvXMLImportContext* pWinner = solveMultipleImages();
+
+    // #123261# see if the winner is a XMLTextFrameContext_Impl
+    const XMLTextFrameContext_Impl* pImplWinner = dynamic_cast< const XMLTextFrameContext_Impl* >(pWinner);
+
+    if(pImplWinner)
+    {
+        // #123261# if yes, set name now, after the winner is identified (setting at each
+        // candidate may run into problems due to colliding with efforts in the target to
+        // avoid double names, so only set one name at one image and not at each)
+        const_cast< XMLTextFrameContext_Impl* >(pImplWinner)->SetNameForFrameFromPropSet();
+    }
 
     SvXMLImportContext *pContext = &m_xImplContext;
-    XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
+    XMLTextFrameContext_Impl *pImpl = dynamic_cast< XMLTextFrameContext_Impl* >(pContext);
+
     if( pImpl )
     {
         pImpl->CreateIfNotThere();
@@ -1554,12 +1585,15 @@ SvXMLImportContext *XMLTextFrameContext::CreateChildContext(
 
                 if( !pContext )
                 {
-
-                    pContext = new XMLTextFrameContext_Impl( GetImport(), p_nPrefix,
-                                                        rLocalName, xAttrList,
-                                                        m_eDefaultAnchorType,
-                                                        nFrameType,
-                                                        m_xAttrList );
+                    pContext = new XMLTextFrameContext_Impl(
+                        GetImport(),
+                        p_nPrefix,
+                        rLocalName,
+                        xAttrList,
+                        m_eDefaultAnchorType,
+                        nFrameType,
+                        m_xAttrList,
+                        !getSupportsMultipleContents());
                 }
 
                 m_xImplContext = pContext;
@@ -1575,8 +1609,14 @@ SvXMLImportContext *XMLTextFrameContext::CreateChildContext(
     {
         // read another image
         pContext = new XMLTextFrameContext_Impl(
-            GetImport(), p_nPrefix, rLocalName, xAttrList,
-            m_eDefaultAnchorType, XML_TEXT_FRAME_GRAPHIC, m_xAttrList);
+            GetImport(),
+            p_nPrefix,
+            rLocalName,
+            xAttrList,
+            m_eDefaultAnchorType,
+            XML_TEXT_FRAME_GRAPHIC,
+            m_xAttrList,
+            false);
 
         m_xImplContext = pContext;
         addContent(*m_xImplContext);
commit 00d4805c000539e457aadfa2f81607826c21a284
Author: Pavel Janík <paveljanik at apache.org>
Date:   Thu Sep 12 11:52:51 2013 +0000

    WaE: Remove "comparison between signed and unsigned integer expressions" warning.

diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 43d3545..9753177 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -1421,7 +1421,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd )
                     sal_uInt8* pScanline(mpScanline);
                     sal_uInt8* pScanlineAlpha(mpScanlineAlpha);
 
-                    for(sal_uInt32 nX(0); nX < maOrigSize.Width(); nX++, pTmp += 4)
+                    for(sal_Int32 nX(0); nX < maOrigSize.Width(); nX++, pTmp += 4)
                     {
                         // prepare content line as BGR by reordering when copying
                         // do not forget to invert alpha (source is alpha, target is opacity)
@@ -1556,7 +1556,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd )
 #endif
                     sal_uInt8* pScanline(mpScanline);
 
-                    for(sal_uInt32 nX(0); nX < maOrigSize.Width(); nX++, pTmp += 3)
+                    for(sal_Int32 nX(0); nX < maOrigSize.Width(); nX++, pTmp += 3)
                     {
                         // prepare content line as BGR by reordering when copying
                         if(bCustomColorTable)
commit d7f99e13a1c5425e82e11eb1b49da1ac6b6cc45c
Author: Herbert Dürr <hdu at apache.org>
Date:   Thu Sep 12 09:12:21 2013 +0000

    #i123242# adjust URL for Windows file signing to AOO

diff --git a/solenv/bin/modules/installer/windows/sign.pm b/solenv/bin/modules/installer/windows/sign.pm
index e12c746..b1ec229 100644
--- a/solenv/bin/modules/installer/windows/sign.pm
+++ b/solenv/bin/modules/installer/windows/sign.pm
@@ -654,9 +654,7 @@ sub sign_files
 
     my $productname = "";
     if ( $followmeinfohash->{'allvariableshash'}->{'PRODUCTNAME'} ) { $productname = "/d " . "\"$followmeinfohash->{'allvariableshash'}->{'PRODUCTNAME'}\""; }
-    my $url = "";
-    if (( ! exists($followmeinfohash->{'allvariableshash'}->{'OPENSOURCE'}) ) || ( $followmeinfohash->{'allvariableshash'}->{'OPENSOURCE'} == 0 )) { $url = "/du " . "\"http://www.sun.com\""; }
-    else { $url = "/du " . "\"http://www.openoffice.org\""; }
+    my $url = "/du " . "\"http://www.openoffice.org\"";
     my $timestampurl = "http://timestamp.verisign.com/scripts/timestamp.dll";
 
     my $pfxfilepath = $installer::globals::pfxfile;
commit e4afc9a0ce0865a23faa3b01e408692eed15e30a
Author: Herbert Dürr <hdu at apache.org>
Date:   Thu Sep 12 09:10:54 2013 +0000

    #i123242# adjust URL in the generated NSIS template to AOO

diff --git a/solenv/bin/modules/installer/download.pm b/solenv/bin/modules/installer/download.pm
index 1d7d64d..f92843f 100644
--- a/solenv/bin/modules/installer/download.pm
+++ b/solenv/bin/modules/installer/download.pm
@@ -1107,7 +1107,7 @@ sub put_website_into_template
 {
     my ($templatefile) = @_;
 
-    my $website = "http\:\/\/www\.sun\.com\/staroffice";
+    my $website = "http\:\/\/www\.openoffice\.org";
 
     replace_one_variable($templatefile, "WEBSITEPLACEHOLDER", $website);
 }


More information about the Libreoffice-commits mailing list