summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authormatteocam <matteo.campanelli@gmail.com>2015-09-06 12:06:47 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2015-09-20 13:05:15 +0200
commite910e775cf9982b6e14df2630ca21026efe09d65 (patch)
treebfa1abe5431b658e144b40733fddc26afce9d247 /svx
parente59fca52399ab1f96b5bb525b56b444c5674ae6d (diff)
chained editeng: Enhance existing svx classes with chaining-related methods
Change-Id: I10829d8f07f8881af6d1a9422cbdae00e83a7ac8
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx37
-rw-r--r--svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx42
-rw-r--r--svx/source/svdraw/svdmodel.cxx27
-rw-r--r--svx/source/svdraw/svdotext.cxx206
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx194
-rw-r--r--svx/source/svdraw/textchainflow.cxx4
6 files changed, 508 insertions, 2 deletions
diff --git a/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx
index e31bac9441a8..db10e0833ff4 100644
--- a/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx
+++ b/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx
@@ -331,6 +331,43 @@ namespace drawinglayer
} // end of namespace primitive2d
} // end of namespace drawinglayer
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrChainedTextPrimitive2D : public SdrTextPrimitive2D
+ {
+ private:
+ // XXX: might have position of overflowing text
+
+ ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const SAL_OVERRIDE;
+
+ public:
+ SdrChainedTextPrimitive2D(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObjectPtrs,
+ const ::basegfx::B2DHomMatrix& rTextRangeTransform);
+
+ // get data
+ const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
+ //bool getWordWrap() const { return true; } // XXX: Hack! Should have a proper implementation//
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
+
+ // transformed clone operator
+ virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const SAL_OVERRIDE;
+
+ // provide unique ID
+ DeclPrimitive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+
#endif // INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
index 385de990fca4..ac7815dc66cc 100644
--- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
@@ -480,6 +480,48 @@ namespace drawinglayer
} // end of namespace primitive2d
} // end of namespace drawinglayer
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+
+ SdrChainedTextPrimitive2D::SdrChainedTextPrimitive2D(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObject,
+ const basegfx::B2DHomMatrix& rTextRangeTransform)
+ : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
+ maTextRangeTransform(rTextRangeTransform)
+ { }
+
+ Primitive2DSequence SdrChainedTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
+ {
+ Primitive2DSequence aRetval;
+ getSdrText()->GetObject().impDecomposeChainedTextPrimitive(aRetval, *this, aViewInformation);
+
+ return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
+ }
+
+ bool SdrChainedTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(SdrTextPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrBlockTextPrimitive2D& rCompare = (SdrBlockTextPrimitive2D&)rPrimitive;
+
+ return (getTextRangeTransform() == rCompare.getTextRangeTransform());
+ }
+
+ return false;
+ }
+
+ SdrTextPrimitive2D* SdrChainedTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
+ {
+ return new SdrChainedTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * getTextRangeTransform());
+ }
+
+ // provide unique ID
+ ImplPrimitive2DIDBlock(SdrChainedTextPrimitive2D, PRIMITIVE2D_ID_SDRCHAINEDTEXTPRIMITIVE2D)
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
namespace drawinglayer
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 5478cdc43d93..942d6239b381 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -56,6 +56,7 @@
#include <svx/svdpool.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdotext.hxx>
+#include <svx/textchain.hxx>
#include <svx/svdetc.hxx>
#include <svx/svdoutl.hxx>
#include <svx/svdoole2.hxx>
@@ -221,6 +222,15 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe
pHitTestOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *this);
ImpSetOutlinerDefaults(pHitTestOutliner, true);
+ /* Start Text Chaining related code */
+ // Initialize Chaining Outliner
+ pChainingOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, *this );
+ ImpSetOutlinerDefaults(pChainingOutliner, true);
+
+ // Make a TextChain
+ pTextChain = new TextChain;
+ /* End Text Chaining related code */
+
ImpCreateTables();
}
@@ -763,6 +773,12 @@ SdrOutliner& SdrModel::GetDrawOutliner(const SdrTextObj* pObj) const
return *pDrawOutliner;
}
+SdrOutliner& SdrModel::GetChainingOutliner(const SdrTextObj* pObj) const
+{
+ pChainingOutliner->SetTextObj(pObj);
+ return *pChainingOutliner;
+}
+
const SdrTextObj* SdrModel::GetFormattingTextObj() const
{
if (pDrawOutliner!=NULL) {
@@ -1994,6 +2010,17 @@ void SdrModel::PageListChanged()
{
}
+TextChain *SdrModel::GetTextChain() const
+{
+ return pTextChain;
+}
+
+void SdrModel::SetNextLinkInTextChain(SdrTextObj *pPrev, SdrTextObj *pNext)
+{
+ // Delegate to SdrTextObj
+ pPrev->SetNextLinkInChain(pNext);
+}
+
const SdrPage* SdrModel::GetMasterPage(sal_uInt16 nPgNum) const
{
DBG_ASSERT(nPgNum < maMaPag.size(), "SdrModel::GetMasterPage: Access out of range (!)");
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 6feb8778e41c..8fd7bc2c0ae1 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -38,6 +38,8 @@
#include <editeng/editobj.hxx>
#include <editeng/outliner.hxx>
#include <editeng/fhgtitem.hxx>
+#include <svx/textchain.hxx>
+#include <svx/textchainflow.hxx>
#include <svl/itempool.hxx>
#include <editeng/adjustitem.hxx>
#include <editeng/flditem.hxx>
@@ -102,6 +104,9 @@ SdrTextObj::SdrTextObj()
mbTextAnimationAllowed = true;
maTextEditOffset = Point(0, 0);
+ // chaining
+ mbToBeChained = false;
+
// #i25616#
mbSupportTextIndentingOnLineWidthChange = true;
mbInDownScale = false;
@@ -130,6 +135,9 @@ SdrTextObj::SdrTextObj(const Rectangle& rNewRect)
mbInDownScale = false;
maTextEditOffset = Point(0, 0);
+ // chaining
+ mbToBeChained = false;
+
// #i25616#
mbSupportTextIndentingOnLineWidthChange = true;
}
@@ -155,6 +163,9 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind)
mbInDownScale = false;
maTextEditOffset = Point(0, 0);
+ // chaining
+ mbToBeChained = false;
+
// #i25616#
mbSupportTextIndentingOnLineWidthChange = true;
}
@@ -176,6 +187,9 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect)
bDisableAutoWidthOnDragging=false;
ImpJustifyRect(maRect);
+ // chaining
+ mbToBeChained = false;
+
mbInEditMode = false;
mbTextHidden = false;
mbTextAnimationAllowed = true;
@@ -1520,6 +1534,25 @@ void SdrTextObj::ForceOutlinerParaObject()
}
}
+// chaining
+bool SdrTextObj::IsToBeChained() const
+{
+ return mbToBeChained;
+}
+
+void SdrTextObj::SetToBeChained(bool bToBeChained)
+{
+ mbToBeChained = bToBeChained;
+}
+
+TextChain *SdrTextObj::GetTextChain() const
+{
+ //if (!IsChainable())
+ // return NULL;
+
+ return pModel->GetTextChain();
+}
+
bool SdrTextObj::IsVerticalWriting() const
{
if(pEdtOutl)
@@ -1948,6 +1981,179 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
}
}
+/* Begin chaining code */
+
+// XXX: Make it a method somewhere?
+SdrObject *ImpGetObjByName(SdrObjList *pObjList, OUString aObjName)
+{
+ // scan the whole list
+ size_t nObjCount = pObjList->GetObjCount();
+ for (unsigned i = 0; i < nObjCount; i++) {
+ SdrObject *pCurObj = pObjList->GetObj(i);
+
+ if (pCurObj->GetName() == aObjName) {
+ return pCurObj;
+ }
+ }
+ // not found
+ return NULL;
+}
+
+// XXX: Make it a (private) method of SdrTextObj
+void ImpUpdateChainLinks(SdrTextObj *pTextObj, OUString aNextLinkName)
+{
+ // XXX: Current implementation constraints text boxes to be on the same page
+
+ // No next link
+ if (aNextLinkName == "") {
+ pTextObj->SetNextLinkInChain(NULL);
+ return;
+ }
+
+ SdrPage *pPage = pTextObj->GetPage();
+ assert(pPage);
+ SdrTextObj *pNextTextObj = dynamic_cast< SdrTextObj * >
+ (ImpGetObjByName(pPage, aNextLinkName));
+ if (!pNextTextObj) {
+ fprintf(stderr, "[CHAINING] Can't find object as next link.\n");
+ return;
+ }
+
+ pTextObj->SetNextLinkInChain(pNextTextObj);
+}
+
+bool SdrTextObj::IsChainable() const
+{
+ // Read it as item
+ const SfxItemSet& rSet = GetObjectItemSet();
+ OUString aNextLinkName = static_cast<const SfxStringItem&>(rSet.Get(SDRATTR_TEXT_CHAINNEXTNAME)).GetValue();
+
+ // Update links if any inconsistency is found
+ bool bNextLinkUnsetYet = (aNextLinkName != "") && !mpNextInChain;
+ bool bInconsistentNextLink = mpNextInChain && mpNextInChain->GetName() != aNextLinkName;
+ // if the link is not set despite there should be one OR if it has changed
+ if (bNextLinkUnsetYet || bInconsistentNextLink) {
+ ImpUpdateChainLinks(const_cast<SdrTextObj *>(this), aNextLinkName);
+ }
+
+ return aNextLinkName != ""; // XXX: Should we also check for GetNilChainingEvent? (see old code below)
+
+/*
+ // Check that no overflow is going on
+ if (!GetTextChain() || GetTextChain()->GetNilChainingEvent(this))
+ return false;
+*/
+}
+
+void SdrTextObj::onChainingEvent()
+{
+ if (!pEdtOutl)
+ return;
+
+ // Outliner for text transfer
+ SdrOutliner &aDrawOutliner = ImpGetDrawOutliner();
+
+ EditingTextChainFlow aTxtChainFlow(this);
+ aTxtChainFlow.CheckForFlowEvents(pEdtOutl);
+
+
+ if (aTxtChainFlow.IsOverflow()) {
+ fprintf(stderr, "[CHAINING] Overflow going on\n");
+ // One outliner is for non-overflowing text, the other for overflowing text
+ // We remove text directly from the editing outliner
+ aTxtChainFlow.ExecuteOverflow(pEdtOutl, &aDrawOutliner);
+ } else if (aTxtChainFlow.IsUnderflow()) {
+ fprintf(stderr, "[CHAINING] Underflow going on\n");
+ // underflow-induced overflow
+ aTxtChainFlow.ExecuteUnderflow(&aDrawOutliner);
+ bool bIsOverflowFromUnderflow = aTxtChainFlow.IsOverflow();
+ // handle overflow
+ if (bIsOverflowFromUnderflow) {
+ fprintf(stderr, "[CHAINING] Overflow going on (underflow induced)\n");
+ // prevents infinite loops when setting text for editing outliner
+
+
+ aTxtChainFlow.ExecuteOverflow(&aDrawOutliner, &aDrawOutliner);
+
+ }
+ }
+}
+
+SdrTextObj* SdrTextObj::GetNextLinkInChain() const
+{
+ /*
+ if (GetTextChain())
+ return GetTextChain()->GetNextLink(this);
+
+ return NULL;
+ */
+
+ return mpNextInChain;
+}
+
+void SdrTextObj::SetNextLinkInChain(SdrTextObj *pNextObj)
+{
+ // Basically a doubly linked list implementation
+
+ SdrTextObj *pOldNextObj = mpNextInChain;
+
+ // Replace next link
+ mpNextInChain = pNextObj;
+ // Deal with old next link's prev link
+ if (pOldNextObj) {
+ pOldNextObj->mpPrevInChain = NULL;
+ }
+
+ // Deal with new next link's prev link
+ if (mpNextInChain) {
+ // If there is a prev already at all and this is not already the current object
+ if (mpNextInChain->mpPrevInChain &&
+ mpNextInChain->mpPrevInChain != this)
+ mpNextInChain->mpPrevInChain->mpNextInChain = NULL;
+ mpNextInChain->mpPrevInChain = this;
+ }
+
+ // TODO: Introduce check for circular chains
+
+}
+
+SdrTextObj* SdrTextObj::GetPrevLinkInChain() const
+{
+ /*
+ if (GetTextChain())
+ return GetTextChain()->GetPrevLink(this);
+
+ return NULL;
+ */
+
+ return mpPrevInChain;
+}
+
+void SdrTextObj::SetPreventChainable()
+{
+ mbIsUnchainableClone = true;
+}
+
+bool SdrTextObj::GetPreventChainable() const
+{
+ // Prevent chaining it 1) during dragging && 2) when we are editing next link
+ return mbIsUnchainableClone || (GetNextLinkInChain() && GetNextLinkInChain()->IsInEditMode());
+}
+
+ SdrObject* SdrTextObj::getFullDragClone() const
+ {
+ SdrObject *pClone = SdrAttrObj::getFullDragClone();
+ SdrTextObj *pTextObjClone = dynamic_cast<SdrTextObj *>(pClone);
+ if (pTextObjClone != NULL) {
+ // Avoid transferring of text for chainable object during dragging
+ pTextObjClone->SetPreventChainable();
+ }
+
+ return pClone;
+ }
+
+/* End chaining code */
+
/** returns the currently active text. */
SdrText* SdrTextObj::getActiveText() const
{
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 74eebf06590d..be19e39cd965 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -22,6 +22,9 @@
#include <svx/svdoutl.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdotext.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/textchain.hxx>
+#include <svx/textchainflow.hxx>
#include <basegfx/vector/b2dvector.hxx>
#include <sdr/primitive2d/sdrtextprimitive2d.hxx>
#include <drawinglayer/primitive2d/textprimitive2d.hxx>
@@ -48,6 +51,8 @@
#include <svx/unoapi.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <editeng/outlobj.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/overflowingtxt.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
using namespace com::sun::star;
@@ -1404,5 +1409,194 @@ void SdrTextObj::impGetScrollTextTiming(drawinglayer::animation::AnimationEntryL
}
}
+void SdrTextObj::impHandleChainingEventsDuringDecomposition(SdrOutliner &rOutliner) const
+{
+ if (GetTextChain()->GetNilChainingEvent(this))
+ return;
+
+ GetTextChain()->SetNilChainingEvent(this, true);
+
+ TextChainFlow aTxtChainFlow(const_cast<SdrTextObj*>(this));
+ bool bIsOverflow;
+
+ // Some debug output
+ size_t nObjCount = pPage->GetObjCount();
+ for (unsigned i = 0; i < nObjCount; i++) {
+ SdrTextObj *pCurObj = (SdrTextObj *) pPage->GetObj(i);
+
+ if (pCurObj == this) {
+ fprintf(stderr, "Working on TextBox %d\n", i);
+ break;
+ }
+ }
+
+ aTxtChainFlow.CheckForFlowEvents(&rOutliner);
+
+ if (aTxtChainFlow.IsUnderflow() && !IsInEditMode())
+ {
+ // underflow-induced overflow
+ aTxtChainFlow.ExecuteUnderflow(&rOutliner);
+ bIsOverflow = aTxtChainFlow.IsOverflow();
+ } else {
+ // standard overflow (no underlow before)
+ bIsOverflow = aTxtChainFlow.IsOverflow();
+ }
+
+ if (bIsOverflow && !IsInEditMode()) {
+ // Initialize Chaining Outliner
+ SdrOutliner &rChainingOutl = pModel->GetChainingOutliner(this);
+ ImpInitDrawOutliner( rChainingOutl );
+ rChainingOutl.SetUpdateMode(true);
+ // We must pass the chaining outliner otherwise we would mess up decomposition
+ aTxtChainFlow.ExecuteOverflow(&rOutliner, &rChainingOutl);
+ }
+
+ GetTextChain()->SetNilChainingEvent(this, false);
+}
+
+void SdrTextObj::impDecomposeChainedTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::SdrChainedTextPrimitive2D& rSdrChainedTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const
+{
+ // decompose matrix to have position and size of text
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ rSdrChainedTextPrimitive.getTextRangeTransform().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // use B2DRange aAnchorTextRange for calculations
+ basegfx::B2DRange aAnchorTextRange(aTranslate);
+ aAnchorTextRange.expand(aTranslate + aScale);
+
+ // prepare outliner
+ const SfxItemSet& rTextItemSet = rSdrChainedTextPrimitive.getSdrText()->GetItemSet();
+ SdrOutliner& rOutliner = ImpGetDrawOutliner();
+
+ SdrTextVertAdjust eVAdj = GetTextVerticalAdjust(rTextItemSet);
+ SdrTextHorzAdjust eHAdj = GetTextHorizontalAdjust(rTextItemSet);
+ const EEControlBits nOriginalControlWord(rOutliner.GetControlWord());
+ const Size aNullSize;
+
+ // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
+ rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
+
+ rOutliner.SetControlWord(nOriginalControlWord|EEControlBits::AUTOPAGESIZE|EEControlBits::STRETCHING);
+ rOutliner.SetMinAutoPaperSize(aNullSize);
+ rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000));
+
+ // add one to rage sizes to get back to the old Rectangle and outliner measurements
+ const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1L));
+ const sal_uInt32 nAnchorTextHeight(FRound(aAnchorTextRange.getHeight() + 1L));
+
+ // Text
+ const OutlinerParaObject* pOutlinerParaObject = rSdrChainedTextPrimitive.getSdrText()->GetOutlinerParaObject();
+ OSL_ENSURE(pOutlinerParaObject, "impDecomposeBlockTextPrimitive used with no OutlinerParaObject (!)");
+
+ const bool bVerticalWritintg(pOutlinerParaObject->IsVertical());
+ const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight));
+
+ if(IsTextFrame())
+ {
+ rOutliner.SetMaxAutoPaperSize(aAnchorTextSize);
+ }
+
+ if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg)
+ {
+ rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0));
+ }
+
+ if(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg)
+ {
+ rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight));
+ }
+
+ rOutliner.SetPaperSize(aNullSize);
+ rOutliner.SetUpdateMode(true);
+ // Sets original text
+ rOutliner.SetText(*pOutlinerParaObject);
+
+ /* Begin overflow/underflow handling */
+
+ impHandleChainingEventsDuringDecomposition(rOutliner);
+
+ /* End overflow/underflow handling */
+
+ // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
+ rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
+
+ // now get back the layouted text size from outliner
+ const Size aOutlinerTextSize(rOutliner.GetPaperSize());
+ const basegfx::B2DVector aOutlinerScale(aOutlinerTextSize.Width(), aOutlinerTextSize.Height());
+ basegfx::B2DVector aAdjustTranslate(0.0, 0.0);
+
+ // correct horizontal translation using the now known text size
+ if(SDRTEXTHORZADJUST_CENTER == eHAdj || SDRTEXTHORZADJUST_RIGHT == eHAdj)
+ {
+ const double fFree(aAnchorTextRange.getWidth() - aOutlinerScale.getX());
+
+ if(SDRTEXTHORZADJUST_CENTER == eHAdj)
+ {
+ aAdjustTranslate.setX(fFree / 2.0);
+ }
+
+ if(SDRTEXTHORZADJUST_RIGHT == eHAdj)
+ {
+ aAdjustTranslate.setX(fFree);
+ }
+ }
+
+ // correct vertical translation using the now known text size
+ if(SDRTEXTVERTADJUST_CENTER == eVAdj || SDRTEXTVERTADJUST_BOTTOM == eVAdj)
+ {
+ const double fFree(aAnchorTextRange.getHeight() - aOutlinerScale.getY());
+
+ if(SDRTEXTVERTADJUST_CENTER == eVAdj)
+ {
+ aAdjustTranslate.setY(fFree / 2.0);
+ }
+
+ if(SDRTEXTVERTADJUST_BOTTOM == eVAdj)
+ {
+ aAdjustTranslate.setY(fFree);
+ }
+ }
+
+ // prepare matrices to apply to newly created primitives. aNewTransformA
+ // will get coordinates in aOutlinerScale size and positive in X, Y.
+ basegfx::B2DHomMatrix aNewTransformA;
+ basegfx::B2DHomMatrix aNewTransformB;
+
+ // translate relative to given primitive to get same rotation and shear
+ // as the master shape we are working on. For vertical, use the top-right
+ // corner
+ const double fStartInX(bVerticalWritintg ? aAdjustTranslate.getX() + aOutlinerScale.getX() : aAdjustTranslate.getX());
+ aNewTransformA.translate(fStartInX, aAdjustTranslate.getY());
+
+ // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y,
+ // move the null point which was top left to bottom right.
+ const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
+ const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0));
+ aNewTransformB.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0);
+
+ // in-between the translations of the single primitives will take place. Afterwards,
+ // the object's transformations need to be applied
+ aNewTransformB.shearX(fShearX);
+ aNewTransformB.rotate(fRotate);
+ aNewTransformB.translate(aTranslate.getX(), aTranslate.getY());
+
+ basegfx::B2DRange aClipRange;
+
+ // now break up text primitives.
+ impTextBreakupHandler aConverter(rOutliner);
+ aConverter.decomposeBlockTextPrimitive(aNewTransformA, aNewTransformB, aClipRange);
+
+ // cleanup outliner
+ rOutliner.Clear();
+ rOutliner.setVisualizedPage(0);
+ rOutliner.SetControlWord(nOriginalControlWord);
+
+ rTarget = aConverter.getPrimitive2DSequence();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 922cfb3756af..3286b86c3564 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -170,14 +170,14 @@ void TextChainFlow::ExecuteUnderflow(SdrOutliner *pOutl)
mpNextLink->NbcSetOutlinerParaObject(pOutl->GetEmptyParaObject());
// We store the size since NbcSetOutlinerParaObject can change it
- Size aOldSize = pOutl->GetMaxAutoPaperSize();
+ //Size aOldSize = pOutl->GetMaxAutoPaperSize();
// This should not be done in editing mode!! //XXX
if (!mpTargetLink->IsInEditMode())
mpTargetLink->NbcSetOutlinerParaObject(pNewText);
// Restore size and set new text
- //pOutl->SetMaxAutoPaperSize(aOldSize); // XXX
+ //pOutl->SetMaxAutoPaperSize(aOldSize); // XXX (it seems to be working anyway without this)
pOutl->SetText(*pNewText);
//GetTextChain()->SetNilChainingEvent(mpTargetLink, false);