diff options
author | Armin Le Grand <alg@apache.org> | 2012-05-31 13:23:45 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2012-05-31 13:23:45 +0000 |
commit | 2868ea34151cfb623a6a8bf41862d430205d9784 (patch) | |
tree | 923c1a3cbfcfb28dfdea7e7674edeae03dc0ba95 | |
parent | 6146497d26fbaab1a85da4bf2c9672199ce240a2 (diff) |
#119287# exchanged hard attributes for OLE and GraphicObject with new default StyleSheet for these objects
Notes
merged as: 0a29c5bedda700a86b46e3c3cd9c9e1ce1d4f278
-rw-r--r-- | sd/inc/app.hrc | 1 | ||||
-rw-r--r-- | sd/inc/glob.hrc | 2 | ||||
-rw-r--r-- | sd/source/core/drawdoc4.cxx | 11 | ||||
-rw-r--r-- | sd/source/core/glob.src | 4 | ||||
-rw-r--r-- | sd/source/core/stlpool.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/func/fuinsert.cxx | 20 | ||||
-rw-r--r-- | sd/source/ui/view/sdview4.cxx | 20 | ||||
-rw-r--r-- | svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofgraphic.cxx | 30 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrcircobj.cxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrole2obj.cxx | 6 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrpathobj.cxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrrectobj.cxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrattributecreator.cxx | 9 | ||||
-rw-r--r-- | svx/source/sdr/properties/graphicproperties.cxx | 4 | ||||
-rw-r--r-- | svx/source/sdr/properties/oleproperties.cxx | 4 |
17 files changed, 88 insertions, 39 deletions
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index ea6b85c0a86a..b733f5acc10b 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -59,6 +59,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 5452ee4b0cd2..7b1c8c43c479 100644 --- a/sd/inc/glob.hrc +++ b/sd/inc/glob.hrc @@ -102,6 +102,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/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index b03a0feb7b1b..8d2bfbcc63b2 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -321,6 +321,17 @@ 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)); diff --git a/sd/source/core/glob.src b/sd/source/core/glob.src index 3d5d262081b2..3f124c8b2b00 100644 --- a/sd/source/core/glob.src +++ b/sd/source/core/glob.src @@ -250,6 +250,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 a70706282ea2..1e3a1e5b937c 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -914,6 +914,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 de7c98f4f156..4b32b499c09e 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -90,6 +90,7 @@ #include "sdxfer.hxx" #include <vcl/svapp.hxx> #include "undo/undoobjects.hxx" +#include "glob.hrc" using namespace com::sun::star; @@ -353,6 +354,25 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) 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 ) { diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 278ef5f98d8a..eabd8cb01c89 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -66,6 +66,7 @@ #include <svtools/soerr.hxx> #include <sfx2/ipclient.hxx> +#include "glob.hrc" using namespace com::sun::star; @@ -222,6 +223,25 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, 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 diff --git a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx index fb0febfcfe6a..c82a930288ff 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx @@ -98,7 +98,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/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index f6c50e1a52df..543e8262579e 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -307,10 +307,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; @@ -327,25 +323,13 @@ 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)); - - 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()); - } - } + // 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)); // 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 diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx index 2fb3a1b53d1b..8c31842ce927 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx @@ -64,7 +64,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 const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx index 57847d651e9d..b9afe48258a8 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx @@ -53,7 +53,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 const Rectangle& rRectangle = GetCircObj().GetGeoRect(); diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index c1018c24db13..202f24106705 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -92,10 +92,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 7308f4eb80d3..0b3b7557536d 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx @@ -52,7 +52,8 @@ namespace sdr const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( rItemSet, - GetPathObj().getText(0))); + GetPathObj().getText(0), + false)); basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); sal_uInt32 nPointCount(0); diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index 17a55caf3d9f..56841ef2d3de 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -54,7 +54,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 const Rectangle& rRectangle = GetRectObj().GetGeoRect(); diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 7bf1adaf812a..7798df7ccd10 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -721,7 +721,8 @@ namespace drawinglayer attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute( const SfxItemSet& rSet, - const SdrText* pText) + const SdrText* pText, + bool bHasContent) { attribute::SdrLineAttribute aLine; attribute::SdrFillAttribute aFill; @@ -765,7 +766,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 1dc5139bc220..701cfad9761e 100644 --- a/svx/source/sdr/properties/graphicproperties.cxx +++ b/svx/source/sdr/properties/graphicproperties.cxx @@ -127,10 +127,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 a80012fdd136..478fdfb84360 100644 --- a/svx/source/sdr/properties/oleproperties.cxx +++ b/svx/source/sdr/properties/oleproperties.cxx @@ -61,10 +61,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 |