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: writerhelper.hxx,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 ************************************************************************/
30 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
33 #ifndef SW_WRITERHELPER
34 #define SW_WRITERHELPER
39 #include <com/sun/star/embed/XEmbeddedObject.hpp>
41 #include <sfx2/objsh.hxx>
43 #include <svtools/itempool.hxx> //SfxItemPool
44 #include <svtools/itemset.hxx> //SfxItemSet
45 #include <format.hxx> //SwFmt
46 #include <node.hxx> //SwCntntNode
47 #include <pam.hxx> //SwPaM
48 #include <tools/poly.hxx> //Polygon, PolyPolygon
49 #include <doc.hxx> //SwDoc
51 //Uncomment to dump debugging streams of graphics
52 #if OSL_DEBUG_LEVEL > 1
60 class OutlinerParaObject
;
75 : public std::binary_function
<sal_uInt16
, sal_uInt16
, bool>
78 bool operator()(sal_uInt16 nA
, sal_uInt16 nB
) const;
85 /// STL container of Paragraph Styles (SwTxtFmtColl)
86 typedef std::vector
<SwTxtFmtColl
*> ParaStyles
;
87 /// STL iterator for ParaStyles
88 typedef ParaStyles::iterator ParaStyleIter
;
89 /// STL container of SfxPoolItems (Attributes)
90 typedef std::map
<sal_uInt16
, const SfxPoolItem
*, sw::util::ItemSort
> PoolItems
;
91 /// STL const iterator for ParaStyles
92 typedef PoolItems::const_iterator cPoolItemIter
;
95 /** Make exporting a Writer Frame easy
97 In word all frames are effectively anchored to character or as
98 character. This is nice and simple, writer is massively complex in this
99 area, so this sw::Frame simplies matters by providing a single unified
100 view of the multitute of elements in writer and their differing quirks.
102 A sw::Frame wraps a writer frame and is guaranted to have a suitable
103 anchor position available from it. It hides much of the needless
104 complexity of the multitude of floating/inline elements in writer, it...
106 Guarantees an anchor position for a frame.
107 Provides a readable way to see if we are anchored inline. (as character)
108 Provides a simple way to flag what type of entity this frame describes.
109 Provides the size of the element as drawn by writer.
112 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
117 enum WriterSource
{eTxtBox
, eGraphic
, eOle
, eDrawing
, eFormControl
};
119 const SwFrmFmt
* mpFlyFrm
;
122 // --> OD 2007-04-19 #i43447#
123 // Size of the frame in the layout.
124 // Especially needed for graphics, whose layout size can differ from its
125 // size, because it is scaled into its environment.
128 WriterSource meWriterType
;
129 const SwNode
*mpStartFrameContent
;
132 Frame(const SwFrmFmt
&rFlyFrm
, const SwPosition
&rPos
);
134 /** Get the writer SwFrmFmt that this object describes
139 const SwFrmFmt
&GetFrmFmt() const { return *mpFlyFrm
; }
141 /** Get the position this frame is anchored at
144 The anchor position of this frame
146 const SwPosition
&GetPosition() const { return maPos
; }
148 /** Get the node this frame is anchored into
151 The SwTxtNode this frame is anchored inside
153 const SwCntntNode
*GetCntntNode() const
154 { return maPos
.nNode
.GetNode().GetCntntNode(); }
156 /** Get the type of frame that this wraps
159 a WriterSource which describes the source type of this wrapper
161 WriterSource
GetWriterType() const { return meWriterType
; }
163 /** Is this frame inline (as character)
166 whether this is inline or not
168 bool IsInline() const;
171 /** Even if the frame isn't an inline frame, force it to behave as one
173 There are a variety of circumstances where word cannot have
174 anything except inline elements, e.g. inside frames. So its easier
175 to force this sw::Frame into behaving as one, instead of special
176 casing export code all over the place.
179 void ForceTreatAsInline();
181 /** Get the first node of content in the frame
184 the first node of content in the frame, might not be any at all.
186 const SwNode
*GetContent() const { return mpStartFrameContent
; }
189 /** Does this sw::Frame refer to the same writer content as another
192 if the two sw::Frames are handling the same writer frame
194 bool RefersToSameFrameAs(const Frame
&rOther
) const
196 return (mpFlyFrm
== rOther
.mpFlyFrm
);
199 /** The Size of the contained element
202 the best size to use to export to word
204 const Size
GetSize() const { return maSize
; }
206 /** The layout size of the contained element
208 OD 2007-04-19 #i43447#
209 Needed for graphics, which are scaled into its environment
213 const Size
GetLayoutSize() const
219 /// STL container of Frames
220 typedef std::vector
<Frame
> Frames
;
221 /// STL iterator for Frames
222 typedef std::vector
<Frame
>::iterator FrameIter
;
229 /** Provide a dynamic_cast style cast for SfxPoolItems
231 A SfxPoolItem generally need to be cast back to its original type
232 to be useful, which is both tedious and errorprone. So item_cast is
233 a helper template to aid the process and test if the cast is
237 The SfxPoolItem which is to be casted
240 A SfxPoolItem derived class to cast rItem to
242 @return A rItem upcasted back to a T
244 @exception std::bad_cast Thrown if the rItem was not a T
247 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
249 template<class T
> const T
& item_cast(const SfxPoolItem
&rItem
)
252 if (!rItem
.IsA(STATICTYPE(T
)))
253 throw std::bad_cast();
254 return static_cast<const T
&>(rItem
);
257 /** Provide a dynamic_cast style cast for SfxPoolItems
259 A SfxPoolItem generally need to be cast back to its original type
260 to be useful, which is both tedious and errorprone. So item_cast is
261 a helper template to aid the process and test if the cast is
265 The SfxPoolItem which is to be casted
268 A SfxPoolItem derived class to cast pItem to
270 @return A pItem upcasted back to a T or 0 if pItem was not a T
273 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
275 template<class T
> const T
* item_cast(const SfxPoolItem
*pItem
)
277 if (pItem
&& !pItem
->IsA(STATICTYPE(T
)))
279 return static_cast<const T
*>(pItem
);
282 /** Extract a SfxPoolItem derived property from a SwCntntNode
284 Writer's attributes are retrieved by passing a numeric identifier
285 and receiving a SfxPoolItem reference which must then typically be
286 cast back to its original type which is both tedious and verbose.
288 ItemGet uses item_cast () on the retrived reference to test that the
289 retrived property is of the type that the developer thinks it is.
292 The SwCntntNode to retrieve the property from
295 The numeric identifier of the property to be retrieved
298 A SfxPoolItem derived class of the retrieved property
300 @exception std::bad_cast Thrown if the property was not a T
302 @return The T requested
305 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
307 template<class T
> const T
& ItemGet(const SwCntntNode
&rNode
,
308 sal_uInt16 eType
) throw(std::bad_cast
)
310 return item_cast
<T
>(rNode
.GetAttr(eType
));
313 /** Extract a SfxPoolItem derived property from a SwFmt
315 Writer's attributes are retrieved by passing a numeric identifier
316 and receiving a SfxPoolItem reference which must then typically be
317 cast back to its original type which is both tedious and verbose.
319 ItemGet uses item_cast () on the retrived reference to test that the
320 retrived property is of the type that the developer thinks it is.
323 The SwFmt to retrieve the property from
326 The numeric identifier of the property to be retrieved
329 A SfxPoolItem derived class of the retrieved property
331 @exception std::bad_cast Thrown if the property was not a T
334 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
336 template<class T
> const T
& ItemGet(const SwFmt
&rFmt
,
337 sal_uInt16 eType
) throw(std::bad_cast
)
339 return item_cast
<T
>(rFmt
.GetFmtAttr(eType
));
342 /** Extract a SfxPoolItem derived property from a SfxItemSet
344 Writer's attributes are retrieved by passing a numeric identifier
345 and receiving a SfxPoolItem reference which must then typically be
346 cast back to its original type which is both tedious and verbose.
348 ItemGet uses item_cast () on the retrived reference to test that the
349 retrived property is of the type that the developer thinks it is.
352 The SfxItemSet to retrieve the property from
355 The numeric identifier of the property to be retrieved
358 A SfxPoolItem derived class of the retrieved property
360 @exception std::bad_cast Thrown if the property was not a T
362 @return The T requested
365 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
367 template<class T
> const T
& ItemGet(const SfxItemSet
&rSet
,
368 sal_uInt16 eType
) throw(std::bad_cast
)
370 return item_cast
<T
>(rSet
.Get(eType
));
373 /** Extract a default SfxPoolItem derived property from a SfxItemPool
375 Writer's attributes are retrieved by passing a numeric identifier
376 and receiving a SfxPoolItem reference which must then typically be
377 cast back to its original type which is both tedious and verbose.
379 DefaultItemGet returns a reference to the default property of a
380 given SfxItemPool for a given property id, e.g. default fontsize
382 DefaultItemGet uses item_cast () on the retrived reference to test
383 that the retrived property is of the type that the developer thinks
387 The SfxItemPool whose default property we want
390 The numeric identifier of the default property to be retrieved
393 A SfxPoolItem derived class of the retrieved property
395 @exception std::bad_cast Thrown if the property was not a T
397 @return The T requested
400 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
402 template<class T
> const T
& DefaultItemGet(const SfxItemPool
&rPool
,
403 sal_uInt16 eType
) throw(std::bad_cast
)
405 return item_cast
<T
>(rPool
.GetDefaultItem(eType
));
408 /** Extract a default SfxPoolItem derived property from a SwDoc
410 Writer's attributes are retrieved by passing a numeric identifier
411 and receiving a SfxPoolItem reference which must then typically be
412 cast back to its original type which is both tedious and verbose.
414 DefaultItemGet returns a reference to the default property of a
415 given SwDoc (Writer Document) for a given property id, e.g default
418 DefaultItemGet uses item_cast () on the retrived reference to test
419 that the retrived property is of the type that the developer thinks
423 The SfxItemPool whose default property we want
426 The numeric identifier of the default property to be retrieved
429 A SfxPoolItem derived class of the retrieved property
431 @exception std::bad_cast Thrown if the property was not a T
433 @return The T requested
436 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
438 template<class T
> const T
& DefaultItemGet(const SwDoc
&rDoc
,
439 sal_uInt16 eType
) throw(std::bad_cast
)
441 return DefaultItemGet
<T
>(rDoc
.GetAttrPool(), eType
);
444 /** Return a pointer to a SfxPoolItem derived class if it exists in an
447 Writer's attributes are retrieved by passing a numeric identifier
448 and receiving a SfxPoolItem reference which must then typically be
449 cast back to its original type which is both tedious and verbose.
451 HasItem returns a pointer to the requested SfxPoolItem for a given
452 property id if it exists in the SfxItemSet or its chain of parents,
455 HasItem uses item_cast () on the retrived pointer to test that the
456 retrived property is of the type that the developer thinks it is.
459 The SfxItemSet whose property we want
462 The numeric identifier of the default property to be retrieved
465 A SfxPoolItem derived class of the retrieved property
467 @return The T requested or 0 if no T found with id eType
470 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
472 template<class T
> const T
* HasItem(const SfxItemSet
&rSet
,
475 return item_cast
<T
>(rSet
.GetItem(eType
));
478 /** Return a pointer to a SfxPoolItem derived class if it exists in an
481 Writer's attributes are retrieved by passing a numeric identifier
482 and receiving a SfxPoolItem reference which must then typically be
483 cast back to its original type which is both tedious and verbose.
485 HasItem returns a pointer to the requested SfxPoolItem for a given
486 property id if it exists in the SwFmt e.g. fontsize
488 HasItem uses item_cast () on the retrived pointer to test that the
489 retrived property is of the type that the developer thinks it is.
492 The SwFmt whose property we want
495 The numeric identifier of the default property to be retrieved
498 A SfxPoolItem derived class of the retrieved property
500 @return The T requested or 0 if no T found with id eType
503 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
505 template<class T
> const T
* HasItem(const SwFmt
&rFmt
,
508 return HasItem
<T
>(rFmt
.GetAttrSet(), eType
);
511 /** Get the Paragraph Styles of a SwDoc
513 Writer's styles are in one of those dreaded macro based pre-STL
514 containers. Give me an STL container of the paragraph styles
518 The SwDoc document to get the styles from
520 @return A ParaStyles containing the SwDoc's Paragraph Styles
523 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
525 ParaStyles
GetParaStyles(const SwDoc
&rDoc
);
528 /** Get a Paragraph Style which fits a given name
530 Its surprisingly tricky to get a style when all you have is a name,
531 but that's what this does
534 The SwDoc document to search in
537 The name of the style to search for
539 @return A Paragraph Style if one exists which matches the name
542 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
544 SwTxtFmtColl
* GetParaStyle(SwDoc
&rDoc
, const String
& rName
);
546 /** Get a Character Style which fits a given name
548 Its surprisingly tricky to get a style when all you have is a name,
549 but that's what this does
552 The SwDoc document to search in
555 The name of the style to search for
557 @return A Character Style if one exists which matches the name
560 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
562 SwCharFmt
* GetCharStyle(SwDoc
&rDoc
, const String
& rName
);
564 /** Sort sequence of Paragraph Styles by assigned outline style list level
566 Sort ParaStyles in ascending order of assigned outline style list level,
567 e.g. given Normal/Heading1/Heading2/.../Heading10 at their default
568 assigned outline style list levels of body level/level 1/level 2/.../level 10
570 OD 2009-02-04 #i98791#
571 adjust the sorting algorithm due to introduced outline level attribute
574 The ParaStyles to sort
577 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
579 void SortByAssignedOutlineStyleListLevel(ParaStyles
&rStyles
);
581 /** Get the SfxPoolItems of a SfxItemSet
583 Writer's SfxPoolItems (attributes) are in one of those dreaded
584 macro based pre-STL containers. Give me an STL container of the
588 The SfxItemSet to get the items from
591 The sw::PoolItems to put the items into
594 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
596 void GetPoolItems(const SfxItemSet
&rSet
, PoolItems
&rItems
);
598 const SfxPoolItem
*SearchPoolItems(const PoolItems
&rItems
,
601 template<class T
> const T
* HasItem(const sw::PoolItems
&rItems
,
604 return item_cast
<T
>(SearchPoolItems(rItems
, eType
));
608 /** Remove properties from an SfxItemSet which a SwFmtCharFmt overrides
610 Given an SfxItemSet and a SwFmtCharFmt remove from the rSet all the
611 properties which the SwFmtCharFmt would override. An SfxItemSet
612 contains attributes, and a SwFmtCharFmt is a "Character Style",
613 so if the SfxItemSet contains bold and so does the character style
614 then delete bold from the SfxItemSet
617 rFmt the SwFmtCharFmt which describes the Character Style
620 rSet the SfxItemSet from which we want to remove any properties
621 which the rFmt would override
624 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
626 @see #i24291# for examples
628 void ClearOverridesFromSet(const SwFmtCharFmt
&rFmt
, SfxItemSet
&rSet
);
630 /** Get the Floating elements in a SwDoc
632 Writer's FrmFmts may or may not be anchored to some text content,
633 e.g. Page Anchored elements will not be. For the winword export we
634 need them to have something to be anchored to. So this method
635 returns all the floating elements in a document as a STL container
636 of sw::Frames which are guaranteed to have an appropiate anchor.
639 The SwDoc document to get the styles from
642 The SwPam to describe the selection in the document to get the
643 elements from. 0 means the entire document.
645 @return A Frames containing the selections Floating elements
648 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
650 Frames
GetFrames(const SwDoc
&rDoc
, SwPaM
*pPaM
= 0);
652 /** Get the Frames anchored to a given node
654 Given a container of frames, find the ones anchored to a given node
657 The container of frames to search in
660 The SwNode to check for anchors to
662 @return the Frames in rFrames anchored to rNode
665 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
667 Frames
GetFramesInNode(const Frames
&rFrames
, const SwNode
&rNode
);
669 /** Get the Frames anchored for all nodes between two points
671 Given a container of frames, find the ones anchored to the nodes
672 from start to end. Half open sequence, i.e. those anchored to
673 start, but not those anchored to end
676 The container of frames to search in
679 The SwNode to start check for anchors from
682 The SwNode to end check for anchors from
684 @return the Frames in rFrames anchored to rNode
687 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
689 Frames
GetFramesBetweenNodes(const Frames
&rFrames
,
690 const SwNode
&rStart
, const SwNode
&rEnd
);
692 /** Get the Numbering Format used on a paragraph
694 There are two differing types of numbering formats that may be on a
695 paragraph, normal and outline. The outline is that numbering you
696 see in tools->outline numbering. Theres no difference in the
697 numbering itself, just how you get it from the SwTxtNode. Needless
698 to say the filter generally couldn't care less what type of
702 The SwTxtNode that is the paragraph
704 @return A SwNumFmt pointer that describes the numbering level
705 on this paragraph, or 0 if there is none.
708 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
710 const SwNumFmt
* GetNumFmtFromTxtNode(const SwTxtNode
&rTxtNode
);
712 const SwNumRule
* GetNumRuleFromTxtNode(const SwTxtNode
&rTxtNd
);
713 const SwNumRule
* GetNormalNumRuleFromTxtNode(const SwTxtNode
&rTxtNd
);
716 /** Get the SwNoTxtNode associated with a SwFrmFmt if here is one
718 There are two differing types of numbering formats that may be on a
719 paragraph, normal and outline. The outline is that numbering you
720 see in tools->outline numbering. Theres no difference in the
721 numbering itself, just how you get it from the SwTxtNode. Needless
722 to say the filter generally couldn't care less what type of
726 The SwFrmFmt that may describe a graphic
728 @return A SwNoTxtNode pointer that describes the graphic of this
729 frame if there is one, or 0 if there is none.
732 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
734 SwNoTxtNode
*GetNoTxtNodeFromSwFrmFmt(const SwFrmFmt
&rFmt
);
736 /** Does a node have a "page break before" applied
738 Both text nodes and tables in writer can have "page break before"
739 This function gives a unified view to both entities
742 The SwNode to query the page break of
744 @return true if there is a page break, false otherwise
747 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
749 bool HasPageBreak(const SwNode
&rNode
);
752 /** Make a best fit Polygon from a PolyPolygon
754 For custom contours in writer we use a PolyPolygon, while word uses
755 a simple polygon, so we need to try and make the best polygon from
759 The PolyPolygon to try and turn into a Polygon
761 @return best fit Polygon from rPolyPoly
764 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
766 Polygon
PolygonFromPolyPolygon(const PolyPolygon
&rPolyPoly
);
768 /** Determine if the font is the special Star|Open Symbol font
771 The FontName to test for being Star|Open Symbol
773 @return true if this is Star|Open Symbol
776 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
778 bool IsStarSymbol(const String
&rFontName
);
780 /** Make setting a drawing object's layer in a Writer document easy
783 Word has the simple concept of a drawing object either in the
784 foreground and in the background. We have an additional complexity
785 that form components live in a seperate layer, which seems
786 unnecessarily complicated. So in the winword filter we set the
787 object's layer through this class with either SendObjectToHell for
788 the bottom layer and SendObjectToHeaven for the top and we don't
789 worry about the odd form layer design wrinkle.
792 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
797 sal_uInt8 mnHeavenLayer
, mnHellLayer
, mnFormLayer
;
798 enum Layer
{eHeaven
, eHell
};
799 void SetObjectLayer(SdrObject
&rObject
, Layer eLayer
) const;
800 void Swap(SetLayer
&rOther
) throw();
803 /** Make Object live in the bottom drawing layer
806 The object to be set to the bottom layer
808 void SendObjectToHell(SdrObject
&rObject
) const;
810 /** Make Object lives in the top top layer
813 The object to be set to the bottom layer
815 void SendObjectToHeaven(SdrObject
&rObject
) const;
817 /** Normal constructor
820 The Writer document whose drawing layers we will be inserting
823 SetLayer(const SwDoc
&rDoc
);
825 SetLayer(const SetLayer
&rOther
) throw();
826 SetLayer
& operator=(const SetLayer
&rOther
) throw();
832 /** Map an ID valid in one SfxItemPool to its equivalent in another
834 Given a WhichId (the id that identifies a property e.g. bold) which
835 is correct in a given SfxItemPool, get the equivalent whichId in
838 This arises because the drawing layer uses the same properties as
839 writer e.g. SvxWeight, but for some reason uses different ids
840 for the same properties as writer.
843 The SfxItemPool in whose terms the Id is returned
846 The SfxItemPool in whose terms the Id is passed in
849 The Id to transform from source to dest
851 @return 0 on failure, the correct property Id on success
854 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
856 USHORT
TransformWhichBetweenPools(const SfxItemPool
&rDestPool
,
857 const SfxItemPool
&rSrcPool
, USHORT nWhich
);
859 /** Map a SwDoc WhichId to the equivalent Id for a given SfxItemSet
861 Given a WhichId (the id that identifies a property e.g. bold) which
862 is correct for a Writer document, get the equivalent whichId which
863 for a given SfxItemSet.
865 This arises because the drawing layer uses the same properties as
866 writer e.g. SvxWeight, but for some reason uses different ids
867 for the same properties as writer.
869 This is effectively the same as TransformWhichBetweenPools except
870 at a slightly different layer.
873 The SfxItemSet in whose terms the Id is returned
876 The SwDoc in whose terms the Id is passed in
879 The Id to transform from writer to the SfxItemSet's domain
881 @return 0 on failure, the correct SfxItemSet Id on success
884 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
886 USHORT
GetSetWhichFromSwDocWhich(const SfxItemSet
&rSet
,
887 const SwDoc
&rDoc
, USHORT nWhich
);
890 /** Make inserting an OLE object into a Writer document easy
892 The rest of Office uses SdrOle2Obj for their OLE objects, Writer
893 doesn't, which makes things a bit difficult as this is the type of
894 object that the escher import code shared by the MSOffice filters
895 produces when it imports an OLE object.
897 This utility class takes ownership of the OLE object away from a
898 SdrOle2Obj and can massage it into the condition best suited to
899 insertion into Writer.
901 If the object was not transferred into Writer then it is deleted
905 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
907 class DrawingOLEAdaptor
910 String msOrigPersistName
;
911 com::sun::star::uno::Reference
< com::sun::star::embed::XEmbeddedObject
> mxIPRef
;
912 SfxObjectShell
& mrPers
;
915 /** Take ownership of a SdrOle2Objs OLE object
918 The SdrOle2Obj whose OLE object we want to take control of
921 The SvPersist of a SwDoc (SwDoc::GetPersist()) into which we
922 may want to move the object, or remove it from if unwanted.
924 DrawingOLEAdaptor(SdrOle2Obj
&rObj
, SfxObjectShell
&rPers
);
926 /// Destructor will destroy the owned OLE object if not transferred
927 ~DrawingOLEAdaptor();
929 /** Transfer ownership of the OLE object to a document's SvPersist
931 TransferToDoc moves the object into the persist under the name
932 passed in. This name is then suitable to be used as an argument
935 The object is no longer owned by the adaptor after this call,
936 subsequent calls are an error and return false.
939 The name to store the object under in the document.
941 @return On success true is returned, otherwise false. On
942 success rName is then suitable for user with SwDoc::InsertOLE
944 bool TransferToDoc(::rtl::OUString
&rName
);
946 /// No assigning allowed
947 DrawingOLEAdaptor
& operator=(const DrawingOLEAdaptor
&);
948 /// No copying allowed
949 DrawingOLEAdaptor(const DrawingOLEAdaptor
&rDoc
);
953 /** Create a SvStream to dump data to during debugging
955 This creates a file in the program dir of OOo, delete the SvStream
956 after you are done with it
959 The suffix that will be appened to this debugging file
961 @return a SvStream to dump data to
964 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
966 SvStream
*CreateDebuggingStream(const String
&rSuffix
);
968 /** Dump one SvStream to another
974 The destination stream
977 Optional Length of data to copy from rSrc to rDest, if unused copy
978 all available data from rSrc
981 <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
983 void DumpStream(const SvStream
&rSrc
, SvStream
&rDest
,
984 sal_uInt32 nLen
= STREAM_SEEK_TO_END
);
990 /* vi:set tabstop=4 shiftwidth=4 expandtab: */