1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SW_WRITERHELPER
21 #define SW_WRITERHELPER
26 #include <com/sun/star/embed/XEmbeddedObject.hpp>
28 #include <sfx2/objsh.hxx>
30 #include <svl/itempool.hxx> //SfxItemPool
31 #include <svl/itemset.hxx> //SfxItemSet
32 #include <format.hxx> //SwFmt
33 #include <node.hxx> //SwCntntNode
34 #include <pam.hxx> //SwPaM
35 #include <tools/poly.hxx> //Polygon, PolyPolygon
36 #include <doc.hxx> //SwDoc
42 class OutlinerParaObject
;
56 : public std::binary_function
<sal_uInt16
, sal_uInt16
, bool>
59 bool operator()(sal_uInt16 nA
, sal_uInt16 nB
) const;
66 /// STL container of Paragraph Styles (SwTxtFmtColl)
67 typedef std::vector
<SwTxtFmtColl
*> ParaStyles
;
68 /// STL iterator for ParaStyles
69 typedef ParaStyles::iterator ParaStyleIter
;
70 /// STL container of SfxPoolItems (Attributes)
71 typedef std::map
<sal_uInt16
, const SfxPoolItem
*, sw::util::ItemSort
> PoolItems
;
72 /// STL const iterator for ParaStyles
73 typedef PoolItems::const_iterator cPoolItemIter
;
76 /** Make exporting a Writer Frame easy
78 In word all frames are effectively anchored to character or as
79 character. This is nice and simple, writer is massively complex in this
80 area, so this sw::Frame simplies matters by providing a single unified
81 view of the multitute of elements in writer and their differing quirks.
83 A sw::Frame wraps a writer frame and is guaranted to have a suitable
84 anchor position available from it. It hides much of the needless
85 complexity of the multitude of floating/inline elements in writer, it...
87 Guarantees an anchor position for a frame.
88 Provides a readable way to see if we are anchored inline. (as character)
89 Provides a simple way to flag what type of entity this frame describes.
90 Provides the size of the element as drawn by writer.
93 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
98 enum WriterSource
{eTxtBox
, eGraphic
, eOle
, eDrawing
, eFormControl
,eBulletGrf
};
100 const SwFrmFmt
* mpFlyFrm
;
103 // #i43447# - Size of the frame in the layout.
104 // Especially needed for graphics, whose layout size can differ from its
105 // size, because it is scaled into its environment.
108 WriterSource meWriterType
;
109 const SwNode
*mpStartFrameContent
;
114 Frame(const SwFrmFmt
&rFlyFrm
, const SwPosition
&rPos
);
115 Frame(const Graphic
&, const SwPosition
&);
117 /** Get the writer SwFrmFmt that this object describes
122 const SwFrmFmt
&GetFrmFmt() const { return *mpFlyFrm
; }
124 /** Get the position this frame is anchored at
127 The anchor position of this frame
129 const SwPosition
&GetPosition() const { return maPos
; }
131 /** Get the node this frame is anchored into
134 The SwTxtNode this frame is anchored inside
136 const SwCntntNode
*GetCntntNode() const
137 { return maPos
.nNode
.GetNode().GetCntntNode(); }
139 /** Get the type of frame that this wraps
142 a WriterSource which describes the source type of this wrapper
144 WriterSource
GetWriterType() const { return meWriterType
; }
146 /** Is this frame inline (as character)
149 whether this is inline or not
151 bool IsInline() const;
154 /** Even if the frame isn't an inline frame, force it to behave as one
156 There are a variety of circumstances where word cannot have
157 anything except inline elements, e.g. inside frames. So its easier
158 to force this sw::Frame into behaving as one, instead of special
159 casing export code all over the place.
162 void ForceTreatAsInline();
164 /** Get the first node of content in the frame
167 the first node of content in the frame, might not be any at all.
169 const SwNode
*GetContent() const { return mpStartFrameContent
; }
170 const Graphic
&GetGraphic() const { return maGrf
; }
171 bool HasGraphic() const { return mbForBullet
; }
174 /** Does this sw::Frame refer to the same writer content as another
177 if the two sw::Frames are handling the same writer frame
179 bool RefersToSameFrameAs(const Frame
&rOther
) const
181 if (mbForBullet
&& rOther
.mbForBullet
)
182 return (maGrf
== rOther
.maGrf
);
183 else if ((!mbForBullet
) && (!rOther
.mbForBullet
))
184 return (mpFlyFrm
== rOther
.mpFlyFrm
);
189 /** The Size of the contained element
192 the best size to use to export to word
194 const Size
GetSize() const { return maSize
; }
196 /** The layout size of the contained element
198 #i43447# - Needed for graphics, which are scaled into its environment
202 const Size
GetLayoutSize() const
208 /// STL container of Frames
209 typedef std::vector
<Frame
> Frames
;
210 /// STL iterator for Frames
211 typedef std::vector
<Frame
>::iterator FrameIter
;
218 /** Provide a dynamic_cast style cast for SfxPoolItems
220 A SfxPoolItem generally need to be cast back to its original type
221 to be useful, which is both tedious and errorprone. So item_cast is
222 a helper template to aid the process and test if the cast is
226 The SfxPoolItem which is to be casted
229 A SfxPoolItem derived class to cast rItem to
231 @return A rItem upcasted back to a T
233 @exception std::bad_cast Thrown if the rItem was not a T
236 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
238 template<class T
> const T
& item_cast(const SfxPoolItem
&rItem
)
241 if (!rItem
.IsA(STATICTYPE(T
)))
242 throw std::bad_cast();
243 return static_cast<const T
&>(rItem
);
246 /** Provide a dynamic_cast style cast for SfxPoolItems
248 A SfxPoolItem generally need to be cast back to its original type
249 to be useful, which is both tedious and errorprone. So item_cast is
250 a helper template to aid the process and test if the cast is
254 The SfxPoolItem which is to be casted
257 A SfxPoolItem derived class to cast pItem to
259 @return A pItem upcasted back to a T or 0 if pItem was not a T
262 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
264 template<class T
> const T
* item_cast(const SfxPoolItem
*pItem
)
266 if (pItem
&& !pItem
->IsA(STATICTYPE(T
)))
268 return static_cast<const T
*>(pItem
);
271 /** Extract a SfxPoolItem derived property from a SwCntntNode
273 Writer's attributes are retrieved by passing a numeric identifier
274 and receiving a SfxPoolItem reference which must then typically be
275 cast back to its original type which is both tedious and verbose.
277 ItemGet uses item_cast () on the retrived reference to test that the
278 retrived property is of the type that the developer thinks it is.
281 The SwCntntNode to retrieve the property from
284 The numeric identifier of the property to be retrieved
287 A SfxPoolItem derived class of the retrieved property
289 @exception std::bad_cast Thrown if the property was not a T
291 @return The T requested
294 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
296 template<class T
> const T
& ItemGet(const SwCntntNode
&rNode
,
297 sal_uInt16 eType
) throw(std::bad_cast
)
299 return item_cast
<T
>(rNode
.GetAttr(eType
));
302 /** Extract a SfxPoolItem derived property from a SwFmt
304 Writer's attributes are retrieved by passing a numeric identifier
305 and receiving a SfxPoolItem reference which must then typically be
306 cast back to its original type which is both tedious and verbose.
308 ItemGet uses item_cast () on the retrived reference to test that the
309 retrived property is of the type that the developer thinks it is.
312 The SwFmt to retrieve the property from
315 The numeric identifier of the property to be retrieved
318 A SfxPoolItem derived class of the retrieved property
320 @exception std::bad_cast Thrown if the property was not a T
323 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
325 template<class T
> const T
& ItemGet(const SwFmt
&rFmt
,
326 sal_uInt16 eType
) throw(std::bad_cast
)
328 return item_cast
<T
>(rFmt
.GetFmtAttr(eType
));
331 /** Extract a SfxPoolItem derived property from a SfxItemSet
333 Writer's attributes are retrieved by passing a numeric identifier
334 and receiving a SfxPoolItem reference which must then typically be
335 cast back to its original type which is both tedious and verbose.
337 ItemGet uses item_cast () on the retrived reference to test that the
338 retrived property is of the type that the developer thinks it is.
341 The SfxItemSet to retrieve the property from
344 The numeric identifier of the property to be retrieved
347 A SfxPoolItem derived class of the retrieved property
349 @exception std::bad_cast Thrown if the property was not a T
351 @return The T requested
354 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
356 template<class T
> const T
& ItemGet(const SfxItemSet
&rSet
,
357 sal_uInt16 eType
) throw(std::bad_cast
)
359 return item_cast
<T
>(rSet
.Get(eType
));
362 /** Extract a default SfxPoolItem derived property from a SfxItemPool
364 Writer's attributes are retrieved by passing a numeric identifier
365 and receiving a SfxPoolItem reference which must then typically be
366 cast back to its original type which is both tedious and verbose.
368 DefaultItemGet returns a reference to the default property of a
369 given SfxItemPool for a given property id, e.g. default fontsize
371 DefaultItemGet uses item_cast () on the retrived reference to test
372 that the retrived property is of the type that the developer thinks
376 The SfxItemPool whose default property we want
379 The numeric identifier of the default property to be retrieved
382 A SfxPoolItem derived class of the retrieved property
384 @exception std::bad_cast Thrown if the property was not a T
386 @return The T requested
389 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
391 template<class T
> const T
& DefaultItemGet(const SfxItemPool
&rPool
,
392 sal_uInt16 eType
) throw(std::bad_cast
)
394 return item_cast
<T
>(rPool
.GetDefaultItem(eType
));
397 /** Extract a default SfxPoolItem derived property from a SwDoc
399 Writer's attributes are retrieved by passing a numeric identifier
400 and receiving a SfxPoolItem reference which must then typically be
401 cast back to its original type which is both tedious and verbose.
403 DefaultItemGet returns a reference to the default property of a
404 given SwDoc (Writer Document) for a given property id, e.g default
407 DefaultItemGet uses item_cast () on the retrived reference to test
408 that the retrived property is of the type that the developer thinks
412 The SfxItemPool whose default property we want
415 The numeric identifier of the default property to be retrieved
418 A SfxPoolItem derived class of the retrieved property
420 @exception std::bad_cast Thrown if the property was not a T
422 @return The T requested
425 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
427 template<class T
> const T
& DefaultItemGet(const SwDoc
&rDoc
,
428 sal_uInt16 eType
) throw(std::bad_cast
)
430 return DefaultItemGet
<T
>(rDoc
.GetAttrPool(), eType
);
433 /** Return a pointer to a SfxPoolItem derived class if it exists in an
436 Writer's attributes are retrieved by passing a numeric identifier
437 and receiving a SfxPoolItem reference which must then typically be
438 cast back to its original type which is both tedious and verbose.
440 HasItem returns a pointer to the requested SfxPoolItem for a given
441 property id if it exists in the SfxItemSet or its chain of parents,
444 HasItem uses item_cast () on the retrived pointer to test that the
445 retrived property is of the type that the developer thinks it is.
448 The SfxItemSet whose property we want
451 The numeric identifier of the default property to be retrieved
454 A SfxPoolItem derived class of the retrieved property
456 @return The T requested or 0 if no T found with id eType
459 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
461 template<class T
> const T
* HasItem(const SfxItemSet
&rSet
,
464 return item_cast
<T
>(rSet
.GetItem(eType
));
467 /** Return a pointer to a SfxPoolItem derived class if it exists in an
470 Writer's attributes are retrieved by passing a numeric identifier
471 and receiving a SfxPoolItem reference which must then typically be
472 cast back to its original type which is both tedious and verbose.
474 HasItem returns a pointer to the requested SfxPoolItem for a given
475 property id if it exists in the SwFmt e.g. fontsize
477 HasItem uses item_cast () on the retrived pointer to test that the
478 retrived property is of the type that the developer thinks it is.
481 The SwFmt whose property we want
484 The numeric identifier of the default property to be retrieved
487 A SfxPoolItem derived class of the retrieved property
489 @return The T requested or 0 if no T found with id eType
492 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
494 template<class T
> const T
* HasItem(const SwFmt
&rFmt
,
497 return HasItem
<T
>(rFmt
.GetAttrSet(), eType
);
500 /** Get the Paragraph Styles of a SwDoc
502 Writer's styles are in one of those dreaded macro based pre-STL
503 containers. Give me an STL container of the paragraph styles
507 The SwDoc document to get the styles from
509 @return A ParaStyles containing the SwDoc's Paragraph Styles
512 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
514 ParaStyles
GetParaStyles(const SwDoc
&rDoc
);
517 /** Get a Paragraph Style which fits a given name
519 Its surprisingly tricky to get a style when all you have is a name,
520 but that's what this does
523 The SwDoc document to search in
526 The name of the style to search for
528 @return A Paragraph Style if one exists which matches the name
531 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
533 SwTxtFmtColl
* GetParaStyle(SwDoc
&rDoc
, const OUString
& rName
);
535 /** Get a Character Style which fits a given name
537 Its surprisingly tricky to get a style when all you have is a name,
538 but that's what this does
541 The SwDoc document to search in
544 The name of the style to search for
546 @return A Character Style if one exists which matches the name
549 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
551 SwCharFmt
* GetCharStyle(SwDoc
&rDoc
, const OUString
& rName
);
553 /** Sort sequence of Paragraph Styles by assigned outline style list level
555 Sort ParaStyles in ascending order of assigned outline style list level,
556 e.g. given Normal/Heading1/Heading2/.../Heading10 at their default
557 assigned outline style list levels of body level/level 1/level 2/.../level 10
560 adjust the sorting algorithm due to introduced outline level attribute
563 The ParaStyles to sort
566 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
568 void SortByAssignedOutlineStyleListLevel(ParaStyles
&rStyles
);
570 /** Get the SfxPoolItems of a SfxItemSet
572 Writer's SfxPoolItems (attributes) are in one of those dreaded
573 macro based pre-STL containers. Give me an STL container of the
577 The SfxItemSet to get the items from
580 The sw::PoolItems to put the items into
583 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
585 void GetPoolItems(const SfxItemSet
&rSet
, PoolItems
&rItems
, bool bExportParentItemSet
);
587 const SfxPoolItem
*SearchPoolItems(const PoolItems
&rItems
,
590 template<class T
> const T
* HasItem(const sw::PoolItems
&rItems
,
593 return item_cast
<T
>(SearchPoolItems(rItems
, eType
));
597 /** Remove properties from an SfxItemSet which a SwFmtCharFmt overrides
599 Given an SfxItemSet and a SwFmtCharFmt remove from the rSet all the
600 properties which the SwFmtCharFmt would override. An SfxItemSet
601 contains attributes, and a SwFmtCharFmt is a "Character Style",
602 so if the SfxItemSet contains bold and so does the character style
603 then delete bold from the SfxItemSet
606 rFmt the SwFmtCharFmt which describes the Character Style
609 rSet the SfxItemSet from which we want to remove any properties
610 which the rFmt would override
613 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
615 @see #i24291# for examples
617 void ClearOverridesFromSet(const SwFmtCharFmt
&rFmt
, SfxItemSet
&rSet
);
619 /** Get the Floating elements in a SwDoc
621 Writer's FrmFmts may or may not be anchored to some text content,
622 e.g. Page Anchored elements will not be. For the winword export we
623 need them to have something to be anchored to. So this method
624 returns all the floating elements in a document as a STL container
625 of sw::Frames which are guaranteed to have an appropriate anchor.
628 The SwDoc document to get the styles from
631 The SwPam to describe the selection in the document to get the
632 elements from. 0 means the entire document.
634 @return A Frames containing the selections Floating elements
637 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
639 Frames
GetFrames(const SwDoc
&rDoc
, SwPaM
*pPaM
= 0);
641 /** Get the Frames anchored to a given node
643 Given a container of frames, find the ones anchored to a given node
646 The container of frames to search in
649 The SwNode to check for anchors to
651 @return the Frames in rFrames anchored to rNode
654 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
656 Frames
GetFramesInNode(const Frames
&rFrames
, const SwNode
&rNode
);
658 /** Get the Numbering Format used on a paragraph
660 There are two differing types of numbering formats that may be on a
661 paragraph, normal and outline. The outline is that numbering you
662 see in tools->outline numbering. Theres no difference in the
663 numbering itself, just how you get it from the SwTxtNode. Needless
664 to say the filter generally couldn't care less what type of
668 The SwTxtNode that is the paragraph
670 @return A SwNumFmt pointer that describes the numbering level
671 on this paragraph, or 0 if there is none.
674 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
676 const SwNumFmt
* GetNumFmtFromTxtNode(const SwTxtNode
&rTxtNode
);
678 /** Get the Numbering Format for a given level from a numbering rule
686 @return A SwNumFmt pointer that describes the numbering level
687 or 0 if the nLevel is out of range
690 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
692 const SwNumFmt
* GetNumFmtFromSwNumRuleLevel(const SwNumRule
&rRule
,
695 const SwNumRule
* GetNumRuleFromTxtNode(const SwTxtNode
&rTxtNd
);
696 const SwNumRule
* GetNormalNumRuleFromTxtNode(const SwTxtNode
&rTxtNd
);
698 /** Get the SwNoTxtNode associated with a SwFrmFmt if here is one
700 There are two differing types of numbering formats that may be on a
701 paragraph, normal and outline. The outline is that numbering you
702 see in tools->outline numbering. Theres no difference in the
703 numbering itself, just how you get it from the SwTxtNode. Needless
704 to say the filter generally couldn't care less what type of
708 The SwFrmFmt that may describe a graphic
710 @return A SwNoTxtNode pointer that describes the graphic of this
711 frame if there is one, or 0 if there is none.
714 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
716 SwNoTxtNode
*GetNoTxtNodeFromSwFrmFmt(const SwFrmFmt
&rFmt
);
718 /** Does a node have a "page break before" applied
720 Both text nodes and tables in writer can have "page break before"
721 This function gives a unified view to both entities
724 The SwNode to query the page break of
726 @return true if there is a page break, false otherwise
729 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
731 bool HasPageBreak(const SwNode
&rNode
);
734 /** Make a best fit Polygon from a PolyPolygon
736 For custom contours in writer we use a PolyPolygon, while word uses
737 a simple polygon, so we need to try and make the best polygon from
741 The PolyPolygon to try and turn into a Polygon
743 @return best fit Polygon from rPolyPoly
746 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
748 Polygon
PolygonFromPolyPolygon(const PolyPolygon
&rPolyPoly
);
750 /** Determine if the font is the special Star|Open Symbol font
753 The FontName to test for being Star|Open Symbol
755 @return true if this is Star|Open Symbol
758 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
760 bool IsStarSymbol(const OUString
&rFontName
);
762 /** Make setting a drawing object's layer in a Writer document easy
765 Word has the simple concept of a drawing object either in the
766 foreground and in the background. We have an additional complexity
767 that form components live in a separate layer, which seems
768 unnecessarily complicated. So in the winword filter we set the
769 object's layer through this class with either SendObjectToHell for
770 the bottom layer and SendObjectToHeaven for the top and we don't
771 worry about the odd form layer design wrinkle.
774 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
779 sal_uInt8 mnHeavenLayer
, mnHellLayer
, mnFormLayer
;
780 enum Layer
{eHeaven
, eHell
};
781 void SetObjectLayer(SdrObject
&rObject
, Layer eLayer
) const;
782 void Swap(SetLayer
&rOther
) throw();
785 /** Make Object live in the bottom drawing layer
788 The object to be set to the bottom layer
790 void SendObjectToHell(SdrObject
&rObject
) const;
792 /** Make Object lives in the top top layer
795 The object to be set to the bottom layer
797 void SendObjectToHeaven(SdrObject
&rObject
) const;
799 /** Normal constructor
802 The Writer document whose drawing layers we will be inserting
805 SetLayer(const SwDoc
&rDoc
);
807 SetLayer(const SetLayer
&rOther
) throw();
808 SetLayer
& operator=(const SetLayer
&rOther
) throw();
814 /** Map an ID valid in one SfxItemPool to its equivalent in another
816 Given a WhichId (the id that identifies a property e.g. bold) which
817 is correct in a given SfxItemPool, get the equivalent whichId in
820 This arises because the drawing layer uses the same properties as
821 writer e.g. SvxWeight, but for some reason uses different ids
822 for the same properties as writer.
825 The SfxItemPool in whose terms the Id is returned
828 The SfxItemPool in whose terms the Id is passed in
831 The Id to transform from source to dest
833 @return 0 on failure, the correct property Id on success
836 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
838 sal_uInt16
TransformWhichBetweenPools(const SfxItemPool
&rDestPool
,
839 const SfxItemPool
&rSrcPool
, sal_uInt16 nWhich
);
841 /** Map a SwDoc WhichId to the equivalent Id for a given SfxItemSet
843 Given a WhichId (the id that identifies a property e.g. bold) which
844 is correct for a Writer document, get the equivalent whichId which
845 for a given SfxItemSet.
847 This arises because the drawing layer uses the same properties as
848 writer e.g. SvxWeight, but for some reason uses different ids
849 for the same properties as writer.
851 This is effectively the same as TransformWhichBetweenPools except
852 at a slightly different layer.
855 The SfxItemSet in whose terms the Id is returned
858 The SwDoc in whose terms the Id is passed in
861 The Id to transform from writer to the SfxItemSet's domain
863 @return 0 on failure, the correct SfxItemSet Id on success
866 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
868 sal_uInt16
GetSetWhichFromSwDocWhich(const SfxItemSet
&rSet
,
869 const SwDoc
&rDoc
, sal_uInt16 nWhich
);
872 /** Make inserting an OLE object into a Writer document easy
874 The rest of Office uses SdrOle2Obj for their OLE objects, Writer
875 doesn't, which makes things a bit difficult as this is the type of
876 object that the escher import code shared by the MSOffice filters
877 produces when it imports an OLE object.
879 This utility class takes ownership of the OLE object away from a
880 SdrOle2Obj and can massage it into the condition best suited to
881 insertion into Writer.
883 If the object was not transferred into Writer then it is deleted
887 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
889 class DrawingOLEAdaptor
892 OUString msOrigPersistName
;
893 com::sun::star::uno::Reference
< com::sun::star::embed::XEmbeddedObject
> mxIPRef
;
894 SfxObjectShell
& mrPers
;
895 const Graphic
* mpGraphic
;
897 /** Take ownership of a SdrOle2Objs OLE object
900 The SdrOle2Obj whose OLE object we want to take control of
903 The SvPersist of a SwDoc (SwDoc::GetPersist()) into which we
904 may want to move the object, or remove it from if unwanted.
906 DrawingOLEAdaptor(SdrOle2Obj
&rObj
, SfxObjectShell
&rPers
);
908 /// Destructor will destroy the owned OLE object if not transferred
909 ~DrawingOLEAdaptor();
911 /** Transfer ownership of the OLE object to a document's SvPersist
913 TransferToDoc moves the object into the persist under the name
914 passed in. This name is then suitable to be used as an argument
917 The object is no longer owned by the adaptor after this call,
918 subsequent calls are an error and return false.
921 The name to store the object under in the document.
923 @return On success true is returned, otherwise false. On
924 success rName is then suitable for user with SwDoc::InsertOLE
926 bool TransferToDoc(OUString
&rName
);
928 /// No assigning allowed
929 DrawingOLEAdaptor
& operator=(const DrawingOLEAdaptor
&);
930 /// No copying allowed
931 DrawingOLEAdaptor(const DrawingOLEAdaptor
&rDoc
);
938 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */