ooo-build r14119 - in branches/ooo-build-3-0: . patches/dev300



Author: pflin
Date: Sat Sep 27 07:26:59 2008
New Revision: 14119
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14119&view=rev

Log:
2008-09-27  Fong Lin  <pflin novell com>
	* patches/dev300/apply,
	* patches/dev300/controls-with-images-import.diff: fix the build
	  issue in ooo300-m7.
	* patches/dev300/controls-with-images-import-m4.diff: 
	* patches/dev300/dialog-groupname-persist.diff:
	* patches/dev300/dialog-groupname-persist-m4.diff: 



Added:
   branches/ooo-build-3-0/patches/dev300/controls-with-images-import-m4.diff
   branches/ooo-build-3-0/patches/dev300/dialog-groupname-persist-m4.diff
Removed:
   branches/ooo-build-3-0/patches/dev300/controls-with-images-import-m7-fix.diff
Modified:
   branches/ooo-build-3-0/ChangeLog
   branches/ooo-build-3-0/patches/dev300/apply
   branches/ooo-build-3-0/patches/dev300/controls-with-images-import.diff
   branches/ooo-build-3-0/patches/dev300/dialog-groupname-persist.diff

Modified: branches/ooo-build-3-0/patches/dev300/apply
==============================================================================
--- branches/ooo-build-3-0/patches/dev300/apply	(original)
+++ branches/ooo-build-3-0/patches/dev300/apply	Sat Sep 27 07:26:59 2008
@@ -1581,9 +1581,10 @@
 vba-support-properties-inmodules.diff
 controls-with-images-in-document.diff, i#38215, noelpwer 
 # import graphic for image control
-controls-with-images-import.diff, Fong
+[ VBAObjects < ooo300-m7 ]
+controls-with-images-import-m4.diff, Fong
 [ VBAObjects >= ooo300-m7 ]
-controls-with-images-import-m7-fix.diff, Fong
+controls-with-images-import.diff, Fong
 [ VBAObjects ]
 #use of form control models in userforms/dialogs, additionally
 #enables use of document embedded images in image control for 
@@ -2422,7 +2423,10 @@
 # depends on forms-radio-button-group-names.diff,
 xl-import-formradiobutton.diff, noelpwer, i#30823
 # persist the groupname for basic dialogs also
+[ RadioButtons >= ooo300-m7 ]
 dialog-groupname-persist.diff, noelpwer, i#30823
+[ RadioButtons < ooo300-m7 ]
+dialog-groupname-persist-m4.diff, noelpwer, i#30823
 
 [ NovellOnly ]
 #only enable enhanced field work in Novell OOo by default

Added: branches/ooo-build-3-0/patches/dev300/controls-with-images-import-m4.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-3-0/patches/dev300/controls-with-images-import-m4.diff	Sat Sep 27 07:26:59 2008
@@ -0,0 +1,443 @@
+--- svx/inc/svx/msocximex.hxx.bak	2008-09-01 10:18:35.000000000 +0800
++++ svx/inc/svx/msocximex.hxx	2008-09-01 10:35:13.000000000 +0800
+@@ -32,6 +32,7 @@
+ 
+ #include <sot/storage.hxx>
+ #include <tools/debug.hxx>
++#include <com/sun/star/graphic/XGraphicObject.hpp>
+ 
+ //!! no such defines in global namespaces - it will break other existing code that uses the same define!!
+ //#ifndef C2U
+@@ -327,14 +328,13 @@ public:
+     nMultiState(0), nValueLen(0), nCaptionLen(0), nVertPos(1), nHorzPos(7),
+ 	nSpecialEffect(2), nIcon(0), nPicture(0), nAccelerator(0), nGroupNameLen(0),
+ 	pValue(0), pCaption(0), pGroupName(0), nIconLen(0), pIcon(0),
+-    nPictureLen(0), pPicture(0) {}
++    nPictureLen(0) {}
+ 
+ 	~OCX_ModernControl() {
+ 		if (pValue) delete[] pValue;
+ 		if (pCaption) delete[] pCaption;
+ 		if (pGroupName) delete[] pGroupName;
+ 		if (pIcon) delete[] pIcon;
+-		if (pPicture) delete[] pPicture;
+ 	}
+ 	sal_Bool Read(SotStorageStream *pS);
+ 
+@@ -417,7 +417,8 @@ public:
+ 
+ 	sal_uInt8 pPictureHeader[20];
+ 	sal_uInt32 nPictureLen;
+-	sal_uInt8 *pPicture;
++    ::rtl::OUString sImageUrl;
++	com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
+ 
+ };
+ 
+@@ -466,6 +467,7 @@ public:
+ 
+         bool bAutoSize;
+         ::rtl::OUString sImageUrl;
++		com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
+         sal_Bool Read(SotStorageStream *pS);
+ 
+ 	using OCX_Control::Import; // to not hide the other two import methods
+@@ -817,7 +819,6 @@ public:
+ 	{
+ 		delete[] pCaption;
+ 		delete[] pIcon;
+-		delete[] pPicture;
+ 	}
+ 
+ 	virtual sal_Bool Read(SvStorageStream *pS);
+@@ -881,7 +882,8 @@ public:
+ 
+ 	sal_uInt8 pPictureHeader[20];
+ 	sal_uInt32  nPictureLen;
+-	sal_uInt8 *pPicture;
++    ::rtl::OUString sImageUrl;
++	com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
+ private:
+         com::sun::star::uno::Reference<
+                 com::sun::star::uno::XComponentContext> mxCtx;
+@@ -1076,7 +1078,7 @@ public:
+ 	fEnabled(1), fLocked(0), fBackStyle(1), fWordWrap(0), fAutoSize(0),
+         nCaptionLen(0), nVertPos(1), nHorzPos(7), nMousePointer(0), nPicture(0),
+         nAccelerator(0), nIcon(0), pCaption(0), nIconLen(0), pIcon(0), nPictureLen(0),
+-        pPicture(0), mbTakeFocus( true )
++        mbTakeFocus( true )
+ 	{
+ 	        msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.CommandButton");
+ 	        msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlButtonModel");
+@@ -1087,7 +1089,6 @@ public:
+ 	~OCX_CommandButton() {
+ 		if (pCaption) delete[] pCaption;
+ 		if (pIcon) delete[] pIcon;
+-		if (pPicture) delete[] pPicture;
+ 	}
+ 	sal_Bool Read(SotStorageStream *pS);
+ 
+@@ -1130,7 +1131,8 @@ public:
+ 
+ 	sal_uInt8 pPictureHeader[20];
+ 	sal_uInt32  nPictureLen;
+-	sal_uInt8 *pPicture;
++    ::rtl::OUString sImageUrl;
++	com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
+ 
+     bool        mbTakeFocus;
+ 
+@@ -1248,7 +1250,7 @@ public:
+ 
+ 	sal_uInt8 pPictureHeader[20];
+ 	sal_uInt32  nPictureLen;
+-	sal_uInt8 *pPicture;
++ 	sal_uInt8 *pPicture;
+ 
+ 	static OCX_Control *Create() { return new OCX_Label;}
+ 
+--- svx/source/msfilter/msocximex.cxx.bak	2008-09-01 10:18:35.000000000 +0800
++++ svx/source/msfilter/msocximex.cxx	2008-09-01 10:54:52.000000000 +0800
+@@ -79,6 +79,12 @@
+ 
+ #include <algorithm>
+ #include <memory>
++#include <com/sun/star/graphic/GraphicObject.hpp>
++#include <com/sun/star/graphic/XGraphicProvider.hpp>
++#include <com/sun/star/graphic/XGraphic.hpp>
++#include <com/sun/star/io/XInputStream.hpp>
++#include <comphelper/componentcontext.hxx>
++#include <unotools/streamwrap.hxx>
+ 
+ #ifndef C2S
+ #define C2S(cChar)	String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar))
+@@ -102,6 +108,7 @@ using namespace cppu;
+ 
+ 
+ #define WW8_ASCII2STR(s) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(s))
++#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
+ 
+ 
+ static char sWW8_form[] = "WW-Standard";
+@@ -130,126 +137,48 @@ long ReadAlign(SvStorageStream *pS, long
+     return 0;
+ }
+ 
+-
+ // NP - Images in controls in OO2.0/SO8 exist as links, e.g. they are not part of the document so are
+ // referenced externally. On import from ms document try to save images for controls here.
+ // Images are stored in directory called temp in the user installation directory. Next version of OO/SO
+ // hopefully will address this issue and allow a choice e.g. images for controls to be stored as links
+ // or embeded in the document.
+-
+-// [out]location     path to the stream to where the image is to be stored,
+-//               if same name exists in folder then this function calcuates a new name
+-// [in] data     raw bytes of image to be stored.
+-// [in] dataLen  no. byte to be stored
+-//
+-// returns, true if successful
+-
+-bool storePictureInFileSystem( OUString& location, sal_uInt8* data, sal_uInt32 dataLen )
++uno::Reference< graphic::XGraphicObject> lcl_readGraphicObject( SotStorageStream *pS )
+ {
+-    bool result = true;
+-    OUString origPath = location;
+-    try
+-    {
+-        uno::Reference<lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(),
+-                                                      uno::UNO_QUERY_THROW );
+-        uno::Reference< com::sun::star::ucb::XSimpleFileAccess> xSFA( xMSF->createInstance(
+-                                                       S2U("com.sun.star.ucb.SimpleFileAccess" ) ),
+-                                                       uno::UNO_QUERY_THROW );
+-        OUString ext;
+-        sal_Int32 index = 0;
+-        while (  xSFA->exists( location ) )
+-        {
+-            ext = OUString::valueOf( ++index );
+-            location = origPath + ext;
+-        }
+-
+-        SvStream*  pStream = ::utl::UcbStreamHelper::CreateStream( location, STREAM_WRITE | STREAM_TRUNC );
+-        if ( pStream )
+-        {
+-            pStream->Write(data, dataLen);
+-            delete pStream;
+-        }
+-        else
+-        {
+-            result = false;
+-        }
+-    }
+-    catch( uno::Exception& )
+-    {
+-        result = false;
+-    }
+-    return result;
++	uno::Reference< graphic::XGraphicObject > xGrfObj;
++	uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
++	if( xServiceManager.is() )
++	{
++		try
++		{
++			// use the GraphicProvider service to get the XGraphic
++			uno::Reference< graphic::XGraphicProvider > xGraphProvider(
++					xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ) ), uno::UNO_QUERY );
++			if( xGraphProvider.is() )
++			{
++				uno::Reference< io::XInputStream > xStream( new utl::OInputStreamWrapper( *pS ) );
++				if( xStream.is() )
++				{
++					uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
++					aMediaProps[0].Name = ::rtl::OUString::createFromAscii( "InputStream" );
++					aMediaProps[0].Value <<= xStream;
++					uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( aMediaProps );
++					if( xGraphic.is() )
++					{
++						// create an XGraphicObject
++						::comphelper::ComponentContext aContext( xServiceManager );
++						xGrfObj = graphic::GraphicObject::create( aContext.getUNOContext() );
++						xGrfObj->setGraphic(xGraphic);
++					}
++				}
++			}
++		}
++		catch( uno::Exception& )
++		{
++		}
++	}
++	return xGrfObj;
+ }
+ 
+-// NP - Images in controls in OO2.0/SO8 exist as links, e.g. they are not part of the document so are
+-// referenced externally. On import from ms document try to save images from controls here so this
+-// at least a macro programmer has a chance to accessed them manually later. Next version of OO/SO
+-// hopefully will address this issue.
+-// Images will be stored in a top level folder in the document package, folder is named "MigratedImages"
+-
+-// [in] pDocSh*  the document shell.
+-// [in] name     name of stream image to stored in.
+-// [in] data     raw bytes of image to be stored.
+-// [in] dataLen  no. byte to be stored
+-
+-bool storePictureInDoc( SfxObjectShell* pDocSh, OUString& name, sal_uInt8* data, sal_uInt32 dataLen )
+-{
+-    uno::Reference < embed::XStorage > xStor;
+-    if (pDocSh)
+-    {
+-        xStor = pDocSh->GetStorage();
+-        if( xStor.is() )
+-        {
+-            try
+-            {
+-                uno::Reference< embed::XStorage > xPictures = xStor->openStorageElement(
+-                    OUString( RTL_CONSTASCII_USTRINGPARAM( "MigratedImages" ) ),
+-                    embed::ElementModes::READWRITE );
+-                uno::Reference< beans::XPropertySet > xPropSet( xPictures, uno::UNO_QUERY );
+-
+-                // Set media type of folder MigratedImages to something ( that is unknown ) so that
+-                // it will get copied to exported OO/SO format after SaveAs
+-                if ( xPropSet.is() )
+-                {
+-                    OUString aMediaType = C2U("MigrationImages");
+-                    uno::Any a;
+-                    a <<= aMediaType;
+-                    xPropSet->setPropertyValue( C2U("MediaType"), a );
+-                }
+-
+-                uno::Reference< io::XStream > xObjReplStr = xPictures->openStreamElement(
+-                        name,
+-                        embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
+-                uno::Reference< io::XOutputStream > xOutStream( xObjReplStr->getOutputStream(), uno::UNO_QUERY_THROW );
+-                uno::Sequence< sal_Int8 > imageBytes( (sal_Int8*)data, dataLen );
+-                xOutStream->writeBytes( imageBytes );
+-                xOutStream->closeOutput();
+-
+-                uno::Reference< embed::XTransactedObject > xTransact( xPictures, uno::UNO_QUERY );
+-                if ( xTransact.is() )
+-                {
+-                    xTransact->commit();
+-                }
+-            }
+-            catch( uno::Exception& )
+-            {
+-                return false;
+-            }
+-
+-        }
+-        else
+-        {
+-            // no storage something wrong
+-            return false;
+-        }
+-    }
+-    else
+-    {
+-        //No doc shell
+-        return false;
+-    }
+-    return true;
+-}
+ 
+ long WriteAlign(SvStorageStream *pS, int nAmount)
+ {
+@@ -1243,6 +1172,12 @@ sal_Bool OCX_CommandButton::Import( com:
+     rPropSet->setPropertyValue( WW8_ASCII2STR( "FocusOnClick" ), aTmp );
+ 
+ 	aFontData.Import(rPropSet);
++
++    if ( sImageUrl.getLength() )
++    {
++        aTmp <<= sImageUrl;
++        rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
++    }
+ 	return sal_True;
+ }
+ 
+@@ -1564,6 +1599,12 @@ sal_Bool OCX_OptionButton::Import(com::s
+     }
+ 
+ 	aFontData.Import(rPropSet);
++
++    if ( sImageUrl.getLength() )
++    {
++        aTmp <<= sImageUrl;
++        rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
++    }
+ 	return sal_True;
+ }
+ 
+@@ -2198,6 +2139,12 @@ sal_Bool OCX_ToggleButton::Import(com::s
+ 	}
+ 
+ 	aFontData.Import(rPropSet);
++	
++    if ( sImageUrl.getLength() )
++    {
++        aTmp <<= sImageUrl;
++        rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
++    }
+ 	return sal_True;
+ }
+ 
+@@ -3051,8 +2998,15 @@ sal_Bool OCX_ModernControl::Read(SvStora
+ 	{
+ 		pS->Read(pPictureHeader,20);
+ 		*pS >> nPictureLen;
+-		pPicture = new sal_uInt8[nPictureLen];
+-		pS->Read(pPicture,nPictureLen);
++		long imagePos = pS->Tell();
++		mxGrfObj = lcl_readGraphicObject( pS );
++		if( mxGrfObj.is() )
++		{
++			sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
++			sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
++		}
++		// make sure the stream position should be pointing after the image
++		pS->Seek( imagePos + nPictureLen );
+ 	}
+ 
+ 	return sal_True;
+@@ -3362,8 +3316,15 @@ sal_Bool OCX_CommandButton::Read(SvStora
+ 	{
+ 		pS->Read(pPictureHeader,20);
+ 		*pS >> nPictureLen;
+-		pPicture = new sal_uInt8[nPictureLen];
+-		pS->Read(pPicture,nPictureLen);
++		long imagePos = pS->Tell();
++		mxGrfObj = lcl_readGraphicObject( pS );
++		if( mxGrfObj.is() )
++		{
++			sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
++			sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
++		}
++		// make sure the stream position should be pointing after the image
++		pS->Seek( imagePos + nPictureLen );
+ 	}
+ 
+ 	return sal_True;
+@@ -4140,8 +4101,7 @@ OCX_UserForm::OCX_UserForm( SotStorageRe
+ 		nKeepScrollBarsVisible(3), nCycle(0), nBorderStyle(0), nSpecialEffect(0),
+ 		nPicture(0), nPictureAlignment(2), nPictureSizeMode(0),
+ 		bPictureTiling(FALSE), nAccelerator(0), nIcon(0), pCaption(0),
+-		nScrollWidth(0), nScrollHeight(0), nScrollLeft(0), nScrollTop(0), nIconLen(0), pIcon(0), nPictureLen(0),
+-		pPicture(0)
++		nScrollWidth(0), nScrollHeight(0), nScrollLeft(0), nScrollTop(0), nIconLen(0), pIcon(0), nPictureLen(0)
+ 	{
+             mnForeColor = 0x80000012;
+ 		    mnBackColor = 0x8000000F;
+@@ -4275,8 +4235,15 @@ sal_Bool OCX_UserForm::Read(SvStorageStr
+ 	{
+ 		pS->Read(pPictureHeader,20);
+ 		*pS >> nPictureLen;
+-		pPicture = new sal_uInt8[nPictureLen];
+-		pS->Read(pPicture,nPictureLen);
++		long imagePos = pS->Tell();
++		mxGrfObj = lcl_readGraphicObject( pS );
++		if( mxGrfObj.is() )
++		{
++			sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
++			sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
++		}
++		// make sure the stream position should be pointing after the image
++		pS->Seek( imagePos + nPictureLen );
+ 	}
+ 
+     ReadAlign( pS, pS->Tell() - nStart, 4);
+@@ -4338,6 +4305,19 @@ sal_Bool OCX_UserForm::Import(
+         rLib->replaceByName(sName, aSourceAny);
+     else
+         rLib->insertByName(sName, aSourceAny);
++
++    if ( sImageUrl.getLength() )
++    {
++        aTmp <<= sImageUrl;
++		try
++		{
++        	xDialogPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
++		}
++		catch( uno::Exception& )
++		{
++			OSL_TRACE("OCX_UserForm::Import, Image fails to import");
++		}
++    }
+     return sal_True;
+ }
+ 
+@@ -5016,12 +4996,6 @@ sal_Bool OCX_TabStrip::ReadFontData(SotS
+ 
+ sal_Bool OCX_Image::Read(SotStorageStream *pS)
+ {
+-    if ( !bSetInDialog )
+-    {
+-        // preserve the present behavior at the moment.
+-        // only import image control for UserForms
+-        return sal_False;
+-    }
+     ULONG nStart = pS->Tell();
+ 	*pS >> nIdentifier;
+ 	DBG_ASSERT(nStandardId==nIdentifier,
+@@ -5125,16 +5099,14 @@ sal_Bool OCX_Image::Read(SotStorageStrea
+ 
+         long imagePos = pS->Tell();
+ 
+-        pS->Seek( imagePos );
+-
+-        sImageUrl =  C2U("vnd.sun.star.expand:${$BRAND_BASE_DIR/program/") + C2U( SAL_CONFIGFILE( "bootstrap" ) ) + C2U("::UserInstallation}/user/temp/") + sName;
+-
+-        sal_uInt8* pImage = new sal_uInt8[ nImageLen ];
+-        pS->Read(pImage, nImageLen);
+-        bool result = storePictureInFileSystem( sImageUrl, pImage, nImageLen );
+-        OUString pictName = sImageUrl.copy( sImageUrl.lastIndexOf('/') + 1 );
+-        result = storePictureInDoc( pDocSh, pictName, pImage, nImageLen );
+-        delete pImage;
++		mxGrfObj = lcl_readGraphicObject( pS );
++		if( mxGrfObj.is() )
++		{
++			sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
++			sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
++		}
++		// make sure the stream position should be pointing after the image
++		pS->Seek( imagePos + nImageLen );
+     }
+     return sal_True;
+ }

Modified: branches/ooo-build-3-0/patches/dev300/controls-with-images-import.diff
==============================================================================
--- branches/ooo-build-3-0/patches/dev300/controls-with-images-import.diff	(original)
+++ branches/ooo-build-3-0/patches/dev300/controls-with-images-import.diff	Sat Sep 27 07:26:59 2008
@@ -96,8 +96,8 @@
  
  	static OCX_Control *Create() { return new OCX_Label;}
  
---- svx/source/msfilter/msocximex.cxx.bak	2008-09-01 10:18:35.000000000 +0800
-+++ svx/source/msfilter/msocximex.cxx	2008-09-01 10:54:52.000000000 +0800
+--- svx/source/msfilter/msocximex.cxx.bak	2008-09-27 13:33:48.000000000 +0800
++++ svx/source/msfilter/msocximex.cxx	2008-09-27 13:38:59.000000000 +0800
 @@ -79,6 +79,12 @@
  
  #include <algorithm>
@@ -280,7 +280,7 @@
  
  long WriteAlign(SvStorageStream *pS, int nAmount)
  {
-@@ -1243,6 +1172,12 @@ sal_Bool OCX_CommandButton::Import( com:
+@@ -1413,6 +1342,12 @@ sal_Bool OCX_CommandButton::Import( com:
      rPropSet->setPropertyValue( WW8_ASCII2STR( "FocusOnClick" ), aTmp );
  
  	aFontData.Import(rPropSet);
@@ -293,8 +293,8 @@
  	return sal_True;
  }
  
-@@ -1564,6 +1599,12 @@ sal_Bool OCX_OptionButton::Import(com::s
-     }
+@@ -1710,6 +1645,12 @@ sal_Bool OCX_OptionButton::Import(com::s
+     rPropSet->setPropertyValue( WW8_ASCII2STR("VerticalAlign"), aTmp );
  
  	aFontData.Import(rPropSet);
 +
@@ -306,7 +306,7 @@
  	return sal_True;
  }
  
-@@ -2198,6 +2139,12 @@ sal_Bool OCX_ToggleButton::Import(com::s
+@@ -2344,6 +2285,12 @@ sal_Bool OCX_ToggleButton::Import(com::s
  	}
  
  	aFontData.Import(rPropSet);
@@ -319,7 +319,7 @@
  	return sal_True;
  }
  
-@@ -3051,8 +2998,15 @@ sal_Bool OCX_ModernControl::Read(SvStora
+@@ -3197,8 +3144,15 @@ sal_Bool OCX_ModernControl::Read(SvStora
  	{
  		pS->Read(pPictureHeader,20);
  		*pS >> nPictureLen;
@@ -337,7 +337,7 @@
  	}
  
  	return sal_True;
-@@ -3362,8 +3316,15 @@ sal_Bool OCX_CommandButton::Read(SvStora
+@@ -3288,8 +3242,15 @@ sal_Bool OCX_CommandButton::Read(SvStora
  	{
  		pS->Read(pPictureHeader,20);
  		*pS >> nPictureLen;
@@ -355,7 +355,7 @@
  	}
  
  	return sal_True;
-@@ -4140,8 +4101,7 @@ OCX_UserForm::OCX_UserForm( SotStorageRe
+@@ -4053,8 +4014,7 @@ OCX_UserForm::OCX_UserForm( SotStorageRe
  		nKeepScrollBarsVisible(3), nCycle(0), nBorderStyle(0), nSpecialEffect(0),
  		nPicture(0), nPictureAlignment(2), nPictureSizeMode(0),
  		bPictureTiling(FALSE), nAccelerator(0), nIcon(0), pCaption(0),
@@ -365,7 +365,7 @@
  	{
              mnForeColor = 0x80000012;
  		    mnBackColor = 0x8000000F;
-@@ -4275,8 +4235,15 @@ sal_Bool OCX_UserForm::Read(SvStorageStr
+@@ -4188,8 +4148,15 @@ sal_Bool OCX_UserForm::Read(SvStorageStr
  	{
  		pS->Read(pPictureHeader,20);
  		*pS >> nPictureLen;
@@ -383,7 +383,7 @@
  	}
  
      ReadAlign( pS, pS->Tell() - nStart, 4);
-@@ -4338,6 +4305,19 @@ sal_Bool OCX_UserForm::Import(
+@@ -4247,6 +4214,19 @@ sal_Bool OCX_UserForm::Import(
          rLib->replaceByName(sName, aSourceAny);
      else
          rLib->insertByName(sName, aSourceAny);
@@ -403,7 +403,7 @@
      return sal_True;
  }
  
-@@ -5016,12 +4996,6 @@ sal_Bool OCX_TabStrip::ReadFontData(SotS
+@@ -5185,12 +5165,6 @@ sal_Bool OCX_TabStrip::ReadFontData(SotS
  
  sal_Bool OCX_Image::Read(SotStorageStream *pS)
  {
@@ -416,7 +416,7 @@
      ULONG nStart = pS->Tell();
  	*pS >> nIdentifier;
  	DBG_ASSERT(nStandardId==nIdentifier,
-@@ -5125,16 +5099,14 @@ sal_Bool OCX_Image::Read(SotStorageStrea
+@@ -5281,16 +5255,14 @@ sal_Bool OCX_Image::Read(SotStorageStrea
  
          long imagePos = pS->Tell();
  

Added: branches/ooo-build-3-0/patches/dev300/dialog-groupname-persist-m4.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-3-0/patches/dev300/dialog-groupname-persist-m4.diff	Sat Sep 27 07:26:59 2008
@@ -0,0 +1,367 @@
+diff --git svx/inc/svx/msocximex.hxx svx/inc/svx/msocximex.hxx
+index f3bda14..c94eaeb 100644
+--- svx/inc/svx/msocximex.hxx
++++ svx/inc/svx/msocximex.hxx
+@@ -290,6 +290,7 @@ public:
+         sal_uInt16 mnTabPos;
+ 	UniString sName;
+ 	UniString msToolTip;
++	UniString msParentName;
+ 	OCX_FontData aFontData;
+         SfxObjectShell *pDocSh;
+ protected:
+@@ -506,54 +507,8 @@ typedef std::vector<OCX_Control*>::iterator CtrlIterator;
+ typedef std::vector<OCX_Control*>::const_iterator CtrlIteratorConst;
+ typedef std::vector<OCX_Control*>  CtrlList;
+ 
+-
+-
+-class RBGroup
+-{
+-    public:
+-    RBGroup():mRBGroupPos(0){}
+-    RBGroup(sal_uInt16& groupPos ):mRBGroupPos(groupPos){}
+-    sal_Int16 tabPos() const { return mRBGroupPos; }
+-    std::vector<OCX_Control*>::size_type numControls()
+-    { return mpControls.size(); }
+-    std::vector<OCX_Control*>& controls() { return mpControls; }
+-
+-    void add(OCX_Control* pRB);
+-    private:
+-    sal_uInt16 mRBGroupPos;
+-    std::vector<OCX_Control*> mpControls;
+-};
+-
+-typedef ::std::hash_map < ::rtl::OUString, RBGroup*, ::rtl::OUStringHash,
+-    ::std::equal_to< ::rtl::OUString > > RBGroupHash;
+-typedef std::vector<RBGroup*>::iterator GroupIterator;
+-
+ class OCX_OptionButton;
+ 
+-class RBGroupManager
+-{
+-public:
+-    RBGroupManager( String& defaultName );
+-    ~RBGroupManager();
+-
+-    CtrlList insertGroupsIntoControlList( const CtrlList& sourceList );
+-    void addRadioButton( OCX_OptionButton* pRButton );
+-private:
+-
+-    void addSeperator( std::vector< OCX_Control* >& dest );
+-    void copyList( std::vector< OCX_Control* >& src,
+-                  std::vector< OCX_Control* >& dest,
+-                  bool addGroupSeperator );
+-
+-    RBGroupHash rbGroups;
+-    String mSDefaultName;
+-    std::vector< RBGroup* > groupList;
+-    sal_uInt16 numRadioButtons;
+-};
+-
+-
+-
+-
+ class OCX_ContainerControl : public OCX_Control
+ {
+ public:
+@@ -593,7 +548,6 @@ protected:
+             OCX_Control* pParent = NULL );
+         rtl::OUString createSubStreamName( const sal_uInt32& subStorageID );
+ 
+-        RBGroupManager rbGroupMgr;
+         com::sun::star::uno::Reference<
+                 com::sun::star::container::XNameContainer > mxParent;
+ 	std::vector<OCX_Control*> mpControls;
+diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
+index ef7ca77..530a5ce 100644
+--- svx/source/msfilter/msocximex.cxx
++++ svx/source/msfilter/msocximex.cxx
+@@ -908,176 +908,6 @@ class ContainerRecordReaderFac
+ 
+ // ============================================================================
+ 
+-void RBGroup::add(OCX_Control* pRB)
+-{
+-    // The tab index for the group is calculated as
+-    // the lowest tab index found in the list of RadioButtons
+-    if ( pRB->mnTabPos < mRBGroupPos )
+-    {
+-        mRBGroupPos = pRB->mnTabPos;
+-        CtrlIterator aEnd = mpControls.end();
+-        for (CtrlIterator aIter = mpControls.begin(); aIter != aEnd; ++ aIter )
+-        {
+-            (*aIter)->mnTabPos = mRBGroupPos;
+-        }
+-    }
+-    mpControls.push_back( pRB );
+-}
+-
+-struct SortGroupByTabPos
+-{
+-    bool operator()( const RBGroup* a, const RBGroup* b )
+-    {
+-        return a->tabPos() < b->tabPos();
+-    }
+-};
+-
+-RBGroupManager::RBGroupManager( String& defaultName ):mSDefaultName( defaultName ),
+-    numRadioButtons(0)
+-{
+-    groupList.reserve( 8 ); // reserve far more than we expect
+-}
+-
+-RBGroupManager::~RBGroupManager()
+-{
+-    for ( GroupIterator gIter=groupList.begin(); gIter!=groupList.end(); ++gIter )
+-    {
+-        delete( *gIter );
+-    }
+-}
+-
+-// Loose description of the method below ( I sure there is a better way to do
+-// this )
+-// In order to "fake" MS grouping behavior for OptionButtons the OptionButtons
+-// in the same group need to have consecutive tab indices ( regardless of the
+-// imported tab indices of the RadioButtons ). Additionally if two
+-// groups of OptionButtons end up having all consecutive indices they
+-// will be treated as a single group by OpenOffice. In this case
+-// a dummy seperator control needs to be inserted between the groups.
+-//
+-// This method returns a new list "destinationList" containing the controls
+-// passed in "sourceList" and the OptionButtons contained in the various
+-// Groups maintained by this  class.
+-// Controls are ordered in the destination list by tab index.
+-// Each RadioButtonGroup has a tab index associated with it.
+-// ( Tab index of a RadioGroup is determined as the tab index of the
+-// OptionButton control with the lowest tab index in the group )
+-
+-
+-void RBGroupManager::addRadioButton( OCX_OptionButton* pRButton )
+-{
+-    if ( pRButton )
+-    {
+-        OUString groupName = mSDefaultName;
+-        if ( pRButton->nGroupNameLen )
+-        {
+-            groupName =
+-                lclCreateOUString(pRButton->pGroupName,
+-                    pRButton->nGroupNameLen);
+-        }
+-        ++numRadioButtons;
+-        RBGroupHash::iterator iter = rbGroups.find( groupName );
+-        if ( iter != rbGroups.end() )
+-        {
+-            iter->second->controls().push_back( pRButton );
+-        }
+-        else
+-        {
+-            RBGroup* newGroup = new RBGroup(pRButton->mnTabPos);
+-            newGroup->controls().push_back( pRButton );
+-            rbGroups[ groupName ] = newGroup;
+-            groupList.push_back( newGroup );
+-        }
+-
+-    }
+-}
+-
+-CtrlList RBGroupManager::insertGroupsIntoControlList( const CtrlList& sourceList )
+-{
+-    ::std::sort( groupList.begin(), groupList.end(), SortGroupByTabPos() );
+-    std::vector<OCX_Control*> destinationList;
+-    if ( groupList.size() )
+-    {
+-        destinationList.reserve( sourceList.size() + numRadioButtons );
+-
+-        GroupIterator groupEnd = groupList.end();
+-        CtrlIteratorConst sourceEnd = sourceList.end();
+-
+-        size_t prevGroupListSize = 0;
+-
+-        CtrlIteratorConst containees = sourceList.begin();
+-        GroupIterator groupIter=groupList.begin();
+-        while ( containees != sourceEnd ||
+-                groupIter != groupEnd )
+-        {
+-            bool addGroupSeperator = false;
+-            if ( containees != sourceEnd )
+-            {
+-                if ( groupIter != groupEnd )
+-                {
+-                    sal_Int16 groupTabPos = (*groupIter)->tabPos();
+-                    if ( (*containees)->mnTabPos >= groupTabPos )
+-                    {
+-                       if ( !(destinationList.size() >=  prevGroupListSize ))
+-                        {
+-                            addGroupSeperator = true;
+-                        }
+-                        copyList( (*groupIter)->controls(), destinationList, addGroupSeperator );
+-                        ++groupIter;
+-
+-                        prevGroupListSize = destinationList.size();
+-                    }
+-                }
+-                destinationList.push_back(*containees);
+-                ++containees;
+-            }
+-            else
+-            {
+-               if ( groupIter != groupEnd )
+-               {
+-                    if ( !(destinationList.size() >  prevGroupListSize ))
+-                    {
+-                        addGroupSeperator = true;
+-                    }
+-                    copyList( (*groupIter)->controls(), destinationList, addGroupSeperator );
+-                    ++groupIter;
+-                    prevGroupListSize = destinationList.size();
+-                }
+-            }
+-        }
+-    }
+-    else
+-    {
+-        destinationList = sourceList;
+-    }
+-    return destinationList;
+-
+-}
+-
+-
+-void RBGroupManager::addSeperator( std::vector< OCX_Control* >& dest )
+-{
+-    OCX_Control* seperator = new OCX_CommandButton;
+-    seperator->SetInDialog(true);
+-    seperator->sName = C2S("GroupSeperator");
+-    dest.push_back( seperator );
+-}
+-
+-void RBGroupManager::copyList( std::vector< OCX_Control* >& src,
+-    std::vector< OCX_Control* >& dest,
+-    bool addGroupSeperator )
+-{
+-    if ( addGroupSeperator )
+-    {
+-        addSeperator( dest );
+-    }
+-
+-    for ( CtrlIterator rbIter = src.begin(); rbIter != src.end(); ++rbIter )
+-    {
+-        dest.push_back( *rbIter );
+-    }
+-}
+-
+ class OCX_UserFormLabel : public OCX_Label
+ {
+ public:
+@@ -1854,9 +1684,27 @@ sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
+     aTmp <<= ::com::sun::star::style::VerticalAlignment_MIDDLE;
+     rPropSet->setPropertyValue( WW8_ASCII2STR("VerticalAlign"), aTmp );
+ 
+-    if ( pGroupName )
++    // If this is a dialog control then we need to  set a groupname *always*
++    rtl::OUString sGroupName = lclCreateOUString( pGroupName, nGroupNameLen );
++    if ( GetInDialog() ) // Userform/Dialog
++    {
++        // By default groupnames are not set in Excel, it's not unusual to have
++        // a number of groups of radiobuttons located inside frame ( or other container
++        // controls ) where there is *no* specific groupname set for the radiobuttons.
++        // But... there is implicit grouping for radio buttons in seperate containers
++        // e.g. radio buttons in a frame are by default in the same group.
++        // Unfortunately in openoffice there are no containers below the dialog itself :-(
++        // To ensure correct grouping for imported radiobuttons either with no groupname
++        // or identical groupnames that are in separate containers we *must* ensure
++        // that a suitable groupname is applied. 
++        // Because controlNames are unique even across different containers we can use the
++        // controls container (e.g. parent) name as a prefix for a group name
++	rtl::OUString sParentName = msParentName;
++        sGroupName = sParentName.concat( C2U( ":" ) ).concat( sGroupName );
++    }
++    if ( sGroupName.getLength() > 0 )
+     {
+-        aTmp <<= lclCreateOUString( pGroupName, nGroupNameLen );
++        aTmp <<= sGroupName;
+         rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp);
+     }
+ 	uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
+@@ -3566,7 +3414,7 @@ OCX_ContainerControl::OCX_ContainerControl( SotStorageRef& parent,
+             const ::rtl::OUString& sN,
+             const uno::Reference< container::XNameContainer >  &rParent,
+             OCX_Control* pParent ) :
+-                OCX_Control(sN, pParent), rbGroupMgr( sName ), mxParent(rParent), nNoRecords(0), nTotalLen(0), containerType( STDCONTAINER )
++                OCX_Control(sN, pParent), mxParent(rParent), nNoRecords(0), nTotalLen(0), containerType( STDCONTAINER )
+ {
+ 
+     mContainerStorage = parent->OpenSotStorage(storageName,
+@@ -3800,6 +3648,7 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
+             // applied to all containees
+             pControl->mnStep = mnStep;
+         }
++        pControl->msParentName = sName;
+ 
+         // #117490# DR: container records provide size of substream, use it here...
+ 
+@@ -3810,17 +3659,7 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
+         // set stream to position behind substream of this control
+         oStream->Seek( nStrmPos + rec.nSubStreamLen );
+ 
+-        //need to fake grouping behaviour for radio ( option ) buttons
+-        if ( rec.nTypeIdent == OPTIONBUTTON )
+-        {
+-            OCX_OptionButton* pRButton =
+-                static_cast< OCX_OptionButton*>(pControl);
+-            rbGroupMgr.addRadioButton( pRButton );
+-        }
+-        else
+-        {
+-            mpControls.push_back( pControl );
+-        }
++        mpControls.push_back( pControl );
+     }
+ }
+ 
+@@ -3843,7 +3682,6 @@ sal_Bool OCX_ContainerControl::Read(SvStorageStream *pS)
+     // this ensures that the default tab index created by Star/Open office
+     // reflects the "flattened" ms tab order.
+     ::std::sort( mpControls.begin(), mpControls.end(), SortOrderByTabPos() );
+-    mpControls = rbGroupMgr.insertGroupsIntoControlList( mpControls );
+ 	return true;
+ }
+ 
+diff --git xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+index ac4444e..7488f94 100644
+--- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
++++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+@@ -452,6 +452,8 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference<
+                            OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
+     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
++    readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
++                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":group-name") ) );
+ 
+     sal_Int16 nState = 0;
+     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
+diff --git xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+index e47c033..310b3a6 100644
+--- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
++++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+@@ -1521,6 +1521,9 @@ void TitledBoxElement::endElement()
+         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+                                    OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
+                                    xAttributes );
++        ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
++                                  OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
++                                  xAttributes );
+ 		
+ 		sal_Int16 nVal = 0;
+ 		sal_Bool bChecked = sal_False;
+@@ -1662,6 +1665,9 @@ void RadioGroupElement::endElement()
+         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+                                    OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
+                                    xAttributes );
++        ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
++                                  OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
++                                  xAttributes );
+ 		sal_Int16 nVal = 0;
+ 		sal_Bool bChecked = sal_False;
+ 		if (getBoolAttr( &bChecked,

Modified: branches/ooo-build-3-0/patches/dev300/dialog-groupname-persist.diff
==============================================================================
--- branches/ooo-build-3-0/patches/dev300/dialog-groupname-persist.diff	(original)
+++ branches/ooo-build-3-0/patches/dev300/dialog-groupname-persist.diff	Sat Sep 27 07:26:59 2008
@@ -77,7 +77,7 @@
 index ef7ca77..530a5ce 100644
 --- svx/source/msfilter/msocximex.cxx
 +++ svx/source/msfilter/msocximex.cxx
-@@ -908,176 +908,6 @@ class ContainerRecordReaderFac
+@@ -909,176 +909,6 @@ class ContainerRecordReaderFac
  
  // ============================================================================
  
@@ -254,7 +254,7 @@
  class OCX_UserFormLabel : public OCX_Label
  {
  public:
-@@ -1854,9 +1684,27 @@ sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
+@@ -1901,9 +1731,27 @@ sal_Bool OCX_OptionButton::Import(com::s
      aTmp <<= ::com::sun::star::style::VerticalAlignment_MIDDLE;
      rPropSet->setPropertyValue( WW8_ASCII2STR("VerticalAlign"), aTmp );
  
@@ -284,7 +284,7 @@
          rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp);
      }
  	uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-@@ -3566,7 +3414,7 @@ OCX_ContainerControl::OCX_ContainerControl( SotStorageRef& parent,
+@@ -3640,7 +3488,7 @@ OCX_ContainerControl::OCX_ContainerContr
              const ::rtl::OUString& sN,
              const uno::Reference< container::XNameContainer >  &rParent,
              OCX_Control* pParent ) :
@@ -293,7 +293,7 @@
  {
  
      mContainerStorage = parent->OpenSotStorage(storageName,
-@@ -3800,6 +3648,7 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
+@@ -3873,6 +3721,7 @@ void OCX_ContainerControl::ProcessContro
              // applied to all containees
              pControl->mnStep = mnStep;
          }
@@ -301,7 +301,7 @@
  
          // #117490# DR: container records provide size of substream, use it here...
  
-@@ -3810,17 +3659,7 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
+@@ -3883,17 +3732,7 @@ void OCX_ContainerControl::ProcessContro
          // set stream to position behind substream of this control
          oStream->Seek( nStrmPos + rec.nSubStreamLen );
  
@@ -320,7 +320,7 @@
      }
  }
  
-@@ -3843,7 +3682,6 @@ sal_Bool OCX_ContainerControl::Read(SvStorageStream *pS)
+@@ -3916,7 +3755,6 @@ sal_Bool OCX_ContainerControl::Read(SvSt
      // this ensures that the default tab index created by Star/Open office
      // reflects the "flattened" ms tab order.
      ::std::sort( mpControls.begin(), mpControls.end(), SortOrderByTabPos() );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]