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