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