solenv/clang-format/blacklist        |    2 
 sw/inc/textboxhelper.hxx             |   21 +
 sw/source/core/doc/textboxhelper.cxx |  420 ++++++++++++++++++-----------------
 3 files changed, 239 insertions(+), 204 deletions(-)

New commits:
commit 4d35ac2f063f09efa0503303ef7c99b2e829ed14
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Wed Feb 21 17:31:56 2018 +0100

    sw: clang-format textboxhelper
    
    This was more or less consistent before, but the recent automatic
    rewrites broke consistency, just give up on manual formatting here.
    
    Change-Id: Ieb387e3d7230d227e33ba0b420cfa572309c5330
    Reviewed-on: https://gerrit.libreoffice.org/50119
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 198294203d73..654166228374 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -15126,7 +15126,6 @@ sw/inc/tabcol.hxx
 sw/inc/tblafmt.hxx
 sw/inc/tblenum.hxx
 sw/inc/tblsel.hxx
-sw/inc/textboxhelper.hxx
 sw/inc/tgrditem.hxx
 sw/inc/tox.hxx
 sw/inc/toxe.hxx
@@ -15375,7 +15374,6 @@ sw/source/core/doc/swstylemanager.hxx
 sw/source/core/doc/tblafmt.cxx
 sw/source/core/doc/tblcpy.cxx
 sw/source/core/doc/tblrwcl.cxx
-sw/source/core/doc/textboxhelper.cxx
 sw/source/core/doc/visiturl.cxx
 sw/source/core/docnode/cancellablejob.cxx
 sw/source/core/docnode/cancellablejob.hxx
diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index 29e8ea6fd6a5..4e94e9b94e39 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -55,11 +55,14 @@ public:
     static css::uno::Any queryInterface(SwFrameFormat* pShape, const 
css::uno::Type& rType);
 
     /// Sync property of TextBox with the one of the shape.
-    static void syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_uInt8 
nMemberID, const css::uno::Any& rValue);
+    static void syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_uInt8 
nMemberID,
+                             const css::uno::Any& rValue);
     /// Does the same, but works on properties which lack an sw-specific WID / 
MemberID.
-    static void syncProperty(SwFrameFormat* pShape, const OUString& 
rPropertyName, const css::uno::Any& rValue);
+    static void syncProperty(SwFrameFormat* pShape, const OUString& 
rPropertyName,
+                             const css::uno::Any& rValue);
     /// Get a property of the underlying TextFrame.
-    static void getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID, 
sal_uInt8 nMemberID, css::uno::Any& rValue);
+    static void getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID, 
sal_uInt8 nMemberID,
+                            css::uno::Any& rValue);
 
     /// Similar to syncProperty(), but used by the internal API (e.g. for UI 
purposes).
     static void syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const& 
rSet);
@@ -74,7 +77,8 @@ public:
      */
     static SwFrameFormat* getOtherTextBoxFormat(const SwFrameFormat* pFormat, 
sal_uInt16 nType);
     /// If we have an associated TextFrame, then return that.
-    static SwFrameFormat* 
getOtherTextBoxFormat(css::uno::Reference<css::drawing::XShape> const& xShape);
+    static SwFrameFormat*
+    getOtherTextBoxFormat(css::uno::Reference<css::drawing::XShape> const& 
xShape);
     /// Return the textbox rectangle of a draw shape (in twips).
     static tools::Rectangle getTextRectangle(SwFrameFormat* pShape, bool 
bAbsolute = true);
 
@@ -103,11 +107,14 @@ public:
     static void getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& 
rWrapThrough);
 
     /// Saves the current shape -> textbox links in a map, so they can be 
restored later.
-    static void saveLinks(const SwFrameFormats& rFormats, std::map<const 
SwFrameFormat*, const SwFrameFormat*>& rLinks);
+    static void saveLinks(const SwFrameFormats& rFormats,
+                          std::map<const SwFrameFormat*, const 
SwFrameFormat*>& rLinks);
     /// Reset the shape -> textbox link on the shape, and save it to the map, 
so it can be restored later.
-    static void resetLink(SwFrameFormat* pShape, std::map<const 
SwFrameFormat*, SwFormatContent>& rOldContent);
+    static void resetLink(SwFrameFormat* pShape,
+                          std::map<const SwFrameFormat*, SwFormatContent>& 
rOldContent);
     /// Undo the effect of saveLinks() + individual resetLink() calls.
-    static void restoreLinks(std::set<ZSortFly>& rOld, 
std::vector<SwFrameFormat*>& rNew, SavedLink& rSavedLinks, SavedContent& 
rResetContent);
+    static void restoreLinks(std::set<ZSortFly>& rOld, 
std::vector<SwFrameFormat*>& rNew,
+                             SavedLink& rSavedLinks, SavedContent& 
rResetContent);
 };
 
 #endif // INCLUDED_SW_INC_TEXTBOXHELPER_HXX
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index ccfb7b4d5f53..3377220d98fd 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -52,9 +52,13 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape)
         return;
 
     // Create the associated TextFrame and insert it into the document.
-    uno::Reference<text::XTextContent> 
xTextFrame(SwXServiceProvider::MakeInstance(SwServiceType::TypeTextFrame, 
*pShape->GetDoc()), uno::UNO_QUERY);
-    uno::Reference<text::XTextDocument> 
xTextDocument(pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
-    uno::Reference<text::XTextContentAppend> 
xTextContentAppend(xTextDocument->getText(), uno::UNO_QUERY);
+    uno::Reference<text::XTextContent> xTextFrame(
+        SwXServiceProvider::MakeInstance(SwServiceType::TypeTextFrame, 
*pShape->GetDoc()),
+        uno::UNO_QUERY);
+    uno::Reference<text::XTextDocument> xTextDocument(
+        pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
+    uno::Reference<text::XTextContentAppend> 
xTextContentAppend(xTextDocument->getText(),
+                                                                
uno::UNO_QUERY);
     xTextContentAppend->appendTextContent(xTextFrame, 
uno::Sequence<beans::PropertyValue>());
 
     // Link FLY and DRAW formats, so it becomes a text box (needed for 
syncProperty calls).
@@ -96,19 +100,27 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape)
     }
 
     // Also initialize the properties, which are not constant, but inherited 
from the shape's ones.
-    uno::Reference<drawing::XShape> 
xShape(pShape->FindRealSdrObject()->getUnoShape(), uno::UNO_QUERY);
+    uno::Reference<drawing::XShape> 
xShape(pShape->FindRealSdrObject()->getUnoShape(),
+                                           uno::UNO_QUERY);
     syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, 
uno::makeAny(xShape->getSize()));
 
     uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, 
uno::UNO_QUERY);
-    syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, 
xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT));
-    syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_RELATION, 
xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_RELATION));
-    syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, 
xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT));
-    syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_RELATION, 
xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION));
-    syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION, 
xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION));
-    syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, 
xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION));
-    syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT, 
xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT));
-    syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0, 
xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_VERT_ADJUST));
-
+    syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_ORIENT,
+                 xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT));
+    syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_RELATION,
+                 
xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_RELATION));
+    syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_ORIENT,
+                 xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT));
+    syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_RELATION,
+                 
xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION));
+    syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION,
+                 
xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION));
+    syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION,
+                 
xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION));
+    syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT,
+                 
xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT));
+    syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0,
+                 
xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_VERT_ADJUST));
 }
 
 void SwTextBoxHelper::destroy(SwFrameFormat* pShape)
@@ -133,7 +145,8 @@ bool SwTextBoxHelper::isTextBox(const SwFrameFormat* 
pFormat, sal_uInt16 nType)
     if (!pFormat || pFormat->Which() != nType || 
!pFormat->GetAttrSet().HasItem(RES_CNTNT))
         return false;
 
-    sal_uInt16 nOtherType = (pFormat->Which() == RES_FLYFRMFMT) ? 
sal_uInt16(RES_DRAWFRMFMT) : sal_uInt16(RES_FLYFRMFMT);
+    sal_uInt16 nOtherType = (pFormat->Which() == RES_FLYFRMFMT) ? 
sal_uInt16(RES_DRAWFRMFMT)
+                                                                : 
sal_uInt16(RES_FLYFRMFMT);
     SwFrameFormat* pOtherFormat = pFormat->GetOtherTextBoxFormat();
     if (!pOtherFormat)
         return false;
@@ -224,7 +237,8 @@ void SwTextBoxHelper::getShapeWrapThrough(const 
SwFrameFormat* pTextBox, bool& r
         rWrapThrough = pShape->GetSurround().GetSurround() == 
css::text::WrapTextMode_THROUGH;
 }
 
-SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(const SwFrameFormat* 
pFormat, sal_uInt16 nType)
+SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(const SwFrameFormat* 
pFormat,
+                                                      sal_uInt16 nType)
 {
     if (!isTextBox(pFormat, nType))
         return nullptr;
@@ -241,14 +255,12 @@ SwFrameFormat* 
SwTextBoxHelper::getOtherTextBoxFormat(uno::Reference<drawing::XS
     return getOtherTextBoxFormat(pFormat, RES_DRAWFRMFMT);
 }
 
-template < typename T >
-void lcl_queryInterface(SwFrameFormat* pShape, uno::Any& rAny)
+template <typename T> void lcl_queryInterface(SwFrameFormat* pShape, uno::Any& 
rAny)
 {
     if (SwFrameFormat* pFormat = 
SwTextBoxHelper::getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT))
     {
         uno::Reference<T> const xInterface(
-            SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat),
-            uno::UNO_QUERY);
+            SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat), 
uno::UNO_QUERY);
         rAny <<= xInterface;
     }
 }
@@ -270,7 +282,6 @@ uno::Any SwTextBoxHelper::queryInterface(SwFrameFormat* 
pShape, const uno::Type&
         lcl_queryInterface<text::XTextRange>(pShape, aRet);
     }
 
-
     return aRet;
 }
 
@@ -284,7 +295,8 @@ tools::Rectangle 
SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool b
         // Need to temporarily release the lock acquired in
         // SdXMLShapeContext::AddShape(), otherwise we get an empty rectangle,
         // see EnhancedCustomShapeEngine::getTextBounds().
-        uno::Reference<document::XActionLockable> 
xLockable(pCustomShape->getUnoShape(), uno::UNO_QUERY);
+        uno::Reference<document::XActionLockable> 
xLockable(pCustomShape->getUnoShape(),
+                                                            uno::UNO_QUERY);
         sal_Int16 nLocks = 0;
         if (xLockable.is())
             nLocks = xLockable->resetActionLocks();
@@ -298,8 +310,8 @@ tools::Rectangle 
SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool b
         // Relative, so count the logic (reference) rectangle, see the 
EnhancedCustomShape2d ctor.
         Point aPoint(pCustomShape->GetSnapRect().Center());
         Size aSize(pCustomShape->GetLogicRect().GetSize());
-        aPoint.AdjustX( -(aSize.Width() / 2) );
-        aPoint.AdjustY( -(aSize.Height() / 2) );
+        aPoint.AdjustX(-(aSize.Width() / 2));
+        aPoint.AdjustY(-(aSize.Height() / 2));
         tools::Rectangle aLogicRect(aPoint, aSize);
         aRet.Move(-1 * aLogicRect.Left(), -1 * aLogicRect.Top());
     }
@@ -307,7 +319,8 @@ tools::Rectangle 
SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool b
     return aRet;
 }
 
-void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& 
rPropertyName, const css::uno::Any& rValue)
+void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& 
rPropertyName,
+                                   const css::uno::Any& rValue)
 {
     if (rPropertyName == "CustomShapeGeometry")
     {
@@ -318,26 +331,35 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, 
const OUString& rPrope
         if (pObject)
         {
             tools::Rectangle aRectangle(pObject->GetSnapRect());
-            syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION, 
uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Left()))));
-            syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, 
uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Top()))));
+            syncProperty(
+                pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION,
+                
uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Left()))));
+            syncProperty(
+                pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION,
+                
uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Top()))));
         }
 
         if (SwFrameFormat* pFormat = getOtherTextBoxFormat(pShape, 
RES_DRAWFRMFMT))
         {
             comphelper::SequenceAsHashMap aCustomShapeGeometry(rValue);
             // That would be the btLr text direction which we don't support at 
a frame level, so do it at a character level.
-            if (aCustomShapeGeometry.find("TextPreRotateAngle") != 
aCustomShapeGeometry.end() && 
aCustomShapeGeometry["TextPreRotateAngle"].get<sal_Int32>() == -270)
+            if (aCustomShapeGeometry.find("TextPreRotateAngle") != 
aCustomShapeGeometry.end()
+                && aCustomShapeGeometry["TextPreRotateAngle"].get<sal_Int32>() 
== -270)
             {
                 if (const SwNodeIndex* pNodeIndex = 
pFormat->GetContent().GetContentIdx())
                 {
                     SwPaM 
aPaM(*pFormat->GetDoc()->GetNodes()[pNodeIndex->GetIndex() + 1], 0);
                     aPaM.SetMark();
-                    if (SwTextNode* pMark = 
pFormat->GetDoc()->GetNodes()[pNodeIndex->GetNode().EndOfSectionIndex() - 
1]->GetTextNode())
+                    if (SwTextNode* pMark
+                        = pFormat->GetDoc()
+                              
->GetNodes()[pNodeIndex->GetNode().EndOfSectionIndex() - 1]
+                              ->GetTextNode())
                     {
                         aPaM.GetMark()->nNode = *pMark;
                         aPaM.GetMark()->nContent.Assign(pMark, 
pMark->GetText().getLength());
                         SvxCharRotateItem aItem(900, false, RES_CHRATR_ROTATE);
-                        
pFormat->GetDoc()->getIDocumentContentOperations().InsertPoolItem(aPaM, aItem);
+                        
pFormat->GetDoc()->getIDocumentContentOperations().InsertPoolItem(aPaM,
+                                                                               
           aItem);
                     }
                 }
             }
@@ -357,7 +379,8 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, 
const OUString& rPrope
         syncProperty(pShape, RES_BOX, BOTTOM_BORDER_DISTANCE, rValue);
 }
 
-void SwTextBoxHelper::getProperty(SwFrameFormat const* pShape, sal_uInt16 
nWID, sal_uInt8 nMemberID, css::uno::Any& rValue)
+void SwTextBoxHelper::getProperty(SwFrameFormat const* pShape, sal_uInt16 
nWID, sal_uInt8 nMemberID,
+                                  css::uno::Any& rValue)
 {
     if (!pShape)
         return;
@@ -370,22 +393,23 @@ void SwTextBoxHelper::getProperty(SwFrameFormat const* 
pShape, sal_uInt16 nWID,
         {
             switch (nMemberID)
             {
-            case MID_CHAIN_PREVNAME:
-            case MID_CHAIN_NEXTNAME:
-            {
-                const SwFormatChain& rChain = pFormat->GetChain();
-                rChain.QueryValue(rValue, nMemberID);
-            }
-            break;
-            case MID_CHAIN_NAME:
-                rValue <<= pFormat->GetName();
+                case MID_CHAIN_PREVNAME:
+                case MID_CHAIN_NEXTNAME:
+                {
+                    const SwFormatChain& rChain = pFormat->GetChain();
+                    rChain.QueryValue(rValue, nMemberID);
+                }
                 break;
+                case MID_CHAIN_NAME:
+                    rValue <<= pFormat->GetName();
+                    break;
             }
         }
     }
 }
 
-void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, 
sal_uInt8 nMemberID, const css::uno::Any& rValue)
+void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, 
sal_uInt8 nMemberID,
+                                   const css::uno::Any& rValue)
 {
     // No shape yet? Then nothing to do, initial properties are set by 
create().
     if (!pShape)
@@ -402,116 +426,118 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* 
pShape, sal_uInt16 nWID, sal_u
         bool bAdjustSize = false;
         switch (nWID)
         {
-        case RES_HORI_ORIENT:
-            switch (nMemberID)
-            {
-            case MID_HORIORIENT_ORIENT:
-                aPropertyName = UNO_NAME_HORI_ORIENT;
-                break;
-            case MID_HORIORIENT_RELATION:
-                aPropertyName = UNO_NAME_HORI_ORIENT_RELATION;
-                break;
-            case MID_HORIORIENT_POSITION:
-                aPropertyName = UNO_NAME_HORI_ORIENT_POSITION;
-                bAdjustX = true;
-                break;
-            }
-            break;
-        case RES_VERT_ORIENT:
-            switch (nMemberID)
-            {
-            case MID_VERTORIENT_ORIENT:
-                aPropertyName = UNO_NAME_VERT_ORIENT;
-                break;
-            case MID_VERTORIENT_RELATION:
-                aPropertyName = UNO_NAME_VERT_ORIENT_RELATION;
-                break;
-            case MID_VERTORIENT_POSITION:
-                aPropertyName = UNO_NAME_VERT_ORIENT_POSITION;
-                bAdjustY = true;
-                break;
-            }
-            break;
-        case RES_FRM_SIZE:
-            switch (nMemberID)
-            {
-            case MID_FRMSIZE_IS_AUTO_HEIGHT:
-                aPropertyName = UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT;
-                break;
-            case MID_FRMSIZE_REL_HEIGHT_RELATION:
-                aPropertyName = UNO_NAME_RELATIVE_HEIGHT_RELATION;
+            case RES_HORI_ORIENT:
+                switch (nMemberID)
+                {
+                    case MID_HORIORIENT_ORIENT:
+                        aPropertyName = UNO_NAME_HORI_ORIENT;
+                        break;
+                    case MID_HORIORIENT_RELATION:
+                        aPropertyName = UNO_NAME_HORI_ORIENT_RELATION;
+                        break;
+                    case MID_HORIORIENT_POSITION:
+                        aPropertyName = UNO_NAME_HORI_ORIENT_POSITION;
+                        bAdjustX = true;
+                        break;
+                }
                 break;
-            case MID_FRMSIZE_REL_WIDTH_RELATION:
-                aPropertyName = UNO_NAME_RELATIVE_WIDTH_RELATION;
+            case RES_VERT_ORIENT:
+                switch (nMemberID)
+                {
+                    case MID_VERTORIENT_ORIENT:
+                        aPropertyName = UNO_NAME_VERT_ORIENT;
+                        break;
+                    case MID_VERTORIENT_RELATION:
+                        aPropertyName = UNO_NAME_VERT_ORIENT_RELATION;
+                        break;
+                    case MID_VERTORIENT_POSITION:
+                        aPropertyName = UNO_NAME_VERT_ORIENT_POSITION;
+                        bAdjustY = true;
+                        break;
+                }
                 break;
-            default:
-                aPropertyName = UNO_NAME_SIZE;
-                bAdjustSize = true;
+            case RES_FRM_SIZE:
+                switch (nMemberID)
+                {
+                    case MID_FRMSIZE_IS_AUTO_HEIGHT:
+                        aPropertyName = UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT;
+                        break;
+                    case MID_FRMSIZE_REL_HEIGHT_RELATION:
+                        aPropertyName = UNO_NAME_RELATIVE_HEIGHT_RELATION;
+                        break;
+                    case MID_FRMSIZE_REL_WIDTH_RELATION:
+                        aPropertyName = UNO_NAME_RELATIVE_WIDTH_RELATION;
+                        break;
+                    default:
+                        aPropertyName = UNO_NAME_SIZE;
+                        bAdjustSize = true;
+                        break;
+                }
                 break;
-            }
-            break;
-        case RES_ANCHOR:
-            switch (nMemberID)
-            {
-            case MID_ANCHOR_ANCHORTYPE:
-                if (aValue.get<text::TextContentAnchorType>() == 
text::TextContentAnchorType_AS_CHARACTER)
+            case RES_ANCHOR:
+                switch (nMemberID)
                 {
-                    uno::Reference<beans::XPropertySet> const xPropertySet(
-                        SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), 
pFormat),
-                        uno::UNO_QUERY);
-                    xPropertySet->setPropertyValue(UNO_NAME_SURROUND, 
uno::makeAny(text::WrapTextMode_THROUGH));
-                    return;
+                    case MID_ANCHOR_ANCHORTYPE:
+                        if (aValue.get<text::TextContentAnchorType>()
+                            == text::TextContentAnchorType_AS_CHARACTER)
+                        {
+                            uno::Reference<beans::XPropertySet> const 
xPropertySet(
+                                
SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat),
+                                uno::UNO_QUERY);
+                            xPropertySet->setPropertyValue(
+                                UNO_NAME_SURROUND, 
uno::makeAny(text::WrapTextMode_THROUGH));
+                            return;
+                        }
+                        break;
                 }
                 break;
-            }
-            break;
-        case FN_TEXT_RANGE:
-        {
-            uno::Reference<text::XTextRange> xRange;
-            rValue >>= xRange;
-            SwUnoInternalPaM aInternalPaM(*pFormat->GetDoc());
-            if (sw::XTextRangeToSwPaM(aInternalPaM, xRange))
+            case FN_TEXT_RANGE:
             {
-                SwFormatAnchor aAnchor(pFormat->GetAnchor());
-                aAnchor.SetAnchor(aInternalPaM.Start());
-                pFormat->SetFormatAttr(aAnchor);
-            }
-        }
-        break;
-        case RES_CHAIN:
-            switch (nMemberID)
-            {
-            case MID_CHAIN_PREVNAME:
-                aPropertyName = UNO_NAME_CHAIN_PREV_NAME;
-                break;
-            case MID_CHAIN_NEXTNAME:
-                aPropertyName = UNO_NAME_CHAIN_NEXT_NAME;
-                break;
+                uno::Reference<text::XTextRange> xRange;
+                rValue >>= xRange;
+                SwUnoInternalPaM aInternalPaM(*pFormat->GetDoc());
+                if (sw::XTextRangeToSwPaM(aInternalPaM, xRange))
+                {
+                    SwFormatAnchor aAnchor(pFormat->GetAnchor());
+                    aAnchor.SetAnchor(aInternalPaM.Start());
+                    pFormat->SetFormatAttr(aAnchor);
+                }
             }
             break;
-        case RES_TEXT_VERT_ADJUST:
-            aPropertyName = UNO_NAME_TEXT_VERT_ADJUST;
-            break;
-        case RES_BOX:
-            switch (nMemberID)
-            {
-            case LEFT_BORDER_DISTANCE:
-                aPropertyName = UNO_NAME_LEFT_BORDER_DISTANCE;
+            case RES_CHAIN:
+                switch (nMemberID)
+                {
+                    case MID_CHAIN_PREVNAME:
+                        aPropertyName = UNO_NAME_CHAIN_PREV_NAME;
+                        break;
+                    case MID_CHAIN_NEXTNAME:
+                        aPropertyName = UNO_NAME_CHAIN_NEXT_NAME;
+                        break;
+                }
                 break;
-            case RIGHT_BORDER_DISTANCE:
-                aPropertyName = UNO_NAME_RIGHT_BORDER_DISTANCE;
+            case RES_TEXT_VERT_ADJUST:
+                aPropertyName = UNO_NAME_TEXT_VERT_ADJUST;
                 break;
-            case TOP_BORDER_DISTANCE:
-                aPropertyName = UNO_NAME_TOP_BORDER_DISTANCE;
+            case RES_BOX:
+                switch (nMemberID)
+                {
+                    case LEFT_BORDER_DISTANCE:
+                        aPropertyName = UNO_NAME_LEFT_BORDER_DISTANCE;
+                        break;
+                    case RIGHT_BORDER_DISTANCE:
+                        aPropertyName = UNO_NAME_RIGHT_BORDER_DISTANCE;
+                        break;
+                    case TOP_BORDER_DISTANCE:
+                        aPropertyName = UNO_NAME_TOP_BORDER_DISTANCE;
+                        break;
+                    case BOTTOM_BORDER_DISTANCE:
+                        aPropertyName = UNO_NAME_BOTTOM_BORDER_DISTANCE;
+                        break;
+                }
                 break;
-            case BOTTOM_BORDER_DISTANCE:
-                aPropertyName = UNO_NAME_BOTTOM_BORDER_DISTANCE;
+            case RES_OPAQUE:
+                aPropertyName = UNO_NAME_OPAQUE;
                 break;
-            }
-            break;
-        case RES_OPAQUE:
-            aPropertyName = UNO_NAME_OPAQUE;
-            break;
         }
 
         if (!aPropertyName.isEmpty())
@@ -536,21 +562,22 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, 
sal_uInt16 nWID, sal_u
                     }
                     else if (bAdjustSize)
                     {
-                        awt::Size aSize(TWIPS_TO_MM(aRect.getWidth()), 
TWIPS_TO_MM(aRect.getHeight()));
+                        awt::Size aSize(TWIPS_TO_MM(aRect.getWidth()),
+                                        TWIPS_TO_MM(aRect.getHeight()));
                         aValue <<= aSize;
                     }
                 }
             }
 
             uno::Reference<beans::XPropertySet> const xPropertySet(
-                SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat),
-                uno::UNO_QUERY);
+                SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat), 
uno::UNO_QUERY);
             xPropertySet->setPropertyValue(aPropertyName, aValue);
         }
     }
 }
 
-void SwTextBoxHelper::saveLinks(const SwFrameFormats& rFormats, std::map<const 
SwFrameFormat*, const SwFrameFormat*>& rLinks)
+void SwTextBoxHelper::saveLinks(const SwFrameFormats& rFormats,
+                                std::map<const SwFrameFormat*, const 
SwFrameFormat*>& rLinks)
 {
     for (const auto pFormat : rFormats)
     {
@@ -559,7 +586,8 @@ void SwTextBoxHelper::saveLinks(const SwFrameFormats& 
rFormats, std::map<const S
     }
 }
 
-void SwTextBoxHelper::resetLink(SwFrameFormat* pShape, std::map<const 
SwFrameFormat*, SwFormatContent>& rOldContent)
+void SwTextBoxHelper::resetLink(SwFrameFormat* pShape,
+                                std::map<const SwFrameFormat*, 
SwFormatContent>& rOldContent)
 {
     if (pShape->Which() == RES_DRAWFRMFMT)
     {
@@ -569,7 +597,8 @@ void SwTextBoxHelper::resetLink(SwFrameFormat* pShape, 
std::map<const SwFrameFor
     }
 }
 
-void SwTextBoxHelper::restoreLinks(std::set<ZSortFly>& rOld, 
std::vector<SwFrameFormat*>& rNew, SavedLink& rSavedLinks, SavedContent& 
rResetContent)
+void SwTextBoxHelper::restoreLinks(std::set<ZSortFly>& rOld, 
std::vector<SwFrameFormat*>& rNew,
+                                   SavedLink& rSavedLinks, SavedContent& 
rResetContent)
 {
     std::size_t i = 0;
     for (auto aSetIt = rOld.begin(); aSetIt != rOld.end(); ++aSetIt, ++i)
@@ -585,7 +614,8 @@ void SwTextBoxHelper::restoreLinks(std::set<ZSortFly>& 
rOld, std::vector<SwFrame
             }
         }
         if (rResetContent.find(aSetIt->GetFormat()) != rResetContent.end())
-            
const_cast<SwFrameFormat*>(aSetIt->GetFormat())->SetFormatAttr(rResetContent[aSetIt->GetFormat()]);
+            const_cast<SwFrameFormat*>(aSetIt->GetFormat())
+                ->SetFormatAttr(rResetContent[aSetIt->GetFormat()]);
     }
 }
 
@@ -601,72 +631,72 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
         {
             switch (nWhich)
             {
-            case RES_VERT_ORIENT:
-            {
-                auto& rOrient = static_cast<const 
SwFormatVertOrient&>(*aIter.GetCurItem());
-                SwFormatVertOrient aOrient(rOrient);
+                case RES_VERT_ORIENT:
+                {
+                    auto& rOrient = static_cast<const 
SwFormatVertOrient&>(*aIter.GetCurItem());
+                    SwFormatVertOrient aOrient(rOrient);
 
-                tools::Rectangle aRect = getTextRectangle(&rShape, 
/*bAbsolute=*/false);
-                if (!aRect.IsEmpty())
-                    aOrient.SetPos(aOrient.GetPos() + aRect.getY());
+                    tools::Rectangle aRect = getTextRectangle(&rShape, 
/*bAbsolute=*/false);
+                    if (!aRect.IsEmpty())
+                        aOrient.SetPos(aOrient.GetPos() + aRect.getY());
 
-                aTextBoxSet.Put(aOrient);
+                    aTextBoxSet.Put(aOrient);
 
-                // restore height (shrunk for extending beyond the page bottom 
- tdf#91260)
-                SwFormatFrameSize aSize(pFormat->GetFrameSize());
-                if (!aRect.IsEmpty())
-                {
-                    aSize.SetHeight(aRect.getHeight());
-                    aTextBoxSet.Put(aSize);
+                    // restore height (shrunk for extending beyond the page 
bottom - tdf#91260)
+                    SwFormatFrameSize aSize(pFormat->GetFrameSize());
+                    if (!aRect.IsEmpty())
+                    {
+                        aSize.SetHeight(aRect.getHeight());
+                        aTextBoxSet.Put(aSize);
+                    }
                 }
-            }
-            break;
-            case RES_HORI_ORIENT:
-            {
-                auto& rOrient = static_cast<const 
SwFormatHoriOrient&>(*aIter.GetCurItem());
-                SwFormatHoriOrient aOrient(rOrient);
+                break;
+                case RES_HORI_ORIENT:
+                {
+                    auto& rOrient = static_cast<const 
SwFormatHoriOrient&>(*aIter.GetCurItem());
+                    SwFormatHoriOrient aOrient(rOrient);
 
-                tools::Rectangle aRect = getTextRectangle(&rShape, 
/*bAbsolute=*/false);
-                if (!aRect.IsEmpty())
-                    aOrient.SetPos(aOrient.GetPos() + aRect.getX());
+                    tools::Rectangle aRect = getTextRectangle(&rShape, 
/*bAbsolute=*/false);
+                    if (!aRect.IsEmpty())
+                        aOrient.SetPos(aOrient.GetPos() + aRect.getX());
 
-                aTextBoxSet.Put(aOrient);
-            }
-            break;
-            case RES_FRM_SIZE:
-            {
-                // In case the shape got resized, then we need to adjust both
-                // the position and the size of the textbox (e.g. larger
-                // rounded edges of a rectangle -> need to push right/down the
-                // textbox).
-                SwFormatVertOrient aVertOrient(rShape.GetVertOrient());
-                SwFormatHoriOrient aHoriOrient(rShape.GetHoriOrient());
-                SwFormatFrameSize aSize(pFormat->GetFrameSize());
-
-                tools::Rectangle aRect = getTextRectangle(&rShape, 
/*bAbsolute=*/false);
-                if (!aRect.IsEmpty())
+                    aTextBoxSet.Put(aOrient);
+                }
+                break;
+                case RES_FRM_SIZE:
                 {
-                    aVertOrient.SetPos(aVertOrient.GetPos() + aRect.getY());
-                    aTextBoxSet.Put(aVertOrient);
+                    // In case the shape got resized, then we need to adjust 
both
+                    // the position and the size of the textbox (e.g. larger
+                    // rounded edges of a rectangle -> need to push right/down 
the
+                    // textbox).
+                    SwFormatVertOrient aVertOrient(rShape.GetVertOrient());
+                    SwFormatHoriOrient aHoriOrient(rShape.GetHoriOrient());
+                    SwFormatFrameSize aSize(pFormat->GetFrameSize());
+
+                    tools::Rectangle aRect = getTextRectangle(&rShape, 
/*bAbsolute=*/false);
+                    if (!aRect.IsEmpty())
+                    {
+                        aVertOrient.SetPos(aVertOrient.GetPos() + 
aRect.getY());
+                        aTextBoxSet.Put(aVertOrient);
 
-                    aHoriOrient.SetPos(aHoriOrient.GetPos() + aRect.getX());
-                    aTextBoxSet.Put(aHoriOrient);
+                        aHoriOrient.SetPos(aHoriOrient.GetPos() + 
aRect.getX());
+                        aTextBoxSet.Put(aHoriOrient);
 
-                    aSize.SetWidth(aRect.getWidth());
-                    aSize.SetHeight(aRect.getHeight());
-                    aTextBoxSet.Put(aSize);
+                        aSize.SetWidth(aRect.getWidth());
+                        aSize.SetHeight(aRect.getHeight());
+                        aTextBoxSet.Put(aSize);
+                    }
                 }
-            }
-            break;
-            default:
-                SAL_WARN("sw.core", "SwTextBoxHelper::syncFlyFrameAttr: 
unhandled which-id: " << nWhich);
                 break;
+                default:
+                    SAL_WARN("sw.core",
+                             "SwTextBoxHelper::syncFlyFrameAttr: unhandled 
which-id: " << nWhich);
+                    break;
             }
 
             if (aIter.IsAtEnd())
                 break;
-        }
-        while (0 != (nWhich = aIter.NextItem()->Which()));
+        } while (0 != (nWhich = aIter.NextItem()->Which()));
 
         if (aTextBoxSet.Count())
             pFormat->GetDoc()->SetFlyFrameAttr(*pFormat, aTextBoxSet);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to