[Libreoffice-commits] core.git: editeng/source include/editeng sd/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 28 13:35:09 UTC 2021


 editeng/source/outliner/outliner.cxx   |   20 ++++++++++----------
 editeng/source/outliner/outlvw.cxx     |   24 ++++++++++++------------
 include/editeng/outliner.hxx           |    6 ++----
 sd/source/core/drawdoc4.cxx            |    2 +-
 sd/source/core/sdpage.cxx              |    4 ++--
 sd/source/ui/dlg/headerfooterdlg.cxx   |    2 +-
 sd/source/ui/view/DocumentRenderer.cxx |    4 ++--
 sd/source/ui/view/drtxtob.cxx          |    2 +-
 sd/source/ui/view/drviews2.cxx         |    4 ++--
 sd/source/ui/view/drviewse.cxx         |    2 +-
 10 files changed, 34 insertions(+), 36 deletions(-)

New commits:
commit cc7ff6d890ab2cacc7f0273039b15689dad5e0dd
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Jul 28 15:20:51 2021 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Jul 28 15:34:29 2021 +0200

    Three identical functions for a class is a bit too much
    
    Change-Id: Ia949f3fe2cbbc8aa524347854faa23807d58e252
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119606
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 49ac38415987..7ffa2de88589 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -194,7 +194,7 @@ void Outliner::Init( OutlinerMode nMode )
 
     SetMaxDepth( 9 );
 
-    switch ( ImplGetOutlinerMode() )
+    switch ( GetOutlinerMode() )
     {
         case OutlinerMode::TextObject:
         case OutlinerMode::TitleObject:
@@ -249,7 +249,7 @@ void Outliner::SetDepth( Paragraph* pPara, sal_Int16 nNewDepth )
     ImplInitDepth( nPara, nNewDepth, true );
     ImplCalcBulletText( nPara, false, false );
 
-    if ( ImplGetOutlinerMode() == OutlinerMode::OutlineObject )
+    if ( GetOutlinerMode() == OutlinerMode::OutlineObject )
         ImplSetLevelDependentStyleSheet( nPara );
 
     DepthChangedHdl(pPara, nPrevFlags);
@@ -374,7 +374,7 @@ std::unique_ptr<OutlinerParaObject> Outliner::CreateParaObject( sal_Int32 nStart
         return nullptr;
 
     std::unique_ptr<EditTextObject> xText = pEditEngine->CreateTextObject( nStartPara, nCount );
-    const bool bIsEditDoc(OutlinerMode::TextObject == ImplGetOutlinerMode());
+    const bool bIsEditDoc(OutlinerMode::TextObject == GetOutlinerMode());
     ParagraphDataVector aParagraphDataVector(nCount);
     const sal_Int32 nLastPara(nStartPara + nCount - 1);
 
@@ -384,7 +384,7 @@ std::unique_ptr<OutlinerParaObject> Outliner::CreateParaObject( sal_Int32 nStart
     }
 
     std::unique_ptr<OutlinerParaObject> pPObj(new OutlinerParaObject(std::move(xText), aParagraphDataVector, bIsEditDoc));
-    pPObj->SetOutlinerMode(GetMode());
+    pPObj->SetOutlinerMode(GetOutlinerMode());
 
     return pPObj;
 }
@@ -443,8 +443,8 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara )
 
             // In the outliner mode, filter the tabs and set the indentation
             // about a LRSpaceItem. In EditEngine mode intend over old tabs
-            if( ( ImplGetOutlinerMode() == OutlinerMode::OutlineObject ) ||
-                ( ImplGetOutlinerMode() == OutlinerMode::OutlineView ) )
+            if( ( GetOutlinerMode() == OutlinerMode::OutlineObject ) ||
+                ( GetOutlinerMode() == OutlinerMode::OutlineView ) )
             {
                 // Extract Tabs
                 sal_Int32 nTabs = 0;
@@ -686,7 +686,7 @@ void Outliner::ImplCheckNumBulletItem( sal_Int32 nPara )
 void Outliner::ImplSetLevelDependentStyleSheet( sal_Int32 nPara )
 {
 
-    DBG_ASSERT( ( ImplGetOutlinerMode() == OutlinerMode::OutlineObject ) || ( ImplGetOutlinerMode() == OutlinerMode::OutlineView ), "SetLevelDependentStyleSheet: Wrong Mode!" );
+    DBG_ASSERT( ( GetOutlinerMode() == OutlinerMode::OutlineObject ) || ( GetOutlinerMode() == OutlinerMode::OutlineView ), "SetLevelDependentStyleSheet: Wrong Mode!" );
 
     SfxStyleSheet* pStyle = GetStyleSheet( nPara );
 
@@ -1189,7 +1189,7 @@ void Outliner::ImpTextPasted( sal_Int32 nStartPara, sal_Int32 nCount )
 
     while( nCount && pPara )
     {
-        if( ImplGetOutlinerMode() != OutlinerMode::TextObject )
+        if( GetOutlinerMode() != OutlinerMode::TextObject )
         {
             nDepthChangedHdlPrevDepth = pPara->GetDepth();
             ParaFlag nPrevFlags = pPara->nFlags;
@@ -1240,7 +1240,7 @@ bool Outliner::ImpCanIndentSelectedPages( OutlinerView* pCurView )
 
     // If the first paragraph is on level 0 it can not indented in any case,
     // possible there might be indentations in the following on the 0 level.
-    if ( ( mnFirstSelPage == 0 ) && ( ImplGetOutlinerMode() != OutlinerMode::TextObject ) )
+    if ( ( mnFirstSelPage == 0 ) && ( GetOutlinerMode() != OutlinerMode::TextObject ) )
     {
         if ( nDepthChangedHdlPrevDepth == 1 )   // is the only page
             return false;
@@ -2123,7 +2123,7 @@ std::unique_ptr<OutlinerParaObject> Outliner::GetEmptyParaObject() const
 {
     std::unique_ptr<EditTextObject> pEmptyText = pEditEngine->GetEmptyTextObject();
     std::unique_ptr<OutlinerParaObject> pPObj( new OutlinerParaObject( std::move(pEmptyText) ));
-    pPObj->SetOutlinerMode(GetMode());
+    pPObj->SetOutlinerMode(GetOutlinerMode());
     return pPObj;
 }
 
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 6cd2f6d7515e..cdac21edf282 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -121,7 +121,7 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra
             break;
             case KeyFuncType::DELETE:
             {
-                if( !bReadOnly && !bSelection && ( pOwner->ImplGetOutlinerMode() != OutlinerMode::TextObject ) )
+                if( !bReadOnly && !bSelection && ( pOwner->GetOutlinerMode() != OutlinerMode::TextObject ) )
                 {
                     if( aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) )
                     {
@@ -147,14 +147,14 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra
             {
                 if ( !bReadOnly && !aKeyCode.IsMod1() && !aKeyCode.IsMod2() )
                 {
-                    if ( ( pOwner->ImplGetOutlinerMode() != OutlinerMode::TextObject ) &&
-                         ( pOwner->ImplGetOutlinerMode() != OutlinerMode::TitleObject ) &&
+                    if ( ( pOwner->GetOutlinerMode() != OutlinerMode::TextObject ) &&
+                         ( pOwner->GetOutlinerMode() != OutlinerMode::TitleObject ) &&
                          ( bSelection || !aSel.nStartPos ) )
                     {
                         Indent( aKeyCode.IsShift() ? -1 : +1 );
                         bKeyProcessed = true;
                     }
-                    else if ( ( pOwner->ImplGetOutlinerMode() == OutlinerMode::TextObject ) &&
+                    else if ( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) &&
                               !bSelection && !aSel.nEndPos && pOwner->ImplHasNumberFormat( aSel.nEndPara ) )
                     {
                         Indent( aKeyCode.IsShift() ? -1 : +1 );
@@ -284,7 +284,7 @@ sal_Int32 OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTa
 
 bool OutlinerView::MouseMove( const MouseEvent& rMEvt )
 {
-    if( ( pOwner->ImplGetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->GetEditEngine()->IsInSelectionMode())
+    if( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->GetEditEngine()->IsInSelectionMode())
         return pEditView->MouseMove( rMEvt );
 
     Point aMousePosWin( pEditView->GetOutputDevice().PixelToLogic( rMEvt.GetPosPixel() ) );
@@ -299,7 +299,7 @@ bool OutlinerView::MouseMove( const MouseEvent& rMEvt )
 
 bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt )
 {
-    if ( ( pOwner->ImplGetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->GetEditEngine()->IsInSelectionMode() )
+    if ( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->GetEditEngine()->IsInSelectionMode() )
         return pEditView->MouseButtonDown( rMEvt );
 
     Point aMousePosWin( pEditView->GetOutputDevice().PixelToLogic( rMEvt.GetPosPixel() ) );
@@ -331,7 +331,7 @@ bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt )
     }
 
     // special case for outliner view in impress, check if double click hits the page icon for toggle
-    if( (nPara == EE_PARA_NOT_FOUND) && (pOwner->ImplGetOutlinerMode() == OutlinerMode::OutlineView) && (eTarget == MouseTarget::Text) && (rMEvt.GetClicks() == 2) )
+    if( (nPara == EE_PARA_NOT_FOUND) && (pOwner->GetOutlinerMode() == OutlinerMode::OutlineView) && (eTarget == MouseTarget::Text) && (rMEvt.GetClicks() == 2) )
     {
         ESelection aSel( pEditView->GetSelection() );
         nPara = aSel.nStartPara;
@@ -347,7 +347,7 @@ bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt )
 
 bool OutlinerView::MouseButtonUp( const MouseEvent& rMEvt )
 {
-    if ( ( pOwner->ImplGetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->GetEditEngine()->IsInSelectionMode() )
+    if ( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->GetEditEngine()->IsInSelectionMode() )
         return pEditView->MouseButtonUp( rMEvt );
 
     Point aMousePosWin( pEditView->GetOutputDevice().PixelToLogic( rMEvt.GetPosPixel() ) );
@@ -503,7 +503,7 @@ void OutlinerView::Indent( short nDiff )
 
         if( nOldDepth != nNewDepth )
         {
-            if ( ( nPara == aSel.nStartPara ) && aSel.nStartPara && ( pOwner->ImplGetOutlinerMode() != OutlinerMode::TextObject ))
+            if ( ( nPara == aSel.nStartPara ) && aSel.nStartPara && ( pOwner->GetOutlinerMode() != OutlinerMode::TextObject ))
             {
                 // Special case: the predecessor of an indented paragraph is
                 // invisible and is now on the same level as the visible
@@ -534,7 +534,7 @@ void OutlinerView::Indent( short nDiff )
             pOwner->ImplInitDepth( nPara, nNewDepth, true );
             pOwner->ImplCalcBulletText( nPara, false, false );
 
-            if ( pOwner->ImplGetOutlinerMode() == OutlinerMode::OutlineObject )
+            if ( pOwner->GetOutlinerMode() == OutlinerMode::OutlineObject )
                 pOwner->ImplSetLevelDependentStyleSheet( nPara );
 
             // Notify App
@@ -690,7 +690,7 @@ void OutlinerView::Paste( bool bUseSpecial )
     else
         pEditView->Paste();
 
-    if ( pOwner->ImplGetOutlinerMode() == OutlinerMode::OutlineObject )
+    if ( pOwner->GetOutlinerMode() == OutlinerMode::OutlineObject )
     {
         const sal_Int32 nParaCount = pOwner->pEditEngine->GetParagraphCount();
 
@@ -1365,7 +1365,7 @@ void OutlinerView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueItera
 
     for ( sal_Int32 n = nChangesStart; n <= nChangesEnd; n++ )
     {
-        if ( pOwner->ImplGetOutlinerMode() == OutlinerMode::OutlineObject )
+        if ( pOwner->GetOutlinerMode() == OutlinerMode::OutlineObject )
             pOwner->ImplSetLevelDependentStyleSheet( n );
     }
 
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 309334acc809..b28cdd39ac4b 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -624,7 +624,6 @@ private:
     bool        ImpCanDeleteSelectedPages( OutlinerView* pCurView );
     bool        ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_Int32 nFirstPage, sal_Int32 nPages );
 
-    OutlinerMode ImplGetOutlinerMode() const { return nOutlinerMode; }
     void        ImplCheckDepth( sal_Int16& rnDepth ) const;
 
 protected:
@@ -645,13 +644,12 @@ protected:
 
 public:
 
-                    Outliner( SfxItemPool* pPool, OutlinerMode nOutlinerMode );
+                    Outliner( SfxItemPool* pPool, OutlinerMode nMode );
     virtual         ~Outliner() override;
 
     void            dumpAsXml(xmlTextWriterPtr pWriter) const;
 
-    void            Init( OutlinerMode nOutlinerMode );
-    OutlinerMode    GetMode() const { return nOutlinerMode; }
+    void            Init( OutlinerMode nMode );
 
     void            SetVertical( bool bVertical);
     void            SetRotation(TextRotation nRotation);
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index e078afc58b54..e41e43daf06c 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -967,7 +967,7 @@ void SdDrawDocument::SpellObject(SdrTextObj* pObj)
     Link<EditStatus&,void> aEvtHdl = pOutl->GetStatusEventHdl();
     pOutl->SetStatusEventHdl(LINK(this, SdDrawDocument, OnlineSpellEventHdl));
 
-    OutlinerMode nOldOutlMode = pOutl->GetMode();
+    OutlinerMode nOldOutlMode = pOutl->GetOutlinerMode();
     OutlinerMode nOutlMode = OutlinerMode::TextObject;
     if (pObj->GetObjInventor() == SdrInventor::Default &&
         pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 38b0308bf667..55ee1a8a280d 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -491,7 +491,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
             {
                 SdrOutliner* pOutliner = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetInternalOutliner();
 
-                OutlinerMode nOutlMode = pOutliner->GetMode();
+                OutlinerMode nOutlMode = pOutliner->GetOutlinerMode();
                 pOutliner->Init( OutlinerMode::TextObject );
                 pOutliner->SetStyleSheet( 0, nullptr );
                 pOutliner->SetVertical( bVertical );
@@ -2379,7 +2379,7 @@ void SdPage::SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eO
         pOutl->SetUpdateMode( false );
     }
 
-    OutlinerMode nOutlMode = pOutl->GetMode();
+    OutlinerMode nOutlMode = pOutl->GetOutlinerMode();
     Size aPaperSize = pOutl->GetPaperSize();
     bool bUpdateMode = pOutl->GetUpdateMode();
     pOutl->SetUpdateMode(false);
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx
index 3320ed06b9e3..ddc769551d5a 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -557,7 +557,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType &rLanguage, boo
 
     Outliner* pOutl = mpDoc->GetInternalOutliner();
     pOutl->Init( OutlinerMode::TextObject );
-    OutlinerMode nOutlMode = pOutl->GetMode();
+    OutlinerMode nOutlMode = pOutl->GetOutlinerMode();
 
     EditEngine* pEdit = const_cast< EditEngine* >(&pOutl->GetEditEngine());
 
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index 20f75eea71d3..d0cc984e249b 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1123,7 +1123,7 @@ namespace {
             // Get and set up the outliner.
             const ::tools::Rectangle aOutRect (rPrinter.GetPageOffset(), rPrinter.GetOutputSize());
             Outliner* pOutliner = rDocument.GetInternalOutliner();
-            const OutlinerMode nSavedOutlMode (pOutliner->GetMode());
+            const OutlinerMode nSavedOutlMode (pOutliner->GetOutlinerMode());
             const bool bSavedUpdateMode (pOutliner->GetUpdateMode());
             const Size aSavedPaperSize (pOutliner->GetPaperSize());
 
@@ -1631,7 +1631,7 @@ private:
 
         Outliner* pOutliner = mrBase.GetDocument()->GetInternalOutliner();
         pOutliner->Init(OutlinerMode::OutlineView);
-        const OutlinerMode nSavedOutlMode (pOutliner->GetMode());
+        const OutlinerMode nSavedOutlMode (pOutliner->GetOutlinerMode());
         const bool bSavedUpdateMode (pOutliner->GetUpdateMode());
         const Size aSavedPaperSize (pOutliner->GetPaperSize());
         const MapMode aSavedMapMode (pOutliner->GetRefMapMode());
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx
index 01e5675a96c7..13980e1b4bab 100644
--- a/sd/source/ui/view/drtxtob.cxx
+++ b/sd/source/ui/view/drtxtob.cxx
@@ -266,7 +266,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
                         Paragraph* pPara = aSelList.empty() ? nullptr : *(aSelList.begin());
 
                         // find out if we are an OutlineView
-                        bool bIsOutlineView(OutlinerMode::OutlineView == pOLV->GetOutliner()->GetMode());
+                        bool bIsOutlineView(OutlinerMode::OutlineView == pOLV->GetOutliner()->GetOutlinerMode());
 
                         // This is ONLY for OutlineViews
                         if(bIsOutlineView)
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 00f32b6d57b6..b370a0d551bb 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -496,7 +496,7 @@ public:
 
         // Create the outliner from the
         Outliner* pOutliner = m_rDrawViewShell.GetDoc()->GetInternalOutliner();
-        OutlinerMode eOutlinerMode = pOutliner->GetMode();
+        OutlinerMode eOutlinerMode = pOutliner->GetOutlinerMode();
 
         comphelper::ScopeGuard const aOutlinerGuard([pOutliner, eOutlinerMode] () {
             pOutliner->Init(eOutlinerMode);
@@ -2487,7 +2487,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             {
                 Outliner* pOutl = GetDoc()->GetInternalOutliner();
                 pOutl->Init( OutlinerMode::TextObject );
-                OutlinerMode nOutlMode = pOutl->GetMode();
+                OutlinerMode nOutlMode = pOutl->GetOutlinerMode();
                 pOutl->SetStyleSheet( 0, nullptr );
                 pOutl->QuickInsertField( *pFieldItem, ESelection() );
                 std::unique_ptr<OutlinerParaObject> pOutlParaObject = pOutl->CreateParaObject();
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 5e5a3ff38514..3acc0b882c3d 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -1483,7 +1483,7 @@ void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText,
     {
         Outliner* pOutl = GetDoc()->GetInternalOutliner();
         pOutl->Init( OutlinerMode::TextObject );
-        OutlinerMode nOutlMode = pOutl->GetMode();
+        OutlinerMode nOutlMode = pOutl->GetOutlinerMode();
 
         SvxURLField aURLField(rURL, rText, SvxURLFormat::Repr);
         aURLField.SetTargetFrame(rTarget);


More information about the Libreoffice-commits mailing list