diff options
38 files changed, 342 insertions, 15 deletions
diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx index 423703e526f7..97715b07c295 100644 --- a/chart2/source/controller/main/ShapeController.cxx +++ b/chart2/source/controller/main/ShapeController.cxx @@ -401,16 +401,19 @@ void ShapeController::executeDispatch_ObjectTitleDescription() OUString aTitle( pSelectedObj->GetTitle() ); OUString aDescription( pSelectedObj->GetDescription() ); + bool isDecorative(pSelectedObj->IsDecorative()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); weld::Window* pChartWindow(m_pChartController->GetChartFrame()); ScopedVclPtr< AbstractSvxObjectTitleDescDialog > pDlg( - pFact->CreateSvxObjectTitleDescDialog(pChartWindow, aTitle, aDescription)); + pFact->CreateSvxObjectTitleDescDialog(pChartWindow, aTitle, aDescription, isDecorative)); if ( pDlg->Execute() == RET_OK ) { pDlg->GetTitle( aTitle ); pDlg->GetDescription( aDescription ); + pDlg->IsDecorative(isDecorative); pSelectedObj->SetTitle( aTitle ); pSelectedObj->SetDescription( aDescription ); + pSelectedObj->SetDecorative(isDecorative); } } diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx index d6666a0a3f49..84f21a86d616 100644 --- a/cui/source/dialogs/dlgname.cxx +++ b/cui/source/dialogs/dlgname.cxx @@ -87,10 +87,12 @@ IMPL_LINK_NOARG(SvxObjectNameDialog, ModifyHdl, weld::Entry&, void) // Dialog for editing Object Title and Description SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, - const OUString& rDescription) + const OUString& rDescription, + bool const isDecorative) : GenericDialogController(pParent, "cui/ui/objecttitledescdialog.ui", "ObjectTitleDescDialog") , m_xEdtTitle(m_xBuilder->weld_entry("object_title_entry")) , m_xEdtDescription(m_xBuilder->weld_text_view("desc_entry")) + , m_xDecorativeCB(m_xBuilder->weld_check_button("decorative")) { //lock height to initial height m_xEdtDescription->set_size_request(-1, m_xEdtDescription->get_text_height() * 5); @@ -100,6 +102,8 @@ SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(weld::Window* pParent, const // activate title m_xEdtTitle->select_region(0, -1); + + m_xDecorativeCB->set_active(isDecorative); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 303467ba51d1..346bb8bc8370 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -630,6 +630,11 @@ void AbstractSvxObjectTitleDescDialog_Impl::GetDescription(OUString& rDescriptio rDescription = m_xDlg->GetDescription(); } +void AbstractSvxObjectTitleDescDialog_Impl::IsDecorative(bool & rIsDecorative) +{ + rIsDecorative = m_xDlg->IsDecorative(); +} + OUString AbstractSvxMultiPathDialog_Impl::GetPath() const { return m_xDlg->GetPath(); @@ -1098,9 +1103,9 @@ VclPtr<AbstractSvxObjectNameDialog> AbstractDialogFactory_Impl::CreateSvxObjectN return VclPtr<AbstractSvxObjectNameDialog_Impl>::Create(std::make_unique<SvxObjectNameDialog>(pParent, rName)); } -VclPtr<AbstractSvxObjectTitleDescDialog> AbstractDialogFactory_Impl::CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription) +VclPtr<AbstractSvxObjectTitleDescDialog> AbstractDialogFactory_Impl::CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription, bool const isDecorative) { - return VclPtr<AbstractSvxObjectTitleDescDialog_Impl>::Create(std::make_unique<SvxObjectTitleDescDialog>(pParent, rTitle, rDescription)); + return VclPtr<AbstractSvxObjectTitleDescDialog_Impl>::Create(std::make_unique<SvxObjectTitleDescDialog>(pParent, rTitle, rDescription, isDecorative)); } VclPtr<AbstractSvxMultiPathDialog> AbstractDialogFactory_Impl::CreateSvxMultiPathDialog(weld::Window* pParent) diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 900013184ddd..cd3f638aced5 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -297,6 +297,7 @@ private: DECL_ABSTDLG_CLASS(AbstractSvxObjectTitleDescDialog,SvxObjectTitleDescDialog) virtual void GetTitle(OUString& rName) override; virtual void GetDescription(OUString& rName) override; + virtual void IsDecorative(bool & rIsDecorative) override; }; // AbstractSvxMultiPathDialog_Impl @@ -523,7 +524,7 @@ public: const OUString& rName, const OUString& rDesc) override; // #i68101# virtual VclPtr<AbstractSvxObjectNameDialog> CreateSvxObjectNameDialog(weld::Window* pParent, const OUString& rName) override; - virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription) override; + virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription, bool isDecorative) override; virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxMultiPathDialog(weld::Window* pParent) override; virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxPathSelectDialog(weld::Window* pParent) override; virtual VclPtr<AbstractSvxHpLinkDlg> CreateSvxHpLinkDlg(SfxChildWindow* pChild, SfxBindings* pBindings, weld::Window* pParent) override; diff --git a/cui/uiconfig/ui/objecttitledescdialog.ui b/cui/uiconfig/ui/objecttitledescdialog.ui index 547ccc066e34..e2cc8f1330ba 100644 --- a/cui/uiconfig/ui/objecttitledescdialog.ui +++ b/cui/uiconfig/ui/objecttitledescdialog.ui @@ -160,6 +160,26 @@ <property name="position">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="decorative"> + <property name="label" translatable="yes" context="objecttitledescdialog|decorative">Decorative</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="decorative-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="objecttitledescdialog|extended_tip|decorative">The item is purely decorative, not part of the document content, and may be ignored by assistive technologies.</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> </object> <packing> <property name="expand">True</property> diff --git a/include/cui/dlgname.hxx b/include/cui/dlgname.hxx index 1a7ffc4f3bd5..04fc5610e937 100644 --- a/include/cui/dlgname.hxx +++ b/include/cui/dlgname.hxx @@ -110,12 +110,16 @@ private: // description std::unique_ptr<weld::TextView> m_xEdtDescription; + std::unique_ptr<weld::CheckButton> m_xDecorativeCB; + public: // constructor - SvxObjectTitleDescDialog(weld::Window* pWindow, const OUString& rTitle, const OUString& rDesc); + SvxObjectTitleDescDialog(weld::Window* pWindow, const OUString& rTitle, const OUString& rDesc, + bool isDecorative); // data access OUString GetTitle() const { return m_xEdtTitle->get_text(); } OUString GetDescription() const { return m_xEdtDescription->get_text(); } + bool IsDecorative() const { return m_xDecorativeCB->get_active(); } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svl/solar.hrc b/include/svl/solar.hrc index 5caeb64f40c2..f1ec1a456829 100644 --- a/include/svl/solar.hrc +++ b/include/svl/solar.hrc @@ -23,7 +23,7 @@ // defines ------------------------------------------------------------------ #define OWN_ATTR_VALUE_START 3900 -#define OWN_ATTR_VALUE_END 4007 +#define OWN_ATTR_VALUE_END 4008 #define RID_LIB_START 10000 #define RID_LIB_END 19999 diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc index eb8ca335f91c..80066b3d33f3 100644 --- a/include/svx/strings.hrc +++ b/include/svx/strings.hrc @@ -258,6 +258,7 @@ #define STR_UndoObjName NC_("STR_UndoObjName", "Change object name of %1 to") #define STR_UndoObjTitle NC_("STR_UndoObjTitle", "Change object title of %1") #define STR_UndoObjDescription NC_("STR_UndoObjDescription", "Change object description of %1") +#define STR_UndoObjDecorative NC_("STR_UndoObjDecorative", "Change decorative of %1") #define STR_ItemValON NC_("STR_ItemValON", "on") #define STR_ItemValOFF NC_("STR_ItemValOFF", "off") #define STR_ItemValYES NC_("STR_ItemValYES", "yes") diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 54376b1f0397..8dadf982b490 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -380,6 +380,8 @@ public: virtual OUString GetTitle() const; virtual void SetDescription(const OUString& rStr); virtual OUString GetDescription() const; + virtual void SetDecorative(bool isDecorative); + virtual bool IsDecorative() const; // for group objects bool IsGroupObject() const; diff --git a/include/svx/svdovirt.hxx b/include/svx/svdovirt.hxx index fc8ce86247ed..8ccddce4d263 100644 --- a/include/svx/svdovirt.hxx +++ b/include/svx/svdovirt.hxx @@ -68,6 +68,8 @@ public: virtual OUString GetTitle() const override; virtual void SetDescription(const OUString& rStr) override; virtual OUString GetDescription() const override; + virtual void SetDecorative(bool isDecorative) override; + virtual bool IsDecorative() const override; virtual const tools::Rectangle& GetCurrentBoundRect() const override; virtual const tools::Rectangle& GetLastBoundRect() const override; diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx index f198a3c3e554..36c59ca482a4 100644 --- a/include/svx/svdundo.hxx +++ b/include/svx/svdundo.hxx @@ -476,6 +476,20 @@ private: }; +class SdrUndoObjDecorative final : public SdrUndoObj +{ +private: + bool const m_WasDecorative; + +public: + SdrUndoObjDecorative(SdrObject & rObj, bool const WasDecorative); + + virtual void Undo() override; + virtual void Redo() override; + + virtual OUString GetComment() const override; +}; + /* * Layer @@ -747,6 +761,8 @@ public: SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType, const OUString& sOldStr, const OUString& sNewStr ); + static std::unique_ptr<SdrUndoAction> CreateUndoObjectDecorative(SdrObject& rObject, + bool const WasDecorative); // Diagram ModelData changes virtual std::unique_ptr<SdrUndoAction> CreateUndoDiagramModelData( SdrObject& rObject, std::shared_ptr< svx::diagram::DiagramDataState >& rStartState ); diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 3ac7ac86d008..d5a0b5fec7fc 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -186,6 +186,7 @@ protected: public: virtual void GetTitle(OUString& rTitle) = 0; virtual void GetDescription(OUString& rDescription) = 0; + virtual void IsDecorative(bool & rIsDecorative) = 0; }; /// Abstract class provides the get information from the numbering and position dialog. @@ -380,7 +381,7 @@ public: // #i68101# virtual VclPtr<AbstractSvxObjectNameDialog> CreateSvxObjectNameDialog(weld::Window* pParent, const OUString& rName) = 0; - virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription) = 0; + virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription, bool isDecorative) = 0; virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxMultiPathDialog(weld::Window* pParent) = 0 ; virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxPathSelectDialog(weld::Window* pParent) = 0 ; virtual VclPtr<AbstractSvxHpLinkDlg> CreateSvxHpLinkDlg(SfxChildWindow* pChild, SfxBindings* pBindings, weld::Window* pParent) = 0; diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx index 6c60eac60933..aef31edf1e19 100644 --- a/include/svx/unoshprp.hxx +++ b/include/svx/unoshprp.hxx @@ -196,7 +196,8 @@ #define OWN_ATTR_TEXTFITTOSIZESCALE (OWN_ATTR_VALUE_START+105) #define OWN_ATTR_TEXTCOLUMNS (OWN_ATTR_VALUE_START+106) #define OWN_ATTR_HYPERLINK (OWN_ATTR_VALUE_START+107) -// ATTENTION: current maximum is OWN_ATTR_VALUE_START+107 svx; wnen adding values, update +#define OWN_ATTR_MISC_OBJ_DECORATIVE (OWN_ATTR_VALUE_START+108) +// ATTENTION: current maximum is OWN_ATTR_VALUE_START+108 svx; when adding values, update // OWN_ATTR_VALUE_END in include/svl/solar.hrc accordingly // #FontWork# @@ -369,6 +370,7 @@ /* #i68101# */ \ { UNO_NAME_MISC_OBJ_TITLE, OWN_ATTR_MISC_OBJ_TITLE , ::cppu::UnoType<OUString>::get(), 0, 0}, \ { UNO_NAME_MISC_OBJ_DESCRIPTION, OWN_ATTR_MISC_OBJ_DESCRIPTION , ::cppu::UnoType<OUString>::get(), 0, 0}, \ + { u"Decorative", OWN_ATTR_MISC_OBJ_DECORATIVE, ::cppu::UnoType<bool>::get(), 0, 0}, \ { UNO_NAME_HYPERLINK, OWN_ATTR_HYPERLINK, ::cppu::UnoType<OUString>::get(), 0, 0}, \ { u"WritingMode", SDRATTR_WRITINGMODE2, ::cppu::UnoType<sal_Int16>::get(), 0, 0}, diff --git a/offapi/com/sun/star/drawing/Shape.idl b/offapi/com/sun/star/drawing/Shape.idl index 118031488426..0dc5e397ac93 100644 --- a/offapi/com/sun/star/drawing/Shape.idl +++ b/offapi/com/sun/star/drawing/Shape.idl @@ -202,6 +202,15 @@ published service Shape */ [optional, property] string Description; + /** Determines if the shape is purely decorative. + + If `TRUE`, it is considered not part of the document content, + and may be ignored by assistive technologies. + + @since LibreOffice 7.6 + */ + [optional, property] boolean Decorative; + }; diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx index 4e95a7d65b07..7c39afc2de0d 100644 --- a/sc/source/ui/drawfunc/drawsh5.cxx +++ b/sc/source/ui/drawfunc/drawsh5.cxx @@ -578,11 +578,12 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) { OUString aTitle(pSelected->GetTitle()); OUString aDescription(pSelected->GetDescription()); + bool isDecorative(pSelected->IsDecorative()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); vcl::Window* pWin = rViewData.GetActiveWin(); ScopedVclPtr<AbstractSvxObjectTitleDescDialog> pDlg(pFact->CreateSvxObjectTitleDescDialog( - pWin ? pWin->GetFrameWeld() : nullptr, aTitle, aDescription)); + pWin ? pWin->GetFrameWeld() : nullptr, aTitle, aDescription, isDecorative)); if(RET_OK == pDlg->Execute()) { @@ -591,8 +592,10 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) // handle Title and Description pDlg->GetTitle(aTitle); pDlg->GetDescription(aDescription); + pDlg->IsDecorative(isDecorative); pSelected->SetTitle(aTitle); pSelected->SetDescription(aDescription); + pSelected->SetDecorative(isDecorative); // ChartListenerCollectionNeedsUpdate is needed for Navigator update pDocSh->GetDocument().SetChartListenerCollectionNeedsUpdate( true ); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index aecd672e78fa..7dc9e98a167f 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -2722,17 +2722,20 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)"); OUString aTitle(pSelected->GetTitle()); OUString aDescription(pSelected->GetDescription()); + bool isDecorative(pSelected->IsDecorative()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<AbstractSvxObjectTitleDescDialog> pDlg(pFact->CreateSvxObjectTitleDescDialog( - GetFrameWeld(), aTitle, aDescription)); + GetFrameWeld(), aTitle, aDescription, isDecorative)); if(RET_OK == pDlg->Execute()) { pDlg->GetTitle(aTitle); pDlg->GetDescription(aDescription); + pDlg->IsDecorative(isDecorative); pSelected->SetTitle(aTitle); pSelected->SetDescription(aDescription); + pSelected->SetDecorative(isDecorative); } } diff --git a/svx/source/inc/svdobjplusdata.hxx b/svx/source/inc/svdobjplusdata.hxx index 5e00a37c57c6..ef2bc2abd027 100644 --- a/svx/source/inc/svdobjplusdata.hxx +++ b/svx/source/inc/svdobjplusdata.hxx @@ -32,6 +32,7 @@ class SdrObjPlusData final OUString aObjName; OUString aObjTitle; OUString aObjDescription; + bool isDecorative = false; public: SdrObjPlusData(); diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index bc3b5ee178bd..fabf99a13d75 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -398,7 +398,7 @@ drawinglayer::primitive2d::Primitive2DContainer const & ViewObjectContact::getPr // was done at ImplRenderPaintProc::createRedirectedPrimitive2DSequence before if (!xNewPrimitiveSequence.empty() && isExportPDFTags()) { - if (nullptr != pSdrObj) + if (nullptr != pSdrObj && !pSdrObj->IsDecorative()) { vcl::PDFWriter::StructElement eElement(vcl::PDFWriter::NonStructElement); const SdrInventor nInventor(pSdrObj->GetObjInventor()); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 03f9f0f95739..6ea7dfe83839 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -868,6 +868,40 @@ OUString SdrObject::GetDescription() const return OUString(); } +void SdrObject::SetDecorative(bool const isDecorative) +{ + ImpForcePlusData(); + + if (m_pPlusData->isDecorative == isDecorative) + { + return; + } + + if (getSdrModelFromSdrObject().IsUndoEnabled()) + { + std::unique_ptr<SdrUndoAction> pUndoAction( + SdrUndoFactory::CreateUndoObjectDecorative( + *this, m_pPlusData->isDecorative)); + getSdrModelFromSdrObject().BegUndo(pUndoAction->GetComment()); + getSdrModelFromSdrObject().AddUndo(std::move(pUndoAction)); + } + + m_pPlusData->isDecorative = isDecorative; + + if (getSdrModelFromSdrObject().IsUndoEnabled()) + { + getSdrModelFromSdrObject().EndUndo(); + } + + SetChanged(); + BroadcastObjectChange(); +} + +bool SdrObject::IsDecorative() const +{ + return m_pPlusData == nullptr ? false : m_pPlusData->isDecorative; +} + sal_uInt32 SdrObject::GetOrdNum() const { if (SdrObjList* pParentList = getParentSdrObjListFromSdrObject()) diff --git a/svx/source/svdraw/svdobjplusdata.cxx b/svx/source/svdraw/svdobjplusdata.cxx index af27c5629fa8..8318b3df963f 100644 --- a/svx/source/svdraw/svdobjplusdata.cxx +++ b/svx/source/svdraw/svdobjplusdata.cxx @@ -50,6 +50,7 @@ SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const pNewPlusData->aObjName = aObjName; pNewPlusData->aObjTitle = aObjTitle; pNewPlusData->aObjDescription = aObjDescription; + pNewPlusData->isDecorative = isDecorative; return pNewPlusData; } diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx index e8f6284b3b2e..25a38804a78b 100644 --- a/svx/source/svdraw/svdovirt.cxx +++ b/svx/source/svdraw/svdovirt.cxx @@ -141,6 +141,16 @@ OUString SdrVirtObj::GetDescription() const return mxRefObj->GetDescription(); } +void SdrVirtObj::SetDecorative(bool const isDecorative) +{ + return mxRefObj->SetDecorative(isDecorative); +} + +bool SdrVirtObj::IsDecorative() const +{ + return mxRefObj->IsDecorative(); +} + const tools::Rectangle& SdrVirtObj::GetCurrentBoundRect() const { auto aRectangle = mxRefObj->GetCurrentBoundRect(); // TODO: Optimize this. diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 9df18d9eb1f7..3788f8d7154c 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -1216,6 +1216,31 @@ OUString SdrUndoObjStrAttr::GetComment() const return aStr; } +SdrUndoObjDecorative::SdrUndoObjDecorative(SdrObject & rObj, bool const WasDecorative) + : SdrUndoObj(rObj) + , m_WasDecorative(WasDecorative) +{ +} + +void SdrUndoObjDecorative::Undo() +{ + ImpShowPageOfThisObject(); + + mxObj->SetDecorative(m_WasDecorative); +} + +void SdrUndoObjDecorative::Redo() +{ + mxObj->SetDecorative(!m_WasDecorative); + + ImpShowPageOfThisObject(); +} + +OUString SdrUndoObjDecorative::GetComment() const +{ + return ImpGetDescriptionStr(STR_UndoObjDecorative); +} + SdrUndoLayer::SdrUndoLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel) : SdrUndoAction(rNewModel) @@ -1714,6 +1739,12 @@ std::unique_ptr<SdrUndoAction> SdrUndoFactory::CreateUndoObjectStrAttr( SdrObjec return std::make_unique<SdrUndoObjStrAttr>( rObject, eObjStrAttrType, sOldStr, sNewStr ); } +std::unique_ptr<SdrUndoAction> SdrUndoFactory::CreateUndoObjectDecorative( + SdrObject& rObject, bool const WasDecorative) +{ + return std::make_unique<SdrUndoObjDecorative>(rObject, WasDecorative); +} + // layer std::unique_ptr<SdrUndoAction> SdrUndoFactory::CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel) diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index 0022cb77f4f5..105ed7a2d60e 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -475,6 +475,7 @@ static o3tl::span<SfxItemPropertyMapEntry const> ImplGetSvxPluginPropertyMap() // #i68101# { UNO_NAME_MISC_OBJ_TITLE, OWN_ATTR_MISC_OBJ_TITLE , cppu::UnoType<OUString>::get(), 0, 0}, { UNO_NAME_MISC_OBJ_DESCRIPTION, OWN_ATTR_MISC_OBJ_DESCRIPTION , cppu::UnoType<OUString>::get(), 0, 0}, + { u"Decorative", OWN_ATTR_MISC_OBJ_DECORATIVE, ::cppu::UnoType<bool>::get(), 0, 0 }, }; return aPluginPropertyMap_Impl; @@ -509,6 +510,7 @@ static o3tl::span<SfxItemPropertyMapEntry const> ImplGetSvxFramePropertyMap() // #i68101# { UNO_NAME_MISC_OBJ_TITLE, OWN_ATTR_MISC_OBJ_TITLE , cppu::UnoType<OUString>::get(), 0, 0}, { UNO_NAME_MISC_OBJ_DESCRIPTION, OWN_ATTR_MISC_OBJ_DESCRIPTION , cppu::UnoType<OUString>::get(), 0, 0}, + { u"Decorative", OWN_ATTR_MISC_OBJ_DECORATIVE, ::cppu::UnoType<bool>::get(), 0, 0 }, }; return aFramePropertyMap_Impl; @@ -542,6 +544,7 @@ static o3tl::span<SfxItemPropertyMapEntry const> ImplGetSvxAppletPropertyMap() // #i68101# { UNO_NAME_MISC_OBJ_TITLE, OWN_ATTR_MISC_OBJ_TITLE , cppu::UnoType<OUString>::get(), 0, 0}, { UNO_NAME_MISC_OBJ_DESCRIPTION, OWN_ATTR_MISC_OBJ_DESCRIPTION , cppu::UnoType<OUString>::get(), 0, 0}, + { u"Decorative", OWN_ATTR_MISC_OBJ_DECORATIVE, ::cppu::UnoType<bool>::get(), 0, 0 }, }; return aAppletPropertyMap_Impl; @@ -598,6 +601,7 @@ static o3tl::span<SfxItemPropertyMapEntry const> ImplGetSvxControlShapePropertyM // #i68101# { UNO_NAME_MISC_OBJ_TITLE, OWN_ATTR_MISC_OBJ_TITLE , cppu::UnoType<OUString>::get(), 0, 0}, { UNO_NAME_MISC_OBJ_DESCRIPTION, OWN_ATTR_MISC_OBJ_DESCRIPTION , cppu::UnoType<OUString>::get(), 0, 0}, + { u"Decorative", OWN_ATTR_MISC_OBJ_DECORATIVE, ::cppu::UnoType<bool>::get(), 0, 0 }, // #i112587# { UNO_NAME_MISC_OBJ_PRINTABLE, SDRATTR_OBJPRINTABLE , cppu::UnoType<bool>::get(), 0, 0}, { u"Visible", SDRATTR_OBJVISIBLE , cppu::UnoType<bool>::get(), 0, 0}, @@ -624,6 +628,7 @@ static o3tl::span<SfxItemPropertyMapEntry const> ImplGetSvxPageShapePropertyMap( // #i68101# { UNO_NAME_MISC_OBJ_TITLE, OWN_ATTR_MISC_OBJ_TITLE , cppu::UnoType<OUString>::get(), 0, 0}, { UNO_NAME_MISC_OBJ_DESCRIPTION, OWN_ATTR_MISC_OBJ_DESCRIPTION , cppu::UnoType<OUString>::get(), 0, 0}, + { u"Decorative", OWN_ATTR_MISC_OBJ_DECORATIVE, ::cppu::UnoType<bool>::get(), 0, 0 }, }; return aPageShapePropertyMap_Impl; @@ -709,6 +714,7 @@ static o3tl::span<SfxItemPropertyMapEntry const> ImplGetSvxMediaShapePropertyMap // #i68101# { UNO_NAME_MISC_OBJ_TITLE, OWN_ATTR_MISC_OBJ_TITLE , cppu::UnoType<OUString>::get(), 0, 0}, { UNO_NAME_MISC_OBJ_DESCRIPTION, OWN_ATTR_MISC_OBJ_DESCRIPTION , cppu::UnoType<OUString>::get(), 0, 0}, + { u"Decorative", OWN_ATTR_MISC_OBJ_DECORATIVE, ::cppu::UnoType<bool>::get(), 0, 0 }, {u"PrivateStream", OWN_ATTR_MEDIA_STREAM, cppu::UnoType<css::io::XInputStream>::get(), 0, 0}, {u"PrivateTempFileURL", OWN_ATTR_MEDIA_TEMPFILEURL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY, 0}, { u"MediaMimeType", OWN_ATTR_MEDIA_MIMETYPE, cppu::UnoType<OUString>::get(), 0, 0}, @@ -738,6 +744,7 @@ static o3tl::span<SfxItemPropertyMapEntry const> ImplGetSvxTableShapePropertyMap { u"UINameSingular", OWN_ATTR_UINAME_SINGULAR , ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY, 0}, { UNO_NAME_MISC_OBJ_TITLE, OWN_ATTR_MISC_OBJ_TITLE , cppu::UnoType<OUString>::get(), 0, 0}, { UNO_NAME_MISC_OBJ_DESCRIPTION, OWN_ATTR_MISC_OBJ_DESCRIPTION , cppu::UnoType<OUString>::get(), 0, 0}, + { u"Decorative", OWN_ATTR_MISC_OBJ_DECORATIVE, ::cppu::UnoType<bool>::get(), 0, 0 }, { u"Model", OWN_ATTR_OLEMODEL , cppu::UnoType<css::table::XTable>::get(), css::beans::PropertyAttribute::READONLY, 0}, { u"TableTemplate", OWN_ATTR_TABLETEMPLATE , cppu::UnoType<css::container::XIndexAccess>::get(), 0, 0}, { u"UseFirstRowStyle", OWN_ATTR_TABLETEMPLATE_FIRSTROW, cppu::UnoType<bool>::get(),0, 0}, diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 95adad4150a0..b186a95097c2 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -2395,6 +2395,16 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn } break; } + case OWN_ATTR_MISC_OBJ_DECORATIVE: + { + bool isDecorative; + if (rValue >>= isDecorative) + { + pSdrObject->SetDecorative(isDecorative); + return true; + } + break; + } case SDRATTR_OBJPRINTABLE: { @@ -2839,6 +2849,13 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn break; } + case OWN_ATTR_MISC_OBJ_DECORATIVE: + { + bool const isDecorative(GetSdrObject()->IsDecorative()); + rValue <<= isDecorative; + break; + } + case SDRATTR_OBJPRINTABLE: rValue <<= GetSdrObject()->IsPrintable(); break; diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index c709db694d07..9fce6c92e4c9 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -637,6 +637,8 @@ public: const OUString& sNewTitle ); void SetFlyFrameDescription( SwFlyFrameFormat& rFlyFrameFormat, const OUString& sNewDescription ); + void SetFlyFrameDecorative(SwFlyFrameFormat& rFlyFrameFormat, + bool isDecorative); // Footnotes // Footnote information diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 63dc89afbc74..ce1cdc79f3fd 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -379,6 +379,8 @@ public: void SetObjTitle( const OUString& rTitle ); OUString GetObjDescription() const; void SetObjDescription( const OUString& rDescription ); + bool IsObjDecorative() const; + void SetObjDecorative(bool isDecorative); bool IsFrameSelected() const; bool GetFlyFrameAttr( SfxItemSet &rSet ) const; diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index c619da0e95a8..cb9846f969c4 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -256,6 +256,7 @@ public: OUString GetObjDescription() const; void SetObjDescription( const OUString& rDescription, bool bBroadcast = false ); + void SetObjDecorative(bool isDecorative); /** SwFlyFrameFormat::IsBackgroundTransparent diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index 99cbc47b55b3..16df1a234e3c 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -592,6 +592,7 @@ #define STR_PARAGRAPH_SIGN_UNDO NC_("STR_PARAGRAPH_SIGN_UNDO", "Paragraph sign") #define STR_UNDO_FLYFRMFMT_TITLE NC_("STR_UNDO_FLYFRMFMT_TITLE", "Change object title of $1") #define STR_UNDO_FLYFRMFMT_DESCRIPTION NC_("STR_UNDO_FLYFRMFMT_DESCRIPTION", "Change object description of $1") +#define STR_UNDO_FLYFRMFMT_DECORATIVE NC_("STR_UNDO_FLYFRMFMT_DECORATIVE", "Change decorative of $1") #define STR_UNDO_TBLSTYLE_CREATE NC_("STR_UNDO_TBLSTYLE_CREATE", "Create table style: $1") #define STR_UNDO_TBLSTYLE_DELETE NC_("STR_UNDO_TBLSTYLE_DELETE", "Delete table style: $1") #define STR_UNDO_TBLSTYLE_UPDATE NC_("STR_UNDO_TBLSTYLE_UPDATE", "Update table style: $1") diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx index a0a7d918d017..dc91de5aff4d 100644 --- a/sw/inc/swundo.hxx +++ b/sw/inc/swundo.hxx @@ -179,6 +179,7 @@ enum class SwUndoId UPDATE_SECTIONS, // 147 CHANGE_THEME = 148, DELETE_SECTIONS = 149, + FLYFRMFMT_DECORATIVE = 150, }; OUString GetUndoComment(SwUndoId eId); diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 3d94cffef514..a0edbf934d9b 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -595,6 +595,28 @@ void SwDoc::SetFlyFrameDescription( SwFlyFrameFormat& rFlyFrameFormat, getIDocumentState().SetModified(); } +void SwDoc::SetFlyFrameDecorative(SwFlyFrameFormat& rFlyFrameFormat, + bool const isDecorative) +{ + if (rFlyFrameFormat.GetAttrSet().Get(RES_DECORATIVE).GetValue() == isDecorative) + { + return; + } + + ::sw::DrawUndoGuard const drawUndoGuard(GetIDocumentUndoRedo()); + + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().AppendUndo( + std::make_unique<SwUndoFlyDecorative>(rFlyFrameFormat, isDecorative)); + } + + rFlyFrameFormat.SetObjDecorative(isDecorative); + + getIDocumentState().SetModified(); +} + + bool SwDoc::SetFrameFormatToFly( SwFrameFormat& rFormat, SwFrameFormat& rNewFormat, SfxItemSet* pSet, bool bKeepOrient ) { diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 92f41ef0597e..2fb646150d0e 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -2045,6 +2045,55 @@ void SwFEShell::SetObjDescription( const OUString& rDescription ) } } +bool SwFEShell::IsObjDecorative() const +{ + if (!Imp()->HasDrawView()) + { + return false; + } + + SdrMarkList const& rMarkList(Imp()->GetDrawView()->GetMarkedObjectList()); + if (rMarkList.GetMarkCount() != 1) + { + return false; + } + + SdrObject const*const pObj(rMarkList.GetMark(0)->GetMarkedSdrObj()); + SwFrameFormat const*const pFormat(FindFrameFormat(pObj)); + if (pFormat->Which() == RES_FLYFRMFMT) + { + return dynamic_cast<const SwFlyFrameFormat&>(*pFormat).GetAttrSet().Get(RES_DECORATIVE).GetValue(); + } + return pObj->IsDecorative(); +} + +void SwFEShell::SetObjDecorative(bool const isDecorative) +{ + if (!Imp()->HasDrawView()) + { + return; + } + + SdrMarkList const& rMarkList(Imp()->GetDrawView()->GetMarkedObjectList()); + if (rMarkList.GetMarkCount() != 1) + { + return; + } + + SdrObject *const pObj(rMarkList.GetMark(0)->GetMarkedSdrObj()); + SwFrameFormat *const pFormat(FindFrameFormat(pObj)); + if (pFormat->Which() == RES_FLYFRMFMT) + { + GetDoc()->SetFlyFrameDecorative(dynamic_cast<SwFlyFrameFormat&>(*pFormat), + isDecorative); + } + else + { + pObj->SetDecorative(isDecorative); + } +} + + void SwFEShell::AlignFormulaToBaseline( const uno::Reference < embed::XEmbeddedObject >& xObj ) { #if OSL_DEBUG_LEVEL > 0 diff --git a/sw/source/core/inc/undoflystrattr.hxx b/sw/source/core/inc/undoflystrattr.hxx index 069c0aca5f12..6cb639ac4140 100644 --- a/sw/source/core/inc/undoflystrattr.hxx +++ b/sw/source/core/inc/undoflystrattr.hxx @@ -44,6 +44,23 @@ class SwUndoFlyStrAttr final : public SwUndo const OUString msNewStr; }; +class SwUndoFlyDecorative final : public SwUndo +{ + public: + SwUndoFlyDecorative(SwFlyFrameFormat& rFlyFrameFormat, + bool isDecorative); + virtual ~SwUndoFlyDecorative() override; + + virtual void UndoImpl( ::sw::UndoRedoContext & ) override; + virtual void RedoImpl( ::sw::UndoRedoContext & ) override; + + virtual SwRewriter GetRewriter() const override; + + private: + SwFlyFrameFormat & m_rFlyFrameFormat; + bool const m_IsDecorative; +}; + #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOFLYSTRATTR_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index b61a466e08eb..596ae8d93fe4 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -3237,6 +3237,21 @@ OUString SwFlyFrameFormat::GetObjDescription() const return msDesc; } +void SwFlyFrameFormat::SetObjDecorative(bool const isDecorative) +{ + SdrObject* pMasterObject = FindSdrObject(); + OSL_ENSURE( pMasterObject, "<SwFlyFrameFormat::SetDescription(..)> - missing <SdrObject> instance" ); + if ( !pMasterObject ) + { + return; + } + + SetFormatAttr(SfxBoolItem(RES_DECORATIVE, isDecorative)); + pMasterObject->SetDecorative(isDecorative); + // does anybody care about a broadcast? +} + + /** SwFlyFrameFormat::IsBackgroundTransparent - for #99657# OD 22.08.2002 - overriding virtual method and its default implementation, diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 712b8252e79d..c0a8427b0361 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -682,6 +682,9 @@ OUString GetUndoComment(SwUndoId eId) case SwUndoId::DELETE_SECTIONS: pId = STR_DELETE_SECTIONS; break; + case SwUndoId::FLYFRMFMT_DECORATIVE: + pId = STR_UNDO_FLYFRMFMT_DECORATIVE; + break; } assert(pId); diff --git a/sw/source/core/undo/undoflystrattr.cxx b/sw/source/core/undo/undoflystrattr.cxx index 89c9467958ae..60d8da4e95af 100644 --- a/sw/source/core/undo/undoflystrattr.cxx +++ b/sw/source/core/undo/undoflystrattr.cxx @@ -88,4 +88,35 @@ SwRewriter SwUndoFlyStrAttr::GetRewriter() const return aResult; } +SwUndoFlyDecorative::SwUndoFlyDecorative(SwFlyFrameFormat& rFlyFrameFormat, + bool const isDecorative) + : SwUndo(SwUndoId::FLYFRMFMT_DECORATIVE, rFlyFrameFormat.GetDoc()) + , m_rFlyFrameFormat(rFlyFrameFormat) + , m_IsDecorative(isDecorative) +{ +} + +SwUndoFlyDecorative::~SwUndoFlyDecorative() +{ +} + +void SwUndoFlyDecorative::UndoImpl(::sw::UndoRedoContext &) +{ + m_rFlyFrameFormat.SetObjDecorative(!m_IsDecorative); +} + +void SwUndoFlyDecorative::RedoImpl(::sw::UndoRedoContext &) +{ + m_rFlyFrameFormat.SetObjDecorative(m_IsDecorative); +} + +SwRewriter SwUndoFlyDecorative::GetRewriter() const +{ + SwRewriter aResult; + + aResult.AddRule(UndoArg1, m_rFlyFrameFormat.GetName()); + + return aResult; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index daff1a19ae94..cbb8a9c7835f 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -615,18 +615,21 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq) OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)"); OUString aTitle(pSelected->GetTitle()); OUString aDescription(pSelected->GetDescription()); + bool isDecorative(pSelected->IsDecorative()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<AbstractSvxObjectTitleDescDialog> pDlg(pFact->CreateSvxObjectTitleDescDialog(GetView().GetFrameWeld(), - aTitle, aDescription)); + aTitle, aDescription, isDecorative)); if(RET_OK == pDlg->Execute()) { pDlg->GetTitle(aTitle); pDlg->GetDescription(aDescription); + pDlg->IsDecorative(isDecorative); pSelected->SetTitle(aTitle); pSelected->SetDescription(aDescription); + pSelected->SetDecorative(isDecorative); pSh->SetModified(); } diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index bec169eed5ba..65c41becb0c3 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -690,19 +690,22 @@ void SwFrameShell::Execute(SfxRequest &rReq) { OUString aDescription(rSh.GetObjDescription()); OUString aTitle(rSh.GetObjTitle()); + bool isDecorative(rSh.IsObjDecorative()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<AbstractSvxObjectTitleDescDialog> pDlg( pFact->CreateSvxObjectTitleDescDialog(GetView().GetFrameWeld(), - aTitle, aDescription )); + aTitle, aDescription, isDecorative)); if ( pDlg->Execute() == RET_OK ) { pDlg->GetDescription(aDescription); pDlg->GetTitle(aTitle); + pDlg->IsDecorative(isDecorative); rSh.SetObjDescription(aDescription); rSh.SetObjTitle(aTitle); + rSh.SetObjDecorative(isDecorative); } } } diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index 30d6faebc8a2..7b805165bef8 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -320,7 +320,7 @@ const XMLPropertyMapEntry aXMLSDProperties[] = GMAP( PROP_SizeProtect, XML_NAMESPACE_STYLE, XML_PROTECT, XML_SD_TYPE_SIZE_PROTECT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, CTF_SD_SIZE_PROTECT ), GMAP( PROP_WritingMode, XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_SD_TYPE_WRITINGMODE2, CTF_WRITINGMODE2 ), { PROP_WritingMode, XML_NAMESPACE_LO_EXT, XML_WRITING_MODE, XML_SD_TYPE_WRITINGMODE2|XML_TYPE_PROP_GRAPHIC, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, true}, - + { PROP_Decorative, XML_NAMESPACE_LO_EXT, XML_DECORATIVE, XML_TYPE_BOOL|XML_TYPE_PROP_GRAPHIC, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }, MAP_END() }; |