2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 03:44:11 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 03:44:11 +00:00
|
|
|
* $RCSfile: fulinend.cxx,v $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2006-11-14 13:29:37 +00:00
|
|
|
* $Revision: 1.11 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2006-11-14 13:29:37 +00:00
|
|
|
* last change: $Author: ihi $ $Date: 2006-11-14 14:29:37 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 03:44:11 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 03:44:11 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 03:44:11 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 03:44:11 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 03:44:11 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 17:51:29 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sd.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-01-20 10:04:46 +00:00
|
|
|
#include "fulinend.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _XTABLE_HXX
|
|
|
|
#include <svx/xtable.hxx>
|
|
|
|
#endif
|
2004-02-03 19:16:18 +00:00
|
|
|
//CHINA001 #ifndef _SVX_DLG_NAME_HXX //autogen
|
|
|
|
//CHINA001 #include <svx/dlgname.hxx>
|
|
|
|
//CHINA001 #endif
|
|
|
|
#include <svx/svxdlg.hxx> //CHINA001
|
|
|
|
#include <svx/dialogs.hrc> //CHINA001
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _SVDOBJ_HXX //autogen
|
|
|
|
#include <svx/svdobj.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDOPATH_HXX //autogen
|
|
|
|
#include <svx/svdopath.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_MSGBOX_HXX //autogen
|
|
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "strings.hrc"
|
2004-01-20 10:04:46 +00:00
|
|
|
#ifndef SD_VIEW_SHELL_HXX
|
|
|
|
#include "ViewShell.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#endif
|
2002-10-17 15:31:49 +00:00
|
|
|
#include "helpids.h"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "sdresid.hxx"
|
|
|
|
#include "drawdoc.hxx"
|
2004-01-20 10:04:46 +00:00
|
|
|
#ifndef SD_VIEW_HXX
|
|
|
|
#include "View.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_WINDOW_SHELL_HXX
|
|
|
|
#include "Window.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace sd {
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#define BITMAP_WIDTH 32
|
|
|
|
#define BITMAP_HEIGHT 12
|
|
|
|
|
|
|
|
TYPEINIT1( FuLineEnd, FuPoor );
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Konstruktor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 10:04:46 +00:00
|
|
|
FuLineEnd::FuLineEnd(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
|
2000-09-18 16:07:07 +00:00
|
|
|
SdDrawDocument* pDoc, SfxRequest& rReq)
|
|
|
|
: FuPoor(pViewSh, pWin, pView, pDoc, rReq)
|
2005-12-14 15:59:49 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FunctionReference FuLineEnd::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
|
|
|
|
{
|
|
|
|
FunctionReference xFunc( new FuLineEnd( pViewSh, pWin, pView, pDoc, rReq ) );
|
|
|
|
xFunc->DoExecute(rReq);
|
|
|
|
return xFunc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FuLineEnd::DoExecute( SfxRequest& rReq )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-07-12 14:03:37 +00:00
|
|
|
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( rMarkList.GetMarkCount() == 1 )
|
|
|
|
{
|
2006-07-25 10:34:59 +00:00
|
|
|
const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
|
2000-09-18 16:07:07 +00:00
|
|
|
const SdrObject* pNewObj;
|
|
|
|
SdrObject* pConvPolyObj = NULL;
|
|
|
|
|
|
|
|
if( pObj->ISA( SdrPathObj ) )
|
|
|
|
{
|
|
|
|
pNewObj = pObj;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SdrObjTransformInfoRec aInfoRec;
|
|
|
|
pObj->TakeObjInfo( aInfoRec );
|
|
|
|
|
|
|
|
if( aInfoRec.bCanConvToPath &&
|
|
|
|
pObj->GetObjInventor() == SdrInventor &&
|
|
|
|
pObj->GetObjIdentifier() != OBJ_GRUP )
|
|
|
|
// bCanConvToPath ist bei Gruppenobjekten TRUE,
|
|
|
|
// stuerzt aber bei ConvertToPathObj() ab !
|
|
|
|
{
|
|
|
|
pNewObj = pConvPolyObj = pObj->ConvertToPolyObj( TRUE, FALSE );
|
|
|
|
|
|
|
|
if( !pNewObj || !pNewObj->ISA( SdrPathObj ) )
|
|
|
|
return; // Abbruch, zusaetzliche Sicherheit, die bei
|
|
|
|
// Gruppenobjekten aber nichts bringt.
|
|
|
|
}
|
|
|
|
else return; // Abbruch
|
|
|
|
}
|
|
|
|
|
2006-11-14 13:29:37 +00:00
|
|
|
const ::basegfx::B2DPolyPolygon aPolyPolygon = ( (SdrPathObj*) pNewObj )->GetPathPoly();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Loeschen des angelegten PolyObjektes
|
|
|
|
if( pConvPolyObj )
|
|
|
|
delete pConvPolyObj;
|
|
|
|
|
|
|
|
XLineEndList* pLineEndList = pDoc->GetLineEndList();
|
|
|
|
XLineEndEntry* pEntry;
|
|
|
|
|
|
|
|
String aNewName( SdResId( STR_LINEEND ) );
|
|
|
|
String aDesc( SdResId( STR_DESC_LINEEND ) );
|
|
|
|
String aName;
|
|
|
|
|
|
|
|
long nCount = pLineEndList->Count();
|
|
|
|
long j = 1;
|
|
|
|
BOOL bDifferent = FALSE;
|
|
|
|
|
|
|
|
while( !bDifferent )
|
|
|
|
{
|
|
|
|
aName = aNewName;
|
|
|
|
aName.Append( sal_Unicode(' ') );
|
|
|
|
aName.Append( UniString::CreateFromInt32( j++ ) );
|
|
|
|
bDifferent = TRUE;
|
|
|
|
for( long i = 0; i < nCount && bDifferent; i++ )
|
|
|
|
{
|
2006-06-19 11:32:44 +00:00
|
|
|
if( aName == pLineEndList->GetLineEnd( i )->GetName() )
|
2000-09-18 16:07:07 +00:00
|
|
|
bDifferent = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-03 19:16:18 +00:00
|
|
|
//CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( NULL, aName, aDesc );
|
|
|
|
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
|
|
|
DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
|
|
|
|
AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( NULL, aName, aDesc, ResId(RID_SVXDLG_NAME) );
|
|
|
|
DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
|
2002-10-17 15:31:49 +00:00
|
|
|
pDlg->SetEditHelpId( HID_SD_NAMEDIALOG_LINEEND );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( pDlg->Execute() == RET_OK )
|
|
|
|
{
|
|
|
|
pDlg->GetName( aName );
|
|
|
|
bDifferent = TRUE;
|
|
|
|
|
|
|
|
for( long i = 0; i < nCount && bDifferent; i++ )
|
|
|
|
{
|
2006-06-19 11:32:44 +00:00
|
|
|
if( aName == pLineEndList->GetLineEnd( i )->GetName() )
|
2000-09-18 16:07:07 +00:00
|
|
|
bDifferent = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bDifferent )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
XOutdevItemPool* pItemPool = (XOutdevItemPool*) &pViewSh->GetPool();
|
|
|
|
XLineAttrSetItem aXLSet( pItemPool );
|
|
|
|
XFillAttrSetItem aXFSet( pItemPool );
|
|
|
|
VirtualDevice aTmpVD ( *pWindow );
|
|
|
|
XOutputDevice aTmpXOut( &aTmpVD, pItemPool );
|
|
|
|
|
|
|
|
aTmpVD.ChangeMapMode( MAP_100TH_MM );
|
|
|
|
aTmpVD.SetOutputSize( aTmpVD.PixelToLogic( Size( BITMAP_WIDTH * 2, BITMAP_HEIGHT ) ) );
|
|
|
|
aXLSet.GetItemSet().Put( XLineStartWidthItem( aTmpVD.GetOutputSize().Height() ) );
|
|
|
|
aXLSet.GetItemSet().Put( XLineEndWidthItem( aTmpVD.GetOutputSize().Height() ) );
|
|
|
|
aXFSet.GetItemSet().Put( XFillColorItem( String(), Color( COL_WHITE ) ) );
|
|
|
|
aXFSet.GetItemSet().Put( XFillStyleItem( XFILL_SOLID ) );
|
|
|
|
aXLSet.GetItemSet().Put( XLineStyleItem( XLINE_NONE ) );
|
|
|
|
|
|
|
|
aTmpXOut.SetLineAttr( ( const XLineAttrSetItem& ) pItemPool->Put( aXLSet ) );
|
|
|
|
aTmpXOut.SetFillAttr( ( const XFillAttrSetItem& ) pItemPool->Put( aXFSet ) );
|
|
|
|
aTmpXOut.DrawRect( Rectangle( Point(), aTmpVD.GetOutputSize() ) );
|
|
|
|
|
|
|
|
aXLSet.GetItemSet().Put( XLineStyleItem( XLINE_SOLID ) );
|
|
|
|
aXLSet.GetItemSet().Put( XLineStartItem( String(), aXPoly ) );
|
|
|
|
aXLSet.GetItemSet().Put( XLineEndItem( String(), aXPoly ) );
|
|
|
|
|
|
|
|
aTmpXOut.SetLineAttr( ( const XLineAttrSetItem& ) pItemPool->Put( aXLSet ) );
|
|
|
|
aTmpXOut.DrawLine( Point( 0, aTmpVD.GetOutputSize().Height() / 2 ),
|
|
|
|
Point( aTmpVD.GetOutputSize().Width(), aTmpVD.GetOutputSize().Height() / 2 ) );
|
|
|
|
Bitmap* pBitmap = new Bitmap( aTmpVD.GetBitmap( Point(), aTmpVD.GetOutputSize() ) );
|
|
|
|
*/
|
2006-11-14 13:29:37 +00:00
|
|
|
pEntry = new XLineEndEntry( aPolyPolygon, aName );
|
2000-09-18 16:07:07 +00:00
|
|
|
pLineEndList->Insert( pEntry, LIST_APPEND);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
String aStr(SdResId( STR_WARN_NAME_DUPLICATE ));
|
2005-12-14 15:59:49 +00:00
|
|
|
WarningBox aWarningBox( pWindow, WinBits( WB_OK ),
|
2000-09-18 16:07:07 +00:00
|
|
|
aStr );
|
|
|
|
aWarningBox.Execute();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete pDlg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-12-14 15:59:49 +00:00
|
|
|
void FuLineEnd::Activate()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void FuLineEnd::Deactivate()
|
|
|
|
{
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-01-20 10:04:46 +00:00
|
|
|
} // end of namespace sd
|