diff options
Diffstat (limited to 'sd/source/ui/docshell')
-rw-r--r-- | sd/source/ui/docshell/docshel2.cxx | 472 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel3.cxx | 257 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel4.cxx | 1012 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshell.cxx | 570 | ||||
-rw-r--r-- | sd/source/ui/docshell/grdocsh.cxx | 88 | ||||
-rw-r--r-- | sd/source/ui/docshell/sdclient.cxx | 220 |
6 files changed, 0 insertions, 2619 deletions
diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx deleted file mode 100644 index 82f261ed6..000000000 --- a/sd/source/ui/docshell/docshel2.cxx +++ /dev/null @@ -1,472 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "DrawDocShell.hxx" -#include <vcl/msgbox.hxx> -#include <svx/svdpagv.hxx> -#include <svx/svxdlg.hxx> -#include <svx/dialogs.hrc> - -#include "helpids.h" -#include "ViewShell.hxx" -#include "drawview.hxx" -#include "FrameView.hxx" -#include "drawdoc.hxx" -#include "sdpage.hxx" -#include "View.hxx" -#include "ClientView.hxx" -#include "Window.hxx" -#include "strings.hrc" -#include "res_bmp.hrc" -#include "sdresid.hxx" -#include "strmname.h" -#include "fupoor.hxx" -#include <vcl/svapp.hxx> -#include <vcl/virdev.hxx> - -namespace sd { - -/************************************************************************* -|* -|* Zeichnen der DocShell (mittels der Hilfsklasse SdDrawViewShell) -|* -\************************************************************************/ - -void DrawDocShell::Draw(OutputDevice* pOut, const JobSetup&, sal_uInt16 nAspect) -{ - if (nAspect == ASPECT_THUMBNAIL) - { - /********************************************************************** - * THUMBNAIL: Hier koennte ev. einmal der Draft-Mode gesetzt werden - **********************************************************************/ - } - - ClientView* pView = new ClientView(this, pOut, NULL); - - pView->SetHlplVisible(sal_False); - pView->SetGridVisible(sal_False); - pView->SetBordVisible(sal_False); - pView->SetPageVisible(sal_False); - pView->SetGlueVisible(sal_False); - - SdPage* pSelectedPage = NULL; - - const std::vector<sd::FrameView*> &rViews = mpDoc->GetFrameViewList(); - if( !rViews.empty() ) - { - sd::FrameView* pFrameView = rViews[0]; - if( pFrameView->GetPageKind() == PK_STANDARD ) - { - sal_uInt16 nSelectedPage = pFrameView->GetSelectedPage(); - pSelectedPage = mpDoc->GetSdPage(nSelectedPage, PK_STANDARD); - } - } - - if( NULL == pSelectedPage ) - { - SdPage* pPage = NULL; - sal_uInt16 nPageCnt = (sal_uInt16) mpDoc->GetSdPageCount(PK_STANDARD); - - for (sal_uInt16 i = 0; i < nPageCnt; i++) - { - pPage = mpDoc->GetSdPage(i, PK_STANDARD); - - if ( pPage->IsSelected() ) - pSelectedPage = pPage; - } - - if( NULL == pSelectedPage ) - pSelectedPage = mpDoc->GetSdPage(0, PK_STANDARD); - } - - Rectangle aVisArea = GetVisArea(nAspect); - pOut->IntersectClipRegion(aVisArea); - pView->ShowSdrPage(pSelectedPage); - - if (pOut->GetOutDevType() != OUTDEV_WINDOW) - { - MapMode aOldMapMode = pOut->GetMapMode(); - - if (pOut->GetOutDevType() == OUTDEV_PRINTER) - { - MapMode aMapMode = aOldMapMode; - Point aOrigin = aMapMode.GetOrigin(); - aOrigin.X() += 1; - aOrigin.Y() += 1; - aMapMode.SetOrigin(aOrigin); - pOut->SetMapMode(aMapMode); - } - - Region aRegion(aVisArea); - pView->CompleteRedraw(pOut, aRegion); - - if (pOut->GetOutDevType() == OUTDEV_PRINTER) - { - pOut->SetMapMode(aOldMapMode); - } - } - - delete pView; - -} - -Rectangle DrawDocShell::GetVisArea(sal_uInt16 nAspect) const -{ - Rectangle aVisArea; - - if( ( ASPECT_THUMBNAIL == nAspect ) || ( ASPECT_DOCPRINT == nAspect ) ) - { - // Groesse der ersten Seite herausgeben - MapMode aSrcMapMode(MAP_PIXEL); - MapMode aDstMapMode(MAP_100TH_MM); - Size aSize = mpDoc->GetSdPage(0, PK_STANDARD)->GetSize(); - aSrcMapMode.SetMapUnit(MAP_100TH_MM); - - aSize = Application::GetDefaultDevice()->LogicToLogic(aSize, &aSrcMapMode, &aDstMapMode); - aVisArea.SetSize(aSize); - } - else - { - aVisArea = SfxObjectShell::GetVisArea(nAspect); - } - - if (aVisArea.IsEmpty() && mpViewShell) - { - Window* pWin = mpViewShell->GetActiveWindow(); - - if (pWin) - { - aVisArea = pWin->PixelToLogic(Rectangle(Point(0,0), pWin->GetOutputSizePixel())); - } - } - - return (aVisArea); -} - -/************************************************************************* -|* -|* ViewShell anmelden -|* -\************************************************************************/ - -void DrawDocShell::Connect(ViewShell* pViewSh) -{ - mpViewShell = pViewSh; -} - -/************************************************************************* -|* -|* ViewShell abmelden -|* -\************************************************************************/ - -void DrawDocShell::Disconnect(ViewShell* pViewSh) -{ - if (mpViewShell == pViewSh) - { - mpViewShell = NULL; - } -} - -FrameView* DrawDocShell::GetFrameView() -{ - FrameView* pFrameView = NULL; - - if (mpViewShell) - { - pFrameView = mpViewShell->GetFrameView(); - } - - return(pFrameView); -} - -/************************************************************************* -|* -|* Groesse der ersten Seite zurueckgeben -|* -\************************************************************************/ - -Size DrawDocShell::GetFirstPageSize() -{ - return SfxObjectShell::GetFirstPageSize(); -} - -/************************************************************************* -|* -|* Bitmap einer beliebigen Seite erzeugen -|* -\************************************************************************/ - -Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixel) -{ - MapMode aMapMode( MAP_100TH_MM ); - const Size aSize( pPage->GetSize() ); - const Point aNullPt; - VirtualDevice aVDev( *Application::GetDefaultDevice() ); - - aVDev.SetMapMode( aMapMode ); - - const Size aPixSize( aVDev.LogicToPixel( aSize ) ); - const sal_uLong nMaxEdgePix = Max( aPixSize.Width(), aPixSize.Height() ); - Fraction aFrac( nMaxEdgePixel, nMaxEdgePix ); - - aMapMode.SetScaleX( aFrac ); - aMapMode.SetScaleY( aFrac ); - aVDev.SetMapMode( aMapMode ); - aVDev.SetOutputSize( aSize ); - - // damit die dunklen Linien am rechten und unteren Seitenrans mitkommen - aFrac = Fraction( nMaxEdgePixel - 1, nMaxEdgePix ); - aMapMode.SetScaleX( aFrac ); - aMapMode.SetScaleY( aFrac ); - aVDev.SetMapMode( aMapMode ); - - ClientView* pView = new ClientView( this, &aVDev, NULL ); - FrameView* pFrameView = GetFrameView(); - pView->ShowSdrPage( pPage ); - - if ( GetFrameView() ) - { - // Initialisierungen der Zeichen-(Bildschirm-)Attribute - pView->SetGridCoarse( pFrameView->GetGridCoarse() ); - pView->SetGridFine( pFrameView->GetGridFine() ); - pView->SetSnapGridWidth(pFrameView->GetSnapGridWidthX(), pFrameView->GetSnapGridWidthY()); - pView->SetGridVisible( pFrameView->IsGridVisible() ); - pView->SetGridFront( pFrameView->IsGridFront() ); - pView->SetSnapAngle( pFrameView->GetSnapAngle() ); - pView->SetGridSnap( pFrameView->IsGridSnap() ); - pView->SetBordSnap( pFrameView->IsBordSnap() ); - pView->SetHlplSnap( pFrameView->IsHlplSnap() ); - pView->SetOFrmSnap( pFrameView->IsOFrmSnap() ); - pView->SetOPntSnap( pFrameView->IsOPntSnap() ); - pView->SetOConSnap( pFrameView->IsOConSnap() ); - pView->SetDragStripes( pFrameView->IsDragStripes() ); - pView->SetFrameDragSingles( pFrameView->IsFrameDragSingles() ); - pView->SetSnapMagneticPixel( pFrameView->GetSnapMagneticPixel() ); - pView->SetMarkedHitMovesAlways( pFrameView->IsMarkedHitMovesAlways() ); - pView->SetMoveOnlyDragging( pFrameView->IsMoveOnlyDragging() ); - pView->SetSlantButShear( pFrameView->IsSlantButShear() ); - pView->SetNoDragXorPolys( pFrameView->IsNoDragXorPolys() ); - pView->SetCrookNoContortion( pFrameView->IsCrookNoContortion() ); - pView->SetAngleSnapEnabled( pFrameView->IsAngleSnapEnabled() ); - pView->SetBigOrtho( pFrameView->IsBigOrtho() ); - pView->SetOrtho( pFrameView->IsOrtho() ); - - SdrPageView* pPageView = pView->GetSdrPageView(); - - if (pPageView) - { - if ( pPageView->GetVisibleLayers() != pFrameView->GetVisibleLayers() ) - pPageView->SetVisibleLayers( pFrameView->GetVisibleLayers() ); - - if ( pPageView->GetPrintableLayers() != pFrameView->GetPrintableLayers() ) - pPageView->SetPrintableLayers( pFrameView->GetPrintableLayers() ); - - if ( pPageView->GetLockedLayers() != pFrameView->GetLockedLayers() ) - pPageView->SetLockedLayers( pFrameView->GetLockedLayers() ); - - pPageView->SetHelpLines( pFrameView->GetStandardHelpLines() ); - } - - if ( pView->GetActiveLayer() != pFrameView->GetActiveLayer() ) - pView->SetActiveLayer( pFrameView->GetActiveLayer() ); - } - - pView->CompleteRedraw( &aVDev, Rectangle( aNullPt, aSize ) ); - - // IsRedrawReady() always gives sal_True while ( !pView->IsRedrawReady() ) {} - delete pView; - - aVDev.SetMapMode( MapMode() ); - - Bitmap aPreview( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) ); - - DBG_ASSERT(!!aPreview, "Vorschau-Bitmap konnte nicht erzeugt werden"); - - return aPreview; -} - - -/************************************************************************* -|* -|* Pruefen, ob die Seite vorhanden ist und dann den Anwender zwingen einen -|* noch nicht vorhandenen Namen einzugeben. Wird sal_False zurueckgegeben, -|* wurde die Aktion vom Anwender abgebrochen. -|* -\************************************************************************/ - -sal_Bool DrawDocShell::CheckPageName (::Window* pWin, String& rName ) -{ - const String aStrForDlg( rName ); - bool bIsNameValid = IsNewPageNameValid( rName, true ); - - if( ! bIsNameValid ) - { - String aDesc( SdResId( STR_WARN_PAGE_EXISTS ) ); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - AbstractSvxNameDialog* aNameDlg = pFact ? pFact->CreateSvxNameDialog( pWin, aStrForDlg, aDesc ) : 0; - if( aNameDlg ) - { - aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE ); - - if( mpViewShell ) - aNameDlg->SetCheckNameHdl( LINK( this, DrawDocShell, RenameSlideHdl ) ); - - FunctionReference xFunc( mpViewShell->GetCurrentFunction() ); - if( xFunc.is() ) - xFunc->cancel(); - - if( aNameDlg->Execute() == RET_OK ) - { - aNameDlg->GetName( rName ); - bIsNameValid = IsNewPageNameValid( rName ); - } - delete aNameDlg; - } - } - - return ( bIsNameValid ? sal_True : sal_False ); -} - -bool DrawDocShell::IsNewPageNameValid( String & rInOutPageName, bool bResetStringIfStandardName /* = false */ ) -{ - bool bCanUseNewName = false; - - // check if name is something like 'Slide n' - String aStrPage( SdResId( STR_SD_PAGE ) ); - aStrPage += ' '; - - bool bIsStandardName = false; - - // prevent also _future_ slide names of the form "'STR_SD_PAGE' + ' ' + '[0-9]+|[a-z]|[A-Z]|[CDILMVX]+|[cdilmvx]+'" - // (arabic, lower- and upper case single letter, lower- and upper case roman numbers) - if( 0 == rInOutPageName.Search( aStrPage ) ) - { - if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) >= '0' && - rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) <= '9' ) - { - // check for arabic numbering - - // gobble up all following numbers - String sRemainder = rInOutPageName.GetToken( 1, sal_Unicode(' ') ); - while( sRemainder.Len() && - sRemainder.GetChar(0) >= '0' && - sRemainder.GetChar(0) <= '9' ) - { - // trim by one - sRemainder.Erase(0, 1); - } - - // EOL? Reserved name! - if( !sRemainder.Len() ) - { - bIsStandardName = true; - } - } - else if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) >= 'a' && - rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) <= 'z' && - rInOutPageName.GetToken( 1, sal_Unicode(' ') ).Len() == 1 ) - { - // lower case, single character: reserved - bIsStandardName = true; - } - else if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) >= 'A' && - rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) <= 'Z' && - rInOutPageName.GetToken( 1, sal_Unicode(' ') ).Len() == 1 ) - { - // upper case, single character: reserved - bIsStandardName = true; - } - else - { - // check for upper/lower case roman numbering - String sReserved( String::CreateFromAscii( "cdilmvx" ) ); - - // gobble up all following characters contained in one reserved class - String sRemainder = rInOutPageName.GetToken( 1, sal_Unicode(' ') ); - if( sReserved.Search( sRemainder.GetChar(0) ) == STRING_NOTFOUND ) - sReserved.ToUpperAscii(); - - while( sReserved.Search( sRemainder.GetChar(0) ) != STRING_NOTFOUND ) - { - // trim by one - sRemainder.Erase(0, 1); - } - - // EOL? Reserved name! - if( !sRemainder.Len() ) - { - bIsStandardName = true; - } - } - } - - if( bIsStandardName ) - { - if( bResetStringIfStandardName ) - { - // this is for insertion of slides from other files with standard - // name. They get a new standard name, if the string is set to an - // empty one. - rInOutPageName = String(); - bCanUseNewName = true; - } - else - bCanUseNewName = false; - } - else - { - if( rInOutPageName.Len() > 0 ) - { - sal_Bool bOutDummy; - sal_uInt16 nExistingPageNum = mpDoc->GetPageByName( rInOutPageName, bOutDummy ); - bCanUseNewName = ( nExistingPageNum == SDRPAGE_NOTFOUND ); - } - else - bCanUseNewName = false; - } - - return bCanUseNewName; -} - -IMPL_LINK( DrawDocShell, RenameSlideHdl, AbstractSvxNameDialog*, pDialog ) -{ - if( ! pDialog ) - return 0; - - String aNewName; - pDialog->GetName( aNewName ); - - return IsNewPageNameValid( aNewName ); -} -} // end of namespace sd - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx deleted file mode 100644 index a6e148d59..000000000 --- a/sd/source/ui/docshell/docshel3.cxx +++ /dev/null @@ -1,257 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "DrawDocShell.hxx" - -#include "app.hrc" - -#include <svx/svxids.hrc> -#include <svx/dialogs.hrc> - -#include <svx/ofaitem.hxx> -#include <svx/svxerr.hxx> -#include <svx/dialmgr.hxx> -#include <svl/srchitem.hxx> -#include <svx/srchdlg.hxx> -#ifdef _OUTLINER_HXX -#include <editeng/outliner.hxx> -#endif -#include <sfx2/request.hxx> -#include <svl/style.hxx> -#include <svx/drawitem.hxx> -#include <editeng/unolingu.hxx> -#include <com/sun/star/i18n/TextConversionOption.hpp> - - -#include "strings.hrc" -#include "glob.hrc" -#include "res_bmp.hrc" - -#include "app.hxx" -#include "drawdoc.hxx" -#include "sdpage.hxx" -#include "sdattr.hxx" -#include "fusearch.hxx" -#include "ViewShell.hxx" -#include "View.hxx" -#include "slideshow.hxx" -#include "fuhhconv.hxx" -#include "slideshow.hxx" - -using namespace ::com::sun::star; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::uno; - -namespace sd { - -#define POOL_BUFFER_SIZE (sal_uInt16)32768 -#define BASIC_BUFFER_SIZE (sal_uInt16)8192 -#define DOCUMENT_BUFFER_SIZE (sal_uInt16)32768 - -/************************************************************************* -|* -|* SFX-Requests bearbeiten -|* -\************************************************************************/ - -void DrawDocShell::Execute( SfxRequest& rReq ) -{ - if(mpViewShell && SlideShow::IsRunning( mpViewShell->GetViewShellBase() )) - { - // during a running presentation no slot will be executed - return; - } - - switch ( rReq.GetSlot() ) - { - case SID_SEARCH_ITEM: - { - const SfxItemSet* pReqArgs = rReq.GetArgs(); - - if (pReqArgs) - { - const SvxSearchItem* pSearchItem = - (const SvxSearchItem*) &pReqArgs->Get(SID_SEARCH_ITEM); - - // ein Zuweisungsoperator am SearchItem waer nicht schlecht... - SvxSearchItem* pAppSearchItem = SD_MOD()->GetSearchItem(); - delete pAppSearchItem; - pAppSearchItem = (SvxSearchItem*) pSearchItem->Clone(); - SD_MOD()->SetSearchItem(pAppSearchItem); - } - - rReq.Done(); - } - break; - - case FID_SEARCH_ON: - { - // Keine Aktion noetig - rReq.Done(); - } - break; - - case FID_SEARCH_OFF: - { - if( dynamic_cast< FuSearch* >(mxDocShellFunction.get()) ) - { - // End Search&Replace in all docshells - SfxObjectShell* pFirstShell = SfxObjectShell::GetFirst(); - SfxObjectShell* pShell = pFirstShell; - - while (pShell) - { - if (pShell->ISA(DrawDocShell)) - { - ( (DrawDocShell*) pShell)->CancelSearching(); - } - - pShell = SfxObjectShell::GetNext(*pShell); - - if (pShell == pFirstShell) - { - pShell = NULL; - } - } - - SetDocShellFunction(0); - Invalidate(); - rReq.Done(); - } - } - break; - - case FID_SEARCH_NOW: - { - const SfxItemSet* pReqArgs = rReq.GetArgs(); - - if ( pReqArgs ) - { - rtl::Reference< FuSearch > xFuSearch( dynamic_cast< FuSearch* >( GetDocShellFunction().get() ) ); - - if( !xFuSearch.is() && mpViewShell ) - { - ::sd::View* pView = mpViewShell->GetView(); - SetDocShellFunction( FuSearch::Create( mpViewShell, mpViewShell->GetActiveWindow(), pView, mpDoc, rReq ) ); - xFuSearch.set( dynamic_cast< FuSearch* >( GetDocShellFunction().get() ) ); - } - - if( xFuSearch.is() ) - { - const SvxSearchItem* pSearchItem = - (const SvxSearchItem*) &pReqArgs->Get(SID_SEARCH_ITEM); - - // ein Zuweisungsoperator am SearchItem waer nicht schlecht... - SvxSearchItem* pAppSearchItem = SD_MOD()->GetSearchItem(); - delete pAppSearchItem; - pAppSearchItem = (SvxSearchItem*)pSearchItem->Clone(); - SD_MOD()->SetSearchItem(pAppSearchItem); - xFuSearch->SearchAndReplace(pSearchItem); - } - } - - rReq.Done(); - } - break; - - case SID_CLOSEDOC: - { - ExecuteSlot(rReq, SfxObjectShell::GetStaticInterface()); - } - break; - - case SID_GET_COLORTABLE: - { - // passende ColorTable ist per PutItem gesetzt worden - SvxColorTableItem* pColItem = (SvxColorTableItem*) GetItem( SID_COLOR_TABLE ); - XColorTable* pTable = pColItem->GetColorTable(); - rReq.SetReturnValue( OfaPtrItem( SID_GET_COLORTABLE, pTable ) ); - } - break; - - case SID_VERSION: - { - const sal_uLong nOldSwapMode = mpDoc->GetSwapGraphicsMode(); - - mpDoc->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP ); - ExecuteSlot( rReq, SfxObjectShell::GetStaticInterface() ); - mpDoc->SetSwapGraphicsMode( nOldSwapMode ); - } - break; - - case SID_HANGUL_HANJA_CONVERSION: - { - if( mpViewShell ) - { - FunctionReference aFunc( FuHangulHanjaConversion::Create( mpViewShell, mpViewShell->GetActiveWindow(), mpViewShell->GetView(), mpDoc, rReq ) ); - static_cast< FuHangulHanjaConversion* >( aFunc.get() )->StartConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL, i18n::TextConversionOption::CHARACTER_BY_CHARACTER, sal_True ); - } - } - break; - - case SID_CHINESE_CONVERSION: - { - if( mpViewShell ) - { - FunctionReference aFunc( FuHangulHanjaConversion::Create( mpViewShell, mpViewShell->GetActiveWindow(), mpViewShell->GetView(), mpDoc, rReq ) ); - static_cast< FuHangulHanjaConversion* >( aFunc.get() )->StartChineseConversion(); - } - } - break; - - default: - break; - } -} - -/************************************************************************* -|* -|* Suchmaske fuer Organizer -|* -\************************************************************************/ - -void DrawDocShell::SetOrganizerSearchMask(SfxStyleSheetBasePool* pBasePool) const -{ - pBasePool->SetSearchMask(SD_STYLE_FAMILY_GRAPHICS, SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED); -} - - -void DrawDocShell::SetDocShellFunction( const ::sd::FunctionReference& xFunction ) -{ - if( mxDocShellFunction.is() ) - mxDocShellFunction->Dispose(); - - mxDocShellFunction = xFunction; -} - -} // end of namespace sd - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx deleted file mode 100644 index 9f9d8a5ec..000000000 --- a/sd/source/ui/docshell/docshel4.cxx +++ /dev/null @@ -1,1012 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "DrawDocShell.hxx" -#include <com/sun/star/document/PrinterIndependentLayout.hpp> -#include <tools/urlobj.hxx> -#include <sfx2/progress.hxx> -#include <vcl/waitobj.hxx> -#include <svx/svxids.hrc> -#include <editeng/flstitem.hxx> -#include <editeng/eeitem.hxx> -#include <svl/aeitem.hxx> -#include <svl/flagitem.hxx> -#include <sot/storage.hxx> -#include <sfx2/docfile.hxx> -#include <sfx2/docfilt.hxx> -#include <sfx2/dispatch.hxx> -#include <svx/svdotext.hxx> -#include <svl/style.hxx> -#include <sfx2/printer.hxx> -#include <svtools/ctrltool.hxx> -#include <svtools/sfxecode.hxx> -#include <sot/clsids.hxx> -#include <sot/formats.hxx> -#include <sfx2/request.hxx> -#include <unotools/fltrcfg.hxx> -#include <sfx2/frame.hxx> -#include <sfx2/viewfrm.hxx> -#include <unotools/saveopt.hxx> -#include <com/sun/star/drawing/XDrawPage.hpp> -#include <com/sun/star/drawing/XDrawView.hpp> -#include <comphelper/processfactory.hxx> - -#include "app.hrc" -#include "glob.hrc" -#include "strings.hrc" -#include "strmname.h" -#include "FrameView.hxx" -#include "optsitem.hxx" -#include "Outliner.hxx" -#include "sdattr.hxx" -#include "drawdoc.hxx" -#include "ViewShell.hxx" -#include "app.hxx" -#include "View.hxx" -#include "sdpage.hxx" -#include "sdresid.hxx" -#include "DrawViewShell.hxx" -#include "ViewShellBase.hxx" -#include "Window.hxx" -#include "sdmod.hxx" -#include "OutlineViewShell.hxx" -#include "sdxmlwrp.hxx" -#include "sdpptwrp.hxx" -#include "sdcgmfilter.hxx" -#include "sdgrffilter.hxx" -#include "sdhtmlfilter.hxx" -#include "framework/FrameworkHelper.hxx" - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using ::sd::framework::FrameworkHelper; - - -namespace sd { - -/************************************************************************* -|* -|* SfxPrinter ggf. erzeugen und zurueckgeben -|* -\************************************************************************/ - -SfxPrinter* DrawDocShell::GetPrinter(sal_Bool bCreate) -{ - if (bCreate && !mpPrinter) - { - // 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(mpDoc->GetDocumentType())); - SfxFlagItem aFlagItem( SID_PRINTER_CHANGESTODOC ); - sal_uInt16 nFlags = 0; - - nFlags = (aPrintItem.GetOptionsPrint().IsWarningSize() ? SFX_PRINTER_CHG_SIZE : 0) | - (aPrintItem.GetOptionsPrint().IsWarningOrientation() ? SFX_PRINTER_CHG_ORIENTATION : 0); - aFlagItem.SetValue( nFlags ); - - pSet->Put( aPrintItem ); - pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aPrintItem.GetOptionsPrint().IsWarningPrinter() ) ); - pSet->Put( aFlagItem ); - - mpPrinter = new SfxPrinter(pSet); - mbOwnPrinter = sal_True; - - // Ausgabequalitaet setzen - sal_uInt16 nQuality = aPrintItem.GetOptionsPrint().GetOutputQuality(); - - sal_uLong nMode = DRAWMODE_DEFAULT; - - if( nQuality == 1 ) - nMode = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT; - else if( nQuality == 2 ) - nMode = DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP | DRAWMODE_WHITEGRADIENT; - - mpPrinter->SetDrawMode( nMode ); - - MapMode aMM (mpPrinter->GetMapMode()); - aMM.SetMapUnit(MAP_100TH_MM); - mpPrinter->SetMapMode(aMM); - UpdateRefDevice(); - } - return mpPrinter; -} - -/************************************************************************* -|* -|* neuen SfxPrinter setzen (Eigentuemeruebergang) -|* -\************************************************************************/ - -void DrawDocShell::SetPrinter(SfxPrinter *pNewPrinter) -{ - if ( mpViewShell ) - { - ::sd::View* pView = mpViewShell->GetView(); - if ( pView->IsTextEdit() ) - pView->SdrEndTextEdit(); - } - - if ( mpPrinter && mbOwnPrinter && (mpPrinter != pNewPrinter) ) - { - delete mpPrinter; - } - - mpPrinter = pNewPrinter; - mbOwnPrinter = sal_True; - if ( mpDoc->GetPrinterIndependentLayout() == ::com::sun::star::document::PrinterIndependentLayout::DISABLED ) - UpdateFontList(); - UpdateRefDevice(); -} - -void DrawDocShell::UpdateFontList() -{ - delete mpFontList; - OutputDevice* pRefDevice = NULL; - if ( mpDoc->GetPrinterIndependentLayout() == ::com::sun::star::document::PrinterIndependentLayout::DISABLED ) - pRefDevice = GetPrinter(sal_True); - else - pRefDevice = SD_MOD()->GetVirtualRefDevice(); - mpFontList = new FontList( pRefDevice, NULL, sal_False ); - SvxFontListItem aFontListItem( mpFontList, SID_ATTR_CHAR_FONTLIST ); - PutItem( aFontListItem ); -} - -Printer* DrawDocShell::GetDocumentPrinter() -{ - return GetPrinter(sal_False); -} - -void DrawDocShell::OnDocumentPrinterChanged(Printer* pNewPrinter) -{ - // if we already have a printer, see if its the same - if( mpPrinter ) - { - // easy case - if( mpPrinter == pNewPrinter ) - return; - - // compare if its the same printer with the same job setup - if( (mpPrinter->GetName() == pNewPrinter->GetName()) && - (mpPrinter->GetJobSetup() == pNewPrinter->GetJobSetup())) - return; - } - - // if (mpPrinter->IsA(SfxPrinter)) - { - // Da kein RTTI verfuegbar, wird hart gecasted (...) - SetPrinter((SfxPrinter*) pNewPrinter); - - // Printer gehoert dem Container - mbOwnPrinter = sal_False; - } -} - -void DrawDocShell::UpdateRefDevice() -{ - if( mpDoc ) - { - // Determine the device for which the output will be formatted. - OutputDevice* pRefDevice = NULL; - switch (mpDoc->GetPrinterIndependentLayout()) - { - case ::com::sun::star::document::PrinterIndependentLayout::DISABLED: - pRefDevice = mpPrinter; - 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. - DBG_ASSERT(false, "DrawDocShell::UpdateRefDevice(): Unexpected printer layout mode"); - - pRefDevice = mpPrinter; - break; - } - mpDoc->SetRefDevice( pRefDevice ); - - ::sd::Outliner* pOutl = mpDoc->GetOutliner( sal_False ); - - if( pOutl ) - pOutl->SetRefDevice( pRefDevice ); - - ::sd::Outliner* pInternalOutl = mpDoc->GetInternalOutliner( sal_False ); - - if( pInternalOutl ) - pInternalOutl->SetRefDevice( pRefDevice ); - } -} - -/************************************************************************* -|* -|* InitNew, (Dokument wird neu erzeugt): Streams oeffnen -|* -\************************************************************************/ - -sal_Bool DrawDocShell::InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) -{ - sal_Bool bRet = sal_False; - - bRet = SfxObjectShell::InitNew( xStorage ); - - Rectangle aVisArea( Point(0, 0), Size(14100, 10000) ); - SetVisArea(aVisArea); - - if (bRet) - { - if( !mbSdDataObj ) - mpDoc->NewOrLoadCompleted(NEW_DOC); // otherwise calling - // NewOrLoadCompleted(NEW_LOADED) in - // SdDrawDocument::AllocModel() - } - return bRet; -} - -/************************************************************************* -|* -|* Load: Pools und Dokument laden -|* -\************************************************************************/ - -sal_Bool DrawDocShell::Load( SfxMedium& rMedium ) -{ - mbNewDocument = sal_False; - - sal_Bool bRet = sal_False; - bool bStartPresentation = false; - ErrCode nError = ERRCODE_NONE; - - SfxItemSet* pSet = rMedium.GetItemSet(); - - - if( pSet ) - { - if( ( SFX_ITEM_SET == pSet->GetItemState(SID_PREVIEW ) ) && ( (SfxBoolItem&) ( pSet->Get( SID_PREVIEW ) ) ).GetValue() ) - { - mpDoc->SetStarDrawPreviewMode( sal_True ); - } - - if( SFX_ITEM_SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&& - ( (SfxBoolItem&) ( pSet->Get( SID_DOC_STARTPRESENTATION ) ) ).GetValue() ) - { - bStartPresentation = true; - mpDoc->SetStartWithPresentation( true ); - } - } - - bRet = SfxObjectShell::Load( rMedium ); - if( bRet ) - { - bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( rMedium.GetStorage() ) ).Import( nError ); - } - - if( bRet ) - { - UpdateTablePointers(); - - // 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. - //TODO/LATER: looks a little bit strange! - if( ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) && SfxObjectShell::GetVisArea( ASPECT_CONTENT ).IsEmpty() ) - { - SdPage* pPage = mpDoc->GetSdPage( 0, PK_STANDARD ); - - if( pPage ) - SetVisArea( Rectangle( pPage->GetAllObjBoundRect() ) ); - } - - FinishedLoading( SFX_LOADED_ALL ); - - const INetURLObject aUrl; - SfxObjectShell::SetAutoLoad( aUrl, 0, sal_False ); - } - else - { - if( nError == ERRCODE_IO_BROKENPACKAGE ) - SetError( ERRCODE_IO_BROKENPACKAGE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); - - // TODO/LATER: correct error handling?! - //pStore->SetError( SVSTREAM_WRONGVERSION, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); - else - SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); - } - - // tell SFX to change viewshell when in preview mode - if( IsPreview() || bStartPresentation ) - { - SfxItemSet *pMediumSet = GetMedium()->GetItemSet(); - if( pMediumSet ) - pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) ); - } - - return bRet; -} - -/************************************************************************* -|* -|* LoadFrom: Inhalte fuer Organizer laden -|* -\************************************************************************/ - -sal_Bool DrawDocShell::LoadFrom( SfxMedium& rMedium ) -{ - mbNewDocument = sal_False; - - WaitObject* pWait = NULL; - if( mpViewShell ) - pWait = new WaitObject( (Window*) mpViewShell->GetActiveWindow() ); - - sal_Bool bRet = sal_False; - - mpDoc->NewOrLoadCompleted( NEW_DOC ); - mpDoc->CreateFirstPages(); - mpDoc->StopWorkStartupDelay(); - - // TODO/LATER: nobody is interested in the error code?! - ErrCode nError = ERRCODE_NONE; - bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Organizer, SotStorage::GetVersion( rMedium.GetStorage() ) ).Import( nError ); - - - // tell SFX to change viewshell when in preview mode - if( IsPreview() ) - { - SfxItemSet *pSet = GetMedium()->GetItemSet(); - - if( pSet ) - pSet->Put( SfxUInt16Item( SID_VIEW_ID, 5 ) ); - } - - delete pWait; - - return bRet; -} - -/************************************************************************* -|* -|* ImportFrom: load from 3rd party format -|* -\************************************************************************/ - -sal_Bool DrawDocShell::ImportFrom( SfxMedium &rMedium, bool bInsert ) -{ - const sal_Bool bRet=SfxObjectShell::ImportFrom(rMedium, bInsert); - - SfxItemSet* pSet = rMedium.GetItemSet(); - if( pSet ) - { - if( SFX_ITEM_SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&& - ( (SfxBoolItem&) ( pSet->Get( SID_DOC_STARTPRESENTATION ) ) ).GetValue() ) - { - mpDoc->SetStartWithPresentation( true ); - - // tell SFX to change viewshell when in preview mode - if( IsPreview() ) - { - SfxItemSet *pMediumSet = GetMedium()->GetItemSet(); - if( pMediumSet ) - pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, 1 ) ); - } - } - } - - return bRet; -} - -/************************************************************************* -|* -|* ConvertFrom: aus Fremdformat laden -|* -\************************************************************************/ - -sal_Bool DrawDocShell::ConvertFrom( SfxMedium& rMedium ) -{ - mbNewDocument = sal_False; - - const String aFilterName( rMedium.GetFilter()->GetFilterName() ); - sal_Bool bRet = sal_False; - bool bStartPresentation = false; - - SetWaitCursor( sal_True ); - - SfxItemSet* pSet = rMedium.GetItemSet(); - if( pSet ) - { - if( ( SFX_ITEM_SET == pSet->GetItemState(SID_PREVIEW ) ) && ( (SfxBoolItem&) ( pSet->Get( SID_PREVIEW ) ) ).GetValue() ) - { - mpDoc->SetStarDrawPreviewMode( sal_True ); - } - - if( SFX_ITEM_SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&& - ( (SfxBoolItem&) ( pSet->Get( SID_DOC_STARTPRESENTATION ) ) ).GetValue() ) - { - bStartPresentation = true; - mpDoc->SetStartWithPresentation( true ); - } - } - - if( aFilterName == pFilterPowerPoint97 - || aFilterName == pFilterPowerPoint97Template - || aFilterName == pFilterPowerPoint97AutoPlay) - { - mpDoc->StopWorkStartupDelay(); - bRet = SdPPTFilter( rMedium, *this, sal_True ).Import(); - } - else if (aFilterName.SearchAscii("impress8" ) != STRING_NOTFOUND || - aFilterName.SearchAscii("draw8") != STRING_NOTFOUND ) - { - // TODO/LATER: nobody is interested in the error code?! - mpDoc->CreateFirstPages(); - mpDoc->StopWorkStartupDelay(); - ErrCode nError = ERRCODE_NONE; - bRet = SdXMLFilter( rMedium, *this, sal_True ).Import( nError ); - - } - else if (aFilterName.SearchAscii("StarOffice XML (Draw)" ) != STRING_NOTFOUND || aFilterName.SearchAscii("StarOffice XML (Impress)") != STRING_NOTFOUND ) - { - // TODO/LATER: nobody is interested in the error code?! - mpDoc->CreateFirstPages(); - mpDoc->StopWorkStartupDelay(); - ErrCode nError = ERRCODE_NONE; - bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SOFFICE_FILEFORMAT_60 ).Import( nError ); - } - else if( aFilterName.EqualsAscii( "CGM - Computer Graphics Metafile" ) ) - { - mpDoc->CreateFirstPages(); - mpDoc->StopWorkStartupDelay(); - bRet = SdCGMFilter( rMedium, *this, sal_True ).Import(); - } - else - { - mpDoc->CreateFirstPages(); - mpDoc->StopWorkStartupDelay(); - bRet = SdGRFFilter( rMedium, *this ).Import(); - } - - FinishedLoading( SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES ); - - // tell SFX to change viewshell when in preview mode - if( IsPreview() ) - { - SfxItemSet *pMediumSet = GetMedium()->GetItemSet(); - - if( pMediumSet ) - pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, 5 ) ); - } - SetWaitCursor( sal_False ); - - // tell SFX to change viewshell when in preview mode - if( IsPreview() || bStartPresentation ) - { - SfxItemSet *pMediumSet = GetMedium()->GetItemSet(); - if( pMediumSet ) - pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) ); - } - - return bRet; -} - -/************************************************************************* -|* -|* Save: Pools und Dokument in die offenen Streams schreiben -|* -\************************************************************************/ - -sal_Bool DrawDocShell::Save() -{ - mpDoc->StopWorkStartupDelay(); - - //TODO/LATER: why this?! - if( GetCreateMode() == SFX_CREATE_MODE_STANDARD ) - SfxObjectShell::SetVisArea( Rectangle() ); - - sal_Bool bRet = SfxObjectShell::Save(); - - if( bRet ) - { - // Call UpdateDocInfoForSave() before export - UpdateDocInfoForSave(); - - bRet = SdXMLFilter( *GetMedium(), *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( GetMedium()->GetStorage() ) ).Export(); - } - - return bRet; -} - -/************************************************************************* -|* -|* SaveAs: Pools und Dokument in den angegebenen Storage sichern -|* -\************************************************************************/ - -sal_Bool DrawDocShell::SaveAs( SfxMedium& rMedium ) -{ - mpDoc->StopWorkStartupDelay(); - - //TODO/LATER: why this?! - if( GetCreateMode() == SFX_CREATE_MODE_STANDARD ) - SfxObjectShell::SetVisArea( Rectangle() ); - - sal_uInt32 nVBWarning = ERRCODE_NONE; - sal_Bool bRet = SfxObjectShell::SaveAs( rMedium ); - - if( bRet ) - { - // Call UpdateDocInfoForSave() before export - UpdateDocInfoForSave(); - bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( rMedium.GetStorage() ) ).Export(); - } - - if( GetError() == ERRCODE_NONE ) - SetError( nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); - - return bRet; -} - -/************************************************************************* -|* -|* ConvertTo: im Fremdformat speichern -|* -\************************************************************************/ - -sal_Bool DrawDocShell::ConvertTo( SfxMedium& rMedium ) -{ - sal_Bool bRet = sal_False; - - if( mpDoc->GetPageCount() ) - { - const SfxFilter* pMediumFilter = rMedium.GetFilter(); - const String aTypeName( pMediumFilter->GetTypeName() ); - SdFilter* pFilter = NULL; - - if( aTypeName.SearchAscii( "graphic_HTML" ) != STRING_NOTFOUND ) - { - pFilter = new SdHTMLFilter( rMedium, *this, sal_True ); - } - else if( aTypeName.SearchAscii( "MS_PowerPoint_97" ) != STRING_NOTFOUND ) - { - pFilter = new SdPPTFilter( rMedium, *this, sal_True ); - ((SdPPTFilter*)pFilter)->PreSaveBasic(); - } - else if ( aTypeName.SearchAscii( "CGM_Computer_Graphics_Metafile" ) != STRING_NOTFOUND ) - { - pFilter = new SdCGMFilter( rMedium, *this, sal_True ); - } - else if( ( aTypeName.SearchAscii( "draw8" ) != STRING_NOTFOUND ) || - ( aTypeName.SearchAscii( "impress8" ) != STRING_NOTFOUND ) ) - { - pFilter = new SdXMLFilter( rMedium, *this, sal_True ); - UpdateDocInfoForSave(); - } - 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(); - } - else - { - pFilter = new SdGRFFilter( rMedium, *this ); - } - - if( pFilter ) - { - const sal_uLong nOldSwapMode = mpDoc->GetSwapGraphicsMode(); - - mpDoc->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP ); - - bRet = pFilter->Export(); - if( !bRet ) - mpDoc->SetSwapGraphicsMode( nOldSwapMode ); - - delete pFilter; - } - } - - return bRet; -} - -/************************************************************************* -|* -|* SaveCompleted: die eigenen Streams wieder oeffnen, damit kein anderer -|* sie "besetzt" -|* -\************************************************************************/ - -sal_Bool DrawDocShell::SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) -{ - sal_Bool bRet = sal_False; - - if( SfxObjectShell::SaveCompleted(xStorage) ) - { - mpDoc->NbcSetChanged( sal_False ); - - if( mpViewShell ) - { - if( mpViewShell->ISA( OutlineViewShell ) ) - static_cast<OutlineView*>(mpViewShell->GetView()) - ->GetOutliner()->ClearModifyFlag(); - - SdrOutliner* pOutl = mpViewShell->GetView()->GetTextEditOutliner(); - if( pOutl ) - { - SdrObject* pObj = mpViewShell->GetView()->GetTextEditObject(); - if( pObj ) - pObj->NbcSetOutlinerParaObject( pOutl->CreateParaObject() ); - - pOutl->ClearModifyFlag(); - } - } - - bRet = sal_True; - - SfxViewFrame* pFrame = ( mpViewShell && mpViewShell->GetViewFrame() ) ? - mpViewShell->GetViewFrame() : - SfxViewFrame::Current(); - - if( pFrame ) - pFrame->GetBindings().Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False ); - } - return bRet; -} - -/************************************************************************* -|* -|* Referenz auf Dokument -|* -\************************************************************************/ - -SdDrawDocument* DrawDocShell::GetDoc() -{ - return mpDoc; -} - -/************************************************************************* -|* -|* Referenz auf Dokument -|* -\************************************************************************/ - -SfxStyleSheetBasePool* DrawDocShell::GetStyleSheetPool() -{ - return( (SfxStyleSheetBasePool*) mpDoc->GetStyleSheetPool() ); -} - -/************************************************************************* -|* -|* Sprung zu Bookmark -|* -\************************************************************************/ - -sal_Bool DrawDocShell::GotoBookmark(const String& rBookmark) -{ - sal_Bool bFound = sal_False; - - if (mpViewShell && mpViewShell->ISA(DrawViewShell)) - { - DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(mpViewShell); - ViewShellBase& rBase (mpViewShell->GetViewShellBase()); - - sal_Bool bIsMasterPage = sal_False; - sal_uInt16 nPageNumber = SDRPAGE_NOTFOUND; - SdrObject* pObj = NULL; - - rtl::OUString sBookmark( rBookmark ); - const rtl::OUString sInteraction( RTL_CONSTASCII_USTRINGPARAM( "action?" ) ); - if ( sBookmark.match( sInteraction ) ) - { - const rtl::OUString sJump( RTL_CONSTASCII_USTRINGPARAM( "jump=" ) ); - if ( sBookmark.match( sJump, sInteraction.getLength() ) ) - { - rtl::OUString aDestination( sBookmark.copy( sInteraction.getLength() + sJump.getLength() ) ); - if ( aDestination.match( String( RTL_CONSTASCII_USTRINGPARAM( "firstslide" ) ) ) ) - { - nPageNumber = 1; - } - else if ( aDestination.match( String( RTL_CONSTASCII_USTRINGPARAM( "lastslide" ) ) ) ) - { - nPageNumber = mpDoc->GetPageCount() - 2; - } - else if ( aDestination.match( String( RTL_CONSTASCII_USTRINGPARAM( "previousslide" ) ) ) ) - { - SdPage* pPage = pDrawViewShell->GetActualPage(); - nPageNumber = pPage->GetPageNum(); - nPageNumber = nPageNumber > 2 ? nPageNumber - 2 : SDRPAGE_NOTFOUND; - } - else if ( aDestination.match( String( RTL_CONSTASCII_USTRINGPARAM( "nextslide" ) ) ) ) - { - SdPage* pPage = pDrawViewShell->GetActualPage(); - nPageNumber = pPage->GetPageNum() + 2; - if ( nPageNumber >= mpDoc->GetPageCount() ) - nPageNumber = SDRPAGE_NOTFOUND; - } - } - } - else - { - String aBookmark( rBookmark ); - - // Ist das Bookmark eine Seite? - nPageNumber = mpDoc->GetPageByName( aBookmark, bIsMasterPage ); - - if (nPageNumber == SDRPAGE_NOTFOUND) - { - // Ist das Bookmark ein Objekt? - pObj = mpDoc->GetObj(aBookmark); - - if (pObj) - { - nPageNumber = pObj->GetPage()->GetPageNum(); - } - } - } - if (nPageNumber != SDRPAGE_NOTFOUND) - { - // Jump to the bookmarked page. This is done in three steps. - - bFound = sal_True; - SdPage* pPage; - if (bIsMasterPage) - pPage = (SdPage*) mpDoc->GetMasterPage(nPageNumber); - else - pPage = (SdPage*) mpDoc->GetPage(nPageNumber); - - // 1.) Change the view shell to the edit view, the notes view, - // or the handout view. - PageKind eNewPageKind = pPage->GetPageKind(); - - if( (eNewPageKind != PK_STANDARD) && (mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW) ) - return sal_False; - - if (eNewPageKind != pDrawViewShell->GetPageKind()) - { - // Arbeitsbereich wechseln - GetFrameView()->SetPageKind(eNewPageKind); - ::rtl::OUString sViewURL; - switch (eNewPageKind) - { - case PK_STANDARD: - sViewURL = FrameworkHelper::msImpressViewURL; - break; - case PK_NOTES: - sViewURL = FrameworkHelper::msNotesViewURL; - break; - case PK_HANDOUT: - sViewURL = FrameworkHelper::msHandoutViewURL; - break; - default: - break; - } - if (sViewURL.getLength() > 0) - { - ::boost::shared_ptr<FrameworkHelper> pHelper ( - FrameworkHelper::Instance(rBase)); - pHelper->RequestView( - sViewURL, - FrameworkHelper::msCenterPaneURL); - pHelper->WaitForUpdate(); - - // Get the new DrawViewShell. - mpViewShell = pHelper->GetViewShell(FrameworkHelper::msCenterPaneURL).get(); - pDrawViewShell = dynamic_cast<sd::DrawViewShell*>(mpViewShell); - } - else - { - pDrawViewShell = NULL; - } - } - - if (pDrawViewShell != NULL) - { - // Set the edit mode to either the normal edit mode or the - // master page mode. - EditMode eNewEditMode = EM_PAGE; - if (bIsMasterPage) - { - eNewEditMode = EM_MASTERPAGE; - } - - if (eNewEditMode != pDrawViewShell->GetEditMode()) - { - // EditMode setzen - pDrawViewShell->ChangeEditMode(eNewEditMode, sal_False); - } - - // Make the bookmarked page the current 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. - sal_uInt16 nSdPgNum = (nPageNumber - 1) / 2; - Reference<drawing::XDrawView> xController (rBase.GetController(), UNO_QUERY); - if (xController.is()) - { - Reference<drawing::XDrawPage> xDrawPage (pPage->getUnoPage(), UNO_QUERY); - xController->setCurrentPage (xDrawPage); - } - else - { - // As a fall back switch to the page via the core. - DBG_ASSERT (xController.is(), - "DrawDocShell::GotoBookmark: can't switch page via API"); - pDrawViewShell->SwitchPage(nSdPgNum); - } - - if (pObj != NULL) - { - // Objekt einblenden und selektieren - pDrawViewShell->MakeVisible(pObj->GetLogicRect(), - *pDrawViewShell->GetActiveWindow()); - pDrawViewShell->GetView()->UnmarkAll(); - pDrawViewShell->GetView()->MarkObj( - pObj, - pDrawViewShell->GetView()->GetSdrPageView(), sal_False); - } - } - } - - SfxBindings& rBindings = (pDrawViewShell->GetViewFrame()!=NULL - ? pDrawViewShell->GetViewFrame() - : SfxViewFrame::Current() )->GetBindings(); - - rBindings.Invalidate(SID_NAVIGATOR_STATE, sal_True, sal_False); - rBindings.Invalidate(SID_NAVIGATOR_PAGENAME); - } - - return (bFound); -} - -/************************************************************************* -|* -|* SaveAsOwnFormat: wenn es eine Dokumentvorlage werden soll, -|* -\************************************************************************/ -#include <tools/urlobj.hxx> - -sal_Bool DrawDocShell::SaveAsOwnFormat( SfxMedium& rMedium ) -{ - - 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 - - String aLayoutName; - - SfxStringItem* pLayoutItem; - if( rMedium.GetItemSet()->GetItemState(SID_TEMPLATE_NAME, sal_False, (const SfxPoolItem**) & pLayoutItem ) == SFX_ITEM_SET ) - { - aLayoutName = pLayoutItem->GetValue(); - } - else - { - INetURLObject aURL( rMedium.GetName() ); - aURL.removeExtension(); - aLayoutName = aURL.getName(); - } - - if( aLayoutName.Len() ) - { - String aOldPageLayoutName = mpDoc->GetSdPage(0, PK_STANDARD)->GetLayoutName(); - mpDoc->RenameLayoutTemplate(aOldPageLayoutName, aLayoutName); - } - } - - return SfxObjectShell::SaveAsOwnFormat(rMedium); -} - -/************************************************************************* -|* -|* FillClass -|* -\************************************************************************/ - -void DrawDocShell::FillClass(SvGlobalName* pClassName, - sal_uInt32* pFormat, - String* , - String* pFullTypeName, - String* pShortTypeName, - sal_Int32 nFileFormat, - sal_Bool bTemplate /* = sal_False */) const -{ - if (nFileFormat == SOFFICE_FILEFORMAT_60) - { - if ( meDocType == DOCUMENT_TYPE_DRAW ) - { - *pClassName = SvGlobalName(SO3_SDRAW_CLASSID_60); - *pFormat = SOT_FORMATSTR_ID_STARDRAW_60; - *pFullTypeName = String(SdResId(STR_GRAPHIC_DOCUMENT_FULLTYPE_60)); - } - else - { - *pClassName = SvGlobalName(SO3_SIMPRESS_CLASSID_60); - *pFormat = SOT_FORMATSTR_ID_STARIMPRESS_60; - *pFullTypeName = String(SdResId(STR_IMPRESS_DOCUMENT_FULLTYPE_60)); - } - } - else if (nFileFormat == SOFFICE_FILEFORMAT_8) - { - if ( meDocType == DOCUMENT_TYPE_DRAW ) - { - *pClassName = SvGlobalName(SO3_SDRAW_CLASSID_60); - *pFormat = bTemplate ? SOT_FORMATSTR_ID_STARDRAW_8_TEMPLATE : 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 = bTemplate ? SOT_FORMATSTR_ID_STARIMPRESS_8_TEMPLATE : SOT_FORMATSTR_ID_STARIMPRESS_8; - *pFullTypeName = String(RTL_CONSTASCII_USTRINGPARAM("Impress 8")); // HACK: method will be removed with new storage API - } - } - - *pShortTypeName = String(SdResId( (meDocType == DOCUMENT_TYPE_DRAW) ? - STR_GRAPHIC_DOCUMENT : STR_IMPRESS_DOCUMENT )); -} - -OutputDevice* DrawDocShell::GetDocumentRefDev (void) -{ - OutputDevice* pReferenceDevice = SfxObjectShell::GetDocumentRefDev (); - // Only when our parent does not have a reference device then we return - // our own. - if (pReferenceDevice == NULL && mpDoc != NULL) - pReferenceDevice = mpDoc->GetRefDevice (); - return pReferenceDevice; -} - -/** executes the SID_OPENDOC slot to let the framework open a document - with the given URL and this document as a referer */ -void DrawDocShell::OpenBookmark( const String& rBookmarkURL ) -{ - SfxStringItem aStrItem( SID_FILE_NAME, rBookmarkURL ); - SfxStringItem aReferer( SID_REFERER, GetMedium()->GetName() ); - const SfxPoolItem* ppArgs[] = { &aStrItem, &aReferer, 0 }; - ( mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings().Execute( SID_OPENHYPERLINK, ppArgs ); -} - -} // end of namespace sd - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx deleted file mode 100644 index 58479bb17..000000000 --- a/sd/source/ui/docshell/docshell.cxx +++ /dev/null @@ -1,570 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "DrawDocShell.hxx" -#include <vcl/svapp.hxx> - -#include <sfx2/docfac.hxx> -#include <sfx2/objface.hxx> - -#include <svx/svxids.hrc> -#include <svl/srchitem.hxx> -#include <svx/srchdlg.hxx> -#include <editeng/flstitem.hxx> -#include <svl/eitem.hxx> -#include <svl/intitem.hxx> -#include <sfx2/printer.hxx> -#include <sfx2/docfile.hxx> -#include <svx/drawitem.hxx> -#include <editeng/flstitem.hxx> -#include <svx/drawitem.hxx> -#include <svx/srchdlg.hxx> -#include <sfx2/dispatch.hxx> -#include <svl/whiter.hxx> -#include <svl/itempool.hxx> -#include <svtools/ctrltool.hxx> -#include <svtools/filter.hxx> -#include <sot/clsids.hxx> -#include <svl/cjkoptions.hxx> -#include <svl/visitem.hxx> - -#include <svx/svdoutl.hxx> - -#include <sfx2/fcontnr.hxx> - -#include "app.hrc" -#include "app.hxx" -#include "strmname.h" -#include "stlpool.hxx" -#include "strings.hrc" -#include "View.hxx" -#include "drawdoc.hxx" -#include "sdpage.hxx" -#include "glob.hrc" -#include "res_bmp.hrc" -#include "fupoor.hxx" -#include "fusearch.hxx" -#include "ViewShell.hxx" -#include "sdresid.hxx" -#include "slideshow.hxx" -#include "drawview.hxx" -#include "FrameView.hxx" -#include "unomodel.hxx" -#include "undo/undomanager.hxx" -#include "undo/undofactory.hxx" -#include "OutlineView.hxx" -#include "ViewShellBase.hxx" - -using namespace sd; -#define DrawDocShell -#include "sdslots.hxx" - -SFX_IMPL_INTERFACE(DrawDocShell, SfxObjectShell, SdResId(0)) -{ - SFX_CHILDWINDOW_REGISTRATION(SvxSearchDialogWrapper::GetChildWindowId()); -} - - -namespace sd { - -#define POOL_BUFFER_SIZE (sal_uInt16)32768 -#define BASIC_BUFFER_SIZE (sal_uInt16)8192 -#define DOCUMENT_BUFFER_SIZE (sal_uInt16)32768 - - -GraphicFilter* GetGrfFilter(); - -/************************************************************************* -|* -|* SFX-Slotmaps und -Definitionen -|* -\************************************************************************/ -TYPEINIT1( DrawDocShell, SfxObjectShell ); - -SFX_IMPL_OBJECTFACTORY( - DrawDocShell, - SvGlobalName(SO3_SIMPRESS_CLASSID), - SFXOBJECTSHELL_STD_NORMAL, - "simpress" ) - -/************************************************************************* -|* -|* Construct -|* -\************************************************************************/ - -void DrawDocShell::Construct( bool bClipboard ) -{ - mbInDestruction = sal_False; - SetSlotFilter(); // setzt Filter zurueck - - mbOwnDocument = mpDoc == 0; - if( mbOwnDocument ) - mpDoc = new SdDrawDocument(meDocType, this); - - // The document has been created so we can call UpdateRefDevice() to set - // the document's ref device. - UpdateRefDevice(); - - SetBaseModel( new SdXImpressDocument( this, bClipboard ) ); - SetPool( &mpDoc->GetItemPool() ); - mpUndoManager = new sd::UndoManager; - mpDoc->SetSdrUndoManager( mpUndoManager ); - mpDoc->SetSdrUndoFactory( new sd::UndoFactory ); - UpdateTablePointers(); - SetStyleFamily(5); //CL: eigentlich SFX_STYLE_FAMILY_PSEUDO -} - -/************************************************************************* -|* -|* Konstruktor 1 -|* -\************************************************************************/ - -DrawDocShell::DrawDocShell(SfxObjectCreateMode eMode, - sal_Bool bDataObject, - DocumentType eDocumentType) : - SfxObjectShell( eMode == SFX_CREATE_MODE_INTERNAL ? SFX_CREATE_MODE_EMBEDDED : eMode), - mpDoc(NULL), - mpUndoManager(NULL), - mpPrinter(NULL), - mpViewShell(NULL), - mpFontList(NULL), - meDocType(eDocumentType), - mpFilterSIDs(0), - mbSdDataObj(bDataObject), - mbOwnPrinter(sal_False), - mbNewDocument( sal_True ) -{ - Construct( eMode == SFX_CREATE_MODE_INTERNAL ); -} - -/************************************************************************* -|* -|* Konstruktor 2 -|* -\************************************************************************/ - -DrawDocShell::DrawDocShell( const sal_uInt64 nModelCreationFlags, sal_Bool bDataObject, DocumentType eDocumentType ) : - SfxObjectShell( nModelCreationFlags ), - mpDoc(NULL), - mpUndoManager(NULL), - mpPrinter(NULL), - mpViewShell(NULL), - mpFontList(NULL), - meDocType(eDocumentType), - mpFilterSIDs(0), - mbSdDataObj(bDataObject), - mbOwnPrinter(sal_False), - mbNewDocument( sal_True ) -{ - Construct( sal_False ); -} - -/************************************************************************* -|* -|* Konstruktor 3 -|* -\************************************************************************/ - -DrawDocShell::DrawDocShell(SdDrawDocument* pDoc, SfxObjectCreateMode eMode, - sal_Bool bDataObject, - DocumentType eDocumentType) : - SfxObjectShell(eMode == SFX_CREATE_MODE_INTERNAL ? SFX_CREATE_MODE_EMBEDDED : eMode), - mpDoc(pDoc), - mpUndoManager(NULL), - mpPrinter(NULL), - mpViewShell(NULL), - mpFontList(NULL), - meDocType(eDocumentType), - mpFilterSIDs(0), - mbSdDataObj(bDataObject), - mbOwnPrinter(sal_False), - mbNewDocument( sal_True ) -{ - Construct( eMode == SFX_CREATE_MODE_INTERNAL ); -} - -/************************************************************************* -|* -|* Destruktor -|* -\************************************************************************/ - -DrawDocShell::~DrawDocShell() -{ - // Tell all listeners that the doc shell is about to be - // destroyed. This has been introduced for the PreviewRenderer to - // free its view (that uses the item poll of the doc shell) but - // may be usefull in other places as well. - Broadcast(SfxSimpleHint(SFX_HINT_DYING)); - - mbInDestruction = sal_True; - - SetDocShellFunction(0); - - delete mpFontList; - - if( mpDoc ) - mpDoc->SetSdrUndoManager( 0 ); - delete mpUndoManager; - - if (mbOwnPrinter) - delete mpPrinter; - - if( mbOwnDocument ) - delete mpDoc; - - // damit der Navigator das Verschwinden des Dokuments mitbekommt - SfxBoolItem aItem(SID_NAVIGATOR_INIT, sal_True); - SfxViewFrame* pFrame = mpViewShell ? mpViewShell->GetFrame() : GetFrame(); - - if( !pFrame ) - pFrame = SfxViewFrame::GetFirst( this ); - - if( pFrame ) - pFrame->GetDispatcher()->Execute( - SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L); -} - -/************************************************************************* -|* -|* Slot-Stati setzen -|* -\************************************************************************/ - -void DrawDocShell::GetState(SfxItemSet &rSet) -{ - - SfxWhichIter aIter( rSet ); - sal_uInt16 nWhich = aIter.FirstWhich(); - - while ( nWhich ) - { - sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich) - ? GetPool().GetSlotId(nWhich) - : nWhich; - - switch ( nSlotId ) - { - case SID_SEARCH_ITEM: - { - rSet.Put( *SD_MOD()->GetSearchItem() ); - } - break; - - case SID_CLOSEDOC: - { - sal_Bool bDisabled = sal_False; - if (bDisabled) - { - rSet.DisableItem(SID_CLOSEDOC); - } - else - { - GetSlotState(SID_CLOSEDOC, SfxObjectShell::GetInterface(), &rSet); - } - } - break; - - case SID_SEARCH_OPTIONS: - { - sal_uInt16 nOpt = SEARCH_OPTIONS_SEARCH | - SEARCH_OPTIONS_WHOLE_WORDS | - SEARCH_OPTIONS_BACKWARDS | - SEARCH_OPTIONS_REG_EXP | - SEARCH_OPTIONS_EXACT | - SEARCH_OPTIONS_SIMILARITY | - SEARCH_OPTIONS_SELECTION; - - if (!IsReadOnly()) - { - nOpt |= SEARCH_OPTIONS_REPLACE; - nOpt |= SEARCH_OPTIONS_REPLACE_ALL; - } - - rSet.Put(SfxUInt16Item(nWhich, nOpt)); - } - break; - - case SID_VERSION: - { - GetSlotState( SID_VERSION, SfxObjectShell::GetInterface(), &rSet ); - } - break; - - case SID_CHINESE_CONVERSION: - case SID_HANGUL_HANJA_CONVERSION: - { - rSet.Put(SfxVisibilityItem(nWhich, SvtCJKOptions().IsAnyEnabled())); - } - break; - - default: - break; - } - nWhich = aIter.NextWhich(); - } - - SfxViewFrame* pFrame = SfxViewFrame::Current(); - - if (pFrame) - { - if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN) - { - pFrame->GetSlotState(SID_RELOAD, - pFrame->GetInterface(), &rSet); - } - } -} - -void DrawDocShell::InPlaceActivate( sal_Bool bActive ) -{ - ViewShell* pViewSh = NULL; - SfxViewShell* pSfxViewSh = NULL; - SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false); - std::vector<FrameView*> &rViews = mpDoc->GetFrameViewList(); - - if( !bActive ) - { - std::vector<FrameView*>::iterator pIter; - for ( pIter = rViews.begin(); pIter != rViews.end(); ++pIter ) - delete *pIter; - - rViews.clear(); - - while (pSfxViewFrame) - { - // Anzahl FrameViews ermitteln - pSfxViewSh = pSfxViewFrame->GetViewShell(); - pViewSh = PTR_CAST( ViewShell, pSfxViewSh ); - - if ( pViewSh && pViewSh->GetFrameView() ) - { - pViewSh->WriteFrameViewData(); - rViews.push_back( new FrameView( mpDoc, pViewSh->GetFrameView() ) ); - } - - pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false); - } - } - - SfxObjectShell::InPlaceActivate( bActive ); - - if( bActive ) - { - for( sal_uInt32 i = 0; pSfxViewFrame && (i < rViews.size()); i++ ) - { - // Anzahl FrameViews ermitteln - pSfxViewSh = pSfxViewFrame->GetViewShell(); - pViewSh = PTR_CAST( ViewShell, pSfxViewSh ); - - if ( pViewSh ) - { - pViewSh->ReadFrameViewData( rViews[ i ] ); - } - - pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false); - } - } -} - -/************************************************************************* -|* -|* SFX-Aktivierung -|* -\************************************************************************/ - -void DrawDocShell::Activate( sal_Bool bMDI) -{ - if (bMDI) - { - ApplySlotFilter(); - mpDoc->StartOnlineSpelling(); - } -} - -/************************************************************************* -|* -|* SFX-Deaktivierung -|* -\************************************************************************/ - -void DrawDocShell::Deactivate( sal_Bool ) -{ -} - -/************************************************************************* -|* -|* SFX-Undomanager zurueckgeben -|* -\************************************************************************/ - -::svl::IUndoManager* DrawDocShell::GetUndoManager() -{ - return mpUndoManager; -} - - - -/************************************************************************* -|* -|* Tabellenzeiger auffrischen -|* -\************************************************************************/ - -void DrawDocShell::UpdateTablePointers() -{ - PutItem( SvxColorTableItem( mpDoc->GetColorTable(), SID_COLOR_TABLE ) ); - PutItem( SvxGradientListItem( mpDoc->GetGradientList(), SID_GRADIENT_LIST ) ); - PutItem( SvxHatchListItem( mpDoc->GetHatchList(), SID_HATCH_LIST ) ); - PutItem( SvxBitmapListItem( mpDoc->GetBitmapList(), SID_BITMAP_LIST ) ); - PutItem( SvxDashListItem( mpDoc->GetDashList(), SID_DASH_LIST ) ); - PutItem( SvxLineEndListItem( mpDoc->GetLineEndList(), SID_LINEEND_LIST ) ); - - UpdateFontList(); -} - -void DrawDocShell::CancelSearching() -{ - if( dynamic_cast<FuSearch*>( mxDocShellFunction.get() ) ) - { - SetDocShellFunction(0); - } -} - -/************************************************************************* -|* -|* den eingestellten SlotFilter anwenden -|* -\************************************************************************/ - -void DrawDocShell::ApplySlotFilter() const -{ - SfxViewShell* pTestViewShell = SfxViewShell::GetFirst(); - - while( pTestViewShell ) - { - if( pTestViewShell->GetObjectShell() - == const_cast<DrawDocShell*>( this ) - && pTestViewShell->GetViewFrame() - && pTestViewShell->GetViewFrame()->GetDispatcher() ) - { - SfxDispatcher* pDispatcher = pTestViewShell->GetViewFrame()->GetDispatcher(); - - if( mpFilterSIDs ) - pDispatcher->SetSlotFilter( mbFilterEnable, mnFilterCount, mpFilterSIDs ); - else - pDispatcher->SetSlotFilter(); - - if( pDispatcher->GetBindings() ) - pDispatcher->GetBindings()->InvalidateAll( sal_True ); - } - - pTestViewShell = SfxViewShell::GetNext( *pTestViewShell ); - } -} - -void DrawDocShell::SetModified( sal_Bool bSet /* = sal_True */ ) -{ - SfxObjectShell::SetModified( bSet ); - - // change model state, too - // only set the changed state if modification is enabled - if( IsEnableSetModified() ) - { - if ( mpDoc ) - mpDoc->NbcSetChanged( bSet ); - - Broadcast( SfxSimpleHint( SFX_HINT_DOCCHANGED ) ); - } -} - -/************************************************************************* -|* -|* Callback fuer ExecuteSpellPopup() -|* -\************************************************************************/ - -// ExecuteSpellPopup now handled by DrawDocShell. This is necessary -// to get hands on the outliner and the text object. -IMPL_LINK(DrawDocShell, OnlineSpellCallback, SpellCallbackInfo*, pInfo) -{ - SdrObject* pObj = NULL; - SdrOutliner* pOutl = NULL; - - if(GetViewShell()) - { - pOutl = GetViewShell()->GetView()->GetTextEditOutliner(); - pObj = GetViewShell()->GetView()->GetTextEditObject(); - } - - mpDoc->ImpOnlineSpellCallback(pInfo, pObj, pOutl); - return(0); -} - -void DrawDocShell::ClearUndoBuffer() -{ - // clear possible undo buffers of outliners - SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false); - while(pSfxViewFrame) - { - ViewShellBase* pViewShellBase = dynamic_cast< ViewShellBase* >( pSfxViewFrame->GetViewShell() ); - if( pViewShellBase ) - { - ::boost::shared_ptr<ViewShell> pViewSh( pViewShellBase->GetMainViewShell() ); - if( pViewSh.get() ) - { - ::sd::View* pView = pViewSh->GetView(); - if( pView ) - { - pView->SdrEndTextEdit(); - sd::OutlineView* pOutlView = dynamic_cast< sd::OutlineView* >( pView ); - if( pOutlView ) - { - SdrOutliner* pOutliner = pOutlView->GetOutliner(); - if( pOutliner ) - pOutliner->GetUndoManager().Clear(); - } - } - } - } - pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false); - } - - ::svl::IUndoManager* pUndoManager = GetUndoManager(); - if(pUndoManager && pUndoManager->GetUndoActionCount()) - pUndoManager->Clear(); -} - -} // end of namespace sd - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/docshell/grdocsh.cxx b/sd/source/ui/docshell/grdocsh.cxx deleted file mode 100644 index c7620d379..000000000 --- a/sd/source/ui/docshell/grdocsh.cxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include <svx/svxids.hrc> -#include <sfx2/app.hxx> -#include <svl/srchitem.hxx> -#include <tools/globname.hxx> - -#include <sot/clsids.hxx> - -#include <sfx2/objface.hxx> - - -#include "app.hrc" -#include "strings.hrc" -#include "glob.hrc" -#include "GraphicDocShell.hxx" -#include "DrawDocShell.hxx" -#include "drawdoc.hxx" -#include "sdresid.hxx" - -using namespace sd; -#define GraphicDocShell -#include "sdgslots.hxx" - -namespace sd -{ -TYPEINIT1(GraphicDocShell, DrawDocShell); - -SFX_IMPL_INTERFACE(GraphicDocShell, SfxObjectShell, SdResId(0)) -{ - SFX_CHILDWINDOW_REGISTRATION(SID_SEARCH_DLG); -} - -SFX_IMPL_OBJECTFACTORY( GraphicDocShell, SvGlobalName(SO3_SDRAW_CLASSID_60), SFXOBJECTSHELL_STD_NORMAL, "sdraw" ) - -GraphicDocShell::GraphicDocShell(SfxObjectCreateMode eMode, - sal_Bool bDataObject, - DocumentType eDocType) : - DrawDocShell(eMode, bDataObject, eDocType) -{ - SetStyleFamily( SD_STYLE_FAMILY_GRAPHICS ); -} - -GraphicDocShell::GraphicDocShell(const sal_uInt64 nModelCreationFlags, - sal_Bool bDataObject, - DocumentType eDocType) : - DrawDocShell(nModelCreationFlags, bDataObject, eDocType) -{ - SetStyleFamily( SD_STYLE_FAMILY_GRAPHICS ); -} - -GraphicDocShell::~GraphicDocShell() -{ -} - - -} // end of namespace sd - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/docshell/sdclient.cxx b/sd/source/ui/docshell/sdclient.cxx deleted file mode 100644 index 37259d987..000000000 --- a/sd/source/ui/docshell/sdclient.cxx +++ /dev/null @@ -1,220 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "Client.hxx" -#include <com/sun/star/embed/NoVisualAreaSizeException.hpp> -#include <svx/svdoole2.hxx> -#include <svx/svdograf.hxx> -#include <svx/svdpagv.hxx> - -#include <toolkit/helper/vclunohelper.hxx> - -#include "strings.hrc" -#include "ViewShell.hxx" -#include "DrawViewShell.hxx" -#include "View.hxx" -#include "Window.hxx" -#include "sdresid.hxx" -#include <vcl/svapp.hxx> - -using namespace com::sun::star; - -namespace sd { - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -Client::Client(SdrOle2Obj* pObj, ViewShell* pViewShell, ::Window* pWindow) : - SfxInPlaceClient(pViewShell->GetViewShell(), pWindow, pObj->GetAspect() ), - mpViewShell(pViewShell), - pSdrOle2Obj(pObj), - pSdrGrafObj(NULL), - pOutlinerParaObj (NULL) -{ - SetObject( pObj->GetObjRef() ); - DBG_ASSERT( GetObject().is(), "No object connected!" ); -} - -/************************************************************************* -|* -|* Dtor -|* -\************************************************************************/ - -Client::~Client() -{ -} - - -/************************************************************************* -|* -|* Wenn IP-aktiv, dann kommt diese Anforderung um Vergroesserung des -|* sichtbaren Ausschnitts des Objektes -|* -\************************************************************************/ - -void Client::RequestNewObjectArea( Rectangle& aObjRect ) -{ - ::sd::View* pView = mpViewShell->GetView(); - - sal_Bool bSizeProtect = sal_False; - sal_Bool bPosProtect = sal_False; - - const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); - if (rMarkList.GetMarkCount() == 1) - { - SdrMark* pMark = rMarkList.GetMark(0); - SdrObject* pObj = pMark->GetMarkedSdrObj(); - - // no need to check for changes, this method is called only if the area really changed - bSizeProtect = pObj->IsResizeProtect(); - bPosProtect = pObj->IsMoveProtect(); - } - - Rectangle aOldRect = GetObjArea(); - if ( bPosProtect ) - aObjRect.SetPos( aOldRect.TopLeft() ); - - if ( bSizeProtect ) - aObjRect.SetSize( aOldRect.GetSize() ); - - Rectangle aWorkArea( pView->GetWorkArea() ); - if ( !aWorkArea.IsInside(aObjRect) && !bPosProtect && aObjRect != aOldRect ) - { - // correct position - Point aPos = aObjRect.TopLeft(); - Size aSize = aObjRect.GetSize(); - Point aWorkAreaTL = aWorkArea.TopLeft(); - Point aWorkAreaBR = aWorkArea.BottomRight(); - - aPos.X() = Max(aPos.X(), aWorkAreaTL.X()); - aPos.X() = Min(aPos.X(), aWorkAreaBR.X()-aSize.Width()); - aPos.Y() = Max(aPos.Y(), aWorkAreaTL.Y()); - aPos.Y() = Min(aPos.Y(), aWorkAreaBR.Y()-aSize.Height()); - - aObjRect.SetPos(aPos); - } -} - -void Client::ObjectAreaChanged() -{ - ::sd::View* pView = mpViewShell->GetView(); - const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); - if (rMarkList.GetMarkCount() == 1) - { - SdrMark* pMark = rMarkList.GetMark(0); - SdrObject* pObj = pMark->GetMarkedSdrObj(); - - // no need to check for changes, this method is called only if the area really changed - pObj->SetLogicRect( GetScaledObjArea() ); - } -} - -void Client::ViewChanged() -{ - if ( GetAspect() == embed::Aspects::MSOLE_ICON ) - { - // the iconified object seems not to need such a scaling handling - // since the replacement image and the size a completely controlled by the container - // TODO/LATER: when the icon exchange is implemented the scaling handling might be required again here - - pSdrOle2Obj->ActionChanged(); // draw needs it to remove lines in slide preview - return; - } - - //TODO/LATER: should we try to avoid the recalculation of the visareasize - //if we know that it didn't change? - if (mpViewShell->GetActiveWindow()) - { - ::sd::View* pView = mpViewShell->GetView(); - if (pView) - { - Rectangle aLogicRect( pSdrOle2Obj->GetLogicRect() ); - Size aLogicSize( aLogicRect.GetWidth(), aLogicRect.GetHeight() ); - - if( pSdrOle2Obj->IsChart() ) - { - //charts never should be stretched see #i84323# for example - pSdrOle2Obj->SetLogicRect( Rectangle( aLogicRect.TopLeft(), aLogicSize ) ); - pSdrOle2Obj->BroadcastObjectChange(); - return; - } - - // TODO/LEAN: maybe we can do this without requesting the VisualArea? - // working with the visual area might need running state, so the object may switch itself to this state - MapMode aMap100( MAP_100TH_MM ); - Rectangle aVisArea; - Size aSize = pSdrOle2Obj->GetOrigObjSize( &aMap100 ); - - aVisArea.SetSize( aSize ); - Size aScaledSize( static_cast< long >( GetScaleWidth() * Fraction( aVisArea.GetWidth() ) ), - static_cast< long >( GetScaleHeight() * Fraction( aVisArea.GetHeight() ) ) ); - - // react to the change if the difference is bigger than one pixel - Size aPixelDiff = - Application::GetDefaultDevice()->LogicToPixel( - Size( aLogicRect.GetWidth() - aScaledSize.Width(), - aLogicRect.GetHeight() - aScaledSize.Height() ), - aMap100 ); - if( aPixelDiff.Width() || aPixelDiff.Height() ) - { - pSdrOle2Obj->SetLogicRect( Rectangle( aLogicRect.TopLeft(), aScaledSize ) ); - pSdrOle2Obj->BroadcastObjectChange(); - } - else - pSdrOle2Obj->ActionChanged(); - } - } -} - - -/************************************************************************* -|* -|* Objekt in den sichtbaren Breich scrollen -|* -\************************************************************************/ - -void Client::MakeVisible() -{ - if (mpViewShell->ISA(DrawViewShell)) - { - static_cast<DrawViewShell*>(mpViewShell)->MakeVisible( - pSdrOle2Obj->GetLogicRect(), - *mpViewShell->GetActiveWindow()); - } -} - -} // end of namespace sd - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |