From 0a29c5bedda700a86b46e3c3cd9c9e1ce1d4f278 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 31 May 2012 13:23:45 +0000 Subject: Resolves: #i119287# exchanged hard attributes for OLE and GraphicObject ...with new default StyleSheet for these objects (cherry picked from commit 2868ea34151cfb623a6a8bf41862d430205d9784) Conflicts: sd/source/core/drawdoc4.cxx svx/source/sdr/contact/viewcontactofgraphic.cxx Change-Id: I4849101de2ac1da83c8fb0f2d68316774982d197 Resolves: #i119287# Adapted to get the needed style as default style for all SdrGrafObj and SDrOle2Objs. Checked various scenarios, works well. (cherry picked from commit bc85939149f7ae5b65343d7f27bf302a8e31d4b1) Conflicts: sd/source/core/drawdoc.cxx sd/source/ui/func/fuinsert.cxx sd/source/ui/view/sdview4.cxx Change-Id: I40a17216f5c11ebca073026f62f1e9ab9ddfd119 --- sd/inc/app.hrc | 1 + sd/inc/glob.hrc | 2 ++ sd/source/core/drawdoc.cxx | 3 +++ sd/source/core/drawdoc4.cxx | 12 +++++++++ sd/source/core/glob.src | 4 +++ sd/source/core/stlpool.cxx | 1 + sd/source/ui/func/fuinsert.cxx | 1 + sd/source/ui/view/sdview4.cxx | 1 + .../svx/sdr/primitive2d/sdrattributecreator.hxx | 3 ++- svx/inc/svx/svdmodel.hxx | 5 ++++ svx/source/sdr/contact/viewcontactofgraphic.cxx | 29 ++++++---------------- .../sdr/contact/viewcontactofsdrcaptionobj.cxx | 3 ++- svx/source/sdr/contact/viewcontactofsdrcircobj.cxx | 3 ++- svx/source/sdr/contact/viewcontactofsdrole2obj.cxx | 6 ++++- svx/source/sdr/contact/viewcontactofsdrpathobj.cxx | 3 ++- svx/source/sdr/contact/viewcontactofsdrrectobj.cxx | 3 ++- svx/source/sdr/primitive2d/sdrattributecreator.cxx | 9 +++++-- svx/source/sdr/properties/graphicproperties.cxx | 4 --- svx/source/sdr/properties/oleproperties.cxx | 4 --- svx/source/svdraw/svdmodel.cxx | 1 + svx/source/svdraw/svdograf.cxx | 20 +++++++++++++++ svx/source/svdraw/svdoole2.cxx | 22 ++++++++++++++++ 22 files changed, 102 insertions(+), 38 deletions(-) diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index 5dc3b3d091ff..d421a9bd653e 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -53,6 +53,7 @@ #define HID_PSEUDOSHEET_BACKGROUND (HID_SD_START + 97) #define HID_PSEUDOSHEET_NOTES (HID_SD_START + 98) #define HID_PSEUDOSHEET_SUBTITLE (HID_SD_START + 101) +#define HID_POOLSHEET_OBJNOLINENOFILL (HID_SD_START + 102) #define HID_SD_CELL_STYLE_DEFAULT (HID_SD_START + 194) #define HID_SD_CELL_STYLE_BANDED (HID_SD_START + 195) diff --git a/sd/inc/glob.hrc b/sd/inc/glob.hrc index 009b0929317e..afbb483d06ff 100644 --- a/sd/inc/glob.hrc +++ b/sd/inc/glob.hrc @@ -97,6 +97,8 @@ #define STR_POOLSHEET_FIRST_COLUMN RID_GLOB_START+73 #define STR_POOLSHEET_LAST_COLUMN RID_GLOB_START+74 // +#define STR_POOLSHEET_OBJNOLINENOFILL RID_GLOB_START+75 +// #define STR_PSEUDOSHEET_TITLE RID_GLOB_START+80 #define STR_PSEUDOSHEET_OUTLINE RID_GLOB_START+81 #define STR_PSEUDOSHEET_BACKGROUNDOBJECTS RID_GLOB_START+82 diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 844b93053e95..6a283d486861 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -594,6 +594,9 @@ void SdDrawDocument::NewOrLoadCompleted(DocCreationMode eMode) String aName( SdResId(STR_STANDARD_STYLESHEET_NAME)); SetDefaultStyleSheet(static_cast(mxStyleSheetPool->Find(aName, SD_STYLE_FAMILY_GRAPHICS))); + // #i119287# Set default StyleSheet for SdrGrafObj and SdrOle2Obj + SetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(static_cast(mxStyleSheetPool->Find(String( SdResId(STR_POOLSHEET_OBJNOLINENOFILL)), SD_STYLE_FAMILY_GRAPHICS))); + // Initialize DrawOutliner and DocumentOutliner, but don't initialize the // global outliner, as it is not document specific like StyleSheetPool and // StyleRequestHandler are. diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 3f24709bb5c9..3cdfe86f373a 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -293,7 +293,19 @@ void SdDrawDocument::CreateLayoutTemplates() pISet->Put(XFillStyleItem(XFILL_NONE)); pISet->Put(XLineColorItem(String(), RGB_Color(COL_BLACK))); + // Object no fill no line + + aName = String(SdResId(STR_POOLSHEET_OBJNOLINENOFILL)); + pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJNOLINENOFILL ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XFillStyleItem(XFILL_NONE)); + pISet->Put(XLineStyleItem(XLINE_NONE)); + // Text + aName = String(SdResId(STR_POOLSHEET_TEXT)); pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask)); pSheet->SetParent(aStdName); diff --git a/sd/source/core/glob.src b/sd/source/core/glob.src index 91b47afdfb70..5dfe3dc8f715 100644 --- a/sd/source/core/glob.src +++ b/sd/source/core/glob.src @@ -245,6 +245,10 @@ String STR_POOLSHEET_MEASURE { Text [ en-US ] = "Dimension Line" ; }; +String STR_POOLSHEET_OBJNOLINENOFILL +{ + Text [ en-US ] = "Object with no fill and no line" ; +}; String STR_POOLSHEET_OBJWITHARROW { Text [ en-US ] = "Object with arrow" ; diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index 67db6eaeeb09..d11de4298920 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -891,6 +891,7 @@ void SdStyleSheetPool::UpdateStdNames() case HID_POOLSHEET_OBJWITHARROW: nNameId = STR_POOLSHEET_OBJWITHARROW; break; case HID_POOLSHEET_OBJWITHSHADOW: nNameId = STR_POOLSHEET_OBJWITHSHADOW; break; case HID_POOLSHEET_OBJWITHOUTFILL: nNameId = STR_POOLSHEET_OBJWITHOUTFILL; break; + case HID_POOLSHEET_OBJNOLINENOFILL: nNameId = STR_POOLSHEET_OBJNOLINENOFILL;break; case HID_POOLSHEET_TEXT: nNameId = STR_POOLSHEET_TEXT; break; case HID_POOLSHEET_TEXTBODY: nNameId = STR_POOLSHEET_TEXTBODY; break; case HID_POOLSHEET_TEXTBODY_JUSTIFY:nNameId = STR_POOLSHEET_TEXTBODY_JUSTIFY;break; diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index f21dd7e0c689..4809358324ad 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -79,6 +79,7 @@ #include "sdxfer.hxx" #include #include "undo/undoobjects.hxx" +#include "glob.hrc" using namespace com::sun::star; diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 075cf79074be..53d414cbd701 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -59,6 +59,7 @@ #include #include +#include "glob.hrc" using namespace com::sun::star; diff --git a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx index 768bc445d850..e3e940993790 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx @@ -94,7 +94,8 @@ namespace drawinglayer attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute( const SfxItemSet& rSet, - const SdrText* pText); + const SdrText* pText, + bool bHasContent); // used from OLE and graphic attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute( const SfxItemSet& rSet, diff --git a/svx/inc/svx/svdmodel.hxx b/svx/inc/svx/svdmodel.hxx index d436fd9e0810..d57c992f3ace 100644 --- a/svx/inc/svx/svdmodel.hxx +++ b/svx/inc/svx/svdmodel.hxx @@ -182,6 +182,7 @@ protected: sal_uIntPtr nProgressOfs; // -Handler rtl::Reference< SfxStyleSheetBasePool > mxStyleSheetPool; SfxStyleSheet* pDefaultStyleSheet; + SfxStyleSheet* mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj; // #i119287# sfx2::LinkManager* pLinkManager; // LinkManager std::deque* pUndoStack; std::deque* pRedoStack; @@ -358,6 +359,10 @@ public: SfxStyleSheet* GetDefaultStyleSheet() const { return pDefaultStyleSheet; } void SetDefaultStyleSheet(SfxStyleSheet* pDefSS) { pDefaultStyleSheet = pDefSS; } + // #i119287# 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; } diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index 421a32bcee41..0a1082f51fa3 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -297,10 +297,6 @@ namespace sdr { drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( - drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( - rItemSet, - GetGrafObject().getText(0))); // create and fill GraphicAttr GraphicAttr aLocalGrafInfo; @@ -317,25 +313,14 @@ namespace sdr aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue()); aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom()); - if(aAttribute.isDefault() && 255L != aLocalGrafInfo.GetTransparency()) - { - // no fill, no line, no text (invisible), but the graphic content is visible. - // Create evtl. shadow for content which was not created by createNewSdrLineFillShadowTextAttribute yet - const drawinglayer::attribute::SdrShadowAttribute aShadow( - drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet)); + // we have content if graphic is not completely transparent + const bool bHasContent(255L != aLocalGrafInfo.GetTransparency()); + drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetGrafObject().getText(0), + bHasContent)); - if(!aShadow.isDefault()) - { - // create new attribute set if indeed shadow is used - aAttribute = drawinglayer::attribute::SdrLineFillShadowTextAttribute( - aAttribute.getLine(), - aAttribute.getFill(), - aAttribute.getLineStartEnd(), - aShadow, - aAttribute.getFillFloatTransGradient(), - aAttribute.getText()); - } - } // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect() // which will use the primitive data we just create in the near future Rectangle rRectangle = GetGrafObject().GetGeoRect(); diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx index 9076ba7d45a0..78e6c5e2c55d 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx @@ -59,7 +59,8 @@ namespace sdr const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( rItemSet, - rCaptionObj.getText(0))); + rCaptionObj.getText(0), + false)); // take unrotated snap rect (direct model data) for position and size Rectangle rRectangle = rCaptionObj.GetGeoRect(); diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx index 2b1f58c75d34..5289f5e3a734 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx @@ -47,7 +47,8 @@ namespace sdr const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( rItemSet, - GetCircObj().getText(0))); + GetCircObj().getText(0), + false)); // take unrotated snap rect (direct model data) for position and size Rectangle aRectangle = GetCircObj().GetGeoRect(); diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index 358eda0b6dae..9aa5d07db16b 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -88,10 +88,14 @@ namespace sdr // Prepare attribute settings, will be used soon anyways const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); + + // this may be refined more granular; if no content, attributes may get simpler + const bool bHasContent(true); const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( rItemSet, - GetOle2Obj().getText(0))); + GetOle2Obj().getText(0), + bHasContent)); drawinglayer::primitive2d::Primitive2DReference xContent; if(GetOle2Obj().IsChart()) diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index a6c130b08337..f3cc4e2c4ac5 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx @@ -46,7 +46,8 @@ namespace sdr const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( rItemSet, - GetPathObj().getText(0))); + GetPathObj().getText(0), + false)); basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); Point aGridOff = GetPathObj().GetGridOffset(); // Hack for calc, transform position of object according diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index 166c3d52e95b..b4088772039f 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -48,7 +48,8 @@ namespace sdr const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( rItemSet, - GetRectObj().getText(0))); + GetRectObj().getText(0), + false)); // take unrotated snap rect (direct model data) for position and size Rectangle rRectangle = GetRectObj().GetGeoRect(); diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 273db74e60c7..88fce3ce1f3b 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -716,7 +716,8 @@ namespace drawinglayer attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute( const SfxItemSet& rSet, - const SdrText* pText) + const SdrText* pText, + bool bHasContent) { attribute::SdrLineAttribute aLine; attribute::SdrFillAttribute aFill; @@ -760,7 +761,11 @@ namespace drawinglayer } } - if(!aLine.isDefault() || !aFill.isDefault() || !aText.isDefault()) + // bHasContent is used from OLE and graphic objects. Normally a possible shadow + // depends on line, fill or text to be set, but for these objects it is possible + // to have none of these, but still content which needs to have a shadow (if set), + // so shadow needs to be tried + if(bHasContent || !aLine.isDefault() || !aFill.isDefault() || !aText.isDefault()) { // try shadow aShadow = createNewSdrShadowAttribute(rSet); diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx index e8f74858a928..ad12924a1009 100644 --- a/svx/source/sdr/properties/graphicproperties.cxx +++ b/svx/source/sdr/properties/graphicproperties.cxx @@ -121,10 +121,6 @@ namespace sdr mpItemSet->Put( SdrGrafInvertItem( sal_False ) ); mpItemSet->Put( SdrGrafModeItem( GRAPHICDRAWMODE_STANDARD ) ); mpItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) ); - - // #i25616# - mpItemSet->Put( XFillStyleItem(XFILL_NONE) ); - mpItemSet->Put( XLineStyleItem(XLINE_NONE) ); } } // end of namespace properties } // end of namespace sdr diff --git a/svx/source/sdr/properties/oleproperties.cxx b/svx/source/sdr/properties/oleproperties.cxx index 2d8462ab3c56..02ab254a890e 100644 --- a/svx/source/sdr/properties/oleproperties.cxx +++ b/svx/source/sdr/properties/oleproperties.cxx @@ -55,10 +55,6 @@ namespace sdr // force ItemSet GetObjectItemSet(); - - // #i108221# - mpItemSet->Put( XFillStyleItem(XFILL_NONE) ); - mpItemSet->Put( XLineStyleItem(XLINE_NONE) ); } } // end of namespace properties } // end of namespace sdr diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 092544dae9cd..c5fe0532d178 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -128,6 +128,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe nProgressMax=0; nProgressOfs=0; pDefaultStyleSheet=NULL; + mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj = 0; pLinkManager=NULL; pUndoStack=NULL; pRedoStack=NULL; diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 78a8e2709a14..a0041ee8de1a 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -962,6 +962,26 @@ void SdrGrafObj::SetPage( SdrPage* pNewPage ) ImpLinkAbmeldung(); } + if(!pModel && !GetStyleSheet() && pNewPage->GetModel()) + { + // #i119287# 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.isEmpty() && bInsert) diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index e3656a4ffa84..034f5b8b8b08 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -87,6 +87,8 @@ #include #include +#include + using namespace ::rtl; using namespace ::com::sun::star; @@ -1449,6 +1451,26 @@ void SdrOle2Obj::SetPage(SdrPage* pNewPage) if (bRemove && mpImpl->mbConnected ) Disconnect(); + if(!pModel && !GetStyleSheet() && pNewPage->GetModel()) + { + // #i119287# 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 ) -- cgit v1.2.3