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