1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docshel3.cxx,v $
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"
39 #include <svx/svxids.hrc>
41 #ifndef _SVX_DIALOGS_HRC
42 #include <svx/dialogs.hrc>
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>
51 #include <svx/outliner.hxx>
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"
62 #include "res_bmp.hrc"
65 #include "drawdoc.hxx"
68 #include "fusearch.hxx"
69 #include "ViewShell.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
;
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
99 switch ( rReq
.GetSlot() )
101 case SID_SEARCH_ITEM
:
103 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
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
);
123 // Keine Aktion noetig
130 if( dynamic_cast< FuSearch
* >(mxDocShellFunction
.get()) )
132 // Suchen&Ersetzen in allen DocShells beenden
133 SfxObjectShell
* pFirstShell
= SfxObjectShell::GetFirst();
134 SfxObjectShell
* pShell
= pFirstShell
;
138 if (pShell
->ISA(DrawDocShell
))
140 ( (DrawDocShell
*) pShell
)->CancelSearching();
143 pShell
= SfxObjectShell::GetNext(*pShell
);
145 if (pShell
== pFirstShell
)
151 SetDocShellFunction(0);
160 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
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() ) );
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
);
193 // SfxObjectShell::DoClose();
194 ExecuteSlot(rReq
, SfxObjectShell::GetStaticInterface());
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
) );
209 const ULONG nOldSwapMode
= mpDoc
->GetSwapGraphicsMode();
211 mpDoc
->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP
);
212 ExecuteSlot( rReq
, SfxObjectShell::GetStaticInterface() );
213 mpDoc
->SetSwapGraphicsMode( nOldSwapMode
);
217 case SID_HANGUL_HANJA_CONVERSION
:
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
);
227 case SID_CHINESE_CONVERSION
:
231 FunctionReference
aFunc( FuHangulHanjaConversion::Create( mpViewShell
, mpViewShell
->GetActiveWindow(), mpViewShell
->GetView(), mpDoc
, rReq
) );
232 static_cast< FuHangulHanjaConversion
* >( aFunc
.get() )->StartChineseConversion();
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