summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-04-25 12:03:50 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-04-25 16:34:31 +0100
commit6643b783b4d8c298eae716a36a1776692498f00b (patch)
tree7db7be087ea37e9cd1eb6f2c5987d1152c322bf4 /sd/source
parent731f7fe778c19378dfcbc1a5e9165f666ebb90df (diff)
Related: rhbz#1091111 GetSdrPageView can return NULL
Change-Id: I560bf74235728fb39156c32b47dd40f181dada16
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/ui/view/drviewsa.cxx92
1 files changed, 48 insertions, 44 deletions
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 5cc9d321aac1..8e1e09dd35cb 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -656,55 +656,59 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
}
}
- Point aPos = GetActiveWindow()->PixelToLogic(maMousePos);
- mpDrawView->GetSdrPageView()->LogicToPagePos(aPos);
- Fraction aUIScale(GetDoc()->GetUIScale());
- aPos.X() = Fraction(aPos.X()) / aUIScale;
- aPos.Y() = Fraction(aPos.Y()) / aUIScale;
-
- // position- and size items
- if ( mpDrawView->IsAction() )
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+ if (pPageView)
{
- Rectangle aRect;
- mpDrawView->TakeActionRect( aRect );
-
- if ( aRect.IsEmpty() )
- rSet.Put( SfxPointItem(SID_ATTR_POSITION, aPos) );
- else
- {
- mpDrawView->GetSdrPageView()->LogicToPagePos(aRect);
- aPos = aRect.TopLeft();
- aPos.X() = Fraction(aPos.X()) / aUIScale;
- aPos.Y() = Fraction(aPos.Y()) / aUIScale;
- rSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos) );
- Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
- aSize.Height() = Fraction(aSize.Height()) / aUIScale;
- aSize.Width() = Fraction(aSize.Width()) / aUIScale;
- rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
- }
- }
- else
- {
- if ( mpDrawView->AreObjectsMarked() )
+ Point aPos = GetActiveWindow()->PixelToLogic(maMousePos);
+ pPageView->LogicToPagePos(aPos);
+ Fraction aUIScale(GetDoc()->GetUIScale());
+ aPos.X() = Fraction(aPos.X()) / aUIScale;
+ aPos.Y() = Fraction(aPos.Y()) / aUIScale;
+
+ // position- and size items
+ if ( mpDrawView->IsAction() )
{
- Rectangle aRect = mpDrawView->GetAllMarkedRect();
- mpDrawView->GetSdrPageView()->LogicToPagePos(aRect);
-
- // Show the position of the selected shape(s)
- Point aShapePosition (aRect.TopLeft());
- aShapePosition.X() = Fraction(aShapePosition.X()) / aUIScale;
- aShapePosition.Y() = Fraction(aShapePosition.Y()) / aUIScale;
- rSet.Put (SfxPointItem(SID_ATTR_POSITION, aShapePosition));
-
- Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
- aSize.Height() = Fraction(aSize.Height()) / aUIScale;
- aSize.Width() = Fraction(aSize.Width()) / aUIScale;
- rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
+ Rectangle aRect;
+ mpDrawView->TakeActionRect( aRect );
+
+ if ( aRect.IsEmpty() )
+ rSet.Put( SfxPointItem(SID_ATTR_POSITION, aPos) );
+ else
+ {
+ pPageView->LogicToPagePos(aRect);
+ aPos = aRect.TopLeft();
+ aPos.X() = Fraction(aPos.X()) / aUIScale;
+ aPos.Y() = Fraction(aPos.Y()) / aUIScale;
+ rSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos) );
+ Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
+ aSize.Height() = Fraction(aSize.Height()) / aUIScale;
+ aSize.Width() = Fraction(aSize.Width()) / aUIScale;
+ rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
+ }
}
else
{
- rSet.Put( SfxPointItem(SID_ATTR_POSITION, aPos) );
- rSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) );
+ if ( mpDrawView->AreObjectsMarked() )
+ {
+ Rectangle aRect = mpDrawView->GetAllMarkedRect();
+ pPageView->LogicToPagePos(aRect);
+
+ // Show the position of the selected shape(s)
+ Point aShapePosition (aRect.TopLeft());
+ aShapePosition.X() = Fraction(aShapePosition.X()) / aUIScale;
+ aShapePosition.Y() = Fraction(aShapePosition.Y()) / aUIScale;
+ rSet.Put (SfxPointItem(SID_ATTR_POSITION, aShapePosition));
+
+ Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
+ aSize.Height() = Fraction(aSize.Height()) / aUIScale;
+ aSize.Width() = Fraction(aSize.Width()) / aUIScale;
+ rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
+ }
+ else
+ {
+ rSet.Put( SfxPointItem(SID_ATTR_POSITION, aPos) );
+ rSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) );
+ }
}
}