include/svx/fontworkbar.hxx | 2 include/vcl/EnumContext.hxx | 1 officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu | 13 +++++ svx/source/sidebar/SelectionAnalyzer.cxx | 9 +++ svx/source/toolbars/fontworkbar.cxx | 25 +++++++---- sw/source/uibase/shells/drawsh.cxx | 11 ++++ vcl/source/window/EnumContext.cxx | 1 7 files changed, 53 insertions(+), 9 deletions(-)
New commits: commit 6dc466e02451c3d59f535050763413b63aca675a Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Jan 27 14:34:19 2021 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Tue Feb 9 10:56:23 2021 +0100 Introduce Fontwork context Change-Id: I61512e4da13514d3e5a199ccb46468ba199b808f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110023 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/include/svx/fontworkbar.hxx b/include/svx/fontworkbar.hxx index 224aae1dbb1e..bac7ce1543bc 100644 --- a/include/svx/fontworkbar.hxx +++ b/include/svx/fontworkbar.hxx @@ -26,6 +26,7 @@ class SfxViewShell; class SdrView; +class SdrObject; /************************************************************************/ @@ -33,6 +34,7 @@ namespace svx { bool SVX_DLLPUBLIC checkForSelectedFontWork( SdrView const * pSdrView, sal_uInt32& nCheckStatus ); +bool SVX_DLLPUBLIC checkForFontWork( SdrObject* pObj ); class SAL_WARN_UNUSED SVX_DLLPUBLIC FontworkBar final : public SfxShell { diff --git a/include/vcl/EnumContext.hxx b/include/vcl/EnumContext.hxx index 1c68e1b6f014..4cc6217ffb26 100644 --- a/include/vcl/EnumContext.hxx +++ b/include/vcl/EnumContext.hxx @@ -71,6 +71,7 @@ public: Chart, ChartElements, Draw, + DrawFontwork, DrawLine, DrawPage, DrawText, diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu index 80b9999ef5d9..f7946142d86e 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu @@ -351,6 +351,7 @@ Calc, Pivot, visible, .uno:CellTextDlg ; DrawImpress, 3DObject, visible ; DrawImpress, Draw, hidden ; + DrawImpress, DrawFontwork, hidden ; DrawImpress, DrawText, visible ; DrawImpress, DrawLine, hidden ; DrawImpress, Graphic, hidden ; @@ -515,13 +516,16 @@ <prop oor:name="ContextList"> <value oor:separator=";"> Calc, Draw, visible ; + Calc, DrawFontwork, visible ; Calc, OLE, hidden ; DrawImpress, 3DObject, visible ; DrawImpress, Draw, visible ; + DrawImpress, DrawFontwork, visible ; DrawImpress, Graphic, hidden ; DrawImpress, TextObject, hidden ; DrawImpress, OLE, hidden ; WriterVariants, Draw, visible ; + WriterVariants, DrawFontwork, visible ; Writer, Graphic, hidden ; Writer, OLE, hidden ; Writer, Frame, visible ; @@ -551,9 +555,11 @@ <prop oor:name="ContextList"> <value oor:separator=";"> Calc, Draw, visible ; + Calc, DrawFontwork, visible ; Calc, OLE, hidden ; DrawImpress, 3DObject, visible ; DrawImpress, Draw, hidden ; + DrawImpress, DrawFontwork, hidden ; DrawImpress, Graphic, hidden ; DrawImpress, TextObject, hidden ; DrawImpress, OLE, hidden ; @@ -583,16 +589,19 @@ <prop oor:name="ContextList"> <value oor:separator=";"> Calc, Draw, visible ; + Calc, DrawFontwork, visible ; Calc, DrawLine, visible ; Calc, Graphic, visible ; Calc, OLE, hidden ; DrawImpress, 3DObject, visible ; DrawImpress, Draw, visible ; + DrawImpress, DrawFontwork, visible ; DrawImpress, DrawLine, visible ; DrawImpress, Graphic, visible ; DrawImpress, TextObject, hidden ; DrawImpress, OLE, hidden ; WriterVariants, Draw, visible ; + WriterVariants, DrawFontwork, visible ; </value> </prop> <prop oor:name="ImplementationURL" oor:type="xs:string"> @@ -646,6 +655,7 @@ <value oor:separator=";"> Calc, Chart, visible ; Calc, Draw, hidden ; + Calc, DrawFontwork, hidden ; Calc, DrawLine, visible ; Calc, Form, visible ; Calc, Graphic, hidden ; @@ -654,6 +664,7 @@ Calc, OLE, visible ; DrawImpress, 3DObject, visible ; DrawImpress, Draw, visible ; + DrawImpress, DrawFontwork, visible ; DrawImpress, DrawLine, visible ; DrawImpress, Form, visible ; DrawImpress, Graphic, hidden ; @@ -662,6 +673,7 @@ DrawImpress, OLE, visible ; DrawImpress, TextObject, hidden ; WriterVariants, Draw, hidden ; + WriterVariants, DrawFontwork, hidden ; WriterVariants, Form, visible ; WriterVariants, Graphic, visible, .uno:GraphicDialog ; WriterVariants, Media, visible ; @@ -1075,6 +1087,7 @@ DrawImpress, DrawLine, hidden ; DrawImpress, 3DObject, hidden ; DrawImpress, Draw, hidden ; + DrawImpress, DrawFontwork, hidden ; DrawImpress, DrawText, visible ; DrawImpress, Graphic, hidden ; DrawImpress, Table, visible ; diff --git a/svx/source/sidebar/SelectionAnalyzer.cxx b/svx/source/sidebar/SelectionAnalyzer.cxx index ea4fb5db2d7f..1400c005f22a 100644 --- a/svx/source/sidebar/SelectionAnalyzer.cxx +++ b/svx/source/sidebar/SelectionAnalyzer.cxx @@ -24,6 +24,7 @@ #include <svx/svdpage.hxx> #include <svx/fmglob.hxx> #include <svx/globl3d.hxx> +#include <svx/fontworkbar.hxx> using vcl::EnumContext; @@ -48,6 +49,10 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SC (const SdrMark { eContext = EnumContext::Context::DrawText; } + else if (svx::checkForFontWork(pObj)) + { + eContext = EnumContext::Context::DrawFontwork; + } else { const SdrInventor nInv = pObj->GetObjInventor(); @@ -135,6 +140,10 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD ( else eContext = EnumContext::Context::DrawText; } + else if (svx::checkForFontWork(pObj)) + { + eContext = EnumContext::Context::DrawFontwork; + } else { const SdrInventor nInv = pObj->GetObjInventor(); diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx index 3b6144c2e229..1d8e0728f0e2 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -208,12 +208,27 @@ FontworkBar::~FontworkBar() } namespace svx { +bool checkForFontWork( SdrObject* pObj ) +{ + static const char sTextPath[] = "TextPath"; + bool bFound = false; + + if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr ) + { + const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + const Any* pAny = aGeometryItem.GetPropertyValueByName( sTextPath, sTextPath ); + if( pAny ) + *pAny >>= bFound; + } + + return bFound; +} + bool checkForSelectedFontWork( SdrView const * pSdrView, sal_uInt32& nCheckStatus ) { if ( nCheckStatus & 2 ) return ( nCheckStatus & 1 ) != 0; - static const char sTextPath[] = "TextPath"; const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); const size_t nCount = rMarkList.GetMarkCount(); @@ -221,13 +236,7 @@ bool checkForSelectedFontWork( SdrView const * pSdrView, sal_uInt32& nCheckStatu for(size_t i=0; (i<nCount) && !bFound ; ++i) { SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); - if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr ) - { - const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); - const Any* pAny = aGeometryItem.GetPropertyValueByName( sTextPath, sTextPath ); - if( pAny ) - *pAny >>= bFound; - } + bFound = checkForFontWork(pObj); } if ( bFound ) nCheckStatus |= 1; diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index d1b72f12ca82..3bfaf25b958d 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -41,6 +41,7 @@ #include <docstat.hxx> #include <IDocumentStatistics.hxx> #include <tools/diagnose_ex.h> +#include <svx/fontworkbar.hxx> #include <svx/svdoashp.hxx> #include <svx/xfillit0.hxx> @@ -538,7 +539,15 @@ SwDrawShell::SwDrawShell(SwView &_rView) : { SetName("Draw"); - SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Draw)); + vcl::EnumContext::Context eContext = vcl::EnumContext::Context::Draw; + + SwWrtShell &rSh = GetShell(); + SdrView* pDrView = rSh.GetDrawView(); + sal_uInt32 nCheckStatus = 0; + if (pDrView && svx::checkForSelectedFontWork(pDrView, nCheckStatus)) + eContext = vcl::EnumContext::Context::DrawFontwork; + + SfxShell::SetContextName(vcl::EnumContext::GetContextName(eContext)); } // Edit SfxRequests for FontWork diff --git a/vcl/source/window/EnumContext.cxx b/vcl/source/window/EnumContext.cxx index 78bd6cbc675b..d138fce5d79f 100644 --- a/vcl/source/window/EnumContext.cxx +++ b/vcl/source/window/EnumContext.cxx @@ -160,6 +160,7 @@ void EnumContext::ProvideContextContainers() AddEntry("Chart", Context::Chart); AddEntry("ChartElements", Context::ChartElements); AddEntry("Draw", Context::Draw); + AddEntry("DrawFontwork", Context::DrawFontwork); AddEntry("DrawLine", Context::DrawLine); AddEntry("DrawPage", Context::DrawPage); AddEntry("DrawText", Context::DrawText); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits