#104503# put inserted control at a central position
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: drawbase.hxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: os $ $Date: 2002-06-24 14:53:54 $
|
||||
* last change: $Author: os $ $Date: 2002-10-25 13:09:46 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -91,6 +91,7 @@ protected:
|
||||
BOOL bCreateObj :1;
|
||||
BOOL bInsForm :1;
|
||||
|
||||
Point GetDefaultCenterPos();
|
||||
public:
|
||||
SwDrawBase(SwWrtShell *pSh, SwEditWin* pWin, SwView* pView);
|
||||
virtual ~SwDrawBase();
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: conform.cxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: os $ $Date: 2002-04-29 12:28:21 $
|
||||
* last change: $Author: os $ $Date: 2002-10-25 13:09:48 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -79,7 +79,6 @@
|
||||
#include <svx/fmshell.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
#include "view.hxx"
|
||||
#include "edtwin.hxx"
|
||||
#include "wrtsh.hxx"
|
||||
@@ -172,14 +171,13 @@ void ConstFormControl::Activate(const USHORT nSlotId)
|
||||
---------------------------------------------------------------------------*/
|
||||
void ConstFormControl::CreateDefaultObject()
|
||||
{
|
||||
Size aWinSize = pWin->GetSizePixel();
|
||||
Point aStartPos(aWinSize.Width()/2, aWinSize.Height() / 2);
|
||||
aStartPos = pWin->PixelToLogic(aStartPos);
|
||||
Point aStartPos(GetDefaultCenterPos());
|
||||
Point aEndPos(aStartPos);
|
||||
aStartPos.X() -= 2 * MM50;
|
||||
aStartPos.Y() -= MM50;
|
||||
aEndPos.X() += 2 * MM50;
|
||||
aEndPos.Y() += MM50;
|
||||
|
||||
if(!pSh->HasDrawView())
|
||||
pSh->MakeDrawView();
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: drawbase.cxx,v $
|
||||
*
|
||||
* $Revision: 1.8 $
|
||||
* $Revision: 1.9 $
|
||||
*
|
||||
* last change: $Author: os $ $Date: 2002-10-17 13:37:22 $
|
||||
* last change: $Author: os $ $Date: 2002-10-25 13:09:47 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -753,9 +753,7 @@ void SwDrawBase::EnterSelectMode(const MouseEvent& rMEvt)
|
||||
---------------------------------------------------------------------------*/
|
||||
void SwDrawBase::CreateDefaultObject()
|
||||
{
|
||||
Size aWinSize = pWin->GetSizePixel();
|
||||
Point aStartPos(aWinSize.Width()/2, aWinSize.Height() / 2);
|
||||
aStartPos = pWin->PixelToLogic(aStartPos);
|
||||
Point aStartPos = GetDefaultCenterPos();
|
||||
Point aEndPos(aStartPos);
|
||||
aStartPos.X() -= 8 * MM50;
|
||||
aStartPos.Y() -= 4 * MM50;
|
||||
@@ -764,5 +762,18 @@ void SwDrawBase::CreateDefaultObject()
|
||||
Rectangle aRect(aStartPos, aEndPos);
|
||||
pSh->CreateDefaultShape(pWin->GetDrawMode(), aRect, nSlotId);
|
||||
}
|
||||
|
||||
/* -----------------25.10.2002 14:14-----------------
|
||||
*
|
||||
* --------------------------------------------------*/
|
||||
Point SwDrawBase::GetDefaultCenterPos()
|
||||
{
|
||||
Size aDocSz(pSh->GetDocSize());
|
||||
const SwRect& rVisArea = pSh->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();
|
||||
return aStartPos;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user