[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - include/sfx2 sfx2/source sw/source

Caolán McNamara caolanm at redhat.com
Tue Jul 29 05:39:07 PDT 2014


 include/sfx2/styledlg.hxx           |    3 +++
 sfx2/source/dialog/mgetempl.cxx     |   16 +++++-----------
 sfx2/source/dialog/styledlg.cxx     |   14 ++++++++++++++
 sw/source/core/uibase/app/docst.cxx |    6 +++++-
 4 files changed, 27 insertions(+), 12 deletions(-)

New commits:
commit 1cf2cf1d4fbb1622c1789cb893d5e9fd9de1cd61
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jul 24 09:42:30 2014 +0100

    Resolves: fdo#81641 the new style shouldn't be a conditional style
    
    regression from
    
    commit 715d79bcc59d68c77dc84a1038998dd873df92e9
    Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
    Date:   Fri Nov 30 11:51:46 2012 +0100
    
        Styles & Formatting: added SFXSTYLEBIT_ALL_VISIBLE and show hidden styles
    
    commit 2fd9c2bf9af0c50dae3af3dbe5e22965ccdb4ae7
    Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
    Date:   Sun Nov 25 15:24:42 2012 +0100
    
        Allow to hide styles in the "Styles & Formating" dialog
    
        In its current state, the feature only hides the styles. Things to sort
        out are:
         + Add some automatic filter to show hidden styles
         + Make the visibility persist in the file format
    
    (cherry picked from commit 1af0e46102350114dd5e854b7692c640dae2727f)
    
    Conflicts:
    	sw/source/uibase/app/docst.cxx
    
    Change-Id: I7244d424765db0d5ed3aeaf380a8e1af56aa7eaf
    
    Related: fdo#81641 exclude 'all styles' category from organizer page
    
    it doesn't make sense to be able to assign a style to
    'all styles'
    
    Change-Id: I632c62f293b553e436ceb8da0baf2bb39941fd39
    (cherry picked from commit 2223ff6cb99df097a357674801835c7a260b551d)
    
    style category listbox depends on being unsorted
    
    regression from
    
    commit 6ecfbf153a7c11c63d208630ac6a27064058099d
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Wed Mar 13 15:10:25 2013 +0000
    
        drop unused resources and toggle label to activate replacement widget
    
    Change-Id: I65ca8ec58ed984120f3c2e7ba68507cbf8acf089
    (cherry picked from commit 11fab6b705638359b2ca0e3e85590aa7cc70a03a)
    
    Related: fdo#81641 create new styles with an initial name
    
    instead of creating with a blank name and changing it later
    
    this way undo of a style creation is initialized with its name and so create a
    style followed by deleting a style and undoing all those steps doesn't crash
    
    (cherry picked from commit e904562af54545684b32d2042ded6bdb9459edca)
    
    Conflicts:
    	sw/source/uibase/app/docst.cxx
    
    Change-Id: Ida7a34410d5d7b05edcb86950aabb3c672b82c8f
    Reviewed-on: https://gerrit.libreoffice.org/10502
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/include/sfx2/styledlg.hxx b/include/sfx2/styledlg.hxx
index eb6d152..41a9020 100644
--- a/include/sfx2/styledlg.hxx
+++ b/include/sfx2/styledlg.hxx
@@ -25,6 +25,7 @@
 #include <sfx2/tabdlg.hxx>
 
 class SfxStyleSheetBase;
+class SfxStyleSheetBasePool;
 
 class SFX2_DLLPUBLIC SfxStyleDialog: public SfxTabDialog
 {
@@ -45,6 +46,8 @@ public:
     const SfxStyleSheetBase&    GetStyleSheet() const { return *pStyle; }
 
     virtual short               Ok() SAL_OVERRIDE;
+
+    static OUString GenerateUnusedName(SfxStyleSheetBasePool &rPool);
 };
 
 #endif
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 733abce..cf3d0f3 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -67,7 +67,9 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
     m_pBaseLb->setMaxWidthChars(nMaxWidth);
     get(m_pFilterFt, "categoryft");
     get(m_pFilterLb, "category");
-    m_pFilterLb->SetStyle(m_pFilterLb->GetStyle() | WB_SORT);
+    //note that the code depends on categories not being lexically
+    //sorted, so if its changed to sorted, the code needs to
+    //be adapted to be position unaware
     m_pFilterLb->setMaxWidthChars(nMaxWidth);
     get(m_pDescFt, "desc");
 
@@ -94,16 +96,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
     if ( pStyle->GetName().isEmpty() && pPool )
     {
         // NullString as Name -> generate Name
-        OUString aNoName( SfxResId(STR_NONAME).toString() );
-        sal_uInt16 nNo = 1;
-        OUString aNo( aNoName );
-        aNoName += OUString::number( nNo );
-        while ( pPool->Find( aNoName ) )
-        {
-            ++nNo;
-            aNoName = aNo;
-            aNoName += OUString::number( nNo );
-        }
+        OUString aNoName(SfxStyleDialog::GenerateUnusedName(*pPool));
         pStyle->SetName( aNoName );
         aName = aNoName;
         aFollow = pStyle->GetFollow();
@@ -193,6 +186,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
 
             if ( pTupel->nFlags != SFXSTYLEBIT_AUTO     &&
                  pTupel->nFlags != SFXSTYLEBIT_USED     &&
+                 pTupel->nFlags != SFXSTYLEBIT_ALL_VISIBLE &&
                  pTupel->nFlags != SFXSTYLEBIT_ALL )
             {
                 m_pFilterLb->InsertEntry( pTupel->aName, nIdx );
diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx
index 73cd425..c6848fb1 100644
--- a/sfx2/source/dialog/styledlg.cxx
+++ b/sfx2/source/dialog/styledlg.cxx
@@ -147,5 +147,19 @@ IMPL_LINK( SfxStyleDialog, CancelHdl, Button *, pButton )
     return 0;
 }
 
+OUString SfxStyleDialog::GenerateUnusedName(SfxStyleSheetBasePool &rPool)
+{
+    OUString aNoName(SfxResId(STR_NONAME).toString());
+    sal_uInt16 nNo = 1;
+    OUString aNo(aNoName);
+    aNoName += OUString::number(nNo);
+    while (rPool.Find(aNoName))
+    {
+        ++nNo;
+        aNoName = aNo;
+        aNoName += OUString::number(nNo);
+    }
+    return aNoName;
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/uibase/app/docst.cxx b/sw/source/core/uibase/app/docst.cxx
index 5e846f7..402bb75 100644
--- a/sw/source/core/uibase/app/docst.cxx
+++ b/sw/source/core/uibase/app/docst.cxx
@@ -25,6 +25,7 @@
 
 #include <hintids.hxx>
 #include <sfx2/app.hxx>
+#include <sfx2/styledlg.hxx>
 #include <svl/whiter.hxx>
 #include <sfx2/templdlg.hxx>
 #include <sfx2/tplpitem.hxx>
@@ -285,6 +286,9 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
                 false, &pItem ))
                 sParent = ((const SfxStringItem*)pItem)->GetValue();
 
+            if (sName.isEmpty() && mxBasePool.get())
+                sName = SfxStyleDialog::GenerateUnusedName(*mxBasePool);
+
             nRet = Edit( sName, sParent, nFamily, nMask, true, OString(), 0, rReq.IsAPI() );
         }
         break;
@@ -613,7 +617,7 @@ sal_uInt16 SwDocShell::Edit(
 
     if( bNew )
     {
-        if( SFXSTYLEBIT_ALL != nMask && SFXSTYLEBIT_USED != nMask )
+        if (SFXSTYLEBIT_ALL != nMask && SFXSTYLEBIT_ALL_VISIBLE != nMask && SFXSTYLEBIT_USED != nMask)
             nMask |= SFXSTYLEBIT_USERDEF;
         else
             nMask = SFXSTYLEBIT_USERDEF;


More information about the Libreoffice-commits mailing list