[Libreoffice-commits] core.git: Branch 'feature/sidebar' - sd/source svx/source

Armin Le Grand alg at apache.org
Thu May 9 09:35:52 PDT 2013


 sd/source/ui/view/drviews2.cxx |  110 -----------------------------------------
 svx/source/svdraw/svdedtv1.cxx |   42 +++++++++++++++
 2 files changed, 42 insertions(+), 110 deletions(-)

New commits:
commit 2db68b8740422ddd19871a17b33fad31821ec2fd
Author: Armin Le Grand <alg at apache.org>
Date:   Wed Apr 24 14:18:22 2013 +0000

    Related: #i122121# moved automatic StartEnd adaption to svx
    
    (cherry picked from commit 81e9ede3e748a40555e87efd1af19521dab5261d)
    
    Conflicts:
    	sd/source/ui/view/drviews2.cxx
    
    Change-Id: I5ce51fce89e8f29d2f469bf11c5ba6f075f690f2

diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 0941eda..4e44fb7 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -277,117 +277,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         {
             if( rReq.GetArgs() )
             {
-                sal_Bool bMergeUndo = sal_False;
-                ::svl::IUndoManager* pUndoManager = GetDocSh()->GetUndoManager();
-
-                // adjustment Start/EndWidth
-                if(nSId == SID_ATTR_LINE_WIDTH)
-                {
-                    SdrObject* pObj = NULL;
-                    const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
-                    sal_uLong nCount = rMarkList.GetMarkCount();
-
-                    sal_Int32 nNewLineWidth = ((const XLineWidthItem&)rReq.GetArgs()->Get(XATTR_LINEWIDTH)).GetValue();
-
-                    for (sal_uLong i=0; i<nCount; i++)
-                    {
-                        SfxItemSet aAttr(GetDoc()->GetPool());
-                        pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
-                        aAttr.Put(pObj->GetMergedItemSet());
-
-                        sal_Int32 nActLineWidth = ((const XLineWidthItem&)aAttr.Get(XATTR_LINEWIDTH)).GetValue();
-
-                        if(nActLineWidth != nNewLineWidth)
-                        {
-                            sal_Bool bSetItemSet(sal_False);
-
-                            // do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
-                            if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINESTARTWIDTH))
-                            {
-                                sal_Int32 nValAct = ((const XLineStartWidthItem&)aAttr.Get(XATTR_LINESTARTWIDTH)).GetValue();
-                                sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
-                                if(nValNew < 0)
-                                    nValNew = 0;
-                                bSetItemSet = sal_True;
-                                aAttr.Put(XLineStartWidthItem(nValNew));
-                            }
-
-                            // do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
-                            if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINEENDWIDTH))
-                            {
-                                sal_Int32 nValAct = ((const XLineEndWidthItem&)aAttr.Get(XATTR_LINEENDWIDTH)).GetValue();
-                                sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
-                                if(nValNew < 0)
-                                    nValNew = 0;
-                                bSetItemSet = sal_True;
-                                aAttr.Put(XLineEndWidthItem(nValNew));
-                            }
-
-                            if(bSetItemSet)
-                                pObj->SetMergedItemSet(aAttr);
-                        }
-                    }
-                }
-
-                if (nSId == SID_ATTR_FILL_SHADOW)
-                {
-                    // possibly transparent objects are filled white
-                    SdrObject* pObj = NULL;
-                    const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
-                    sal_uLong nCount = rMarkList.GetMarkCount();
-
-                    const bool bUndo = mpDrawView->IsUndoEnabled();
-
-                    for (sal_uLong i=0; i<nCount; i++)
-                    {
-                        SfxItemSet aAttr(GetDoc()->GetPool());
-                        pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
-
-                        // #i25616#
-                        if(!pObj->ISA(SdrGrafObj))
-                        {
-                            aAttr.Put(pObj->GetMergedItemSet());
-
-                            const XFillStyleItem& rFillStyle =
-                            (const XFillStyleItem&) aAttr.Get(XATTR_FILLSTYLE);
-
-                            if (rFillStyle.GetValue() == XFILL_NONE)
-                            {
-                                if( bUndo )
-                                {
-                                    // template has no filling, so force
-                                    // filling (hard) attribute
-                                    if (!bMergeUndo)
-                                    {
-                                        bMergeUndo = sal_True;
-                                        pUndoManager->EnterListAction( String(), String() );
-                                        mpDrawView->BegUndo();
-                                    }
-
-                                    mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
-                                }
-
-                                aAttr.Put(XFillStyleItem(XFILL_SOLID));
-                                aAttr.Put(XFillColorItem(String(), COL_WHITE));
-
-                                pObj->SetMergedItemSet(aAttr);
-                            }
-                        }
-                    }
-
-                    if (bMergeUndo)
-                    {
-                        mpDrawView->EndUndo();
-                    }
-                }
-
                 mpDrawView->SetAttributes(*rReq.GetArgs());
-
-                if (bMergeUndo)
-                {
-                    pUndoManager->LeaveListAction();
-                }
-
                 rReq.Done();
             }
             else
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 6a1c62e..196779b 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -49,6 +49,9 @@
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <svx/AffineMatrixItem.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1033,6 +1036,16 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, sal_Bool bReplaceAll)
         // #i38135#
         bool bResetAnimationTimer(false);
 
+        // check if LineWidth is part of the change
+        const bool bLineWidthChange(SFX_ITEM_SET == aAttr.GetItemState(XATTR_LINEWIDTH));
+        sal_Int32 nNewLineWidth(0);
+        sal_Int32 nOldLineWidth(0);
+
+        if(bLineWidthChange)
+        {
+            nNewLineWidth = ((const XLineWidthItem&)aAttr.Get(XATTR_LINEWIDTH)).GetValue();
+        }
+
         for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
         {
             SdrMark* pM=GetSdrMarkByIndex(nm);
@@ -1077,9 +1090,38 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, sal_Bool bReplaceAll)
                 aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pObj));
             }
 
+            if(bLineWidthChange)
+            {
+                nOldLineWidth = ((const XLineWidthItem&)pObj->GetMergedItem(XATTR_LINEWIDTH)).GetValue();
+            }
+
             // set attributes at object
             pObj->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
 
+            if(bLineWidthChange)
+            {
+                const SfxItemSet& rSet = pObj->GetMergedItemSet();
+
+                if(nOldLineWidth != nNewLineWidth)
+                {
+                    if(SFX_ITEM_DONTCARE != rSet.GetItemState(XATTR_LINESTARTWIDTH))
+                    {
+                        const sal_Int32 nValAct(((const XLineStartWidthItem&)rSet.Get(XATTR_LINESTARTWIDTH)).GetValue());
+                        const sal_Int32 nValNewStart(std::max((sal_Int32)0, nValAct + (((nNewLineWidth - nOldLineWidth) * 15) / 10)));
+
+                        pObj->SetMergedItem(XLineStartWidthItem(nValNewStart));
+                    }
+
+                    if(SFX_ITEM_DONTCARE != rSet.GetItemState(XATTR_LINEENDWIDTH))
+                    {
+                        const sal_Int32 nValAct(((const XLineEndWidthItem&)rSet.Get(XATTR_LINEENDWIDTH)).GetValue());
+                        const sal_Int32 nValNewEnd(std::max((sal_Int32)0, nValAct + (((nNewLineWidth - nOldLineWidth) * 15) / 10)));
+
+                        pObj->SetMergedItem(XLineEndWidthItem(nValNewEnd));
+                    }
+                }
+            }
+
             if(pObj->ISA(SdrTextObj))
             {
                 SdrTextObj* pTextObj = ((SdrTextObj*)pObj);


More information about the Libreoffice-commits mailing list