1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unocoll.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <swtypes.hxx>
37 #include <hintids.hxx>
38 #ifndef _SVX_SVXIDS_HRC //autogen
39 #include <svx/svxids.hrc>
44 #include <poolfmt.hxx>
45 #include <unocoll.hxx>
46 #include <unosett.hxx>
47 #include <unoclbck.hxx>
48 #include <fmtanchr.hxx>
50 #include <section.hxx>
55 #include <fmtpdsc.hxx>
56 #include <pagedesc.hxx>
57 #include <vos/mutex.hxx>
58 #include <com/sun/star/text/XTextTableCursor.hpp>
59 #include <com/sun/star/text/XTextTablesSupplier.hpp>
60 #include <com/sun/star/text/TableColumnSeparator.hpp>
61 #include <com/sun/star/text/XTextTable.hpp>
62 #include <svtools/PasswordHelper.hxx>
63 #include <svtools/unoimap.hxx>
64 #include <svtools/unoevent.hxx>
66 #include <unostyle.hxx>
67 #include <unofield.hxx>
69 #include <unoframe.hxx>
70 #include <vcl/svapp.hxx>
71 #include <authfld.hxx>
72 #include <SwXTextDefaults.hxx>
73 #include <unochart.hxx>
74 #include <comphelper/makesequence.hxx>
75 #include <comphelper/sequence.hxx>
80 #include <com/sun/star/document/XCodeNameQuery.hpp>
81 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
82 #include <com/sun/star/form/XFormsSupplier.hpp>
83 #include <com/sun/star/script/ModuleInfo.hpp>
84 #include <com/sun/star/script/ModuleType.hpp>
85 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
86 #include <vbahelper/vbahelper.hxx>
87 #include <basic/basmgr.hxx>
88 using ::rtl::OUString
;
89 using namespace ::com::sun::star
;
90 using namespace ::com::sun::star::document
;
91 using namespace ::com::sun::star::uno
;
92 using namespace ::com::sun::star::text
;
93 using namespace ::com::sun::star::container
;
94 using namespace ::com::sun::star::lang
;
96 class SwVbaCodeNameProvider
: public ::cppu::WeakImplHelper1
< document::XCodeNameQuery
>
98 SwDocShell
* mpDocShell
;
99 rtl::OUString msThisDocumentCodeName
;
101 SwVbaCodeNameProvider( SwDocShell
* pDocShell
) : mpDocShell( pDocShell
) {}
103 rtl::OUString SAL_CALL
getCodeNameForObject( const uno::Reference
< uno::XInterface
>& xIf
) throw( uno::RuntimeException
)
105 // Initialise the code name
106 if ( msThisDocumentCodeName
.getLength() == 0 )
110 uno::Reference
< beans::XPropertySet
> xProps( mpDocShell
->GetModel(), uno::UNO_QUERY_THROW
);
111 uno::Reference
< container::XNameAccess
> xLibContainer( xProps
->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW
);
112 rtl::OUString
sProjectName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) );
113 if ( mpDocShell
->GetBasicManager()->GetName().Len() )
114 sProjectName
= mpDocShell
->GetBasicManager()->GetName();
116 uno::Reference
< container::XNameAccess
> xStandard( xLibContainer
->getByName( sProjectName
), uno::UNO_QUERY_THROW
);
117 uno::Sequence
< rtl::OUString
> sModuleNames
= xStandard
->getElementNames();
118 for ( sal_Int32 i
=0; i
< sModuleNames
.getLength(); ++i
)
120 script::ModuleInfo mInfo
;
121 if ( xStandard
->getByName( sModuleNames
[ i
] ) >>= mInfo
)
123 if ( mInfo
.ModuleType
== script::ModuleType::Document
)
125 msThisDocumentCodeName
= sModuleNames
[ i
];
131 catch( uno::Exception
& )
135 rtl::OUString sCodeName
;
138 OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
139 // need to find the page ( and index ) for this control
140 uno::Reference
< drawing::XDrawPageSupplier
> xSupplier( mpDocShell
->GetModel(), uno::UNO_QUERY_THROW
);
141 uno::Reference
< container::XIndexAccess
> xIndex( xSupplier
->getDrawPage(), uno::UNO_QUERY_THROW
);
142 sal_Int32 nLen
= xIndex
->getCount();
143 bool bMatched
= false;
144 uno::Sequence
< script::ScriptEventDescriptor
> aFakeEvents
;
147 uno::Reference
< form::XFormsSupplier
> xFormSupplier( xIndex
, uno::UNO_QUERY_THROW
);
148 uno::Reference
< container::XIndexAccess
> xFormIndex( xFormSupplier
->getForms(), uno::UNO_QUERY_THROW
);
149 // get the www-standard container
150 uno::Reference
< container::XIndexAccess
> xFormControls( xFormIndex
->getByIndex(0), uno::UNO_QUERY_THROW
);
151 sal_Int32 nCntrls
= xFormControls
->getCount();
152 for( sal_Int32 cIndex
= 0; cIndex
< nCntrls
; ++cIndex
)
154 uno::Reference
< uno::XInterface
> xControl( xFormControls
->getByIndex( cIndex
), uno::UNO_QUERY_THROW
);
155 bMatched
= ( xControl
== xIf
);
158 sCodeName
= msThisDocumentCodeName
;
163 catch( uno::Exception
& ) {}
165 // Probably should throw here ( if !bMatched )
170 typedef std::hash_map
< rtl::OUString
, rtl::OUString
, rtl::OUStringHash
> StringHashMap
;
171 class SwVbaProjectNameProvider
: public ::cppu::WeakImplHelper1
< container::XNameContainer
>
173 SwDocShell
* mpDocShell
;
174 StringHashMap mTemplateToProject
;
176 SwVbaProjectNameProvider( SwDocShell
* pDocShell
) : mpDocShell( pDocShell
)
179 virtual ::sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::uno::RuntimeException
)
181 return ( mTemplateToProject
.find( aName
) != mTemplateToProject
.end() );
183 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
)
185 if ( !hasByName( aName
) )
186 throw container::NoSuchElementException();
187 return uno::makeAny( mTemplateToProject
.find( aName
)->second
);
189 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames( ) throw (::com::sun::star::uno::RuntimeException
)
191 uno::Sequence
< rtl::OUString
> aElements( mTemplateToProject
.size() );
192 StringHashMap::iterator it_end
= mTemplateToProject
.end();
194 for ( StringHashMap::iterator it
= mTemplateToProject
.begin(); it
!= it_end
; ++it
, ++index
)
195 aElements
[ index
] = it
->first
;
199 virtual void SAL_CALL
insertByName( const rtl::OUString
& aName
, const uno::Any
& aElement
) throw ( com::sun::star::lang::IllegalArgumentException
, com::sun::star::container::ElementExistException
, com::sun::star::lang::WrappedTargetException
)
202 rtl::OUString sProjectName
;
203 aElement
>>= sProjectName
;
204 OSL_TRACE("** Template cache inserting template name %s with project %s"
205 , rtl::OUStringToOString( aName
, RTL_TEXTENCODING_UTF8
).getStr()
206 , rtl::OUStringToOString( sProjectName
, RTL_TEXTENCODING_UTF8
).getStr() );
207 mTemplateToProject
[ aName
] = sProjectName
;
210 virtual void SAL_CALL
removeByName( const rtl::OUString
& Name
) throw ( com::sun::star::container::NoSuchElementException
, com::sun::star::lang::WrappedTargetException
)
212 if ( !hasByName( Name
) )
213 throw container::NoSuchElementException();
214 mTemplateToProject
.erase( Name
);
216 virtual void SAL_CALL
replaceByName( const rtl::OUString
& aName
, const uno::Any
& aElement
) throw ( com::sun::star::lang::IllegalArgumentException
, com::sun::star::container::NoSuchElementException
, com::sun::star::lang::WrappedTargetException
)
218 if ( !hasByName( aName
) )
219 throw container::NoSuchElementException();
220 insertByName( aName
, aElement
); // insert will overwrite
223 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType( ) throw (::com::sun::star::uno::RuntimeException
)
225 return ::getCppuType((const rtl::OUString
*)0);
227 virtual ::sal_Bool SAL_CALL
hasElements( ) throw (::com::sun::star::uno::RuntimeException
)
230 return ( mTemplateToProject
.size() > 0 );
235 class SwVbaObjectForCodeNameProvider
: public ::cppu::WeakImplHelper1
< container::XNameAccess
>
237 SwDocShell
* mpDocShell
;
239 SwVbaObjectForCodeNameProvider( SwDocShell
* pDocShell
) : mpDocShell( pDocShell
)
241 // #FIXME #TODO is the code name for ThisDocument read anywhere?
244 virtual ::sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::uno::RuntimeException
)
246 // #FIXME #TODO we really need to be checking against the codename for
248 if ( aName
.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisDocument" ) ) ) )
252 ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
)
254 if ( !hasByName( aName
) )
255 throw container::NoSuchElementException();
256 uno::Sequence
< uno::Any
> aArgs( 2 );
257 aArgs
[0] = uno::Any( uno::Reference
< uno::XInterface
>() );
258 aArgs
[1] = uno::Any( mpDocShell
->GetModel() );
259 uno::Reference
< uno::XInterface
> xDocObj
= ov::createVBAUnoAPIServiceWithArgs( mpDocShell
, "ooo.vba.word.Document" , aArgs
);
260 OSL_TRACE("Creating Object ( ooo.vba.word.Document ) 0x%x", xDocObj
.get() );
261 return uno::makeAny( xDocObj
);
263 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames( ) throw (::com::sun::star::uno::RuntimeException
)
265 uno::Sequence
< rtl::OUString
> aNames
;
269 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType( ) throw (::com::sun::star::uno::RuntimeException
){ return uno::Type(); }
270 virtual ::sal_Bool SAL_CALL
hasElements( ) throw (::com::sun::star::uno::RuntimeException
) { return sal_True
; }
274 /******************************************************************************
276 ******************************************************************************/
277 struct ProvNamesId_Type
283 // note: this thing is indexed as an array, so do not insert/remove entries!
284 const ProvNamesId_Type __FAR_DATA aProvNamesId
[] =
286 { "com.sun.star.text.TextTable", SW_SERVICE_TYPE_TEXTTABLE
},
287 { "com.sun.star.text.TextFrame", SW_SERVICE_TYPE_TEXTFRAME
},
288 { "com.sun.star.text.GraphicObject", SW_SERVICE_TYPE_GRAPHIC
},
289 { "com.sun.star.text.TextEmbeddedObject", SW_SERVICE_TYPE_OLE
},
290 { "com.sun.star.text.Bookmark", SW_SERVICE_TYPE_BOOKMARK
},
291 { "com.sun.star.text.Footnote", SW_SERVICE_TYPE_FOOTNOTE
},
292 { "com.sun.star.text.Endnote", SW_SERVICE_TYPE_ENDNOTE
},
293 { "com.sun.star.text.DocumentIndexMark", SW_SERVICE_TYPE_INDEXMARK
},
294 { "com.sun.star.text.DocumentIndex", SW_SERVICE_TYPE_INDEX
},
295 { "com.sun.star.text.ReferenceMark", SW_SERVICE_REFERENCE_MARK
},
296 { "com.sun.star.style.CharacterStyle", SW_SERVICE_STYLE_CHARACTER_STYLE
},
297 { "com.sun.star.style.ParagraphStyle", SW_SERVICE_STYLE_PARAGRAPH_STYLE
},
298 { "com.sun.star.style.FrameStyle", SW_SERVICE_STYLE_FRAME_STYLE
},
299 { "com.sun.star.style.PageStyle", SW_SERVICE_STYLE_PAGE_STYLE
},
300 { "com.sun.star.style.NumberingStyle", SW_SERVICE_STYLE_NUMBERING_STYLE
},
301 { "com.sun.star.text.ContentIndexMark", SW_SERVICE_CONTENT_INDEX_MARK
},
302 { "com.sun.star.text.ContentIndex", SW_SERVICE_CONTENT_INDEX
},
303 { "com.sun.star.text.UserIndexMark", SW_SERVICE_USER_INDEX_MARK
},
304 { "com.sun.star.text.UserIndex", SW_SERVICE_USER_INDEX
},
305 { "com.sun.star.text.TextSection", SW_SERVICE_TEXT_SECTION
},
306 { "com.sun.star.text.TextField.DateTime", SW_SERVICE_FIELDTYPE_DATETIME
},
307 { "com.sun.star.text.TextField.User", SW_SERVICE_FIELDTYPE_USER
},
308 { "com.sun.star.text.TextField.SetExpression", SW_SERVICE_FIELDTYPE_SET_EXP
},
309 { "com.sun.star.text.TextField.GetExpression", SW_SERVICE_FIELDTYPE_GET_EXP
},
310 { "com.sun.star.text.TextField.FileName", SW_SERVICE_FIELDTYPE_FILE_NAME
},
311 { "com.sun.star.text.TextField.PageNumber", SW_SERVICE_FIELDTYPE_PAGE_NUM
},
312 { "com.sun.star.text.TextField.Author", SW_SERVICE_FIELDTYPE_AUTHOR
},
313 { "com.sun.star.text.TextField.Chapter", SW_SERVICE_FIELDTYPE_CHAPTER
},
314 { "", SW_SERVICE_FIELDTYPE_DUMMY_0
},
315 { "com.sun.star.text.TextField.GetReference", SW_SERVICE_FIELDTYPE_GET_REFERENCE
},
316 { "com.sun.star.text.TextField.ConditionalText", SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT
},
317 { "com.sun.star.text.TextField.Annotation", SW_SERVICE_FIELDTYPE_ANNOTATION
},
318 { "com.sun.star.text.TextField.Input", SW_SERVICE_FIELDTYPE_INPUT
},
319 { "com.sun.star.text.TextField.Macro", SW_SERVICE_FIELDTYPE_MACRO
},
320 { "com.sun.star.text.TextField.DDE", SW_SERVICE_FIELDTYPE_DDE
},
321 { "com.sun.star.text.TextField.HiddenParagraph", SW_SERVICE_FIELDTYPE_HIDDEN_PARA
},
322 { "" /*com.sun.star.text.TextField.DocumentInfo"*/, SW_SERVICE_FIELDTYPE_DOC_INFO
},
323 { "com.sun.star.text.TextField.TemplateName", SW_SERVICE_FIELDTYPE_TEMPLATE_NAME
},
324 { "com.sun.star.text.TextField.ExtendedUser", SW_SERVICE_FIELDTYPE_USER_EXT
},
325 { "com.sun.star.text.TextField.ReferencePageSet", SW_SERVICE_FIELDTYPE_REF_PAGE_SET
},
326 { "com.sun.star.text.TextField.ReferencePageGet", SW_SERVICE_FIELDTYPE_REF_PAGE_GET
},
327 { "com.sun.star.text.TextField.JumpEdit", SW_SERVICE_FIELDTYPE_JUMP_EDIT
},
328 { "com.sun.star.text.TextField.Script", SW_SERVICE_FIELDTYPE_SCRIPT
},
329 { "com.sun.star.text.TextField.DatabaseNextSet", SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET
},
330 { "com.sun.star.text.TextField.DatabaseNumberOfSet", SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET
},
331 { "com.sun.star.text.TextField.DatabaseSetNumber", SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM
},
332 { "com.sun.star.text.TextField.Database", SW_SERVICE_FIELDTYPE_DATABASE
},
333 { "com.sun.star.text.TextField.DatabaseName", SW_SERVICE_FIELDTYPE_DATABASE_NAME
},
334 { "com.sun.star.text.TextField.TableFormula", SW_SERVICE_FIELDTYPE_TABLE_FORMULA
},
335 { "com.sun.star.text.TextField.PageCount", SW_SERVICE_FIELDTYPE_PAGE_COUNT
},
336 { "com.sun.star.text.TextField.ParagraphCount", SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT
},
337 { "com.sun.star.text.TextField.WordCount", SW_SERVICE_FIELDTYPE_WORD_COUNT
},
338 { "com.sun.star.text.TextField.CharacterCount", SW_SERVICE_FIELDTYPE_CHARACTER_COUNT
},
339 { "com.sun.star.text.TextField.TableCount", SW_SERVICE_FIELDTYPE_TABLE_COUNT
},
340 { "com.sun.star.text.TextField.GraphicObjectCount", SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT
},
341 { "com.sun.star.text.TextField.EmbeddedObjectCount", SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT
},
342 { "com.sun.star.text.TextField.DocInfo.ChangeAuthor", SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR
},
343 { "com.sun.star.text.TextField.DocInfo.ChangeDateTime", SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME
},
344 { "com.sun.star.text.TextField.DocInfo.EditTime", SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME
},
345 { "com.sun.star.text.TextField.DocInfo.Description", SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION
},
346 { "com.sun.star.text.TextField.DocInfo.CreateAuthor", SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR
},
347 { "com.sun.star.text.TextField.DocInfo.CreateDateTime", SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME
},
348 { "", SW_SERVICE_FIELDTYPE_DUMMY_0
},
349 { "", SW_SERVICE_FIELDTYPE_DUMMY_1
},
350 { "", SW_SERVICE_FIELDTYPE_DUMMY_2
},
351 { "", SW_SERVICE_FIELDTYPE_DUMMY_3
},
352 { "com.sun.star.text.TextField.DocInfo.Custom", SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM
},
353 { "com.sun.star.text.TextField.DocInfo.PrintAuthor", SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR
},
354 { "com.sun.star.text.TextField.DocInfo.PrintDateTime", SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME
},
355 { "com.sun.star.text.TextField.DocInfo.KeyWords", SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS
},
356 { "com.sun.star.text.TextField.DocInfo.Subject", SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT
},
357 { "com.sun.star.text.TextField.DocInfo.Title", SW_SERVICE_FIELDTYPE_DOCINFO_TITLE
},
358 { "com.sun.star.text.TextField.DocInfo.Revision", SW_SERVICE_FIELDTYPE_DOCINFO_REVISION
},
359 { "com.sun.star.text.TextField.Bibliography", SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY
},
360 { "com.sun.star.text.TextField.CombinedCharacters", SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS
},
361 { "com.sun.star.text.TextField.DropDown", SW_SERVICE_FIELDTYPE_DROPDOWN
},
362 { "", SW_SERVICE_FIELDTYPE_DUMMY_4
},
363 { "", SW_SERVICE_FIELDTYPE_DUMMY_5
},
364 { "", SW_SERVICE_FIELDTYPE_DUMMY_6
},
365 { "", SW_SERVICE_FIELDTYPE_DUMMY_7
},
366 { "", SW_SERVICE_FIELDTYPE_DUMMY_8
},
367 { "com.sun.star.text.FieldMaster.User", SW_SERVICE_FIELDMASTER_USER
},
368 { "com.sun.star.text.FieldMaster.DDE", SW_SERVICE_FIELDMASTER_DDE
},
369 { "com.sun.star.text.FieldMaster.SetExpression", SW_SERVICE_FIELDMASTER_SET_EXP
},
370 { "com.sun.star.text.FieldMaster.Database", SW_SERVICE_FIELDMASTER_DATABASE
},
371 { "com.sun.star.text.FieldMaster.Bibliography", SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY
},
372 { "", SW_SERVICE_FIELDMASTER_DUMMY2
},
373 { "", SW_SERVICE_FIELDMASTER_DUMMY3
},
374 { "", SW_SERVICE_FIELDMASTER_DUMMY4
},
375 { "", SW_SERVICE_FIELDMASTER_DUMMY5
},
376 { "com.sun.star.text.IllustrationsIndex", SW_SERVICE_INDEX_ILLUSTRATIONS
},
377 { "com.sun.star.text.ObjectIndex", SW_SERVICE_INDEX_OBJECTS
},
378 { "com.sun.star.text.TableIndex", SW_SERVICE_INDEX_TABLES
},
379 { "com.sun.star.text.Bibliography", SW_SERVICE_INDEX_BIBLIOGRAPHY
},
380 { "com.sun.star.text.Paragraph", SW_SERVICE_PARAGRAPH
},
381 { "com.sun.star.text.TextField.InputUser", SW_SERVICE_FIELDTYPE_INPUT_USER
},
382 { "com.sun.star.text.TextField.HiddenText", SW_SERVICE_FIELDTYPE_HIDDEN_TEXT
},
383 { "com.sun.star.style.ConditionalParagraphStyle", SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE
},
384 { "com.sun.star.text.NumberingRules", SW_SERVICE_NUMBERING_RULES
},
385 { "com.sun.star.text.TextColumns", SW_SERVICE_TEXT_COLUMNS
},
386 { "com.sun.star.text.IndexHeaderSection", SW_SERVICE_INDEX_HEADER_SECTION
},
387 { "com.sun.star.text.Defaults", SW_SERVICE_DEFAULTS
},
388 { "com.sun.star.image.ImageMapRectangleObject", SW_SERVICE_IMAP_RECTANGLE
},
389 { "com.sun.star.image.ImageMapCircleObject", SW_SERVICE_IMAP_CIRCLE
},
390 { "com.sun.star.image.ImageMapPolygonObject", SW_SERVICE_IMAP_POLYGON
},
391 { "com.sun.star.text.TextGraphicObject", SW_SERVICE_TYPE_TEXT_GRAPHIC
},
392 { "com.sun.star.chart2.data.DataProvider", SW_SERVICE_CHART2_DATA_PROVIDER
},
393 { "com.sun.star.text.Fieldmark", SW_SERVICE_TYPE_FIELDMARK
},
394 { "com.sun.star.text.FormFieldmark", SW_SERVICE_TYPE_FORMFIELDMARK
},
395 { "ooo.vba.VBAObjectModuleObjectProvider", SW_SERVICE_VBAOBJECTPROVIDER
},
396 { "ooo.vba.VBACodeNameProvider", SW_SERVICE_VBACODENAMEPROVIDER
},
397 { "ooo.vba.VBAProjectNameProvider", SW_SERVICE_VBAPROJECTNAMEPROVIDER
},
399 // case-correct versions of the service names (see #i67811)
400 { CSS_TEXT_TEXTFIELD_DATE_TIME
, SW_SERVICE_FIELDTYPE_DATETIME
},
401 { CSS_TEXT_TEXTFIELD_USER
, SW_SERVICE_FIELDTYPE_USER
},
402 { CSS_TEXT_TEXTFIELD_SET_EXPRESSION
, SW_SERVICE_FIELDTYPE_SET_EXP
},
403 { CSS_TEXT_TEXTFIELD_GET_EXPRESSION
, SW_SERVICE_FIELDTYPE_GET_EXP
},
404 { CSS_TEXT_TEXTFIELD_FILE_NAME
, SW_SERVICE_FIELDTYPE_FILE_NAME
},
405 { CSS_TEXT_TEXTFIELD_PAGE_NUMBER
, SW_SERVICE_FIELDTYPE_PAGE_NUM
},
406 { CSS_TEXT_TEXTFIELD_AUTHOR
, SW_SERVICE_FIELDTYPE_AUTHOR
},
407 { CSS_TEXT_TEXTFIELD_CHAPTER
, SW_SERVICE_FIELDTYPE_CHAPTER
},
408 { CSS_TEXT_TEXTFIELD_GET_REFERENCE
, SW_SERVICE_FIELDTYPE_GET_REFERENCE
},
409 { CSS_TEXT_TEXTFIELD_CONDITIONAL_TEXT
, SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT
},
410 { CSS_TEXT_TEXTFIELD_ANNOTATION
, SW_SERVICE_FIELDTYPE_ANNOTATION
},
411 { CSS_TEXT_TEXTFIELD_INPUT
, SW_SERVICE_FIELDTYPE_INPUT
},
412 { CSS_TEXT_TEXTFIELD_MACRO
, SW_SERVICE_FIELDTYPE_MACRO
},
413 { CSS_TEXT_TEXTFIELD_DDE
, SW_SERVICE_FIELDTYPE_DDE
},
414 { CSS_TEXT_TEXTFIELD_HIDDEN_PARAGRAPH
, SW_SERVICE_FIELDTYPE_HIDDEN_PARA
},
415 { CSS_TEXT_TEXTFIELD_TEMPLATE_NAME
, SW_SERVICE_FIELDTYPE_TEMPLATE_NAME
},
416 { CSS_TEXT_TEXTFIELD_EXTENDED_USER
, SW_SERVICE_FIELDTYPE_USER_EXT
},
417 { CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_SET
, SW_SERVICE_FIELDTYPE_REF_PAGE_SET
},
418 { CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_GET
, SW_SERVICE_FIELDTYPE_REF_PAGE_GET
},
419 { CSS_TEXT_TEXTFIELD_JUMP_EDIT
, SW_SERVICE_FIELDTYPE_JUMP_EDIT
},
420 { CSS_TEXT_TEXTFIELD_SCRIPT
, SW_SERVICE_FIELDTYPE_SCRIPT
},
421 { CSS_TEXT_TEXTFIELD_DATABASE_NEXT_SET
, SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET
},
422 { CSS_TEXT_TEXTFIELD_DATABASE_NUMBER_OF_SET
, SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET
},
423 { CSS_TEXT_TEXTFIELD_DATABASE_SET_NUMBER
, SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM
},
424 { CSS_TEXT_TEXTFIELD_DATABASE
, SW_SERVICE_FIELDTYPE_DATABASE
},
425 { CSS_TEXT_TEXTFIELD_DATABASE_NAME
, SW_SERVICE_FIELDTYPE_DATABASE_NAME
},
426 { CSS_TEXT_TEXTFIELD_TABLE_FORMULA
, SW_SERVICE_FIELDTYPE_TABLE_FORMULA
},
427 { CSS_TEXT_TEXTFIELD_PAGE_COUNT
, SW_SERVICE_FIELDTYPE_PAGE_COUNT
},
428 { CSS_TEXT_TEXTFIELD_PARAGRAPH_COUNT
, SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT
},
429 { CSS_TEXT_TEXTFIELD_WORD_COUNT
, SW_SERVICE_FIELDTYPE_WORD_COUNT
},
430 { CSS_TEXT_TEXTFIELD_CHARACTER_COUNT
, SW_SERVICE_FIELDTYPE_CHARACTER_COUNT
},
431 { CSS_TEXT_TEXTFIELD_TABLE_COUNT
, SW_SERVICE_FIELDTYPE_TABLE_COUNT
},
432 { CSS_TEXT_TEXTFIELD_GRAPHIC_OBJECT_COUNT
, SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT
},
433 { CSS_TEXT_TEXTFIELD_EMBEDDED_OBJECT_COUNT
, SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT
},
434 { CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_AUTHOR
, SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR
},
435 { CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_DATE_TIME
, SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME
},
436 { CSS_TEXT_TEXTFIELD_DOCINFO_EDIT_TIME
, SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME
},
437 { CSS_TEXT_TEXTFIELD_DOCINFO_DESCRIPTION
, SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION
},
438 { CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_AUTHOR
, SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR
},
439 { CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_DATE_TIME
, SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME
},
440 { CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_AUTHOR
, SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR
},
441 { CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_DATE_TIME
, SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME
},
442 { CSS_TEXT_TEXTFIELD_DOCINFO_KEY_WORDS
, SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS
},
443 { CSS_TEXT_TEXTFIELD_DOCINFO_SUBJECT
, SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT
},
444 { CSS_TEXT_TEXTFIELD_DOCINFO_TITLE
, SW_SERVICE_FIELDTYPE_DOCINFO_TITLE
},
445 { CSS_TEXT_TEXTFIELD_DOCINFO_REVISION
, SW_SERVICE_FIELDTYPE_DOCINFO_REVISION
},
446 { CSS_TEXT_TEXTFIELD_DOCINFO_CUSTOM
, SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM
},
447 { CSS_TEXT_TEXTFIELD_BIBLIOGRAPHY
, SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY
},
448 { CSS_TEXT_TEXTFIELD_COMBINED_CHARACTERS
, SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS
},
449 { CSS_TEXT_TEXTFIELD_DROP_DOWN
, SW_SERVICE_FIELDTYPE_DROPDOWN
},
450 { CSS_TEXT_TEXTFIELD_INPUT_USER
, SW_SERVICE_FIELDTYPE_INPUT_USER
},
451 { CSS_TEXT_TEXTFIELD_HIDDEN_TEXT
, SW_SERVICE_FIELDTYPE_HIDDEN_TEXT
},
452 { CSS_TEXT_FIELDMASTER_USER
, SW_SERVICE_FIELDMASTER_USER
},
453 { CSS_TEXT_FIELDMASTER_DDE
, SW_SERVICE_FIELDMASTER_DDE
},
454 { CSS_TEXT_FIELDMASTER_SET_EXPRESSION
, SW_SERVICE_FIELDMASTER_SET_EXP
},
455 { CSS_TEXT_FIELDMASTER_DATABASE
, SW_SERVICE_FIELDMASTER_DATABASE
},
456 { CSS_TEXT_FIELDMASTER_BIBLIOGRAPHY
, SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY
}
459 /* -----------------------------23.03.01 13:38--------------------------------
461 ---------------------------------------------------------------------------*/
462 const SvEventDescription
* lcl_GetSupportedMacroItems()
464 static const SvEventDescription aMacroDescriptionsImpl
[] =
466 { SFX_EVENT_MOUSEOVER_OBJECT
, "OnMouseOver" },
467 { SFX_EVENT_MOUSEOUT_OBJECT
, "OnMouseOut" },
471 return aMacroDescriptionsImpl
;
474 /******************************************************************
476 ******************************************************************/
477 /*-- 13.01.99 13:31:44---------------------------------------------------
479 -----------------------------------------------------------------------*/
480 OUString
SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType
)
482 vos::OGuard
aGuard(Application::GetSolarMutex());
484 sal_uInt16 nEntries
= sizeof(aProvNamesId
) / sizeof(aProvNamesId
[0]);
485 if(nObjectType
< nEntries
)
486 sRet
= C2U(aProvNamesId
[nObjectType
].pName
);
489 /* -----------------11.03.99 12:05-------------------
491 * --------------------------------------------------*/
492 uno::Sequence
<OUString
> SwXServiceProvider::GetAllServiceNames()
494 sal_uInt16 nEntries
= sizeof(aProvNamesId
) / sizeof(aProvNamesId
[0]);
495 uno::Sequence
<OUString
> aRet(nEntries
);
496 OUString
* pArray
= aRet
.getArray();
498 for(sal_uInt16 i
= 0; i
< nEntries
; i
++)
500 String
sProv(C2U(aProvNamesId
[i
].pName
));
512 /*-- 13.01.99 13:31:45---------------------------------------------------
514 -----------------------------------------------------------------------*/
515 sal_uInt16
SwXServiceProvider::GetProviderType(const OUString
& rServiceName
)
517 sal_uInt16 nEntries
= sizeof(aProvNamesId
) / sizeof(aProvNamesId
[0]);
518 for(sal_uInt16 i
= 0; i
< nEntries
; i
++ )
520 if( COMPARE_EQUAL
== rServiceName
.compareToAscii(aProvNamesId
[i
].pName
))
521 return aProvNamesId
[i
].nType
;
523 return SW_SERVICE_INVALID
;
525 /* -----------------13.01.99 14:37-------------------
527 * --------------------------------------------------*/
528 uno::Reference
< uno::XInterface
> SwXServiceProvider::MakeInstance(sal_uInt16 nObjectType
, SwDoc
* pDoc
)
530 vos::OGuard
aGuard(Application::GetSolarMutex());
531 uno::Reference
< uno::XInterface
> xRet
;
534 case SW_SERVICE_TYPE_TEXTTABLE
:
536 SwXTextTable
* pTextTable
= new SwXTextTable();
537 xRet
= (cppu::OWeakObject
*)pTextTable
;
540 case SW_SERVICE_TYPE_TEXTFRAME
:
542 SwXTextFrame
* pTextFrame
= new SwXTextFrame( pDoc
);
543 xRet
= (cppu::OWeakObject
*)(SwXFrame
*)pTextFrame
;
546 case SW_SERVICE_TYPE_GRAPHIC
:
547 case SW_SERVICE_TYPE_TEXT_GRAPHIC
/* #i47503# */ :
549 SwXTextGraphicObject
* pGraphic
= new SwXTextGraphicObject( pDoc
);
550 xRet
= (cppu::OWeakObject
*)(SwXFrame
*)pGraphic
;
554 case SW_SERVICE_TYPE_OLE
:
556 SwXTextEmbeddedObject
* pOle
= new SwXTextEmbeddedObject( pDoc
);
557 xRet
= (cppu::OWeakObject
*)(SwXFrame
*)pOle
;
560 case SW_SERVICE_TYPE_BOOKMARK
:
562 SwXBookmark
* pBookmark
= new SwXBookmark
;
563 xRet
= (cppu::OWeakObject
*)pBookmark
;
566 case SW_SERVICE_TYPE_FIELDMARK
:
568 SwXFieldmark
* pFieldmark
= new SwXFieldmark(false);
569 xRet
= (cppu::OWeakObject
*)pFieldmark
;
572 case SW_SERVICE_TYPE_FORMFIELDMARK
:
574 SwXFieldmark
* pFieldmark
= new SwXFieldmark(true);
575 xRet
= (cppu::OWeakObject
*)pFieldmark
;
578 case SW_SERVICE_VBAOBJECTPROVIDER
:
580 SwVbaObjectForCodeNameProvider
* pObjProv
= new SwVbaObjectForCodeNameProvider( pDoc
->GetDocShell() );
581 xRet
= (cppu::OWeakObject
*)pObjProv
;
584 case SW_SERVICE_VBACODENAMEPROVIDER
:
586 SwVbaCodeNameProvider
* pObjProv
= new SwVbaCodeNameProvider( pDoc
->GetDocShell() );
587 xRet
= (cppu::OWeakObject
*)pObjProv
;
590 case SW_SERVICE_VBAPROJECTNAMEPROVIDER
:
592 uno::Reference
< container::XNameContainer
> xProjProv
= pDoc
->GetVBATemplateToProjectCache();
593 if ( !xProjProv
.is() )
595 xProjProv
= new SwVbaProjectNameProvider( pDoc
->GetDocShell() );
596 pDoc
->SetVBATemplateToProjectCache( xProjProv
);
598 //xRet = (cppu::OWeakObject*)xProjProv;
602 case SW_SERVICE_TYPE_FOOTNOTE
:
603 xRet
= (cppu::OWeakObject
*)new SwXFootnote(sal_False
);
605 case SW_SERVICE_TYPE_ENDNOTE
:
606 xRet
= (cppu::OWeakObject
*)new SwXFootnote(sal_True
);
608 case SW_SERVICE_CONTENT_INDEX_MARK
:
609 case SW_SERVICE_USER_INDEX_MARK
:
610 case SW_SERVICE_TYPE_INDEXMARK
:
612 TOXTypes eType
= TOX_INDEX
;
613 if(SW_SERVICE_CONTENT_INDEX_MARK
== nObjectType
)
615 else if(SW_SERVICE_USER_INDEX_MARK
== nObjectType
)
617 xRet
= (cppu::OWeakObject
*)new SwXDocumentIndexMark(eType
);
620 case SW_SERVICE_CONTENT_INDEX
:
621 case SW_SERVICE_USER_INDEX
:
622 case SW_SERVICE_TYPE_INDEX
:
623 case SW_SERVICE_INDEX_ILLUSTRATIONS
:
624 case SW_SERVICE_INDEX_OBJECTS
:
625 case SW_SERVICE_INDEX_TABLES
:
626 case SW_SERVICE_INDEX_BIBLIOGRAPHY
:
628 TOXTypes eType
= TOX_INDEX
;
629 if(SW_SERVICE_CONTENT_INDEX
== nObjectType
)
631 else if(SW_SERVICE_USER_INDEX
== nObjectType
)
633 else if(SW_SERVICE_INDEX_ILLUSTRATIONS
== nObjectType
)
635 eType
= TOX_ILLUSTRATIONS
;
637 else if(SW_SERVICE_INDEX_OBJECTS
== nObjectType
)
641 else if(SW_SERVICE_INDEX_BIBLIOGRAPHY
== nObjectType
)
643 eType
= TOX_AUTHORITIES
;
645 else if(SW_SERVICE_INDEX_TABLES
== nObjectType
)
649 xRet
= (cppu::OWeakObject
*)new SwXDocumentIndex(eType
, *pDoc
);
652 case SW_SERVICE_INDEX_HEADER_SECTION
:
653 case SW_SERVICE_TEXT_SECTION
:
654 xRet
= SwXTextSectionClient::CreateXTextSection( 0, SW_SERVICE_INDEX_HEADER_SECTION
== nObjectType
);
657 case SW_SERVICE_REFERENCE_MARK
:
658 xRet
= (cppu::OWeakObject
*)new SwXReferenceMark(0, 0);
660 case SW_SERVICE_STYLE_CHARACTER_STYLE
:
661 case SW_SERVICE_STYLE_PARAGRAPH_STYLE
:
662 case SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE
:
663 case SW_SERVICE_STYLE_FRAME_STYLE
:
664 case SW_SERVICE_STYLE_PAGE_STYLE
:
665 case SW_SERVICE_STYLE_NUMBERING_STYLE
:
667 SfxStyleFamily eFamily
= SFX_STYLE_FAMILY_CHAR
;
670 case SW_SERVICE_STYLE_PARAGRAPH_STYLE
:
671 case SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE
:
672 eFamily
= SFX_STYLE_FAMILY_PARA
;
674 case SW_SERVICE_STYLE_FRAME_STYLE
:
675 eFamily
= SFX_STYLE_FAMILY_FRAME
;
677 case SW_SERVICE_STYLE_PAGE_STYLE
:
678 eFamily
= SFX_STYLE_FAMILY_PAGE
;
680 case SW_SERVICE_STYLE_NUMBERING_STYLE
:
681 eFamily
= SFX_STYLE_FAMILY_PSEUDO
;
684 SwXStyle
* pNewStyle
= SFX_STYLE_FAMILY_PAGE
== eFamily
?
685 new SwXPageStyle(pDoc
->GetDocShell()) :
686 eFamily
== SFX_STYLE_FAMILY_FRAME
?
687 new SwXFrameStyle ( pDoc
):
688 new SwXStyle( pDoc
, eFamily
, nObjectType
== SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE
);
689 xRet
= (cppu::OWeakObject
*)pNewStyle
;
692 // SW_SERVICE_DUMMY_5
693 // SW_SERVICE_DUMMY_6
694 // SW_SERVICE_DUMMY_7
695 // SW_SERVICE_DUMMY_8
696 // SW_SERVICE_DUMMY_9
697 case SW_SERVICE_FIELDTYPE_DATETIME
:
698 case SW_SERVICE_FIELDTYPE_USER
:
699 case SW_SERVICE_FIELDTYPE_SET_EXP
:
700 case SW_SERVICE_FIELDTYPE_GET_EXP
:
701 case SW_SERVICE_FIELDTYPE_FILE_NAME
:
702 case SW_SERVICE_FIELDTYPE_PAGE_NUM
:
703 case SW_SERVICE_FIELDTYPE_AUTHOR
:
704 case SW_SERVICE_FIELDTYPE_CHAPTER
:
705 case SW_SERVICE_FIELDTYPE_GET_REFERENCE
:
706 case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT
:
707 case SW_SERVICE_FIELDTYPE_INPUT
:
708 case SW_SERVICE_FIELDTYPE_MACRO
:
709 case SW_SERVICE_FIELDTYPE_DDE
:
710 case SW_SERVICE_FIELDTYPE_HIDDEN_PARA
:
711 case SW_SERVICE_FIELDTYPE_DOC_INFO
:
712 case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME
:
713 case SW_SERVICE_FIELDTYPE_USER_EXT
:
714 case SW_SERVICE_FIELDTYPE_REF_PAGE_SET
:
715 case SW_SERVICE_FIELDTYPE_REF_PAGE_GET
:
716 case SW_SERVICE_FIELDTYPE_JUMP_EDIT
:
717 case SW_SERVICE_FIELDTYPE_SCRIPT
:
718 case SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET
:
719 case SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET
:
720 case SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM
:
721 case SW_SERVICE_FIELDTYPE_DATABASE
:
722 case SW_SERVICE_FIELDTYPE_DATABASE_NAME
:
723 case SW_SERVICE_FIELDTYPE_PAGE_COUNT
:
724 case SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT
:
725 case SW_SERVICE_FIELDTYPE_WORD_COUNT
:
726 case SW_SERVICE_FIELDTYPE_CHARACTER_COUNT
:
727 case SW_SERVICE_FIELDTYPE_TABLE_COUNT
:
728 case SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT
:
729 case SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT
:
730 case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR
:
731 case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME
:
732 case SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME
:
733 case SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION
:
734 case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR
:
735 case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME
:
736 case SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM
:
737 case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR
:
738 case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME
:
739 case SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS
:
740 case SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT
:
741 case SW_SERVICE_FIELDTYPE_DOCINFO_TITLE
:
742 case SW_SERVICE_FIELDTYPE_DOCINFO_REVISION
:
743 case SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY
:
744 case SW_SERVICE_FIELDTYPE_INPUT_USER
:
745 case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT
:
746 case SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS
:
747 case SW_SERVICE_FIELDTYPE_DROPDOWN
:
748 case SW_SERVICE_FIELDTYPE_TABLE_FORMULA
:
749 xRet
= (cppu::OWeakObject
*)new SwXTextField(nObjectType
);
751 case SW_SERVICE_FIELDTYPE_ANNOTATION
:
752 xRet
= (cppu::OWeakObject
*)new SwXTextField(nObjectType
, pDoc
);
754 case SW_SERVICE_FIELDMASTER_USER
:
755 case SW_SERVICE_FIELDMASTER_DDE
:
756 case SW_SERVICE_FIELDMASTER_SET_EXP
:
757 case SW_SERVICE_FIELDMASTER_DATABASE
:
759 sal_uInt16 nResId
= USHRT_MAX
;
762 case SW_SERVICE_FIELDMASTER_USER
: nResId
= RES_USERFLD
; break;
763 case SW_SERVICE_FIELDMASTER_DDE
: nResId
= RES_DDEFLD
; break;
764 case SW_SERVICE_FIELDMASTER_SET_EXP
: nResId
= RES_SETEXPFLD
; break;
765 case SW_SERVICE_FIELDMASTER_DATABASE
: nResId
= RES_DBFLD
; break;
767 xRet
= (cppu::OWeakObject
*)new SwXFieldMaster(pDoc
, nResId
);
770 case SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY
:
772 SwFieldType
* pType
= pDoc
->GetFldType(RES_AUTHORITY
, aEmptyStr
, sal_True
);
775 SwAuthorityFieldType
aType(pDoc
);
776 pType
= pDoc
->InsertFldType(aType
);
780 SwClientIter
aIter( *pType
);
781 SwXFieldMaster
* pMaster
= (SwXFieldMaster
*)aIter
.First( TYPE( SwXFieldMaster
));
783 xRet
= (cppu::OWeakObject
*)pMaster
;
786 xRet
= (cppu::OWeakObject
*)new SwXFieldMaster(*pType
, pDoc
);
789 case SW_SERVICE_PARAGRAPH
:
790 xRet
= (cppu::OWeakObject
*)new SwXParagraph();
792 case SW_SERVICE_NUMBERING_RULES
:
793 xRet
= (cppu::OWeakObject
*)new SwXNumberingRules(*pDoc
);
795 case SW_SERVICE_TEXT_COLUMNS
:
796 xRet
= (cppu::OWeakObject
*)new SwXTextColumns(0);
798 case SW_SERVICE_DEFAULTS
:
799 xRet
= (cppu::OWeakObject
*)new SwXTextDefaults( pDoc
);
801 case SW_SERVICE_IMAP_RECTANGLE
:
802 xRet
= SvUnoImageMapRectangleObject_createInstance( lcl_GetSupportedMacroItems() );
804 case SW_SERVICE_IMAP_CIRCLE
:
805 xRet
= SvUnoImageMapCircleObject_createInstance( lcl_GetSupportedMacroItems() );
807 case SW_SERVICE_IMAP_POLYGON
:
808 xRet
= SvUnoImageMapPolygonObject_createInstance( lcl_GetSupportedMacroItems() );
810 case SW_SERVICE_CHART2_DATA_PROVIDER
:
811 // #i64497# If a chart is in a temporary document during clipoard
812 // paste, there should be no data provider, so that own data is used
813 // This should not happen during copy/paste, as this will unlink
814 // charts using table data.
815 OSL_ASSERT( pDoc
->GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED
);
816 if( pDoc
->GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED
)
817 xRet
= (cppu::OWeakObject
*) pDoc
->GetChartDataProvider( true /* create - if not yet available */ );
820 throw uno::RuntimeException();
824 /******************************************************************
826 ******************************************************************/
827 //SMART_UNO_IMPLEMENTATION( SwXTextTables, UsrObject );
829 /*-- 13.01.99 12:56:24---------------------------------------------------
831 -----------------------------------------------------------------------*/
832 SwXTextTables::SwXTextTables(SwDoc
* pDc
) :
837 /*-- 13.01.99 12:56:25---------------------------------------------------
839 -----------------------------------------------------------------------*/
840 SwXTextTables::~SwXTextTables()
844 /*-- 13.01.99 12:56:25---------------------------------------------------
846 -----------------------------------------------------------------------*/
847 sal_Int32
SwXTextTables::getCount(void) throw( uno::RuntimeException
)
849 vos::OGuard
aGuard(Application::GetSolarMutex());
852 nRet
= GetDoc()->GetTblFrmFmtCount(sal_True
);
855 /*-- 13.01.99 12:56:26---------------------------------------------------
857 -----------------------------------------------------------------------*/
858 uno::Any SAL_CALL
SwXTextTables::getByIndex(sal_Int32 nIndex
)
859 throw( IndexOutOfBoundsException
, WrappedTargetException
, uno::RuntimeException
)
861 vos::OGuard
aGuard(Application::GetSolarMutex());
865 if(0 <= nIndex
&& GetDoc()->GetTblFrmFmtCount(sal_True
) > nIndex
)
867 SwFrmFmt
& rFmt
= GetDoc()->GetTblFrmFmt( static_cast< xub_StrLen
>(nIndex
), sal_True
);
868 uno::Reference
< XTextTable
> xTbl
= SwXTextTables::GetObject(rFmt
);
869 aRet
.setValue( &xTbl
,
870 ::getCppuType((uno::Reference
< XTextTable
>*)0));
873 throw IndexOutOfBoundsException();
876 throw uno::RuntimeException();
879 /*-- 13.01.99 12:56:26---------------------------------------------------
881 -----------------------------------------------------------------------*/
882 uno::Any
SwXTextTables::getByName(const OUString
& rItemName
)
883 throw( NoSuchElementException
, WrappedTargetException
, uno::RuntimeException
)
885 vos::OGuard
aGuard(Application::GetSolarMutex());
889 sal_uInt16 nCount
= GetDoc()->GetTblFrmFmtCount(sal_True
);
890 uno::Reference
< XTextTable
> xTbl
;
891 for( sal_uInt16 i
= 0; i
< nCount
; i
++)
893 String
aName(rItemName
);
894 SwFrmFmt
& rFmt
= GetDoc()->GetTblFrmFmt(i
, sal_True
);
895 if(aName
== rFmt
.GetName())
897 xTbl
= SwXTextTables::GetObject(rFmt
);
899 ::getCppuType(( uno::Reference
< XTextTable
>*)0));
904 throw NoSuchElementException();
907 throw uno::RuntimeException();
910 /*-- 13.01.99 12:56:26---------------------------------------------------
912 -----------------------------------------------------------------------*/
913 uno::Sequence
< OUString
> SwXTextTables::getElementNames(void)
914 throw( uno::RuntimeException
)
916 vos::OGuard
aGuard(Application::GetSolarMutex());
918 throw uno::RuntimeException();
919 sal_uInt16 nCount
= GetDoc()->GetTblFrmFmtCount(sal_True
);
920 uno::Sequence
<OUString
> aSeq(nCount
);
923 OUString
* pArray
= aSeq
.getArray();
924 for( sal_uInt16 i
= 0; i
< nCount
; i
++)
926 SwFrmFmt
& rFmt
= GetDoc()->GetTblFrmFmt(i
, sal_True
);
928 pArray
[i
] = OUString(rFmt
.GetName());
933 /*-- 13.01.99 12:56:27---------------------------------------------------
935 -----------------------------------------------------------------------*/
936 sal_Bool
SwXTextTables::hasByName(const OUString
& rName
)
937 throw( uno::RuntimeException
)
939 vos::OGuard
aGuard(Application::GetSolarMutex());
940 sal_Bool bRet
= sal_False
;
943 sal_uInt16 nCount
= GetDoc()->GetTblFrmFmtCount(sal_True
);
944 for( sal_uInt16 i
= 0; i
< nCount
; i
++)
947 SwFrmFmt
& rFmt
= GetDoc()->GetTblFrmFmt(i
, sal_True
);
948 if(aName
== rFmt
.GetName())
956 throw uno::RuntimeException();
959 /*-- 13.01.99 12:56:27---------------------------------------------------
961 -----------------------------------------------------------------------*/
963 SwXTextTables::getElementType( )
964 throw(uno::RuntimeException
)
966 return ::getCppuType((uno::Reference
<XTextTable
>*)0);
968 /*-- 13.01.99 12:56:27---------------------------------------------------
970 -----------------------------------------------------------------------*/
971 sal_Bool
SwXTextTables::hasElements(void) throw( uno::RuntimeException
)
973 vos::OGuard
aGuard(Application::GetSolarMutex());
975 throw uno::RuntimeException();
976 return 0 != GetDoc()->GetTblFrmFmtCount(sal_True
);
978 /* -----------------25.10.99 16:01-------------------
980 --------------------------------------------------*/
981 OUString
SwXTextTables::getImplementationName(void) throw( uno::RuntimeException
)
983 return C2U("SwXTextTables");
985 /* -----------------25.10.99 16:01-------------------
987 --------------------------------------------------*/
988 sal_Bool
SwXTextTables::supportsService(const OUString
& rServiceName
) throw( uno::RuntimeException
)
990 return rServiceName
== C2U("com.sun.star.text.TextTables");
992 /* -----------------25.10.99 16:01-------------------
994 --------------------------------------------------*/
995 uno::Sequence
< OUString
> SwXTextTables::getSupportedServiceNames(void) throw( uno::RuntimeException
)
997 uno::Sequence
< OUString
> aRet(1);
998 OUString
* pArr
= aRet
.getArray();
999 pArr
[0] = C2U("com.sun.star.text.TextTables");
1002 /*-- 13.01.99 12:56:28---------------------------------------------------
1004 -----------------------------------------------------------------------*/
1005 XTextTable
* SwXTextTables::GetObject( SwFrmFmt
& rFmt
)
1007 vos::OGuard
aGuard(Application::GetSolarMutex());
1008 SwXTextTable
* pTbl
= (SwXTextTable
*)SwClientIter( rFmt
).
1009 First( TYPE( SwXTextTable
));
1011 pTbl
= new SwXTextTable(rFmt
);
1016 /******************************************************************
1017 * SwXFrameEnumeration
1018 ******************************************************************/
1021 template<FlyCntType T
> struct UnoFrameWrap_traits
{};
1024 struct UnoFrameWrap_traits
<FLYCNTTYPE_FRM
>
1026 typedef SwXTextFrame core_frame_t
;
1027 typedef XTextFrame uno_frame_t
;
1028 static inline bool filter(const SwNode
* const pNode
) { return !pNode
->IsNoTxtNode(); };
1032 struct UnoFrameWrap_traits
<FLYCNTTYPE_GRF
>
1034 typedef SwXTextGraphicObject core_frame_t
;
1035 typedef XTextContent uno_frame_t
;
1036 static inline bool filter(const SwNode
* const pNode
) { return pNode
->IsGrfNode(); };
1040 struct UnoFrameWrap_traits
<FLYCNTTYPE_OLE
>
1042 typedef SwXTextEmbeddedObject core_frame_t
;
1043 typedef XEmbeddedObjectSupplier uno_frame_t
;
1044 static inline bool filter(const SwNode
* const pNode
) { return pNode
->IsOLENode(); };
1047 template<FlyCntType T
>
1048 static uno::Any
lcl_UnoWrapFrame(SwFrmFmt
* pFmt
)
1050 SwXFrame
* pFrm
= static_cast<SwXFrame
*>(SwClientIter(*pFmt
).First(TYPE(SwXFrame
)));
1052 pFrm
= new typename UnoFrameWrap_traits
<T
>::core_frame_t(*pFmt
);
1053 Reference
< typename UnoFrameWrap_traits
<T
>::uno_frame_t
> xFrm
=
1054 static_cast< typename UnoFrameWrap_traits
<T
>::core_frame_t
* >(pFrm
);
1055 return uno::makeAny(xFrm
);
1058 // runtime adapter for lcl_UnoWrapFrame
1059 static uno::Any
lcl_UnoWrapFrame(SwFrmFmt
* pFmt
, FlyCntType eType
) throw(uno::RuntimeException())
1063 case FLYCNTTYPE_FRM
:
1064 return lcl_UnoWrapFrame
<FLYCNTTYPE_FRM
>(pFmt
);
1065 case FLYCNTTYPE_GRF
:
1066 return lcl_UnoWrapFrame
<FLYCNTTYPE_GRF
>(pFmt
);
1067 case FLYCNTTYPE_OLE
:
1068 return lcl_UnoWrapFrame
<FLYCNTTYPE_OLE
>(pFmt
);
1070 throw uno::RuntimeException();
1074 template<FlyCntType T
>
1075 class SwXFrameEnumeration
: public SwSimpleEnumerationBaseClass
1078 typedef ::std::slist
< Any
> frmcontainer_t
;
1079 frmcontainer_t m_aFrames
;
1081 virtual ~SwXFrameEnumeration() {};
1083 SwXFrameEnumeration(const SwDoc
* const pDoc
);
1086 virtual sal_Bool SAL_CALL
hasMoreElements(void) throw( RuntimeException
);
1087 virtual Any SAL_CALL
nextElement(void) throw( NoSuchElementException
, WrappedTargetException
, RuntimeException
);
1090 virtual OUString SAL_CALL
getImplementationName(void) throw( RuntimeException
);
1091 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw( RuntimeException
);
1092 virtual Sequence
< OUString
> SAL_CALL
getSupportedServiceNames(void) throw( RuntimeException
);
1096 template<FlyCntType T
>
1097 SwXFrameEnumeration
<T
>::SwXFrameEnumeration(const SwDoc
* const pDoc
)
1100 vos::OGuard
aGuard(Application::GetSolarMutex());
1101 const SwSpzFrmFmts
* const pFmts
= pDoc
->GetSpzFrmFmts();
1104 const SwFrmFmt
* const pFmtsEnd
= (*pFmts
)[pFmts
->Count()];
1105 ::std::insert_iterator
<frmcontainer_t
> pInserter
= ::std::insert_iterator
<frmcontainer_t
>(m_aFrames
, m_aFrames
.begin());
1106 for(SwFrmFmt
* pFmt
= (*pFmts
)[0]; pFmt
< pFmtsEnd
; ++pFmt
)
1108 if(pFmt
->Which() != RES_FLYFRMFMT
)
1110 const SwNodeIndex
* pIdx
= pFmt
->GetCntnt().GetCntntIdx();
1111 if(!pIdx
|| !pIdx
->GetNodes().IsDocNodes())
1113 const SwNode
* pNd
= pDoc
->GetNodes()[ pIdx
->GetIndex() + 1 ];
1114 if(UnoFrameWrap_traits
<T
>::filter(pNd
))
1115 *pInserter
++ = lcl_UnoWrapFrame
<T
>(pFmt
);
1119 template<FlyCntType T
>
1120 sal_Bool SwXFrameEnumeration
<T
>::hasMoreElements(void) throw( RuntimeException
)
1122 vos::OGuard
aGuard(Application::GetSolarMutex());
1123 return !m_aFrames
.empty();
1126 template<FlyCntType T
>
1127 Any SwXFrameEnumeration
<T
>::nextElement(void) throw( NoSuchElementException
, WrappedTargetException
, RuntimeException
)
1129 vos::OGuard
aGuard(Application::GetSolarMutex());
1130 if(m_aFrames
.empty())
1131 throw NoSuchElementException();
1132 Any aResult
= *m_aFrames
.begin();
1133 m_aFrames
.pop_front();
1137 template<FlyCntType T
>
1138 OUString SwXFrameEnumeration
<T
>::getImplementationName(void) throw( RuntimeException
)
1140 return C2U("SwXFrameEnumeration");
1143 template<FlyCntType T
>
1144 sal_Bool SwXFrameEnumeration
<T
>::supportsService(const OUString
& ServiceName
) throw( RuntimeException
)
1146 return C2U("com.sun.star.container.XEnumeration") == ServiceName
;
1149 template<FlyCntType T
>
1150 Sequence
< OUString
> SwXFrameEnumeration
<T
>::getSupportedServiceNames(void) throw( RuntimeException
)
1152 return ::comphelper::makeSequence(C2U("com.sun.star.container.XEnumeration"));
1155 /******************************************************************
1157 ******************************************************************/
1158 OUString
SwXFrames::getImplementationName(void) throw( RuntimeException
)
1160 return C2U("SwXFrames");
1163 BOOL
SwXFrames::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
1165 return C2U("com.sun.star.text.TextFrames") == rServiceName
;
1168 Sequence
<OUString
> SwXFrames::getSupportedServiceNames(void) throw( RuntimeException
)
1170 return ::comphelper::makeSequence(C2U("com.sun.star.text.TextFrames"));
1173 SwXFrames::SwXFrames(SwDoc
* _pDoc
, FlyCntType eSet
) :
1174 SwUnoCollection(_pDoc
),
1178 SwXFrames::~SwXFrames()
1181 uno::Reference
<container::XEnumeration
> SwXFrames::createEnumeration(void) throw(uno::RuntimeException
)
1183 vos::OGuard
aGuard(Application::GetSolarMutex());
1185 throw uno::RuntimeException();
1188 case FLYCNTTYPE_FRM
:
1189 return uno::Reference
< container::XEnumeration
>(
1190 new SwXFrameEnumeration
<FLYCNTTYPE_FRM
>(GetDoc()));
1191 case FLYCNTTYPE_GRF
:
1192 return uno::Reference
< container::XEnumeration
>(
1193 new SwXFrameEnumeration
<FLYCNTTYPE_GRF
>(GetDoc()));
1194 case FLYCNTTYPE_OLE
:
1195 return uno::Reference
< container::XEnumeration
>(
1196 new SwXFrameEnumeration
<FLYCNTTYPE_OLE
>(GetDoc()));
1198 throw uno::RuntimeException();
1202 sal_Int32
SwXFrames::getCount(void) throw(uno::RuntimeException
)
1204 vos::OGuard
aGuard(Application::GetSolarMutex());
1206 throw uno::RuntimeException();
1207 return GetDoc()->GetFlyCount(eType
);
1210 uno::Any
SwXFrames::getByIndex(sal_Int32 nIndex
)
1211 throw(IndexOutOfBoundsException
, WrappedTargetException
, uno::RuntimeException
)
1213 vos::OGuard
aGuard(Application::GetSolarMutex());
1215 throw uno::RuntimeException();
1216 if(nIndex
< 0 || nIndex
>= USHRT_MAX
)
1217 throw IndexOutOfBoundsException();
1218 SwFrmFmt
* pFmt
= GetDoc()->GetFlyNum(static_cast<sal_uInt16
>(nIndex
), eType
);
1220 throw IndexOutOfBoundsException();
1221 return lcl_UnoWrapFrame(pFmt
, eType
);
1223 uno::Any
SwXFrames::getByName(const OUString
& rName
)
1224 throw(NoSuchElementException
, WrappedTargetException
, uno::RuntimeException
)
1226 vos::OGuard
aGuard(Application::GetSolarMutex());
1228 throw uno::RuntimeException();
1229 const SwFrmFmt
* pFmt
;
1232 case FLYCNTTYPE_GRF
:
1233 pFmt
= GetDoc()->FindFlyByName(rName
, ND_GRFNODE
);
1234 case FLYCNTTYPE_OLE
:
1235 pFmt
= GetDoc()->FindFlyByName(rName
, ND_OLENODE
);
1237 pFmt
= GetDoc()->FindFlyByName(rName
, ND_TEXTNODE
);
1240 throw NoSuchElementException();
1241 return lcl_UnoWrapFrame(const_cast<SwFrmFmt
*>(pFmt
), eType
);
1244 uno::Sequence
<OUString
> SwXFrames::getElementNames(void) throw( uno::RuntimeException
)
1246 vos::OGuard
aGuard(Application::GetSolarMutex());
1248 throw uno::RuntimeException();
1249 const Reference
<XEnumeration
> xEnum
= createEnumeration();
1250 ::std::vector
<OUString
> vNames
;
1251 while(xEnum
->hasMoreElements())
1253 Reference
<container::XNamed
> xNamed
;
1254 xEnum
->nextElement() >>= xNamed
;
1256 vNames
.push_back(xNamed
->getName());
1258 return ::comphelper::containerToSequence(vNames
);
1261 sal_Bool
SwXFrames::hasByName(const OUString
& rName
) throw( uno::RuntimeException
)
1263 vos::OGuard
aGuard(Application::GetSolarMutex());
1265 throw uno::RuntimeException();
1268 case FLYCNTTYPE_GRF
:
1269 return GetDoc()->FindFlyByName(rName
, ND_GRFNODE
) != NULL
;
1270 case FLYCNTTYPE_OLE
:
1271 return GetDoc()->FindFlyByName(rName
, ND_OLENODE
) != NULL
;
1273 return GetDoc()->FindFlyByName(rName
, ND_TEXTNODE
) != NULL
;
1277 uno::Type SAL_CALL
SwXFrames::getElementType() throw(uno::RuntimeException
)
1279 vos::OGuard
aGuard(Application::GetSolarMutex());
1282 case FLYCNTTYPE_FRM
:
1283 return ::getCppuType((uno::Reference
<XTextFrame
>*)0);
1284 case FLYCNTTYPE_GRF
:
1285 return ::getCppuType((uno::Reference
<XTextContent
>*)0);
1286 case FLYCNTTYPE_OLE
:
1287 return ::getCppuType((uno::Reference
<XEmbeddedObjectSupplier
>*)0);
1293 sal_Bool
SwXFrames::hasElements(void) throw(uno::RuntimeException
)
1295 vos::OGuard
aGuard(Application::GetSolarMutex());
1297 throw uno::RuntimeException();
1298 return GetDoc()->GetFlyCount(eType
) > 0;
1301 SwXFrame
* SwXFrames::GetObject(SwFrmFmt
& rFmt
, FlyCntType eType
)
1303 SwXFrame
* pFrm
= (SwXFrame
*)SwClientIter(rFmt
).First(TYPE(SwXFrame
));
1304 if(pFrm
) return pFrm
;
1307 case FLYCNTTYPE_FRM
:
1308 return new SwXTextFrame(rFmt
);
1309 case FLYCNTTYPE_GRF
:
1310 return new SwXTextGraphicObject(rFmt
);
1311 case FLYCNTTYPE_OLE
:
1312 return new SwXTextEmbeddedObject(rFmt
);
1318 /******************************************************************
1320 ******************************************************************/
1321 /* -----------------------------06.04.00 12:44--------------------------------
1323 ---------------------------------------------------------------------------*/
1324 OUString
SwXTextFrames::getImplementationName(void) throw( RuntimeException
)
1326 return C2U("SwXTextFrames");
1328 /* -----------------------------06.04.00 12:44--------------------------------
1330 ---------------------------------------------------------------------------*/
1331 BOOL
SwXTextFrames::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
1333 return C2U("com.sun.star.text.TextFrames") == rServiceName
;
1335 /* -----------------------------06.04.00 12:44--------------------------------
1337 ---------------------------------------------------------------------------*/
1338 Sequence
< OUString
> SwXTextFrames::getSupportedServiceNames(void) throw( RuntimeException
)
1340 Sequence
< OUString
> aRet(1);
1341 OUString
* pArray
= aRet
.getArray();
1342 pArray
[0] = C2U("com.sun.star.text.TextFrames");
1345 /*-- 14.01.99 08:06:16---------------------------------------------------
1347 -----------------------------------------------------------------------*/
1348 SwXTextFrames::SwXTextFrames(SwDoc
* _pDoc
) :
1349 SwXFrames(_pDoc
, FLYCNTTYPE_FRM
)
1352 /*-- 14.01.99 08:06:17---------------------------------------------------
1354 -----------------------------------------------------------------------*/
1355 SwXTextFrames::~SwXTextFrames()
1359 /******************************************************************
1360 * SwXTextGraphicObjects
1361 ******************************************************************/
1362 //SMART_UNO_IMPLEMENTATION( SwXTextGraphicObjects, UsrObject );
1364 /* -----------------------------06.04.00 12:44--------------------------------
1366 ---------------------------------------------------------------------------*/
1367 OUString
SwXTextGraphicObjects::getImplementationName(void) throw( RuntimeException
)
1369 return C2U("SwXTextGraphicObjects");
1371 /* -----------------------------06.04.00 12:44--------------------------------
1373 ---------------------------------------------------------------------------*/
1374 BOOL
SwXTextGraphicObjects::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
1376 return C2U("com.sun.star.text.TextGraphicObjects") == rServiceName
;
1378 /* -----------------------------06.04.00 12:44--------------------------------
1380 ---------------------------------------------------------------------------*/
1381 Sequence
< OUString
> SwXTextGraphicObjects::getSupportedServiceNames(void) throw( RuntimeException
)
1383 Sequence
< OUString
> aRet(1);
1384 OUString
* pArray
= aRet
.getArray();
1385 pArray
[0] = C2U("com.sun.star.text.TextGraphicObjects");
1388 /*-- 14.01.99 08:45:53---------------------------------------------------
1390 -----------------------------------------------------------------------*/
1391 SwXTextGraphicObjects::SwXTextGraphicObjects(SwDoc
* _pDoc
) :
1392 SwXFrames(_pDoc
, FLYCNTTYPE_GRF
)
1395 /*-- 14.01.99 08:45:54---------------------------------------------------
1397 -----------------------------------------------------------------------*/
1398 SwXTextGraphicObjects::~SwXTextGraphicObjects()
1402 /******************************************************************
1403 * SwXTextEmbeddedObjects
1404 ******************************************************************/
1405 /* -----------------------------06.04.00 12:44--------------------------------
1407 ---------------------------------------------------------------------------*/
1408 OUString
SwXTextEmbeddedObjects::getImplementationName(void) throw( RuntimeException
)
1410 return C2U("SwXTextEmbeddedObjects");
1412 /* -----------------------------06.04.00 12:44--------------------------------
1414 ---------------------------------------------------------------------------*/
1415 BOOL
SwXTextEmbeddedObjects::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
1417 return C2U("com.sun.star.text.TextEmbeddedObjects") == rServiceName
;
1419 /* -----------------------------06.04.00 12:44--------------------------------
1421 ---------------------------------------------------------------------------*/
1422 Sequence
< OUString
> SwXTextEmbeddedObjects::getSupportedServiceNames(void) throw( RuntimeException
)
1424 Sequence
< OUString
> aRet(1);
1425 OUString
* pArray
= aRet
.getArray();
1426 pArray
[0] = C2U("com.sun.star.text.TextEmbeddedObjects");
1429 /*-- 14.01.99 08:45:13---------------------------------------------------
1431 -----------------------------------------------------------------------*/
1432 SwXTextEmbeddedObjects::SwXTextEmbeddedObjects(SwDoc
* _pDoc
) :
1433 SwXFrames(_pDoc
, FLYCNTTYPE_OLE
)
1436 /*-- 14.01.99 08:45:31---------------------------------------------------
1438 -----------------------------------------------------------------------*/
1439 SwXTextEmbeddedObjects::~SwXTextEmbeddedObjects()
1443 /******************************************************************
1445 ******************************************************************/
1446 #define PASSWORD_STD_TIMEOUT 1000
1447 /* -----------------------------06.04.00 12:44--------------------------------
1449 ---------------------------------------------------------------------------*/
1450 OUString
SwXTextSections::getImplementationName(void) throw( RuntimeException
)
1452 return C2U("SwXTextSections");
1454 /* -----------------------------06.04.00 12:44--------------------------------
1456 ---------------------------------------------------------------------------*/
1457 BOOL
SwXTextSections::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
1459 return C2U("com.sun.star.text.TextSections") == rServiceName
;
1461 /* -----------------------------06.04.00 12:44--------------------------------
1463 ---------------------------------------------------------------------------*/
1464 Sequence
< OUString
> SwXTextSections::getSupportedServiceNames(void) throw( RuntimeException
)
1466 Sequence
< OUString
> aRet(1);
1467 OUString
* pArray
= aRet
.getArray();
1468 pArray
[0] = C2U("com.sun.star.text.TextSections");
1471 /*-- 14.01.99 09:06:05---------------------------------------------------
1473 -----------------------------------------------------------------------*/
1474 SwXTextSections::SwXTextSections(SwDoc
* _pDoc
) :
1475 SwUnoCollection(_pDoc
)
1478 /*-- 14.01.99 09:06:05---------------------------------------------------
1480 -----------------------------------------------------------------------*/
1481 SwXTextSections::~SwXTextSections()
1484 /*-- 14.01.99 09:06:05---------------------------------------------------
1486 -----------------------------------------------------------------------*/
1487 sal_Int32
SwXTextSections::getCount(void) throw( uno::RuntimeException
)
1489 vos::OGuard
aGuard(Application::GetSolarMutex());
1491 throw uno::RuntimeException();
1492 const SwSectionFmts
& rSectFmts
= GetDoc()->GetSections();
1493 sal_uInt16 nCount
= rSectFmts
.Count();
1494 for(sal_uInt16 i
= nCount
; i
; i
--)
1496 if( !rSectFmts
[i
- 1]->IsInNodesArr())
1501 /*-- 14.01.99 09:06:06---------------------------------------------------
1503 -----------------------------------------------------------------------*/
1504 uno::Any
SwXTextSections::getByIndex(sal_Int32 nIndex
)
1505 throw( IndexOutOfBoundsException
, WrappedTargetException
, uno::RuntimeException
)
1507 vos::OGuard
aGuard(Application::GetSolarMutex());
1508 uno::Reference
< XTextSection
> xRet
;
1511 SwSectionFmts
& rFmts
= GetDoc()->GetSections();
1513 const SwSectionFmts
& rSectFmts
= GetDoc()->GetSections();
1514 sal_uInt16 nCount
= rSectFmts
.Count();
1515 for(sal_uInt16 i
= 0; i
< nCount
; i
++)
1517 if( !rSectFmts
[i
]->IsInNodesArr())
1519 else if(nIndex
== i
)
1524 if(nIndex
>= 0 && nIndex
< rFmts
.Count())
1526 SwSectionFmt
* pFmt
= rFmts
[(sal_uInt16
)nIndex
];
1527 xRet
= GetObject(*pFmt
);
1530 throw IndexOutOfBoundsException();
1533 throw uno::RuntimeException();
1534 return makeAny(xRet
);
1536 /*-- 14.01.99 09:06:06---------------------------------------------------
1538 -----------------------------------------------------------------------*/
1539 uno::Any
SwXTextSections::getByName(const OUString
& Name
)
1540 throw( NoSuchElementException
, WrappedTargetException
, uno::RuntimeException
)
1542 vos::OGuard
aGuard(Application::GetSolarMutex());
1547 SwSectionFmts
& rFmts
= GetDoc()->GetSections();
1548 uno::Reference
< XTextSection
> xSect
;
1549 for(sal_uInt16 i
= 0; i
< rFmts
.Count(); i
++)
1551 SwSectionFmt
* pFmt
= rFmts
[i
];
1552 if(pFmt
->IsInNodesArr() && aName
== pFmt
->GetSection()->GetName())
1554 xSect
= GetObject(*pFmt
);
1555 aRet
.setValue(&xSect
, ::getCppuType((uno::Reference
<XTextSection
>*)0));
1560 throw NoSuchElementException();
1563 throw uno::RuntimeException();
1566 /*-- 14.01.99 09:06:06---------------------------------------------------
1568 -----------------------------------------------------------------------*/
1569 uno::Sequence
< OUString
> SwXTextSections::getElementNames(void)
1570 throw( uno::RuntimeException
)
1572 vos::OGuard
aGuard(Application::GetSolarMutex());
1574 throw uno::RuntimeException();
1575 sal_uInt16 nCount
= GetDoc()->GetSections().Count();
1576 SwSectionFmts
& rSectFmts
= GetDoc()->GetSections();
1577 for(sal_uInt16 i
= nCount
; i
; i
--)
1579 if( !rSectFmts
[i
- 1]->IsInNodesArr())
1583 uno::Sequence
<OUString
> aSeq(nCount
);
1586 SwSectionFmts
& rFmts
= GetDoc()->GetSections();
1587 OUString
* pArray
= aSeq
.getArray();
1588 sal_uInt16 nIndex
= 0;
1589 for( sal_uInt16 i
= 0; i
< nCount
; i
++, nIndex
++)
1591 const SwSectionFmt
* pFmt
= rFmts
[nIndex
];
1592 while(!pFmt
->IsInNodesArr())
1594 pFmt
= rFmts
[++nIndex
];
1596 pArray
[i
] = pFmt
->GetSection()->GetName();
1601 /*-- 14.01.99 09:06:06---------------------------------------------------
1603 -----------------------------------------------------------------------*/
1604 sal_Bool
SwXTextSections::hasByName(const OUString
& Name
)
1605 throw( uno::RuntimeException
)
1607 vos::OGuard
aGuard(Application::GetSolarMutex());
1608 sal_Bool bRet
= sal_False
;
1612 SwSectionFmts
& rFmts
= GetDoc()->GetSections();
1613 for(sal_uInt16 i
= 0; i
< rFmts
.Count(); i
++)
1615 const SwSectionFmt
* pFmt
= rFmts
[i
];
1616 if(aName
== pFmt
->GetSection()->GetName())
1625 //Sonderbehandlung der dbg_ - Methoden
1626 if( COMPARE_EQUAL
!= aName
.CompareToAscii("dbg_", 4))
1627 throw uno::RuntimeException();
1631 /*-- 14.01.99 09:06:06---------------------------------------------------
1633 -----------------------------------------------------------------------*/
1634 uno::Type SAL_CALL
SwXTextSections::getElementType() throw(uno::RuntimeException
)
1636 return ::getCppuType((uno::Reference
<XTextSection
>*)0);
1638 /*-- 14.01.99 09:06:06---------------------------------------------------
1640 -----------------------------------------------------------------------*/
1641 sal_Bool
SwXTextSections::hasElements(void) throw( uno::RuntimeException
)
1643 vos::OGuard
aGuard(Application::GetSolarMutex());
1644 sal_uInt16 nCount
= 0;
1647 SwSectionFmts
& rFmts
= GetDoc()->GetSections();
1648 nCount
= rFmts
.Count();
1651 throw uno::RuntimeException();
1654 /*-- 14.01.99 09:06:07---------------------------------------------------
1656 -----------------------------------------------------------------------*/
1657 uno::Reference
< XTextSection
> SwXTextSections::GetObject( SwSectionFmt
& rFmt
)
1659 SwXTextSectionClient
* pClient
= (SwXTextSectionClient
*)SwClientIter( rFmt
).
1660 First( TYPE( SwXTextSectionClient
));
1661 uno::Reference
< XTextSection
> xRet
;
1663 xRet
= pClient
->GetXTextSection();
1664 // it is possible that the client is still registered but the reference is already invalid
1666 xRet
= SwXTextSectionClient::CreateXTextSection(&rFmt
);
1670 OUString
SwXBookmarks::getImplementationName(void) throw( RuntimeException
)
1672 return OUString::createFromAscii("SwXBookmarks");
1675 BOOL
SwXBookmarks::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
1677 return OUString::createFromAscii("com.sun.star.text.Bookmarks") == rServiceName
;
1680 Sequence
< OUString
> SwXBookmarks::getSupportedServiceNames(void) throw( RuntimeException
)
1682 Sequence
< OUString
> aRet(1);
1683 aRet
[0] = OUString::createFromAscii("com.sun.star.text.Bookmarks");
1687 SwXBookmarks::SwXBookmarks(SwDoc
* _pDoc
) :
1688 SwUnoCollection(_pDoc
)
1691 SwXBookmarks::~SwXBookmarks()
1694 sal_Int32
SwXBookmarks::getCount(void)
1695 throw( uno::RuntimeException
)
1697 vos::OGuard
aGuard(Application::GetSolarMutex());
1699 throw uno::RuntimeException();
1700 return GetDoc()->getIDocumentMarkAccess()->getBookmarksCount();
1703 uno::Any
SwXBookmarks::getByIndex(sal_Int32 nIndex
)
1704 throw( IndexOutOfBoundsException
, WrappedTargetException
, uno::RuntimeException
)
1706 vos::OGuard
aGuard(Application::GetSolarMutex());
1708 throw uno::RuntimeException();
1709 IDocumentMarkAccess
* const pMarkAccess
= GetDoc()->getIDocumentMarkAccess();
1710 if(nIndex
< 0 || nIndex
>= pMarkAccess
->getBookmarksCount())
1711 throw IndexOutOfBoundsException();
1714 ::sw::mark::IMark
* pBkmk
= pMarkAccess
->getBookmarksBegin()[nIndex
].get();
1715 uno::Reference
< XTextContent
> xRef
= GetObject(*pBkmk
, GetDoc());
1716 aRet
.setValue(&xRef
, ::getCppuType((uno::Reference
<XTextContent
>*)0));
1720 uno::Any
SwXBookmarks::getByName(const rtl::OUString
& rName
)
1721 throw( NoSuchElementException
, WrappedTargetException
, uno::RuntimeException
)
1723 vos::OGuard
aGuard(Application::GetSolarMutex());
1725 throw uno::RuntimeException();
1727 IDocumentMarkAccess
* const pMarkAccess
= GetDoc()->getIDocumentMarkAccess();
1728 IDocumentMarkAccess::const_iterator_t ppBkmk
= pMarkAccess
->findBookmark(rName
);
1729 if(ppBkmk
== pMarkAccess
->getBookmarksEnd())
1730 throw NoSuchElementException();
1733 uno::Reference
< XTextContent
> xRef
= SwXBookmarks::GetObject(*(ppBkmk
->get()), GetDoc());
1734 aRet
.setValue(&xRef
, ::getCppuType((uno::Reference
<XTextContent
>*)0));
1738 uno::Sequence
< OUString
> SwXBookmarks::getElementNames(void)
1739 throw( uno::RuntimeException
)
1741 vos::OGuard
aGuard(Application::GetSolarMutex());
1743 throw uno::RuntimeException();
1745 IDocumentMarkAccess
* const pMarkAccess
= GetDoc()->getIDocumentMarkAccess();
1746 uno::Sequence
<OUString
> aSeq(pMarkAccess
->getBookmarksCount());
1748 for(IDocumentMarkAccess::const_iterator_t ppMark
= pMarkAccess
->getBookmarksBegin();
1749 ppMark
!= pMarkAccess
->getBookmarksEnd();)
1750 aSeq
[nCnt
++] = (*ppMark
++)->GetName();
1754 sal_Bool
SwXBookmarks::hasByName(const OUString
& rName
)
1755 throw( uno::RuntimeException
)
1757 vos::OGuard
aGuard(Application::GetSolarMutex());
1759 throw uno::RuntimeException();
1761 IDocumentMarkAccess
* const pMarkAccess
= GetDoc()->getIDocumentMarkAccess();
1762 return pMarkAccess
->findBookmark(rName
) != pMarkAccess
->getBookmarksEnd();
1765 uno::Type SAL_CALL
SwXBookmarks::getElementType()
1766 throw(uno::RuntimeException
)
1768 return ::getCppuType((uno::Reference
<XTextContent
>*)0);
1771 sal_Bool
SwXBookmarks::hasElements(void)
1772 throw( uno::RuntimeException
)
1774 vos::OGuard
aGuard(Application::GetSolarMutex());
1776 throw uno::RuntimeException();
1777 return GetDoc()->getIDocumentMarkAccess()->getBookmarksCount() != 0;
1780 SwXBookmark
* SwXBookmarks::GetObject( ::sw::mark::IMark
& rBkmk
, SwDoc
* pDoc
)
1782 SwModify
* const pModify
= static_cast<SwModify
*>(&rBkmk
);
1783 SwXBookmark
* pXBkmk
= (SwXBookmark
*)SwClientIter(*pModify
).First(TYPE(SwXBookmark
));
1786 // FIXME: These belong in XTextFieldsSupplier
1787 //if (dynamic_cast< ::sw::mark::TextFieldmark* >(&rBkmk))
1788 // pXBkmk = new SwXFieldmark(false, &rBkmk, pDoc);
1789 //else if (dynamic_cast< ::sw::mark::CheckboxFieldmark* >(&rBkmk))
1790 // pXBkmk = new SwXFieldmark(true, &rBkmk, pDoc);
1793 dynamic_cast< ::sw::mark::IBookmark
* >(&rBkmk
),
1794 "<SwXBookmark::GetObject(..)>"
1795 "SwXBookmark requested for non-bookmark mark.");
1796 pXBkmk
= new SwXBookmark(&rBkmk
, pDoc
);
1801 /******************************************************************
1803 ******************************************************************/
1805 SwXNumberingRulesCollection::SwXNumberingRulesCollection( SwDoc
* _pDoc
) :
1806 SwUnoCollection(_pDoc
)
1810 SwXNumberingRulesCollection::~SwXNumberingRulesCollection()
1814 sal_Int32
SwXNumberingRulesCollection::getCount(void) throw( uno::RuntimeException
)
1816 vos::OGuard
aGuard(Application::GetSolarMutex());
1818 throw uno::RuntimeException();
1819 return GetDoc()->GetNumRuleTbl().Count();
1822 uno::Any
SwXNumberingRulesCollection::getByIndex(sal_Int32 nIndex
)
1823 throw( IndexOutOfBoundsException
, WrappedTargetException
, uno::RuntimeException
)
1825 vos::OGuard
aGuard(Application::GetSolarMutex());
1829 uno::Reference
< XIndexReplace
> xRef
;
1830 if ( nIndex
< GetDoc()->GetNumRuleTbl().Count() )
1832 xRef
= new SwXNumberingRules( *GetDoc()->GetNumRuleTbl()[ static_cast< USHORT
>(nIndex
) ] );
1833 aRet
.setValue(&xRef
, ::getCppuType((uno::Reference
<XIndexReplace
>*)0));
1837 throw IndexOutOfBoundsException();
1840 throw uno::RuntimeException();
1844 uno::Type SAL_CALL
SwXNumberingRulesCollection::getElementType() throw(uno::RuntimeException
)
1846 return ::getCppuType((uno::Reference
<XIndexReplace
>*)0);
1849 sal_Bool
SwXNumberingRulesCollection::hasElements(void) throw( uno::RuntimeException
)
1851 vos::OGuard
aGuard(Application::GetSolarMutex());
1853 throw uno::RuntimeException();
1854 return GetDoc()->GetNumRuleTbl().Count() > 0;
1857 /* -----------------------------06.04.00 12:44--------------------------------
1859 ---------------------------------------------------------------------------*/
1860 OUString
SwXFootnotes::getImplementationName(void) throw( RuntimeException
)
1862 return C2U("SwXFootnotes");
1864 /* -----------------------------06.04.00 12:44--------------------------------
1866 ---------------------------------------------------------------------------*/
1867 BOOL
SwXFootnotes::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
1869 return C2U("com.sun.star.text.Footnotes") == rServiceName
;
1871 /* -----------------------------06.04.00 12:44--------------------------------
1873 ---------------------------------------------------------------------------*/
1874 Sequence
< OUString
> SwXFootnotes::getSupportedServiceNames(void) throw( RuntimeException
)
1876 Sequence
< OUString
> aRet(1);
1877 OUString
* pArray
= aRet
.getArray();
1878 pArray
[0] = C2U("com.sun.star.text.Footnotes");
1881 /*-- 14.01.99 09:03:52---------------------------------------------------
1883 -----------------------------------------------------------------------*/
1884 SwXFootnotes::SwXFootnotes(sal_Bool bEnd
, SwDoc
* _pDoc
)
1885 : SwUnoCollection(_pDoc
)
1889 /*-- 14.01.99 09:03:52---------------------------------------------------
1891 -----------------------------------------------------------------------*/
1892 SwXFootnotes::~SwXFootnotes()
1895 /*-- 14.01.99 09:03:53---------------------------------------------------
1897 -----------------------------------------------------------------------*/
1898 sal_Int32
SwXFootnotes::getCount(void) throw( uno::RuntimeException
)
1900 vos::OGuard
aGuard(Application::GetSolarMutex());
1902 throw uno::RuntimeException();
1903 sal_Int32 nCount
= 0;
1904 sal_uInt16 n
, nFtnCnt
= GetDoc()->GetFtnIdxs().Count();
1906 for( n
= 0; n
< nFtnCnt
; ++n
)
1908 pTxtFtn
= GetDoc()->GetFtnIdxs()[ n
];
1909 const SwFmtFtn
& rFtn
= pTxtFtn
->GetFtn();
1910 if ( rFtn
.IsEndNote() != m_bEndnote
)
1916 /*-- 14.01.99 09:03:53---------------------------------------------------
1918 -----------------------------------------------------------------------*/
1919 uno::Any
SwXFootnotes::getByIndex(sal_Int32 nIndex
)
1920 throw( IndexOutOfBoundsException
, WrappedTargetException
, uno::RuntimeException
)
1922 vos::OGuard
aGuard(Application::GetSolarMutex());
1924 sal_Int32 nCount
= 0;
1927 sal_uInt16 n
, nFtnCnt
= GetDoc()->GetFtnIdxs().Count();
1929 uno::Reference
< XFootnote
> xRef
;
1930 for( n
= 0; n
< nFtnCnt
; ++n
)
1932 pTxtFtn
= GetDoc()->GetFtnIdxs()[ n
];
1933 const SwFmtFtn
& rFtn
= pTxtFtn
->GetFtn();
1934 if ( rFtn
.IsEndNote() != m_bEndnote
)
1937 if(nCount
== nIndex
)
1939 xRef
= new SwXFootnote(GetDoc(), rFtn
);
1940 aRet
.setValue(&xRef
, ::getCppuType((uno::Reference
<XFootnote
>*)0));
1946 throw IndexOutOfBoundsException();
1949 throw uno::RuntimeException();
1952 /*-- 14.01.99 09:03:53---------------------------------------------------
1954 -----------------------------------------------------------------------*/
1955 uno::Type SAL_CALL
SwXFootnotes::getElementType() throw(uno::RuntimeException
)
1957 return ::getCppuType((uno::Reference
<XFootnote
>*)0);
1959 /*-- 14.01.99 09:03:54---------------------------------------------------
1961 -----------------------------------------------------------------------*/
1962 sal_Bool
SwXFootnotes::hasElements(void) throw( uno::RuntimeException
)
1964 vos::OGuard
aGuard(Application::GetSolarMutex());
1966 throw uno::RuntimeException();
1967 return GetDoc()->GetFtnIdxs().Count() > 0;
1969 /* -----------------------------05.09.00 12:48--------------------------------
1971 ---------------------------------------------------------------------------*/
1972 Reference
<XFootnote
> SwXFootnotes::GetObject( SwDoc
& rDoc
, const SwFmtFtn
& rFmt
)
1974 Reference
<XTextContent
> xContent
= ((SwUnoCallBack
*)rDoc
.GetUnoCallBack())->
1977 xContent
= new SwXFootnote(&rDoc
, rFmt
);
1978 Reference
<XFootnote
> xRet(xContent
, UNO_QUERY
);
1982 /******************************************************************
1984 ******************************************************************/
1985 /* -----------------------------06.04.00 12:44--------------------------------
1987 ---------------------------------------------------------------------------*/
1988 OUString
SwXReferenceMarks::getImplementationName(void) throw( RuntimeException
)
1990 return C2U("SwXReferenceMarks");
1992 /* -----------------------------06.04.00 12:44--------------------------------
1994 ---------------------------------------------------------------------------*/
1995 BOOL
SwXReferenceMarks::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
1997 return C2U("com.sun.star.text.ReferenceMarks") == rServiceName
;
1999 /* -----------------------------06.04.00 12:44--------------------------------
2001 ---------------------------------------------------------------------------*/
2002 Sequence
< OUString
> SwXReferenceMarks::getSupportedServiceNames(void) throw( RuntimeException
)
2004 Sequence
< OUString
> aRet(1);
2005 OUString
* pArray
= aRet
.getArray();
2006 pArray
[0] = C2U("com.sun.star.text.ReferenceMarks");
2009 /*-- 14.01.99 09:03:16---------------------------------------------------
2011 -----------------------------------------------------------------------*/
2012 SwXReferenceMarks::SwXReferenceMarks(SwDoc
* _pDoc
) :
2013 SwUnoCollection(_pDoc
)
2016 /*-- 14.01.99 09:03:16---------------------------------------------------
2018 -----------------------------------------------------------------------*/
2019 SwXReferenceMarks::~SwXReferenceMarks()
2022 /*-- 14.01.99 09:03:17---------------------------------------------------
2024 -----------------------------------------------------------------------*/
2025 sal_Int32
SwXReferenceMarks::getCount(void) throw( uno::RuntimeException
)
2027 vos::OGuard
aGuard(Application::GetSolarMutex());
2029 throw uno::RuntimeException();
2030 return GetDoc()->GetRefMarks();
2032 /*-- 14.01.99 09:03:17---------------------------------------------------
2034 -----------------------------------------------------------------------*/
2035 uno::Any
SwXReferenceMarks::getByIndex(sal_Int32 nIndex
)
2036 throw( IndexOutOfBoundsException
, WrappedTargetException
, uno::RuntimeException
)
2038 vos::OGuard
aGuard(Application::GetSolarMutex());
2041 throw uno::RuntimeException();
2042 uno::Reference
< XTextContent
> xRef
;
2043 if(0 <= nIndex
&& nIndex
< USHRT_MAX
)
2045 const SwFmtRefMark
* pMark
= GetDoc()->GetRefMark( (sal_uInt16
) nIndex
);
2048 xRef
= SwXReferenceMarks::GetObject( GetDoc(), pMark
);
2049 aRet
.setValue(&xRef
, ::getCppuType((uno::Reference
<XTextContent
>*)0));
2053 throw IndexOutOfBoundsException();
2056 /*-- 14.01.99 09:03:17---------------------------------------------------
2058 -----------------------------------------------------------------------*/
2059 uno::Any
SwXReferenceMarks::getByName(const OUString
& rName
)
2060 throw( NoSuchElementException
, WrappedTargetException
, uno::RuntimeException
)
2062 vos::OGuard
aGuard(Application::GetSolarMutex());
2066 const SwFmtRefMark
* pMark
= GetDoc()->GetRefMark(rName
);
2069 uno::Reference
< XTextContent
> xRef
= SwXReferenceMarks::GetObject( GetDoc(), pMark
);
2070 aRet
.setValue(&xRef
, ::getCppuType((uno::Reference
<XTextContent
>*)0));
2073 throw NoSuchElementException();
2076 throw uno::RuntimeException();
2079 /*-- 14.01.99 09:03:17---------------------------------------------------
2081 -----------------------------------------------------------------------*/
2082 uno::Sequence
< OUString
> SwXReferenceMarks::getElementNames(void) throw( uno::RuntimeException
)
2084 vos::OGuard
aGuard(Application::GetSolarMutex());
2085 uno::Sequence
<OUString
> aRet
;
2088 SvStringsDtor aStrings
;
2089 sal_uInt16 nCount
= GetDoc()->GetRefMarks( &aStrings
);
2090 aRet
.realloc(nCount
);
2091 OUString
* pNames
= aRet
.getArray();
2092 for(sal_uInt16 i
= 0; i
< nCount
; i
++)
2093 pNames
[i
] = *aStrings
.GetObject(i
);
2096 throw uno::RuntimeException();
2099 /*-- 14.01.99 09:03:17---------------------------------------------------
2101 -----------------------------------------------------------------------*/
2102 sal_Bool
SwXReferenceMarks::hasByName(const OUString
& rName
) throw( uno::RuntimeException
)
2104 vos::OGuard
aGuard(Application::GetSolarMutex());
2106 throw uno::RuntimeException();
2107 return 0 != GetDoc()->GetRefMark( rName
);
2109 /*-- 14.01.99 09:03:18---------------------------------------------------
2111 -----------------------------------------------------------------------*/
2112 uno::Type SAL_CALL
SwXReferenceMarks::getElementType() throw(uno::RuntimeException
)
2114 return ::getCppuType((uno::Reference
<XTextContent
>*)0);
2116 /*-- 14.01.99 09:03:18---------------------------------------------------
2118 -----------------------------------------------------------------------*/
2119 sal_Bool
SwXReferenceMarks::hasElements(void) throw( uno::RuntimeException
)
2121 vos::OGuard
aGuard(Application::GetSolarMutex());
2123 throw uno::RuntimeException();
2124 return 0 != GetDoc()->GetRefMarks();
2126 /*-- 14.01.99 09:03:19---------------------------------------------------
2128 -----------------------------------------------------------------------*/
2129 SwXReferenceMark
* SwXReferenceMarks::GetObject( SwDoc
* pDoc
, const SwFmtRefMark
* pMark
)
2131 vos::OGuard
aGuard(Application::GetSolarMutex());
2132 SwClientIter
aIter( *pDoc
->GetUnoCallBack() );
2133 SwXReferenceMark
* pxMark
= (SwXReferenceMark
*)aIter
.First( TYPE( SwXReferenceMark
));
2136 if(pxMark
->GetMark() == pMark
)
2138 pxMark
= (SwXReferenceMark
*)aIter
.Next();
2141 pxMark
= new SwXReferenceMark(pDoc
, pMark
);
2144 /******************************************************************
2146 ******************************************************************/
2147 /*-----------------11.03.98 11:18-------------------
2148 Gueltigkeitspruefung
2149 --------------------------------------------------*/
2150 void SwUnoCollection::Invalidate()
2152 bObjectValid
= sal_False
;