1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sd.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "DrawDocShell.hxx" 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include "app.hrc" 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #ifndef _SVXIDS_HRC 36*cdf0e10cSrcweir #include <svx/svxids.hrc> 37*cdf0e10cSrcweir #endif 38*cdf0e10cSrcweir #ifndef _SVX_DIALOGS_HRC 39*cdf0e10cSrcweir #include <svx/dialogs.hrc> 40*cdf0e10cSrcweir #endif 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #include <svx/ofaitem.hxx> 43*cdf0e10cSrcweir #include <svx/svxerr.hxx> 44*cdf0e10cSrcweir #include <svx/dialmgr.hxx> 45*cdf0e10cSrcweir #include <svl/srchitem.hxx> 46*cdf0e10cSrcweir #include <svx/srchdlg.hxx> 47*cdf0e10cSrcweir #ifdef _OUTLINER_HXX 48*cdf0e10cSrcweir #include <editeng/outliner.hxx> 49*cdf0e10cSrcweir #endif 50*cdf0e10cSrcweir #include <sfx2/request.hxx> 51*cdf0e10cSrcweir #include <svl/style.hxx> 52*cdf0e10cSrcweir #include <svx/drawitem.hxx> 53*cdf0e10cSrcweir #include <editeng/unolingu.hxx> 54*cdf0e10cSrcweir #include <com/sun/star/i18n/TextConversionOption.hpp> 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir #include "strings.hrc" 58*cdf0e10cSrcweir #include "glob.hrc" 59*cdf0e10cSrcweir #include "res_bmp.hrc" 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir #include "app.hxx" 62*cdf0e10cSrcweir #include "drawdoc.hxx" 63*cdf0e10cSrcweir #include "sdpage.hxx" 64*cdf0e10cSrcweir #include "sdattr.hxx" 65*cdf0e10cSrcweir #include "fusearch.hxx" 66*cdf0e10cSrcweir #include "ViewShell.hxx" 67*cdf0e10cSrcweir #include "View.hxx" 68*cdf0e10cSrcweir #include "slideshow.hxx" 69*cdf0e10cSrcweir #include "fuhhconv.hxx" 70*cdf0e10cSrcweir #include "slideshow.hxx" 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir using namespace ::com::sun::star; 73*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 74*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir namespace sd { 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir #define POOL_BUFFER_SIZE (sal_uInt16)32768 79*cdf0e10cSrcweir #define BASIC_BUFFER_SIZE (sal_uInt16)8192 80*cdf0e10cSrcweir #define DOCUMENT_BUFFER_SIZE (sal_uInt16)32768 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir /************************************************************************* 83*cdf0e10cSrcweir |* 84*cdf0e10cSrcweir |* SFX-Requests bearbeiten 85*cdf0e10cSrcweir |* 86*cdf0e10cSrcweir \************************************************************************/ 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir void DrawDocShell::Execute( SfxRequest& rReq ) 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir if(mpViewShell && SlideShow::IsRunning( mpViewShell->GetViewShellBase() )) 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir // during a running presentation no slot will be executed 93*cdf0e10cSrcweir return; 94*cdf0e10cSrcweir } 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir switch ( rReq.GetSlot() ) 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir case SID_SEARCH_ITEM: 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir const SfxItemSet* pReqArgs = rReq.GetArgs(); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir if (pReqArgs) 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir const SvxSearchItem* pSearchItem = 105*cdf0e10cSrcweir (const SvxSearchItem*) &pReqArgs->Get(SID_SEARCH_ITEM); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir // ein Zuweisungsoperator am SearchItem waer nicht schlecht... 108*cdf0e10cSrcweir SvxSearchItem* pAppSearchItem = SD_MOD()->GetSearchItem(); 109*cdf0e10cSrcweir delete pAppSearchItem; 110*cdf0e10cSrcweir pAppSearchItem = (SvxSearchItem*) pSearchItem->Clone(); 111*cdf0e10cSrcweir SD_MOD()->SetSearchItem(pAppSearchItem); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir rReq.Done(); 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir break; 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir case FID_SEARCH_ON: 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir // Keine Aktion noetig 121*cdf0e10cSrcweir rReq.Done(); 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir break; 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir case FID_SEARCH_OFF: 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir if( dynamic_cast< FuSearch* >(mxDocShellFunction.get()) ) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir // Suchen&Ersetzen in allen DocShells beenden 130*cdf0e10cSrcweir SfxObjectShell* pFirstShell = SfxObjectShell::GetFirst(); 131*cdf0e10cSrcweir SfxObjectShell* pShell = pFirstShell; 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir while (pShell) 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir if (pShell->ISA(DrawDocShell)) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir ( (DrawDocShell*) pShell)->CancelSearching(); 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir pShell = SfxObjectShell::GetNext(*pShell); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir if (pShell == pFirstShell) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir pShell = NULL; 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir SetDocShellFunction(0); 149*cdf0e10cSrcweir Invalidate(); 150*cdf0e10cSrcweir rReq.Done(); 151*cdf0e10cSrcweir } 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir break; 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir case FID_SEARCH_NOW: 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir const SfxItemSet* pReqArgs = rReq.GetArgs(); 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir if ( pReqArgs ) 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir rtl::Reference< FuSearch > xFuSearch( dynamic_cast< FuSearch* >( GetDocShellFunction().get() ) ); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir if( !xFuSearch.is() && mpViewShell ) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir ::sd::View* pView = mpViewShell->GetView(); 166*cdf0e10cSrcweir SetDocShellFunction( FuSearch::Create( mpViewShell, mpViewShell->GetActiveWindow(), pView, mpDoc, rReq ) ); 167*cdf0e10cSrcweir xFuSearch.set( dynamic_cast< FuSearch* >( GetDocShellFunction().get() ) ); 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir if( xFuSearch.is() ) 171*cdf0e10cSrcweir { 172*cdf0e10cSrcweir const SvxSearchItem* pSearchItem = 173*cdf0e10cSrcweir (const SvxSearchItem*) &pReqArgs->Get(SID_SEARCH_ITEM); 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir // ein Zuweisungsoperator am SearchItem waer nicht schlecht... 176*cdf0e10cSrcweir SvxSearchItem* pAppSearchItem = SD_MOD()->GetSearchItem(); 177*cdf0e10cSrcweir delete pAppSearchItem; 178*cdf0e10cSrcweir pAppSearchItem = (SvxSearchItem*)pSearchItem->Clone(); 179*cdf0e10cSrcweir SD_MOD()->SetSearchItem(pAppSearchItem); 180*cdf0e10cSrcweir xFuSearch->SearchAndReplace(pSearchItem); 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir rReq.Done(); 185*cdf0e10cSrcweir } 186*cdf0e10cSrcweir break; 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir case SID_CLOSEDOC: 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir // SfxObjectShell::DoClose(); 191*cdf0e10cSrcweir ExecuteSlot(rReq, SfxObjectShell::GetStaticInterface()); 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir break; 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir case SID_GET_COLORTABLE: 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir // passende ColorTable ist per PutItem gesetzt worden 198*cdf0e10cSrcweir SvxColorTableItem* pColItem = (SvxColorTableItem*) GetItem( SID_COLOR_TABLE ); 199*cdf0e10cSrcweir XColorTable* pTable = pColItem->GetColorTable(); 200*cdf0e10cSrcweir rReq.SetReturnValue( OfaPtrItem( SID_GET_COLORTABLE, pTable ) ); 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir break; 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir case SID_VERSION: 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir const sal_uLong nOldSwapMode = mpDoc->GetSwapGraphicsMode(); 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir mpDoc->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP ); 209*cdf0e10cSrcweir ExecuteSlot( rReq, SfxObjectShell::GetStaticInterface() ); 210*cdf0e10cSrcweir mpDoc->SetSwapGraphicsMode( nOldSwapMode ); 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir break; 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir case SID_HANGUL_HANJA_CONVERSION: 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir if( mpViewShell ) 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir FunctionReference aFunc( FuHangulHanjaConversion::Create( mpViewShell, mpViewShell->GetActiveWindow(), mpViewShell->GetView(), mpDoc, rReq ) ); 219*cdf0e10cSrcweir static_cast< FuHangulHanjaConversion* >( aFunc.get() )->StartConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL, i18n::TextConversionOption::CHARACTER_BY_CHARACTER, sal_True ); 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir break; 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir case SID_CHINESE_CONVERSION: 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir if( mpViewShell ) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir FunctionReference aFunc( FuHangulHanjaConversion::Create( mpViewShell, mpViewShell->GetActiveWindow(), mpViewShell->GetView(), mpDoc, rReq ) ); 229*cdf0e10cSrcweir static_cast< FuHangulHanjaConversion* >( aFunc.get() )->StartChineseConversion(); 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir break; 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir default: 235*cdf0e10cSrcweir break; 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir /************************************************************************* 240*cdf0e10cSrcweir |* 241*cdf0e10cSrcweir |* Suchmaske fuer Organizer 242*cdf0e10cSrcweir |* 243*cdf0e10cSrcweir \************************************************************************/ 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir void DrawDocShell::SetOrganizerSearchMask(SfxStyleSheetBasePool* pBasePool) const 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir pBasePool->SetSearchMask(SD_STYLE_FAMILY_GRAPHICS, SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED); 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir void DrawDocShell::SetDocShellFunction( const ::sd::FunctionReference& xFunction ) 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir if( mxDocShellFunction.is() ) 254*cdf0e10cSrcweir mxDocShellFunction->Dispose(); 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir mxDocShellFunction = xFunction; 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir } // end of namespace sd 260