summaryrefslogtreecommitdiff
path: root/sw/source/ui/uiview
diff options
context:
space:
mode:
authorOliver Specht <os@openoffice.org>2002-10-25 12:09:48 +0000
committerOliver Specht <os@openoffice.org>2002-10-25 12:09:48 +0000
commit39ed6bd497f2fed29c84023aa7d1739b303fd043 (patch)
tree2066db57a8c16f73c12f901d2290b04da362cb78 /sw/source/ui/uiview
parent0cace47f3eb472308a00866ee2404e6eee2d15bd (diff)
#104503# put inserted control at a central position
Diffstat (limited to 'sw/source/ui/uiview')
-rw-r--r--sw/source/ui/uiview/viewdraw.cxx28
1 files changed, 21 insertions, 7 deletions
diff --git a/sw/source/ui/uiview/viewdraw.cxx b/sw/source/ui/uiview/viewdraw.cxx
index 7c01d5cb58bf..d2be6fa6fd0d 100644
--- a/sw/source/ui/uiview/viewdraw.cxx
+++ b/sw/source/ui/uiview/viewdraw.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewdraw.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: os $ $Date: 2002-09-09 13:17:44 $
+ * last change: $Author: os $ $Date: 2002-10-25 13:09:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -125,6 +125,9 @@
#ifndef _SVDOTEXT_HXX //autogen
#include <svx/svdotext.hxx>
#endif
+#ifndef _SVDOGRP_HXX
+#include <svx/svdogrp.hxx>
+#endif
#ifndef _SVDETC_HXX
#include <svx/svdetc.hxx>
#endif
@@ -237,14 +240,25 @@ void SwView::ExecDraw(SfxRequest& rReq)
if ( pObj )
{
- // calc a default position
- Size aWinSize( GetEditWin().GetSizePixel() );
- Point aCenter( aWinSize.Width()/2, aWinSize.Height() / 2 );
- aCenter = GetEditWin().PixelToLogic( aCenter );
+ Size aDocSz(pWrtShell->GetDocSize());
+ const SwRect& rVisArea = pWrtShell->VisArea();
+ Point aStartPos = rVisArea.Center();
+ if(rVisArea.Width() > aDocSz.Width())
+ aStartPos.X() = aDocSz.Width() / 2 + rVisArea.Left();
+ if(rVisArea.Height() > aDocSz.Height())
+ aStartPos.Y() = aDocSz.Height() / 2 + rVisArea.Top();
+
+ //determine the size of the object
+ if(pObj->IsGroupObject())
+ {
+ const Rectangle& rBoundRect = ((SdrObjGroup*)pObj)->GetBoundRect();
+ aStartPos.X() -= rBoundRect.GetWidth()/2;
+ aStartPos.Y() -= rBoundRect.GetHeight()/2;
+ }
// TODO: unmark all other
pWrtShell->EnterStdMode();
- pWrtShell->SwFEShell::Insert( *pObj, 0, 0, &aCenter );
+ pWrtShell->SwFEShell::Insert( *pObj, 0, 0, &aStartPos );
}
}
}