2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: docshel4.cxx,v $
|
|
|
|
*
|
2004-10-04 17:30:29 +00:00
|
|
|
* $Revision: 1.62 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2004-10-04 17:30:29 +00:00
|
|
|
* last change: $Author: kz $ $Date: 2004-10-04 18:30:29 $
|
2000-09-18 16:07:07 +00: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): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
#include "DrawDocShell.hxx"
|
|
|
|
|
2003-04-24 13:38:03 +00:00
|
|
|
#ifndef _COM_SUN_STAR_DOCUMENT_PRINTERINDEPENDENTLAYOUT_HPP_
|
|
|
|
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
|
|
|
|
#endif
|
|
|
|
|
2002-08-01 10:30:12 +00:00
|
|
|
#ifndef _URLOBJ_HXX
|
|
|
|
#include <tools/urlobj.hxx>
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _SFX_PROGRESS_HXX
|
|
|
|
#include <sfx2/progress.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_WAITOBJ_HXX
|
|
|
|
#include <vcl/waitobj.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVXIDS_HRC
|
|
|
|
#include <svx/svxids.hrc>
|
|
|
|
#endif
|
|
|
|
#define ITEMID_FONTLIST SID_ATTR_CHAR_FONTLIST
|
|
|
|
#ifndef _SVX_FLSTITEM_HXX
|
|
|
|
#include <svx/flstitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _AEITEM_HXX //autogen
|
|
|
|
#include <svtools/aeitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXFLAGITEM_HXX //autogen
|
|
|
|
#include <svtools/flagitem.hxx>
|
|
|
|
#endif
|
2004-10-04 17:30:29 +00:00
|
|
|
#include <sot/storage.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _SFXDOCFILE_HXX //autogen
|
|
|
|
#include <sfx2/docfile.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFX_DOCFILT_HACK_HXX //autogen
|
|
|
|
#include <sfx2/docfilt.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _DISPATCH_HXX //autogen
|
|
|
|
#include <sfx2/dispatch.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDOTEXT_HXX //autogen
|
|
|
|
#include <svx/svdotext.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXSTYLE_HXX //autogen
|
|
|
|
#include <svtools/style.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFX_PRINTER_HXX //autogen
|
|
|
|
#include <sfx2/printer.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _CTRLTOOL_HXX //autogen
|
|
|
|
#include <svtools/ctrltool.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXSTBMGR_HXX //autogen
|
|
|
|
#include <sfx2/stbmgr.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFX_ECODE_HXX //autogen
|
|
|
|
#include <svtools/sfxecode.hxx>
|
|
|
|
#endif
|
2004-10-04 17:30:29 +00:00
|
|
|
#include <sot/clsids.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _SOT_FORMATS_HXX //autogen
|
|
|
|
#include <sot/formats.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXREQUEST_HXX //autogen
|
|
|
|
#include <sfx2/request.hxx>
|
|
|
|
#endif
|
|
|
|
#ifdef TF_STARONE
|
|
|
|
#include "unomodel.hxx"
|
|
|
|
#endif
|
2004-02-04 08:58:04 +00:00
|
|
|
|
|
|
|
#include <svtools/fltrcfg.hxx>
|
2004-10-04 17:30:29 +00:00
|
|
|
#include <sfx2/frame.hxx>
|
|
|
|
#include <sfx2/viewfrm.hxx>
|
2004-02-04 08:58:04 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _SVXMSBAS_HXX
|
|
|
|
#include <svx/svxmsbas.hxx>
|
|
|
|
#endif
|
2000-10-31 14:24:57 +00:00
|
|
|
#ifndef INCLUDED_SVTOOLS_SAVEOPT_HXX
|
|
|
|
#include <svtools/saveopt.hxx>
|
|
|
|
#endif
|
2003-04-08 14:20:29 +00:00
|
|
|
#ifndef _SD_UNODRAWVIEW_HXX
|
|
|
|
#include "SdUnoDrawView.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_DRAWING_XDRAWPAGE_HPP_
|
|
|
|
#include <com/sun/star/drawing/XDrawPage.hpp>
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#pragma hdrstop
|
|
|
|
|
|
|
|
#include "app.hrc"
|
|
|
|
#include "glob.hrc"
|
|
|
|
#include "strings.hrc"
|
|
|
|
#include "strmname.h"
|
2004-02-02 09:54:17 +00:00
|
|
|
#ifndef SD_FRAMW_VIEW_HXX
|
|
|
|
#include "FrameView.hxx"
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "optsitem.hxx"
|
2004-02-02 09:54:17 +00:00
|
|
|
#ifndef SD_OUTLINER_HXX
|
|
|
|
#include "Outliner.hxx"
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "sdattr.hxx"
|
|
|
|
#include "drawdoc.hxx"
|
2004-02-02 09:54:17 +00:00
|
|
|
#ifndef SD_VIEW_SHELL_HXX
|
|
|
|
#include "ViewShell.hxx"
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "app.hxx"
|
2004-02-02 09:54:17 +00:00
|
|
|
#ifndef SD_VIEW_HXX
|
|
|
|
#include "View.hxx"
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "sdpage.hxx"
|
|
|
|
#include "sdresid.hxx"
|
2004-02-02 09:54:17 +00:00
|
|
|
#ifndef SD_DRAW_VIEW_SHELL_HXX
|
|
|
|
#include "DrawViewShell.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_WINDOW_HXX
|
|
|
|
#include "Window.hxx"
|
|
|
|
#endif
|
2004-05-10 14:46:04 +00:00
|
|
|
//CHINA001 #include "new_foil.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "sdmod.hxx"
|
2004-02-02 09:54:17 +00:00
|
|
|
#ifndef SD_OUTLINE_VIEW_SHELL_HXX
|
|
|
|
#include "OutlineViewShell.hxx"
|
|
|
|
#endif
|
2001-02-13 11:17:06 +00:00
|
|
|
#include "sdxmlwrp.hxx"
|
|
|
|
#include "sdpptwrp.hxx"
|
|
|
|
#include "sdcgmfilter.hxx"
|
|
|
|
#include "sdgrffilter.hxx"
|
|
|
|
#include "sdbinfilter.hxx"
|
2002-04-18 14:48:12 +00:00
|
|
|
#include "sdhtmlfilter.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
namespace sd {
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SfxPrinter ggf. erzeugen und zurueckgeben
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
SfxPrinter* DrawDocShell::GetPrinter(BOOL bCreate)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if (bCreate && !pPrinter)
|
|
|
|
{
|
|
|
|
// ItemSet mit speziellem Poolbereich anlegen
|
|
|
|
SfxItemSet* pSet = new SfxItemSet( GetPool(),
|
|
|
|
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
|
|
|
|
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
|
|
|
|
ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT,
|
|
|
|
0 );
|
|
|
|
// PrintOptionsSet setzen
|
|
|
|
SdOptionsPrintItem aPrintItem( ATTR_OPTIONS_PRINT,
|
|
|
|
SD_MOD()->GetSdOptions(pDoc->GetDocumentType()));
|
|
|
|
SfxFlagItem aFlagItem( SID_PRINTER_CHANGESTODOC );
|
|
|
|
USHORT nFlags = 0;
|
|
|
|
|
|
|
|
nFlags = (aPrintItem.IsWarningSize() ? SFX_PRINTER_CHG_SIZE : 0) |
|
|
|
|
(aPrintItem.IsWarningOrientation() ? SFX_PRINTER_CHG_ORIENTATION : 0);
|
|
|
|
aFlagItem.SetValue( nFlags );
|
|
|
|
|
|
|
|
pSet->Put( aPrintItem );
|
|
|
|
pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aPrintItem.IsWarningPrinter() ) );
|
|
|
|
pSet->Put( aFlagItem );
|
|
|
|
|
|
|
|
pPrinter = new SfxPrinter(pSet);
|
|
|
|
bOwnPrinter = TRUE;
|
|
|
|
|
|
|
|
// Ausgabequalitaet setzen
|
|
|
|
UINT16 nQuality = aPrintItem.GetOutputQuality();
|
|
|
|
|
|
|
|
ULONG nMode = DRAWMODE_DEFAULT;
|
2002-03-06 15:27:58 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if( nQuality == 1 )
|
2002-03-06 15:27:58 +00:00
|
|
|
nMode = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT;
|
2000-09-18 16:07:07 +00:00
|
|
|
else if( nQuality == 2 )
|
2002-03-06 15:27:58 +00:00
|
|
|
nMode = DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP | DRAWMODE_WHITEGRADIENT;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pPrinter->SetDrawMode( nMode );
|
|
|
|
|
|
|
|
MapMode aMM (pPrinter->GetMapMode());
|
|
|
|
aMM.SetMapUnit(MAP_100TH_MM);
|
|
|
|
pPrinter->SetMapMode(aMM);
|
2002-07-26 07:32:44 +00:00
|
|
|
UpdateRefDevice();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
return pPrinter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* neuen SfxPrinter setzen (Eigentuemeruebergang)
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
void DrawDocShell::SetPrinter(SfxPrinter *pNewPrinter)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( pViewShell )
|
|
|
|
{
|
2004-02-02 09:54:17 +00:00
|
|
|
::sd::View* pView = pViewShell->GetView();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pView->IsTextEdit() )
|
|
|
|
pView->EndTextEdit();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pPrinter && bOwnPrinter && (pPrinter != pNewPrinter) )
|
|
|
|
{
|
|
|
|
delete pPrinter;
|
|
|
|
}
|
|
|
|
|
|
|
|
pPrinter = pNewPrinter;
|
|
|
|
bOwnPrinter = TRUE;
|
|
|
|
|
|
|
|
delete pFontList;
|
|
|
|
pFontList = new FontList( GetPrinter(TRUE), Application::GetDefaultDevice(), FALSE );
|
|
|
|
SvxFontListItem aFontListItem( pFontList );
|
|
|
|
PutItem( aFontListItem );
|
2002-07-26 07:32:44 +00:00
|
|
|
UpdateRefDevice();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|*
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
2004-02-02 09:54:17 +00:00
|
|
|
Printer* DrawDocShell::GetDocumentPrinter()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return GetPrinter(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|*
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
2004-02-02 09:54:17 +00:00
|
|
|
void DrawDocShell::OnDocumentPrinterChanged(Printer* pNewPrinter)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-10-28 10:08:56 +00:00
|
|
|
// if we already have a printer, see if its the same
|
|
|
|
if( pPrinter )
|
|
|
|
{
|
|
|
|
// easy case
|
|
|
|
if( pPrinter == pNewPrinter )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// compare if its the same printer with the same job setup
|
|
|
|
if( (pPrinter->GetName() == pNewPrinter->GetName()) &&
|
|
|
|
(pPrinter->GetJobSetup() == pNewPrinter->GetJobSetup()))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if (pPrinter->IsA(SfxPrinter))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Da kein RTTI verfuegbar, wird hart gecasted (...)
|
|
|
|
SetPrinter((SfxPrinter*) pNewPrinter);
|
|
|
|
|
|
|
|
// Printer gehoert dem Container
|
|
|
|
bOwnPrinter = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-26 07:32:44 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|*
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
2004-02-02 09:54:17 +00:00
|
|
|
void DrawDocShell::UpdateRefDevice()
|
2002-07-26 07:32:44 +00:00
|
|
|
{
|
|
|
|
if( pDoc )
|
|
|
|
{
|
2003-04-24 13:38:03 +00:00
|
|
|
// Determine the device for which the output will be formatted.
|
|
|
|
OutputDevice* pRefDevice = NULL;
|
|
|
|
switch (pDoc->GetPrinterIndependentLayout())
|
|
|
|
{
|
|
|
|
case ::com::sun::star::document::PrinterIndependentLayout::DISABLED:
|
|
|
|
pRefDevice = pPrinter;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ::com::sun::star::document::PrinterIndependentLayout::ENABLED:
|
|
|
|
pRefDevice = SD_MOD()->GetVirtualRefDevice();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// We are confronted with an invalid or un-implemented
|
|
|
|
// layout mode. Use the printer as formatting device
|
|
|
|
// as a fall-back.
|
2004-02-02 09:54:17 +00:00
|
|
|
DBG_ASSERT(false, "DrawDocShell::UpdateRefDevice(): Unexpected printer layout mode");
|
2003-04-24 13:38:03 +00:00
|
|
|
|
|
|
|
pRefDevice = pPrinter;
|
|
|
|
break;
|
|
|
|
}
|
2002-07-26 07:32:44 +00:00
|
|
|
pDoc->SetRefDevice( pRefDevice );
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
::sd::Outliner* pOutl = pDoc->GetOutliner( FALSE );
|
2002-07-26 07:32:44 +00:00
|
|
|
|
|
|
|
if( pOutl )
|
|
|
|
pOutl->SetRefDevice( pRefDevice );
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
::sd::Outliner* pInternalOutl = pDoc->GetInternalOutliner( FALSE );
|
2002-07-26 07:32:44 +00:00
|
|
|
|
|
|
|
if( pInternalOutl )
|
|
|
|
pInternalOutl->SetRefDevice( pRefDevice );
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* InitNew, (Dokument wird neu erzeugt): Streams oeffnen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
BOOL DrawDocShell::InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
BOOL bRet = FALSE;
|
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
bRet = SfxObjectShell::InitNew( xStorage );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
Rectangle aVisArea( Point(0, 0), Size(14100, 10000) );
|
|
|
|
SetVisArea(aVisArea);
|
|
|
|
|
|
|
|
if (bRet)
|
|
|
|
{
|
|
|
|
if( !bSdDataObj )
|
|
|
|
pDoc->NewOrLoadCompleted(NEW_DOC); // otherwise calling
|
|
|
|
// NewOrLoadCompleted(NEW_LOADED) in
|
|
|
|
// SdDrawDocument::AllocModel()
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Load: Pools und Dokument laden
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
sal_Bool DrawDocShell::IsNewDocument() const
|
2002-08-01 10:30:12 +00:00
|
|
|
{
|
|
|
|
return( mbNewDocument &&
|
|
|
|
( !GetMedium() || GetMedium()->GetURLObject().GetProtocol() == INET_PROT_NOT_VALID ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Load: Pools und Dokument laden
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
BOOL DrawDocShell::Load( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-08-01 10:30:12 +00:00
|
|
|
mbNewDocument = sal_False;
|
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
BOOL bRet = FALSE;
|
2003-05-16 13:17:31 +00:00
|
|
|
bool bStartPresentation = false;
|
2004-10-04 17:30:29 +00:00
|
|
|
ErrCode nError = ERRCODE_NONE;
|
2001-02-13 11:17:06 +00:00
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
SfxItemSet* pSet = GetMedium()->GetItemSet();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-05-16 13:17:31 +00:00
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
if( pSet )
|
|
|
|
{
|
|
|
|
if( ( SFX_ITEM_SET == pSet->GetItemState(SID_PREVIEW ) ) && ( (SfxBoolItem&) ( pSet->Get( SID_PREVIEW ) ) ).GetValue() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-10-04 17:30:29 +00:00
|
|
|
pDoc->SetStarDrawPreviewMode( TRUE );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
if( SFX_ITEM_SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&&
|
|
|
|
( (SfxBoolItem&) ( pSet->Get( SID_DOC_STARTPRESENTATION ) ) ).GetValue() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-10-04 17:30:29 +00:00
|
|
|
bStartPresentation = true;
|
|
|
|
pDoc->SetStartWithPresentation( true );
|
2001-02-13 11:17:06 +00:00
|
|
|
}
|
|
|
|
}
|
2004-10-04 17:30:29 +00:00
|
|
|
|
|
|
|
bRet = SfxObjectShell::Load( xStorage );
|
|
|
|
if( bRet )
|
|
|
|
{
|
|
|
|
SfxMedium* pMedium = GetMedium();
|
|
|
|
bRet = SdXMLFilter( *pMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( xStorage ) ).Import( nError );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
if( bRet )
|
|
|
|
{
|
|
|
|
UpdateTablePointers();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-04-04 18:17:55 +00:00
|
|
|
// #108451# If we're an embedded OLE object, use tight bounds
|
|
|
|
// for our visArea. No point in showing the user lots of empty
|
|
|
|
// space. Had to remove the check for empty VisArea below,
|
|
|
|
// since XML load always sets a VisArea before.
|
2004-10-04 17:30:29 +00:00
|
|
|
//TODO/LATER: looks a little bit strange!
|
|
|
|
if( ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) && SfxObjectShell::GetVisArea( ASPECT_CONTENT ).IsEmpty() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-13 11:17:06 +00:00
|
|
|
SdPage* pPage = pDoc->GetSdPage( 0, PK_STANDARD );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
if( pPage )
|
|
|
|
SetVisArea( Rectangle( pPage->GetAllObjBoundRect() ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
FinishedLoading( SFX_LOADED_ALL );
|
|
|
|
}
|
|
|
|
else
|
2003-03-27 09:58:12 +00:00
|
|
|
{
|
2004-10-04 17:30:29 +00:00
|
|
|
if( nError == ERRCODE_IO_BROKENPACKAGE )
|
2003-03-27 09:58:12 +00:00
|
|
|
SetError( ERRCODE_IO_BROKENPACKAGE );
|
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
// TODO/LATER: correct error handling?!
|
|
|
|
//pStore->SetError( SVSTREAM_WRONGVERSION );
|
|
|
|
else
|
|
|
|
SetError( ERRCODE_ABORT );
|
2003-03-27 09:58:12 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-08-07 12:36:07 +00:00
|
|
|
// tell SFX to change viewshell when in preview mode
|
2003-05-16 13:17:31 +00:00
|
|
|
if( IsPreview() || bStartPresentation )
|
2001-08-07 12:36:07 +00:00
|
|
|
{
|
|
|
|
SfxItemSet *pSet = GetMedium()->GetItemSet();
|
|
|
|
|
|
|
|
if( pSet )
|
2003-05-16 13:17:31 +00:00
|
|
|
pSet->Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) );
|
2001-08-07 12:36:07 +00:00
|
|
|
}
|
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
return bRet;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* LoadFrom: Inhalte fuer Organizer laden
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
BOOL DrawDocShell::LoadFrom( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage )
|
2001-02-13 11:17:06 +00:00
|
|
|
{
|
2002-08-01 10:30:12 +00:00
|
|
|
mbNewDocument = sal_False;
|
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
WaitObject* pWait = NULL;
|
|
|
|
if( pViewShell )
|
|
|
|
pWait = new WaitObject( (Window*) pViewShell->GetActiveWindow() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-05-03 11:20:25 +00:00
|
|
|
BOOL bRet = FALSE;
|
|
|
|
|
2001-08-07 12:54:41 +00:00
|
|
|
// #90691# return to old behaviour (before #80365#): construct own medium
|
2004-10-04 17:30:29 +00:00
|
|
|
SfxMedium aMedium(xStorage);
|
2001-08-07 12:54:41 +00:00
|
|
|
|
|
|
|
// #90691# for having a progress bar nonetheless for XML copy it
|
|
|
|
// from the local DocShell medium (GetMedium()) to the constructed one
|
|
|
|
SfxMedium* pLocalMedium = GetMedium();
|
|
|
|
if(pLocalMedium)
|
|
|
|
{
|
|
|
|
SfxItemSet* pLocalItemSet = pLocalMedium->GetItemSet();
|
|
|
|
SfxItemSet* pDestItemSet = aMedium.GetItemSet();
|
|
|
|
|
|
|
|
if(pLocalItemSet && pDestItemSet)
|
|
|
|
{
|
2003-12-01 09:09:07 +00:00
|
|
|
const SfxUnoAnyItem* pItem = static_cast<
|
|
|
|
const SfxUnoAnyItem*>(
|
|
|
|
pLocalItemSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL));
|
2001-08-07 12:54:41 +00:00
|
|
|
|
|
|
|
if(pItem)
|
|
|
|
{
|
|
|
|
pDestItemSet->Put(*pItem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-03 11:20:25 +00:00
|
|
|
pDoc->NewOrLoadCompleted( NEW_DOC );
|
|
|
|
pDoc->CreateFirstPages();
|
|
|
|
pDoc->StopWorkStartupDelay();
|
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
// TODO/LATER: nobody is interested in the error code?!
|
|
|
|
ErrCode nError = ERRCODE_NONE;
|
|
|
|
bRet = SdXMLFilter( aMedium, *this, sal_True, SDXMLMODE_Organizer, SotStorage::GetVersion( xStorage ) ).Import( nError );
|
2001-05-03 11:20:25 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-08-07 12:36:07 +00:00
|
|
|
// tell SFX to change viewshell when in preview mode
|
|
|
|
if( IsPreview() )
|
|
|
|
{
|
|
|
|
SfxItemSet *pSet = GetMedium()->GetItemSet();
|
|
|
|
|
|
|
|
if( pSet )
|
|
|
|
pSet->Put( SfxUInt16Item( SID_VIEW_ID, 5 ) );
|
|
|
|
}
|
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
delete pWait;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2001-02-13 11:17:06 +00:00
|
|
|
|* ConvertFrom: aus Fremdformat laden
|
2000-09-18 16:07:07 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
BOOL DrawDocShell::ConvertFrom( SfxMedium& rMedium )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-08-01 10:30:12 +00:00
|
|
|
mbNewDocument = sal_False;
|
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
const String aFilterName( rMedium.GetFilter()->GetFilterName() );
|
|
|
|
BOOL bRet = FALSE;
|
|
|
|
|
|
|
|
SetWaitCursor( TRUE );
|
|
|
|
|
|
|
|
if( aFilterName == pFilterPowerPoint97 || aFilterName == pFilterPowerPoint97Template)
|
|
|
|
{
|
|
|
|
pDoc->StopWorkStartupDelay();
|
2004-10-04 17:30:29 +00:00
|
|
|
bRet = SdPPTFilter( rMedium, *this, sal_True ).Import();
|
2001-02-13 11:17:06 +00:00
|
|
|
}
|
2004-07-13 06:44:12 +00:00
|
|
|
else if (aFilterName.SearchAscii("impress8" ) != STRING_NOTFOUND ||
|
|
|
|
aFilterName.SearchAscii("draw8") != STRING_NOTFOUND )
|
2001-02-13 11:17:06 +00:00
|
|
|
{
|
2004-10-04 17:30:29 +00:00
|
|
|
// TODO/LATER: nobody is interested in the error code?!
|
2001-02-13 11:17:06 +00:00
|
|
|
pDoc->CreateFirstPages();
|
|
|
|
pDoc->StopWorkStartupDelay();
|
2004-10-04 17:30:29 +00:00
|
|
|
ErrCode nError = ERRCODE_NONE;
|
|
|
|
bRet = SdXMLFilter( rMedium, *this, sal_True ).Import( nError );
|
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
}
|
2004-07-13 06:44:12 +00:00
|
|
|
else if (aFilterName.SearchAscii("StarOffice XML (Draw)" ) != STRING_NOTFOUND || aFilterName.SearchAscii("StarOffice XML (Impress)") != STRING_NOTFOUND )
|
|
|
|
{
|
2004-10-04 17:30:29 +00:00
|
|
|
// TODO/LATER: nobody is interested in the error code?!
|
2004-07-13 06:44:12 +00:00
|
|
|
pDoc->CreateFirstPages();
|
|
|
|
pDoc->StopWorkStartupDelay();
|
2004-10-04 17:30:29 +00:00
|
|
|
ErrCode nError = ERRCODE_NONE;
|
|
|
|
bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SOFFICE_FILEFORMAT_60 ).Import( nError );
|
2004-07-13 06:44:12 +00:00
|
|
|
}
|
2001-02-13 11:17:06 +00:00
|
|
|
else if( aFilterName.EqualsAscii( "CGM - Computer Graphics Metafile" ) )
|
|
|
|
{
|
|
|
|
pDoc->CreateFirstPages();
|
|
|
|
pDoc->StopWorkStartupDelay();
|
2004-10-04 17:30:29 +00:00
|
|
|
bRet = SdCGMFilter( rMedium, *this, sal_True ).Import();
|
2001-02-13 11:17:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pDoc->CreateFirstPages();
|
|
|
|
pDoc->StopWorkStartupDelay();
|
2004-10-04 17:30:29 +00:00
|
|
|
bRet = SdGRFFilter( rMedium, *this, sal_True ).Import();
|
2001-02-13 11:17:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FinishedLoading( SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES );
|
|
|
|
|
2001-08-07 12:36:07 +00:00
|
|
|
// tell SFX to change viewshell when in preview mode
|
|
|
|
if( IsPreview() )
|
|
|
|
{
|
|
|
|
SfxItemSet *pSet = GetMedium()->GetItemSet();
|
|
|
|
|
|
|
|
if( pSet )
|
|
|
|
pSet->Put( SfxUInt16Item( SID_VIEW_ID, 5 ) );
|
|
|
|
}
|
2001-02-13 11:17:06 +00:00
|
|
|
SetWaitCursor( FALSE );
|
|
|
|
|
|
|
|
return bRet;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Save: Pools und Dokument in die offenen Streams schreiben
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
BOOL DrawDocShell::Save()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pDoc->StopWorkStartupDelay();
|
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
//TODO/LATER: why this?!
|
2001-02-13 11:17:06 +00:00
|
|
|
if( GetCreateMode() == SFX_CREATE_MODE_STANDARD )
|
2004-10-04 17:30:29 +00:00
|
|
|
SfxObjectShell::SetVisArea( Rectangle() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
BOOL bRet = SfxObjectShell::Save();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( bRet )
|
|
|
|
{
|
2001-07-05 12:09:12 +00:00
|
|
|
// #86834# Call UpdateDocInfoForSave() before export
|
|
|
|
UpdateDocInfoForSave();
|
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
uno::Reference< embed::XStorage > xStorage = GetStorage();
|
|
|
|
SfxMedium aMedium( xStorage );
|
|
|
|
bRet = SdXMLFilter( aMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( xStorage ) ).Export();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SaveAs: Pools und Dokument in den angegebenen Storage sichern
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
BOOL DrawDocShell::SaveAs( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStore )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pDoc->StopWorkStartupDelay();
|
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
//TODO/LATER: why this?!
|
2001-02-13 11:17:06 +00:00
|
|
|
if( GetCreateMode() == SFX_CREATE_MODE_STANDARD )
|
2004-10-04 17:30:29 +00:00
|
|
|
SfxObjectShell::SetVisArea( Rectangle() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
UINT32 nVBWarning = ERRCODE_NONE;
|
2004-10-04 17:30:29 +00:00
|
|
|
BOOL bRet = SfxObjectShell::SaveAs( xStore );
|
2001-02-13 11:17:06 +00:00
|
|
|
|
|
|
|
if( bRet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-10-04 17:30:29 +00:00
|
|
|
// #86834# Call UpdateDocInfoForSave() before export
|
|
|
|
UpdateDocInfoForSave();
|
|
|
|
SfxMedium aMedium( xStore );
|
|
|
|
bRet = SdXMLFilter( aMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( xStore ) ).Export();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
if( GetError() == ERRCODE_NONE )
|
|
|
|
SetError( nVBWarning );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
return bRet;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* ConvertTo: im Fremdformat speichern
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
BOOL DrawDocShell::ConvertTo( SfxMedium& rMedium )
|
2001-02-13 11:17:06 +00:00
|
|
|
{
|
|
|
|
BOOL bRet = FALSE;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
if( pDoc->GetPageCount() )
|
|
|
|
{
|
2002-04-18 14:48:12 +00:00
|
|
|
const SfxFilter* pMediumFilter = rMedium.GetFilter();
|
|
|
|
const String aTypeName( pMediumFilter->GetTypeName() );
|
|
|
|
SdFilter* pFilter = NULL;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2002-04-18 14:48:12 +00:00
|
|
|
if( aTypeName.SearchAscii( "graphic_HTML" ) != STRING_NOTFOUND )
|
|
|
|
{
|
|
|
|
pFilter = new SdHTMLFilter( rMedium, *this, sal_True );
|
|
|
|
}
|
|
|
|
else if( aTypeName.SearchAscii( "MS_PowerPoint_97" ) != STRING_NOTFOUND )
|
2001-02-13 11:17:06 +00:00
|
|
|
{
|
|
|
|
pFilter = new SdPPTFilter( rMedium, *this, sal_True );
|
2001-03-16 12:44:56 +00:00
|
|
|
((SdPPTFilter*)pFilter)->PreSaveBasic();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2002-04-18 14:48:12 +00:00
|
|
|
else if ( aTypeName.SearchAscii( "CGM_Computer_Graphics_Metafile" ) != STRING_NOTFOUND )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-13 11:17:06 +00:00
|
|
|
pFilter = new SdCGMFilter( rMedium, *this, sal_True );
|
|
|
|
}
|
2004-07-13 06:44:12 +00:00
|
|
|
else if( ( aTypeName.SearchAscii( "draw8" ) != STRING_NOTFOUND ) ||
|
|
|
|
( aTypeName.SearchAscii( "impress8" ) != STRING_NOTFOUND ) )
|
2001-02-13 11:17:06 +00:00
|
|
|
{
|
|
|
|
pFilter = new SdXMLFilter( rMedium, *this, sal_True );
|
|
|
|
UpdateDocInfoForSave();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2004-07-13 06:44:12 +00:00
|
|
|
else if( ( aTypeName.SearchAscii( "StarOffice_XML_Impress" ) != STRING_NOTFOUND ) ||
|
|
|
|
( aTypeName.SearchAscii( "StarOffice_XML_Draw" ) != STRING_NOTFOUND ) )
|
|
|
|
{
|
|
|
|
pFilter = new SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SOFFICE_FILEFORMAT_60 );
|
|
|
|
UpdateDocInfoForSave();
|
|
|
|
}
|
2002-04-18 14:48:12 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
pFilter = new SdGRFFilter( rMedium, *this, sal_True );
|
|
|
|
}
|
2000-10-30 10:50:43 +00:00
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
if( pFilter )
|
|
|
|
{
|
|
|
|
const ULONG nOldSwapMode = pDoc->GetSwapGraphicsMode();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
pDoc->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-13 11:17:06 +00:00
|
|
|
if( !( bRet = pFilter->Export() ) )
|
|
|
|
pDoc->SetSwapGraphicsMode( nOldSwapMode );
|
|
|
|
|
|
|
|
delete pFilter;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-02-13 11:17:06 +00:00
|
|
|
|
|
|
|
return bRet;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SaveCompleted: die eigenen Streams wieder oeffnen, damit kein anderer
|
|
|
|
|* sie "besetzt"
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
BOOL DrawDocShell::SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
BOOL bRet = FALSE;
|
|
|
|
|
2004-10-04 17:30:29 +00:00
|
|
|
if( SfxObjectShell::SaveCompleted(xStorage) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-13 11:17:06 +00:00
|
|
|
pDoc->NbcSetChanged( FALSE );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-04-20 08:45:44 +00:00
|
|
|
if( pViewShell )
|
|
|
|
{
|
2004-02-02 09:54:17 +00:00
|
|
|
if( pViewShell->ISA( OutlineViewShell ) )
|
|
|
|
static_cast<OutlineView*>(pViewShell->GetView())
|
|
|
|
->GetOutliner()->ClearModifyFlag();
|
2001-04-20 08:45:44 +00:00
|
|
|
|
|
|
|
SdrOutliner* pOutl = pViewShell->GetView()->GetTextEditOutliner();
|
|
|
|
if( pOutl )
|
2001-05-16 11:30:45 +00:00
|
|
|
{
|
|
|
|
SdrObject* pObj = pViewShell->GetView()->GetTextEditObject();
|
|
|
|
if( pObj )
|
|
|
|
pObj->NbcSetOutlinerParaObject( pOutl->CreateParaObject() );
|
|
|
|
|
2001-04-20 08:45:44 +00:00
|
|
|
pOutl->ClearModifyFlag();
|
2001-05-16 11:30:45 +00:00
|
|
|
}
|
2001-04-20 08:45:44 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
bRet = TRUE;
|
|
|
|
|
2001-03-21 10:46:52 +00:00
|
|
|
SfxViewFrame* pFrame = ( pViewShell && pViewShell->GetViewFrame() ) ?
|
|
|
|
pViewShell->GetViewFrame() :
|
|
|
|
SfxViewFrame::Current();
|
|
|
|
|
|
|
|
if( pFrame )
|
|
|
|
pFrame->GetBindings().Invalidate( SID_NAVIGATOR_STATE, TRUE, FALSE );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Referenz auf Dokument
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
SdDrawDocument* DrawDocShell::GetDoc()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pDoc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Referenz auf Dokument
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
SfxStyleSheetBasePool* DrawDocShell::GetStyleSheetPool()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return( (SfxStyleSheetBasePool*) pDoc->GetStyleSheetPool() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Sprung zu Bookmark
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
BOOL DrawDocShell::GotoBookmark(const String& rBookmark)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-04-08 14:20:29 +00:00
|
|
|
OSL_TRACE("GotoBookmark %s",
|
|
|
|
::rtl::OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr());
|
2000-09-18 16:07:07 +00:00
|
|
|
BOOL bFound = FALSE;
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
if (pViewShell && pViewShell->ISA(DrawViewShell))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-02-02 09:54:17 +00:00
|
|
|
DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>(pViewShell);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
String aBookmark( rBookmark );
|
|
|
|
|
|
|
|
if( rBookmark.Len() && rBookmark.GetChar( 0 ) == sal_Unicode('#') )
|
|
|
|
aBookmark = rBookmark.Copy( 1 );
|
|
|
|
|
|
|
|
// Ist das Bookmark eine Seite?
|
2001-05-16 12:51:30 +00:00
|
|
|
BOOL bIsMasterPage;
|
|
|
|
USHORT nPgNum = pDoc->GetPageByName( aBookmark, bIsMasterPage );
|
|
|
|
SdrObject* pObj = NULL;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (nPgNum == SDRPAGE_NOTFOUND)
|
|
|
|
{
|
|
|
|
// Ist das Bookmark ein Objekt?
|
|
|
|
pObj = pDoc->GetObj(aBookmark);
|
|
|
|
|
|
|
|
if (pObj)
|
|
|
|
{
|
|
|
|
nPgNum = pObj->GetPage()->GetPageNum();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nPgNum != SDRPAGE_NOTFOUND)
|
|
|
|
{
|
|
|
|
/**********************************************************
|
|
|
|
* Zur Seite springen
|
|
|
|
**********************************************************/
|
|
|
|
bFound = TRUE;
|
2003-12-01 09:09:07 +00:00
|
|
|
SdPage* pPage;
|
|
|
|
if (bIsMasterPage)
|
|
|
|
pPage = (SdPage*) pDoc->GetMasterPage(nPgNum);
|
|
|
|
else
|
|
|
|
pPage = (SdPage*) pDoc->GetPage(nPgNum);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
PageKind eNewPageKind = pPage->GetPageKind();
|
|
|
|
|
|
|
|
if (eNewPageKind != pDrViewSh->GetPageKind())
|
|
|
|
{
|
|
|
|
// Arbeitsbereich wechseln
|
|
|
|
GetFrameView()->SetPageKind(eNewPageKind);
|
2000-09-21 15:12:50 +00:00
|
|
|
( ( pViewShell && pViewShell->GetViewFrame() ) ?
|
|
|
|
pViewShell->GetViewFrame() : SfxViewFrame::Current() )->
|
|
|
|
GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Die aktuelle ViewShell hat sich geaendert!
|
2004-02-02 09:54:17 +00:00
|
|
|
pDrViewSh = static_cast<DrawViewShell*>(pViewShell);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EditMode eNewEditMode = EM_PAGE;
|
|
|
|
|
2001-05-16 12:51:30 +00:00
|
|
|
if( bIsMasterPage )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
eNewEditMode = EM_MASTERPAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (eNewEditMode != pDrViewSh->GetEditMode())
|
|
|
|
{
|
|
|
|
// EditMode setzen
|
|
|
|
pDrViewSh->ChangeEditMode(eNewEditMode, FALSE);
|
|
|
|
}
|
|
|
|
|
2003-04-08 14:20:29 +00:00
|
|
|
// Jump to the page. This is done by using the API because this
|
|
|
|
// takes care of all the little things to be done. Especially
|
|
|
|
// writing the view data to the frame view (see bug #107803#).
|
2000-09-18 16:07:07 +00:00
|
|
|
USHORT nSdPgNum = (nPgNum - 1) / 2;
|
2004-02-02 09:54:17 +00:00
|
|
|
SdUnoDrawView* pUnoDrawView = static_cast<SdUnoDrawView*>(
|
2004-06-03 10:52:46 +00:00
|
|
|
pDrViewSh->GetController());
|
2003-04-08 14:20:29 +00:00
|
|
|
if (pUnoDrawView != NULL)
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::drawing::XDrawPage> xDrawPage (
|
|
|
|
pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY);
|
|
|
|
pUnoDrawView->setCurrentPage (xDrawPage);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// As a fall back switch to the page via the core.
|
|
|
|
DBG_ASSERT (pUnoDrawView!=NULL,
|
2004-02-02 09:54:17 +00:00
|
|
|
"DrawDocShell::GotoBookmark: can't switch page via API");
|
2003-04-08 14:20:29 +00:00
|
|
|
pDrViewSh->SwitchPage(nSdPgNum);
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (pObj)
|
|
|
|
{
|
|
|
|
// Objekt einblenden und selektieren
|
|
|
|
pDrViewSh->MakeVisible(pObj->GetLogicRect(),
|
|
|
|
*pDrViewSh->GetActiveWindow());
|
|
|
|
pDrViewSh->GetView()->UnmarkAll();
|
|
|
|
pDrViewSh->GetView()->MarkObj(pObj, pDrViewSh->GetView()->GetPageViewPvNum(0), FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-21 15:12:50 +00:00
|
|
|
SfxBindings& rBindings = ( ( pViewShell && pViewShell->GetViewFrame() ) ?
|
|
|
|
pViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings();
|
|
|
|
|
|
|
|
rBindings.Invalidate(SID_NAVIGATOR_STATE, TRUE, FALSE);
|
|
|
|
rBindings.Invalidate(SID_NAVIGATOR_PAGENAME);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (bFound);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SaveAsOwnFormat: wenn es eine Dokumentvorlage werden soll,
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
2001-11-05 14:23:46 +00:00
|
|
|
#ifndef _URLOBJ_HXX
|
|
|
|
#include <tools/urlobj.hxx>
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
BOOL DrawDocShell::SaveAsOwnFormat( SfxMedium& rMedium )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-07-10 07:02:15 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
const SfxFilter* pFilter = rMedium.GetFilter();
|
|
|
|
|
|
|
|
if (pFilter->IsOwnTemplateFormat())
|
|
|
|
{
|
|
|
|
// jetzt die StarDraw-Spezialitaeten:
|
|
|
|
// die Layoutvorlagen der ersten Seite werden mit dem jetzt
|
|
|
|
// bekannten Layoutnamen versehen, die Layoutnamen der betroffenen
|
|
|
|
// Masterpages und Seiten werden gesetzt;
|
|
|
|
// alle Textobjekte der betroffenen Standard-, Notiz- und
|
|
|
|
// Masterpages werden ueber die Namensaenderung informiert
|
2001-07-10 07:02:15 +00:00
|
|
|
|
2001-11-05 14:23:46 +00:00
|
|
|
String aLayoutName;
|
|
|
|
|
2001-07-10 07:02:15 +00:00
|
|
|
SfxStringItem* pLayoutItem;
|
|
|
|
if( rMedium.GetItemSet()->GetItemState(SID_TEMPLATE_NAME, FALSE, (const SfxPoolItem**) & pLayoutItem ) == SFX_ITEM_SET )
|
|
|
|
{
|
2001-11-05 14:23:46 +00:00
|
|
|
aLayoutName = pLayoutItem->GetValue();
|
2001-07-10 07:02:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-11-05 14:23:46 +00:00
|
|
|
INetURLObject aURL( rMedium.GetName() );
|
|
|
|
aURL.removeExtension();
|
|
|
|
aLayoutName = aURL.getName();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aLayoutName.Len() )
|
|
|
|
{
|
|
|
|
String aOldPageLayoutName = pDoc->GetSdPage(0, PK_STANDARD)->GetLayoutName();
|
|
|
|
pDoc->RenameLayoutTemplate(aOldPageLayoutName, aLayoutName);
|
2001-07-10 07:02:15 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return SfxObjectShell::SaveAsOwnFormat(rMedium);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* FillClass
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
void DrawDocShell::FillClass(SvGlobalName* pClassName,
|
2000-09-18 16:07:07 +00:00
|
|
|
ULONG* pFormat,
|
|
|
|
String* pAppName,
|
|
|
|
String* pFullTypeName,
|
|
|
|
String* pShortTypeName,
|
2004-10-04 17:30:29 +00:00
|
|
|
sal_Int32 nFileFormat ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-10-04 17:30:29 +00:00
|
|
|
if (nFileFormat == SOFFICE_FILEFORMAT_60)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-10-04 17:30:29 +00:00
|
|
|
if ( eDocType == DOCUMENT_TYPE_DRAW )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-10-04 17:30:29 +00:00
|
|
|
*pClassName = SvGlobalName(SO3_SDRAW_CLASSID_60);
|
|
|
|
*pFormat = SOT_FORMATSTR_ID_STARDRAW_60;
|
|
|
|
*pFullTypeName = String(SdResId(STR_GRAPHIC_DOCUMENT_FULLTYPE_60));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2004-10-04 17:30:29 +00:00
|
|
|
else
|
2004-07-13 06:44:12 +00:00
|
|
|
{
|
2004-10-04 17:30:29 +00:00
|
|
|
*pClassName = SvGlobalName(SO3_SIMPRESS_CLASSID_60);
|
|
|
|
*pFormat = SOT_FORMATSTR_ID_STARIMPRESS_60;
|
|
|
|
*pFullTypeName = String(SdResId(STR_IMPRESS_DOCUMENT_FULLTYPE_60));
|
2004-07-13 06:44:12 +00:00
|
|
|
}
|
2004-10-04 17:30:29 +00:00
|
|
|
}
|
|
|
|
else if (nFileFormat == SOFFICE_FILEFORMAT_8)
|
|
|
|
{
|
|
|
|
if ( eDocType == DOCUMENT_TYPE_DRAW )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-10-04 17:30:29 +00:00
|
|
|
*pClassName = SvGlobalName(SO3_SDRAW_CLASSID_60);
|
|
|
|
*pFormat = SOT_FORMATSTR_ID_STARDRAW_8;
|
|
|
|
*pFullTypeName = String(RTL_CONSTASCII_USTRINGPARAM("Draw 8")); // HACK: method will be removed with new storage API
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*pClassName = SvGlobalName(SO3_SIMPRESS_CLASSID_60);
|
|
|
|
*pFormat = SOT_FORMATSTR_ID_STARIMPRESS_8;
|
|
|
|
*pFullTypeName = String(RTL_CONSTASCII_USTRINGPARAM("Impress 8")); // HACK: method will be removed with new storage API
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2004-10-04 17:30:29 +00:00
|
|
|
|
|
|
|
*pShortTypeName = String(SdResId( (eDocType == DOCUMENT_TYPE_DRAW) ?
|
|
|
|
STR_GRAPHIC_DOCUMENT : STR_IMPRESS_DOCUMENT ));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2003-04-24 13:38:03 +00:00
|
|
|
|
2004-02-02 09:54:17 +00:00
|
|
|
OutputDevice* DrawDocShell::GetDocumentRefDev (void)
|
2003-04-24 13:38:03 +00:00
|
|
|
{
|
2004-10-04 17:30:29 +00:00
|
|
|
OutputDevice* pReferenceDevice = SfxObjectShell::GetDocumentRefDev ();
|
2003-04-24 13:38:03 +00:00
|
|
|
// Only when our parent does not have a reference device then we return
|
|
|
|
// our own.
|
|
|
|
if (pReferenceDevice == NULL && pDoc != NULL)
|
|
|
|
pReferenceDevice = pDoc->GetRefDevice ();
|
|
|
|
return pReferenceDevice;
|
|
|
|
}
|
2004-02-02 09:54:17 +00:00
|
|
|
} // end of namespace sd
|