This is an automated email from the ASF dual-hosted git repository. jimjag pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 321594d2d360557d383d443eff35f44610055cea Author: Jim Jagielski <[email protected]> AuthorDate: Wed Nov 4 12:16:47 2026 -0500 sw, xmloff: add a Decorative property to Writer frames and graphics, written as draw:decorative in ODF 1.4 --- main/sw/inc/cmdid.h | 1 + main/sw/inc/frmfmt.hxx | 2 ++ main/sw/inc/ndnotxt.hxx | 2 ++ main/sw/inc/unoprnms.hxx | 3 ++- main/sw/source/core/doc/doclay.cxx | 3 +++ main/sw/source/core/docnode/ndnotxt.cxx | 15 ++++++++++++ main/sw/source/core/graphic/ndgrf.cxx | 1 + main/sw/source/core/layout/atrfrm.cxx | 17 +++++++++++++ main/sw/source/core/ole/ndole.cxx | 1 + main/sw/source/core/unocore/unoframe.cxx | 41 ++++++++++++++++++++++++++++++++ main/sw/source/core/unocore/unomap.cxx | 1 + main/sw/source/core/unocore/unoprnms.cxx | 3 ++- main/xmloff/source/text/txtprmap.cxx | 1 + 13 files changed, 89 insertions(+), 2 deletions(-) diff --git a/main/sw/inc/cmdid.h b/main/sw/inc/cmdid.h index ec63d48689..842852d851 100644 --- a/main/sw/inc/cmdid.h +++ b/main/sw/inc/cmdid.h @@ -1234,6 +1234,7 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr #define FN_SET_FRM_ALT_NAME (FN_FRAME + 18) #define FN_UNO_TITLE (FN_FRAME + 19) #define FN_UNO_DESCRIPTION (FN_FRAME + 20) +#define FN_UNO_DECORATIVE (FN_FRAME + 21) #define SID_ATTR_PAGE_COLUMN (FN_SIDEBAR + 0) #define SID_ATTR_PAGE_ULSPACE (FN_SIDEBAR + 1) diff --git a/main/sw/inc/frmfmt.hxx b/main/sw/inc/frmfmt.hxx index 7c3da2f506..fe71cb3423 100644 --- a/main/sw/inc/frmfmt.hxx +++ b/main/sw/inc/frmfmt.hxx @@ -205,6 +205,8 @@ public: const String GetObjDescription() const; void SetObjDescription( const String& rDescription, bool bBroadcast = false ); + bool IsObjDecorative() const; + void SetObjDecorative( bool bDecorative ); // <-- /** SwFlyFrmFmt::IsBackgroundTransparent - for #99657# diff --git a/main/sw/inc/ndnotxt.hxx b/main/sw/inc/ndnotxt.hxx index f64ae62963..8f37fdffec 100644 --- a/main/sw/inc/ndnotxt.hxx +++ b/main/sw/inc/ndnotxt.hxx @@ -74,6 +74,8 @@ public: const String GetDescription() const; void SetDescription( const String& rDescription, bool bBroadcast = false ); + bool IsDecorative() const; + void SetDecorative( bool bDecorative ); // const String GetAlternateText() const; // void SetAlternateText( const String& rTxt, diff --git a/main/sw/inc/unoprnms.hxx b/main/sw/inc/unoprnms.hxx index 7be7ff1a79..3de091f45d 100644 --- a/main/sw/inc/unoprnms.hxx +++ b/main/sw/inc/unoprnms.hxx @@ -868,8 +868,9 @@ enum SwPropNameIds /* 0799 */ UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENT, /* 0800 */ UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENTNAME, /* 0801 */ UNO_NAME_FOOTER_FILLCOLOR_2, +/* 0802 */ UNO_NAME_DECORATIVE, -/* 0802 */ SW_PROPNAME_END +/* 0803 */ SW_PROPNAME_END }; diff --git a/main/sw/source/core/doc/doclay.cxx b/main/sw/source/core/doc/doclay.cxx index 3802d2cf8f..48c28d931a 100644 --- a/main/sw/source/core/doc/doclay.cxx +++ b/main/sw/source/core/doc/doclay.cxx @@ -1311,6 +1311,8 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, const String sDescription( bIsSwFlyFrmFmtInstance ? static_cast<SwFlyFrmFmt*>(pOldFmt)->GetObjDescription() : String() ); + const bool bDecorative( bIsSwFlyFrmFmtInstance + && static_cast<SwFlyFrmFmt*>(pOldFmt)->IsObjDecorative() ); // <-- pOldFmt->DelFrms(); @@ -1454,6 +1456,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, { static_cast<SwFlyFrmFmt*>(pOldFmt)->SetObjTitle( sTitle ); static_cast<SwFlyFrmFmt*>(pOldFmt)->SetObjDescription( sDescription ); + static_cast<SwFlyFrmFmt*>(pOldFmt)->SetObjDecorative( bDecorative ); } // <-- } diff --git a/main/sw/source/core/docnode/ndnotxt.cxx b/main/sw/source/core/docnode/ndnotxt.cxx index e51fbcff64..f5aae61f2d 100644 --- a/main/sw/source/core/docnode/ndnotxt.cxx +++ b/main/sw/source/core/docnode/ndnotxt.cxx @@ -334,4 +334,19 @@ const String SwNoTxtNode::GetDescription() const return pFlyFmt->GetObjDescription(); } + +bool SwNoTxtNode::IsDecorative() const +{ + const SwFlyFrmFmt* pFlyFmt = dynamic_cast<const SwFlyFrmFmt*>(GetFlyFmt()); + return pFlyFmt && pFlyFmt->IsObjDecorative(); +} + +void SwNoTxtNode::SetDecorative( bool bDecorative ) +{ + SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(GetFlyFmt()); + if ( pFlyFmt ) + { + pFlyFmt->SetObjDecorative( bDecorative ); + } +} // <-- diff --git a/main/sw/source/core/graphic/ndgrf.cxx b/main/sw/source/core/graphic/ndgrf.cxx index 61936e769a..557e4c73ca 100644 --- a/main/sw/source/core/graphic/ndgrf.cxx +++ b/main/sw/source/core/graphic/ndgrf.cxx @@ -1090,6 +1090,7 @@ SwCntntNode* SwGrfNode::MakeCopy( (SwAttrSet*) GetpSwAttrSet() ); pGrfNd->SetTitle( GetTitle() ); pGrfNd->SetDescription( GetDescription() ); + pGrfNd->SetDecorative( IsDecorative() ); pGrfNd->SetContour( HasContour(), HasAutomaticContour() ); return pGrfNd; } diff --git a/main/sw/source/core/layout/atrfrm.cxx b/main/sw/source/core/layout/atrfrm.cxx index 25ead5fb06..ae38358ca6 100644 --- a/main/sw/source/core/layout/atrfrm.cxx +++ b/main/sw/source/core/layout/atrfrm.cxx @@ -3083,6 +3083,23 @@ const String SwFlyFrmFmt::GetObjDescription() const return pMasterObject->GetDescription(); } + +bool SwFlyFrmFmt::IsObjDecorative() const +{ + const SdrObject* pMasterObject = FindSdrObject(); + return pMasterObject && pMasterObject->IsDecorative(); +} + +void SwFlyFrmFmt::SetObjDecorative( bool bDecorative ) +{ + SdrObject* pMasterObject = FindSdrObject(); + ASSERT( pMasterObject, + "<SwFlyFrmFmt::SetObjDecorative(..)> - missing <SdrObject> instance" ); + if ( pMasterObject ) + { + pMasterObject->SetDecorative( bDecorative ); + } +} // <-- /** SwFlyFrmFmt::IsBackgroundTransparent - for #99657# diff --git a/main/sw/source/core/ole/ndole.cxx b/main/sw/source/core/ole/ndole.cxx index f146d15e94..1dcf6c8710 100644 --- a/main/sw/source/core/ole/ndole.cxx +++ b/main/sw/source/core/ole/ndole.cxx @@ -482,6 +482,7 @@ SwCntntNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const pOLENd->SetChartTblName( GetChartTblName() ); pOLENd->SetTitle( GetTitle() ); pOLENd->SetDescription( GetDescription() ); + pOLENd->SetDecorative( IsDecorative() ); pOLENd->SetContour( HasContour(), HasAutomaticContour() ); pOLENd->SetAspect( GetAspect() ); // the replacement image must be already copied diff --git a/main/sw/source/core/unocore/unoframe.cxx b/main/sw/source/core/unocore/unoframe.cxx index 406a8dd4d1..3e84eb0394 100644 --- a/main/sw/source/core/unocore/unoframe.cxx +++ b/main/sw/source/core/unocore/unoframe.cxx @@ -1472,6 +1472,21 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: GetOrCreateSdrObject( pFlyFmt ); pFlyFmt->GetDoc()->SetFlyFrmDescription( *(pFlyFmt), sDescription ); } + else if( FN_UNO_DECORATIVE == pEntry->nWID ) + { + SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt); + ASSERT( pFmt, + "unexpected type of <pFmt> --> crash" ); + sal_Bool bDecorative = sal_False; + aValue >>= bDecorative; + // assure that <SdrObject> instance exists. + GetOrCreateSdrObject( pFlyFmt ); + if ( pFlyFmt->IsObjDecorative() != ( bDecorative != sal_False ) ) + { + pFlyFmt->SetObjDecorative( bDecorative ); + pFlyFmt->GetDoc()->SetModified(); + } + } // <-- else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID) { @@ -2113,6 +2128,11 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) GetOrCreateSdrObject( pFlyFmt ); aAny <<= OUString(pFlyFmt->GetObjDescription()); } + else if( FN_UNO_DECORATIVE == pEntry->nWID ) + { + const SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt); + aAny <<= static_cast<sal_Bool>( pFlyFmt && pFlyFmt->IsObjDecorative() ); + } // <-- else if(eType == FLYCNTTYPE_GRF && (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ACTUAL_SIZE)))) @@ -2385,6 +2405,13 @@ uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates( { pStates[i] = beans::PropertyState_DIRECT_VALUE; } + else if(FN_UNO_DECORATIVE == pEntry->nWID) + { + // no item behind it: a default of false must not be exported + const SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt); + pStates[i] = ( pFlyFmt && pFlyFmt->IsObjDecorative() ) + ? beans::PropertyState_DIRECT_VALUE : beans::PropertyState_DEFAULT_VALUE; + } else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID) { //UUUU @@ -2519,6 +2546,15 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName ) GetOrCreateSdrObject( pFlyFmt ); pFlyFmt->GetDoc()->SetFlyFrmDescription( *(pFlyFmt), aEmptyStr ); } + else if( FN_UNO_DECORATIVE == pEntry->nWID ) + { + SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt); + if ( pFlyFmt && pFlyFmt->IsObjDecorative() ) + { + pFlyFmt->SetObjDecorative( false ); + pFlyFmt->GetDoc()->SetModified(); + } + } // <-- else { @@ -2997,6 +3033,11 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan { setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_DESCRIPTION)), *pDescription); } + const ::uno::Any* pDecorative; + if ( pProps->GetProperty(FN_UNO_DECORATIVE, 0, pDecorative) ) + { + setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_DECORATIVE)), *pDecorative); + } // <-- } else diff --git a/main/sw/source/core/unocore/unomap.cxx b/main/sw/source/core/unocore/unomap.cxx index 982582e548..24fee9f530 100644 --- a/main/sw/source/core/unocore/unomap.cxx +++ b/main/sw/source/core/unocore/unomap.cxx @@ -362,6 +362,7 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider() { 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_TITLE), FN_UNO_TITLE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, \ { SW_PROP_NMID(UNO_NAME_DESCRIPTION), FN_UNO_DESCRIPTION, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, \ + { SW_PROP_NMID(UNO_NAME_DECORATIVE), FN_UNO_DECORATIVE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, \ { SW_PROP_NMID(UNO_NAME_LAYOUT_SIZE), WID_LAYOUT_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PropertyAttribute::MAYBEVOID | PropertyAttribute::READONLY, 0 }, diff --git a/main/sw/source/core/unocore/unoprnms.cxx b/main/sw/source/core/unocore/unoprnms.cxx index 8988bef415..9fc322f904 100644 --- a/main/sw/source/core/unocore/unoprnms.cxx +++ b/main/sw/source/core/unocore/unoprnms.cxx @@ -860,7 +860,8 @@ const SwPropNameTab aPropNameTab = { /* 0798 UNO_NAME_FOOTER_FILL_TRANSPARENCE */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILL_TRANSPARENCE)}, /* 0799 UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENT */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLTRANSPARENCEGRADIENT)}, /* 0800 UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENTNAME */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLTRANSPARENCEGRADIENTNAME)}, -/* 0801 UNO_NAME_FOOTER_FILLCOLOR_2 */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLCOLOR_2)} +/* 0801 UNO_NAME_FOOTER_FILLCOLOR_2 */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLCOLOR_2)}, +/* 0802 UNO_NAME_DECORATIVE */ {MAP_CHAR_LEN("Decorative")} }; diff --git a/main/xmloff/source/text/txtprmap.cxx b/main/xmloff/source/text/txtprmap.cxx index c9b176399c..c827e0a3da 100644 --- a/main/xmloff/source/text/txtprmap.cxx +++ b/main/xmloff/source/text/txtprmap.cxx @@ -628,6 +628,7 @@ XMLPropertyMapEntry aXMLFramePropMap[] = // not required // RES_PRINT MG_E( "Print", STYLE, PRINT_CONTENT, XML_TYPE_BOOL, 0 ), + MG_EV( "Decorative", DRAW, DECORATIVE, XML_TYPE_BOOL, 0, SvtSaveOptions::ODFVER_014 ), // RES_OPAQUE MG_ED( "Opaque", STYLE, RUN_THROUGH, XML_TYPE_TEXT_OPAQUE, 0 ), // RES_PROTECT
