framework/source/services/ContextChangeEventMultiplexer.cxx |    1 
 sd/inc/Outliner.hxx                                         |    1 
 sd/source/core/drawdoc.cxx                                  |   14 
 sd/source/ui/app/sdmod.cxx                                  |   12 
 sd/source/ui/app/sdmod1.cxx                                 |   36 +-
 sd/source/ui/app/sdmod2.cxx                                 |   48 ++
 sd/source/ui/framework/module/ToolBarModule.cxx             |    8 
 sd/source/ui/func/fuolbull.cxx                              |    2 
 sd/source/ui/func/fusearch.cxx                              |   14 
 sd/source/ui/inc/OutlinerIteratorImpl.hxx                   |   56 ---
 sd/source/ui/view/NotesPanelViewShell.cxx                   |    1 
 sd/source/ui/view/Outliner.cxx                              |  139 ++++---
 sd/source/ui/view/OutlinerIterator.cxx                      |  211 +++---------
 sd/source/ui/view/ToolBarManager.cxx                        |    4 
 sd/source/ui/view/drviews7.cxx                              |   14 
 sd/source/ui/view/viewshel.cxx                              |   13 
 translations                                                |    2 
 17 files changed, 275 insertions(+), 301 deletions(-)

New commits:
commit b01a1a825a87a529745b15345060443ebae7be46
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Jul 5 14:06:13 2024 +0100
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Tue Jul 9 00:51:45 2024 +0200

    cid#1609595 Dereference null return value
    
    Change-Id: I6ae93f46c50e0fe4a29d03fdf02797f808d4d1c3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170022
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170090

diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 7df93444c6cb..ff613cae2b7a 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1844,13 +1844,13 @@ SdrObject* SdOutliner::SetObject (
     if(rPosition.meEditMode == EditMode::Page && rPosition.mePageKind == 
PageKind::Notes)
     {
         std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock());
-        std::shared_ptr<sd::DrawViewShell> pDrawViewShell(
-            std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell));
-
-        if (pDrawViewShell->GetEditMode() != EditMode::Page
-            || pDrawViewShell->GetCurPagePos() != rPosition.mnPageIndex)
-            SetPage(EditMode::Page, 
static_cast<sal_uInt16>(rPosition.mnPageIndex));
-
+        if (std::shared_ptr<sd::DrawViewShell> pDrawViewShell =
+            std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell))
+        {
+            if (pDrawViewShell->GetEditMode() != EditMode::Page
+                || pDrawViewShell->GetCurPagePos() != rPosition.mnPageIndex)
+                SetPage(EditMode::Page, 
static_cast<sal_uInt16>(rPosition.mnPageIndex));
+        }
         mnText = rPosition.mnText;
         return rPosition.mxObject.get().get();
     }
commit ee80e50a9e18428b0e135e256da3efeb81a63787
Author:     Sarper Akdemir <[email protected]>
AuthorDate: Thu Jun 27 15:48:00 2024 +0200
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Mon Jul 8 13:25:55 2024 +0200

    synchronize the state of notes pane with master
    
    Change-Id: Idc4c19fec49eb3e2e8b54bd35df27c9e947487ff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170143
    Tested-by: allotropia jenkins <[email protected]>
    Reviewed-by: Thorsten Behrens <[email protected]>

diff --git a/framework/source/services/ContextChangeEventMultiplexer.cxx 
b/framework/source/services/ContextChangeEventMultiplexer.cxx
index 73afc51e2181..1cf4a670cf5a 100644
--- a/framework/source/services/ContextChangeEventMultiplexer.cxx
+++ b/framework/source/services/ContextChangeEventMultiplexer.cxx
@@ -25,7 +25,6 @@
 #include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp>
 #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
-#include <sfx2/viewsh.hxx>
 
 #include <comphelper/compbase.hxx>
 #include <cppuhelper/supportsservice.hxx>
diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx
index 94f83c0753e3..8d00cfbbba9c 100644
--- a/sd/inc/Outliner.hxx
+++ b/sd/inc/Outliner.hxx
@@ -201,7 +201,6 @@ private:
 
     /// Returns the current outline view
     OutlinerView* getOutlinerView();
-    OutlinerView* lclGetNotesPaneOutliner();
 
     /// Specifies whether to search and replace, to spell check or to do a
     /// text conversion.
diff --git a/sd/source/ui/framework/module/ToolBarModule.cxx 
b/sd/source/ui/framework/module/ToolBarModule.cxx
index 2aa0ffdb9132..cf3fd880105e 100644
--- a/sd/source/ui/framework/module/ToolBarModule.cxx
+++ b/sd/source/ui/framework/module/ToolBarModule.cxx
@@ -18,7 +18,7 @@
  */
 
 #include "ToolBarModule.hxx"
-#include "ViewShell.hxx"
+#include <ViewShell.hxx>
 #include <ViewShellBase.hxx>
 #include <ViewShellManager.hxx>
 #include <DrawController.hxx>
@@ -148,9 +148,9 @@ void ToolBarModule::HandlePaneViewShellFocused(const 
css::uno::Reference<css::dr
     if(!mpBase)
         return;
 
-    std::shared_ptr<FrameworkHelper> pFrameworkHelper 
(FrameworkHelper::Instance(*mpBase));
-    std::shared_ptr<ViewShell> pViewShell = 
pFrameworkHelper->GetViewShell(pFrameworkHelper->GetView(rxResourceId));
-
+    std::shared_ptr<FrameworkHelper> 
pFrameworkHelper(FrameworkHelper::Instance(*mpBase));
+    std::shared_ptr<ViewShell> pViewShell
+        = 
FrameworkHelper::GetViewShell(pFrameworkHelper->GetView(rxResourceId));
 
     if(mpBase->GetMainViewShell() == pViewShell)
     {
diff --git a/sd/source/ui/inc/OutlinerIteratorImpl.hxx 
b/sd/source/ui/inc/OutlinerIteratorImpl.hxx
index a84d17e1cd15..485f2b89eaec 100644
--- a/sd/source/ui/inc/OutlinerIteratorImpl.hxx
+++ b/sd/source/ui/inc/OutlinerIteratorImpl.hxx
@@ -155,36 +155,35 @@ private:
     IteratorImplBase& operator= (const IteratorImplBase& rIterator);
 };
 
-/** Iterator for iteration over all objects in a single view.  On reaching
-    the last object on the last page (or the first object on the first page)
-    the view is *not* switched.  Further calls to the
-    <member>GotoNextObject()</member> method will be ignored.
+/** Iterator for iteration over all objects in all views. It switches views 
when
+    appropriate.
+
+    Iterates in the following pattern
+    1-) Alternating Normal View and Notes View for each page
+    2-) Master Pages
+    3-) Notes Masters
+    4-) The Handout Master
 
     <p>For documentation of the methods please refer to the base class
     <type>IteratorImplBase</type>.</p>
 */
-class ViewIteratorImpl : public IteratorImplBase
+class DocumentIteratorImpl final : public IteratorImplBase
 {
 public:
-    ViewIteratorImpl (
+    DocumentIteratorImpl (
         sal_Int32 nPageIndex,
+        PageKind ePageKind,
+        EditMode eEditMode,
         SdDrawDocument* pDocument,
         const std::weak_ptr<ViewShell>& rpViewShellWeak,
         bool bDirectionIsForward);
-    ViewIteratorImpl (
-        sal_Int32 nPageIndex,
-        SdDrawDocument* pDocument,
-        const std::weak_ptr<ViewShell>& rpViewShellWeak,
-        bool bDirectionIsForward,
-        PageKind ePageKind,
-        EditMode eEditMode);
-    virtual ~ViewIteratorImpl() override;
+    virtual ~DocumentIteratorImpl() override;
 
     virtual void GotoNextText() override;
     virtual IteratorImplBase* Clone (IteratorImplBase* pObject = nullptr) 
const override;
     virtual void Reverse() override;
 
-protected:
+private:
     /** Set up page pointer and object list iterator for the specified
         page.
         @param nPageIndex
@@ -199,33 +198,6 @@ protected:
     /// Pointer to the page associated with the current page index. May be 
NULL.
     SdPage* mpPage;
 
-private:
-    // Don't use this operator.
-    ViewIteratorImpl& operator= (const ViewIteratorImpl&) = delete;
-};
-
-/** Iterator for iteration over all objects in all views.  It automatically
-    switches views when reaching the end/beginning of a view.
-
-    <p>For documentation of the methods please refer to the base class
-    <type>IteratorImplBase</type>.</p>
-*/
-class DocumentIteratorImpl final : public ViewIteratorImpl
-{
-public:
-    DocumentIteratorImpl (
-        sal_Int32 nPageIndex,
-        PageKind ePageKind,
-        EditMode eEditMode,
-        SdDrawDocument* pDocument,
-        const std::weak_ptr<ViewShell>& rpViewShellWeak,
-        bool bDirectionIsForward);
-    virtual ~DocumentIteratorImpl() override;
-
-    virtual void GotoNextText() override;
-    virtual IteratorImplBase* Clone (IteratorImplBase* pObject = nullptr) 
const override;
-
-private:
     /// Number of pages in the view that is specified by 
<member>maPosition</member>.
     sal_Int32 mnPageCount;
 
diff --git a/sd/source/ui/view/NotesPanelViewShell.cxx 
b/sd/source/ui/view/NotesPanelViewShell.cxx
index f7d5f28a31db..738ccc3abeff 100644
--- a/sd/source/ui/view/NotesPanelViewShell.cxx
+++ b/sd/source/ui/view/NotesPanelViewShell.cxx
@@ -571,6 +571,7 @@ void NotesPanelViewShell::GetState(SfxItemSet& rSet)
     {
         switch (nWhich)
         {
+            case FID_SEARCH_NOW:
             case SID_SEARCH_ITEM:
             case SID_SEARCH_OPTIONS:
                 // Call common (old) implementation in the document shell.
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index ca5581108bd3..7df93444c6cb 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -130,6 +130,30 @@ sd::ViewShellBase* getViewShellBase()
     return dynamic_cast<sd::ViewShellBase*>(SfxViewShell::Current());
 }
 
+OutlinerView* lclGetNotesPaneOutliner(const std::shared_ptr<sd::ViewShell>& 
pViewShell)
+{
+    if (!pViewShell)
+        return nullptr;
+
+    // request the notes pane
+    sd::ViewShellBase& rBase = pViewShell->GetViewShellBase();
+
+    sd::framework::FrameworkHelper::Instance(rBase)->RequestView(
+        sd::framework::FrameworkHelper::msNotesPanelViewURL,
+        sd::framework::FrameworkHelper::msBottomImpressPaneURL);
+
+    auto pInstance = sd::framework::FrameworkHelper::Instance(rBase);
+    pInstance->RequestSynchronousUpdate();
+
+    std::shared_ptr<sd::ViewShell> pNotesPaneShell(
+        
pInstance->GetViewShell(sd::framework::FrameworkHelper::msBottomImpressPaneURL));
+
+    if (!pNotesPaneShell)
+        return nullptr;
+
+    return 
static_cast<sd::NotesPanelView*>(pNotesPaneShell->GetView())->GetOutlinerView();
+}
+
 } // end anonymous namespace
 
 SdOutliner::SdOutliner( SdDrawDocument* pDoc, OutlinerMode nMode )
@@ -899,11 +923,12 @@ bool 
SdOutliner::SearchAndReplaceOnce(std::vector<sd::SearchSelection>* pSelecti
                 if (mpSearchItem->GetCommand() != SvxSearchCmd::REPLACE_ALL)
                 {
                     nMatchCount = 
getOutlinerView()->StartSearchAndReplace(*mpSearchItem);
-                    if (nMatchCount && maCurrentPosition.mePageKind == 
PageKind::Notes)
+                    if (nMatchCount && maCurrentPosition.meEditMode == 
EditMode::Page
+                        && maCurrentPosition.mePageKind == PageKind::Notes)
                     {
-                        if(auto pOutl = lclGetNotesPaneOutliner())
+                        if(auto pNotesPaneOutliner = 
lclGetNotesPaneOutliner(pViewShell))
                         {
-                            
pOutl->SetSelection(getOutlinerView()->GetSelection());
+                            
pNotesPaneOutliner->SetSelection(getOutlinerView()->GetSelection());
                         }
                     }
                 }
@@ -922,28 +947,27 @@ bool 
SdOutliner::SearchAndReplaceOnce(std::vector<sd::SearchSelection>* pSelecti
                     // text object.
                     maLastValidPosition = maCurrentPosition;
 
-                    // there's a possible crasher here due to replace not 
working.
-
                     // Now that the mbEndOfSearch flag guards this block the
                     // following assertion and return should not be
                     // necessary anymore.
-                    // 
DBG_ASSERT(GetEditEngine().HasView(&getOutlinerView()->GetEditView() ),
-                    //     "SearchAndReplace without valid view!" );
-                    // if ( ! GetEditEngine().HasView( 
&getOutlinerView()->GetEditView() ) )
-                    // {
-                    //     mpDrawDocument->GetDocSh()->SetWaitCursor( false );
-                    //     return true;
-                    // }
-
-                    // notes->outliner
+                    
DBG_ASSERT(GetEditEngine().HasView(&getOutlinerView()->GetEditView() ),
+                        "SearchAndReplace without valid view!" );
+                    if ( ! GetEditEngine().HasView( 
&getOutlinerView()->GetEditView() )
+                         && maCurrentPosition.mePageKind != PageKind::Notes )
+                    {
+                        mpDrawDocument->GetDocSh()->SetWaitCursor( false );
+                        return true;
+                    }
+
                     if (meMode == SEARCH)
                     {
                         auto nMatch = 
getOutlinerView()->StartSearchAndReplace(*mpSearchItem);
-                        if (nMatch && maCurrentPosition.mePageKind == 
PageKind::Notes)
+                        if (nMatch && maCurrentPosition.meEditMode == 
EditMode::Page
+                            && maCurrentPosition.mePageKind == PageKind::Notes)
                         {
-                            if(auto pOutl = lclGetNotesPaneOutliner())
+                            if(auto pNotesPaneOutliner = 
lclGetNotesPaneOutliner(pViewShell))
                             {
-                                
pOutl->SetSelection(getOutlinerView()->GetSelection());
+                                
pNotesPaneOutliner->SetSelection(getOutlinerView()->GetSelection());
                             }
                         }
                     }
@@ -1222,26 +1246,6 @@ bool isValidVectorGraphicObject(const 
sd::outliner::IteratorPosition& rPosition)
 
 } // end anonymous namespace
 
-OutlinerView* SdOutliner::lclGetNotesPaneOutliner()
-{
-        // request the notes pane
-        std::shared_ptr<sd::ViewShell> pViewShell(mpWeakViewShell.lock());
-        sd::ViewShellBase& rBase = pViewShell->GetViewShellBase();
-
-        sd::framework::FrameworkHelper::Instance(rBase)->RequestView(
-            sd::framework::FrameworkHelper::msNotesPanelViewURL,
-            sd::framework::FrameworkHelper::msBottomImpressPaneURL);
-
-        auto pInstance = sd::framework::FrameworkHelper::Instance(rBase);
-        pInstance->RequestSynchronousUpdate();
-
-        std::shared_ptr<sd::ViewShell> 
pNotesPaneShell(pInstance->GetViewShell(sd::framework::FrameworkHelper::msBottomImpressPaneURL));
-
-        if(!pNotesPaneShell)
-            return nullptr;
-
-        return 
static_cast<sd::NotesPanelView*>(pNotesPaneShell->GetView())->GetOutlinerView();
-}
 
 /** The main purpose of this method is to iterate over all shape objects of
     the search area (current selection, current view, or whole document)
@@ -1596,9 +1600,9 @@ void SdOutliner::PrepareSearchAndReplace()
         pOutlinerView->SetSelection (GetSearchStartPosition ());
         if (lclIsValidTextObject(maCurrentPosition) && 
maCurrentPosition.mePageKind == PageKind::Notes)
         {
-            if (auto pOutl = lclGetNotesPaneOutliner())
+            if (auto pNotesPaneOutliner = 
lclGetNotesPaneOutliner(mpWeakViewShell.lock()))
             {
-                pOutl->SetSelection(getOutlinerView()->GetSelection());
+                
pNotesPaneOutliner->SetSelection(getOutlinerView()->GetSelection());
             }
         }
     }
@@ -1710,7 +1714,7 @@ void SdOutliner::EnterEditMode (bool bGrabFocus)
         return;
 
     pViewShell->GetDispatcher()->ExecuteList(
-        SID_TEXTEDIT, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, { &aItem });
+        SID_TEXTEDIT, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, {&aItem});
 
     if (mpView->IsTextEdit())
     {
@@ -1729,25 +1733,9 @@ void SdOutliner::EnterEditMode (bool bGrabFocus)
 
     // Turn on the edit mode for the text object.
     SetUpdateLayout(true);
-    if(maCurrentPosition.mePageKind != PageKind::Notes)
-    {
-        std::shared_ptr<sd::ViewShell> pFakeShell{};
-        sd::ViewShellBase* pBase = getViewShellBase();
-        if(auto pViewShellManager = pBase->GetViewShellManager())
-            pFakeShell = pViewShellManager->GetOverridingMainShell();
-
-        if(pFakeShell)
-            bGrabFocus=true;
-        mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, 
this,
-                                 pOutlinerView, true, true, bGrabFocus);
 
-        // likely only one or two of these is enough
-        getViewShellBase()->GetMainViewShell()->GetParentWindow()->GrabFocus();
-        getViewShellBase()->GetMainViewShell()->GetContentWindow()->Activate();
-        
getViewShellBase()->GetMainViewShell()->GetContentWindow()->GrabFocus();
-        getViewShellBase()->GetMainViewShell()->GetContentWindow()->GetFocus();
-    }
-    else
+    if(maCurrentPosition.mePageKind == PageKind::Notes
+       && maCurrentPosition.meEditMode == EditMode::Page)
     {
         sd::ViewShellBase& rBase = pViewShell->GetViewShellBase();
 
@@ -1761,13 +1749,27 @@ void SdOutliner::EnterEditMode (bool bGrabFocus)
         std::shared_ptr<sd::ViewShell> 
pNotesPaneShell(pInstance->GetViewShell(sd::framework::FrameworkHelper::msBottomImpressPaneURL));
         if(pNotesPaneShell)
         {
-            // likely only one or two of these is enough
             pNotesPaneShell->GetParentWindow()->GrabFocus();
-            pNotesPaneShell->GetContentWindow()->Activate();
             pNotesPaneShell->GetContentWindow()->GrabFocus();
-            pNotesPaneShell->GetContentWindow()->GetFocus();
         }
     }
+    else
+    {
+        std::shared_ptr<sd::ViewShell> pOverridingViewShell{};
+        sd::ViewShellBase* pBase = getViewShellBase();
+        if (auto pViewShellManager = pBase->GetViewShellManager())
+            pOverridingViewShell = pViewShellManager->GetOverridingMainShell();
+
+        if (pOverridingViewShell)
+        {
+            
getViewShellBase()->GetMainViewShell()->GetParentWindow()->GrabFocus();
+            
getViewShellBase()->GetMainViewShell()->GetContentWindow()->GrabFocus();
+            bGrabFocus = true;
+        }
+
+        mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, 
this, pOutlinerView,
+                                 true, true, bGrabFocus);
+    }
 
     mbFoundObject = true;
 }
@@ -1839,13 +1841,14 @@ bool SdOutliner::HandleFailedSearch()
 SdrObject* SdOutliner::SetObject (
     const sd::outliner::IteratorPosition& rPosition)
 {
-    if(rPosition.mePageKind == PageKind::Notes)
+    if(rPosition.meEditMode == EditMode::Page && rPosition.mePageKind == 
PageKind::Notes)
     {
         std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock());
         std::shared_ptr<sd::DrawViewShell> pDrawViewShell(
             std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell));
 
-        if(pDrawViewShell->GetEditMode() != EditMode::Page || 
pDrawViewShell->GetCurPagePos() != rPosition.mnPageIndex)
+        if (pDrawViewShell->GetEditMode() != EditMode::Page
+            || pDrawViewShell->GetCurPagePos() != rPosition.mnPageIndex)
             SetPage(EditMode::Page, 
static_cast<sal_uInt16>(rPosition.mnPageIndex));
 
         mnText = rPosition.mnText;
diff --git a/sd/source/ui/view/OutlinerIterator.cxx 
b/sd/source/ui/view/OutlinerIterator.cxx
index 95bfa0968b02..492880e9bf7c 100644
--- a/sd/source/ui/view/OutlinerIterator.cxx
+++ b/sd/source/ui/view/OutlinerIterator.cxx
@@ -512,110 +512,7 @@ bool SelectionIteratorImpl::IsEqualSelection(const 
IteratorImplBase& rIterator)
         && mnObjectIndex == pSelectionIterator->mnObjectIndex;
 }
 
-//===== ViewIteratorImpl ================================================
-
-ViewIteratorImpl::ViewIteratorImpl (
-    sal_Int32 nPageIndex,
-    SdDrawDocument* pDocument,
-    const std::weak_ptr<ViewShell>& rpViewShellWeak,
-    bool bDirectionIsForward)
-    : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward),
-      mpPage(nullptr)
-{
-    SetPage (nPageIndex);
-}
-
-ViewIteratorImpl::ViewIteratorImpl (
-    sal_Int32 nPageIndex,
-    SdDrawDocument* pDocument,
-    const std::weak_ptr<ViewShell>& rpViewShellWeak,
-    bool bDirectionIsForward,
-    PageKind ePageKind,
-    EditMode eEditMode)
-    : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward, 
ePageKind, eEditMode),
-      mpPage(nullptr)
-{
-    SetPage (nPageIndex);
-}
-
-ViewIteratorImpl::~ViewIteratorImpl()
-{
-}
-
-IteratorImplBase* ViewIteratorImpl::Clone (IteratorImplBase* pObject) const
-{
-
-    ViewIteratorImpl* pIterator = static_cast<ViewIteratorImpl*>(pObject);
-    if (pIterator == nullptr)
-        pIterator = new ViewIteratorImpl (
-            maPosition.mnPageIndex, mpDocument, mpViewShellWeak, 
mbDirectionIsForward);
-
-    IteratorImplBase::Clone (pObject);
-
-    if (moObjectIterator)
-    {
-        pIterator->moObjectIterator.emplace(mpPage, SdrIterMode::DeepNoGroups, 
!mbDirectionIsForward);
-
-        // No direct way to set the object iterator to the current object.
-        pIterator->maPosition.mxObject = nullptr;
-        while (pIterator->moObjectIterator->IsMore() && 
pIterator->maPosition.mxObject.get()!=maPosition.mxObject.get())
-            pIterator->maPosition.mxObject = 
pIterator->moObjectIterator->Next();
-    }
-    else
-        pIterator->moObjectIterator.reset();
-
-    return pIterator;
-}
-
-void ViewIteratorImpl::GotoNextText()
-{
-    SdrTextObj* pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() 
);
-    if( pTextObj )
-    {
-        if (mbDirectionIsForward)
-        {
-            ++maPosition.mnText;
-            if( maPosition.mnText < pTextObj->getTextCount() )
-                return;
-        }
-        else
-        {
-            --maPosition.mnText;
-            if( maPosition.mnText >= 0 )
-                return;
-        }
-    }
-
-    if (moObjectIterator && moObjectIterator->IsMore())
-        maPosition.mxObject = moObjectIterator->Next();
-    else
-        maPosition.mxObject = nullptr;
-
-    if (!maPosition.mxObject.get().is() )
-    {
-        if (mbDirectionIsForward)
-            SetPage (maPosition.mnPageIndex+1);
-        else
-            SetPage (maPosition.mnPageIndex-1);
-
-        if (mpPage != nullptr)
-            moObjectIterator.emplace( mpPage, SdrIterMode::DeepNoGroups, 
!mbDirectionIsForward );
-        if (moObjectIterator && moObjectIterator->IsMore())
-            maPosition.mxObject = moObjectIterator->Next();
-        else
-            maPosition.mxObject = nullptr;
-    }
-
-    maPosition.mnText = 0;
-    if( !mbDirectionIsForward && maPosition.mxObject.get().is() )
-    {
-        pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() );
-        if( pTextObj )
-            maPosition.mnText = pTextObj->getTextCount() - 1;
-    }
-}
-
-void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex)
+void DocumentIteratorImpl::SetPage(sal_Int32 nPageIndex)
 {
     maPosition.mnPageIndex = nPageIndex;
 
@@ -667,7 +564,7 @@ void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex)
 
 }
 
-void ViewIteratorImpl::Reverse()
+void DocumentIteratorImpl::Reverse()
 {
     IteratorImplBase::Reverse ();
 
@@ -696,13 +593,14 @@ DocumentIteratorImpl::DocumentIteratorImpl (
     SdDrawDocument* pDocument,
     const std::weak_ptr<ViewShell>& rpViewShellWeak,
     bool bDirectionIsForward)
-    : ViewIteratorImpl (nPageIndex, pDocument, rpViewShellWeak, 
bDirectionIsForward,
-        ePageKind, eEditMode)
+    : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward, 
ePageKind, eEditMode)
+    , mpPage(nullptr)
 {
     if (eEditMode == EditMode::Page)
         mnPageCount = pDocument->GetSdPageCount (ePageKind);
     else
         mnPageCount = pDocument->GetMasterSdPageCount(ePageKind);
+    SetPage(nPageIndex);
 }
 
 DocumentIteratorImpl::~DocumentIteratorImpl()
@@ -716,7 +614,21 @@ IteratorImplBase* DocumentIteratorImpl::Clone 
(IteratorImplBase* pObject) const
             maPosition.mnPageIndex, maPosition.mePageKind, 
maPosition.meEditMode,
             mpDocument, mpViewShellWeak, mbDirectionIsForward);
     // Finish the cloning.
-    return ViewIteratorImpl::Clone (pIterator);
+    IteratorImplBase::Clone (pObject);
+
+    if (moObjectIterator)
+    {
+        pIterator->moObjectIterator.emplace(mpPage, SdrIterMode::DeepNoGroups, 
!mbDirectionIsForward);
+
+        // No direct way to set the object iterator to the current object.
+        pIterator->maPosition.mxObject = nullptr;
+        while (pIterator->moObjectIterator->IsMore() && 
pIterator->maPosition.mxObject.get()!=maPosition.mxObject.get())
+            pIterator->maPosition.mxObject = 
pIterator->moObjectIterator->Next();
+    }
+    else
+        pIterator->moObjectIterator.reset();
+
+    return pIterator;
 }
 
 void DocumentIteratorImpl::GotoNextText()
@@ -724,8 +636,6 @@ void DocumentIteratorImpl::GotoNextText()
     bool bSetToOnePastLastPage = false;
     bool bViewChanged = false;
 
-    // ViewIteratorImpl::GotoNextText();
-
     SdrTextObj* pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() 
);
     if( pTextObj )
     {
@@ -750,26 +660,28 @@ void DocumentIteratorImpl::GotoNextText()
 
     if (!maPosition.mxObject.get().is() )
     {
-        if(maPosition.mePageKind == PageKind::Standard)
+        if (maPosition.meEditMode == EditMode::Page
+            && maPosition.mePageKind == PageKind::Standard)
         {
             maPosition.mePageKind = PageKind::Notes;
             if (mbDirectionIsForward)
-                SetPage (maPosition.mnPageIndex);
-            else
                 SetPage(maPosition.mnPageIndex);
+            else
+                SetPage(maPosition.mnPageIndex - 1);
         }
-        else if (maPosition.mePageKind == PageKind::Notes)
+        else if (maPosition.meEditMode == EditMode::Page
+                 && maPosition.mePageKind == PageKind::Notes)
         {
             maPosition.mePageKind = PageKind::Standard;
             if (mbDirectionIsForward)
-                SetPage (maPosition.mnPageIndex+1);
+                SetPage(maPosition.mnPageIndex + 1);
             else
-                SetPage(maPosition.mnPageIndex - 1);
+                SetPage(maPosition.mnPageIndex);
         }
         else
         {
             if (mbDirectionIsForward)
-                SetPage (maPosition.mnPageIndex+1);
+                SetPage(maPosition.mnPageIndex + 1);
             else
                 SetPage(maPosition.mnPageIndex - 1);
         }
@@ -801,67 +713,74 @@ void DocumentIteratorImpl::GotoNextText()
                 maPosition.meEditMode = EditMode::MasterPage;
                 SetPage (0);
             }
-
             // Switch to next view mode.
             else
             {
                 if (maPosition.mePageKind == PageKind::Handout)
-                    // Not really necessary but makes things more clear.
+                {
+                    // search wrapped
                     bSetToOnePastLastPage = true;
-                else
+                }
+                else if (maPosition.mePageKind == PageKind::Standard)
                 {
-                    maPosition.meEditMode = EditMode::Page;
-                    if (maPosition.mePageKind == PageKind::Standard)
-                        maPosition.mePageKind = PageKind::Handout;
-                    else if (maPosition.mePageKind == PageKind::Notes)
-                        maPosition.mePageKind = PageKind::Handout;
-                    SetPage (0);
+                    // switch to master notes
+                    maPosition.mePageKind = PageKind::Notes;
+                    SetPage(0);
+                }
+                else if (maPosition.mePageKind == PageKind::Notes)
+                {
+                    // switch to master handout
+                    maPosition.mePageKind = PageKind::Handout;
+                    SetPage(0);
                 }
             }
             bViewChanged = true;
         }
     }
     else
+    {
         if (maPosition.mnPageIndex < 0)
         {
-            // Switch from master pages to draw pages.
             if (maPosition.meEditMode == EditMode::MasterPage)
-            {
-                maPosition.meEditMode = EditMode::Page;
-                bSetToOnePastLastPage = true;
-            }
-
-            // Switch to previous view mode.
-            else
             {
                 if (maPosition.mePageKind == PageKind::Standard)
-                    SetPage (-1);
-                else
                 {
-                    maPosition.meEditMode = EditMode::MasterPage;
-                    if (maPosition.mePageKind == PageKind::Handout)
-                        maPosition.mePageKind = PageKind::Notes;
-                    else if (maPosition.mePageKind == PageKind::Notes)
-                        maPosition.mePageKind = PageKind::Standard;
+                    maPosition.meEditMode = EditMode::Page;
+                    maPosition.mePageKind = PageKind::Notes;
+                    bSetToOnePastLastPage = true;
+                }
+                else if (maPosition.mePageKind == PageKind::Handout)
+                {
+                    maPosition.mePageKind = PageKind::Notes;
+                    bSetToOnePastLastPage = true;
+                }
+                else if (maPosition.mePageKind == PageKind::Notes)
+                {
+                    maPosition.mePageKind = PageKind::Standard;
                     bSetToOnePastLastPage = true;
                 }
             }
-            bViewChanged = true;
+            else
+            {
+                // search wrapped
+                SetPage(-1);
+            }
         }
+        bViewChanged = true;
+    }
 
     if (!bViewChanged)
         return;
 
     // Get new page count;
-    sal_Int32 nPageCount;
     if (maPosition.meEditMode == EditMode::Page)
-        nPageCount = mpDocument->GetSdPageCount (maPosition.mePageKind);
+        mnPageCount = mpDocument->GetSdPageCount (maPosition.mePageKind);
     else
-        nPageCount = mpDocument->GetMasterSdPageCount(maPosition.mePageKind);
+        mnPageCount = mpDocument->GetMasterSdPageCount(maPosition.mePageKind);
 
     // Now that we know the number of pages we can set the current page index.
     if (bSetToOnePastLastPage)
-        SetPage (nPageCount);
+        SetPage (mnPageCount);
 }
 
 } // end of namespace ::sd::outliner
diff --git a/sd/source/ui/view/ToolBarManager.cxx 
b/sd/source/ui/view/ToolBarManager.cxx
index 6d718a0680da..9433f1922740 100644
--- a/sd/source/ui/view/ToolBarManager.cxx
+++ b/sd/source/ui/view/ToolBarManager.cxx
@@ -17,10 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include "NotesPanelViewShell.hxx"
 #include <ToolBarManager.hxx>
 
 #include <DrawViewShell.hxx>
+#include <NotesPanelViewShell.hxx>
 #include <EventMultiplexer.hxx>
 #include <ViewShellBase.hxx>
 #include <ViewShellManager.hxx>
@@ -159,8 +159,6 @@ public:
         const std::shared_ptr<ViewShell>& rpMainViewShell,
         const std::shared_ptr<ViewShellManager>& rpManager);
 
-    void SetActiveViewShell(std::shared_ptr<ViewShell>& rpMainViewShell);
-
 private:
     class ShellDescriptor
     {public:
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index f181b72db41c..0504738812b6 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -1955,24 +1955,24 @@ void DrawViewShell::Execute (SfxRequest& rReq)
         case SID_SEARCH_ITEM:
             // Forward this request to the common (old) code of the
             // document shell.
-            GetDocSh()->Execute(rReq);
-            break;
+            GetDocSh()->Execute (rReq);
+        break;
 
         case SID_SPELL_DIALOG:
         {
             SfxViewFrame* pViewFrame = GetViewFrame();
             if (rReq.GetArgs() != nullptr)
-                pViewFrame->SetChildWindow(
-                    SID_SPELL_DIALOG,
-                    static_cast<const 
SfxBoolItem&>(rReq.GetArgs()->Get(SID_SPELL_DIALOG))
-                        .GetValue());
+                pViewFrame->SetChildWindow (SID_SPELL_DIALOG,
+                    static_cast<const SfxBoolItem&>(rReq.GetArgs()->
+                        Get(SID_SPELL_DIALOG)).GetValue());
             else
                 pViewFrame->ToggleChildWindow(SID_SPELL_DIALOG);
 
             pViewFrame->GetBindings().Invalidate(SID_SPELL_DIALOG);
-            rReq.Ignore();
+            rReq.Ignore ();
         }
         break;
+
         default:
             SAL_WARN("sd", "DrawViewShell::Execute(): can not handle slot " << 
rReq.GetSlot());
             break;
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index a150cc97fd8f..f10b79c24468 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -403,20 +403,21 @@ void ViewShell::Deactivate(bool bIsMDIActivate)
 
 void ViewShell::BroadcastContextForActivation(const bool bIsActivated)
 {
-    auto getFrameworkResourceIdForShell = [&]() -> 
uno::Reference<drawing::framework::XResourceId> const
+    auto getFrameworkResourceIdForShell
+        = [&]() -> uno::Reference<drawing::framework::XResourceId> const
     {
         Reference<::css::drawing::framework::XControllerManager> 
xControllerManager(
             GetViewShellBase().GetController(), UNO_QUERY);
         if (!xControllerManager.is())
             return {};
 
-        Reference<::css::drawing::framework::XConfigurationController> 
xConfigurationController(
-            xControllerManager->getConfigurationController(), UNO_QUERY);
+        Reference<::css::drawing::framework::XConfigurationController> 
xConfigurationController
+            = xControllerManager->getConfigurationController();
         if (!xConfigurationController.is())
             return {};
 
-        Reference<::css::drawing::framework::XConfiguration> xConfiguration(
-            xConfigurationController->getCurrentConfiguration(), UNO_QUERY);
+        Reference<::css::drawing::framework::XConfiguration> xConfiguration
+            = xConfigurationController->getCurrentConfiguration();
         if (!xConfiguration.is())
             return {};
 
@@ -452,7 +453,7 @@ void ViewShell::BroadcastContextForActivation(const bool 
bIsActivated)
             EventMultiplexerEventId::FocusShifted, nullptr, 
getFrameworkResourceIdForShell());
     }
 
-    if(GetDispatcher())
+    if (GetDispatcher())
         SfxShell::BroadcastContextForActivation(bIsActivated);
 }
 
commit dad2596ab0dc453daf13f71f0bee48eead2ee1d9
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Mon Jul 8 12:53:44 2024 +0200
Commit:     Gerrit Code Review <[email protected]>
CommitDate: Mon Jul 8 12:53:44 2024 +0200

    Update git submodules
    
    * Update translations from branch 'feature/cib_contract49c'
      to 17317ce9e0cc6473150125382d015e0af2374e7a
      - Translate strings in bullets dropdown
    
        Change-Id: Ie588288ab0c8fd28ccd741d54280b97d333ec918

diff --git a/translations b/translations
index 86983d17704f..17317ce9e0cc 160000
--- a/translations
+++ b/translations
@@ -1 +1 @@
-Subproject commit 86983d17704f420a06f585a8e8d229a328f50908
+Subproject commit 17317ce9e0cc6473150125382d015e0af2374e7a
commit e0743196601f7bc6fc3f3835b71fccaf1560943b
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Thu Jul 4 14:34:28 2024 +0200
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Fri Jul 5 03:46:25 2024 +0200

    tdf#161653 Fix selecting from numbering dropdown (Impress/Draw)
    
    Change-Id: Ia066a8ff4b7ab4760fec7a4475afbceee084d115
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169996
    Tested-by: allotropia jenkins <[email protected]>
    Reviewed-by: Thorsten Behrens <[email protected]>

diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index ef9412956ece..c6c8d385ea35 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -124,6 +124,8 @@ void 
FuBulletAndPosition::SetCurrentBulletsNumbering(SfxRequest& rReq)
     }
 
     const SfxUInt16Item* pItem = 
rReq.GetArgs()->GetItem(SID_ATTR_BULLET_INDEX);
+    if (!pItem) // tdf#161653
+        pItem = rReq.GetArg<SfxUInt16Item>(nSId);
     if ( !pItem )
     {
         rReq.Done();
commit 28f3321ce9d18aedfd9aeb159ec1d6d384b33fc8
Author:     Thorsten Behrens <[email protected]>
AuthorDate: Tue Jun 25 16:23:55 2024 +0200
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Fri Jul 5 03:24:55 2024 +0200

    tdf#33603: handle outliner setup for notes pane search
    
    User can start search from subviewshell context of Notes pane, so
    disambiguate & delegate to actual main view shell (same fallback logic
    as for non-Notes pane case).
    
    Change-Id: I129505f452690ca5fde23dc6953cc3f34438d267
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169710
    Reviewed-by: Sarper Akdemir <[email protected]>
    Tested-by: Jenkins

diff --git a/sd/source/ui/func/fusearch.cxx b/sd/source/ui/func/fusearch.cxx
index 73a112bf44c6..4856dd20bece 100644
--- a/sd/source/ui/func/fusearch.cxx
+++ b/sd/source/ui/func/fusearch.cxx
@@ -29,6 +29,7 @@
 #include <DrawDocShell.hxx>
 #include <DrawViewShell.hxx>
 #include <OutlineViewShell.hxx>
+#include <NotesPanelViewShell.hxx>
 #include <ViewShellBase.hxx>
 
 class SfxRequest;
@@ -78,6 +79,19 @@ void FuSearch::DoExecute( SfxRequest& )
         m_bOwnOutliner = false;
         m_pSdOutliner = mpDoc->GetOutliner();
     }
+    else if ( dynamic_cast< const NotesPanelViewShell *>( mpViewShell ) !=  
nullptr )
+    {
+        if( mpViewShell->GetViewShellBase().GetMainViewShell()->GetShellType() 
== ViewShell::ST_OUTLINE )
+        {
+            m_bOwnOutliner = false;
+            m_pSdOutliner = mpDoc->GetOutliner();
+        }
+        if( mpViewShell->GetViewShellBase().GetMainViewShell()->GetShellType() 
== ViewShell::ST_IMPRESS )
+        {
+            m_bOwnOutliner = true;
+            m_pSdOutliner = new SdOutliner( mpDoc, OutlinerMode::TextObject );
+        }
+    }
 
     if (m_pSdOutliner)
        m_pSdOutliner->PrepareSpelling();
commit bda5efa887f20ea7d18fd26139e1de051daf87d1
Author:     Gabor Kelemen <[email protected]>
AuthorDate: Tue Apr 23 20:04:43 2024 +0200
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Fri Jul 5 02:30:53 2024 +0200

    Use less SdOptionsLayout->GetMetric/SetMetric in favor of officecfg
    
    Change-Id: I12c9f69e0db1bf3e726b7d642e9a6855b031d3b9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166597
    Reviewed-by: Thorsten Behrens <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit 055e7d866680390dca6e18864ca4297cc0ebda84)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169951
    Tested-by: allotropia jenkins <[email protected]>

diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 71b31219dbcb..54a828c81094 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -36,6 +36,7 @@
 #include <unotools/configmgr.hxx>
 #include <unotools/useroptions.hxx>
 #include <officecfg/Office/Impress.hxx>
+#include <officecfg/Office/Draw.hxx>
 
 #include <sfx2/linkmgr.hxx>
 #include <Outliner.hxx>
@@ -53,6 +54,8 @@
 #include <unotools/charclass.hxx>
 #include <comphelper/processfactory.hxx>
 #include <unotools/lingucfg.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/syslocale.hxx>
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
 #include <com/sun/star/xml/dom/XDocument.hpp>
@@ -157,12 +160,19 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, 
SfxObjectShell* pDrDocSh)
     sal_Int32 nX, nY;
     SdOptions* pOptions = SD_MOD()->GetSdOptions(meDocType);
     pOptions->GetScale( nX, nY );
+    SvtSysLocale aSysLocale;
 
     // Allow UI scale only for draw documents.
     if( eType == DocumentType::Draw )
-        SetUIUnit( static_cast<FieldUnit>(pOptions->GetMetric()), Fraction( 
nX, nY ) );  // user-defined
+        if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == 
MeasurementSystem::Metric)
+            SetUIUnit( 
static_cast<FieldUnit>(officecfg::Office::Draw::Layout::Other::MeasureUnit::Metric::get()),
 Fraction( nX, nY ) );  // user-defined
+        else
+            SetUIUnit( 
static_cast<FieldUnit>(officecfg::Office::Draw::Layout::Other::MeasureUnit::NonMetric::get()),
 Fraction( nX, nY ) );  // user-defined
     else
-        SetUIUnit( static_cast<FieldUnit>(pOptions->GetMetric()), Fraction( 1, 
1 ) );    // default
+        if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == 
MeasurementSystem::Metric)
+            SetUIUnit( 
static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::Metric::get()),
 Fraction( 1, 1 ) );    // default
+        else
+                        SetUIUnit( 
static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::NonMetric::get()),
 Fraction( 1, 1 ) );    // default
 
     SetScaleUnit(MapUnit::Map100thMM);
     SetDefaultFontHeight(o3tl::convert(24, o3tl::Length::pt, 
o3tl::Length::mm100));
diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
index 22f566706c46..7e1f05074728 100644
--- a/sd/source/ui/app/sdmod.cxx
+++ b/sd/source/ui/app/sdmod.cxx
@@ -141,18 +141,6 @@ SdOptions* SdModule::GetSdOptions(DocumentType eDocType)
 
         pOptions = pImpressOptions;
     }
-    if( pOptions )
-    {
-        sal_uInt16 nMetric = pOptions->GetMetric();
-
-        ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( 
SfxObjectShell::Current() );
-        SdDrawDocument* pDoc = nullptr;
-        if (pDocSh)
-            pDoc = pDocSh->GetDoc();
-
-        if( nMetric != 0xffff && pDoc && eDocType == pDoc->GetDocumentType() )
-            PutItem( SfxUInt16Item( SID_ATTR_METRIC, nMetric ) );
-    }
 
     return pOptions;
 }
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 7251e6541722..b4c329ea9a2f 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -21,7 +21,9 @@
 #include <svl/intitem.hxx>
 #include <sfx2/frame.hxx>
 #include <sfx2/viewfrm.hxx>
+#include <unotools/localedatawrapper.hxx>
 #include <unotools/moduleoptions.hxx>
+#include <unotools/syslocale.hxx>
 #include <framework/FrameworkHelper.hxx>
 #include <osl/diagnose.h>
 #include <vcl/commandevent.hxx>
@@ -53,6 +55,9 @@
 #include <memory>
 #include <slideshow.hxx>
 
+#include <officecfg/Office/Draw.hxx>
+#include <officecfg/Office/Impress.hxx>
+
 using ::sd::framework::FrameworkHelper;
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::frame::XFrame;
@@ -126,9 +131,21 @@ void SdModule::Execute(SfxRequest& rReq)
                                 DocumentType eDocType = 
pDocSh->GetDoc()->GetDocumentType();
 
                                 PutItem( *pItem );
-                                SdOptions* pOptions = GetSdOptions( eDocType );
-                                if(pOptions)
-                                    pOptions->SetMetric( 
static_cast<sal_uInt16>(eUnit) );
+                                SvtSysLocale aSysLocale;
+                                
std::shared_ptr<comphelper::ConfigurationChanges> batch(
+                                    
comphelper::ConfigurationChanges::create());
+
+                                if (eDocType == DocumentType::Impress)
+                                    if 
(aSysLocale.GetLocaleData().getMeasurementSystemEnum() == 
MeasurementSystem::Metric)
+                                        
officecfg::Office::Impress::Layout::Other::MeasureUnit::Metric::set(static_cast<sal_uInt16>(eUnit),
 batch);
+                                    else
+                                        
officecfg::Office::Impress::Layout::Other::MeasureUnit::NonMetric::set(static_cast<sal_uInt16>(eUnit),
 batch);
+                                else
+                                    if 
(aSysLocale.GetLocaleData().getMeasurementSystemEnum() == 
MeasurementSystem::Metric)
+                                        
officecfg::Office::Draw::Layout::Other::MeasureUnit::Metric::set(static_cast<sal_uInt16>(eUnit),
 batch);
+                                else
+                                        
officecfg::Office::Draw::Layout::Other::MeasureUnit::NonMetric::set(static_cast<sal_uInt16>(eUnit),
 batch);
+                                batch->commit();
                                 rReq.Done();
                             }
                         }
@@ -314,9 +331,18 @@ void SdModule::GetState(SfxItemSet& rItemSet)
         if(pDocSh)
         {
             DocumentType eDocType = pDocSh->GetDoc()->GetDocumentType();
+            SvtSysLocale aSysLocale;
 
-            SdOptions* pOptions = GetSdOptions(eDocType);
-            rItemSet.Put( SfxUInt16Item( SID_ATTR_METRIC, 
pOptions->GetMetric() ) );
+            if (eDocType == DocumentType::Impress)
+                if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == 
MeasurementSystem::Metric)
+                    rItemSet.Put( SfxUInt16Item( SID_ATTR_METRIC, 
officecfg::Office::Impress::Layout::Other::MeasureUnit::Metric::get() ) );
+                else
+                    rItemSet.Put( SfxUInt16Item( SID_ATTR_METRIC, 
officecfg::Office::Impress::Layout::Other::MeasureUnit::NonMetric::get() ) );
+            else
+                if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == 
MeasurementSystem::Metric)
+                    rItemSet.Put( SfxUInt16Item( SID_ATTR_METRIC, 
officecfg::Office::Draw::Layout::Other::MeasureUnit::Metric::get() ) );
+                else
+                    rItemSet.Put( SfxUInt16Item( SID_ATTR_METRIC, 
officecfg::Office::Draw::Layout::Other::MeasureUnit::NonMetric::get() ) );
         }
     }
 
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index 8a6424d16263..f15e0b08a1df 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -24,6 +24,8 @@
 #include <svl/inethist.hxx>
 #include <svl/poolitem.hxx>
 #include <svl/flagitem.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/syslocale.hxx>
 #include <unotools/useroptions.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/viewfrm.hxx>
@@ -61,6 +63,9 @@
 #include <sdabstdlg.hxx>
 #include <svl/intitem.hxx>
 
+#include <officecfg/Office/Draw.hxx>
+#include <officecfg/Office/Impress.hxx>
+
 /** retrieves the page that is currently painted. This will only be the master 
page
     if the current drawn view only shows the master page*/
 static SdPage* GetCurrentPage( sd::ViewShell const * pViewSh, EditFieldInfo 
const * pInfo, bool& bMasterView )
@@ -470,10 +475,20 @@ std::optional<SfxItemSet> SdModule::CreateItemSet( 
sal_uInt16 nSlot )
     aRet.Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, nDefTab ) );
 
     FieldUnit nMetric = FieldUnit(0xffff);
+    SvtSysLocale aSysLocale;
     if( pFrameView)
         nMetric = pDoc->GetUIUnit();
     else
-        nMetric = static_cast<FieldUnit>(pOptions->GetMetric());
+        if (eDocType == DocumentType::Impress)
+            if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == 
MeasurementSystem::Metric)
+                nMetric = 
static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::Metric::get());
+            else
+                nMetric = 
static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::NonMetric::get());
+        else
+            if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == 
MeasurementSystem::Metric)
+                nMetric = 
static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::Metric::get());
+            else
+                nMetric = 
static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::NonMetric::get());
 
     if( nMetric == FieldUnit(0xffff) )
         nMetric = GetFieldUnit();
@@ -573,7 +588,22 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const 
SfxItemSet& rSet )
     {
         if( pDoc && eDocType == pDoc->GetDocumentType() )
             PutItem( *pItem );
-        pOptions->SetMetric( pItem->GetValue() );
+
+        SvtSysLocale aSysLocale;
+        std::shared_ptr<comphelper::ConfigurationChanges> batch(
+            comphelper::ConfigurationChanges::create());
+        if (eDocType == DocumentType::Impress)
+            if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == 
MeasurementSystem::Metric)
+                
officecfg::Office::Impress::Layout::Other::MeasureUnit::Metric::set(pItem->GetValue(),
 batch);
+            else
+                
officecfg::Office::Impress::Layout::Other::MeasureUnit::NonMetric::set(pItem->GetValue(),
 batch);
+        else
+            if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == 
MeasurementSystem::Metric)
+                
officecfg::Office::Draw::Layout::Other::MeasureUnit::Metric::set(pItem->GetValue(),
 batch);
+            else
+                
officecfg::Office::Draw::Layout::Other::MeasureUnit::NonMetric::set(pItem->GetValue(),
 batch);
+        batch->commit();
+
     }
     sal_uInt16 nDefTab = pOptions->GetDefTab();
     // Default-Tabulator
@@ -701,7 +731,19 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const 
SfxItemSet& rSet )
     // Only if also the document type matches...
     if( pDocSh && pDoc && eDocType == pDoc->GetDocumentType() )
     {
-        FieldUnit eUIUnit = static_cast<FieldUnit>(pOptions->GetMetric());
+        FieldUnit eUIUnit;
+        SvtSysLocale aSysLocale;
+        if (eDocType == DocumentType::Impress)
+            if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == 
MeasurementSystem::Metric)
+                eUIUnit = 
static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::Metric::get());
+            else
+                eUIUnit = 
static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::NonMetric::get());
+        else
+            if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == 
MeasurementSystem::Metric)
+                eUIUnit = 
static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::Metric::get());
+            else
+                eUIUnit = 
static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::NonMetric::get());
+
         pDoc->SetUIUnit(eUIUnit);
 
         if (pViewShell)

Reply via email to