[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 3 commits - sd/source sfx2/source sw/source

Oliver-Rainer Wittmann orw at apache.org
Fri May 31 07:07:34 PDT 2013


 sd/source/core/drawdoc3.cxx        |  159 +++++++++++++++++++++++++++----------
 sfx2/source/sidebar/Accessible.hxx |    1 
 sw/source/ui/docvw/edtwin.cxx      |   34 ++++++-
 3 files changed, 146 insertions(+), 48 deletions(-)

New commits:
commit 7d2515d9ac497b3aaf47ae3ce79ec79bc6880330
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Fri May 31 14:03:01 2013 +0000

    122262: correct handling of Shift-<arrow key> for bigger steps movement of objects in order to get back text selection via keys in a table

diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index f1077ce..c577b21 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -1626,17 +1626,15 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
                 switch( rKeyCode.GetModifier() | rKeyCode.GetCode() )
                 {
                 case KEY_RIGHT | KEY_MOD2:
-                case KEY_RIGHT | KEY_SHIFT:
                     eKeyState = KS_ColRightBig;
                     eFlyState = KS_Fly_Change;
-                    nDir = rKeyCode.GetModifier() & KEY_SHIFT ? MOVE_RIGHT_HUGE : MOVE_RIGHT_SMALL;
+                    nDir = MOVE_RIGHT_SMALL;
                     goto KEYINPUT_CHECKTABLE;
 
                 case KEY_LEFT | KEY_MOD2:
-                case KEY_LEFT | KEY_SHIFT:
                     eKeyState = KS_ColRightSmall;
                     eFlyState = KS_Fly_Change;
-                    nDir = rKeyCode.GetModifier() & KEY_SHIFT ? MOVE_LEFT_HUGE : MOVE_LEFT_SMALL;
+                    nDir = MOVE_LEFT_SMALL;
                     goto KEYINPUT_CHECKTABLE;
 
                 case KEY_RIGHT | KEY_MOD2 | KEY_SHIFT:
@@ -1664,17 +1662,15 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
                     goto KEYINPUT_CHECKTABLE;
 
                 case KEY_UP | KEY_MOD2:
-                case KEY_UP | KEY_SHIFT:
                     eKeyState = KS_ColBottomSmall;
                     eFlyState = KS_Fly_Change;
-                    nDir = rKeyCode.GetModifier() & KEY_SHIFT ? MOVE_UP_HUGE : MOVE_UP_SMALL;
+                    nDir = MOVE_UP_SMALL;
                     goto KEYINPUT_CHECKTABLE;
 
                 case KEY_DOWN | KEY_MOD2:
-                case KEY_DOWN | KEY_SHIFT:
                     eKeyState = KS_ColBottomBig;
                     eFlyState = KS_Fly_Change;
-                    nDir = rKeyCode.GetModifier() & KEY_SHIFT ? MOVE_DOWN_HUGE : MOVE_DOWN_SMALL;
+                    nDir = MOVE_DOWN_SMALL;
                     goto KEYINPUT_CHECKTABLE;
 
 //              case KEY_UP | KEY_MOD2 | KEY_SHIFT:
@@ -1718,6 +1714,28 @@ KEYINPUT_CHECKTABLE:
                     }
                     break;
 
+                // huge object move
+                case KEY_RIGHT | KEY_SHIFT:
+                case KEY_LEFT | KEY_SHIFT:
+                case KEY_UP | KEY_SHIFT:
+                case KEY_DOWN | KEY_SHIFT:
+                {
+                    if ( pFlyFmt
+                         || ( (rSh.GetSelectionType() & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM))
+                              && rSh.GetDrawView()->AreObjectsMarked() ) )
+                    {
+                        eKeyState = pFlyFmt ? KS_Fly_Change : KS_Draw_Change;
+                        switch ( rKeyCode.GetCode() )
+                        {
+                            case KEY_RIGHT: nDir = MOVE_RIGHT_HUGE; break;
+                            case KEY_LEFT: nDir = MOVE_LEFT_HUGE; break;
+                            case KEY_UP: nDir = MOVE_UP_HUGE; break;
+                            case KEY_DOWN: nDir = MOVE_DOWN_HUGE; break;
+                        }
+                    }
+                    break;
+                }
+
 //-------
 // Insert/Delete
                 case KEY_LEFT:
commit 2136f4599bdc6f44bc0cc551189bfa565d3fbe71
Author: Armin Le Grand <alg at apache.org>
Date:   Fri May 31 12:50:30 2013 +0000

    i121863 Corrected D&D from MasterPage view, source SlideSorter, target 2nd DocumentView

diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index d30abdd..ee6e698 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1512,6 +1512,58 @@ void SdDrawDocument::RemoveUnnecessaryMasterPages(SdPage* pMasterPage, sal_Bool
 |* Ist rLayoutName leer, so wird die erste MasterPage genommen
 \************************************************************************/
 
+// #121863# factored out functionality
+bool isMasterPageLayoutNameUnique(const SdDrawDocument& rDoc, const String& rCandidate)
+{
+    if(!rCandidate.Len())
+    {
+        return false;
+    }
+
+    const sal_uInt16 nPageCount(rDoc.GetMasterPageCount());
+
+    for(sal_uInt16 a(0); a < nPageCount; a++)
+    {
+        const SdrPage* pCandidate = rDoc.GetMasterPage(a);
+        String aPageLayoutName(pCandidate->GetLayoutName());
+        aPageLayoutName.Erase(aPageLayoutName.SearchAscii(SD_LT_SEPARATOR));
+
+        if(aPageLayoutName == rCandidate)
+        {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+// #121863# factored out functinality
+String createNewMasterPageLayoutName(const SdDrawDocument& rDoc)
+{
+    const String aBaseName(SdResId(STR_LAYOUT_DEFAULT_NAME));
+    String aRetval;
+    sal_uInt16 nCount(0);
+
+    while(!aRetval.Len())
+    {
+        aRetval = aBaseName;
+
+        if(nCount)
+        {
+            aRetval += String::CreateFromInt32(nCount);
+        }
+
+        nCount++;
+
+        if(!isMasterPageLayoutNameUnique(rDoc, aRetval))
+        {
+            aRetval.Erase();
+        }
+    }
+
+    return aRetval;
+}
+
 void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
                                    const String& rLayoutName,
                                    SdDrawDocument* pSourceDoc,
@@ -1541,8 +1593,6 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
     String aOldLayoutName(aOldPageLayoutName);
     aOldLayoutName.Erase(aOldLayoutName.SearchAscii( SD_LT_SEPARATOR ));
 
-    String aNewLayoutName( rLayoutName );
-
     if (pSourceDoc)
     {
         List* pReplList = NULL;
@@ -1556,7 +1606,6 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
             // No LayoutName: take first MasterPage
             pMaster = (SdPage*) pSourceDoc->GetMasterSdPage(0, PK_STANDARD);
             pNotesMaster = (SdPage*) pSourceDoc->GetMasterSdPage(0, PK_NOTES);
-            aNewLayoutName = pMaster->GetName();
         }
         else
         {
@@ -1587,7 +1636,6 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
                 // so take the first MasterPage
                 pMaster = (SdPage*) pSourceDoc->GetMasterSdPage(0, PK_STANDARD);
                 pNotesMaster = (SdPage*) pSourceDoc->GetMasterSdPage(0, PK_NOTES);
-                aNewLayoutName = pMaster->GetName();
             }
         }
 
@@ -1604,13 +1652,53 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
             return;
         }
 
+        const String aOriginalNewLayoutName( pMaster->GetName() );
+        String aTargetNewLayoutName(aOriginalNewLayoutName);
+
+        if (pSourceDoc != this)
+        {
+            // #121863# clone masterpages, they are from another model (!)
+            SdPage* pNewNotesMaster = dynamic_cast< SdPage* >(pNotesMaster->Clone(this));
+            SdPage* pNewMaster = dynamic_cast< SdPage* >(pMaster->Clone(this));
+
+            if(!pNewNotesMaster || !pNewMaster)
+            {
+                delete pNewNotesMaster;
+                delete pNewMaster;
+                OSL_ASSERT("SdDrawDocument::SetMasterPage() cloning of MasterPage/NoteAmsterPage failed!" );
+                return;
+            }
+
+            pNotesMaster = pNewNotesMaster;
+            pMaster = pNewMaster;
+
+            // layout name needs to be unique
+            aTargetNewLayoutName = pMaster->GetLayoutName();
+            aTargetNewLayoutName.Erase(aTargetNewLayoutName.SearchAscii(SD_LT_SEPARATOR));
+
+            if(!isMasterPageLayoutNameUnique(*this, aTargetNewLayoutName))
+            {
+                aTargetNewLayoutName = createNewMasterPageLayoutName(*this);
+
+                String aTemp(aTargetNewLayoutName);
+                aTemp.AppendAscii(RTL_CONSTASCII_STRINGPARAM(SD_LT_SEPARATOR));
+                aTemp.Append(String(SdResId(STR_LAYOUT_OUTLINE)));
+
+                pMaster->SetName(aTargetNewLayoutName);
+                pMaster->SetLayoutName(aTemp);
+
+                pNotesMaster->SetName(aTargetNewLayoutName);
+                pNotesMaster->SetLayoutName(aTemp);
+            }
+        }
+
         if (pSourceDoc != this)
         {
             const sal_uInt16 nMasterPageCount = GetMasterPageCount();
             for ( sal_uInt16 nMPage = 0; nMPage < nMasterPageCount; nMPage++ )
             {
                 SdPage* pCheckMaster = (SdPage*)GetMasterPage(nMPage);
-                if( pCheckMaster->GetName() == aNewLayoutName )
+                if( pCheckMaster->GetName() == aTargetNewLayoutName )
                 {
                     bLayoutReloaded = sal_True;
                     break;
@@ -1635,8 +1723,18 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
             {
                 aName = pHisSheet->GetName();
 
-                if( aName.Search( aNewLayoutName ) == 0 )
+                // #121863# search in source styles with original style name from source of
+                // evtl. cloned master (not-cloned, renamed for uniqueness)
+                if( aName.Search( aOriginalNewLayoutName ) == 0 )
                 {
+                    // #121863# build name of evtl. cloned master style to search for
+                    if(aOriginalNewLayoutName != aTargetNewLayoutName)
+                    {
+                        const sal_uInt16 nPos(aName.SearchAscii(SD_LT_SEPARATOR));
+                        aName.Erase(0, nPos);
+                        aName.Insert(aTargetNewLayoutName, 0);
+                    }
+
                     SfxStyleSheet* pMySheet = static_cast<SfxStyleSheet*>( mxStyleSheetPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE) );
 
                     if (pMySheet)
@@ -1672,10 +1770,13 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
                     pReplData->nFamily    = pMySheet->GetFamily();
                     pReplData->aNewName   = pMySheet->GetName();
 
+                    // #121863# re-create original name of styte used at page where to replace with
+                    // this new style
                     String aTemp(pMySheet->GetName());
-                    sal_uInt16 nPos = aTemp.SearchAscii( SD_LT_SEPARATOR );
+                    const sal_uInt16 nPos(aTemp.SearchAscii(SD_LT_SEPARATOR));
                     aTemp.Erase(0, nPos);
                     aTemp.Insert(aOldLayoutName, 0);
+
                     pReplData->aName = aTemp;
                     pReplList->Insert(pReplData, LIST_APPEND);
                 }
@@ -1738,13 +1839,16 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
         String aLayoutName = aPageLayoutName;
         aLayoutName.Erase( aLayoutName.SearchAscii( SD_LT_SEPARATOR ));
 
-        if (pSourceDoc != this)
-        {
-            // Aus dem Source-Dokument austragen
-            SdrPage* pTest = NULL;
-            pTest = pSourceDoc->RemoveMasterPage(pNotesMaster->GetPageNum());
-            pTest = pSourceDoc->RemoveMasterPage(pMaster->GetPageNum());
-        }
+        // #121863# Do *not* remove from original document any longer, it is potentially used there
+        // and would lead to crashes. Rely on the automatic process of removing unused masterpages
+        // (see RemoveUnnecessaryMasterPages)
+        //if (pSourceDoc != this)
+        //{
+        //  // Aus dem Source-Dokument austragen
+        //  SdrPage* pTest = NULL;
+        //  pTest = pSourceDoc->RemoveMasterPage(pNotesMaster->GetPageNum());
+        //  pTest = pSourceDoc->RemoveMasterPage(pMaster->GetPageNum());
+        //}
 
         /*********************************************************************
         |* Neue MasterPages ins Dokument eintragen und den Standard- und
@@ -1884,32 +1988,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
         /*********************************************************************
         |* Einen neuen Layoutnamen ausdenken
         \********************************************************************/
-        String aName        = String(SdResId(STR_LAYOUT_DEFAULT_NAME));
-        String aTest;
-        sal_Bool   bNotANewName = sal_True;
-        sal_uInt16 nCount       = 0;
-        sal_uInt16 nMPgCount    = GetMasterPageCount();
-
-        for (nCount = 0; bNotANewName; nCount++)
-        {
-            // Testnamen bilden
-            aTest = aName;              // Standard, Standard1, Standard2, ...
-            if (nCount > 0)
-                aTest += String::CreateFromInt32( nCount );
-
-            // gibt's schon eine, die so heisst?
-            bNotANewName = sal_False;
-            for (sal_uInt16 nMPg = 1; nMPg < nMPgCount; nMPg++)
-            {
-                const SdrPage* pTest = GetMasterPage(nMPg);
-                String aPageLayoutName(pTest->GetLayoutName());
-                aPageLayoutName.Erase( aPageLayoutName.SearchAscii( SD_LT_SEPARATOR ));
-
-                if (aPageLayoutName == aTest)
-                    bNotANewName = sal_True;
-            }
-        }
-        aName = aTest;
+        String aName(createNewMasterPageLayoutName(*this));
         String aPageLayoutName(aName);
         aPageLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
         aPageLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
commit df229e8441510da5116d648d7ee8bc1599427771
Author: Andre Fischer <af at apache.org>
Date:   Fri May 31 12:27:30 2013 +0000

    122271: Added missing include.

diff --git a/sfx2/source/sidebar/Accessible.hxx b/sfx2/source/sidebar/Accessible.hxx
index 6209c27..c839e6f 100644
--- a/sfx2/source/sidebar/Accessible.hxx
+++ b/sfx2/source/sidebar/Accessible.hxx
@@ -27,6 +27,7 @@
 
 #include <cppuhelper/compbase1.hxx>
 #include <cppuhelper/basemutex.hxx>
+#include <boost/noncopyable.hpp>
 
 namespace css = ::com::sun::star;
 namespace cssu = ::com::sun::star::uno;


More information about the Libreoffice-commits mailing list