compilerplugins/clang/mergeclasses.results |    1 
 include/sfx2/docfile.hxx                   |    3 
 sfx2/source/appl/workwin.cxx               |  123 +++++++++++------------------
 sfx2/source/doc/docfile.cxx                |   22 ++---
 sfx2/source/inc/workwin.hxx                |   23 +----
 sfx2/source/view/frame.cxx                 |    2 
 6 files changed, 68 insertions(+), 106 deletions(-)

New commits:
commit 3e6c930842eea53a1faa0721c0807e07466c8fb2
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Fri Oct 14 11:52:35 2016 +0200

    loplugin:mergeclasses merge SfxWorkWindow with SfxFrameWorkWin_Impl
    
    Change-Id: If6cab49904fdb044d85a4fd29f79faa7b52c9959

diff --git a/compilerplugins/clang/mergeclasses.results 
b/compilerplugins/clang/mergeclasses.results
index 68088b9..442ba92 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -131,7 +131,6 @@ merge SfxModelSubComponent with sfx2::DocumentUndoManager
 merge SfxMultiFixRecordWriter with SfxMultiVarRecordWriter
 merge SfxSingleRecordReader with SfxMultiRecordReader
 merge SfxSingleRecordWriter with SfxMultiFixRecordWriter
-merge SfxWorkWindow with SfxFrameWorkWin_Impl
 merge SmFontPickList with SmFontPickListBox
 merge StarSymbolToMSMultiFont with StarSymbolToMSMultiFontImpl
 merge StgAvlIterator with StgIterator
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 21982e6..f98235a 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -461,47 +461,9 @@ void SfxWorkWindow::Sort_Impl()
 
 // constructor for workwin of a Frame
 
-SfxFrameWorkWin_Impl::SfxFrameWorkWin_Impl( vcl::Window *pWin, SfxFrame *pFrm, 
SfxFrame* pMaster )
-    : SfxWorkWindow(
-        pWin,
-        pFrm->GetCurrentViewFrame()->GetBindings(),
-        pFrm->GetParentFrame() ? pFrm->GetParentFrame()->GetWorkWindow_Impl() 
: nullptr )
-    , pMasterFrame( pMaster )
-    , pFrame( pFrm )
-{
-    pConfigShell = pFrm->GetCurrentViewFrame();
-    if ( pConfigShell && pConfigShell->GetObjectShell() )
-    {
-        bShowStatusBar = ( !pConfigShell->GetObjectShell()->IsInPlaceActive() 
);
-        bDockingAllowed = true;
-        bInternalDockingAllowed = true;
-    }
-
-    // The required split windows (one for each side) can be created
-    for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
-    {
-        // The SplitWindows excludes direct ChildWindows of the WorkWindows
-        // and receives the docked window.
-
-        SfxChildAlignment eAlign =
-                        ( n == SFX_SPLITWINDOWS_LEFT ? SfxChildAlignment::LEFT 
:
-                            n == SFX_SPLITWINDOWS_RIGHT ? 
SfxChildAlignment::RIGHT :
-                            n == SFX_SPLITWINDOWS_TOP ? SfxChildAlignment::TOP 
:
-                                SfxChildAlignment::BOTTOM );
-        VclPtr<SfxSplitWindow> pSplitWin = 
VclPtr<SfxSplitWindow>::Create(pWorkWin, eAlign, this, pParent==nullptr );
-        pSplit[n] = pSplitWin;
-    }
-
-    nOrigMode = SFX_VISIBILITY_STANDARD;
-    nUpdateMode = SFX_VISIBILITY_STANDARD;
-}
-
-
-// Constructor of the base class
-
-SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxBindings& rB, 
SfxWorkWindow* pParentWorkwin ) :
-    pParent( pParentWorkwin ),
-    pBindings(&rB),
+SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxFrame *pFrm, SfxFrame* 
pMaster ) :
+    pParent( pFrm->GetParentFrame() ? 
pFrm->GetParentFrame()->GetWorkWindow_Impl() : nullptr ),
+    pBindings(&pFrm->GetCurrentViewFrame()->GetBindings()),
     pWorkWin (pWin),
     pConfigShell( nullptr ),
     pActiveChild( nullptr ),
@@ -523,7 +485,9 @@ SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, 
SfxBindings& rB, SfxWorkWindow*
     m_aStatusBarResName( "private:resource/statusbar/statusbar" ),
     m_aLayoutManagerPropName( "LayoutManager" ),
     m_aTbxTypeName( "private:resource/toolbar/" ),
-    m_aProgressBarResName( "private:resource/progressbar/progressbar" )
+    m_aProgressBarResName( "private:resource/progressbar/progressbar" ),
+    pMasterFrame( pMaster ),
+    pFrame( pFrm )
 {
     DBG_ASSERT (pBindings, "No Bindings!");
 
@@ -539,6 +503,32 @@ SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, 
SfxBindings& rB, SfxWorkWindow*
     m_xLayoutManagerListener.set( static_cast< cppu::OWeakObject* >( 
pLayoutManagerListener ),
                                   css::uno::UNO_QUERY );
     pLayoutManagerListener->setFrame( xFrame );
+
+    pConfigShell = pFrm->GetCurrentViewFrame();
+    if ( pConfigShell && pConfigShell->GetObjectShell() )
+    {
+        bShowStatusBar = ( !pConfigShell->GetObjectShell()->IsInPlaceActive() 
);
+        bDockingAllowed = true;
+        bInternalDockingAllowed = true;
+    }
+
+    // The required split windows (one for each side) can be created
+    for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
+    {
+        // The SplitWindows excludes direct ChildWindows of the WorkWindows
+        // and receives the docked window.
+
+        SfxChildAlignment eAlign =
+                        ( n == SFX_SPLITWINDOWS_LEFT ? SfxChildAlignment::LEFT 
:
+                            n == SFX_SPLITWINDOWS_RIGHT ? 
SfxChildAlignment::RIGHT :
+                            n == SFX_SPLITWINDOWS_TOP ? SfxChildAlignment::TOP 
:
+                                SfxChildAlignment::BOTTOM );
+        VclPtr<SfxSplitWindow> pSplitWin = 
VclPtr<SfxSplitWindow>::Create(pWorkWin, eAlign, this, pParent==nullptr );
+        pSplit[n] = pSplitWin;
+    }
+
+    nOrigMode = SFX_VISIBILITY_STANDARD;
+    nUpdateMode = SFX_VISIBILITY_STANDARD;
 }
 
 
@@ -669,14 +659,9 @@ void SfxWorkWindow::DeleteControllers_Impl()
 }
 
 
-// Virtual method for placing the child window.
+// for placing the child window.
 
-void SfxWorkWindow::ArrangeChildren_Impl( bool /*bForce*/)
-{
-    Arrange_Impl();
-}
-
-void SfxFrameWorkWin_Impl::ArrangeChildren_Impl( bool bForce )
+void SfxWorkWindow::ArrangeChildren_Impl( bool bForce )
 {
     if ( pFrame->IsClosing_Impl() || ( m_nLock && !bForce ))
         return;
@@ -1079,7 +1064,7 @@ bool SfxWorkWindow::IsVisible_Impl( sal_uInt16 nMode ) 
const
     }
 }
 
-void SfxFrameWorkWin_Impl::UpdateObjectBars_Impl()
+void SfxWorkWindow::UpdateObjectBars_Impl()
 {
     if ( pFrame->IsClosing_Impl() )
         return;
@@ -1087,11 +1072,11 @@ void SfxFrameWorkWin_Impl::UpdateObjectBars_Impl()
     SfxWorkWindow *pWork = pParent;
     while ( pWork )
     {
-        pWork->SfxWorkWindow::UpdateObjectBars_Impl();
+        pWork->UpdateObjectBars_Impl2();
         pWork = pWork->GetParent_Impl();
     }
 
-    SfxWorkWindow::UpdateObjectBars_Impl();
+    UpdateObjectBars_Impl2();
 
     {
         pWork = pParent;
@@ -1164,16 +1149,16 @@ css::uno::Reference< css::frame::XFrame > 
SfxWorkWindow::GetFrameInterface()
     SfxDispatcher* pDispatcher( GetBindings().GetDispatcher() );
     if ( pDispatcher )
     {
-        SfxViewFrame* pFrame = pDispatcher->GetFrame();
-        if ( pFrame )
-           xFrame = pFrame->GetFrame().GetFrameInterface();
+        SfxViewFrame* pViewFrame = pDispatcher->GetFrame();
+        if ( pViewFrame )
+           xFrame = pViewFrame->GetFrame().GetFrameInterface();
     }
 
     return xFrame;
 }
 
 
-void SfxWorkWindow::UpdateObjectBars_Impl()
+void SfxWorkWindow::UpdateObjectBars_Impl2()
 {
     // Lock SplitWindows (which means suppressing the Resize-Reaction of the
     // DockingWindows)
@@ -1205,9 +1190,9 @@ void SfxWorkWindow::UpdateObjectBars_Impl()
 
     if ( pDispatcher )
     {
-        SfxViewFrame* pFrame = pDispatcher->GetFrame();
-        if ( pFrame )
-           bPluginMode = IsPluginMode( pFrame->GetObjectShell() );
+        SfxViewFrame* pViewFrame = pDispatcher->GetFrame();
+        if ( pViewFrame )
+           bPluginMode = IsPluginMode( pViewFrame->GetObjectShell() );
     }
 
     // Iterate over all Toolboxes
@@ -2197,21 +2182,11 @@ void SfxWorkWindow::ResetChildWindows_Impl()
     }
 }
 
-
-// Virtual method that returns the size of the area (client area) of the
+// returns the size of the area (client area) of the
 // parent windows, in which the ChildWindow can be fitted.
 
 Rectangle SfxWorkWindow::GetTopRect_Impl()
 {
-    return Rectangle (Point(), pWorkWin->GetOutputSizePixel() );
-}
-
-
-// Virtual method that returns the size of the area (client area) of the
-// parent windows, in which the ChildWindow can be fitted.
-
-Rectangle SfxFrameWorkWin_Impl::GetTopRect_Impl()
-{
     return pMasterFrame->GetTopOuterRectPixel_Impl();
 }
 
@@ -2239,18 +2214,18 @@ void SfxWorkWindow::SaveStatus_Impl(SfxChildWindow 
*pChild, const SfxChildWinInf
 void SfxWorkWindow::InitializeChild_Impl(SfxChildWin_Impl *pCW)
 {
     SfxDispatcher *pDisp = pBindings->GetDispatcher_Impl();
-    SfxViewFrame *pFrame = pDisp ? pDisp->GetFrame() :nullptr;
-    SfxModule *pMod = pFrame ? SfxModule::GetActiveModule(pFrame) :nullptr;
+    SfxViewFrame *pViewFrame = pDisp ? pDisp->GetFrame() :nullptr;
+    SfxModule *pMod = pViewFrame ? SfxModule::GetActiveModule(pViewFrame) 
:nullptr;
 
     OUString sModule;
-    if (pFrame)
+    if (pViewFrame)
     {
         try
         {
             using namespace ::com::sun::star;
             uno::Reference< frame::XModuleManager2 > xModuleManager(
                 
frame::ModuleManager::create(::comphelper::getProcessComponentContext()));
-            sModule = 
xModuleManager->identify(pFrame->GetFrame().GetFrameInterface());
+            sModule = 
xModuleManager->identify(pViewFrame->GetFrame().GetFrameInterface());
             SvtModuleOptions::EFactory eFac = 
SvtModuleOptions::ClassifyFactoryByServiceName(sModule);
             sModule = SvtModuleOptions::GetFactoryShortName(eFac);
         }
diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx
index 78fe130..d0fe42d 100644
--- a/sfx2/source/inc/workwin.hxx
+++ b/sfx2/source/inc/workwin.hxx
@@ -222,6 +222,8 @@ protected:
     OUString                m_aTbxTypeName;
     OUString                m_aProgressBarResName;
     css::uno::Reference< css::lang::XComponent > m_xLayoutManagerListener;
+    SfxFrame*               pMasterFrame;
+    SfxFrame*               pFrame;
 
 protected:
     void                    CreateChildWin_Impl(SfxChildWin_Impl*,bool);
@@ -229,13 +231,13 @@ protected:
     void                    Sort_Impl();
     SfxChild_Impl*          FindChild_Impl( const vcl::Window& rWindow ) const;
     bool                    RequestTopToolSpacePixel_Impl( SvBorder aBorder );
-    virtual Rectangle       GetTopRect_Impl();
+    Rectangle               GetTopRect_Impl();
     SvBorder                Arrange_Impl();
     void                    SaveStatus_Impl(SfxChildWindow*, const 
SfxChildWinInfo&);
     static bool             IsPluginMode( SfxObjectShell* pObjShell );
 
 public:
-                            SfxWorkWindow( vcl::Window *pWin, SfxBindings& 
rBindings, SfxWorkWindow* pParent = nullptr);
+                            SfxWorkWindow( vcl::Window* pWin, SfxFrame* pFrm, 
SfxFrame* pMaster );
     virtual                 ~SfxWorkWindow();
     SfxBindings&            GetBindings()
                             { return *pBindings; }
@@ -260,7 +262,7 @@ public:
     void                    ShowChildren_Impl();
     void                    HideChildren_Impl();
     bool                    PrepareClose_Impl();
-    virtual void            ArrangeChildren_Impl( bool bForce = true );
+    void                    ArrangeChildren_Impl( bool bForce = true );
     void                    DeleteControllers_Impl();
     void                    HidePopups_Impl(bool bHide, bool bParent, 
sal_uInt16 nId=0);
     void                    ConfigChild_Impl(SfxChildIdentifier,
@@ -272,7 +274,8 @@ public:
     void                    SetFullScreen_Impl( bool bSet ) { bIsFullScreen = 
bSet; }
 
     // Methods for Objectbars
-    virtual void            UpdateObjectBars_Impl();
+    void                    UpdateObjectBars_Impl();
+    void                    UpdateObjectBars_Impl2();
     void                    ResetObjectBars_Impl();
     void                    SetObjectBar_Impl(sal_uInt16 nPos, sal_uInt32 
nResId,
                                     SfxInterface *pIFace);
@@ -307,18 +310,6 @@ public:
     css::uno::Reference< css::frame::XFrame > GetFrameInterface();
 };
 
-class SfxFrameWorkWin_Impl : public SfxWorkWindow
-{
-    SfxFrame*           pMasterFrame;
-    SfxFrame*           pFrame;
-public:
-                        SfxFrameWorkWin_Impl( vcl::Window* pWin, SfxFrame* 
pFrm, SfxFrame* pMaster );
-    virtual void        ArrangeChildren_Impl( bool bForce = true ) override;
-    virtual void        UpdateObjectBars_Impl() override;
-    virtual Rectangle   GetTopRect_Impl() override;
-};
-
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index ba1e615..a4617bf 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -788,7 +788,7 @@ void SfxFrame::CreateWorkWindow_Impl()
         }
     }
 
-    pImpl->pWorkWin = new SfxFrameWorkWin_Impl( &pFrame->GetWindow(), this, 
pFrame );
+    pImpl->pWorkWin = new SfxWorkWindow( &pFrame->GetWindow(), this, pFrame );
 }
 
 void SfxFrame::GrabFocusOnComponent_Impl()
commit 11570275c601496bd709da1454cd8ffde50823e7
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Fri Oct 14 11:32:17 2016 +0200

    convert LOCK_UI constants to scoped enum
    
    Change-Id: Ie8a8702124ba86feda17c4371e66c3997ba3557c

diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx
index 76c2a2c..6738786 100644
--- a/include/sfx2/docfile.hxx
+++ b/include/sfx2/docfile.hxx
@@ -163,7 +163,8 @@ public:
     bool                Commit();
     bool                IsStorage();
 
-    sal_Int8            ShowLockedDocumentDialog( const LockFileEntry& aData, 
bool bIsLoading, bool bOwnLock );
+    enum class ShowLockResult { NoLock, Succeeded,Try };
+    ShowLockResult      ShowLockedDocumentDialog( const LockFileEntry& aData, 
bool bIsLoading, bool bOwnLock );
     void                LockOrigFileOnDemand( bool bLoading, bool bNoUI );
     void                DisableUnlockWebDAV( bool bDisableUnlockWebDAV = true 
);
     void                UnlockFile( bool bReleaseLockStream );
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index b8efb54..e93e954 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -134,10 +134,6 @@ namespace {
 
 #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
 
-static const sal_Int8 LOCK_UI_NOLOCK = 0;
-static const sal_Int8 LOCK_UI_SUCCEEDED = 1;
-static const sal_Int8 LOCK_UI_TRY = 2;
-
 bool IsSystemFileLockingUsed()
 {
 #if HAVE_FEATURE_MACOSX_SANDBOX
@@ -838,9 +834,9 @@ void SfxMedium::SetEncryptionDataToStorage_Impl()
 // not for some URL scheme belongs in UCB, not here.
 
 
-sal_Int8 SfxMedium::ShowLockedDocumentDialog( const LockFileEntry& aData, bool 
bIsLoading, bool bOwnLock )
+SfxMedium::ShowLockResult SfxMedium::ShowLockedDocumentDialog( const 
LockFileEntry& aData, bool bIsLoading, bool bOwnLock )
 {
-    sal_Int8 nResult = LOCK_UI_NOLOCK;
+    ShowLockResult nResult = ShowLockResult::NoLock;
 
     if( aData[LockFileComponent::OOOUSERNAME] == 
aData[LockFileComponent::SYSUSERNAME] ||
                                       
aData[LockFileComponent::OOOUSERNAME].isEmpty()  ||
@@ -907,7 +903,7 @@ sal_Int8 SfxMedium::ShowLockedDocumentDialog( const 
LockFileEntry& aData, bool b
                 GetItemSet()->Put( SfxBoolItem( SID_TEMPLATE, true ) );
             }
             else if ( bOwnLock )
-                nResult = LOCK_UI_SUCCEEDED;
+                nResult = ShowLockResult::Succeeded;
         }
         else // if ( XSelected == aContinuations[1] )
         {
@@ -919,7 +915,7 @@ sal_Int8 SfxMedium::ShowLockedDocumentDialog( const 
LockFileEntry& aData, bool b
             if ( bIsLoading )
                 GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, true ) );
             else
-                nResult = LOCK_UI_TRY;
+                nResult = ShowLockResult::Try;
         }
     }
     else
@@ -983,7 +979,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool 
bNoUI )
 
             if ( !bResult && !IsReadOnly() )
             {
-                sal_Int8 bUIStatus = LOCK_UI_NOLOCK;
+                ShowLockResult bUIStatus = ShowLockResult::NoLock;
                 do
                 {
                     if( !bResult )
@@ -1053,7 +1049,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool 
bNoUI )
                         catch( uno::Exception& )
                         {}
                     }
-                } while( !bResult && bUIStatus == LOCK_UI_TRY );
+                } while( !bResult && bUIStatus == ShowLockResult::Try );
             }
 
             pImpl->m_bLocked = bResult;
@@ -1161,7 +1157,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool 
bNoUI )
                         }
                     }
 
-                    sal_Int8 bUIStatus = LOCK_UI_NOLOCK;
+                    ShowLockResult bUIStatus = ShowLockResult::NoLock;
 
                     // check whether system file locking has been used, the 
default value is false
                     bool bUseSystemLock = comphelper::isFileUrl( 
pImpl->m_aLogicName ) && IsSystemFileLockingUsed();
@@ -1267,7 +1263,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool 
bNoUI )
                                 if ( !bResult && !bNoUI )
                                 {
                                     bUIStatus = ShowLockedDocumentDialog( 
aData, bLoading, bOwnLock );
-                                    if ( bUIStatus == LOCK_UI_SUCCEEDED )
+                                    if ( bUIStatus == 
ShowLockResult::Succeeded )
                                     {
                                         // take the ownership over the lock 
file
                                         bResult = 
aLockFile.OverwriteOwnLockFile();
@@ -1280,7 +1276,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool 
bNoUI )
                         catch( const uno::Exception& )
                         {
                         }
-                    } while( !bResult && bUIStatus == LOCK_UI_TRY );
+                    } while( !bResult && bUIStatus == ShowLockResult::Try );
 
                     pImpl->m_bLocked = bResult;
                 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to