merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / docshell / docshel3.cxx
blob814800c8b5ca964038280a62ebea1ad3bb41c346
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docshel3.cxx,v $
10 * $Revision: 1.24 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include "DrawDocShell.hxx"
36 #include "app.hrc"
38 #ifndef _SVXIDS_HRC
39 #include <svx/svxids.hrc>
40 #endif
41 #ifndef _SVX_DIALOGS_HRC
42 #include <svx/dialogs.hrc>
43 #endif
45 #include <svx/ofaitem.hxx>
46 #include <svx/svxerr.hxx>
47 #include <svx/dialmgr.hxx>
48 #include <sfx2/srchitem.hxx>
49 #include <svx/srchdlg.hxx>
50 #ifdef _OUTLINER_HXX
51 #include <svx/outliner.hxx>
52 #endif
53 #include <sfx2/request.hxx>
54 #include <svtools/style.hxx>
55 #include <svx/drawitem.hxx>
56 #include <svx/unolingu.hxx>
57 #include <com/sun/star/i18n/TextConversionOption.hpp>
60 #include "strings.hrc"
61 #include "glob.hrc"
62 #include "res_bmp.hrc"
64 #include "app.hxx"
65 #include "drawdoc.hxx"
66 #include "sdpage.hxx"
67 #include "sdattr.hxx"
68 #include "fusearch.hxx"
69 #include "ViewShell.hxx"
70 #include "View.hxx"
71 #include "slideshow.hxx"
72 #include "fuhhconv.hxx"
73 #include "slideshow.hxx"
75 using namespace ::com::sun::star;
76 using namespace ::com::sun::star::beans;
77 using namespace ::com::sun::star::uno;
79 namespace sd {
81 #define POOL_BUFFER_SIZE (USHORT)32768
82 #define BASIC_BUFFER_SIZE (USHORT)8192
83 #define DOCUMENT_BUFFER_SIZE (USHORT)32768
85 /*************************************************************************
87 |* SFX-Requests bearbeiten
89 \************************************************************************/
91 void DrawDocShell::Execute( SfxRequest& rReq )
93 if(mpViewShell && SlideShow::IsRunning( mpViewShell->GetViewShellBase() ))
95 // during a running presentation no slot will be executed
96 return;
99 switch ( rReq.GetSlot() )
101 case SID_SEARCH_ITEM:
103 const SfxItemSet* pReqArgs = rReq.GetArgs();
105 if (pReqArgs)
107 const SvxSearchItem* pSearchItem =
108 (const SvxSearchItem*) &pReqArgs->Get(SID_SEARCH_ITEM);
110 // ein Zuweisungsoperator am SearchItem waer nicht schlecht...
111 SvxSearchItem* pAppSearchItem = SD_MOD()->GetSearchItem();
112 delete pAppSearchItem;
113 pAppSearchItem = (SvxSearchItem*) pSearchItem->Clone();
114 SD_MOD()->SetSearchItem(pAppSearchItem);
117 rReq.Done();
119 break;
121 case FID_SEARCH_ON:
123 // Keine Aktion noetig
124 rReq.Done();
126 break;
128 case FID_SEARCH_OFF:
130 if( dynamic_cast< FuSearch* >(mxDocShellFunction.get()) )
132 // Suchen&Ersetzen in allen DocShells beenden
133 SfxObjectShell* pFirstShell = SfxObjectShell::GetFirst();
134 SfxObjectShell* pShell = pFirstShell;
136 while (pShell)
138 if (pShell->ISA(DrawDocShell))
140 ( (DrawDocShell*) pShell)->CancelSearching();
143 pShell = SfxObjectShell::GetNext(*pShell);
145 if (pShell == pFirstShell)
147 pShell = NULL;
151 SetDocShellFunction(0);
152 Invalidate();
153 rReq.Done();
156 break;
158 case FID_SEARCH_NOW:
160 const SfxItemSet* pReqArgs = rReq.GetArgs();
162 if ( pReqArgs )
164 rtl::Reference< FuSearch > xFuSearch( dynamic_cast< FuSearch* >( GetDocShellFunction().get() ) );
166 if( !xFuSearch.is() && mpViewShell )
168 ::sd::View* pView = mpViewShell->GetView();
169 SetDocShellFunction( FuSearch::Create( mpViewShell, mpViewShell->GetActiveWindow(), pView, mpDoc, rReq ) );
170 xFuSearch.set( dynamic_cast< FuSearch* >( GetDocShellFunction().get() ) );
173 if( xFuSearch.is() )
175 const SvxSearchItem* pSearchItem =
176 (const SvxSearchItem*) &pReqArgs->Get(SID_SEARCH_ITEM);
178 // ein Zuweisungsoperator am SearchItem waer nicht schlecht...
179 SvxSearchItem* pAppSearchItem = SD_MOD()->GetSearchItem();
180 delete pAppSearchItem;
181 pAppSearchItem = (SvxSearchItem*)pSearchItem->Clone();
182 SD_MOD()->SetSearchItem(pAppSearchItem);
183 xFuSearch->SearchAndReplace(pSearchItem);
187 rReq.Done();
189 break;
191 case SID_CLOSEDOC:
193 // SfxObjectShell::DoClose();
194 ExecuteSlot(rReq, SfxObjectShell::GetStaticInterface());
196 break;
198 case SID_GET_COLORTABLE:
200 // passende ColorTable ist per PutItem gesetzt worden
201 SvxColorTableItem* pColItem = (SvxColorTableItem*) GetItem( SID_COLOR_TABLE );
202 XColorTable* pTable = pColItem->GetColorTable();
203 rReq.SetReturnValue( OfaPtrItem( SID_GET_COLORTABLE, pTable ) );
205 break;
207 case SID_VERSION:
209 const ULONG nOldSwapMode = mpDoc->GetSwapGraphicsMode();
211 mpDoc->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP );
212 ExecuteSlot( rReq, SfxObjectShell::GetStaticInterface() );
213 mpDoc->SetSwapGraphicsMode( nOldSwapMode );
215 break;
217 case SID_HANGUL_HANJA_CONVERSION:
219 if( mpViewShell )
221 FunctionReference aFunc( FuHangulHanjaConversion::Create( mpViewShell, mpViewShell->GetActiveWindow(), mpViewShell->GetView(), mpDoc, rReq ) );
222 static_cast< FuHangulHanjaConversion* >( aFunc.get() )->StartConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL, i18n::TextConversionOption::CHARACTER_BY_CHARACTER, sal_True );
225 break;
227 case SID_CHINESE_CONVERSION:
229 if( mpViewShell )
231 FunctionReference aFunc( FuHangulHanjaConversion::Create( mpViewShell, mpViewShell->GetActiveWindow(), mpViewShell->GetView(), mpDoc, rReq ) );
232 static_cast< FuHangulHanjaConversion* >( aFunc.get() )->StartChineseConversion();
235 break;
237 default:
238 break;
242 /*************************************************************************
244 |* Suchmaske fuer Organizer
246 \************************************************************************/
248 void DrawDocShell::SetOrganizerSearchMask(SfxStyleSheetBasePool* pBasePool) const
250 pBasePool->SetSearchMask(SD_STYLE_FAMILY_GRAPHICS, SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED);
254 void DrawDocShell::SetDocShellFunction( const ::sd::FunctionReference& xFunction )
256 if( mxDocShellFunction.is() )
257 mxDocShellFunction->Dispose();
259 mxDocShellFunction = xFunction;
262 } // end of namespace sd