You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2012/06/11 17:56:07 UTC

svn commit: r1348920 - in /incubator/ooo/trunk/main: sd/source/core/ sd/source/ui/func/ sd/source/ui/view/ svx/inc/svx/ svx/source/svdraw/

Author: alg
Date: Mon Jun 11 15:56:06 2012
New Revision: 1348920

URL: http://svn.apache.org/viewvc?rev=1348920&view=rev
Log:
#119287# Adapted to get the needed style as default style for all SdrGrafObj and SDrOle2Objs. Checked various scenarios, works well.

Modified:
    incubator/ooo/trunk/main/sd/source/core/drawdoc.cxx
    incubator/ooo/trunk/main/sd/source/ui/func/fuinsert.cxx
    incubator/ooo/trunk/main/sd/source/ui/view/sdview4.cxx
    incubator/ooo/trunk/main/svx/inc/svx/svdmodel.hxx
    incubator/ooo/trunk/main/svx/source/svdraw/svdmodel.cxx
    incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx
    incubator/ooo/trunk/main/svx/source/svdraw/svdoole2.cxx

Modified: incubator/ooo/trunk/main/sd/source/core/drawdoc.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sd/source/core/drawdoc.cxx?rev=1348920&r1=1348919&r2=1348920&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sd/source/core/drawdoc.cxx (original)
+++ incubator/ooo/trunk/main/sd/source/core/drawdoc.cxx Mon Jun 11 15:56:06 2012
@@ -645,6 +645,9 @@ void SdDrawDocument::NewOrLoadCompleted(
 	String aName( SdResId(STR_STANDARD_STYLESHEET_NAME));
 	SetDefaultStyleSheet(static_cast<SfxStyleSheet*>(mxStyleSheetPool->Find(aName, SD_STYLE_FAMILY_GRAPHICS)));
 
+    // #119287# Set default StyleSheet for SdrGrafObj and SdrOle2Obj
+	SetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(static_cast<SfxStyleSheet*>(mxStyleSheetPool->Find(String( SdResId(STR_POOLSHEET_OBJNOLINENOFILL)), SD_STYLE_FAMILY_GRAPHICS)));
+
 	// Draw-Outliner und  Dokument Outliner initialisieren,
 	// aber nicht den globalen Outliner, den der ist ja nicht
 	// dokumentspezifisch wie StyleSheetPool und StyleRequestHandler

Modified: incubator/ooo/trunk/main/sd/source/ui/func/fuinsert.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sd/source/ui/func/fuinsert.cxx?rev=1348920&r1=1348919&r2=1348920&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sd/source/ui/func/fuinsert.cxx (original)
+++ incubator/ooo/trunk/main/sd/source/ui/func/fuinsert.cxx Mon Jun 11 15:56:06 2012
@@ -354,25 +354,6 @@ void FuInsertOLE::DoExecute( SfxRequest&
             SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aObjName, aRect );
 			SdrPageView* pPV = mpView->GetSdrPageView();
 
-            if(pOleObj)
-            {
-                // #119287#
-            	SdrModel* pModel = mpView ? mpView->GetModel() : 0;
-                SfxStyleSheetBasePool* pSfxStyleSheetBasePool = pModel ? pModel->GetStyleSheetPool() : 0;
-		        SfxStyleSheet* pSheet = pSfxStyleSheetBasePool ? dynamic_cast< SfxStyleSheet* >(pSfxStyleSheetBasePool->Find(String(SdResId(STR_POOLSHEET_OBJNOLINENOFILL)), SD_STYLE_FAMILY_GRAPHICS)) : 0;
-
-		        if(pSheet)
-		        {
-			        pOleObj->SetStyleSheet(pSheet, false);
-		        }
-                else
-                {
-		            pOleObj->SetMergedItem(XFillStyleItem(XFILL_NONE));
-		            pOleObj->SetMergedItem(XLineStyleItem(XLINE_NONE));
-    		        OSL_ENSURE(false, "Style Sheet for OLE not found (!)");
-                }
-            }
-
 			// if we have a pick obj we need to make this new ole a pres obj replacing the current pick obj
 			if( pPickObj )
 			{

Modified: incubator/ooo/trunk/main/sd/source/ui/view/sdview4.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sd/source/ui/view/sdview4.cxx?rev=1348920&r1=1348919&r2=1348920&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sd/source/ui/view/sdview4.cxx (original)
+++ incubator/ooo/trunk/main/sd/source/ui/view/sdview4.cxx Mon Jun 11 15:56:06 2012
@@ -223,25 +223,6 @@ SdrGrafObj* View::InsertGraphic( const G
 				bIsPresTarget = pP->IsPresObj(pPickObj);
 		}
 
-        if(pNewGrafObj)
-        {
-            // #119287#
-            SdrModel* pModel = pPV->GetView().GetModel();
-            SfxStyleSheetBasePool* pSfxStyleSheetBasePool = pModel ? pModel->GetStyleSheetPool() : 0;
-		    SfxStyleSheet* pSheet = pSfxStyleSheetBasePool ? dynamic_cast< SfxStyleSheet* >(pSfxStyleSheetBasePool->Find(String(SdResId(STR_POOLSHEET_OBJNOLINENOFILL)), SD_STYLE_FAMILY_GRAPHICS)) : 0;
-
-		    if(pSheet)
-		    {
-			    pNewGrafObj->SetStyleSheet(pSheet, false);
-		    }
-            else
-            {
-		        pNewGrafObj->SetMergedItem(XFillStyleItem(XFILL_NONE));
-		        pNewGrafObj->SetMergedItem(XLineStyleItem(XLINE_NONE));
-    		    OSL_ENSURE(false, "Style Sheet for GraphicObject not found (!)");
-            }
-        }
-
 		if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && !bIsPresTarget )
 		{
 			// replace object

Modified: incubator/ooo/trunk/main/svx/inc/svx/svdmodel.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/inc/svx/svdmodel.hxx?rev=1348920&r1=1348919&r2=1348920&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/inc/svx/svdmodel.hxx (original)
+++ incubator/ooo/trunk/main/svx/inc/svx/svdmodel.hxx Mon Jun 11 15:56:06 2012
@@ -208,6 +208,7 @@ protected:
 	sal_uIntPtr           nProgressOfs;   // -Handler
 	rtl::Reference< SfxStyleSheetBasePool > mxStyleSheetPool;
 	SfxStyleSheet*	pDefaultStyleSheet;
+    SfxStyleSheet* mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj; // #119287#
 	sfx2::LinkManager* pLinkManager;   // LinkManager
 	Container*      pUndoStack;
 	Container*      pRedoStack;
@@ -400,6 +401,10 @@ public:
 	SfxStyleSheet*       GetDefaultStyleSheet() const             { return pDefaultStyleSheet; }
 	void                 SetDefaultStyleSheet(SfxStyleSheet* pDefSS) { pDefaultStyleSheet = pDefSS; }
 
+    // #119287# default StyleSheet for SdrGrafObj and SdrOle2Obj
+    SfxStyleSheet* GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj() const { return mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj; }
+	void SetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(SfxStyleSheet* pDefSS) { mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj = pDefSS; }
+
 	sfx2::LinkManager*      GetLinkManager()                         { return pLinkManager; }
 	void                 SetLinkManager( sfx2::LinkManager* pLinkMgr ) { pLinkManager = pLinkMgr; }
 

Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdmodel.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdmodel.cxx?rev=1348920&r1=1348919&r2=1348920&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdmodel.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdmodel.cxx Mon Jun 11 15:56:06 2012
@@ -134,6 +134,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPoo
 	nProgressMax=0;
 	nProgressOfs=0;
 	pDefaultStyleSheet=NULL;
+    mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj = 0;
 	pLinkManager=NULL;
 	pUndoStack=NULL;
 	pRedoStack=NULL;

Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx?rev=1348920&r1=1348919&r2=1348920&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx Mon Jun 11 15:56:06 2012
@@ -1083,6 +1083,26 @@ void SdrGrafObj::SetPage( SdrPage* pNewP
 			ImpLinkAbmeldung();
 	}
 
+    if(!pModel && !GetStyleSheet() && pNewPage->GetModel())
+    {
+        // #119287# Set default StyleSheet for SdrGrafObj here, it is different from 'Default'. This
+        // needs to be done before the style 'Default' is set from the :SetModel() call which is triggered
+        // from the following :SetPage().
+        // TTTT: Needs to be moved in branch aw080 due to having a SdrModel from the beginning, is at this
+        // place for convenience currently (works in both versions, is not in the way)
+		SfxStyleSheet* pSheet = pNewPage->GetModel()->GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj();
+
+		if(pSheet)
+		{
+			SetStyleSheet(pSheet, false);
+		}
+        else
+        {
+		    SetMergedItem(XFillStyleItem(XFILL_NONE));
+		    SetMergedItem(XLineStyleItem(XLINE_NONE));
+        }
+    }
+
 	SdrRectObj::SetPage( pNewPage );
 
 	if(aFileName.Len() && bInsert)

Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdoole2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdoole2.cxx?rev=1348920&r1=1348919&r2=1348920&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdoole2.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdoole2.cxx Mon Jun 11 15:56:06 2012
@@ -94,6 +94,8 @@
 #include <basegfx/polygon/b2dpolypolygon.hxx>
 #include <editeng/outlobj.hxx>
 
+#include <svx/svdpage.hxx>
+
 using namespace ::rtl;
 using namespace ::com::sun::star;
 
@@ -1525,7 +1527,27 @@ void SdrOle2Obj::SetPage(SdrPage* pNewPa
     if (bRemove && mpImpl->mbConnected )
         Disconnect();
 
-	SdrRectObj::SetPage(pNewPage);
+    if(!pModel && !GetStyleSheet() && pNewPage->GetModel())
+    {
+        // #119287# Set default StyleSheet for SdrGrafObj here, it is different from 'Default'. This
+        // needs to be done before the style 'Default' is set from the :SetModel() call which is triggered
+        // from the following :SetPage().
+        // TTTT: Needs to be moved in branch aw080 due to having a SdrModel from the beginning, is at this
+        // place for convenience currently (works in both versions, is not in the way)
+		SfxStyleSheet* pSheet = pNewPage->GetModel()->GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj();
+
+		if(pSheet)
+		{
+			SetStyleSheet(pSheet, false);
+		}
+        else
+        {
+		    SetMergedItem(XFillStyleItem(XFILL_NONE));
+		    SetMergedItem(XLineStyleItem(XLINE_NONE));
+        }
+    }
+
+    SdrRectObj::SetPage(pNewPage);
 
     if (bInsert && !mpImpl->mbConnected )
         Connect();