summaryrefslogtreecommitdiff
path: root/sw/inc/textboxhelper.hxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-13 09:29:12 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-13 10:58:17 +0200
commit02f2d886c897a286b875f9053052061fe0b357fd (patch)
treebca0958a8ee192f9e1563fdfdf57bd9bf629d9cb /sw/inc/textboxhelper.hxx
parent11c94c170500e0bc147ff512789130c770843b1e (diff)
SwDoc::CopyFlyInFlyImpl: factor out textbox code into SwTextBoxHelper
Also, let the new SwTextBoxHelper::restoreLinks() restore also the RES_CNTNT of the *old* draw formats, not only the link between the new draw and fly formats. This allows properly preserving the link between draw and fly formats, when they are in the header (and so copied in and out variously). Change-Id: I101ff06533e2ea27abea8bed171ed69c9649ebe8
Diffstat (limited to 'sw/inc/textboxhelper.hxx')
-rw-r--r--sw/inc/textboxhelper.hxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index 2bb791f31c0d..50024e14c086 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -11,6 +11,9 @@
#define INCLUDED_SW_INC_TEXTBOXHELPER_HXX
#include <list>
+#include <map>
+#include <set>
+#include <vector>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/uno/Any.h>
@@ -21,8 +24,11 @@
class SdrPage;
class SwFrmFmt;
+class SwFrmFmts;
+class SwFmtCntnt;
class SwDoc;
class Rectangle;
+class _ZSortFly;
/**
* A TextBox is a TextFrame, that is tied to a drawinglayer shape.
@@ -33,6 +39,10 @@ class Rectangle;
class SW_DLLPUBLIC SwTextBoxHelper
{
public:
+ /// Maps a draw format to a fly format.
+ typedef std::map<const SwFrmFmt*, const SwFrmFmt*> SavedLink;
+ /// Maps a draw format to content.
+ typedef std::map<const SwFrmFmt*, SwFmtCntnt> SavedContent;
/// Create a TextBox for a shape.
static void create(SwFrmFmt* pShape);
/// Destroy a TextBox for a shape.
@@ -57,6 +67,13 @@ public:
static sal_Int32 getCount(SdrPage* pPage, std::list<SwFrmFmt*>& rTextBoxes);
/// Get a shape by index, excluding TextBoxes.
static css::uno::Any getByIndex(SdrPage* pPage, sal_Int32 nIndex, std::list<SwFrmFmt*>& rTextBoxes) throw(css::lang::IndexOutOfBoundsException);
+
+ /// Saves the current shape -> textbox links in a map, so they can be restored later.
+ static void saveLinks(const SwFrmFmts& rFormats, std::map<const SwFrmFmt*, const SwFrmFmt*>& rLinks);
+ /// Reset the shape -> textbox link on the shape, and save it to the map, so it can be restored later.
+ static void resetLink(SwFrmFmt* pShape, std::map<const SwFrmFmt*, SwFmtCntnt>& rOldContent);
+ /// Undo the effect of saveLinks() + individual resetLink() calls.
+ static void restoreLinks(std::set<_ZSortFly>& rOld, std::vector<SwFrmFmt*>& rNew, SavedLink& rSavedLinks, SavedContent& rResetContent);
};
#endif // INCLUDED_SW_INC_TEXTBOXHELPER_HXX