[Libreoffice-commits] core.git: 2 commits - include/svx include/vcl officecfg/registry svx/source sw/source vcl/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 1 08:56:51 UTC 2021


 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/tbxctrls/fontworkgallery.cxx                      |   12 +++++
 svx/source/toolbars/fontworkbar.cxx                          |   26 +++++++----
 sw/source/uibase/shells/drawsh.cxx                           |   11 ++++
 vcl/source/window/EnumContext.cxx                            |    1 
 8 files changed, 65 insertions(+), 10 deletions(-)

New commits:
commit 903902f826129705f1fafc5583a13be645e145b5
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jan 27 14:34:19 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Apr 1 10:56:17 2021 +0200

    Introduce Fontwork context
    
    Change-Id: I61512e4da13514d3e5a199ccb46468ba199b808f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110023
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112274
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/svx/fontworkbar.hxx b/include/svx/fontworkbar.hxx
index 1f3a81a9a79c..33c67e8f051b 100644
--- a/include/svx/fontworkbar.hxx
+++ b/include/svx/fontworkbar.hxx
@@ -26,12 +26,14 @@
 
 class SfxViewShell;
 class SdrView;
+class SdrObject;
 
 /************************************************************************/
 
 namespace svx
 {
 bool SVXCORE_DLLPUBLIC checkForSelectedFontWork(SdrView const* pSdrView, sal_uInt32& nCheckStatus);
+bool SVXCORE_DLLPUBLIC checkForFontWork(SdrObject* pObj);
 
 class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FontworkBar final : public SfxShell
 {
diff --git a/include/vcl/EnumContext.hxx b/include/vcl/EnumContext.hxx
index 1c356979d858..639a427a138a 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 2c37dec8fe65..5c38580ce00a 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -376,6 +376,7 @@
             Calc,             EditCell,           visible                    ;
             Calc,             Pivot,              visible,  .uno:CellTextDlg ;
             DrawImpress,      Draw,               hidden                     ;
+            DrawImpress,      DrawFontwork,       hidden                     ;
             DrawImpress,      DrawText,           visible                    ;
             DrawImpress,      DrawLine,           hidden                     ;
             DrawImpress,      Graphic,            hidden                     ;
@@ -587,13 +588,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 ;
@@ -655,9 +659,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  ;
@@ -690,16 +696,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">
@@ -759,6 +768,7 @@
           <value oor:separator=";">
             Calc,           Chart,       visible                       ;
             Calc,           Draw,        hidden                        ;
+            Calc,           DrawFontwork, hidden                       ;
             Calc,           DrawLine,    visible                       ;
             Calc,           Form,        visible                       ;
             Calc,           Graphic,     hidden                        ;
@@ -767,6 +777,7 @@
             Calc,           OLE,         visible                       ;
             DrawImpress,    3DObject,    visible                       ;
             DrawImpress,    Draw,        visible                       ;
+            DrawImpress,    DrawFontwork, visible                      ;
             DrawImpress,    DrawLine,    visible                       ;
             DrawImpress,    Form,        visible                       ;
             DrawImpress,    Graphic,     hidden                        ;
@@ -775,6 +786,7 @@
             DrawImpress,    OLE,         visible                       ;
             DrawImpress,    TextObject,  hidden                        ;
             WriterVariants, Draw,        hidden                        ;
+            WriterVariants, DrawFontwork, hidden                       ;
             WriterVariants, Form,        visible                       ;
             WriterVariants, Graphic,     visible, .uno:GraphicDialog   ;
             WriterVariants, Media,       visible                       ;
@@ -1235,6 +1247,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 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;
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index 7589507511a9..3cf059b05929 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -32,6 +32,7 @@
 #include <textboxhelper.hxx>
 #include <wview.hxx>
 #include <swmodule.hxx>
+#include <svx/fontworkbar.hxx>
 
 #include <svx/svdoashp.hxx>
 #include <svx/xfillit0.hxx>
@@ -531,7 +532,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 7d3d704180f4..b407a8069bc7 100644
--- a/vcl/source/window/EnumContext.cxx
+++ b/vcl/source/window/EnumContext.cxx
@@ -159,6 +159,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);
commit ac8a456d7a6c1bf5b1574eeda8ea2ac41a9b32bc
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Mar 31 15:56:00 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Apr 1 10:55:57 2021 +0200

    Add missing popover for fontwork properties popup controllers
    
    Change-Id: I293a88a681b55e123c45edc9c3034b73417d7af5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113418
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index 4236215fe142..3c256c89b773 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -424,6 +424,12 @@ void SAL_CALL FontworkAlignmentControl::initialize( const css::uno::Sequence< cs
 {
     svt::PopupWindowController::initialize( aArguments );
 
+    if (m_pToolbar)
+    {
+        mxPopoverContainer.reset(new ToolbarPopupContainer(m_pToolbar));
+        m_pToolbar->set_item_popover(m_aCommandURL.toUtf8(), mxPopoverContainer->getTopLevel());
+    }
+
     ToolBox* pToolBox = nullptr;
     ToolBoxItemId nId;
     if ( getToolboxId( nId, &pToolBox ) )
@@ -698,6 +704,12 @@ void SAL_CALL FontworkCharacterSpacingControl::initialize( const css::uno::Seque
 {
     svt::PopupWindowController::initialize( aArguments );
 
+    if (m_pToolbar)
+    {
+        mxPopoverContainer.reset(new ToolbarPopupContainer(m_pToolbar));
+        m_pToolbar->set_item_popover(m_aCommandURL.toUtf8(), mxPopoverContainer->getTopLevel());
+    }
+
     ToolBox* pToolBox = nullptr;
     ToolBoxItemId nId;
     if ( getToolboxId( nId, &pToolBox ) )


More information about the Libreoffice-commits mailing list