diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2021-01-27 14:34:19 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-04-01 10:56:17 +0200 |
commit | 903902f826129705f1fafc5583a13be645e145b5 (patch) | |
tree | 2a4a1878be129d4cf6548cc03d75d4156c868c49 /svx | |
parent | ac8a456d7a6c1bf5b1574eeda8ea2ac41a9b32bc (diff) |
Introduce Fontwork context
Change-Id: I61512e4da13514d3e5a199ccb46468ba199b808f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110023
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112274
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sidebar/SelectionAnalyzer.cxx | 9 | ||||
-rw-r--r-- | svx/source/toolbars/fontworkbar.cxx | 26 |
2 files changed, 26 insertions, 9 deletions
diff --git a/svx/source/sidebar/SelectionAnalyzer.cxx b/svx/source/sidebar/SelectionAnalyzer.cxx index 7cc20c5dd0a0..7d0cb4d16967 100644 --- a/svx/source/sidebar/SelectionAnalyzer.cxx +++ b/svx/source/sidebar/SelectionAnalyzer.cxx @@ -22,6 +22,7 @@ #include <svx/svdobj.hxx> #include <svx/svdotext.hxx> #include <svx/svdpage.hxx> +#include <svx/fontworkbar.hxx> using vcl::EnumContext; @@ -46,6 +47,10 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SC(const SdrMarkL { eContext = EnumContext::Context::DrawText; } + else if (svx::checkForFontWork(pObj)) + { + eContext = EnumContext::Context::DrawFontwork; + } else { const SdrInventor nInv = pObj->GetObjInventor(); @@ -133,6 +138,10 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD(const SdrMarkL 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 8f7029204006..0fc4da30e1bf 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -205,26 +205,34 @@ FontworkBar::~FontworkBar() } namespace svx { +bool checkForFontWork( SdrObject* pObj ) +{ + static constexpr OUStringLiteral sTextPath = u"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 constexpr OUStringLiteral sTextPath = u"TextPath"; - const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); const size_t nCount = rMarkList.GetMarkCount(); bool bFound = false; 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; |