[Libreoffice-commits] core.git: sw/qa sw/source

ackepenek ahmetcan.kepenek at gmail.com
Sun Feb 21 17:03:13 UTC 2016


 sw/qa/extras/uiwriter/uiwriter.cxx |    2 +-
 sw/source/uibase/app/appenv.cxx    |    2 +-
 sw/source/uibase/frmdlg/frmmgr.cxx |   15 ++++++++-------
 sw/source/uibase/inc/frmmgr.hxx    |   16 +++++++++-------
 sw/source/uibase/shells/basesh.cxx |   10 +++++-----
 sw/source/uibase/shells/frmsh.cxx  |    4 ++--
 sw/source/uibase/shells/grfsh.cxx  |    4 ++--
 sw/source/uibase/shells/textsh.cxx |    4 ++--
 sw/source/uibase/uiview/view2.cxx  |    4 ++--
 sw/source/uibase/wrtsh/wrtsh1.cxx  |    4 ++--
 10 files changed, 34 insertions(+), 31 deletions(-)

New commits:
commit c621c3f5e115c90249319ef98e1e33e9fd603c9e
Author: ackepenek <ahmetcan.kepenek at gmail.com>
Date:   Sun Feb 21 05:33:45 2016 +0200

    tdf#84938 replace FRMMGR_TYPE_ with enum
    
    Change-Id: I899b57a485b83cd7c10ddc5192c92b4c87fe583a
    Reviewed-on: https://gerrit.libreoffice.org/22582
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 9669946..71ed680 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -2902,7 +2902,7 @@ void SwUiWriterTest::testTdf88986()
 
     // Create the item set that is normally passed to the insert frame dialog.
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-    SwFlyFrameAttrMgr aMgr(true, pWrtShell, FRMMGR_TYPE_TEXT);
+    SwFlyFrameAttrMgr aMgr(true, pWrtShell, Frmmgr_Type::TEXT);
     SfxItemSet aSet = aShell.CreateInsertFrameItemSet(aMgr);
 
     // This was missing along with the gradient and other tables.
diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx
index c66094c..ad0ed53 100644
--- a/sw/source/uibase/app/appenv.cxx
+++ b/sw/source/uibase/app/appenv.cxx
@@ -417,7 +417,7 @@ void SwModule::InsertEnv( SfxRequest& rReq )
         pSh->ChgCurPageDesc(*pDesc);
 
         // Insert Frame
-        SwFlyFrameAttrMgr aMgr(false, pSh, FRMMGR_TYPE_ENVELP);
+        SwFlyFrameAttrMgr aMgr(false, pSh, Frmmgr_Type::ENVELP);
         SwFieldMgr aFieldMgr;
         aMgr.SetHeightSizeType(ATT_VAR_SIZE);
 
diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx b/sw/source/uibase/frmdlg/frmmgr.cxx
index 6f7ca97..87e8a3f 100644
--- a/sw/source/uibase/frmdlg/frmmgr.cxx
+++ b/sw/source/uibase/frmdlg/frmmgr.cxx
@@ -56,7 +56,7 @@ static sal_uInt16 aFrameMgrRange[] = {
                             0};
 
 // determine frame attributes via Shell
-SwFlyFrameAttrMgr::SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, sal_uInt8 nType ) :
+SwFlyFrameAttrMgr::SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nType ) :
     m_aSet( static_cast<SwAttrPool&>(pSh->GetAttrPool()), aFrameMgrRange ),
     m_pOwnSh( pSh ),
     m_bAbsPos( false ),
@@ -66,20 +66,21 @@ SwFlyFrameAttrMgr::SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, sal_uInt8 nTyp
 {
     if ( m_bNewFrame )
     {
-        // set defaults:
-        sal_uInt16 nId = 0;
+        sal_uInt16 nId;
         switch ( nType )
         {
-            case FRMMGR_TYPE_TEXT:  nId = RES_POOLFRM_FRAME;    break;
-            case FRMMGR_TYPE_OLE:   nId = RES_POOLFRM_OLE;      break;
-            case FRMMGR_TYPE_GRF:   nId = RES_POOLFRM_GRAPHIC;  break;
+            case Frmmgr_Type::TEXT:  nId = RES_POOLFRM_FRAME;    break;
+            case Frmmgr_Type::OLE:   nId = RES_POOLFRM_OLE;      break;
+            case Frmmgr_Type::GRF:   nId = RES_POOLFRM_GRAPHIC;  break;
+            // set defaults:
+            default:    nId=0; break;
         }
         m_aSet.SetParent( &m_pOwnSh->GetFormatFromPool( nId )->GetAttrSet());
         m_aSet.Put( SwFormatFrameSize( ATT_MIN_SIZE, DFLT_WIDTH, DFLT_HEIGHT ));
         if ( 0 != ::GetHtmlMode(pSh->GetView().GetDocShell()) )
             m_aSet.Put( SwFormatHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::PRINT_AREA ) );
     }
-    else if ( nType == FRMMGR_TYPE_NONE )
+    else if ( nType == Frmmgr_Type::NONE )
     {
         m_pOwnSh->GetFlyFrameAttr( m_aSet );
         bool bRightToLeft;
diff --git a/sw/source/uibase/inc/frmmgr.hxx b/sw/source/uibase/inc/frmmgr.hxx
index ad22873..c37c3bd 100644
--- a/sw/source/uibase/inc/frmmgr.hxx
+++ b/sw/source/uibase/inc/frmmgr.hxx
@@ -38,12 +38,14 @@ class   SwFormatCol;
 const SwTwips   DFLT_WIDTH      = MM50 * 4;
 const SwTwips   DFLT_HEIGHT     = MM50;
 
-
-#define FRMMGR_TYPE_NONE    0x00
-#define FRMMGR_TYPE_TEXT    0x01
-#define FRMMGR_TYPE_GRF     0x02
-#define FRMMGR_TYPE_OLE     0x04
-#define FRMMGR_TYPE_ENVELP  0x10
+enum class Frmmgr_Type
+{
+    NONE    = 0x00,
+    TEXT    = 0x01,
+    GRF     = 0x02,
+    OLE     = 0x04,
+    ENVELP  = 0x10
+};
 
 class SW_DLLPUBLIC SwFlyFrameAttrMgr
 {
@@ -66,7 +68,7 @@ class SW_DLLPUBLIC SwFlyFrameAttrMgr
     SAL_DLLPRIVATE void _UpdateFlyFrame(); // post-treatment after insert or update
 
 public:
-    SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, sal_uInt8 nType );
+    SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nType );
 
     //CopyCtor for dialogs to check the metrics
     SwFlyFrameAttrMgr( bool bNew, SwWrtShell *pSh, const SfxItemSet &rSet );
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index be0bc3d..9f46dd7 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -1171,7 +1171,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
             else if ( rSh.IsFrameSelected() )
             {
                 // Set border attributes via Frame-Manager.
-                SwFlyFrameAttrMgr aMgr( false, &rSh, FRMMGR_TYPE_NONE );
+                SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE );
                 aMgr.SetAttrSet( *pArgs );
                 aMgr.UpdateFlyFrame();
             }
@@ -1203,7 +1203,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
             else if ( rSh.IsFrameSelected() )
             {
                 // Set border attributes via Frame-Manager.
-                SwFlyFrameAttrMgr aMgr( false, &rSh, FRMMGR_TYPE_NONE );
+                SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE );
                 aMgr.SetAttrSet(*pArgs);
                 aMgr.UpdateFlyFrame();
             }
@@ -1390,7 +1390,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
                 }
                 else if( rSh.IsFrameSelected() )
                 {
-                    SwFlyFrameAttrMgr aMgr( false, &rSh, FRMMGR_TYPE_NONE );
+                    SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE );
                     aSet.Put( aMgr.GetAttrSet() );
                 }
                 else
@@ -2332,7 +2332,7 @@ void SwBaseShell::GetBorderState(SfxItemSet &rSet)
     }
     else if ( rSh.IsFrameSelected() )
     {
-        SwFlyFrameAttrMgr aMgr( false, &rSh, FRMMGR_TYPE_NONE );
+        SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE );
         rSet.Put( aMgr.GetAttrSet() );
         bPrepare = false;
     }
@@ -2425,7 +2425,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
             else if ( rSh.IsFrameSelected() )
             {
                 // Set border attributes via Frame-Manager
-                SwFlyFrameAttrMgr aMgr( false, &rSh, FRMMGR_TYPE_NONE );
+                SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE );
                 aSet.Put( aMgr.GetAttrSet() );
 
                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 5160c0a..f181d2a 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -265,7 +265,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
         return;
     }
 
-    SwFlyFrameAttrMgr aMgr( false, &rSh, FRMMGR_TYPE_NONE );
+    SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE );
     bool bUpdateMgr = true;
     bool bCopyToFormat = false;
     switch ( nSlot )
@@ -678,7 +678,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
         bProtect |= bParentCntProt;
 
         const FrameTypeFlags eFrameType = rSh.GetFrameType(nullptr,true);
-        SwFlyFrameAttrMgr aMgr( false, &rSh, FRMMGR_TYPE_NONE );
+        SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE );
 
         SfxWhichIter aIter( rSet );
         sal_uInt16 nWhich = aIter.FirstWhich();
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index 0e2411b..acde645 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -214,7 +214,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
         case FN_DRAW_WRAP_DLG:
         {
             SwFlyFrameAttrMgr aMgr( false, &rSh, rSh.IsFrameSelected() ?
-                                               FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF);
+                                               Frmmgr_Type::NONE : Frmmgr_Type::GRF);
             const SwViewOption* pVOpt = rSh.GetViewOptions();
             SwViewOption aUsrPref( *pVOpt );
 
@@ -859,7 +859,7 @@ void SwGrfShell::ExecuteRotation(SfxRequest &rReq)
     aTransform.rotate(aRotation);
     rShell.ReRead(OUString(), OUString(), const_cast<const Graphic*>(&aGraphic));
 
-    SwFlyFrameAttrMgr aManager(false, &rShell, rShell.IsFrameSelected() ? FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF);
+    SwFlyFrameAttrMgr aManager(false, &rShell, rShell.IsFrameSelected() ? Frmmgr_Type::NONE : Frmmgr_Type::GRF);
     const long nRotatedWidth = aManager.GetSize().Height();
     const long nRotatedHeight = aManager.GetSize().Width();
     Size aSize(nRotatedWidth, nRotatedHeight);
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index b9220a0..312dc99 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -408,7 +408,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
             Size aSize(16 * MM50, 8 * MM50);
             GetShell().LockPaint();
             GetShell().StartAllAction();
-            SwFlyFrameAttrMgr aMgr( true, GetShellPtr(), FRMMGR_TYPE_TEXT );
+            SwFlyFrameAttrMgr aMgr( true, GetShellPtr(), Frmmgr_Type::TEXT );
             if(nCols > 1)
             {
                 SwFormatCol aCol;
@@ -439,7 +439,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
 
         }
         // Create new border
-        SwFlyFrameAttrMgr aMgr( true, GetShellPtr(), FRMMGR_TYPE_TEXT );
+        SwFlyFrameAttrMgr aMgr( true, GetShellPtr(), Frmmgr_Type::TEXT );
         if(pArgs)
         {
             Size aSize(aMgr.GetSize());
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 92f87f4..5f540e8 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -249,7 +249,7 @@ int SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter,
             }
         }
 
-        SwFlyFrameAttrMgr aFrameManager( true, GetWrtShellPtr(), FRMMGR_TYPE_GRF );
+        SwFlyFrameAttrMgr aFrameManager( true, GetWrtShellPtr(), Frmmgr_Type::GRF );
         SwWrtShell& rShell = GetWrtShell();
 
         // #i123922# determine if we really want to insert or replace the graphic at a selected object
@@ -1881,7 +1881,7 @@ void SwView::InsFrameMode(sal_uInt16 nCols)
 {
     if ( m_pWrtShell->HasWholeTabSelection() )
     {
-        SwFlyFrameAttrMgr aMgr( true, m_pWrtShell, FRMMGR_TYPE_TEXT );
+        SwFlyFrameAttrMgr aMgr( true, m_pWrtShell, Frmmgr_Type::TEXT );
 
         const SwFrameFormat &rPageFormat =
                 m_pWrtShell->GetPageDesc(m_pWrtShell->GetCurPageDesc()).GetMaster();
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index b03c892..6a089ec 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -268,7 +268,7 @@ void SwWrtShell::Insert( const OUString &rPath, const OUString &rFilter,
     if ( !pFrameMgr )
     {
         bOwnMgr = true;
-        pFrameMgr = new SwFlyFrameAttrMgr( true, this, FRMMGR_TYPE_GRF );
+        pFrameMgr = new SwFlyFrameAttrMgr( true, this, Frmmgr_Type::GRF );
 
         // CAUTION
         // GetAttrSet makes an adjustment
@@ -498,7 +498,7 @@ bool SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrame
 
     EnterSelFrameMode();
 
-    SwFlyFrameAttrMgr aFrameMgr( true, this, FRMMGR_TYPE_OLE );
+    SwFlyFrameAttrMgr aFrameMgr( true, this, Frmmgr_Type::OLE );
     aFrameMgr.SetHeightSizeType(ATT_FIX_SIZE);
 
     SwRect aBound;


More information about the Libreoffice-commits mailing list