incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liji...@apache.org
Subject svn commit: r1383298 - in /incubator/ooo/trunk/main: filter/inc/filter/msfilter/ filter/source/msfilter/ sd/source/filter/eppt/
Date Tue, 11 Sep 2012 09:00:22 GMT
Author: lijiany
Date: Tue Sep 11 09:00:21 2012
New Revision: 1383298

URL: http://svn.apache.org/viewvc?rev=1383298&view=rev
Log:
#119467# Form controls cannot be saved into .ppt file in AOO3.4
Reported by: Du Jing
Patch by: Jianyuan Li
Review by: sunying

Modified:
    incubator/ooo/trunk/main/filter/inc/filter/msfilter/escherex.hxx
    incubator/ooo/trunk/main/filter/inc/filter/msfilter/msocximex.hxx
    incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx
    incubator/ooo/trunk/main/filter/source/msfilter/msocximex.cxx
    incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.cxx
    incubator/ooo/trunk/main/sd/source/filter/eppt/epptso.cxx

Modified: incubator/ooo/trunk/main/filter/inc/filter/msfilter/escherex.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/inc/filter/msfilter/escherex.hxx?rev=1383298&r1=1383297&r2=1383298&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/inc/filter/msfilter/escherex.hxx (original)
+++ incubator/ooo/trunk/main/filter/inc/filter/msfilter/escherex.hxx Tue Sep 11 09:00:21 2012
@@ -1219,7 +1219,7 @@ class MSFILTER_DLLPUBLIC EscherPropertyC
 		sal_Bool	CreateGraphicProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet
> & rXPropSet,
 						const String& rSource, const sal_Bool bCreateFillBitmap, const sal_Bool bCreateCroppingAttributes
= sal_False,
 							const sal_Bool bFillBitmapModeAllowed = sal_True );
-
+		sal_Bool   CreateBlipPropertiesforOLEControl( const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > & rXPropSet, const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShape > & rXShape);
 		sal_Bool	CreatePolygonProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet
> & rXPropSet,
 						sal_uInt32 nFlags, sal_Bool bBezier, ::com::sun::star::awt::Rectangle& rGeoRect,
Polygon* pPolygon = NULL );
 

Modified: incubator/ooo/trunk/main/filter/inc/filter/msfilter/msocximex.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/inc/filter/msfilter/msocximex.hxx?rev=1383298&r1=1383297&r2=1383298&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/inc/filter/msfilter/msocximex.hxx (original)
+++ incubator/ooo/trunk/main/filter/inc/filter/msfilter/msocximex.hxx Tue Sep 11 09:00:21
2012
@@ -172,7 +172,7 @@ class OCX_FontData
 {
 public:
 	OCX_FontData() : nFontNameLen(0), fBold(0), fItalic(0), fUnderline(0),
-		fStrike(0), nFontSize(12), nJustification(1), pFontName(0),
+		fStrike(0), nFontSize(12), nJustification(1), nDefaultAlign(0), pFontName(0),
         bHasAlign(sal_False), bHasFont(sal_True) {}
 	~OCX_FontData()  {
 		if (pFontName)
@@ -206,7 +206,7 @@ public:
 	sal_uInt16 nLanguageID;
 	sal_uInt8   nJustification;
     sal_uInt16  nFontWeight;
-
+	sal_Int16 nDefaultAlign;
 	char *pFontName;
 	void SetHasAlign(sal_Bool bIn) {bHasAlign=bIn;}
 	void SetHasFont(sal_Bool bIn) {bHasFont=bIn;}
@@ -1115,6 +1115,7 @@ public:
 	        msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlButtonModel");
 	        mnForeColor = 0x80000012L;
                 mnBackColor = 0x8000000FL;
+                aFontData.SetHasAlign(sal_True);
 	}
 
 	~OCX_CommandButton() {

Modified: incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx?rev=1383298&r1=1383297&r2=1383298&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx Tue Sep 11 09:00:21 2012
@@ -24,6 +24,7 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_filter.hxx"
 #include "eschesdo.hxx"
+#include <svx/svdxcgv.hxx>
 #include <svx/svdomedia.hxx>
 #include <svx/xflftrit.hxx>
 #include <filter/msfilter/escherex.hxx>
@@ -3661,6 +3662,37 @@ MSO_SPT EscherPropertyContainer::GetCust
 }
 
 // ---------------------------------------------------------------------------------------------
+//Implement for form control export
+sal_Bool   EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > & rXPropSet, const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShape > & rXShape)
+{
+	SdrObject* pShape = GetSdrObjectFromXShape( rXShape );
+	if ( pShape )
+	{
+		SdrModel* pMod = pShape->GetModel();
+		Graphic aGraphic(SdrExchangeView::GetObjGraphic( pMod, pShape));
+		
+        GraphicObject   aGraphicObject = aGraphic;
+        ByteString  aUniqueId = aGraphicObject.GetUniqueID();
+		if ( aUniqueId.Len() )
+		{
+			if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
+			{
+				Rectangle aRect( Point( 0, 0 ), pShapeBoundRect->GetSize() );
+				
+				sal_uInt32 nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId, aRect,
NULL );
+				if ( nBlibId )
+				{					
+					AddOpt( ESCHER_Prop_pib, nBlibId, sal_True );
+					ImplCreateGraphicAttributes( rXPropSet, nBlibId, sal_False );
+					return sal_True;
+				}
+			}
+		}
+	}
+
+	return sal_False;
+
+}
 
 EscherPersistTable::EscherPersistTable()
 {

Modified: incubator/ooo/trunk/main/filter/source/msfilter/msocximex.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/msfilter/msocximex.cxx?rev=1383298&r1=1383297&r2=1383298&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/msfilter/msocximex.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/msfilter/msocximex.cxx Tue Sep 11 09:00:21 2012
@@ -1370,10 +1370,11 @@ sal_Bool OCX_CommandButton::Import( com:
 	aTmp <<= ImportColor(mnForeColor);
 	rPropSet->setPropertyValue( WW8_ASCII2STR("TextColor"), aTmp);
 
-    // fake transparent push button by setting window background color
-    if( !fBackStyle )
-        mnBackColor = 0x80000005;
-	aTmp <<= ImportColor(mnBackColor);
+	//fBackStyle is a flag. 1 means with background color. 0 means default.
+	if( fBackStyle )
+		aTmp <<= ImportColor(mnBackColor);
+	else
+		aTmp = uno::Any();
 	rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
 
 	sal_Bool bTemp;
@@ -1432,18 +1433,21 @@ sal_Bool OCX_CommandButton::WriteContent
 	    aTmp >>= mnForeColor;
 	*rContents << ExportColor(mnForeColor);
 
+	//fBackStyle is a flag. 1 means with background color. 0 means default.
 	aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor"));
     if (aTmp.hasValue())
 	    aTmp >>= mnBackColor;
+	else
+		fBackStyle = 0;
 	*rContents << ExportColor(mnBackColor);
 
 	aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled"));
 	fEnabled = any2bool(aTmp);
 	sal_uInt8 nTemp=0;//fEnabled;
 	if (fEnabled)
-		nTemp |= 0x02;
+		nTemp |= 0x02;//has enabled prop
     if (fBackStyle)
-        nTemp |= 0x08;
+        nTemp |= 0x08;//has background color
 	*rContents << nTemp;
 	*rContents << sal_uInt8(0x00);
 
@@ -1468,7 +1472,7 @@ sal_Bool OCX_CommandButton::WriteContent
     mbTakeFocus = any2bool( rPropSet->getPropertyValue( WW8_ASCII2STR( "FocusOnClick"
) ) );
 
     nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
-
+	aFontData.nDefaultAlign = 1;
 	bRet = aFontData.Export(rContents,rPropSet);
 
     rContents->Seek(nOldPos);
@@ -5078,13 +5082,46 @@ sal_Bool OCX_FontData::Export(SvStorageS
 	if (bHasFont)
 	{
 		aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("FontWeight"));
-		float nBold = 0;
-		aTmp >>= nBold;
+		//Export font related props
+		if ( aTmp.hasValue() ) 
+		{
+			float nBold = 0.0;
+			aTmp >>= nBold;
+			if ( nBold >= 150 )
+				fBold = 1;
+		}
+
+		aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("FontSlant"));
+		if ( aTmp.hasValue() )
+		{
+			short eItalic = 0 ;
+			aTmp >>= eItalic ;
+			if ( eItalic == awt::FontSlant_ITALIC )
+				fItalic = 1;
+		}
 
-		if (nBold >= 150)
+		aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("FontUnderline"));
+		if ( aTmp.hasValue() )
+		{
+			short eUnderline = 0 ;
+			aTmp >>= eUnderline;
+			if ( eUnderline == awt::FontUnderline::SINGLE )
+				fUnderline = 1;
+		}
+	
+		aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("FontStrikeout"));
+		if ( aTmp.hasValue() )
+		{
+			short eLtStrikeout = 0;
+			aTmp >>= eLtStrikeout;
+			if ( eLtStrikeout == awt::FontStrikeout::SINGLE )
+				fStrike = 1;
+		}	
+		
+		sal_uInt8 nTmp= 1 * fBold  +  2* fItalic  + 4* fUnderline +  8 * fStrike; 
+		if ( nTmp > 0 )
 		{
 			nFlags |= 0x02;
-			sal_uInt8 nTmp=0x01;
 			*rContent << nTmp;
 			nTmp=0x00;
 			*rContent << nTmp;
@@ -5114,7 +5151,7 @@ sal_Bool OCX_FontData::Export(SvStorageS
 
 			aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Align"));
 			nFlags |= 0x40;
-			sal_Int16 nAlign(0);
+			sal_Int16 nAlign = nDefaultAlign;
             if (aTmp.hasValue())
 			    aTmp >>= nAlign;
 			nJustification = ExportAlign(nAlign);
@@ -5588,6 +5625,7 @@ sal_Bool OCX_SpinButton::Export(
         0x00, 0x00, 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64,
         0x64, 0x65, 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65,
         0x63, 0x74, 0x00, 0x13, 0x00, 0x00, 0x00, 0x46,
+        0x6F, 0x72, 0x6D, 0x73, 0x2E, 0x53, 0x70, 0x69,//Add those to avoid MS crash when
open
         0x6E, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x2E,
         0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00,
         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

Modified: incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.cxx?rev=1383298&r1=1383297&r2=1383298&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.cxx (original)
+++ incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.cxx Tue Sep 11 09:00:21 2012
@@ -1826,7 +1826,8 @@ void PPTWriter::ImplWriteOLE( sal_uInt32
                 if ( pPtr->xControlModel.is() )
                 {
                     String aName;
-                    ::com::sun::star::awt::Size aSize;
+                    //Initialize the graphic size which will be used on export
+                    ::com::sun::star::awt::Size  aSize( pPtr->xShape->getSize() );
                     SvStorageRef xDest( new SvStorage( new SvMemoryStream(), sal_True ) );
                     sal_Bool bOk = SvxMSConvertOCXControls::WriteOCXStream( xDest, pPtr->xControlModel,
aSize, aName );
                     if ( bOk )

Modified: incubator/ooo/trunk/main/sd/source/filter/eppt/epptso.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sd/source/filter/eppt/epptso.cxx?rev=1383298&r1=1383297&r2=1383298&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sd/source/filter/eppt/epptso.cxx (original)
+++ incubator/ooo/trunk/main/sd/source/filter/eppt/epptso.cxx Tue Sep 11 09:00:21 2012
@@ -4593,6 +4593,7 @@ void PPTWriter::ImplWritePage( const PHL
                             << nPageId;
                 PPTExOleObjEntry* pEntry = new PPTExOleObjEntry( OCX_CONTROL, mpExEmbed->Tell()
);
                 pEntry->xControlModel = aXControlModel;
+                pEntry->xShape = mXShape;
                 maExOleObj.Insert( pEntry );
 
                 mnExEmbed++;
@@ -4666,6 +4667,9 @@ void PPTWriter::ImplWritePage( const PHL
                 ImplCreateShape( ESCHER_ShpInst_HostControl, nSpFlags, aSolverContainer );
                 if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM(
"MetaFile" ) ), sal_False  ) )
                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+                //export form control graphic
+                else if ( aPropOpt.CreateBlipPropertiesforOLEControl(mXPropSet,mXShape))
+                    aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
                 aPropOpt.AddOpt( ESCHER_Prop_pictureId, mnExEmbed );
                 aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0x10000 );
 



Mime
View raw message