Kaydet (Commit) a5aab0cc authored tarafından Caolán McNamara's avatar Caolán McNamara

GetSelectedFlyFrm+GetCurrFlyFrm -> GetSelectedOrCurrFlyFrm

Change-Id: I4348c4cf54dcd5504c52cf8ab550572257eef50b
üst 7473aacc
...@@ -395,10 +395,13 @@ public: ...@@ -395,10 +395,13 @@ public:
void SetFrameFormat( SwFrameFormat *pFormat, bool bKeepOrient = false, Point* pDocPos = 0 ); ///< If frame then set frame style. void SetFrameFormat( SwFrameFormat *pFormat, bool bKeepOrient = false, Point* pDocPos = 0 ); ///< If frame then set frame style.
// Get selected fly // Get selected fly
SwFlyFrm *GetSelectedFlyFrm() const; SwFlyFrm* GetSelectedFlyFrm() const;
// Get current fly in which the cursor is positioned // 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. /// Find/delete fly containing the cursor.
SwFrameFormat* WizardGetFly(); SwFrameFormat* WizardGetFly();
......
...@@ -255,7 +255,7 @@ void SwFEShell::SelectFlyFrm( SwFlyFrm& rFrm, bool bNew ) ...@@ -255,7 +255,7 @@ void SwFEShell::SelectFlyFrm( SwFlyFrm& rFrm, bool bNew )
} }
// Get selected fly // Get selected fly
SwFlyFrm *SwFEShell::GetSelectedFlyFrm() const SwFlyFrm* SwFEShell::GetSelectedFlyFrm() const
{ {
if ( Imp()->HasDrawView() ) if ( Imp()->HasDrawView() )
{ {
...@@ -271,12 +271,21 @@ SwFlyFrm *SwFEShell::GetSelectedFlyFrm() const ...@@ -271,12 +271,21 @@ SwFlyFrm *SwFEShell::GetSelectedFlyFrm() const
} }
// Get current fly in which the cursor is positioned // 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); SwContentFrm *pContent = GetCurrFrm(bCalcFrm);
return pContent ? pContent->FindFlyFrm() : 0; 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) // Returns non-null pointer, if the current Fly could be anchored to another one (so it is inside)
const SwFrameFormat* SwFEShell::IsFlyInFly() const SwFrameFormat* SwFEShell::IsFlyInFly()
{ {
...@@ -969,15 +978,11 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr, int n ...@@ -969,15 +978,11 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr, int n
// wrong place or which are ambiguous (multiple selections) will be removed. // wrong place or which are ambiguous (multiple selections) will be removed.
bool SwFEShell::GetFlyFrmAttr( SfxItemSet &rSet ) const bool SwFEShell::GetFlyFrmAttr( SfxItemSet &rSet ) const
{ {
SwFlyFrm *pFly = GetSelectedFlyFrm(); SwFlyFrm *pFly = GetSelectedOrCurrFlyFrm();
if (!pFly) if (!pFly)
{ {
pFly = GetCurrFlyFrm(); OSL_ENSURE( false, "GetFlyFrmAttr, no Fly selected." );
if (!pFly) return false;
{
OSL_ENSURE( false, "GetFlyFrmAttr, no Fly selected." );
return false;
}
} }
SET_CURR_SHELL( const_cast<SwViewShell*>(static_cast<SwViewShell const *>(this)) ); SET_CURR_SHELL( const_cast<SwViewShell*>(static_cast<SwViewShell const *>(this)) );
...@@ -1021,12 +1026,8 @@ bool SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet ) ...@@ -1021,12 +1026,8 @@ bool SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet )
if( rSet.Count() ) if( rSet.Count() )
{ {
SwFlyFrm *pFly = GetSelectedFlyFrm(); SwFlyFrm *pFly = GetSelectedOrCurrFlyFrm();
if( !pFly ) OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." );
{
pFly = GetCurrFlyFrm();
OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." );
}
if( pFly ) if( pFly )
{ {
StartAllAction(); StartAllAction();
...@@ -1100,13 +1101,8 @@ bool SwFEShell::ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet ) ...@@ -1100,13 +1101,8 @@ bool SwFEShell::ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet )
{ {
SET_CURR_SHELL( this ); SET_CURR_SHELL( this );
SwFlyFrm *pFly = GetSelectedFlyFrm(); SwFlyFrm *pFly = GetSelectedOrCurrFlyFrm();
if( !pFly ) OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." );
{
pFly = GetCurrFlyFrm();
OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." );
}
if( pFly ) if( pFly )
{ {
StartAllAction(); StartAllAction();
...@@ -1193,9 +1189,7 @@ void SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Poi ...@@ -1193,9 +1189,7 @@ void SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Poi
const SwFrameFormat* SwFEShell::GetFlyFrameFormat() const const SwFrameFormat* SwFEShell::GetFlyFrameFormat() const
{ {
const SwFlyFrm* pFly = GetSelectedFlyFrm(); const SwFlyFrm* pFly = GetSelectedOrCurrFlyFrm();
if (!pFly)
pFly = GetCurrFlyFrm();
if (pFly) if (pFly)
return pFly->GetFormat(); return pFly->GetFormat();
return 0; return 0;
...@@ -1203,9 +1197,7 @@ const SwFrameFormat* SwFEShell::GetFlyFrameFormat() const ...@@ -1203,9 +1197,7 @@ const SwFrameFormat* SwFEShell::GetFlyFrameFormat() const
SwFrameFormat* SwFEShell::GetFlyFrameFormat() SwFrameFormat* SwFEShell::GetFlyFrameFormat()
{ {
SwFlyFrm* pFly = GetSelectedFlyFrm(); SwFlyFrm* pFly = GetSelectedOrCurrFlyFrm();
if (!pFly)
pFly = GetCurrFlyFrm();
if (pFly) if (pFly)
return pFly->GetFormat(); return pFly->GetFormat();
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment