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