officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu | 3 sw/sdi/_frmsh.sdi | 12 + sw/source/core/attr/format.cxx | 19 ++ sw/source/core/layout/paintfrm.cxx | 7 sw/source/core/unocore/unobrushitemhelper.cxx | 26 ++- sw/source/core/unocore/unoframe.cxx | 60 ++++++++ sw/source/core/unocore/unomap.cxx | 37 ++++- sw/source/core/unocore/unostyle.cxx | 14 + sw/source/ui/frmdlg/frmpage.src | 40 +++++ sw/source/ui/shells/frmsh.cxx | 6 sw/source/ui/shells/grfsh.cxx | 55 +++++-- xmloff/inc/xmloff/XMLShapeStyleContext.hxx | 2 xmloff/source/draw/XMLShapeStyleContext.cxx | 81 ++++++++++- 13 files changed, 320 insertions(+), 42 deletions(-)
New commits: commit 8433ee82c9323501545164ddf6e6008db483ab7a Author: Armin Le Grand <a...@apache.org> Date: Thu Apr 17 16:44:58 2014 +0000 i124638 support for DrawingLayre FillStyle for GraphicFrames and EmbeddedObjectFrames in Writer diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu index abb4f9c..25de5cf 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu @@ -348,9 +348,12 @@ Calc, OLE, hidden ; DrawImpress, 3DObject, visible ; DrawImpress, Draw, visible ; + DrawImpress, Graphic, hidden ; DrawImpress, TextObject, hidden ; DrawImpress, OLE, hidden ; WriterVariants, Draw, visible ; + Writer, Graphic, hidden ; + Writer, OLE, hidden ; Writer, Frame, visible ; </value> </prop> diff --git a/sw/sdi/_frmsh.sdi b/sw/sdi/_frmsh.sdi index 3715e65..e729a60 100644 --- a/sw/sdi/_frmsh.sdi +++ b/sw/sdi/_frmsh.sdi @@ -26,6 +26,7 @@ interface BaseTextFrame Automation = FALSE; ] { + //UUUU SID_ATTR_FILL_STYLE [ Export = FALSE; @@ -34,6 +35,7 @@ interface BaseTextFrame DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + //UUUU SID_ATTR_FILL_COLOR [ Export = FALSE; @@ -42,6 +44,7 @@ interface BaseTextFrame DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + //UUUU SID_ATTR_FILL_GRADIENT [ Export = FALSE; @@ -50,6 +53,7 @@ interface BaseTextFrame DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + //UUUU SID_ATTR_FILL_HATCH [ Export = FALSE; @@ -58,6 +62,7 @@ interface BaseTextFrame DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + //UUUU SID_ATTR_FILL_BITMAP [ Export = FALSE; @@ -66,6 +71,7 @@ interface BaseTextFrame DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + //UUUU SID_ATTR_FILL_TRANSPARENCE [ Export = FALSE; @@ -74,6 +80,7 @@ interface BaseTextFrame DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + //UUUU SID_ATTR_FILL_FLOATTRANSPARENCE [ Export = FALSE; @@ -82,26 +89,31 @@ interface BaseTextFrame DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + //UUUU SID_COLOR_TABLE [ StateMethod = GetDrawAttrStateTextFrame; ] + //UUUU SID_GRADIENT_LIST [ StateMethod = GetDrawAttrStateTextFrame; ] + //UUUU SID_HATCH_LIST [ StateMethod = GetDrawAttrStateTextFrame; ] + //UUUU SID_BITMAP_LIST [ StateMethod = GetDrawAttrStateTextFrame; ] + //UUUU SID_ATTRIBUTES_AREA [ ExecMethod = ExecDrawDlgTextFrame; diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index c36b13f..9cace99 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -586,16 +586,27 @@ sal_Bool SwFmt::SetFmtAttr( const SfxItemSet& rSet ) sal_Bool bRet = sal_False; + //UUUU Usel local copy to be able to apply needed changes, e.g. call + // CheckForUniqueItemForLineFillNameOrIndex which is needed for NameOrIndex stuff + SfxItemSet aTempSet(rSet); + + //UUUU Need to check for unique item for DrawingLayer items of type NameOrIndex + // and evtl. correct that item to ensure unique names for that type. This call may + // modify/correct entries inside of the given SfxItemSet + if(GetDoc()) + { + GetDoc()->CheckForUniqueItemForLineFillNameOrIndex(aTempSet); + } + //UUUU if(RES_FLYFRMFMT == Which()) { const SfxPoolItem* pSource = 0; - if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND, sal_False, &pSource)) + if(SFX_ITEM_SET == aTempSet.GetItemState(RES_BACKGROUND, sal_False, &pSource)) { //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)"); - SfxItemSet aTempSet(rSet); // copy all items to be set anyways to a local ItemSet with is also prepared for the new // fill attribute ranges [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Add the attributes @@ -639,7 +650,7 @@ sal_Bool SwFmt::SetFmtAttr( const SfxItemSet& rSet ) ( RES_GRFFMTCOLL == nFmtWhich || RES_TXTFMTCOLL == nFmtWhich ) ) ) { - if( 0 != ( bRet = (0 != aSet.Put( rSet ))) ) + if( 0 != ( bRet = (0 != aSet.Put( aTempSet ))) ) aSet.SetModifyAtAttr( this ); // --> OD 2006-11-22 #i71574# if ( nFmtWhich == RES_TXTFMTCOLL ) @@ -652,7 +663,7 @@ sal_Bool SwFmt::SetFmtAttr( const SfxItemSet& rSet ) { SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ), aNew( *aSet.GetPool(), aSet.GetRanges() ); - bRet = 0 != aSet.Put_BC( rSet, &aOld, &aNew ); + bRet = 0 != aSet.Put_BC( aTempSet, &aOld, &aNew ); if( bRet ) { // einige Sonderbehandlungen fuer Attribute diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 5971837..15e815b 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3668,9 +3668,10 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const //UUUU check for transparency const FillAttributesPtr aFillAttributes(pSwFrmFmt->getFillAttributes()); - if(aFillAttributes.get()) + // check if the new fill attributes are used + if(aFillAttributes.get() && aFillAttributes->isUsed()) { - bPaintCompleteBack = aFillAttributes->isTransparent(); + bPaintCompleteBack = true; } } else @@ -4122,7 +4123,7 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect, void SwFrm::PaintBorderLine( const SwRect& rRect, const SwRect& rOutRect, - const SwPageFrm *pPage, + const SwPageFrm* /*pPage*/, const Color *pColor ) const { if ( !rOutRect.IsOver( rRect ) ) diff --git a/sw/source/core/unocore/unobrushitemhelper.cxx b/sw/source/core/unocore/unobrushitemhelper.cxx index 4fb8a5f..5d790b2 100644 --- a/sw/source/core/unocore/unobrushitemhelper.cxx +++ b/sw/source/core/unocore/unobrushitemhelper.cxx @@ -133,6 +133,18 @@ void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxI OSL_ENSURE(false, "Could not get Graphic from SvxBrushItem (!)"); } } + else + { + // GPOS_NONE == rBrush.GetGraphicPos() && 0xff == rBrush.GetColor().GetTransparency(), + // still need to rescue the color used. There are sequences used on the UNO API at + // import time (OLE. e.g. chart) which first set RGB color (MID_BACK_COLOR_R_G_B, + // color stays transparent) and then set transparency (MID_BACK_COLOR_TRANSPARENCY) + // to zero later. When not saving the color, it will be lost + const Color aColor(rBrush.GetColor().GetRGBColor()); + + // rToSet.Put(XFillStyleItem(XFILL_NONE)); + rToSet.Put(XFillColorItem(String(), aColor)); + } } //UUUU @@ -175,20 +187,24 @@ SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, sal_Bool bSea //UUUU SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents) { - SvxBrushItem aRetval(RES_BACKGROUND); - const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem* >(rSourceSet.GetItem(XATTR_FILLSTYLE, bSearchInParents))); - if(!pXFillStyleItem) + if(!pXFillStyleItem || XFILL_NONE == pXFillStyleItem->GetValue()) { - return aRetval; + // need to rescue the evtl. set RGB color, but use as transparent color (we have XFILL_NONE) + Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue()); + aFillColor.SetTransparency(0xff); + + return SvxBrushItem(aFillColor, RES_BACKGROUND); } + SvxBrushItem aRetval(RES_BACKGROUND); + switch(pXFillStyleItem->GetValue()) { case XFILL_NONE: { - // done; return default item + // already handled above, can not happen again break; } case XFILL_SOLID: diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 25e0017..7da5f96 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1765,6 +1765,64 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: bDone = true; } + switch(nMemberId) + { + case MID_NAME: + { + //UUUU when named items get set, replace these with the NameOrIndex items + // which exist already in the pool + switch(pEntry->nWID) + { + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLBITMAP: + case XATTR_FILLFLOATTRANSPARENCE: + { + OUString aTempName; + + if(!(aValue >>= aTempName )) + { + throw lang::IllegalArgumentException(); + } + + bDone = SvxShape::SetFillAttribute(pEntry->nWID, aTempName, aSet); + break; + } + default: + { + break; + } + } + break; + } + case MID_GRAFURL: + { + //UUUU Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used + switch(pEntry->nWID) + { + case XATTR_FILLBITMAP: + { + const Graphic aNullGraphic; + XFillBitmapItem aXFillBitmapItem(aSet.GetPool(), aNullGraphic); + + aXFillBitmapItem.PutValue(aValue, nMemberId); + aSet.Put(aXFillBitmapItem); + bDone = true; + break; + } + default: + { + break; + } + } + break; + } + default: + { + break; + } + } + if(!bDone) { m_pPropSet->setPropertyValue(*pEntry, aValue, aSet); @@ -1832,7 +1890,9 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: throw lang::IllegalArgumentException(); } else + { pFmt->SetFmtAttr(aSet); + } } } else if(IsDescriptor()) diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 85ca8e7..72853d5 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -297,6 +297,9 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider() // OD 18.09.2003 #i18732# - add property // OD 2004-05-05 #i28701# - add property 'WrapInfluenceOnObjPos' // OD 2009-07-13 #i73249# - add properties 'Title' and 'Description' +//UUUU all users of COMMON_FRAME_PROPERTIES add the new XATTR_FILL_FIRST, XATTR_FILL_LAST FillStyle, +// thus it may be possible to remove the RES_BACKGROUND entries from SvxBrushItem completely (this includes +// all using UNO_NAME_BACK_* slots) in the future #define COMMON_FRAME_PROPERTIES \ { SW_PROP_NMID(UNO_NAME_ANCHOR_PAGE_NO), RES_ANCHOR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ANCHOR_PAGENUM }, \ { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), RES_ANCHOR, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PROPERTY_NONE, MID_ANCHOR_ANCHORTYPE}, \ @@ -818,9 +821,10 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_WRAP_INFLUENCE_ON_POSITION), RES_WRAP_INFLUENCE_ON_OBJPOS, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, MID_WRAP_INFLUENCE}, { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 }, - //UUUU adf FillProperties for SW, same as FILL_PROPERTIES in svx + //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx // but need own defines in Writer due to later association of strings - // and uno types (see loop at end of this metjhod and definition of SW_PROP_NMID) + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to style import/export FILL_PROPERTIES_SW {0,0,0,0,0,0} @@ -1174,9 +1178,10 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_WIDTH_TYPE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_WIDTH_TYPE }, { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 }, - //UUUU adf FillProperties for SW, same as FILL_PROPERTIES in svx + //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx // but need own defines in Writer due to later association of strings - // and uno types (see loop at end of this metjhod and definition of SW_PROP_NMID) + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to FlyFrame import/export FILL_PROPERTIES_SW {0,0,0,0,0,0} @@ -1187,7 +1192,10 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s case PROPERTY_MAP_TEXT_GRAPHIC: { static SfxItemPropertyMapEntry aGraphicPropertyMap_Impl[] = - { + { //UUUU + // evtl. completely remove SvxBrushItem stuff () + // add support for XATTR_FILL_FIRST, XATTR_FILL_LAST + // COMMON_FRAME_PROPERTIES currently hosts the RES_BACKGROUND entries from SvxBrushItem COMMON_FRAME_PROPERTIES { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR }, { SW_PROP_NMID(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE }, @@ -1214,6 +1222,13 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_GRAPHIC_IS_INVERTED), RES_GRFATR_INVERT, CPPU_E2T(CPPUTYPE_BOOLEAN), 0, 0}, { SW_PROP_NMID(UNO_NAME_TRANSPARENCY), RES_GRFATR_TRANSPARENCY, CPPU_E2T(CPPUTYPE_INT16), 0, 0}, { SW_PROP_NMID(UNO_NAME_GRAPHIC_COLOR_MODE), RES_GRFATR_DRAWMODE, CPPU_E2T(CPPUTYPE_COLORMODE), 0, 0}, + + //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx + // but need own defines in Writer due to later association of strings + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to Writer GraphicObject import/export + FILL_PROPERTIES_SW + {0,0,0,0,0,0} }; aMapEntriesArr[nPropertyId] = aGraphicPropertyMap_Impl; @@ -1222,7 +1237,10 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s case PROPERTY_MAP_EMBEDDED_OBJECT: { static SfxItemPropertyMapEntry aEmbeddedPropertyMap_Impl[] = - { + { //UUUU + // evtl. completely remove SvxBrushItem stuff () + // add support for XATTR_FILL_FIRST, XATTR_FILL_LAST + // COMMON_FRAME_PROPERTIES currently hosts the RES_BACKGROUND entries from SvxBrushItem COMMON_FRAME_PROPERTIES { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR }, { SW_PROP_NMID(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE}, @@ -1237,6 +1255,13 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_COMPONENT),FN_UNO_COMPONENT, CPPU_E2T(CPPUTYPE_REFCOMPONENT), PropertyAttribute::READONLY, 0}, { SW_PROP_NMID(UNO_NAME_EMBEDDED_OBJECT),FN_EMBEDDED_OBJECT, CPPU_E2T(CPPUTPYE_REFEMBEDDEDOBJECT), PropertyAttribute::READONLY, 0}, // { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), FN_UNO_ALTERNATIVE_TEXT,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 }, + + //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx + // but need own defines in Writer due to later association of strings + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to OLE/EmbeddedObject import/export + FILL_PROPERTIES_SW + {0,0,0,0,0,0} }; aMapEntriesArr[nPropertyId] = aEmbeddedPropertyMap_Impl; diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 6b4f94f..6410f90 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1899,6 +1899,13 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case RES_BACKGROUND: { + //UUUU No new FillStyle for PageBackground; need to remove again when we want + // to support that, too. Add a break to *not* set bDone to true + if(SFX_STYLE_FAMILY_PAGE == eFamily) + { + break; + } + //UUUU SfxItemSet& rStyleSet = rBase.GetItemSet(); const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet)); @@ -2676,6 +2683,13 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case RES_BACKGROUND: { + //UUUU No new FillStyle for PageBackground; need to remove again when we want + // to support that, too. Add a break to *not* set bDone to true + if(SFX_STYLE_FAMILY_PAGE == eFamily) + { + break; + } + //UUUU const SfxItemSet& rSet = rBase.GetItemSet(); const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet)); diff --git a/sw/source/ui/frmdlg/frmpage.src b/sw/source/ui/frmdlg/frmpage.src index 82f0a39..abf689c 100644 --- a/sw/source/ui/frmdlg/frmpage.src +++ b/sw/source/ui/frmdlg/frmpage.src @@ -157,14 +157,31 @@ TabDialog DLG_FRM_GRF PageResID = TP_BORDER ; Text [ en-US ] = "Borders" ; }; + + //UUUU new Area and Transparence TabPages PageItem { - Identifier = TP_BACKGROUND ; - PageResID = TP_BACKGROUND ; - Text [ en-US ] = "Background" ; + Identifier = RID_SVXPAGE_AREA; + PageResID = RID_SVXPAGE_AREA; + Text [ en-US ] = "Area" ; }; PageItem { + Identifier = RID_SVXPAGE_TRANSPARENCE; + PageResID = RID_SVXPAGE_TRANSPARENCE; + Text [ en-US ] = "Transparency" ; + }; + + //UUUU remove? + //PageItem + //{ + // Identifier = TP_BACKGROUND ; + // PageResID = TP_BACKGROUND ; + // Text [ en-US ] = "Background" ; + //}; + + PageItem + { Identifier = TP_MACRO_ASSIGN ; Text [ en-US ] = "Macro" ; }; @@ -212,12 +229,29 @@ TabDialog DLG_FRM_OLE PageResID = TP_BORDER ; Text [ en-US ] = "Borders" ; }; + + //UUUU new Area and Transparence TabPages + PageItem + { + Identifier = RID_SVXPAGE_AREA; + PageResID = RID_SVXPAGE_AREA; + Text [ en-US ] = "Area" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_TRANSPARENCE; + PageResID = RID_SVXPAGE_TRANSPARENCE; + Text [ en-US ] = "Transparency" ; + }; + + //UUUU remove? PageItem { Identifier = TP_BACKGROUND ; PageResID = TP_BACKGROUND ; Text [ en-US ] = "Background" ; }; + /* PageItem { Identifier = TP_COLUMN ; diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx index d845869..5d0bb98 100644 --- a/sw/source/ui/shells/frmsh.cxx +++ b/sw/source/ui/shells/frmsh.cxx @@ -440,11 +440,9 @@ void SwFrameShell::Execute(SfxRequest &rReq) SID_HTML_MODE, SID_HTML_MODE, // [10414 FN_GET_PRINT_AREA, FN_GET_PRINT_AREA, // [21032 FN_SURROUND, FN_HORI_ORIENT, // [21303 - FN_SET_FRM_NAME, FN_SET_FRM_NAME, // [21306 - FN_KEEP_ASPECT_RATIO, FN_KEEP_ASPECT_RATIO, // [21307 + FN_SET_FRM_NAME, FN_KEEP_ASPECT_RATIO, // [21306 FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME, // [21318 - FN_OLE_IS_MATH, FN_OLE_IS_MATH, // [22314 - FN_MATH_BASELINE_ALIGNMENT, FN_MATH_BASELINE_ALIGNMENT, // [22315 + FN_OLE_IS_MATH, FN_MATH_BASELINE_ALIGNMENT, // [22314 FN_PARAM_CHAIN_PREVIOUS, FN_PARAM_CHAIN_NEXT, // [22420 0); diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx index 2ec894b..5b50490 100644 --- a/sw/source/ui/shells/grfsh.cxx +++ b/sw/source/ui/shells/grfsh.cxx @@ -75,6 +75,10 @@ #include <shells.hrc> #include <popup.hrc> +#include <doc.hxx> +#include <docsh.hxx> +#include <svx/drawitem.hxx> + #define SwGrfShell #include <sfx2/msg.hxx> #include "swslots.hxx" @@ -128,22 +132,41 @@ void SwGrfShell::Execute(SfxRequest &rReq) const SwViewOption* pVOpt = rSh.GetViewOptions(); SwViewOption aUsrPref( *pVOpt ); - SfxItemSet aSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1, - RES_GRFATR_MIRRORGRF, RES_GRFATR_CROPGRF, - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, - SID_ATTR_GRAF_KEEP_ZOOM, SID_ATTR_GRAF_KEEP_ZOOM, - SID_ATTR_GRAF_FRMSIZE, SID_ATTR_GRAF_FRMSIZE, - SID_ATTR_GRAF_FRMSIZE_PERCENT, SID_ATTR_GRAF_FRMSIZE_PERCENT, - SID_ATTR_GRAF_GRAPHIC, SID_ATTR_GRAF_GRAPHIC, - FN_PARAM_GRF_CONNECT, FN_PARAM_GRF_CONNECT, - SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, - FN_GET_PRINT_AREA, FN_GET_PRINT_AREA, - FN_SET_FRM_NAME, FN_KEEP_ASPECT_RATIO, - FN_PARAM_GRF_DIALOG, FN_PARAM_GRF_DIALOG, - SID_DOCFRAME, SID_DOCFRAME, - SID_HTML_MODE, SID_HTML_MODE, - FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME, - 0); + SfxItemSet aSet(GetPool(), //UUUU sorted by indices + + RES_FRMATR_BEGIN,RES_FRMATR_END - 1, // [ 82 + RES_GRFATR_MIRRORGRF,RES_GRFATR_CROPGRF, // [ 123 + + //UUUU FillAttribute support + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [ 1014 + + SID_DOCFRAME,SID_DOCFRAME, // [ 5598 + SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER, // [10023 + SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE, // [10051 + SID_ATTR_GRAF_KEEP_ZOOM,SID_ATTR_GRAF_KEEP_ZOOM, // [10882 + SID_ATTR_GRAF_FRMSIZE,SID_ATTR_GRAF_GRAPHIC, // [10884, contains SID_ATTR_GRAF_FRMSIZE_PERCENT + + //UUUU items to hand over XPropertyList things like + // XColorList, XHatchList, XGradientList and XBitmapList + // to the Area TabPage + SID_COLOR_TABLE, SID_BITMAP_LIST, // [10179 + + SID_HTML_MODE,SID_HTML_MODE, // [10414 + FN_GET_PRINT_AREA,FN_GET_PRINT_AREA, // [21032 + FN_PARAM_GRF_CONNECT,FN_PARAM_GRF_CONNECT, // [21153 + FN_PARAM_GRF_DIALOG,FN_PARAM_GRF_DIALOG, // [21171 + FN_SET_FRM_NAME,FN_KEEP_ASPECT_RATIO, // [21306 + FN_SET_FRM_ALT_NAME,FN_SET_FRM_ALT_NAME, // [21318 + 0); + + //UUUU create needed items for XPropertyList entries from the DrawModel so that + // the Area TabPage can access them + const SdrModel* pDrawModel = rSh.GetView().GetDocShell()->GetDoc()->GetDrawModel(); + + aSet.Put(SvxColorTableItem(pDrawModel->GetColorTableFromSdrModel(), SID_COLOR_TABLE)); + aSet.Put(SvxGradientListItem(pDrawModel->GetGradientListFromSdrModel(), SID_GRADIENT_LIST)); + aSet.Put(SvxHatchListItem(pDrawModel->GetHatchListFromSdrModel(), SID_HATCH_LIST)); + aSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapListFromSdrModel(), SID_BITMAP_LIST)); sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); aSet.Put(SfxUInt16Item(SID_HTML_MODE, nHtmlMode)); diff --git a/xmloff/inc/xmloff/XMLShapeStyleContext.hxx b/xmloff/inc/xmloff/XMLShapeStyleContext.hxx index c29f65b..c7f4776 100644 --- a/xmloff/inc/xmloff/XMLShapeStyleContext.hxx +++ b/xmloff/inc/xmloff/XMLShapeStyleContext.hxx @@ -40,6 +40,8 @@ protected: ::rtl::OUString m_sControlDataStyleName; ::rtl::OUString m_sListStyleName; sal_Bool m_bIsNumRuleAlreadyConverted; + //UUUU + sal_Bool m_bIsFillStyleAlreadyConverted; protected: virtual void SetAttribute( sal_uInt16 nPrefixKey, diff --git a/xmloff/source/draw/XMLShapeStyleContext.cxx b/xmloff/source/draw/XMLShapeStyleContext.cxx index 811276a..f9e437d 100644 --- a/xmloff/source/draw/XMLShapeStyleContext.cxx +++ b/xmloff/source/draw/XMLShapeStyleContext.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/drawing/XControlShape.hpp> #include "com/sun/star/beans/XPropertySetInfo.hpp" #include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> #include <xmloff/xmlimp.hxx> #include <xmloff/xmlnumi.hxx> #include <xmloff/xmlnmspe.hxx> @@ -46,6 +47,7 @@ using ::rtl::OUStringBuffer; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::drawing; using ::xmloff::token::IsXMLToken; using ::xmloff::token::XML_TEXT_PROPERTIES; using ::xmloff::token::XML_GRAPHIC_PROPERTIES; @@ -63,7 +65,8 @@ XMLShapeStyleContext::XMLShapeStyleContext( SvXMLStylesContext& rStyles, sal_uInt16 nFamily) : XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily ), - m_bIsNumRuleAlreadyConverted( sal_False ) + m_bIsNumRuleAlreadyConverted( sal_False ), + m_bIsFillStyleAlreadyConverted( sal_False ) //UUUU { } @@ -195,6 +198,82 @@ void XMLShapeStyleContext::FillPropertySet( const Reference< beans::XPropertySet } } + if(!m_bIsFillStyleAlreadyConverted && GetProperties().size()) + { + const UniReference< XMLPropertySetMapper >&rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper(); + ::std::vector< XMLPropertyState >& rProperties = GetProperties(); + ::std::vector< XMLPropertyState >::iterator a; + FillStyle eFS(FillStyle_NONE); + static ::rtl::OUString s_FillStyle(RTL_CONSTASCII_USTRINGPARAM("FillStyle")); + + // try to find a FillStyle entry and a value from it + for(a = rProperties.begin(); a != rProperties.end(); a++) + { + if(a->mnIndex != -1) + { + const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex); + + if(rPropName == s_FillStyle) + { + if(a->maValue >>= eFS) + { + // okay, type was good, eFS is set + } + else + { + // also try an int (see XFillStyleItem::PutValue) + sal_Int32 nFS = 0; + + if(a->maValue >>= nFS) + { + eFS = (FillStyle)nFS; + } + } + + // exit loop, we found out what we needed to know + break; + } + } + } + + if(FillStyle_NONE != eFS) + { + //UUUU a FillStyle was found, thus the new [XATTR_FILL_FIRST .. XATTR_FILL_LAST] + // description for the Fill definitions is used. All formally used props based + // on RES_BACKGROUND need to be deleted to get no conflicts between the two + // sets of properties; old files will keep these and adapt accordingly + static ::rtl::OUString s_BackColorRGB(RTL_CONSTASCII_USTRINGPARAM("BackColorRGB")); + static ::rtl::OUString s_BackTransparent(RTL_CONSTASCII_USTRINGPARAM("BackTransparent")); + static ::rtl::OUString s_BackColorTransparency(RTL_CONSTASCII_USTRINGPARAM("BackColorTransparency")); + static ::rtl::OUString s_BackGraphicURL(RTL_CONSTASCII_USTRINGPARAM("BackGraphicURL")); + static ::rtl::OUString s_BackGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("BackGraphicFilter")); + static ::rtl::OUString s_BackGraphicLocation(RTL_CONSTASCII_USTRINGPARAM("BackGraphicLocation")); + static ::rtl::OUString s_BackGraphicTransparency(RTL_CONSTASCII_USTRINGPARAM("BackGraphicTransparency")); + + for(a = rProperties.begin(); a != rProperties.end(); a++) + { + if(a->mnIndex != -1) + { + const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex); + + if(s_BackColorRGB == rPropName + || s_BackTransparent == rPropName + || s_BackColorTransparency == rPropName + || s_BackGraphicURL == rPropName + || s_BackGraphicFilter == rPropName + || s_BackGraphicLocation == rPropName + || s_BackGraphicTransparency== rPropName) + { + // mark entry as inactive + a->mnIndex = -1; + } + } + } + } + + m_bIsFillStyleAlreadyConverted = sal_True; + } + struct _ContextID_Index_Pair aContextIDs[] = { { CTF_DASHNAME , -1 }, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits