2000-09-18 11:07:07 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: sdmod.cxx,v $
|
|
|
|
*
|
2001-08-23 04:54:33 -05:00
|
|
|
* $Revision: 1.13 $
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2001-08-23 04:54:33 -05:00
|
|
|
* last change: $Author: ka $ $Date: 2001-08-23 10:43:51 $
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* either of the following licenses
|
|
|
|
*
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
*
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2000 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
|
|
|
* =================================================
|
|
|
|
* The contents of this file are subject to the Sun Industry Standards
|
|
|
|
* Source License Version 1.1 (the "License"); You may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of the
|
|
|
|
* License at http://www.openoffice.org/license.html.
|
|
|
|
*
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
* obligations concerning the Software.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2000-11-10 09:53:19 -06:00
|
|
|
#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX
|
|
|
|
#include <svtools/pathoptions.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _UNOTOOLS_UCBSTREAMHELPER_HXX
|
|
|
|
#include <unotools/ucbstreamhelper.hxx>
|
|
|
|
#endif
|
2000-09-18 11:07:07 -05:00
|
|
|
#ifndef _URLOBJ_HXX
|
|
|
|
#include <tools/urlobj.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXAPP_HXX //autogen
|
|
|
|
#include <sfx2/app.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_STATUS_HXX //autogen
|
|
|
|
#include <vcl/status.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXINTITEM_HXX //autogen
|
|
|
|
#include <svtools/intitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXMSG_HXX //autogen
|
|
|
|
#include <sfx2/msg.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXOBJFACE_HXX //autogen
|
|
|
|
#include <sfx2/objface.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVX_PSZCTRL_HXX //autogen
|
|
|
|
#include <svx/pszctrl.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVX_ZOOMCTRL_HXX //autogen
|
|
|
|
#include <svx/zoomctrl.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVX_MODCTRL_HXX //autogen
|
|
|
|
#include <svx/modctrl.hxx>
|
|
|
|
#endif
|
2001-06-19 09:07:14 -05:00
|
|
|
#ifndef _ZFORLIST_HXX
|
|
|
|
#include <svtools/zforlist.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
|
|
|
|
#include <comphelper/processfactory.hxx>
|
|
|
|
#endif
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2001-08-20 05:04:49 -05:00
|
|
|
#ifndef _EHDL_HXX
|
|
|
|
#include <svtools/ehdl.hxx>
|
|
|
|
#endif
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
#define ITEMID_SEARCH SID_SEARCH_ITEM
|
|
|
|
#include <svx/svxids.hrc>
|
|
|
|
#include <offmgr/ofaids.hrc>
|
|
|
|
#include <svx/srchitem.hxx>
|
|
|
|
|
|
|
|
#pragma hdrstop
|
|
|
|
|
|
|
|
#define _SD_DLL // fuer SD_MOD()
|
2001-08-20 05:04:49 -05:00
|
|
|
#include "sderror.hxx"
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "sdmod.hxx"
|
|
|
|
#include "sddll.hxx"
|
|
|
|
#include "sdresid.hxx"
|
|
|
|
#include "optsitem.hxx"
|
|
|
|
#include "docshell.hxx"
|
|
|
|
#include "drawdoc.hxx"
|
|
|
|
#include "app.hrc"
|
|
|
|
#include "glob.hrc"
|
|
|
|
#include "strings.hrc"
|
|
|
|
#include "res_bmp.hrc"
|
|
|
|
#include "cfgids.hxx"
|
|
|
|
|
|
|
|
TYPEINIT1( SdModuleDummy, SfxModule );
|
|
|
|
TYPEINIT1( SdModule, SdModuleDummy );
|
|
|
|
|
|
|
|
#define SdModule
|
|
|
|
#include "sdslots.hxx"
|
|
|
|
|
|
|
|
|
|
|
|
SFX_IMPL_INTERFACE(SdModule, SfxModule, SdResId(STR_APPLICATIONOBJECTBAR))
|
|
|
|
{
|
|
|
|
SFX_STATUSBAR_REGISTRATION(RID_DRAW_STATUSBAR);
|
|
|
|
}
|
|
|
|
|
|
|
|
SFX_IMPL_MODULE_DLL(Sd)
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Ctor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SdModule::SdModule(SvFactory* pDrawObjFact, SvFactory* pGraphicObjFact)
|
|
|
|
: SdModuleDummy(SFX_APP()->CreateResManager("sd"), FALSE,
|
|
|
|
pDrawObjFact, pGraphicObjFact),
|
|
|
|
bWaterCan(FALSE),
|
2001-01-19 12:15:28 -06:00
|
|
|
pTransferClip(NULL),
|
|
|
|
pTransferDrag(NULL),
|
2001-08-23 04:54:33 -05:00
|
|
|
pTransferSelection(NULL),
|
2000-09-18 11:07:07 -05:00
|
|
|
pImpressOptions(NULL),
|
|
|
|
pDrawOptions(NULL),
|
2001-04-04 10:41:39 -05:00
|
|
|
pSearchItem(NULL),
|
2001-06-19 09:07:14 -05:00
|
|
|
pNumberFormatter( NULL ),
|
2001-04-04 10:41:39 -05:00
|
|
|
eCurrentNavigatorDragType( NAVIGATOR_DRAGTYPE_NONE ),
|
|
|
|
pCurrentNavigatorDragDocShell( NULL )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
SetName( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarDraw" ) ) ); // Nicht uebersetzen!
|
|
|
|
pSearchItem = new SvxSearchItem(ITEMID_SEARCH);
|
|
|
|
pSearchItem->SetAppFlag(SVX_SEARCHAPP_DRAW);
|
2000-09-28 12:05:36 -05:00
|
|
|
StartListening( *SFX_APP() );
|
2001-08-20 05:04:49 -05:00
|
|
|
|
|
|
|
mpErrorHdl = new SfxErrorHandler( RID_SD_ERRHDL,
|
|
|
|
ERRCODE_AREA_SD,
|
|
|
|
ERRCODE_AREA_SD_END,
|
|
|
|
GetResMgr() );
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Dtor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SdModule::~SdModule()
|
|
|
|
{
|
|
|
|
delete pSearchItem;
|
2001-06-19 09:07:14 -05:00
|
|
|
if( pNumberFormatter )
|
|
|
|
delete pNumberFormatter;
|
2001-08-20 05:04:49 -05:00
|
|
|
delete mpErrorHdl;
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Statusbar erzeugen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
#define AUTOSIZE_WIDTH 180
|
|
|
|
#define TEXT_WIDTH(s) rStatusBar.GetTextWidth((s))
|
|
|
|
|
|
|
|
void SdModule::FillStatusBar(StatusBar& rStatusBar)
|
|
|
|
{
|
|
|
|
// Hinweis
|
|
|
|
rStatusBar.InsertItem( SID_CONTEXT, TEXT_WIDTH( String().Fill( 30, 'x' ) ), // vorher 52
|
|
|
|
SIB_IN | SIB_LEFT | SIB_AUTOSIZE );
|
|
|
|
|
|
|
|
// Groesse und Position
|
|
|
|
rStatusBar.InsertItem( SID_ATTR_SIZE, SvxPosSizeStatusBarControl::GetDefItemWidth(rStatusBar), // vorher 42
|
|
|
|
SIB_IN | SIB_USERDRAW );
|
|
|
|
// SIB_AUTOSIZE | SIB_LEFT | SIB_OWNERDRAW );
|
|
|
|
|
|
|
|
// Massstab
|
|
|
|
rStatusBar.InsertItem( SID_ATTR_ZOOM, SvxZoomStatusBarControl::GetDefItemWidth(rStatusBar), SIB_IN | SIB_CENTER );
|
|
|
|
/*
|
|
|
|
// Einfuege- / Uberschreibmodus
|
|
|
|
rStatusBar.InsertItem( SID_ATTR_INSERT, TEXT_WIDTH( "EINFG" ),
|
|
|
|
SIB_IN | SIB_CENTER );
|
|
|
|
|
|
|
|
// Selektionsmodus
|
|
|
|
rStatusBar.InsertItem( SID_STATUS_SELMODE, TEXT_WIDTH( "ERG" ),
|
|
|
|
SIB_IN | SIB_CENTER );
|
|
|
|
*/
|
|
|
|
// Dokument geaendert
|
|
|
|
rStatusBar.InsertItem( SID_DOC_MODIFIED, SvxModifyControl::GetDefItemWidth(rStatusBar) );
|
|
|
|
|
|
|
|
|
|
|
|
// Seite
|
2000-12-13 04:25:54 -06:00
|
|
|
rStatusBar.InsertItem( SID_STATUS_PAGE, TEXT_WIDTH( String().Fill( 16, 'X' ) ),
|
2000-09-18 11:07:07 -05:00
|
|
|
SIB_IN | SIB_LEFT );
|
|
|
|
|
|
|
|
// Praesentationslayout
|
|
|
|
rStatusBar.InsertItem( SID_STATUS_LAYOUT, TEXT_WIDTH( String().Fill( 10, 'X' ) ),
|
|
|
|
SIB_IN | SIB_LEFT | SIB_AUTOSIZE );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Modul laden (nur Attrappe fuer das Linken der DLL)
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SfxModule* SdModuleDummy::Load()
|
|
|
|
{
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Modul laden
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SfxModule* SdModule::Load()
|
|
|
|
{
|
|
|
|
return (this);
|
|
|
|
}
|
|
|
|
|
2000-09-28 12:05:36 -05:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* get notifications
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2000-09-28 12:05:36 -05:00
|
|
|
void SdModule::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
|
|
|
|
{
|
|
|
|
if( rHint.ISA( SfxSimpleHint ) &&
|
|
|
|
( (SfxSimpleHint&) rHint ).GetId() == SFX_HINT_DEINITIALIZING )
|
|
|
|
{
|
|
|
|
delete pImpressOptions, pImpressOptions = NULL;
|
|
|
|
delete pDrawOptions, pDrawOptions = NULL;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Modul freigeben
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void SdModule::Free()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Optionen zurueckgeben
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SdOptions* SdModule::GetSdOptions(DocumentType eDocType)
|
|
|
|
{
|
|
|
|
SdOptions* pOptions = NULL;
|
|
|
|
|
|
|
|
if (eDocType == DOCUMENT_TYPE_DRAW)
|
|
|
|
{
|
|
|
|
if (!pDrawOptions)
|
2000-09-28 12:05:36 -05:00
|
|
|
pDrawOptions = new SdOptions( SDCFG_DRAW );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
pOptions = pDrawOptions;
|
|
|
|
}
|
|
|
|
else if (eDocType == DOCUMENT_TYPE_IMPRESS)
|
|
|
|
{
|
|
|
|
if (!pImpressOptions)
|
2000-09-28 12:05:36 -05:00
|
|
|
pImpressOptions = new SdOptions( SDCFG_IMPRESS );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
pOptions = pImpressOptions;
|
|
|
|
}
|
|
|
|
if( pOptions )
|
|
|
|
{
|
|
|
|
UINT16 nMetric = pOptions->GetMetric();
|
|
|
|
|
|
|
|
SdDrawDocShell* pDocSh = PTR_CAST( SdDrawDocShell, SfxObjectShell::Current() );
|
|
|
|
SdDrawDocument* pDoc = NULL;
|
|
|
|
if (pDocSh)
|
|
|
|
pDoc = pDocSh->GetDoc();
|
|
|
|
|
|
|
|
if( nMetric != 0xffff && pDoc && eDocType == pDoc->GetDocumentType() )
|
|
|
|
PutItem( SfxUInt16Item( SID_ATTR_METRIC, nMetric ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
return(pOptions);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Optionen-Stream fuer interne Options oeffnen und zurueckgeben;
|
|
|
|
|* falls der Stream zum Lesen geoeffnet wird, aber noch nicht
|
|
|
|
|* angelegt wurde, wird ein 'leeres' RefObject zurueckgegeben
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SvStorageStreamRef SdModule::GetOptionStream( const String& rOptionName,
|
|
|
|
SdOptionStreamMode eMode )
|
|
|
|
{
|
|
|
|
SdDrawDocShell* pDocSh = PTR_CAST( SdDrawDocShell, SfxObjectShell::Current() );
|
|
|
|
SvStorageStreamRef xStm;
|
|
|
|
|
|
|
|
if( pDocSh )
|
|
|
|
{
|
|
|
|
DocumentType eType = pDocSh->GetDoc()->GetDocumentType();
|
|
|
|
String aStmName;
|
|
|
|
|
|
|
|
if( !xOptionStorage.Is() )
|
|
|
|
{
|
2000-11-10 09:53:19 -06:00
|
|
|
INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "drawing.cfg" ) ) );
|
2000-11-10 09:53:19 -06:00
|
|
|
|
2001-07-30 09:31:39 -05:00
|
|
|
SvStream* pStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READWRITE );
|
2000-11-10 09:53:19 -06:00
|
|
|
|
|
|
|
if( pStm )
|
|
|
|
xOptionStorage = new SvStorage( pStm, TRUE );
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if( DOCUMENT_TYPE_DRAW == eType )
|
|
|
|
aStmName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Draw_" ) );
|
|
|
|
else
|
|
|
|
aStmName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Impress_" ) );
|
|
|
|
|
|
|
|
aStmName += rOptionName;
|
|
|
|
|
|
|
|
if( SD_OPTION_STORE == eMode || xOptionStorage->IsContained( aStmName ) )
|
|
|
|
xStm = xOptionStorage->OpenStream( aStmName );
|
|
|
|
}
|
|
|
|
|
|
|
|
return xStm;
|
|
|
|
}
|
|
|
|
|
2001-06-19 09:07:14 -05:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SvNumberFormatter* SdModule::GetNumberFormatter()
|
|
|
|
{
|
|
|
|
if( !pNumberFormatter )
|
|
|
|
pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessServiceFactory(), LANGUAGE_SYSTEM );
|
|
|
|
|
|
|
|
return pNumberFormatter;
|
|
|
|
}
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
|