diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-09-10 13:47:54 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-09-10 14:15:12 +0100 |
commit | a5aab0cce45309afae81b3ec0be8ace1ca0ca17d (patch) | |
tree | e6fe3bce568437daf079723c3e64df3a7465ee7d /sw | |
parent | 7473aacc73f8572e20f6f2a3a1d10001c5cc477d (diff) |
GetSelectedFlyFrm+GetCurrFlyFrm -> GetSelectedOrCurrFlyFrm
Change-Id: I4348c4cf54dcd5504c52cf8ab550572257eef50b
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/fesh.hxx | 7 | ||||
-rw-r--r-- | sw/source/core/frmedt/fefly1.cxx | 48 |
2 files changed, 25 insertions, 30 deletions
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 2ae85eb85ce9..89ce3d6b06dd 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -395,10 +395,13 @@ public: void SetFrameFormat( SwFrameFormat *pFormat, bool bKeepOrient = false, Point* pDocPos = 0 ); ///< If frame then set frame style. // Get selected fly - SwFlyFrm *GetSelectedFlyFrm() const; + SwFlyFrm* GetSelectedFlyFrm() const; // Get current fly in which the cursor is positioned - SwFlyFrm *GetCurrFlyFrm(const bool bCalcFrm = true) const; + SwFlyFrm* GetCurrFlyFrm(const bool bCalcFrm = true) const; + + // Get selected fly, but if none Get current fly in which the cursor is positioned + SwFlyFrm* GetSelectedOrCurrFlyFrm(const bool bCalcFrm = true) const; /// Find/delete fly containing the cursor. SwFrameFormat* WizardGetFly(); diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 59956bb7d197..1f4f42160bf8 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -255,7 +255,7 @@ void SwFEShell::SelectFlyFrm( SwFlyFrm& rFrm, bool bNew ) } // Get selected fly -SwFlyFrm *SwFEShell::GetSelectedFlyFrm() const +SwFlyFrm* SwFEShell::GetSelectedFlyFrm() const { if ( Imp()->HasDrawView() ) { @@ -271,12 +271,21 @@ SwFlyFrm *SwFEShell::GetSelectedFlyFrm() const } // Get current fly in which the cursor is positioned -SwFlyFrm *SwFEShell::GetCurrFlyFrm(const bool bCalcFrm) const +SwFlyFrm* SwFEShell::GetCurrFlyFrm(const bool bCalcFrm) const { SwContentFrm *pContent = GetCurrFrm(bCalcFrm); return pContent ? pContent->FindFlyFrm() : 0; } +// Get selected fly, but if none Get current fly in which the cursor is positioned +SwFlyFrm* SwFEShell::GetSelectedOrCurrFlyFrm(const bool bCalcFrm) const +{ + SwFlyFrm *pFly = GetSelectedFlyFrm(); + if (pFly) + return pFly; + return GetCurrFlyFrm(bCalcFrm); +} + // Returns non-null pointer, if the current Fly could be anchored to another one (so it is inside) const SwFrameFormat* SwFEShell::IsFlyInFly() { @@ -969,15 +978,11 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr, int n // wrong place or which are ambiguous (multiple selections) will be removed. bool SwFEShell::GetFlyFrmAttr( SfxItemSet &rSet ) const { - SwFlyFrm *pFly = GetSelectedFlyFrm(); + SwFlyFrm *pFly = GetSelectedOrCurrFlyFrm(); if (!pFly) { - pFly = GetCurrFlyFrm(); - if (!pFly) - { - OSL_ENSURE( false, "GetFlyFrmAttr, no Fly selected." ); - return false; - } + OSL_ENSURE( false, "GetFlyFrmAttr, no Fly selected." ); + return false; } SET_CURR_SHELL( const_cast<SwViewShell*>(static_cast<SwViewShell const *>(this)) ); @@ -1021,12 +1026,8 @@ bool SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet ) if( rSet.Count() ) { - SwFlyFrm *pFly = GetSelectedFlyFrm(); - if( !pFly ) - { - pFly = GetCurrFlyFrm(); - OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." ); - } + SwFlyFrm *pFly = GetSelectedOrCurrFlyFrm(); + OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." ); if( pFly ) { StartAllAction(); @@ -1100,13 +1101,8 @@ bool SwFEShell::ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet ) { SET_CURR_SHELL( this ); - SwFlyFrm *pFly = GetSelectedFlyFrm(); - if( !pFly ) - { - pFly = GetCurrFlyFrm(); - OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." ); - } - + SwFlyFrm *pFly = GetSelectedOrCurrFlyFrm(); + OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." ); if( pFly ) { StartAllAction(); @@ -1193,9 +1189,7 @@ void SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Poi const SwFrameFormat* SwFEShell::GetFlyFrameFormat() const { - const SwFlyFrm* pFly = GetSelectedFlyFrm(); - if (!pFly) - pFly = GetCurrFlyFrm(); + const SwFlyFrm* pFly = GetSelectedOrCurrFlyFrm(); if (pFly) return pFly->GetFormat(); return 0; @@ -1203,9 +1197,7 @@ const SwFrameFormat* SwFEShell::GetFlyFrameFormat() const SwFrameFormat* SwFEShell::GetFlyFrameFormat() { - SwFlyFrm* pFly = GetSelectedFlyFrm(); - if (!pFly) - pFly = GetCurrFlyFrm(); + SwFlyFrm* pFly = GetSelectedOrCurrFlyFrm(); if (pFly) return pFly->GetFormat(); return 0; |