xref: /AOO41X/main/sfx2/source/appl/appuno.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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_sfx2.hxx"
30*cdf0e10cSrcweir #if defined(_MSC_VER) && (_MSC_VER >= 1300)
31*cdf0e10cSrcweir #pragma warning( disable : 4290 )
32*cdf0e10cSrcweir #endif
33*cdf0e10cSrcweir #include <com/sun/star/document/UpdateDocMode.hpp>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include "sal/config.h"
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir #include <sfx2/appuno.hxx>
38*cdf0e10cSrcweir #include "appbaslib.hxx"
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #include "sfx2/dllapi.h"
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include <basic/sbx.hxx>
43*cdf0e10cSrcweir #include <svl/itempool.hxx>
44*cdf0e10cSrcweir #include <svl/rectitem.hxx>
45*cdf0e10cSrcweir #include <tools/debug.hxx>
46*cdf0e10cSrcweir #include <tools/wldcrd.hxx>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #include <tools/urlobj.hxx>
49*cdf0e10cSrcweir #include <tools/config.hxx>
50*cdf0e10cSrcweir #include <basic/sbxmeth.hxx>
51*cdf0e10cSrcweir #include <basic/sbmeth.hxx>
52*cdf0e10cSrcweir #include <basic/sbxobj.hxx>
53*cdf0e10cSrcweir #include <basic/sberrors.hxx>
54*cdf0e10cSrcweir #include <basic/basmgr.hxx>
55*cdf0e10cSrcweir #include <basic/sbuno.hxx>
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir #include <basic/sbxcore.hxx>
58*cdf0e10cSrcweir #include <svl/ownlist.hxx>
59*cdf0e10cSrcweir #include <svl/lckbitem.hxx>
60*cdf0e10cSrcweir #include <svl/stritem.hxx>
61*cdf0e10cSrcweir #include <svl/slstitm.hxx>
62*cdf0e10cSrcweir #include <svl/intitem.hxx>
63*cdf0e10cSrcweir #include <svl/eitem.hxx>
64*cdf0e10cSrcweir #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
65*cdf0e10cSrcweir #include <com/sun/star/task/XInteractionHandler.hpp>
66*cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp>
67*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
68*cdf0e10cSrcweir #include <com/sun/star/frame/XFrameActionListener.hpp>
69*cdf0e10cSrcweir #include <com/sun/star/frame/XComponentLoader.hpp>
70*cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
71*cdf0e10cSrcweir #include <com/sun/star/frame/FrameActionEvent.hpp>
72*cdf0e10cSrcweir #include <com/sun/star/frame/FrameAction.hpp>
73*cdf0e10cSrcweir #include <com/sun/star/container/XContainer.hpp>
74*cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp>
75*cdf0e10cSrcweir #include <com/sun/star/container/XNameReplace.hpp>
76*cdf0e10cSrcweir #include <com/sun/star/container/XContainerListener.hpp>
77*cdf0e10cSrcweir #include <com/sun/star/container/XSet.hpp>
78*cdf0e10cSrcweir #include <com/sun/star/container/ContainerEvent.hpp>
79*cdf0e10cSrcweir #include <com/sun/star/container/XIndexReplace.hpp>
80*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
81*cdf0e10cSrcweir #include <com/sun/star/awt/XTopWindow.hpp>
82*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
83*cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp>
84*cdf0e10cSrcweir #include <com/sun/star/registry/RegistryValueType.hpp>
85*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
86*cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp>
87*cdf0e10cSrcweir #include <com/sun/star/awt/XButton.hpp>
88*cdf0e10cSrcweir #include <com/sun/star/frame/DispatchResultEvent.hpp>
89*cdf0e10cSrcweir #include <com/sun/star/frame/DispatchResultState.hpp>
90*cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
91*cdf0e10cSrcweir #include <com/sun/star/document/MacroExecMode.hpp>
92*cdf0e10cSrcweir #include <com/sun/star/ucb/XContent.hpp>
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir #include <tools/cachestr.hxx>
95*cdf0e10cSrcweir #include <osl/mutex.hxx>
96*cdf0e10cSrcweir #include <comphelper/sequence.hxx>
97*cdf0e10cSrcweir #include <framework/documentundoguard.hxx>
98*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
99*cdf0e10cSrcweir #include <comphelper/interaction.hxx>
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir using namespace ::com::sun::star;
102*cdf0e10cSrcweir using namespace ::com::sun::star::ucb;
103*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
104*cdf0e10cSrcweir using namespace ::com::sun::star::registry;
105*cdf0e10cSrcweir using namespace ::com::sun::star::frame;
106*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
107*cdf0e10cSrcweir using namespace ::com::sun::star::io;
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir #include "sfxtypes.hxx"
110*cdf0e10cSrcweir #include <sfx2/sfxuno.hxx>
111*cdf0e10cSrcweir #include <sfx2/app.hxx>
112*cdf0e10cSrcweir #include <sfx2/sfxsids.hrc>
113*cdf0e10cSrcweir #include <sfx2/msg.hxx>
114*cdf0e10cSrcweir #include <sfx2/msgpool.hxx>
115*cdf0e10cSrcweir #include <sfx2/request.hxx>
116*cdf0e10cSrcweir #include <sfx2/module.hxx>
117*cdf0e10cSrcweir #include <sfx2/fcontnr.hxx>
118*cdf0e10cSrcweir #include "frmload.hxx"
119*cdf0e10cSrcweir #include <sfx2/frame.hxx>
120*cdf0e10cSrcweir #include <sfx2/objsh.hxx>
121*cdf0e10cSrcweir #include <sfx2/objuno.hxx>
122*cdf0e10cSrcweir #include <sfx2/unoctitm.hxx>
123*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
124*cdf0e10cSrcweir #include "doctemplates.hxx"
125*cdf0e10cSrcweir #include "shutdownicon.hxx"
126*cdf0e10cSrcweir #include "objshimp.hxx"
127*cdf0e10cSrcweir #include "fltoptint.hxx"
128*cdf0e10cSrcweir #include <sfx2/docfile.hxx>
129*cdf0e10cSrcweir #include <sfx2/sfxbasecontroller.hxx>
130*cdf0e10cSrcweir #include <sfx2/brokenpackageint.hxx>
131*cdf0e10cSrcweir #include "eventsupplier.hxx"
132*cdf0e10cSrcweir #include "xpackcreator.hxx"
133*cdf0e10cSrcweir #include "plugin.hxx"
134*cdf0e10cSrcweir #include "iframe.hxx"
135*cdf0e10cSrcweir #include <ownsubfilterservice.hxx>
136*cdf0e10cSrcweir #include "SfxDocumentMetaData.hxx"
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir #define FRAMELOADER_SERVICENAME         "com.sun.star.frame.FrameLoader"
139*cdf0e10cSrcweir #define PROTOCOLHANDLER_SERVICENAME     "com.sun.star.frame.ProtocolHandler"
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir static char const sTemplateRegionName[] = "TemplateRegionName";
142*cdf0e10cSrcweir static char const sTemplateName[] = "TemplateName";
143*cdf0e10cSrcweir static char const sAsTemplate[] = "AsTemplate";
144*cdf0e10cSrcweir static char const sOpenNewView[] = "OpenNewView";
145*cdf0e10cSrcweir static char const sViewId[] = "ViewId";
146*cdf0e10cSrcweir static char const sPluginMode[] = "PluginMode";
147*cdf0e10cSrcweir static char const sReadOnly[] = "ReadOnly";
148*cdf0e10cSrcweir static char const sStartPresentation[] = "StartPresentation";
149*cdf0e10cSrcweir static char const sFrameName[] = "FrameName";
150*cdf0e10cSrcweir static char const sMediaType[] = "MediaType";
151*cdf0e10cSrcweir static char const sPostData[] = "PostData";
152*cdf0e10cSrcweir static char const sCharacterSet[] = "CharacterSet";
153*cdf0e10cSrcweir static char const sInputStream[] = "InputStream";
154*cdf0e10cSrcweir static char const sStream[] = "Stream";
155*cdf0e10cSrcweir static char const sOutputStream[] = "OutputStream";
156*cdf0e10cSrcweir static char const sHidden[] = "Hidden";
157*cdf0e10cSrcweir static char const sPreview[] = "Preview";
158*cdf0e10cSrcweir static char const sViewOnly[] = "ViewOnly";
159*cdf0e10cSrcweir static char const sDontEdit[] = "DontEdit";
160*cdf0e10cSrcweir static char const sSilent[] = "Silent";
161*cdf0e10cSrcweir static char const sJumpMark[] = "JumpMark";
162*cdf0e10cSrcweir static char const sFileName[] = "FileName";
163*cdf0e10cSrcweir static char const sSalvagedFile[] = "SalvagedFile";
164*cdf0e10cSrcweir static char const sStatusInd[] = "StatusIndicator";
165*cdf0e10cSrcweir static char const sModel[] = "Model";
166*cdf0e10cSrcweir static char const sFrame[] = "Frame";
167*cdf0e10cSrcweir static char const sViewData[] = "ViewData";
168*cdf0e10cSrcweir static char const sFilterData[] = "FilterData";
169*cdf0e10cSrcweir static char const sSelectionOnly[] = "SelectionOnly";
170*cdf0e10cSrcweir static char const sFilterFlags[] = "FilterFlags";
171*cdf0e10cSrcweir static char const sMacroExecMode[] = "MacroExecutionMode";
172*cdf0e10cSrcweir static char const sUpdateDocMode[] = "UpdateDocMode";
173*cdf0e10cSrcweir static char const sMinimized[] = "Minimized";
174*cdf0e10cSrcweir static char const sInteractionHdl[] = "InteractionHandler";
175*cdf0e10cSrcweir static char const sUCBContent[] = "UCBContent";
176*cdf0e10cSrcweir static char const sRepairPackage[] = "RepairPackage";
177*cdf0e10cSrcweir static char const sDocumentTitle[] = "DocumentTitle";
178*cdf0e10cSrcweir static char const sComponentData[] = "ComponentData";
179*cdf0e10cSrcweir static char const sComponentContext[] = "ComponentContext";
180*cdf0e10cSrcweir static char const sDocumentBaseURL[] = "DocumentBaseURL";
181*cdf0e10cSrcweir static char const sHierarchicalDocumentName[] = "HierarchicalDocumentName";
182*cdf0e10cSrcweir static char const sCopyStreamIfPossible[] = "CopyStreamIfPossible";
183*cdf0e10cSrcweir static char const sNoAutoSave[] = "NoAutoSave";
184*cdf0e10cSrcweir static char const sFolderName[] = "FolderName";
185*cdf0e10cSrcweir static char const sUseSystemDialog[] = "UseSystemDialog";
186*cdf0e10cSrcweir static char const sStandardDir[] = "StandardDir";
187*cdf0e10cSrcweir static char const sBlackList[] = "BlackList";
188*cdf0e10cSrcweir static char const sModifyPasswordInfo[] = "ModifyPasswordInfo";
189*cdf0e10cSrcweir static char const sSuggestedSaveAsDir[] = "SuggestedSaveAsDir";
190*cdf0e10cSrcweir static char const sSuggestedSaveAsName[] = "SuggestedSaveAsName";
191*cdf0e10cSrcweir static char const sEncryptionData[] = "EncryptionData";
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot )
195*cdf0e10cSrcweir {
196*cdf0e10cSrcweir     if ( !pSlot )
197*cdf0e10cSrcweir         pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir     if ( !pSlot )
200*cdf0e10cSrcweir         return;
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir     if ( nSlotId == SID_OPENURL )
203*cdf0e10cSrcweir         nSlotId = SID_OPENDOC;
204*cdf0e10cSrcweir     if ( nSlotId == SID_SAVEASURL )
205*cdf0e10cSrcweir         nSlotId = SID_SAVEASDOC;
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir     sal_Int32 nCount = rArgs.getLength();
208*cdf0e10cSrcweir     if ( !nCount )
209*cdf0e10cSrcweir         return;
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir     const ::com::sun::star::beans::PropertyValue* pPropsVal = rArgs.getConstArray();
212*cdf0e10cSrcweir     if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
213*cdf0e10cSrcweir     {
214*cdf0e10cSrcweir         // slot is a property
215*cdf0e10cSrcweir         const SfxType* pType = pSlot->GetType();
216*cdf0e10cSrcweir         SfxPoolItem* pItem = pType->CreateItem();
217*cdf0e10cSrcweir         if ( !pItem )
218*cdf0e10cSrcweir         {
219*cdf0e10cSrcweir #ifdef DBG_UTIL
220*cdf0e10cSrcweir             ByteString aStr( "No creator method for item: ");
221*cdf0e10cSrcweir             aStr += ByteString::CreateFromInt32( nSlotId );
222*cdf0e10cSrcweir             DBG_ERROR( aStr.GetBuffer() );
223*cdf0e10cSrcweir #endif
224*cdf0e10cSrcweir             return;
225*cdf0e10cSrcweir         }
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir         sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
228*cdf0e10cSrcweir         sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
229*cdf0e10cSrcweir         pItem->SetWhich( nWhich );
230*cdf0e10cSrcweir         sal_uInt16 nSubCount = pType->nAttribs;
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir         const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[0];
233*cdf0e10cSrcweir         String aName = rProp.Name;
234*cdf0e10cSrcweir         if ( nCount == 1 && aName.CompareToAscii( pSlot->pUnoName ) == COMPARE_EQUAL )
235*cdf0e10cSrcweir         {
236*cdf0e10cSrcweir             // there is only one parameter and its name matches the name of the property,
237*cdf0e10cSrcweir             // so it's either a simple property or a complex property in one single UNO struct
238*cdf0e10cSrcweir             if( pItem->PutValue( rProp.Value, bConvertTwips ? CONVERT_TWIPS : 0 ) )
239*cdf0e10cSrcweir                 // only use successfully converted items
240*cdf0e10cSrcweir                 rSet.Put( *pItem );
241*cdf0e10cSrcweir #ifdef DBG_UTIL
242*cdf0e10cSrcweir             else
243*cdf0e10cSrcweir             {
244*cdf0e10cSrcweir                 ByteString aStr( "Property not convertable: ");
245*cdf0e10cSrcweir                 aStr += pSlot->pUnoName;
246*cdf0e10cSrcweir                 DBG_ERROR( aStr.GetBuffer() );
247*cdf0e10cSrcweir             }
248*cdf0e10cSrcweir #endif
249*cdf0e10cSrcweir         }
250*cdf0e10cSrcweir #ifdef DBG_UTIL
251*cdf0e10cSrcweir         else if ( nSubCount == 0 )
252*cdf0e10cSrcweir         {
253*cdf0e10cSrcweir             // for a simple property there can be only one parameter and its name *must* match
254*cdf0e10cSrcweir             ByteString aStr( "Property name does not match: ");
255*cdf0e10cSrcweir             aStr += ByteString( aName, RTL_TEXTENCODING_UTF8 );
256*cdf0e10cSrcweir             DBG_ERROR( aStr.GetBuffer() );
257*cdf0e10cSrcweir         }
258*cdf0e10cSrcweir #endif
259*cdf0e10cSrcweir         else
260*cdf0e10cSrcweir         {
261*cdf0e10cSrcweir             // there is more than one parameter and the property is a complex one
262*cdf0e10cSrcweir #ifdef DBG_UTIL
263*cdf0e10cSrcweir             // if the dispatch API is used for UI purposes or from the testtool,
264*cdf0e10cSrcweir             // it is possible to skip some or all arguments,
265*cdf0e10cSrcweir             // but it indicates an error for macro recording;
266*cdf0e10cSrcweir             // so this should be notified as a warning only
267*cdf0e10cSrcweir             if ( nCount != nSubCount )
268*cdf0e10cSrcweir             {
269*cdf0e10cSrcweir                 ByteString aStr( "MacroPlayer: wrong number of parameters for slot: ");
270*cdf0e10cSrcweir                 aStr += ByteString::CreateFromInt32( nSlotId );
271*cdf0e10cSrcweir                 DBG_WARNING( aStr.GetBuffer() );
272*cdf0e10cSrcweir             }
273*cdf0e10cSrcweir #endif
274*cdf0e10cSrcweir             // complex property; collect sub items from the parameter set and reconstruct complex item
275*cdf0e10cSrcweir             sal_uInt16 nFound=0;
276*cdf0e10cSrcweir             for ( sal_uInt16 n=0; n<nCount; n++ )
277*cdf0e10cSrcweir             {
278*cdf0e10cSrcweir                 const ::com::sun::star::beans::PropertyValue& rPropValue = pPropsVal[n];
279*cdf0e10cSrcweir                 sal_uInt16 nSub;
280*cdf0e10cSrcweir                 for ( nSub=0; nSub<nSubCount; nSub++ )
281*cdf0e10cSrcweir                 {
282*cdf0e10cSrcweir                     // search sub item by name
283*cdf0e10cSrcweir                     ByteString aStr( pSlot->pUnoName );
284*cdf0e10cSrcweir                     aStr += '.';
285*cdf0e10cSrcweir                     aStr += ByteString( pType->aAttrib[nSub].pName );
286*cdf0e10cSrcweir                     const char* pName = aStr.GetBuffer();
287*cdf0e10cSrcweir                     if ( rPropValue.Name.compareToAscii( pName ) == COMPARE_EQUAL )
288*cdf0e10cSrcweir                     {
289*cdf0e10cSrcweir                         sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID;
290*cdf0e10cSrcweir                         if ( bConvertTwips )
291*cdf0e10cSrcweir                             nSubId |= CONVERT_TWIPS;
292*cdf0e10cSrcweir                         if ( pItem->PutValue( rPropValue.Value, nSubId ) )
293*cdf0e10cSrcweir                             nFound++;
294*cdf0e10cSrcweir #ifdef DBG_UTIL
295*cdf0e10cSrcweir                         else
296*cdf0e10cSrcweir                         {
297*cdf0e10cSrcweir                             ByteString aDbgStr( "Property not convertable: ");
298*cdf0e10cSrcweir                             aDbgStr += pSlot->pUnoName;
299*cdf0e10cSrcweir                             DBG_ERROR( aDbgStr.GetBuffer() );
300*cdf0e10cSrcweir                         }
301*cdf0e10cSrcweir #endif
302*cdf0e10cSrcweir                         break;
303*cdf0e10cSrcweir                     }
304*cdf0e10cSrcweir                 }
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir #ifdef DBG_UTIL
307*cdf0e10cSrcweir                 if ( nSub >= nSubCount )
308*cdf0e10cSrcweir                 {
309*cdf0e10cSrcweir                     // there was a parameter with a name that didn't match to any of the members
310*cdf0e10cSrcweir                     ByteString aStr( "Property name does not match: ");
311*cdf0e10cSrcweir                     aStr += ByteString( String(rPropValue.Name), RTL_TEXTENCODING_UTF8 );
312*cdf0e10cSrcweir                     DBG_ERROR( aStr.GetBuffer() );
313*cdf0e10cSrcweir                 }
314*cdf0e10cSrcweir #endif
315*cdf0e10cSrcweir             }
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir             // at least one part of the complex item must be present; other parts can have default values
318*cdf0e10cSrcweir             if ( nFound > 0 )
319*cdf0e10cSrcweir                 rSet.Put( *pItem );
320*cdf0e10cSrcweir         }
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir         delete pItem;
323*cdf0e10cSrcweir     }
324*cdf0e10cSrcweir     else if ( nCount )
325*cdf0e10cSrcweir     {
326*cdf0e10cSrcweir #ifdef DBG_UTIL
327*cdf0e10cSrcweir         // detect parameters that don't match to any formal argument or one of its members
328*cdf0e10cSrcweir         sal_Int32 nFoundArgs = 0;
329*cdf0e10cSrcweir #endif
330*cdf0e10cSrcweir         // slot is a method
331*cdf0e10cSrcweir         for ( sal_uInt16 nArgs=0; nArgs<pSlot->nArgDefCount; nArgs++ )
332*cdf0e10cSrcweir         {
333*cdf0e10cSrcweir             const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArgs );
334*cdf0e10cSrcweir             SfxPoolItem* pItem = rArg.CreateItem();
335*cdf0e10cSrcweir             if ( !pItem )
336*cdf0e10cSrcweir             {
337*cdf0e10cSrcweir #ifdef DBG_UTIL
338*cdf0e10cSrcweir                 ByteString aStr( "No creator method for argument: ");
339*cdf0e10cSrcweir                 aStr += rArg.pName;
340*cdf0e10cSrcweir                 DBG_ERROR( aStr.GetBuffer() );
341*cdf0e10cSrcweir #endif
342*cdf0e10cSrcweir                 return;
343*cdf0e10cSrcweir             }
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir             sal_uInt16 nWhich = rSet.GetPool()->GetWhich(rArg.nSlotId);
346*cdf0e10cSrcweir             sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
347*cdf0e10cSrcweir             pItem->SetWhich( nWhich );
348*cdf0e10cSrcweir             const SfxType* pType = rArg.pType;
349*cdf0e10cSrcweir             sal_uInt16 nSubCount = pType->nAttribs;
350*cdf0e10cSrcweir             if ( nSubCount == 0 )
351*cdf0e10cSrcweir             {
352*cdf0e10cSrcweir                 // "simple" (base type) argument
353*cdf0e10cSrcweir                 for ( sal_uInt16 n=0; n<nCount; n++ )
354*cdf0e10cSrcweir                 {
355*cdf0e10cSrcweir                     const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
356*cdf0e10cSrcweir                     String aName = rProp.Name;
357*cdf0e10cSrcweir                     if ( aName.CompareToAscii(rArg.pName) == COMPARE_EQUAL )
358*cdf0e10cSrcweir                     {
359*cdf0e10cSrcweir #ifdef DBG_UTIL
360*cdf0e10cSrcweir                         ++nFoundArgs;
361*cdf0e10cSrcweir #endif
362*cdf0e10cSrcweir                         if( pItem->PutValue( rProp.Value ) )
363*cdf0e10cSrcweir                             // only use successfully converted items
364*cdf0e10cSrcweir                             rSet.Put( *pItem );
365*cdf0e10cSrcweir #ifdef DBG_UTIL
366*cdf0e10cSrcweir                         else
367*cdf0e10cSrcweir                         {
368*cdf0e10cSrcweir                             ByteString aStr( "Property not convertable: ");
369*cdf0e10cSrcweir                             aStr += rArg.pName;
370*cdf0e10cSrcweir                             DBG_ERROR( aStr.GetBuffer() );
371*cdf0e10cSrcweir                         }
372*cdf0e10cSrcweir #endif
373*cdf0e10cSrcweir                         break;
374*cdf0e10cSrcweir                     }
375*cdf0e10cSrcweir                 }
376*cdf0e10cSrcweir             }
377*cdf0e10cSrcweir             else
378*cdf0e10cSrcweir             {
379*cdf0e10cSrcweir                 // complex argument, could be passed in one struct
380*cdf0e10cSrcweir                 sal_Bool bAsWholeItem = sal_False;
381*cdf0e10cSrcweir                 for ( sal_uInt16 n=0; n<nCount; n++ )
382*cdf0e10cSrcweir                 {
383*cdf0e10cSrcweir                     const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
384*cdf0e10cSrcweir                     String aName = rProp.Name;
385*cdf0e10cSrcweir                     if ( aName.CompareToAscii(rArg.pName) == COMPARE_EQUAL )
386*cdf0e10cSrcweir                     {
387*cdf0e10cSrcweir                         bAsWholeItem = sal_True;
388*cdf0e10cSrcweir #ifdef DBG_UTIL
389*cdf0e10cSrcweir                         ++nFoundArgs;
390*cdf0e10cSrcweir #endif
391*cdf0e10cSrcweir                         if( pItem->PutValue( rProp.Value ) )
392*cdf0e10cSrcweir                             // only use successfully converted items
393*cdf0e10cSrcweir                             rSet.Put( *pItem );
394*cdf0e10cSrcweir #ifdef DBG_UTIL
395*cdf0e10cSrcweir                         else
396*cdf0e10cSrcweir                         {
397*cdf0e10cSrcweir                             ByteString aStr( "Property not convertable: ");
398*cdf0e10cSrcweir                             aStr += rArg.pName;
399*cdf0e10cSrcweir                             DBG_ERROR( aStr.GetBuffer() );
400*cdf0e10cSrcweir                         }
401*cdf0e10cSrcweir #endif
402*cdf0e10cSrcweir                     }
403*cdf0e10cSrcweir                 }
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir                 if ( !bAsWholeItem )
406*cdf0e10cSrcweir                 {
407*cdf0e10cSrcweir                     // complex argument; collect sub items from argument array and reconstruct complex item
408*cdf0e10cSrcweir                     // only put item if at least one member was found and had the correct type
409*cdf0e10cSrcweir                     // (is this a good idea?! Should we ask for *all* members?)
410*cdf0e10cSrcweir                     sal_Bool bRet = sal_False;
411*cdf0e10cSrcweir                     for ( sal_uInt16 n=0; n<nCount; n++ )
412*cdf0e10cSrcweir                     {
413*cdf0e10cSrcweir                         const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
414*cdf0e10cSrcweir                         for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ )
415*cdf0e10cSrcweir                         {
416*cdf0e10cSrcweir                             // search sub item by name
417*cdf0e10cSrcweir                             ByteString aStr( rArg.pName );
418*cdf0e10cSrcweir                             aStr += '.';
419*cdf0e10cSrcweir                             aStr += pType->aAttrib[nSub].pName;
420*cdf0e10cSrcweir                             const char* pName = aStr.GetBuffer();
421*cdf0e10cSrcweir                             if ( rProp.Name.compareToAscii( pName ) == COMPARE_EQUAL )
422*cdf0e10cSrcweir                             {
423*cdf0e10cSrcweir                                 // at least one member found ...
424*cdf0e10cSrcweir                                 bRet = sal_True;
425*cdf0e10cSrcweir #ifdef DBG_UTIL
426*cdf0e10cSrcweir                                 ++nFoundArgs;
427*cdf0e10cSrcweir #endif
428*cdf0e10cSrcweir                                 sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID;
429*cdf0e10cSrcweir                                 if ( bConvertTwips )
430*cdf0e10cSrcweir                                     nSubId |= CONVERT_TWIPS;
431*cdf0e10cSrcweir                                 if (!pItem->PutValue( rProp.Value, nSubId ) )
432*cdf0e10cSrcweir                                 {
433*cdf0e10cSrcweir                                     // ... but it was not convertable
434*cdf0e10cSrcweir                                     bRet = sal_False;
435*cdf0e10cSrcweir #ifdef DBG_UTIL
436*cdf0e10cSrcweir                                     ByteString aDbgStr( "Property not convertable: ");
437*cdf0e10cSrcweir                                     aDbgStr += rArg.pName;
438*cdf0e10cSrcweir                                     DBG_ERROR( aDbgStr.GetBuffer() );
439*cdf0e10cSrcweir #endif
440*cdf0e10cSrcweir                                 }
441*cdf0e10cSrcweir 
442*cdf0e10cSrcweir                                 break;
443*cdf0e10cSrcweir                             }
444*cdf0e10cSrcweir                         }
445*cdf0e10cSrcweir                     }
446*cdf0e10cSrcweir 
447*cdf0e10cSrcweir                     if ( bRet )
448*cdf0e10cSrcweir                         // only use successfully converted items
449*cdf0e10cSrcweir                         rSet.Put( *pItem );
450*cdf0e10cSrcweir 
451*cdf0e10cSrcweir                 }
452*cdf0e10cSrcweir             }
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir             delete pItem;
455*cdf0e10cSrcweir         }
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir         // special additional parameters for some slots not seen in the slot definitions
458*cdf0e10cSrcweir         // Some of these slots are not considered to be used for macro recording, because they shouldn't be recorded as slots,
459*cdf0e10cSrcweir         // but as dispatching or factory or arbitrary URLs to the frame
460*cdf0e10cSrcweir         // Some also can use additional arguments that are not recordable (will be changed later,
461*cdf0e10cSrcweir         // f.e. "SaveAs" shouldn't support parameters not in the slot definition!)
462*cdf0e10cSrcweir         if ( nSlotId == SID_NEWWINDOW )
463*cdf0e10cSrcweir         {
464*cdf0e10cSrcweir             for ( sal_uInt16 n=0; n<nCount; n++ )
465*cdf0e10cSrcweir             {
466*cdf0e10cSrcweir                 const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
467*cdf0e10cSrcweir                 rtl::OUString aName = rProp.Name;
468*cdf0e10cSrcweir                 if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrame)) )
469*cdf0e10cSrcweir                 {
470*cdf0e10cSrcweir                     Reference< XFrame > xFrame;
471*cdf0e10cSrcweir                     OSL_VERIFY( rProp.Value >>= xFrame );
472*cdf0e10cSrcweir                     rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
473*cdf0e10cSrcweir                 }
474*cdf0e10cSrcweir                 else
475*cdf0e10cSrcweir                 if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHidden)) )
476*cdf0e10cSrcweir                 {
477*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
478*cdf0e10cSrcweir                     if (rProp.Value >>= bVal)
479*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
480*cdf0e10cSrcweir                 }
481*cdf0e10cSrcweir             }
482*cdf0e10cSrcweir         }
483*cdf0e10cSrcweir         else if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
484*cdf0e10cSrcweir                   nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF )
485*cdf0e10cSrcweir         {
486*cdf0e10cSrcweir             for ( sal_uInt16 n=0; n<nCount; n++ )
487*cdf0e10cSrcweir             {
488*cdf0e10cSrcweir #ifdef DBG_UTIL
489*cdf0e10cSrcweir                 ++nFoundArgs;
490*cdf0e10cSrcweir #endif
491*cdf0e10cSrcweir                 const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
492*cdf0e10cSrcweir                 rtl::OUString aName = rProp.Name;
493*cdf0e10cSrcweir                 if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sModel)) )
494*cdf0e10cSrcweir                     rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) );
495*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sComponentData)) )
496*cdf0e10cSrcweir                 {
497*cdf0e10cSrcweir                     rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) );
498*cdf0e10cSrcweir                 }
499*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sComponentContext)) )
500*cdf0e10cSrcweir                 {
501*cdf0e10cSrcweir                     rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) );
502*cdf0e10cSrcweir                 }
503*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStatusInd)) )
504*cdf0e10cSrcweir                 {
505*cdf0e10cSrcweir                     Reference< ::com::sun::star::task::XStatusIndicator > xVal;
506*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
507*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for StatusIndicator" );
508*cdf0e10cSrcweir                     if (bOK)
509*cdf0e10cSrcweir                         rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) );
510*cdf0e10cSrcweir                 }
511*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sInteractionHdl)) )
512*cdf0e10cSrcweir                 {
513*cdf0e10cSrcweir                     Reference< ::com::sun::star::task::XInteractionHandler > xVal;
514*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
515*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for InteractionHandler" );
516*cdf0e10cSrcweir                     if (bOK)
517*cdf0e10cSrcweir                         rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) );
518*cdf0e10cSrcweir                 }
519*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewData)) )
520*cdf0e10cSrcweir                     rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) );
521*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFilterData)) )
522*cdf0e10cSrcweir                     rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) );
523*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sInputStream)) )
524*cdf0e10cSrcweir                 {
525*cdf0e10cSrcweir                     Reference< XInputStream > xVal;
526*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
527*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for InputStream" );
528*cdf0e10cSrcweir                     if (bOK)
529*cdf0e10cSrcweir                         rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) );
530*cdf0e10cSrcweir                 }
531*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStream)) )
532*cdf0e10cSrcweir                 {
533*cdf0e10cSrcweir                     Reference< XInputStream > xVal;
534*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
535*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for Stream" );
536*cdf0e10cSrcweir                     if (bOK)
537*cdf0e10cSrcweir                         rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) );
538*cdf0e10cSrcweir                 }
539*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUCBContent)) )
540*cdf0e10cSrcweir                 {
541*cdf0e10cSrcweir                     Reference< XContent > xVal;
542*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
543*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for UCBContent" );
544*cdf0e10cSrcweir                     if (bOK)
545*cdf0e10cSrcweir                         rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) );
546*cdf0e10cSrcweir                 }
547*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sOutputStream)) )
548*cdf0e10cSrcweir                 {
549*cdf0e10cSrcweir                     Reference< XOutputStream > xVal;
550*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
551*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for OutputStream" );
552*cdf0e10cSrcweir                     if (bOK)
553*cdf0e10cSrcweir                         rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) );
554*cdf0e10cSrcweir                 }
555*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPostData)) )
556*cdf0e10cSrcweir                 {
557*cdf0e10cSrcweir                     Reference< XInputStream > xVal;
558*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= xVal);
559*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for PostData" );
560*cdf0e10cSrcweir                     if (bOK)
561*cdf0e10cSrcweir                         rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) );
562*cdf0e10cSrcweir                 }
563*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrame)) )
564*cdf0e10cSrcweir                 {
565*cdf0e10cSrcweir                     Reference< XFrame > xFrame;
566*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= xFrame);
567*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for Frame" );
568*cdf0e10cSrcweir                     if (bOK)
569*cdf0e10cSrcweir                         rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
570*cdf0e10cSrcweir                 }
571*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sAsTemplate)) )
572*cdf0e10cSrcweir                 {
573*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
574*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
575*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for AsTemplate" );
576*cdf0e10cSrcweir                     if (bOK)
577*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) );
578*cdf0e10cSrcweir                 }
579*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sOpenNewView)) )
580*cdf0e10cSrcweir                 {
581*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
582*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
583*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for OpenNewView" );
584*cdf0e10cSrcweir                     if (bOK)
585*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) );
586*cdf0e10cSrcweir                 }
587*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewId)) )
588*cdf0e10cSrcweir                 {
589*cdf0e10cSrcweir                     sal_Int16 nVal = -1;
590*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
591*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for ViewId" );
592*cdf0e10cSrcweir                     if (bOK)
593*cdf0e10cSrcweir                         rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) );
594*cdf0e10cSrcweir                 }
595*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPluginMode)) )
596*cdf0e10cSrcweir                 {
597*cdf0e10cSrcweir                     sal_Int16 nVal = -1;
598*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
599*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for PluginMode" );
600*cdf0e10cSrcweir                     if (bOK)
601*cdf0e10cSrcweir                         rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) );
602*cdf0e10cSrcweir                 }
603*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sReadOnly)) )
604*cdf0e10cSrcweir                 {
605*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
606*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
607*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for ReadOnly" );
608*cdf0e10cSrcweir                     if (bOK)
609*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) );
610*cdf0e10cSrcweir                 }
611*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStartPresentation)) )
612*cdf0e10cSrcweir                 {
613*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
614*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
615*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for StartPresentation" );
616*cdf0e10cSrcweir                     if (bOK)
617*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) );
618*cdf0e10cSrcweir                 }
619*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSelectionOnly)) )
620*cdf0e10cSrcweir                 {
621*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
622*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
623*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for SelectionOnly" );
624*cdf0e10cSrcweir                     if (bOK)
625*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) );
626*cdf0e10cSrcweir                 }
627*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHidden)) )
628*cdf0e10cSrcweir                 {
629*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
630*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
631*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for Hidden" );
632*cdf0e10cSrcweir                     if (bOK)
633*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
634*cdf0e10cSrcweir                 }
635*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMinimized)) )
636*cdf0e10cSrcweir                 {
637*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
638*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
639*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for Minimized" );
640*cdf0e10cSrcweir                     if (bOK)
641*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) );
642*cdf0e10cSrcweir                 }
643*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSilent)) )
644*cdf0e10cSrcweir                 {
645*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
646*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
647*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for Silent" );
648*cdf0e10cSrcweir                     if (bOK)
649*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_SILENT, bVal ) );
650*cdf0e10cSrcweir                 }
651*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPreview)) )
652*cdf0e10cSrcweir                 {
653*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
654*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
655*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for Preview" );
656*cdf0e10cSrcweir                     if (bOK)
657*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) );
658*cdf0e10cSrcweir                 }
659*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewOnly)) )
660*cdf0e10cSrcweir                 {
661*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
662*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
663*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for ViewOnly" );
664*cdf0e10cSrcweir                     if (bOK)
665*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) );
666*cdf0e10cSrcweir                 }
667*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDontEdit)) )
668*cdf0e10cSrcweir                 {
669*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
670*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
671*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for ViewOnly" );
672*cdf0e10cSrcweir                     if (bOK)
673*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) );
674*cdf0e10cSrcweir                 }
675*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUseSystemDialog)) )
676*cdf0e10cSrcweir                 {
677*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
678*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
679*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for ViewOnly" );
680*cdf0e10cSrcweir                     if (bOK)
681*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) );
682*cdf0e10cSrcweir                 }
683*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStandardDir)) )
684*cdf0e10cSrcweir                 {
685*cdf0e10cSrcweir                     ::rtl::OUString sVal;
686*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
687*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for StandardDir" );
688*cdf0e10cSrcweir                     if (bOK)
689*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) );
690*cdf0e10cSrcweir                 }
691*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBlackList)) )
692*cdf0e10cSrcweir                 {
693*cdf0e10cSrcweir                     ::com::sun::star::uno::Sequence< ::rtl::OUString > xVal;
694*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= xVal);
695*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for BlackList" );
696*cdf0e10cSrcweir                     if (bOK)
697*cdf0e10cSrcweir                     {
698*cdf0e10cSrcweir                         SfxStringListItem stringList(SID_BLACK_LIST);
699*cdf0e10cSrcweir                         stringList.SetStringList( xVal );
700*cdf0e10cSrcweir                         rSet.Put( stringList );
701*cdf0e10cSrcweir                     }
702*cdf0e10cSrcweir                 }
703*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFileName)) )
704*cdf0e10cSrcweir                 {
705*cdf0e10cSrcweir                     ::rtl::OUString sVal;
706*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
707*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for FileName" );
708*cdf0e10cSrcweir                     if (bOK)
709*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) );
710*cdf0e10cSrcweir                 }
711*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSalvagedFile)) )
712*cdf0e10cSrcweir                 {
713*cdf0e10cSrcweir                     ::rtl::OUString sVal;
714*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= sVal);
715*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for SalvagedFile" );
716*cdf0e10cSrcweir                     if (bOK)
717*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) );
718*cdf0e10cSrcweir                 }
719*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFolderName)) )
720*cdf0e10cSrcweir                 {
721*cdf0e10cSrcweir                     ::rtl::OUString sVal;
722*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= sVal);
723*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for FolderName" );
724*cdf0e10cSrcweir                     if (bOK)
725*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_PATH, sVal ) );
726*cdf0e10cSrcweir                 }
727*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrameName)) )
728*cdf0e10cSrcweir                 {
729*cdf0e10cSrcweir                     ::rtl::OUString sVal;
730*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= sVal);
731*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for FrameName" );
732*cdf0e10cSrcweir                     if (bOK && sVal.getLength())
733*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) );
734*cdf0e10cSrcweir                 }
735*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMediaType)) )
736*cdf0e10cSrcweir                 {
737*cdf0e10cSrcweir                     ::rtl::OUString sVal;
738*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
739*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for MediaType" );
740*cdf0e10cSrcweir                     if (bOK)
741*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) );
742*cdf0e10cSrcweir                 }
743*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateName)) )
744*cdf0e10cSrcweir                 {
745*cdf0e10cSrcweir                     ::rtl::OUString sVal;
746*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
747*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for TemplateName" );
748*cdf0e10cSrcweir                     if (bOK)
749*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) );
750*cdf0e10cSrcweir                 }
751*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateRegionName)) )
752*cdf0e10cSrcweir                 {
753*cdf0e10cSrcweir                     ::rtl::OUString sVal;
754*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
755*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for TemplateRegionName" );
756*cdf0e10cSrcweir                     if (bOK)
757*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) );
758*cdf0e10cSrcweir                 }
759*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sJumpMark)) )
760*cdf0e10cSrcweir                 {
761*cdf0e10cSrcweir                     ::rtl::OUString sVal;
762*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
763*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for JumpMark" );
764*cdf0e10cSrcweir                     if (bOK)
765*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) );
766*cdf0e10cSrcweir                 }
767*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sCharacterSet)) )
768*cdf0e10cSrcweir                 {
769*cdf0e10cSrcweir                     ::rtl::OUString sVal;
770*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
771*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for CharacterSet" );
772*cdf0e10cSrcweir                     if (bOK)
773*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_CHARSET, sVal ) );
774*cdf0e10cSrcweir                 }
775*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFilterFlags)) )
776*cdf0e10cSrcweir                 {
777*cdf0e10cSrcweir                     ::rtl::OUString sVal;
778*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
779*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
780*cdf0e10cSrcweir                     if (bOK)
781*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) );
782*cdf0e10cSrcweir                 }
783*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMacroExecMode)) )
784*cdf0e10cSrcweir                 {
785*cdf0e10cSrcweir                     sal_Int16 nVal =-1;
786*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
787*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for MacroExecMode" );
788*cdf0e10cSrcweir                     if (bOK)
789*cdf0e10cSrcweir                         rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) );
790*cdf0e10cSrcweir                 }
791*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUpdateDocMode)) )
792*cdf0e10cSrcweir                 {
793*cdf0e10cSrcweir                     sal_Int16 nVal =-1;
794*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
795*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for UpdateDocMode" );
796*cdf0e10cSrcweir                     if (bOK)
797*cdf0e10cSrcweir                         rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) );
798*cdf0e10cSrcweir                 }
799*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sRepairPackage)) )
800*cdf0e10cSrcweir                 {
801*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
802*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
803*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for RepairPackage" );
804*cdf0e10cSrcweir                     if (bOK)
805*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) );
806*cdf0e10cSrcweir                 }
807*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDocumentTitle)) )
808*cdf0e10cSrcweir                 {
809*cdf0e10cSrcweir                     ::rtl::OUString sVal;
810*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
811*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for DocumentTitle" );
812*cdf0e10cSrcweir                     if (bOK)
813*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) );
814*cdf0e10cSrcweir                 }
815*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDocumentBaseURL)) )
816*cdf0e10cSrcweir                 {
817*cdf0e10cSrcweir                     ::rtl::OUString sVal;
818*cdf0e10cSrcweir                     // the base url can be set to empty ( for embedded objects for example )
819*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= sVal);
820*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for DocumentBaseURL" );
821*cdf0e10cSrcweir                     if (bOK)
822*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) );
823*cdf0e10cSrcweir                 }
824*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHierarchicalDocumentName)) )
825*cdf0e10cSrcweir                 {
826*cdf0e10cSrcweir                     ::rtl::OUString sVal;
827*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
828*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for HierarchicalDocumentName" );
829*cdf0e10cSrcweir                     if (bOK)
830*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) );
831*cdf0e10cSrcweir                 }
832*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sCopyStreamIfPossible)) )
833*cdf0e10cSrcweir                 {
834*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
835*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
836*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for CopyStreamIfPossible" );
837*cdf0e10cSrcweir                     if (bOK)
838*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) );
839*cdf0e10cSrcweir                 }
840*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sNoAutoSave)) )
841*cdf0e10cSrcweir                 {
842*cdf0e10cSrcweir                     sal_Bool bVal = sal_False;
843*cdf0e10cSrcweir                     sal_Bool bOK = (rProp.Value >>= bVal);
844*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type for NoAutoSave" );
845*cdf0e10cSrcweir                     if (bOK)
846*cdf0e10cSrcweir                         rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) );
847*cdf0e10cSrcweir                 }
848*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sModifyPasswordInfo)) )
849*cdf0e10cSrcweir                 {
850*cdf0e10cSrcweir                     rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
851*cdf0e10cSrcweir                 }
852*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sEncryptionData)) )
853*cdf0e10cSrcweir                 {
854*cdf0e10cSrcweir                     rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
855*cdf0e10cSrcweir                 }
856*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuggestedSaveAsDir)) )
857*cdf0e10cSrcweir                 {
858*cdf0e10cSrcweir                     ::rtl::OUString sVal;
859*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
860*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsDir" );
861*cdf0e10cSrcweir                     if (bOK)
862*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR, sVal ) );
863*cdf0e10cSrcweir                 }
864*cdf0e10cSrcweir                 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuggestedSaveAsName)) )
865*cdf0e10cSrcweir                 {
866*cdf0e10cSrcweir                     ::rtl::OUString sVal;
867*cdf0e10cSrcweir                     sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
868*cdf0e10cSrcweir                     DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsName" );
869*cdf0e10cSrcweir                     if (bOK)
870*cdf0e10cSrcweir                         rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) );
871*cdf0e10cSrcweir                 }
872*cdf0e10cSrcweir #ifdef DBG_UTIL
873*cdf0e10cSrcweir                 else
874*cdf0e10cSrcweir                     --nFoundArgs;
875*cdf0e10cSrcweir #endif
876*cdf0e10cSrcweir             }
877*cdf0e10cSrcweir         }
878*cdf0e10cSrcweir         // --> PB 2007-12-09 #i83757#
879*cdf0e10cSrcweir         else
880*cdf0e10cSrcweir         {
881*cdf0e10cSrcweir             // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog"
882*cdf0e10cSrcweir             String sSlotName( DEFINE_CONST_UNICODE( "OptionsTreeDialog" ) );
883*cdf0e10cSrcweir             String sPropName( DEFINE_CONST_UNICODE( "OptionsPageURL" ) );
884*cdf0e10cSrcweir             if ( sSlotName.EqualsAscii( pSlot->pUnoName ) )
885*cdf0e10cSrcweir             {
886*cdf0e10cSrcweir                 for ( sal_uInt16 n = 0; n < nCount; ++n )
887*cdf0e10cSrcweir                 {
888*cdf0e10cSrcweir                     const PropertyValue& rProp = pPropsVal[n];
889*cdf0e10cSrcweir                     String sName( rProp.Name );
890*cdf0e10cSrcweir                     if ( sName == sPropName )
891*cdf0e10cSrcweir                     {
892*cdf0e10cSrcweir                         ::rtl::OUString sURL;
893*cdf0e10cSrcweir                         if ( rProp.Value >>= sURL )
894*cdf0e10cSrcweir                             rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) );
895*cdf0e10cSrcweir                         break;
896*cdf0e10cSrcweir                     }
897*cdf0e10cSrcweir                 }
898*cdf0e10cSrcweir             }
899*cdf0e10cSrcweir         }
900*cdf0e10cSrcweir         // <--
901*cdf0e10cSrcweir #ifdef DB_UTIL
902*cdf0e10cSrcweir         if ( nFoundArgs == nCount )
903*cdf0e10cSrcweir         {
904*cdf0e10cSrcweir             // except for the "special" slots: assure that every argument was convertable
905*cdf0e10cSrcweir             ByteString aStr( "MacroPlayer: Some properties didn't match to any formal argument for slot: ");
906*cdf0e10cSrcweir             aStr += pSlot->pUnoName;
907*cdf0e10cSrcweir             DBG_WARNING( aStr.GetBuffer() );
908*cdf0e10cSrcweir         }
909*cdf0e10cSrcweir #endif
910*cdf0e10cSrcweir     }
911*cdf0e10cSrcweir }
912*cdf0e10cSrcweir 
913*cdf0e10cSrcweir void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, const SfxSlot* pSlot )
914*cdf0e10cSrcweir {
915*cdf0e10cSrcweir     if ( !pSlot )
916*cdf0e10cSrcweir         pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
917*cdf0e10cSrcweir 
918*cdf0e10cSrcweir     if ( !pSlot)
919*cdf0e10cSrcweir         return;
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir     if ( nSlotId == SID_OPENURL )
922*cdf0e10cSrcweir         nSlotId = SID_OPENDOC;
923*cdf0e10cSrcweir     if ( nSlotId == SID_SAVEASURL )
924*cdf0e10cSrcweir         nSlotId = SID_SAVEASDOC;
925*cdf0e10cSrcweir 
926*cdf0e10cSrcweir     // find number of properties to avoid permanent reallocations in the sequence
927*cdf0e10cSrcweir     sal_Int32 nProps=0;
928*cdf0e10cSrcweir 
929*cdf0e10cSrcweir #ifdef DBG_UTIL
930*cdf0e10cSrcweir     // trace number of items and compare with number of properties for debugging purposes
931*cdf0e10cSrcweir     sal_Int32 nItems=0;
932*cdf0e10cSrcweir #endif
933*cdf0e10cSrcweir 
934*cdf0e10cSrcweir     const SfxType *pType = pSlot->GetType();
935*cdf0e10cSrcweir     if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
936*cdf0e10cSrcweir     {
937*cdf0e10cSrcweir         // slot is a property
938*cdf0e10cSrcweir         sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
939*cdf0e10cSrcweir         if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) //???
940*cdf0e10cSrcweir         {
941*cdf0e10cSrcweir             sal_uInt16 nSubCount = pType->nAttribs;
942*cdf0e10cSrcweir             if ( nSubCount )
943*cdf0e10cSrcweir                 // it's a complex property, we want it split into simple types
944*cdf0e10cSrcweir                 // so we expect to get as many items as we have (sub) members
945*cdf0e10cSrcweir                 nProps = nSubCount;
946*cdf0e10cSrcweir             else
947*cdf0e10cSrcweir                 // simple property: we expect to get exactly one item
948*cdf0e10cSrcweir                 nProps++;
949*cdf0e10cSrcweir         }
950*cdf0e10cSrcweir #ifdef DBG_UTIL
951*cdf0e10cSrcweir         else
952*cdf0e10cSrcweir         {
953*cdf0e10cSrcweir             // we will not rely on the "toggle" ability of some property slots
954*cdf0e10cSrcweir             ByteString aStr( "Processing property slot without argument: ");
955*cdf0e10cSrcweir             aStr += ByteString::CreateFromInt32( nSlotId );
956*cdf0e10cSrcweir             DBG_ERROR( aStr.GetBuffer() );
957*cdf0e10cSrcweir         }
958*cdf0e10cSrcweir #endif
959*cdf0e10cSrcweir 
960*cdf0e10cSrcweir #ifdef DBG_UTIL
961*cdf0e10cSrcweir         nItems++;
962*cdf0e10cSrcweir #endif
963*cdf0e10cSrcweir     }
964*cdf0e10cSrcweir     else
965*cdf0e10cSrcweir     {
966*cdf0e10cSrcweir         // slot is a method
967*cdf0e10cSrcweir         sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
968*cdf0e10cSrcweir         for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
969*cdf0e10cSrcweir         {
970*cdf0e10cSrcweir             // check every formal argument of the method
971*cdf0e10cSrcweir             const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
972*cdf0e10cSrcweir             sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
973*cdf0e10cSrcweir             if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) //???
974*cdf0e10cSrcweir             {
975*cdf0e10cSrcweir                 sal_uInt16 nSubCount = rArg.pType->nAttribs;
976*cdf0e10cSrcweir                 if ( nSubCount )
977*cdf0e10cSrcweir                     // argument has a complex type, we want it split into simple types
978*cdf0e10cSrcweir                     // so for this argument we expect to get as many items as we have (sub) members
979*cdf0e10cSrcweir                     nProps += nSubCount;
980*cdf0e10cSrcweir                 else
981*cdf0e10cSrcweir                     // argument of simple type: we expect to get exactly one item for it
982*cdf0e10cSrcweir                     nProps++;
983*cdf0e10cSrcweir #ifdef DBG_UTIL
984*cdf0e10cSrcweir                 nItems++;
985*cdf0e10cSrcweir #endif
986*cdf0e10cSrcweir             }
987*cdf0e10cSrcweir         }
988*cdf0e10cSrcweir 
989*cdf0e10cSrcweir         // special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To)
990*cdf0e10cSrcweir         if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC ||  nSlotId == SID_SAVEDOC ||
991*cdf0e10cSrcweir              nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF )
992*cdf0e10cSrcweir         {
993*cdf0e10cSrcweir             sal_Int32 nAdditional=0;
994*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SFX_ITEM_SET )
995*cdf0e10cSrcweir                 nAdditional++;
996*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SFX_ITEM_SET )
997*cdf0e10cSrcweir                 nAdditional++;
998*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SFX_ITEM_SET )
999*cdf0e10cSrcweir                 nAdditional++;
1000*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_PATH ) == SFX_ITEM_SET )
1001*cdf0e10cSrcweir                 nAdditional++;
1002*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_FILE_DIALOG ) == SFX_ITEM_SET )
1003*cdf0e10cSrcweir                 nAdditional++;
1004*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_STANDARD_DIR ) == SFX_ITEM_SET )
1005*cdf0e10cSrcweir                 nAdditional++;
1006*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_BLACK_LIST ) == SFX_ITEM_SET )
1007*cdf0e10cSrcweir                 nAdditional++;
1008*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_CONTENT ) == SFX_ITEM_SET )
1009*cdf0e10cSrcweir                 nAdditional++;
1010*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_INPUTSTREAM ) == SFX_ITEM_SET )
1011*cdf0e10cSrcweir                 nAdditional++;
1012*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_STREAM ) == SFX_ITEM_SET )
1013*cdf0e10cSrcweir                 nAdditional++;
1014*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SFX_ITEM_SET )
1015*cdf0e10cSrcweir                 nAdditional++;
1016*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_TEMPLATE ) == SFX_ITEM_SET )
1017*cdf0e10cSrcweir                 nAdditional++;
1018*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SFX_ITEM_SET )
1019*cdf0e10cSrcweir                 nAdditional++;
1020*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_VIEW_ID ) == SFX_ITEM_SET )
1021*cdf0e10cSrcweir                 nAdditional++;
1022*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_VIEW_DATA ) == SFX_ITEM_SET )
1023*cdf0e10cSrcweir                 nAdditional++;
1024*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_FILTER_DATA ) == SFX_ITEM_SET )
1025*cdf0e10cSrcweir                 nAdditional++;
1026*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SFX_ITEM_SET )
1027*cdf0e10cSrcweir                 nAdditional++;
1028*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOC_READONLY ) == SFX_ITEM_SET )
1029*cdf0e10cSrcweir                 nAdditional++;
1030*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SFX_ITEM_SET )
1031*cdf0e10cSrcweir                 nAdditional++;
1032*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_SELECTION ) == SFX_ITEM_SET )
1033*cdf0e10cSrcweir                 nAdditional++;
1034*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_CONTENTTYPE ) == SFX_ITEM_SET )
1035*cdf0e10cSrcweir                 nAdditional++;
1036*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_POSTDATA ) == SFX_ITEM_SET )
1037*cdf0e10cSrcweir                 nAdditional++;
1038*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_FILLFRAME ) == SFX_ITEM_SET )
1039*cdf0e10cSrcweir                 nAdditional++;
1040*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_CHARSET ) == SFX_ITEM_SET )
1041*cdf0e10cSrcweir                 nAdditional++;
1042*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_TARGETNAME ) == SFX_ITEM_SET )
1043*cdf0e10cSrcweir                 nAdditional++;
1044*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SFX_ITEM_SET )
1045*cdf0e10cSrcweir                 nAdditional++;
1046*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SFX_ITEM_SET )
1047*cdf0e10cSrcweir                 nAdditional++;
1048*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_HIDDEN ) == SFX_ITEM_SET )
1049*cdf0e10cSrcweir                 nAdditional++;
1050*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_MINIMIZED ) == SFX_ITEM_SET )
1051*cdf0e10cSrcweir                 nAdditional++;
1052*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_PREVIEW ) == SFX_ITEM_SET )
1053*cdf0e10cSrcweir                 nAdditional++;
1054*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_VIEWONLY ) == SFX_ITEM_SET )
1055*cdf0e10cSrcweir                 nAdditional++;
1056*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_EDITDOC ) == SFX_ITEM_SET )
1057*cdf0e10cSrcweir                 nAdditional++;
1058*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_SILENT ) == SFX_ITEM_SET )
1059*cdf0e10cSrcweir                 nAdditional++;
1060*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_JUMPMARK ) == SFX_ITEM_SET )
1061*cdf0e10cSrcweir                 nAdditional++;
1062*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOCUMENT ) == SFX_ITEM_SET )
1063*cdf0e10cSrcweir                 nAdditional++;
1064*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_MACROEXECMODE ) == SFX_ITEM_SET )
1065*cdf0e10cSrcweir                 nAdditional++;
1066*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SFX_ITEM_SET )
1067*cdf0e10cSrcweir                 nAdditional++;
1068*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SFX_ITEM_SET )
1069*cdf0e10cSrcweir                 nAdditional++;
1070*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SFX_ITEM_SET )
1071*cdf0e10cSrcweir                 nAdditional++;
1072*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_COMPONENTDATA ) == SFX_ITEM_SET )
1073*cdf0e10cSrcweir                 nAdditional++;
1074*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_COMPONENTCONTEXT ) == SFX_ITEM_SET )
1075*cdf0e10cSrcweir                 nAdditional++;
1076*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOC_BASEURL ) == SFX_ITEM_SET )
1077*cdf0e10cSrcweir                 nAdditional++;
1078*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME ) == SFX_ITEM_SET )
1079*cdf0e10cSrcweir                 nAdditional++;
1080*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE ) == SFX_ITEM_SET )
1081*cdf0e10cSrcweir                 nAdditional++;
1082*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SFX_ITEM_SET )
1083*cdf0e10cSrcweir                 nAdditional++;
1084*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SFX_ITEM_SET )
1085*cdf0e10cSrcweir                 nAdditional++;
1086*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SFX_ITEM_SET )
1087*cdf0e10cSrcweir                 nAdditional++;
1088*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SFX_ITEM_SET )
1089*cdf0e10cSrcweir                 nAdditional++;
1090*cdf0e10cSrcweir                 nAdditional++;
1091*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SFX_ITEM_SET )
1092*cdf0e10cSrcweir                 nAdditional++;
1093*cdf0e10cSrcweir 
1094*cdf0e10cSrcweir             // consider additional arguments
1095*cdf0e10cSrcweir             nProps += nAdditional;
1096*cdf0e10cSrcweir #ifdef DBG_UTIL
1097*cdf0e10cSrcweir             nItems += nAdditional;
1098*cdf0e10cSrcweir #endif
1099*cdf0e10cSrcweir         }
1100*cdf0e10cSrcweir     }
1101*cdf0e10cSrcweir 
1102*cdf0e10cSrcweir #ifdef DBG_UTIL
1103*cdf0e10cSrcweir     // now check the itemset: is there any item that is not convertable using the list of formal arguments
1104*cdf0e10cSrcweir     // or the table of additional items?!
1105*cdf0e10cSrcweir     if ( rSet.Count() != nItems )
1106*cdf0e10cSrcweir     {
1107*cdf0e10cSrcweir         // detect unknown item and present error message
1108*cdf0e10cSrcweir         const sal_uInt16 *pRanges = rSet.GetRanges();
1109*cdf0e10cSrcweir         while ( *pRanges )
1110*cdf0e10cSrcweir         {
1111*cdf0e10cSrcweir             for(sal_uInt16 nId = *pRanges++; nId <= *pRanges; ++nId)
1112*cdf0e10cSrcweir             {
1113*cdf0e10cSrcweir                 if ( rSet.GetItemState(nId) < SFX_ITEM_SET ) //???
1114*cdf0e10cSrcweir                     // not really set
1115*cdf0e10cSrcweir                     continue;
1116*cdf0e10cSrcweir 
1117*cdf0e10cSrcweir                 if ( !pSlot->IsMode(SFX_SLOT_METHOD) && nId == rSet.GetPool()->GetWhich( pSlot->GetSlotId() ) )
1118*cdf0e10cSrcweir                     continue;
1119*cdf0e10cSrcweir 
1120*cdf0e10cSrcweir                 sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
1121*cdf0e10cSrcweir                 sal_uInt16 nArg;
1122*cdf0e10cSrcweir                 for ( nArg=0; nArg<nFormalArgs; ++nArg )
1123*cdf0e10cSrcweir                 {
1124*cdf0e10cSrcweir                     const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
1125*cdf0e10cSrcweir                     sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1126*cdf0e10cSrcweir                     if ( nId == nWhich )
1127*cdf0e10cSrcweir                         break;
1128*cdf0e10cSrcweir                 }
1129*cdf0e10cSrcweir 
1130*cdf0e10cSrcweir                 if ( nArg<nFormalArgs )
1131*cdf0e10cSrcweir                     continue;
1132*cdf0e10cSrcweir 
1133*cdf0e10cSrcweir                 if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC ||  nSlotId == SID_SAVEDOC ||
1134*cdf0e10cSrcweir                      nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF )
1135*cdf0e10cSrcweir                 {
1136*cdf0e10cSrcweir                     if ( nId == SID_DOCFRAME )
1137*cdf0e10cSrcweir                         continue;
1138*cdf0e10cSrcweir                     if ( nId == SID_PROGRESS_STATUSBAR_CONTROL )
1139*cdf0e10cSrcweir                         continue;
1140*cdf0e10cSrcweir                     if ( nId == SID_INTERACTIONHANDLER )
1141*cdf0e10cSrcweir                         continue;
1142*cdf0e10cSrcweir                     if ( nId == SID_VIEW_DATA )
1143*cdf0e10cSrcweir                         continue;
1144*cdf0e10cSrcweir                     if ( nId == SID_FILTER_DATA )
1145*cdf0e10cSrcweir                         continue;
1146*cdf0e10cSrcweir                     if ( nId == SID_DOCUMENT )
1147*cdf0e10cSrcweir                         continue;
1148*cdf0e10cSrcweir                     if ( nId == SID_CONTENT )
1149*cdf0e10cSrcweir                         continue;
1150*cdf0e10cSrcweir                     if ( nId == SID_INPUTSTREAM )
1151*cdf0e10cSrcweir                         continue;
1152*cdf0e10cSrcweir                     if ( nId == SID_STREAM )
1153*cdf0e10cSrcweir                         continue;
1154*cdf0e10cSrcweir                     if ( nId == SID_OUTPUTSTREAM )
1155*cdf0e10cSrcweir                         continue;
1156*cdf0e10cSrcweir                     if ( nId == SID_POSTDATA )
1157*cdf0e10cSrcweir                         continue;
1158*cdf0e10cSrcweir                     if ( nId == SID_FILLFRAME )
1159*cdf0e10cSrcweir                         continue;
1160*cdf0e10cSrcweir                     if ( nId == SID_TEMPLATE )
1161*cdf0e10cSrcweir                         continue;
1162*cdf0e10cSrcweir                     if ( nId == SID_OPEN_NEW_VIEW )
1163*cdf0e10cSrcweir                         continue;
1164*cdf0e10cSrcweir                     if ( nId == SID_VIEW_ID )
1165*cdf0e10cSrcweir                         continue;
1166*cdf0e10cSrcweir                     if ( nId == SID_PLUGIN_MODE )
1167*cdf0e10cSrcweir                         continue;
1168*cdf0e10cSrcweir                     if ( nId == SID_DOC_READONLY )
1169*cdf0e10cSrcweir                         continue;
1170*cdf0e10cSrcweir                     if ( nId == SID_DOC_STARTPRESENTATION )
1171*cdf0e10cSrcweir                         continue;
1172*cdf0e10cSrcweir                     if ( nId == SID_SELECTION )
1173*cdf0e10cSrcweir                         continue;
1174*cdf0e10cSrcweir                     if ( nId == SID_HIDDEN )
1175*cdf0e10cSrcweir                         continue;
1176*cdf0e10cSrcweir                     if ( nId == SID_MINIMIZED )
1177*cdf0e10cSrcweir                         continue;
1178*cdf0e10cSrcweir                     if ( nId == SID_SILENT )
1179*cdf0e10cSrcweir                         continue;
1180*cdf0e10cSrcweir                     if ( nId == SID_PREVIEW )
1181*cdf0e10cSrcweir                         continue;
1182*cdf0e10cSrcweir                     if ( nId == SID_VIEWONLY )
1183*cdf0e10cSrcweir                         continue;
1184*cdf0e10cSrcweir                     if ( nId == SID_EDITDOC )
1185*cdf0e10cSrcweir                         continue;
1186*cdf0e10cSrcweir                     if ( nId == SID_TARGETNAME )
1187*cdf0e10cSrcweir                         continue;
1188*cdf0e10cSrcweir                     if ( nId == SID_DOC_SALVAGE )
1189*cdf0e10cSrcweir                         continue;
1190*cdf0e10cSrcweir                     if ( nId == SID_PATH )
1191*cdf0e10cSrcweir                         continue;
1192*cdf0e10cSrcweir                     if ( nId == SID_FILE_DIALOG )
1193*cdf0e10cSrcweir                         continue;
1194*cdf0e10cSrcweir                     if ( nId == SID_STANDARD_DIR )
1195*cdf0e10cSrcweir                         continue;
1196*cdf0e10cSrcweir                     if ( nId == SID_BLACK_LIST )
1197*cdf0e10cSrcweir                         continue;
1198*cdf0e10cSrcweir                     if ( nId == SID_CONTENTTYPE )
1199*cdf0e10cSrcweir                         continue;
1200*cdf0e10cSrcweir                     if ( nId == SID_TEMPLATE_NAME )
1201*cdf0e10cSrcweir                         continue;
1202*cdf0e10cSrcweir                     if ( nId == SID_TEMPLATE_REGIONNAME )
1203*cdf0e10cSrcweir                         continue;
1204*cdf0e10cSrcweir                     if ( nId == SID_JUMPMARK )
1205*cdf0e10cSrcweir                         continue;
1206*cdf0e10cSrcweir                     if ( nId == SID_CHARSET )
1207*cdf0e10cSrcweir                         continue;
1208*cdf0e10cSrcweir                     if ( nId == SID_MACROEXECMODE )
1209*cdf0e10cSrcweir                         continue;
1210*cdf0e10cSrcweir                     if ( nId == SID_UPDATEDOCMODE )
1211*cdf0e10cSrcweir                         continue;
1212*cdf0e10cSrcweir                     if ( nId == SID_REPAIRPACKAGE )
1213*cdf0e10cSrcweir                         continue;
1214*cdf0e10cSrcweir                     if ( nId == SID_DOCINFO_TITLE )
1215*cdf0e10cSrcweir                         continue;
1216*cdf0e10cSrcweir                     if ( nId == SID_COMPONENTDATA )
1217*cdf0e10cSrcweir                         continue;
1218*cdf0e10cSrcweir                     if ( nId == SID_COMPONENTCONTEXT )
1219*cdf0e10cSrcweir                         continue;
1220*cdf0e10cSrcweir                     if ( nId == SID_DOC_BASEURL )
1221*cdf0e10cSrcweir                         continue;
1222*cdf0e10cSrcweir                     if ( nId == SID_DOC_HIERARCHICALNAME )
1223*cdf0e10cSrcweir                         continue;
1224*cdf0e10cSrcweir                     if ( nId == SID_COPY_STREAM_IF_POSSIBLE )
1225*cdf0e10cSrcweir                         continue;
1226*cdf0e10cSrcweir                     if ( nId == SID_NOAUTOSAVE )
1227*cdf0e10cSrcweir                         continue;
1228*cdf0e10cSrcweir                      if ( nId == SID_ENCRYPTIONDATA )
1229*cdf0e10cSrcweir                         continue;
1230*cdf0e10cSrcweir 
1231*cdf0e10cSrcweir                     // used only internally
1232*cdf0e10cSrcweir                     if ( nId == SID_SAVETO )
1233*cdf0e10cSrcweir                         continue;
1234*cdf0e10cSrcweir                      if ( nId == SID_MODIFYPASSWORDINFO )
1235*cdf0e10cSrcweir                         continue;
1236*cdf0e10cSrcweir                      if ( nId == SID_SUGGESTEDSAVEASDIR )
1237*cdf0e10cSrcweir                         continue;
1238*cdf0e10cSrcweir                      if ( nId == SID_SUGGESTEDSAVEASNAME )
1239*cdf0e10cSrcweir                         continue;
1240*cdf0e10cSrcweir                }
1241*cdf0e10cSrcweir 
1242*cdf0e10cSrcweir                 ByteString aDbg( "Unknown item detected: ");
1243*cdf0e10cSrcweir                 aDbg += ByteString::CreateFromInt32( nId );
1244*cdf0e10cSrcweir                 DBG_ASSERT( nArg<nFormalArgs, aDbg.GetBuffer() );
1245*cdf0e10cSrcweir             }
1246*cdf0e10cSrcweir         }
1247*cdf0e10cSrcweir     }
1248*cdf0e10cSrcweir #endif
1249*cdf0e10cSrcweir 
1250*cdf0e10cSrcweir     if ( !nProps )
1251*cdf0e10cSrcweir         return;
1252*cdf0e10cSrcweir 
1253*cdf0e10cSrcweir     // convert every item into a property
1254*cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> aSequ( nProps );
1255*cdf0e10cSrcweir     ::com::sun::star::beans::PropertyValue *pValue = aSequ.getArray();
1256*cdf0e10cSrcweir 
1257*cdf0e10cSrcweir     sal_Int32 nActProp=0;
1258*cdf0e10cSrcweir     if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
1259*cdf0e10cSrcweir     {
1260*cdf0e10cSrcweir         // slot is a property
1261*cdf0e10cSrcweir         sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
1262*cdf0e10cSrcweir         sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
1263*cdf0e10cSrcweir         SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, sal_False );
1264*cdf0e10cSrcweir         if ( pItem ) //???
1265*cdf0e10cSrcweir         {
1266*cdf0e10cSrcweir             sal_uInt16 nSubCount = pType->nAttribs;
1267*cdf0e10cSrcweir             if ( !nSubCount )
1268*cdf0e10cSrcweir             {
1269*cdf0e10cSrcweir                 //rPool.FillVariable( *pItem, *pVar, eUserMetric );
1270*cdf0e10cSrcweir                 pValue[nActProp].Name = String( String::CreateFromAscii( pSlot->pUnoName ) ) ;
1271*cdf0e10cSrcweir                 if ( !pItem->QueryValue( pValue[nActProp].Value ) )
1272*cdf0e10cSrcweir                 {
1273*cdf0e10cSrcweir                     ByteString aStr( "Item not convertable: ");
1274*cdf0e10cSrcweir                     aStr += ByteString::CreateFromInt32(nSlotId);
1275*cdf0e10cSrcweir                     DBG_ERROR( aStr.GetBuffer() );
1276*cdf0e10cSrcweir                 }
1277*cdf0e10cSrcweir             }
1278*cdf0e10cSrcweir             else
1279*cdf0e10cSrcweir             {
1280*cdf0e10cSrcweir                 // complex type, add a property value for every member of the struct
1281*cdf0e10cSrcweir                 for ( sal_uInt16 n=1; n<=nSubCount; ++n )
1282*cdf0e10cSrcweir                 {
1283*cdf0e10cSrcweir                     //rPool.FillVariable( *pItem, *pVar, eUserMetric );
1284*cdf0e10cSrcweir                     sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[n-1].nAID;
1285*cdf0e10cSrcweir                     if ( bConvertTwips )
1286*cdf0e10cSrcweir                         nSubId |= CONVERT_TWIPS;
1287*cdf0e10cSrcweir 
1288*cdf0e10cSrcweir                     DBG_ASSERT(( pType->aAttrib[n-1].nAID ) <= 127, "Member ID out of range" );
1289*cdf0e10cSrcweir                     String aName( String::CreateFromAscii( pSlot->pUnoName ) ) ;
1290*cdf0e10cSrcweir                     aName += '.';
1291*cdf0e10cSrcweir                     aName += String( String::CreateFromAscii( pType->aAttrib[n-1].pName ) ) ;
1292*cdf0e10cSrcweir                     pValue[nActProp].Name = aName;
1293*cdf0e10cSrcweir                     if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1294*cdf0e10cSrcweir                     {
1295*cdf0e10cSrcweir                         ByteString aStr( "Sub item ");
1296*cdf0e10cSrcweir                         aStr += ByteString::CreateFromInt32( pType->aAttrib[n-1].nAID );
1297*cdf0e10cSrcweir                         aStr += " not convertable in slot: ";
1298*cdf0e10cSrcweir                         aStr += ByteString::CreateFromInt32(nSlotId);
1299*cdf0e10cSrcweir                         DBG_ERROR( aStr.GetBuffer() );
1300*cdf0e10cSrcweir                     }
1301*cdf0e10cSrcweir                 }
1302*cdf0e10cSrcweir             }
1303*cdf0e10cSrcweir         }
1304*cdf0e10cSrcweir     }
1305*cdf0e10cSrcweir     else
1306*cdf0e10cSrcweir     {
1307*cdf0e10cSrcweir         // slot is a method
1308*cdf0e10cSrcweir         sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
1309*cdf0e10cSrcweir         for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
1310*cdf0e10cSrcweir         {
1311*cdf0e10cSrcweir             const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
1312*cdf0e10cSrcweir             sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1313*cdf0e10cSrcweir             sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
1314*cdf0e10cSrcweir             SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, sal_False );
1315*cdf0e10cSrcweir             if ( pItem ) //???
1316*cdf0e10cSrcweir             {
1317*cdf0e10cSrcweir                 sal_uInt16 nSubCount = rArg.pType->nAttribs;
1318*cdf0e10cSrcweir                 if ( !nSubCount )
1319*cdf0e10cSrcweir                 {
1320*cdf0e10cSrcweir                     //rPool.FillVariable( *pItem, *pVar, eUserMetric );
1321*cdf0e10cSrcweir                     pValue[nActProp].Name = String( String::CreateFromAscii( rArg.pName ) ) ;
1322*cdf0e10cSrcweir                     if ( !pItem->QueryValue( pValue[nActProp++].Value ) )
1323*cdf0e10cSrcweir                     {
1324*cdf0e10cSrcweir                         ByteString aStr( "Item not convertable: ");
1325*cdf0e10cSrcweir                         aStr += ByteString::CreateFromInt32(rArg.nSlotId);
1326*cdf0e10cSrcweir                         DBG_ERROR( aStr.GetBuffer() );
1327*cdf0e10cSrcweir                     }
1328*cdf0e10cSrcweir                 }
1329*cdf0e10cSrcweir                 else
1330*cdf0e10cSrcweir                 {
1331*cdf0e10cSrcweir                     // complex type, add a property value for every member of the struct
1332*cdf0e10cSrcweir                     for ( sal_uInt16 n = 1; n <= nSubCount; ++n )
1333*cdf0e10cSrcweir                     {
1334*cdf0e10cSrcweir                         //rPool.FillVariable( rItem, *pVar, eUserMetric );
1335*cdf0e10cSrcweir                         sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) rArg.pType->aAttrib[n-1].nAID;
1336*cdf0e10cSrcweir                         if ( bConvertTwips )
1337*cdf0e10cSrcweir                             nSubId |= CONVERT_TWIPS;
1338*cdf0e10cSrcweir 
1339*cdf0e10cSrcweir                         DBG_ASSERT((rArg.pType->aAttrib[n-1].nAID) <= 127, "Member ID out of range" );
1340*cdf0e10cSrcweir                         String aName( String::CreateFromAscii( rArg.pName ) ) ;
1341*cdf0e10cSrcweir                         aName += '.';
1342*cdf0e10cSrcweir                         aName += String( String::CreateFromAscii( rArg.pType->aAttrib[n-1].pName ) ) ;
1343*cdf0e10cSrcweir                         pValue[nActProp].Name = aName;
1344*cdf0e10cSrcweir                         if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1345*cdf0e10cSrcweir                         {
1346*cdf0e10cSrcweir                             ByteString aStr( "Sub item ");
1347*cdf0e10cSrcweir                             aStr += ByteString::CreateFromInt32( rArg.pType->aAttrib[n-1].nAID );
1348*cdf0e10cSrcweir                             aStr += " not convertable in slot: ";
1349*cdf0e10cSrcweir                             aStr += ByteString::CreateFromInt32(rArg.nSlotId);
1350*cdf0e10cSrcweir                             DBG_ERROR( aStr.GetBuffer() );
1351*cdf0e10cSrcweir                         }
1352*cdf0e10cSrcweir                     }
1353*cdf0e10cSrcweir                 }
1354*cdf0e10cSrcweir             }
1355*cdf0e10cSrcweir         }
1356*cdf0e10cSrcweir 
1357*cdf0e10cSrcweir         if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC ||  nSlotId == SID_SAVEDOC ||
1358*cdf0e10cSrcweir              nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF )
1359*cdf0e10cSrcweir         {
1360*cdf0e10cSrcweir             const SfxPoolItem *pItem=0;
1361*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_COMPONENTDATA, sal_False, &pItem ) == SFX_ITEM_SET )
1362*cdf0e10cSrcweir             {
1363*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sComponentData));
1364*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1365*cdf0e10cSrcweir             }
1366*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_COMPONENTCONTEXT, sal_False, &pItem ) == SFX_ITEM_SET )
1367*cdf0e10cSrcweir             {
1368*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sComponentContext));
1369*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1370*cdf0e10cSrcweir             }
1371*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL, sal_False, &pItem ) == SFX_ITEM_SET )
1372*cdf0e10cSrcweir             {
1373*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStatusInd));
1374*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1375*cdf0e10cSrcweir             }
1376*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_INTERACTIONHANDLER, sal_False, &pItem ) == SFX_ITEM_SET )
1377*cdf0e10cSrcweir             {
1378*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sInteractionHdl));
1379*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1380*cdf0e10cSrcweir             }
1381*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_VIEW_DATA, sal_False, &pItem ) == SFX_ITEM_SET )
1382*cdf0e10cSrcweir             {
1383*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewData));
1384*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1385*cdf0e10cSrcweir             }
1386*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_FILTER_DATA, sal_False, &pItem ) == SFX_ITEM_SET )
1387*cdf0e10cSrcweir             {
1388*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFilterData));
1389*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1390*cdf0e10cSrcweir             }
1391*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOCUMENT, sal_False, &pItem ) == SFX_ITEM_SET )
1392*cdf0e10cSrcweir             {
1393*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModel));
1394*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1395*cdf0e10cSrcweir             }
1396*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_CONTENT, sal_False, &pItem ) == SFX_ITEM_SET )
1397*cdf0e10cSrcweir             {
1398*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUCBContent));
1399*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1400*cdf0e10cSrcweir             }
1401*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_INPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET )
1402*cdf0e10cSrcweir             {
1403*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sInputStream));
1404*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1405*cdf0e10cSrcweir             }
1406*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_STREAM, sal_False, &pItem ) == SFX_ITEM_SET )
1407*cdf0e10cSrcweir             {
1408*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStream));
1409*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1410*cdf0e10cSrcweir             }
1411*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_OUTPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET )
1412*cdf0e10cSrcweir             {
1413*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sOutputStream));
1414*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1415*cdf0e10cSrcweir             }
1416*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_POSTDATA, sal_False, &pItem ) == SFX_ITEM_SET )
1417*cdf0e10cSrcweir             {
1418*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPostData));
1419*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1420*cdf0e10cSrcweir             }
1421*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET )
1422*cdf0e10cSrcweir             {
1423*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrame));
1424*cdf0e10cSrcweir                 if ( pItem->ISA( SfxUsrAnyItem ) )
1425*cdf0e10cSrcweir                 {
1426*cdf0e10cSrcweir                     OSL_ENSURE( false, "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" );
1427*cdf0e10cSrcweir                     pValue[nActProp++].Value = static_cast< const SfxUsrAnyItem* >( pItem )->GetValue();
1428*cdf0e10cSrcweir                 }
1429*cdf0e10cSrcweir                 else if ( pItem->ISA( SfxUnoFrameItem ) )
1430*cdf0e10cSrcweir                     pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame();
1431*cdf0e10cSrcweir                 else
1432*cdf0e10cSrcweir                     OSL_ENSURE( false, "TransformItems: invalid item type for SID_FILLFRAME!" );
1433*cdf0e10cSrcweir             }
1434*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET )
1435*cdf0e10cSrcweir             {
1436*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sAsTemplate));
1437*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1438*cdf0e10cSrcweir             }
1439*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_OPEN_NEW_VIEW, sal_False, &pItem ) == SFX_ITEM_SET )
1440*cdf0e10cSrcweir             {
1441*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sOpenNewView));
1442*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1443*cdf0e10cSrcweir             }
1444*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_VIEW_ID, sal_False, &pItem ) == SFX_ITEM_SET )
1445*cdf0e10cSrcweir             {
1446*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewId));
1447*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1448*cdf0e10cSrcweir             }
1449*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_PLUGIN_MODE, sal_False, &pItem ) == SFX_ITEM_SET )
1450*cdf0e10cSrcweir             {
1451*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPluginMode));
1452*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1453*cdf0e10cSrcweir             }
1454*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOC_READONLY, sal_False, &pItem ) == SFX_ITEM_SET )
1455*cdf0e10cSrcweir             {
1456*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sReadOnly));
1457*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1458*cdf0e10cSrcweir             }
1459*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, sal_False, &pItem ) == SFX_ITEM_SET )
1460*cdf0e10cSrcweir             {
1461*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStartPresentation));
1462*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1463*cdf0e10cSrcweir             }
1464*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_SELECTION, sal_False, &pItem ) == SFX_ITEM_SET )
1465*cdf0e10cSrcweir             {
1466*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSelectionOnly));
1467*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1468*cdf0e10cSrcweir             }
1469*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_HIDDEN, sal_False, &pItem ) == SFX_ITEM_SET )
1470*cdf0e10cSrcweir             {
1471*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sHidden));
1472*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1473*cdf0e10cSrcweir             }
1474*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_MINIMIZED, sal_False, &pItem ) == SFX_ITEM_SET )
1475*cdf0e10cSrcweir             {
1476*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMinimized));
1477*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1478*cdf0e10cSrcweir             }
1479*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_SILENT, sal_False, &pItem ) == SFX_ITEM_SET )
1480*cdf0e10cSrcweir             {
1481*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSilent));
1482*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1483*cdf0e10cSrcweir             }
1484*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_PREVIEW, sal_False, &pItem ) == SFX_ITEM_SET )
1485*cdf0e10cSrcweir             {
1486*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPreview));
1487*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1488*cdf0e10cSrcweir             }
1489*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_VIEWONLY, sal_False, &pItem ) == SFX_ITEM_SET )
1490*cdf0e10cSrcweir             {
1491*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewOnly));
1492*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= (sal_Bool) (( ((SfxBoolItem*)pItem)->GetValue() ));
1493*cdf0e10cSrcweir             }
1494*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_EDITDOC, sal_False, &pItem ) == SFX_ITEM_SET )
1495*cdf0e10cSrcweir             {
1496*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDontEdit));
1497*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= (sal_Bool) (!( ((SfxBoolItem*)pItem)->GetValue() ));
1498*cdf0e10cSrcweir             }
1499*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_FILE_DIALOG, sal_False, &pItem ) == SFX_ITEM_SET )
1500*cdf0e10cSrcweir             {
1501*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUseSystemDialog));
1502*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= (sal_Bool) ( ((SfxBoolItem*)pItem)->GetValue() );
1503*cdf0e10cSrcweir             }
1504*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_STANDARD_DIR, sal_False, &pItem ) == SFX_ITEM_SET )
1505*cdf0e10cSrcweir             {
1506*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStandardDir));
1507*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= (  ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1508*cdf0e10cSrcweir             }
1509*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_BLACK_LIST, sal_False, &pItem ) == SFX_ITEM_SET )
1510*cdf0e10cSrcweir             {
1511*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sBlackList));
1512*cdf0e10cSrcweir 
1513*cdf0e10cSrcweir                 com::sun::star::uno::Sequence< rtl::OUString > aList;
1514*cdf0e10cSrcweir                 ((SfxStringListItem*)pItem)->GetStringList( aList );
1515*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= aList ;
1516*cdf0e10cSrcweir             }
1517*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_TARGETNAME, sal_False, &pItem ) == SFX_ITEM_SET )
1518*cdf0e10cSrcweir             {
1519*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrameName));
1520*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= (  ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1521*cdf0e10cSrcweir             }
1522*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOC_SALVAGE, sal_False, &pItem ) == SFX_ITEM_SET )
1523*cdf0e10cSrcweir             {
1524*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSalvagedFile));
1525*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= (  ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1526*cdf0e10cSrcweir             }
1527*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_PATH, sal_False, &pItem ) == SFX_ITEM_SET )
1528*cdf0e10cSrcweir             {
1529*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFolderName));
1530*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= (  ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1531*cdf0e10cSrcweir             }
1532*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_CONTENTTYPE, sal_False, &pItem ) == SFX_ITEM_SET )
1533*cdf0e10cSrcweir             {
1534*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMediaType));
1535*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= (  ::rtl::OUString(((SfxStringItem*)pItem)->GetValue())  );
1536*cdf0e10cSrcweir             }
1537*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_TEMPLATE_NAME, sal_False, &pItem ) == SFX_ITEM_SET )
1538*cdf0e10cSrcweir             {
1539*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateName));
1540*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= (  ::rtl::OUString(((SfxStringItem*)pItem)->GetValue())  );
1541*cdf0e10cSrcweir             }
1542*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME, sal_False, &pItem ) == SFX_ITEM_SET )
1543*cdf0e10cSrcweir             {
1544*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateRegionName));
1545*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= (  ::rtl::OUString(((SfxStringItem*)pItem)->GetValue())  );
1546*cdf0e10cSrcweir             }
1547*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_JUMPMARK, sal_False, &pItem ) == SFX_ITEM_SET )
1548*cdf0e10cSrcweir             {
1549*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sJumpMark));
1550*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= (  ::rtl::OUString(((SfxStringItem*)pItem)->GetValue())  );
1551*cdf0e10cSrcweir             }
1552*cdf0e10cSrcweir 
1553*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_CHARSET, sal_False, &pItem ) == SFX_ITEM_SET )
1554*cdf0e10cSrcweir             {
1555*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCharacterSet));
1556*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= (  ::rtl::OUString(((SfxStringItem*)pItem)->GetValue())  );
1557*cdf0e10cSrcweir             }
1558*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_MACROEXECMODE, sal_False, &pItem ) == SFX_ITEM_SET )
1559*cdf0e10cSrcweir             {
1560*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMacroExecMode));
1561*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1562*cdf0e10cSrcweir             }
1563*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_UPDATEDOCMODE, sal_False, &pItem ) == SFX_ITEM_SET )
1564*cdf0e10cSrcweir             {
1565*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUpdateDocMode));
1566*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1567*cdf0e10cSrcweir             }
1568*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_REPAIRPACKAGE, sal_False, &pItem ) == SFX_ITEM_SET )
1569*cdf0e10cSrcweir             {
1570*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sRepairPackage));
1571*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1572*cdf0e10cSrcweir             }
1573*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOCINFO_TITLE, sal_False, &pItem ) == SFX_ITEM_SET )
1574*cdf0e10cSrcweir             {
1575*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDocumentTitle));
1576*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1577*cdf0e10cSrcweir             }
1578*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOC_BASEURL, sal_False, &pItem ) == SFX_ITEM_SET )
1579*cdf0e10cSrcweir             {
1580*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDocumentBaseURL));
1581*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1582*cdf0e10cSrcweir             }
1583*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME, sal_False, &pItem ) == SFX_ITEM_SET )
1584*cdf0e10cSrcweir             {
1585*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sHierarchicalDocumentName));
1586*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1587*cdf0e10cSrcweir             }
1588*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE, sal_False, &pItem ) == SFX_ITEM_SET )
1589*cdf0e10cSrcweir             {
1590*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCopyStreamIfPossible));
1591*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1592*cdf0e10cSrcweir             }
1593*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_NOAUTOSAVE, sal_False, &pItem ) == SFX_ITEM_SET )
1594*cdf0e10cSrcweir             {
1595*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sNoAutoSave));
1596*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1597*cdf0e10cSrcweir             }
1598*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO, sal_False, &pItem ) == SFX_ITEM_SET )
1599*cdf0e10cSrcweir             {
1600*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModifyPasswordInfo));
1601*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1602*cdf0e10cSrcweir             }
1603*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_ENCRYPTIONDATA, sal_False, &pItem ) == SFX_ITEM_SET )
1604*cdf0e10cSrcweir             {
1605*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sEncryptionData));
1606*cdf0e10cSrcweir                 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1607*cdf0e10cSrcweir             }
1608*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR, sal_False, &pItem ) == SFX_ITEM_SET )
1609*cdf0e10cSrcweir             {
1610*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSuggestedSaveAsDir));
1611*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1612*cdf0e10cSrcweir             }
1613*cdf0e10cSrcweir             if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME, sal_False, &pItem ) == SFX_ITEM_SET )
1614*cdf0e10cSrcweir             {
1615*cdf0e10cSrcweir                 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSuggestedSaveAsName));
1616*cdf0e10cSrcweir                 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1617*cdf0e10cSrcweir             }
1618*cdf0e10cSrcweir         }
1619*cdf0e10cSrcweir     }
1620*cdf0e10cSrcweir 
1621*cdf0e10cSrcweir     rArgs = aSequ;
1622*cdf0e10cSrcweir }
1623*cdf0e10cSrcweir 
1624*cdf0e10cSrcweir SFX_IMPL_XINTERFACE_5( SfxMacroLoader, OWeakObject, ::com::sun::star::frame::XDispatchProvider, ::com::sun::star::frame::XNotifyingDispatch, ::com::sun::star::frame::XDispatch, ::com::sun::star::frame::XSynchronousDispatch,::com::sun::star::lang::XInitialization )
1625*cdf0e10cSrcweir SFX_IMPL_XTYPEPROVIDER_5( SfxMacroLoader, ::com::sun::star::frame::XDispatchProvider, ::com::sun::star::frame::XNotifyingDispatch, ::com::sun::star::frame::XDispatch, ::com::sun::star::frame::XSynchronousDispatch,::com::sun::star::lang::XInitialization  )
1626*cdf0e10cSrcweir SFX_IMPL_XSERVICEINFO( SfxMacroLoader, PROTOCOLHANDLER_SERVICENAME, "com.sun.star.comp.sfx2.SfxMacroLoader" )
1627*cdf0e10cSrcweir SFX_IMPL_SINGLEFACTORY( SfxMacroLoader )
1628*cdf0e10cSrcweir 
1629*cdf0e10cSrcweir void SAL_CALL SfxMacroLoader::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
1630*cdf0e10cSrcweir {
1631*cdf0e10cSrcweir     Reference < XFrame > xFrame;
1632*cdf0e10cSrcweir     if ( aArguments.getLength() )
1633*cdf0e10cSrcweir     {
1634*cdf0e10cSrcweir         aArguments[0] >>= xFrame;
1635*cdf0e10cSrcweir         m_xFrame = xFrame;
1636*cdf0e10cSrcweir     }
1637*cdf0e10cSrcweir }
1638*cdf0e10cSrcweir 
1639*cdf0e10cSrcweir SfxObjectShell* SfxMacroLoader::GetObjectShell_Impl()
1640*cdf0e10cSrcweir {
1641*cdf0e10cSrcweir     SfxObjectShell* pDocShell = NULL;
1642*cdf0e10cSrcweir     Reference < XFrame > xFrame( m_xFrame.get(), UNO_QUERY );
1643*cdf0e10cSrcweir     if ( xFrame.is() )
1644*cdf0e10cSrcweir     {
1645*cdf0e10cSrcweir         SfxFrame* pFrame=0;
1646*cdf0e10cSrcweir         for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) )
1647*cdf0e10cSrcweir         {
1648*cdf0e10cSrcweir             if ( pFrame->GetFrameInterface() == xFrame )
1649*cdf0e10cSrcweir                 break;
1650*cdf0e10cSrcweir         }
1651*cdf0e10cSrcweir 
1652*cdf0e10cSrcweir         if ( pFrame )
1653*cdf0e10cSrcweir             pDocShell = pFrame->GetCurrentDocument();
1654*cdf0e10cSrcweir     }
1655*cdf0e10cSrcweir 
1656*cdf0e10cSrcweir     return pDocShell;
1657*cdf0e10cSrcweir }
1658*cdf0e10cSrcweir 
1659*cdf0e10cSrcweir // -----------------------------------------------------------------------
1660*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL SfxMacroLoader::queryDispatch(
1661*cdf0e10cSrcweir     const ::com::sun::star::util::URL&   aURL            ,
1662*cdf0e10cSrcweir     const ::rtl::OUString&               /*sTargetFrameName*/,
1663*cdf0e10cSrcweir     sal_Int32                            /*nSearchFlags*/    ) throw( ::com::sun::star::uno::RuntimeException )
1664*cdf0e10cSrcweir {
1665*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatcher;
1666*cdf0e10cSrcweir     if(aURL.Complete.compareToAscii("macro:",6)==0)
1667*cdf0e10cSrcweir         xDispatcher = this;
1668*cdf0e10cSrcweir     return xDispatcher;
1669*cdf0e10cSrcweir }
1670*cdf0e10cSrcweir 
1671*cdf0e10cSrcweir // -----------------------------------------------------------------------
1672*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL
1673*cdf0e10cSrcweir                 SfxMacroLoader::queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
1674*cdf0e10cSrcweir                     throw( ::com::sun::star::uno::RuntimeException )
1675*cdf0e10cSrcweir {
1676*cdf0e10cSrcweir     sal_Int32 nCount = seqDescriptor.getLength();
1677*cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > lDispatcher(nCount);
1678*cdf0e10cSrcweir     for( sal_Int32 i=0; i<nCount; ++i )
1679*cdf0e10cSrcweir         lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL,
1680*cdf0e10cSrcweir                                               seqDescriptor[i].FrameName,
1681*cdf0e10cSrcweir                                               seqDescriptor[i].SearchFlags );
1682*cdf0e10cSrcweir     return lDispatcher;
1683*cdf0e10cSrcweir }
1684*cdf0e10cSrcweir 
1685*cdf0e10cSrcweir // -----------------------------------------------------------------------
1686*cdf0e10cSrcweir void SAL_CALL SfxMacroLoader::dispatchWithNotification( const ::com::sun::star::util::URL&                                                          aURL      ,
1687*cdf0e10cSrcweir                                                         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&            lArgs     ,
1688*cdf0e10cSrcweir                                                         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& xListener )
1689*cdf0e10cSrcweir               throw (::com::sun::star::uno::RuntimeException)
1690*cdf0e10cSrcweir {
1691*cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
1692*cdf0e10cSrcweir 
1693*cdf0e10cSrcweir     sal_uInt32 nPropertyCount = lArgs.getLength();
1694*cdf0e10cSrcweir     ::rtl::OUString aReferer;
1695*cdf0e10cSrcweir     for( sal_uInt32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
1696*cdf0e10cSrcweir     {
1697*cdf0e10cSrcweir         if( lArgs[nProperty].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")) )
1698*cdf0e10cSrcweir         {
1699*cdf0e10cSrcweir             lArgs[nProperty].Value >>= aReferer;
1700*cdf0e10cSrcweir             break;
1701*cdf0e10cSrcweir         }
1702*cdf0e10cSrcweir     }
1703*cdf0e10cSrcweir 
1704*cdf0e10cSrcweir     ::com::sun::star::uno::Any aAny;
1705*cdf0e10cSrcweir     ErrCode nErr = loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() );
1706*cdf0e10cSrcweir     if( xListener.is() )
1707*cdf0e10cSrcweir     {
1708*cdf0e10cSrcweir         // always call dispatchFinished(), because we didn't load a document but
1709*cdf0e10cSrcweir         // executed a macro instead!
1710*cdf0e10cSrcweir         ::com::sun::star::frame::DispatchResultEvent aEvent;
1711*cdf0e10cSrcweir 
1712*cdf0e10cSrcweir         aEvent.Source = static_cast< ::cppu::OWeakObject* >(this);
1713*cdf0e10cSrcweir         if( nErr == ERRCODE_NONE )
1714*cdf0e10cSrcweir             aEvent.State = ::com::sun::star::frame::DispatchResultState::SUCCESS;
1715*cdf0e10cSrcweir         else
1716*cdf0e10cSrcweir             aEvent.State = ::com::sun::star::frame::DispatchResultState::FAILURE;
1717*cdf0e10cSrcweir 
1718*cdf0e10cSrcweir         xListener->dispatchFinished( aEvent ) ;
1719*cdf0e10cSrcweir     }
1720*cdf0e10cSrcweir }
1721*cdf0e10cSrcweir 
1722*cdf0e10cSrcweir ::com::sun::star::uno::Any SAL_CALL SfxMacroLoader::dispatchWithReturnValue(
1723*cdf0e10cSrcweir     const ::com::sun::star::util::URL& aURL,
1724*cdf0e10cSrcweir     const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& ) throw (::com::sun::star::uno::RuntimeException)
1725*cdf0e10cSrcweir {
1726*cdf0e10cSrcweir     ::com::sun::star::uno::Any aRet;
1727*cdf0e10cSrcweir         /*ErrCode nErr = */loadMacro( aURL.Complete, aRet, GetObjectShell_Impl() );
1728*cdf0e10cSrcweir     return aRet;
1729*cdf0e10cSrcweir }
1730*cdf0e10cSrcweir 
1731*cdf0e10cSrcweir // -----------------------------------------------------------------------
1732*cdf0e10cSrcweir void SAL_CALL SfxMacroLoader::dispatch( const ::com::sun::star::util::URL&                                               aURL  ,
1733*cdf0e10cSrcweir                                         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs )
1734*cdf0e10cSrcweir               throw (::com::sun::star::uno::RuntimeException)
1735*cdf0e10cSrcweir {
1736*cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
1737*cdf0e10cSrcweir 
1738*cdf0e10cSrcweir     sal_uInt32 nPropertyCount = lArgs.getLength();
1739*cdf0e10cSrcweir     ::rtl::OUString aReferer;
1740*cdf0e10cSrcweir     for( sal_uInt32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
1741*cdf0e10cSrcweir     {
1742*cdf0e10cSrcweir         if( lArgs[nProperty].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")) )
1743*cdf0e10cSrcweir         {
1744*cdf0e10cSrcweir             lArgs[nProperty].Value >>= aReferer;
1745*cdf0e10cSrcweir             break;
1746*cdf0e10cSrcweir         }
1747*cdf0e10cSrcweir     }
1748*cdf0e10cSrcweir 
1749*cdf0e10cSrcweir     ::com::sun::star::uno::Any aAny;
1750*cdf0e10cSrcweir     /*ErrCode nErr = */loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() );
1751*cdf0e10cSrcweir }
1752*cdf0e10cSrcweir 
1753*cdf0e10cSrcweir // -----------------------------------------------------------------------
1754*cdf0e10cSrcweir void SAL_CALL SfxMacroLoader::addStatusListener(
1755*cdf0e10cSrcweir     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& ,
1756*cdf0e10cSrcweir     const ::com::sun::star::util::URL&                                                    )
1757*cdf0e10cSrcweir               throw (::com::sun::star::uno::RuntimeException)
1758*cdf0e10cSrcweir {
1759*cdf0e10cSrcweir     /* TODO
1760*cdf0e10cSrcweir             How we can handle different listener for further coming or currently running dispatch() jobs
1761*cdf0e10cSrcweir             without any inconsistency!
1762*cdf0e10cSrcweir      */
1763*cdf0e10cSrcweir }
1764*cdf0e10cSrcweir 
1765*cdf0e10cSrcweir // -----------------------------------------------------------------------
1766*cdf0e10cSrcweir void SAL_CALL SfxMacroLoader::removeStatusListener(
1767*cdf0e10cSrcweir     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >&,
1768*cdf0e10cSrcweir     const ::com::sun::star::util::URL&                                                  )
1769*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException)
1770*cdf0e10cSrcweir {
1771*cdf0e10cSrcweir }
1772*cdf0e10cSrcweir 
1773*cdf0e10cSrcweir ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star::uno::Any& rRetval, SfxObjectShell* pSh )
1774*cdf0e10cSrcweir     throw ( ::com::sun::star::uno::RuntimeException )
1775*cdf0e10cSrcweir {
1776*cdf0e10cSrcweir     SfxObjectShell* pCurrent = pSh;
1777*cdf0e10cSrcweir     if ( !pCurrent )
1778*cdf0e10cSrcweir         // all not full qualified names use the BASIC of the given or current document
1779*cdf0e10cSrcweir         pCurrent = SfxObjectShell::Current();
1780*cdf0e10cSrcweir 
1781*cdf0e10cSrcweir     // 'macro:///lib.mod.proc(args)' => macro of App-BASIC
1782*cdf0e10cSrcweir     // 'macro://[docname|.]/lib.mod.proc(args)' => macro of current or qualified document
1783*cdf0e10cSrcweir     // 'macro://obj.method(args)' => direct API call, execute it via App-BASIC
1784*cdf0e10cSrcweir     String aMacro( rURL );
1785*cdf0e10cSrcweir     sal_uInt16 nHashPos = aMacro.Search( '/', 8 );
1786*cdf0e10cSrcweir     sal_uInt16 nArgsPos = aMacro.Search( '(' );
1787*cdf0e10cSrcweir     BasicManager *pAppMgr = SFX_APP()->GetBasicManager();
1788*cdf0e10cSrcweir     BasicManager *pBasMgr = 0;
1789*cdf0e10cSrcweir     ErrCode nErr = ERRCODE_NONE;
1790*cdf0e10cSrcweir 
1791*cdf0e10cSrcweir     // should a macro function be executed ( no direct API call)?
1792*cdf0e10cSrcweir     if ( STRING_NOTFOUND != nHashPos && nHashPos < nArgsPos )
1793*cdf0e10cSrcweir     {
1794*cdf0e10cSrcweir         // find BasicManager
1795*cdf0e10cSrcweir         SfxObjectShell* pDoc = NULL;
1796*cdf0e10cSrcweir         String aBasMgrName( INetURLObject::decode(aMacro.Copy( 8, nHashPos-8 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) );
1797*cdf0e10cSrcweir         if ( !aBasMgrName.Len() )
1798*cdf0e10cSrcweir             pBasMgr = pAppMgr;
1799*cdf0e10cSrcweir         else if ( aBasMgrName.EqualsAscii(".") )
1800*cdf0e10cSrcweir         {
1801*cdf0e10cSrcweir             // current/actual document
1802*cdf0e10cSrcweir             pDoc = pCurrent;
1803*cdf0e10cSrcweir             if (pDoc)
1804*cdf0e10cSrcweir                 pBasMgr = pDoc->GetBasicManager();
1805*cdf0e10cSrcweir         }
1806*cdf0e10cSrcweir         else
1807*cdf0e10cSrcweir         {
1808*cdf0e10cSrcweir             // full qualified name, find document by name
1809*cdf0e10cSrcweir             for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
1810*cdf0e10cSrcweir                     pObjSh && !pBasMgr;
1811*cdf0e10cSrcweir                     pObjSh = SfxObjectShell::GetNext(*pObjSh) )
1812*cdf0e10cSrcweir                 if ( aBasMgrName == pObjSh->GetTitle(SFX_TITLE_APINAME) )
1813*cdf0e10cSrcweir                 {
1814*cdf0e10cSrcweir                     pDoc = pObjSh;
1815*cdf0e10cSrcweir                     pBasMgr = pDoc->GetBasicManager();
1816*cdf0e10cSrcweir                 }
1817*cdf0e10cSrcweir         }
1818*cdf0e10cSrcweir 
1819*cdf0e10cSrcweir         if ( pBasMgr )
1820*cdf0e10cSrcweir         {
1821*cdf0e10cSrcweir             const bool bIsAppBasic = ( pBasMgr == pAppMgr );
1822*cdf0e10cSrcweir             const bool bIsDocBasic = ( pBasMgr != pAppMgr );
1823*cdf0e10cSrcweir 
1824*cdf0e10cSrcweir             if ( pDoc )
1825*cdf0e10cSrcweir             {
1826*cdf0e10cSrcweir                 // security check for macros from document basic if an SFX doc is given
1827*cdf0e10cSrcweir                 if ( !pDoc->AdjustMacroMode( String() ) )
1828*cdf0e10cSrcweir                     // check forbids execution
1829*cdf0e10cSrcweir                     return ERRCODE_IO_ACCESSDENIED;
1830*cdf0e10cSrcweir             }
1831*cdf0e10cSrcweir             else if ( pDoc && pDoc->GetMedium() )
1832*cdf0e10cSrcweir             {
1833*cdf0e10cSrcweir                 pDoc->AdjustMacroMode( String() );
1834*cdf0e10cSrcweir                 SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
1835*cdf0e10cSrcweir                 SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pMacroExecModeItem, SfxUInt16Item, SID_MACROEXECMODE, sal_False);
1836*cdf0e10cSrcweir                 if ( pUpdateDocItem && pMacroExecModeItem
1837*cdf0e10cSrcweir                   && pUpdateDocItem->GetValue() == document::UpdateDocMode::NO_UPDATE
1838*cdf0e10cSrcweir                   && pMacroExecModeItem->GetValue() == document::MacroExecMode::NEVER_EXECUTE )
1839*cdf0e10cSrcweir                     return ERRCODE_IO_ACCESSDENIED;
1840*cdf0e10cSrcweir             }
1841*cdf0e10cSrcweir 
1842*cdf0e10cSrcweir             // find BASIC method
1843*cdf0e10cSrcweir             String aQualifiedMethod( INetURLObject::decode(aMacro.Copy( nHashPos+1 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) );
1844*cdf0e10cSrcweir             String aArgs;
1845*cdf0e10cSrcweir             if ( STRING_NOTFOUND != nArgsPos )
1846*cdf0e10cSrcweir             {
1847*cdf0e10cSrcweir                 // remove arguments from macro name
1848*cdf0e10cSrcweir                 aArgs = aQualifiedMethod.Copy( nArgsPos - nHashPos - 1 );
1849*cdf0e10cSrcweir                 aQualifiedMethod.Erase( nArgsPos - nHashPos - 1 );
1850*cdf0e10cSrcweir             }
1851*cdf0e10cSrcweir 
1852*cdf0e10cSrcweir             if ( pBasMgr->HasMacro( aQualifiedMethod ) )
1853*cdf0e10cSrcweir             {
1854*cdf0e10cSrcweir                 Any aOldThisComponent;
1855*cdf0e10cSrcweir                 const bool bSetDocMacroMode = ( pDoc != NULL ) && bIsDocBasic;
1856*cdf0e10cSrcweir                 const bool bSetGlobalThisComponent = ( pDoc != NULL ) && bIsAppBasic;
1857*cdf0e10cSrcweir                 if ( bSetDocMacroMode )
1858*cdf0e10cSrcweir                 {
1859*cdf0e10cSrcweir                     // mark document: it executes an own macro, so it's in a modal mode
1860*cdf0e10cSrcweir                     pDoc->SetMacroMode_Impl( sal_True );
1861*cdf0e10cSrcweir                 }
1862*cdf0e10cSrcweir 
1863*cdf0e10cSrcweir                 if ( bSetGlobalThisComponent )
1864*cdf0e10cSrcweir                 {
1865*cdf0e10cSrcweir                     // document is executed via AppBASIC, adjust ThisComponent variable
1866*cdf0e10cSrcweir                     aOldThisComponent = pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pDoc->GetModel() ) );
1867*cdf0e10cSrcweir                 }
1868*cdf0e10cSrcweir 
1869*cdf0e10cSrcweir                 // just to let the shell be alive
1870*cdf0e10cSrcweir                 SfxObjectShellRef xKeepDocAlive = pDoc;
1871*cdf0e10cSrcweir 
1872*cdf0e10cSrcweir                 {
1873*cdf0e10cSrcweir                     // attempt to protect the document against the script tampering with its Undo Context
1874*cdf0e10cSrcweir                     ::std::auto_ptr< ::framework::DocumentUndoGuard > pUndoGuard;
1875*cdf0e10cSrcweir                     if ( bIsDocBasic )
1876*cdf0e10cSrcweir                         pUndoGuard.reset( new ::framework::DocumentUndoGuard( pDoc->GetModel() ) );
1877*cdf0e10cSrcweir 
1878*cdf0e10cSrcweir                     // execute the method
1879*cdf0e10cSrcweir                     SbxVariableRef retValRef = new SbxVariable;
1880*cdf0e10cSrcweir                     nErr = pBasMgr->ExecuteMacro( aQualifiedMethod, aArgs, retValRef );
1881*cdf0e10cSrcweir                     if ( nErr == ERRCODE_NONE )
1882*cdf0e10cSrcweir                         rRetval = sbxToUnoValue( retValRef );
1883*cdf0e10cSrcweir                 }
1884*cdf0e10cSrcweir 
1885*cdf0e10cSrcweir                 if ( bSetGlobalThisComponent )
1886*cdf0e10cSrcweir                 {
1887*cdf0e10cSrcweir                     pAppMgr->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
1888*cdf0e10cSrcweir                 }
1889*cdf0e10cSrcweir 
1890*cdf0e10cSrcweir                 if ( bSetDocMacroMode )
1891*cdf0e10cSrcweir                 {
1892*cdf0e10cSrcweir                     // remove flag for modal mode
1893*cdf0e10cSrcweir                     pDoc->SetMacroMode_Impl( sal_False );
1894*cdf0e10cSrcweir                 }
1895*cdf0e10cSrcweir             }
1896*cdf0e10cSrcweir             else
1897*cdf0e10cSrcweir                 nErr = ERRCODE_BASIC_PROC_UNDEFINED;
1898*cdf0e10cSrcweir         }
1899*cdf0e10cSrcweir         else
1900*cdf0e10cSrcweir             nErr = ERRCODE_IO_NOTEXISTS;
1901*cdf0e10cSrcweir     }
1902*cdf0e10cSrcweir     else
1903*cdf0e10cSrcweir     {
1904*cdf0e10cSrcweir         // direct API call on a specified object
1905*cdf0e10cSrcweir         String aCall( '[' );
1906*cdf0e10cSrcweir         aCall += String(INetURLObject::decode(aMacro.Copy(6), INET_HEX_ESCAPE,
1907*cdf0e10cSrcweir         INetURLObject::DECODE_WITH_CHARSET));
1908*cdf0e10cSrcweir         aCall += ']';
1909*cdf0e10cSrcweir         pAppMgr->GetLib(0)->Execute( aCall );
1910*cdf0e10cSrcweir         nErr = SbxBase::GetError();
1911*cdf0e10cSrcweir     }
1912*cdf0e10cSrcweir 
1913*cdf0e10cSrcweir     SbxBase::ResetError();
1914*cdf0e10cSrcweir     return nErr;
1915*cdf0e10cSrcweir }
1916*cdf0e10cSrcweir 
1917*cdf0e10cSrcweir SFX_IMPL_XSERVICEINFO( SfxAppDispatchProvider, "com.sun.star.frame.DispatchProvider", "com.sun.star.comp.sfx2.AppDispatchProvider" )                                                                \
1918*cdf0e10cSrcweir SFX_IMPL_SINGLEFACTORY( SfxAppDispatchProvider );
1919*cdf0e10cSrcweir 
1920*cdf0e10cSrcweir void SAL_CALL SfxAppDispatchProvider::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
1921*cdf0e10cSrcweir {
1922*cdf0e10cSrcweir     Reference < XFrame > xFrame;
1923*cdf0e10cSrcweir     if ( aArguments.getLength() )
1924*cdf0e10cSrcweir     {
1925*cdf0e10cSrcweir         aArguments[0] >>= xFrame;
1926*cdf0e10cSrcweir         m_xFrame = xFrame;
1927*cdf0e10cSrcweir     }
1928*cdf0e10cSrcweir }
1929*cdf0e10cSrcweir 
1930*cdf0e10cSrcweir Reference < XDispatch > SAL_CALL SfxAppDispatchProvider::queryDispatch(
1931*cdf0e10cSrcweir     const ::com::sun::star::util::URL& aURL,
1932*cdf0e10cSrcweir     const ::rtl::OUString& /*sTargetFrameName*/,
1933*cdf0e10cSrcweir     FrameSearchFlags /*eSearchFlags*/ ) throw( RuntimeException )
1934*cdf0e10cSrcweir {
1935*cdf0e10cSrcweir     sal_uInt16                  nId( 0 );
1936*cdf0e10cSrcweir     sal_Bool                bMasterCommand( sal_False );
1937*cdf0e10cSrcweir     Reference < XDispatch > xDisp;
1938*cdf0e10cSrcweir     const SfxSlot* pSlot = 0;
1939*cdf0e10cSrcweir     SfxDispatcher* pAppDisp = SFX_APP()->GetAppDispatcher_Impl();
1940*cdf0e10cSrcweir     if ( aURL.Protocol.compareToAscii( "slot:" ) == COMPARE_EQUAL ||
1941*cdf0e10cSrcweir          aURL.Protocol.compareToAscii( "commandId:" ) == COMPARE_EQUAL )
1942*cdf0e10cSrcweir     {
1943*cdf0e10cSrcweir         nId = (sal_uInt16) aURL.Path.toInt32();
1944*cdf0e10cSrcweir         SfxShell* pShell;
1945*cdf0e10cSrcweir         pAppDisp->GetShellAndSlot_Impl( nId, &pShell, &pSlot, sal_True, sal_True );
1946*cdf0e10cSrcweir     }
1947*cdf0e10cSrcweir     else if ( aURL.Protocol.compareToAscii( ".uno:" ) == COMPARE_EQUAL )
1948*cdf0e10cSrcweir     {
1949*cdf0e10cSrcweir         // Support ".uno" commands. Map commands to slotid
1950*cdf0e10cSrcweir         bMasterCommand = SfxOfficeDispatch::IsMasterUnoCommand( aURL );
1951*cdf0e10cSrcweir         if ( bMasterCommand )
1952*cdf0e10cSrcweir             pSlot = pAppDisp->GetSlot( SfxOfficeDispatch::GetMasterUnoCommand( aURL ) );
1953*cdf0e10cSrcweir         else
1954*cdf0e10cSrcweir             pSlot = pAppDisp->GetSlot( aURL.Main );
1955*cdf0e10cSrcweir     }
1956*cdf0e10cSrcweir 
1957*cdf0e10cSrcweir     if ( pSlot )
1958*cdf0e10cSrcweir     {
1959*cdf0e10cSrcweir         SfxOfficeDispatch* pDispatch = new SfxOfficeDispatch( pAppDisp, pSlot, aURL ) ;
1960*cdf0e10cSrcweir         pDispatch->SetFrame(m_xFrame);
1961*cdf0e10cSrcweir         pDispatch->SetMasterUnoCommand( bMasterCommand );
1962*cdf0e10cSrcweir         xDisp = pDispatch;
1963*cdf0e10cSrcweir     }
1964*cdf0e10cSrcweir 
1965*cdf0e10cSrcweir     return xDisp;
1966*cdf0e10cSrcweir }
1967*cdf0e10cSrcweir 
1968*cdf0e10cSrcweir Sequence< Reference < XDispatch > > SAL_CALL SfxAppDispatchProvider::queryDispatches( const Sequence < DispatchDescriptor >& seqDescriptor )
1969*cdf0e10cSrcweir throw( RuntimeException )
1970*cdf0e10cSrcweir {
1971*cdf0e10cSrcweir     sal_Int32 nCount = seqDescriptor.getLength();
1972*cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > lDispatcher(nCount);
1973*cdf0e10cSrcweir     for( sal_Int32 i=0; i<nCount; ++i )
1974*cdf0e10cSrcweir         lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL,
1975*cdf0e10cSrcweir                                               seqDescriptor[i].FrameName,
1976*cdf0e10cSrcweir                                               seqDescriptor[i].SearchFlags );
1977*cdf0e10cSrcweir     return lDispatcher;
1978*cdf0e10cSrcweir }
1979*cdf0e10cSrcweir 
1980*cdf0e10cSrcweir Sequence< sal_Int16 > SAL_CALL SfxAppDispatchProvider::getSupportedCommandGroups()
1981*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
1982*cdf0e10cSrcweir {
1983*cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
1984*cdf0e10cSrcweir 
1985*cdf0e10cSrcweir     std::list< sal_Int16 > aGroupList;
1986*cdf0e10cSrcweir     SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl();
1987*cdf0e10cSrcweir 
1988*cdf0e10cSrcweir     const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG );
1989*cdf0e10cSrcweir 
1990*cdf0e10cSrcweir     // Gruppe anw"ahlen ( Gruppe 0 ist intern )
1991*cdf0e10cSrcweir     for ( sal_uInt16 i=0; i<pAppSlotPool->GetGroupCount(); i++ )
1992*cdf0e10cSrcweir     {
1993*cdf0e10cSrcweir         String aName = pAppSlotPool->SeekGroup( i );
1994*cdf0e10cSrcweir         const SfxSlot* pSfxSlot = pAppSlotPool->FirstSlot();
1995*cdf0e10cSrcweir         while ( pSfxSlot )
1996*cdf0e10cSrcweir         {
1997*cdf0e10cSrcweir             if ( pSfxSlot->GetMode() & nMode )
1998*cdf0e10cSrcweir             {
1999*cdf0e10cSrcweir                 sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() );
2000*cdf0e10cSrcweir                 aGroupList.push_back( nCommandGroup );
2001*cdf0e10cSrcweir                 break;
2002*cdf0e10cSrcweir             }
2003*cdf0e10cSrcweir             pSfxSlot = pAppSlotPool->NextSlot();
2004*cdf0e10cSrcweir         }
2005*cdf0e10cSrcweir     }
2006*cdf0e10cSrcweir 
2007*cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< sal_Int16 > aSeq =
2008*cdf0e10cSrcweir         comphelper::containerToSequence< sal_Int16, std::list< sal_Int16 > >( aGroupList );
2009*cdf0e10cSrcweir 
2010*cdf0e10cSrcweir     return aSeq;
2011*cdf0e10cSrcweir }
2012*cdf0e10cSrcweir 
2013*cdf0e10cSrcweir Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL SfxAppDispatchProvider::getConfigurableDispatchInformation( sal_Int16 nCmdGroup )
2014*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
2015*cdf0e10cSrcweir {
2016*cdf0e10cSrcweir     std::list< ::com::sun::star::frame::DispatchInformation > aCmdList;
2017*cdf0e10cSrcweir 
2018*cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
2019*cdf0e10cSrcweir     SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl();
2020*cdf0e10cSrcweir 
2021*cdf0e10cSrcweir     if ( pAppSlotPool )
2022*cdf0e10cSrcweir     {
2023*cdf0e10cSrcweir         const sal_uIntPtr   nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG );
2024*cdf0e10cSrcweir         rtl::OUString aCmdPrefix( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ));
2025*cdf0e10cSrcweir 
2026*cdf0e10cSrcweir         // Gruppe anw"ahlen ( Gruppe 0 ist intern )
2027*cdf0e10cSrcweir         for ( sal_uInt16 i=0; i<pAppSlotPool->GetGroupCount(); i++ )
2028*cdf0e10cSrcweir         {
2029*cdf0e10cSrcweir             String aName = pAppSlotPool->SeekGroup( i );
2030*cdf0e10cSrcweir             const SfxSlot* pSfxSlot = pAppSlotPool->FirstSlot();
2031*cdf0e10cSrcweir             if ( pSfxSlot )
2032*cdf0e10cSrcweir             {
2033*cdf0e10cSrcweir                 sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() );
2034*cdf0e10cSrcweir                 if ( nCommandGroup == nCmdGroup )
2035*cdf0e10cSrcweir                 {
2036*cdf0e10cSrcweir                     while ( pSfxSlot )
2037*cdf0e10cSrcweir                     {
2038*cdf0e10cSrcweir                         if ( pSfxSlot->GetMode() & nMode )
2039*cdf0e10cSrcweir                         {
2040*cdf0e10cSrcweir                             ::com::sun::star::frame::DispatchInformation aCmdInfo;
2041*cdf0e10cSrcweir                             ::rtl::OUStringBuffer aBuf( aCmdPrefix );
2042*cdf0e10cSrcweir                             aBuf.appendAscii( pSfxSlot->GetUnoName() );
2043*cdf0e10cSrcweir                             aCmdInfo.Command = aBuf.makeStringAndClear();
2044*cdf0e10cSrcweir                             aCmdInfo.GroupId = nCommandGroup;
2045*cdf0e10cSrcweir                             aCmdList.push_back( aCmdInfo );
2046*cdf0e10cSrcweir                         }
2047*cdf0e10cSrcweir                         pSfxSlot = pAppSlotPool->NextSlot();
2048*cdf0e10cSrcweir                     }
2049*cdf0e10cSrcweir                 }
2050*cdf0e10cSrcweir             }
2051*cdf0e10cSrcweir         }
2052*cdf0e10cSrcweir     }
2053*cdf0e10cSrcweir 
2054*cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > aSeq =
2055*cdf0e10cSrcweir         comphelper::containerToSequence< ::com::sun::star::frame::DispatchInformation, std::list< ::com::sun::star::frame::DispatchInformation > >( aCmdList );
2056*cdf0e10cSrcweir 
2057*cdf0e10cSrcweir     return aSeq;
2058*cdf0e10cSrcweir }
2059*cdf0e10cSrcweir 
2060*cdf0e10cSrcweir #ifdef TEST_HANDLERS
2061*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
2062*cdf0e10cSrcweir 
2063*cdf0e10cSrcweir #include <com/sun/star/awt/XKeyHandler.hdl>
2064*cdf0e10cSrcweir #include <com/sun/star/awt/XMouseClickHandler.hdl>
2065*cdf0e10cSrcweir 
2066*cdf0e10cSrcweir class TestKeyHandler: public ::cppu::WeakImplHelper2
2067*cdf0e10cSrcweir <
2068*cdf0e10cSrcweir     com::sun::star::awt::XKeyHandler,
2069*cdf0e10cSrcweir     com::sun::star::lang::XServiceInfo
2070*cdf0e10cSrcweir >
2071*cdf0e10cSrcweir {
2072*cdf0e10cSrcweir public:
2073*cdf0e10cSrcweir     TestKeyHandler( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& ){}
2074*cdf0e10cSrcweir 
2075*cdf0e10cSrcweir     SFX_DECL_XSERVICEINFO
2076*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
2077*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
2078*cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source)
2079*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
2080*cdf0e10cSrcweir };
2081*cdf0e10cSrcweir 
2082*cdf0e10cSrcweir class TestMouseClickHandler: public ::cppu::WeakImplHelper2
2083*cdf0e10cSrcweir <
2084*cdf0e10cSrcweir     com::sun::star::awt::XMouseClickHandler,
2085*cdf0e10cSrcweir     com::sun::star::lang::XServiceInfo
2086*cdf0e10cSrcweir >
2087*cdf0e10cSrcweir {
2088*cdf0e10cSrcweir public:
2089*cdf0e10cSrcweir     TestMouseClickHandler( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& ){}
2090*cdf0e10cSrcweir 
2091*cdf0e10cSrcweir     SFX_DECL_XSERVICEINFO
2092*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
2093*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
2094*cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source)
2095*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
2096*cdf0e10cSrcweir };
2097*cdf0e10cSrcweir 
2098*cdf0e10cSrcweir sal_Bool SAL_CALL TestKeyHandler::keyPressed( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException)
2099*cdf0e10cSrcweir {
2100*cdf0e10cSrcweir     return sal_False;
2101*cdf0e10cSrcweir }
2102*cdf0e10cSrcweir 
2103*cdf0e10cSrcweir sal_Bool SAL_CALL TestKeyHandler::keyReleased( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException)
2104*cdf0e10cSrcweir {
2105*cdf0e10cSrcweir     return sal_False;
2106*cdf0e10cSrcweir }
2107*cdf0e10cSrcweir 
2108*cdf0e10cSrcweir void SAL_CALL TestKeyHandler::disposing( const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException)
2109*cdf0e10cSrcweir {
2110*cdf0e10cSrcweir }
2111*cdf0e10cSrcweir 
2112*cdf0e10cSrcweir sal_Bool SAL_CALL TestMouseClickHandler::mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException)
2113*cdf0e10cSrcweir {
2114*cdf0e10cSrcweir     return sal_False;
2115*cdf0e10cSrcweir }
2116*cdf0e10cSrcweir 
2117*cdf0e10cSrcweir sal_Bool SAL_CALL TestMouseClickHandler::mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException)
2118*cdf0e10cSrcweir {
2119*cdf0e10cSrcweir     return sal_False;
2120*cdf0e10cSrcweir }
2121*cdf0e10cSrcweir 
2122*cdf0e10cSrcweir void SAL_CALL TestMouseClickHandler::disposing( const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException)
2123*cdf0e10cSrcweir {
2124*cdf0e10cSrcweir }
2125*cdf0e10cSrcweir 
2126*cdf0e10cSrcweir SFX_IMPL_XSERVICEINFO( TestKeyHandler, "com.sun.star.task.Job", "com.sun.star.comp.Office.KeyHandler");
2127*cdf0e10cSrcweir SFX_IMPL_XSERVICEINFO( TestMouseClickHandler, "com.sun.star.task.Job", "com.sun.star.comp.Office.MouseClickHandler");
2128*cdf0e10cSrcweir SFX_IMPL_SINGLEFACTORY( TestKeyHandler );
2129*cdf0e10cSrcweir SFX_IMPL_SINGLEFACTORY( TestMouseClickHandler );
2130*cdf0e10cSrcweir #endif
2131*cdf0e10cSrcweir // -----------------------------------------------------------------------
2132*cdf0e10cSrcweir 
2133*cdf0e10cSrcweir extern "C" {
2134*cdf0e10cSrcweir 
2135*cdf0e10cSrcweir SFX2_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment(
2136*cdf0e10cSrcweir     const sal_Char**  ppEnvironmentTypeName	,
2137*cdf0e10cSrcweir     uno_Environment** )
2138*cdf0e10cSrcweir {
2139*cdf0e10cSrcweir     *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
2140*cdf0e10cSrcweir }
2141*cdf0e10cSrcweir 
2142*cdf0e10cSrcweir SFX2_DLLPUBLIC void* SAL_CALL component_getFactory(
2143*cdf0e10cSrcweir     const sal_Char*	pImplementationName	,
2144*cdf0e10cSrcweir     void*           pServiceManager		,
2145*cdf0e10cSrcweir     void*		                          )
2146*cdf0e10cSrcweir {
2147*cdf0e10cSrcweir     // Set default return value for this operation - if it failed.
2148*cdf0e10cSrcweir     void* pReturn = NULL ;
2149*cdf0e10cSrcweir 
2150*cdf0e10cSrcweir     if	(
2151*cdf0e10cSrcweir             ( pImplementationName	!=	NULL ) &&
2152*cdf0e10cSrcweir             ( pServiceManager		!=	NULL )
2153*cdf0e10cSrcweir         )
2154*cdf0e10cSrcweir     {
2155*cdf0e10cSrcweir         // Define variables which are used in following macros.
2156*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
2157*cdf0e10cSrcweir               xFactory;
2158*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >	xServiceManager( reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ) )	;
2159*cdf0e10cSrcweir 
2160*cdf0e10cSrcweir         //=============================================================================
2161*cdf0e10cSrcweir         //  Add new macro line to handle new service.
2162*cdf0e10cSrcweir         //
2163*cdf0e10cSrcweir         //	!!! ATTENTION !!!
2164*cdf0e10cSrcweir         //		Write no ";" at end of line and dont forget "else" ! (see macro)
2165*cdf0e10cSrcweir         //=============================================================================
2166*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl )
2167*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( SfxFrameLoader_Impl )
2168*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( SfxMacroLoader )
2169*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( SfxStandaloneDocumentInfoObject )
2170*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( SfxAppDispatchProvider )
2171*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( SfxDocTplService )
2172*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( ShutdownIcon )
2173*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( SfxApplicationScriptLibraryContainer )
2174*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( SfxApplicationDialogLibraryContainer )
2175*cdf0e10cSrcweir #ifdef TEST_HANDLERS
2176*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( TestKeyHandler )
2177*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( TestMouseClickHandler )
2178*cdf0e10cSrcweir #endif
2179*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( OPackageStructureCreator )
2180*cdf0e10cSrcweir         #if 0
2181*cdf0e10cSrcweir         if ( ::sfx2::AppletObject::impl_getStaticImplementationName().equals(
2182*cdf0e10cSrcweir                  ::rtl::OUString::createFromAscii( pImplementationName ) ) )
2183*cdf0e10cSrcweir         {
2184*cdf0e10cSrcweir             xFactory = ::sfx2::AppletObject::impl_createFactory();
2185*cdf0e10cSrcweir         }
2186*cdf0e10cSrcweir         #endif
2187*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::PluginObject )
2188*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::IFrameObject )
2189*cdf0e10cSrcweir         IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::OwnSubFilterService )
2190*cdf0e10cSrcweir         if ( ::comp_SfxDocumentMetaData::_getImplementationName().equals(
2191*cdf0e10cSrcweir                  ::rtl::OUString::createFromAscii( pImplementationName ) ) )
2192*cdf0e10cSrcweir         {
2193*cdf0e10cSrcweir             xFactory = ::cppu::createSingleComponentFactory(
2194*cdf0e10cSrcweir             ::comp_SfxDocumentMetaData::_create,
2195*cdf0e10cSrcweir             ::comp_SfxDocumentMetaData::_getImplementationName(),
2196*cdf0e10cSrcweir             ::comp_SfxDocumentMetaData::_getSupportedServiceNames());
2197*cdf0e10cSrcweir         }
2198*cdf0e10cSrcweir 
2199*cdf0e10cSrcweir         // Factory is valid - service was found.
2200*cdf0e10cSrcweir         if ( xFactory.is() )
2201*cdf0e10cSrcweir         {
2202*cdf0e10cSrcweir             xFactory->acquire();
2203*cdf0e10cSrcweir             pReturn = xFactory.get();
2204*cdf0e10cSrcweir         }
2205*cdf0e10cSrcweir     }
2206*cdf0e10cSrcweir     // Return with result of this operation.
2207*cdf0e10cSrcweir     return pReturn ;
2208*cdf0e10cSrcweir }
2209*cdf0e10cSrcweir } // extern "C"
2210*cdf0e10cSrcweir 
2211*cdf0e10cSrcweir //=========================================================================
2212*cdf0e10cSrcweir 
2213*cdf0e10cSrcweir void SAL_CALL FilterOptionsContinuation::setFilterOptions(
2214*cdf0e10cSrcweir                 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps )
2215*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException)
2216*cdf0e10cSrcweir {
2217*cdf0e10cSrcweir     rProperties = rProps;
2218*cdf0e10cSrcweir }
2219*cdf0e10cSrcweir 
2220*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
2221*cdf0e10cSrcweir     FilterOptionsContinuation::getFilterOptions()
2222*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException)
2223*cdf0e10cSrcweir {
2224*cdf0e10cSrcweir     return rProperties;
2225*cdf0e10cSrcweir }
2226*cdf0e10cSrcweir 
2227*cdf0e10cSrcweir //=========================================================================
2228*cdf0e10cSrcweir 
2229*cdf0e10cSrcweir RequestFilterOptions::RequestFilterOptions( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > rModel,
2230*cdf0e10cSrcweir                               ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > rProperties )
2231*cdf0e10cSrcweir {
2232*cdf0e10cSrcweir     ::rtl::OUString temp;
2233*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2;
2234*cdf0e10cSrcweir     ::com::sun::star::document::FilterOptionsRequest aOptionsRequest( temp,
2235*cdf0e10cSrcweir                                                                       temp2,
2236*cdf0e10cSrcweir                                                                       rModel,
2237*cdf0e10cSrcweir                                                                       rProperties );
2238*cdf0e10cSrcweir 
2239*cdf0e10cSrcweir     m_aRequest <<= aOptionsRequest;
2240*cdf0e10cSrcweir 
2241*cdf0e10cSrcweir     m_pAbort  = new comphelper::OInteractionAbort;
2242*cdf0e10cSrcweir     m_pOptions = new FilterOptionsContinuation;
2243*cdf0e10cSrcweir 
2244*cdf0e10cSrcweir     m_lContinuations.realloc( 2 );
2245*cdf0e10cSrcweir     m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort  );
2246*cdf0e10cSrcweir     m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pOptions );
2247*cdf0e10cSrcweir }
2248*cdf0e10cSrcweir 
2249*cdf0e10cSrcweir ::com::sun::star::uno::Any SAL_CALL RequestFilterOptions::getRequest()
2250*cdf0e10cSrcweir         throw( ::com::sun::star::uno::RuntimeException )
2251*cdf0e10cSrcweir {
2252*cdf0e10cSrcweir     return m_aRequest;
2253*cdf0e10cSrcweir }
2254*cdf0e10cSrcweir 
2255*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
2256*cdf0e10cSrcweir     SAL_CALL RequestFilterOptions::getContinuations()
2257*cdf0e10cSrcweir         throw( ::com::sun::star::uno::RuntimeException )
2258*cdf0e10cSrcweir {
2259*cdf0e10cSrcweir     return m_lContinuations;
2260*cdf0e10cSrcweir }
2261*cdf0e10cSrcweir 
2262*cdf0e10cSrcweir //=========================================================================
2263*cdf0e10cSrcweir class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
2264*cdf0e10cSrcweir {
2265*cdf0e10cSrcweir     ::com::sun::star::uno::Any m_aRequest;
2266*cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations;
2267*cdf0e10cSrcweir     comphelper::OInteractionApprove* m_pApprove;
2268*cdf0e10cSrcweir     comphelper::OInteractionDisapprove*  m_pDisapprove;
2269*cdf0e10cSrcweir 
2270*cdf0e10cSrcweir public:
2271*cdf0e10cSrcweir     RequestPackageReparation_Impl( ::rtl::OUString aName );
2272*cdf0e10cSrcweir     sal_Bool    isApproved();
2273*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
2274*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations()
2275*cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
2276*cdf0e10cSrcweir };
2277*cdf0e10cSrcweir 
2278*cdf0e10cSrcweir RequestPackageReparation_Impl::RequestPackageReparation_Impl( ::rtl::OUString aName )
2279*cdf0e10cSrcweir {
2280*cdf0e10cSrcweir 	::rtl::OUString temp;
2281*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2;
2282*cdf0e10cSrcweir 	::com::sun::star::document::BrokenPackageRequest aBrokenPackageRequest( temp,
2283*cdf0e10cSrcweir                                                        				  		temp2,
2284*cdf0e10cSrcweir 																	  		aName );
2285*cdf0e10cSrcweir    	m_aRequest <<= aBrokenPackageRequest;
2286*cdf0e10cSrcweir     m_pApprove = new comphelper::OInteractionApprove;
2287*cdf0e10cSrcweir     m_pDisapprove = new comphelper::OInteractionDisapprove;
2288*cdf0e10cSrcweir    	m_lContinuations.realloc( 2 );
2289*cdf0e10cSrcweir    	m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pApprove );
2290*cdf0e10cSrcweir    	m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pDisapprove );
2291*cdf0e10cSrcweir }
2292*cdf0e10cSrcweir 
2293*cdf0e10cSrcweir sal_Bool RequestPackageReparation_Impl::isApproved()
2294*cdf0e10cSrcweir {
2295*cdf0e10cSrcweir     return m_pApprove->wasSelected();
2296*cdf0e10cSrcweir }
2297*cdf0e10cSrcweir 
2298*cdf0e10cSrcweir ::com::sun::star::uno::Any SAL_CALL RequestPackageReparation_Impl::getRequest()
2299*cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException )
2300*cdf0e10cSrcweir {
2301*cdf0e10cSrcweir 	return m_aRequest;
2302*cdf0e10cSrcweir }
2303*cdf0e10cSrcweir 
2304*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
2305*cdf0e10cSrcweir     SAL_CALL RequestPackageReparation_Impl::getContinuations()
2306*cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException )
2307*cdf0e10cSrcweir {
2308*cdf0e10cSrcweir 	return m_lContinuations;
2309*cdf0e10cSrcweir }
2310*cdf0e10cSrcweir 
2311*cdf0e10cSrcweir RequestPackageReparation::RequestPackageReparation( ::rtl::OUString aName )
2312*cdf0e10cSrcweir {
2313*cdf0e10cSrcweir     pImp = new RequestPackageReparation_Impl( aName );
2314*cdf0e10cSrcweir     pImp->acquire();
2315*cdf0e10cSrcweir }
2316*cdf0e10cSrcweir 
2317*cdf0e10cSrcweir RequestPackageReparation::~RequestPackageReparation()
2318*cdf0e10cSrcweir {
2319*cdf0e10cSrcweir     pImp->release();
2320*cdf0e10cSrcweir }
2321*cdf0e10cSrcweir 
2322*cdf0e10cSrcweir sal_Bool RequestPackageReparation::isApproved()
2323*cdf0e10cSrcweir {
2324*cdf0e10cSrcweir     return pImp->isApproved();
2325*cdf0e10cSrcweir }
2326*cdf0e10cSrcweir 
2327*cdf0e10cSrcweir com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > RequestPackageReparation::GetRequest()
2328*cdf0e10cSrcweir {
2329*cdf0e10cSrcweir     return com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >(pImp);
2330*cdf0e10cSrcweir }
2331*cdf0e10cSrcweir 
2332*cdf0e10cSrcweir //=========================================================================
2333*cdf0e10cSrcweir class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
2334*cdf0e10cSrcweir {
2335*cdf0e10cSrcweir     ::com::sun::star::uno::Any m_aRequest;
2336*cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations;
2337*cdf0e10cSrcweir     comphelper::OInteractionAbort*  m_pAbort;
2338*cdf0e10cSrcweir 
2339*cdf0e10cSrcweir public:
2340*cdf0e10cSrcweir     NotifyBrokenPackage_Impl( ::rtl::OUString aName );
2341*cdf0e10cSrcweir     sal_Bool    isAborted();
2342*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
2343*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations()
2344*cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
2345*cdf0e10cSrcweir };
2346*cdf0e10cSrcweir 
2347*cdf0e10cSrcweir NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( ::rtl::OUString aName )
2348*cdf0e10cSrcweir {
2349*cdf0e10cSrcweir 	::rtl::OUString temp;
2350*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2;
2351*cdf0e10cSrcweir 	::com::sun::star::document::BrokenPackageRequest aBrokenPackageRequest( temp,
2352*cdf0e10cSrcweir                                                        				  		temp2,
2353*cdf0e10cSrcweir 																	  		aName );
2354*cdf0e10cSrcweir    	m_aRequest <<= aBrokenPackageRequest;
2355*cdf0e10cSrcweir     m_pAbort  = new comphelper::OInteractionAbort;
2356*cdf0e10cSrcweir    	m_lContinuations.realloc( 1 );
2357*cdf0e10cSrcweir    	m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort  );
2358*cdf0e10cSrcweir }
2359*cdf0e10cSrcweir 
2360*cdf0e10cSrcweir sal_Bool NotifyBrokenPackage_Impl::isAborted()
2361*cdf0e10cSrcweir {
2362*cdf0e10cSrcweir     return m_pAbort->wasSelected();
2363*cdf0e10cSrcweir }
2364*cdf0e10cSrcweir 
2365*cdf0e10cSrcweir ::com::sun::star::uno::Any SAL_CALL NotifyBrokenPackage_Impl::getRequest()
2366*cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException )
2367*cdf0e10cSrcweir {
2368*cdf0e10cSrcweir 	return m_aRequest;
2369*cdf0e10cSrcweir }
2370*cdf0e10cSrcweir 
2371*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
2372*cdf0e10cSrcweir     SAL_CALL NotifyBrokenPackage_Impl::getContinuations()
2373*cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException )
2374*cdf0e10cSrcweir {
2375*cdf0e10cSrcweir 	return m_lContinuations;
2376*cdf0e10cSrcweir }
2377*cdf0e10cSrcweir 
2378*cdf0e10cSrcweir NotifyBrokenPackage::NotifyBrokenPackage( ::rtl::OUString aName )
2379*cdf0e10cSrcweir {
2380*cdf0e10cSrcweir     pImp = new NotifyBrokenPackage_Impl( aName );
2381*cdf0e10cSrcweir     pImp->acquire();
2382*cdf0e10cSrcweir }
2383*cdf0e10cSrcweir 
2384*cdf0e10cSrcweir NotifyBrokenPackage::~NotifyBrokenPackage()
2385*cdf0e10cSrcweir {
2386*cdf0e10cSrcweir     pImp->release();
2387*cdf0e10cSrcweir }
2388*cdf0e10cSrcweir 
2389*cdf0e10cSrcweir sal_Bool NotifyBrokenPackage::isAborted()
2390*cdf0e10cSrcweir {
2391*cdf0e10cSrcweir     return pImp->isAborted();
2392*cdf0e10cSrcweir }
2393*cdf0e10cSrcweir 
2394*cdf0e10cSrcweir com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > NotifyBrokenPackage::GetRequest()
2395*cdf0e10cSrcweir {
2396*cdf0e10cSrcweir     return com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >(pImp);
2397*cdf0e10cSrcweir }
2398*cdf0e10cSrcweir 
2399