[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - sd/inc sd/source

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 7 07:11:39 UTC 2019


 sd/inc/CustomAnimationPreset.hxx                |    6 +++-
 sd/source/core/CustomAnimationPreset.cxx        |   33 ++++++++++++++----------
 sd/source/ui/animations/CustomAnimationPane.cxx |   27 +++++--------------
 sd/source/ui/animations/CustomAnimationPane.hxx |   18 +------------
 sd/source/ui/view/drviews1.cxx                  |    3 ++
 sd/source/ui/view/drviewse.cxx                  |    6 ++++
 6 files changed, 43 insertions(+), 50 deletions(-)

New commits:
commit faf3b70e8ba12e787e5fff797abb3eb7eba272d5
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Dec 12 10:46:13 2018 -0500
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 7 09:11:12 2019 +0200

    sd: LOK: publish statechange on entering master view
    
    Reviewed-on: https://gerrit.libreoffice.org/69617
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/73498
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit ae2720ab206c2ff4a677e7fad147a3037f07a9be)
    
    Change-Id: Ib736800544b9669e3708da0c01370af22cdf3e97
    Reviewed-on: https://gerrit.libreoffice.org/77038
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index a0f5b7ffae52..cf8f73d21819 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -438,6 +438,9 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
             GetViewFrame()->SetChildWindow(
                 AnimationChildWindow::GetChildWindowId(), false );
 
+            if (comphelper::LibreOfficeKit::isActive())
+                GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+                                                        ".uno:SlideMasterPage=true");
             if (!mpActualPage)
             {
                 // as long as there is no mpActualPage, take first
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 30f395c9f5cc..520e29bfb47a 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -29,6 +29,7 @@
 
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <comphelper/lok.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <undo/undomanager.hxx>
 #include <vcl/waitobj.hxx>
 #include <svl/aeitem.hxx>
@@ -1057,6 +1058,11 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
 
         case SID_CLOSE_MASTER_VIEW:
         {
+            // Notify of disabling master view, which is enabled in DrawViewShell::ChangeEditMode.
+            if (comphelper::LibreOfficeKit::isActive())
+                GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+                                                           ".uno:SlideMasterPage=false");
+
             Broadcast (
                 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START));
 
commit 1102bb5563b8a2febfa14ad92c106781ef81b6e3
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Jan 28 10:03:39 2019 -0500
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 7 09:11:05 2019 +0200

    sd: LOK: support per-user localization of CustomAnimationPreset
    
    This only fixes the caching in CustomAnimationPreset and
    CustomAnimationPane. Other cached labels will be done separately.
    
    Reviewed-on: https://gerrit.libreoffice.org/68263
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>
    (cherry picked from commit b44679e47211a27f4fe22d05762d9d48c8f88935)
    
    Reviewed-on: https://gerrit.libreoffice.org/76241
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit 3b55741586883d4fbb7f3e4c5368b5382c3ce5f8)
    
    Change-Id: Iaf511168d26b3a5567ca53556e242d3c071d2623
    Reviewed-on: https://gerrit.libreoffice.org/77036
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/inc/CustomAnimationPreset.hxx b/sd/inc/CustomAnimationPreset.hxx
index eeeeac55ad77..57669734014b 100644
--- a/sd/inc/CustomAnimationPreset.hxx
+++ b/sd/inc/CustomAnimationPreset.hxx
@@ -88,6 +88,9 @@ public:
     SAL_DLLPRIVATE CustomAnimationPresets();
     SAL_DLLPRIVATE ~CustomAnimationPresets();
 
+    /** This method gets presets instance, which is localized
+     * for the current user's locale.
+    */
     static const CustomAnimationPresets& getCustomAnimationPresets();
 
     SAL_DLLPRIVATE css::uno::Reference< css::animations::XAnimationNode > getRandomPreset( sal_Int16 nPresetClass ) const;
@@ -125,7 +128,8 @@ private:
     PresetCategoryList maMotionPathsPresets;
     PresetCategoryList maMiscPresets;
 
-    SAL_DLLPRIVATE static CustomAnimationPresets*  mpCustomAnimationPresets;
+    //! Maps per-language the animation presets.
+    SAL_DLLPRIVATE static std::map<OUString, CustomAnimationPresets*>  mpCustomAnimationPresetsMap;
 };
 
 
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx
index 804ef7b9ddf2..5b4bb999d613 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -38,7 +38,9 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/propertysequence.hxx>
 #include <comphelper/random.hxx>
+#include <comphelper/lok.hxx>
 #include <unotools/pathoptions.hxx>
+#include <unotools/syslocaleoptions.hxx>
 #include <tools/stream.hxx>
 
 #include <tools/debug.hxx>
@@ -530,22 +532,27 @@ void CustomAnimationPresets::changePresetSubType( const CustomAnimationEffectPtr
     }
 }
 
-CustomAnimationPresets* CustomAnimationPresets::mpCustomAnimationPresets = nullptr;
+std::map<OUString, CustomAnimationPresets*>  CustomAnimationPresets::mpCustomAnimationPresetsMap;
 
 const CustomAnimationPresets& CustomAnimationPresets::getCustomAnimationPresets()
 {
-    if( !mpCustomAnimationPresets )
-    {
-        SolarMutexGuard aGuard;
-
-        if( !mpCustomAnimationPresets )
-        {
-            mpCustomAnimationPresets = new sd::CustomAnimationPresets();
-            mpCustomAnimationPresets->importResources();
-        }
-    }
-
-    return *mpCustomAnimationPresets;
+    // Support localization per-view. Currently not useful for Desktop
+    // but very much critical for LOK. The cache now is per-language.
+    const OUString aLang = comphelper::LibreOfficeKit::isActive()
+                               ? comphelper::LibreOfficeKit::getLanguageTag().getLanguage()
+                               : SvtSysLocaleOptions().GetLanguageTag().getLanguage();
+
+    SolarMutexGuard aGuard;
+    const auto it = mpCustomAnimationPresetsMap.find(aLang);
+    if (it != mpCustomAnimationPresetsMap.end())
+        return *it->second;
+
+    // Note: we are invoked recursively(!), so we must set the instance pointer
+    // in the cache map before we importResources, lest we get in infinite loop.
+    sd::CustomAnimationPresets* pCustomAnimationPresets = new sd::CustomAnimationPresets();
+    mpCustomAnimationPresetsMap[aLang] = pCustomAnimationPresets;
+    pCustomAnimationPresets->importResources();
+    return *pCustomAnimationPresets;
 }
 
 Reference< XAnimationNode > CustomAnimationPresets::getRandomPreset( sal_Int16 nPresetClass ) const
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index 99675714021b..76794375426b 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -128,7 +128,6 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase,
                                           const css::uno::Reference<css::frame::XFrame>& rxFrame )
 :   PanelLayout( pParent, "CustomAnimationsPanel", "modules/simpress/ui/customanimationspanel.ui", rxFrame ),
     mrBase( rBase ),
-    mpCustomAnimationPresets(nullptr),
     mnPropertyType( nPropertyTypeNone ),
     mnCurvePathPos( LISTBOX_ENTRY_NOTFOUND ),
     mnPolygonPathPos( LISTBOX_ENTRY_NOTFOUND ),
@@ -144,7 +143,6 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase,
                                           bool )
 :   PanelLayout( pParent, "CustomAnimationsPanel", "modules/simpress/ui/customanimationspanelhorizontal.ui", rxFrame ),
     mrBase( rBase ),
-    mpCustomAnimationPresets(nullptr),
     mnPropertyType( nPropertyTypeNone ),
     mnCurvePathPos( LISTBOX_ENTRY_NOTFOUND ),
     mnPolygonPathPos( LISTBOX_ENTRY_NOTFOUND ),
@@ -556,7 +554,7 @@ void CustomAnimationPane::updateControls()
     {
         CustomAnimationEffectPtr pEffect = maListSelection.front();
 
-        OUString aUIName( getPresets().getUINameForPresetId( pEffect->getPresetId() ) );
+        OUString aUIName( CustomAnimationPresets::getCustomAnimationPresets().getUINameForPresetId( pEffect->getPresetId() ) );
 
         OUString aTemp( maStrModify );
 
@@ -566,7 +564,7 @@ void CustomAnimationPane::updateControls()
             mpFTEffect->SetText( aTemp );
         }
 
-        CustomAnimationPresetPtr pDescriptor = getPresets().getEffectDescriptor( pEffect->getPresetId() );
+        CustomAnimationPresetPtr pDescriptor = CustomAnimationPresets::getCustomAnimationPresets().getEffectDescriptor( pEffect->getPresetId() );
         if( pDescriptor.get() )
         {
             PropertySubControl* pSubControl = nullptr;
@@ -1031,7 +1029,7 @@ bool CustomAnimationPane::setProperty1Value( sal_Int32 nType, const CustomAnimat
             rValue >>= aPresetSubType;
             if( aPresetSubType != pEffect->getPresetSubType() )
             {
-                getPresets().changePresetSubType( pEffect, aPresetSubType );
+                CustomAnimationPresets::getCustomAnimationPresets().changePresetSubType( pEffect, aPresetSubType );
                 bEffectChanged = true;
             }
         }
@@ -1128,13 +1126,9 @@ std::unique_ptr<STLPropertySet> CustomAnimationPane::createSelectionSet()
     sal_Int32 nMaxParaDepth = 0;
 
     // get options from selected effects
-    EffectSequence::iterator aIter( maListSelection.begin() );
-    const EffectSequence::iterator aEnd( maListSelection.end() );
-    const CustomAnimationPresets& rPresets (getPresets());
-    while( aIter != aEnd )
+    const CustomAnimationPresets& rPresets (CustomAnimationPresets::getCustomAnimationPresets());
+    for( CustomAnimationEffectPtr& pEffect : maListSelection )
     {
-        CustomAnimationEffectPtr pEffect = (*aIter++);
-
         EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
         if( !pEffectSequence )
             pEffectSequence = mpMainSequence.get();
@@ -2218,7 +2212,7 @@ sal_uInt32 CustomAnimationPane::fillAnimationLB( bool bHasText )
 {
     PresetCategoryList rCategoryList;
     sal_uInt16 nPosition = mpLBCategory->GetSelectedEntryPos();
-    const CustomAnimationPresets& rPresets (getPresets());
+    const CustomAnimationPresets& rPresets (CustomAnimationPresets::getCustomAnimationPresets());
     switch(nPosition)
     {
         case 0:rCategoryList = rPresets.getEntrancePresets();break;
@@ -2311,7 +2305,7 @@ IMPL_LINK_NOARG(CustomAnimationPane, lateInitCallback, Timer *, void)
 {
     // Call getPresets() to initiate the (expensive) construction of the
     // presets list.
-    getPresets();
+    CustomAnimationPresets::getCustomAnimationPresets();
 
     // update selection and control states
     onSelectionChanged();
@@ -2470,13 +2464,6 @@ void CustomAnimationPane::preview( const Reference< XAnimationNode >& xAnimation
     SlideShow::StartPreview( mrBase, mxCurrentPage, xRoot );
 }
 
-const CustomAnimationPresets& CustomAnimationPane::getPresets()
-{
-    if (mpCustomAnimationPresets == nullptr)
-        mpCustomAnimationPresets = &CustomAnimationPresets::getCustomAnimationPresets();
-    return *mpCustomAnimationPresets;
-}
-
 // ICustomAnimationListController
 void CustomAnimationPane::onSelect()
 {
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx
index 596d2b53bde2..7e653346739b 100644
--- a/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -33,13 +33,6 @@
 
 #include <vector>
 
-class PushButton;
-class FixedLine;
-class FixedText;
-class ListBox;
-class ComboBox;
-class CheckBox;
-
 enum class PathKind { NONE, CURVE, POLYGON, FREEFORM };
 
 namespace com { namespace sun { namespace star { namespace animations {
@@ -113,7 +106,7 @@ private:
     void changeSelection( STLPropertySet const * pResultSet, STLPropertySet const * pOldSet );
 
     static css::uno::Any getProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect );
-    bool setProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect, const css::uno::Any& rValue );
+    static bool setProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect, const css::uno::Any& rValue );
     void UpdateLook();
     sal_uInt32 fillAnimationLB( bool bHasText );
     PathKind getCreatePathKind() const;
@@ -134,8 +127,6 @@ private:
 private:
     ViewShellBase& mrBase;
 
-    const CustomAnimationPresets* mpCustomAnimationPresets;
-
     // UI Elements
     VclPtr<FixedText>   mpFTAnimation;
     VclPtr<CustomAnimationList> mpCustomAnimationList;
@@ -179,17 +170,12 @@ private:
     css::uno::Reference< css::drawing::XDrawPage > mxCurrentPage;
     css::uno::Reference< css::drawing::XDrawView > mxView;
 
-    /** The mpCustomAnimationPresets is initialized either on demand or
+    /** The CustomAnimationPresets is initialized either on demand or
         after a short time after the construction of a new object of this
         class.  This timer is responsible for the later.
     */
     Timer maLateInitTimer;
 
-    /** This method initializes the mpCustomAnimationPresets on demand and
-        returns a reference to the list.
-    */
-    const CustomAnimationPresets& getPresets();
-
     MotionPathTagVector maMotionPathTags;
 
     ScopeLock maSelectionLock;


More information about the Libreoffice-commits mailing list