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

Caolán McNamara caolanm at redhat.com
Wed May 28 05:26:46 PDT 2014


 include/sfx2/mgetempl.hxx              |    1 -
 include/svl/style.hxx                  |    9 +++++++--
 sc/inc/stlsheet.hxx                    |    2 +-
 sc/source/core/data/stlsheet.cxx       |    4 ++--
 sd/inc/stlsheet.hxx                    |    2 +-
 sd/source/core/drawdoc4.cxx            |    1 -
 sd/source/core/stlpool.cxx             |   12 +++++++-----
 sd/source/core/stlsheet.cxx            |    8 ++------
 sfx2/source/dialog/mgetempl.cxx        |   14 +++-----------
 svl/source/items/style.cxx             |    4 +++-
 sw/inc/docstyle.hxx                    |    2 +-
 sw/source/core/uibase/app/docstyle.cxx |    4 ++--
 12 files changed, 29 insertions(+), 34 deletions(-)

New commits:
commit f438d84fd91a7174d748d870854974bc97b35d8c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 28 13:23:52 2014 +0100

    Related: fdo#79142 make SetName default to Reindexing
    
    Change-Id: I408042bc7bf1a5a955203d65d2c68ebf9527b9b5
    (cherry picked from commit 05e2fd162ef86ebe4ea2a2a679cabeae33e844f0)

diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx
index 085da93..6082fbe 100644
--- a/include/sfx2/mgetempl.hxx
+++ b/include/sfx2/mgetempl.hxx
@@ -54,7 +54,6 @@ class SfxManageStyleSheetPage : public SfxTabPage
 
     SfxStyleSheetBase *pStyle;
     SfxStyleFamilies *pFamilies;
-    SfxStyleSheetBasePool *pPool;
     const SfxStyleFamilyItem *pItem;
     OUString aBuf;
     bool bModified;
diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index 493ba24..f82d142 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -105,8 +105,13 @@ public:
     // returns the internal name of this style
     virtual const OUString& GetName() const;
 
-    // sets the internal name of this style
-    virtual bool SetName( const OUString& );
+    // sets the internal name of this style.
+    //
+    // If the name of a style is changed, then the styles container needs to be
+    // reindexed (see IndexedStyleSheets). If you set bReindexNow to false to
+    // defer that indexing, then you must call the Reindex manually on the
+    // SfxStyleSheetBasePool parent.
+    virtual bool SetName(const OUString& rNewName, bool bReindexNow = true);
 
     /** returns the display name of this style, it is used at the user interface.
         If the display name is empty, this method returns the internal name. */
diff --git a/sc/inc/stlsheet.hxx b/sc/inc/stlsheet.hxx
index 71e6a4b..f242535 100644
--- a/sc/inc/stlsheet.hxx
+++ b/sc/inc/stlsheet.hxx
@@ -57,7 +57,7 @@ public:
     virtual const OUString& GetParent() const SAL_OVERRIDE;
     virtual const OUString& GetFollow() const SAL_OVERRIDE;
 
-    virtual bool SetName( const OUString& ) SAL_OVERRIDE;
+    virtual bool SetName(const OUString& rNewName, bool bReindexNow = true) SAL_OVERRIDE;
 
             void                SetUsage( ScStyleSheet::Usage eUse ) const
                                     { eUsage = eUse; }
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx
index 0e7fd7c..cac09e9 100644
--- a/sc/source/core/data/stlsheet.cxx
+++ b/sc/source/core/data/stlsheet.cxx
@@ -303,13 +303,13 @@ const OUString& ScStyleSheet::GetFollow() const
 //! Flag gesetzt und abgefragt werden.
 //! Die ganze Abfrage muss raus, wenn fuer eine neue Datei-Version die Namens-Umsetzung wegfaellt.
 
-bool ScStyleSheet::SetName( const OUString& rNew )
+bool ScStyleSheet::SetName(const OUString& rNew, bool bReindexNow)
 {
     OUString aFileStdName = OUString(STRING_STANDARD);
     if ( rNew == aFileStdName && aFileStdName != ScGlobal::GetRscString(STR_STYLENAME_STANDARD) )
         return false;
     else
-        return SfxStyleSheet::SetName( rNew );
+        return SfxStyleSheet::SetName(rNew, bReindexNow);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx
index 90ce7eb..a64366b 100644
--- a/sd/inc/stlsheet.hxx
+++ b/sd/inc/stlsheet.hxx
@@ -60,7 +60,7 @@ public:
     virtual bool        HasFollowSupport() const SAL_OVERRIDE;
     virtual bool        HasParentSupport() const SAL_OVERRIDE;
     virtual bool        HasClearParentSupport() const SAL_OVERRIDE;
-    virtual bool        SetName( const OUString& ) SAL_OVERRIDE;
+    virtual bool        SetName(const OUString& rNewName, bool bReindexNow = true) SAL_OVERRIDE;
     virtual void        SetHelpId( const OUString& r, sal_uLong nId ) SAL_OVERRIDE;
 
     void        AdjustToFontHeight(SfxItemSet& rSet, bool bOnlyMissingItems = true);
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 061ac8d..c2e5f57 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -1103,7 +1103,6 @@ void SdDrawDocument::RenameLayoutTemplate(const OUString& rOldLayoutName, const
             aReplList.push_back(aReplData);
 
             pSheet->SetName(aSheetName);
-            mxStyleSheetPool.get()->Reindex();
         }
 
         pSheet = aIter.Next();
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 84e970a..17ca4f0 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -1038,16 +1038,18 @@ void SdStyleSheetPool::UpdateStdNames()
                         // Sheet does exist: old sheet has to be removed
                         aEraseList.push_back( pStyle );
                     }
-                    Reindex();
                 }
             }
         }
     }
 
-    // styles that could not be renamed, must be removed
-    for ( size_t i = 0, n = aEraseList.size(); i < n; ++i )
-        Remove( aEraseList[ i ] );
-    Reindex();
+    if (!aEraseList.empty())
+    {
+        // styles that could not be renamed, must be removed
+        for ( size_t i = 0, n = aEraseList.size(); i < n; ++i )
+            Remove( aEraseList[ i ] );
+        Reindex();
+    }
 }
 
 // Set new SvxNumBulletItem for the respective style sheet
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 215c7ec..2e26e7b 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -628,15 +628,11 @@ bool SdStyleSheet::HasClearParentSupport() const
     return true;
 }
 
-
-
-bool SdStyleSheet::SetName( const OUString& rName )
+bool SdStyleSheet::SetName(const OUString& rName, bool bReindexNow)
 {
-    return SfxStyleSheet::SetName( rName );
+    return SfxStyleSheet::SetName(rName, bReindexNow);
 }
 
-
-
 void SdStyleSheet::SetHelpId( const OUString& r, sal_uLong nId )
 {
     SfxStyleSheet::SetHelpId( r, nId );
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 07e7b1d..733abce 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -45,7 +45,6 @@
 SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemSet& rAttrSet)
     : SfxTabPage(pParent, "ManageStylePage", "sfx/ui/managestylepage.ui", rAttrSet)
     , pStyle(&((SfxStyleDialog*)GetParentDialog())->GetStyleSheet())
-    , pPool(NULL)
     , pItem(0)
     , bModified(false)
     , aName(pStyle->GetName())
@@ -79,6 +78,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
     OSL_ENSURE( pResMgr, "No ResMgr in Module" );
     pFamilies = new SfxStyleFamilies( ResId( DLG_STYLE_DESIGNER, *pResMgr ) );
 
+    SfxStyleSheetBasePool* pPool = 0;
     SfxObjectShell* pDocShell = SfxObjectShell::Current();
 
     if ( pDocShell )
@@ -105,7 +105,6 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
             aNoName += OUString::number( nNo );
         }
         pStyle->SetName( aNoName );
-        pPool->Reindex();
         aName = aNoName;
         aFollow = pStyle->GetFollow();
         aParent = pStyle->GetParent();
@@ -420,11 +419,7 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet& /*rAttrSet*/ )
     OUString sCmp( pStyle->GetName() );
 
     if ( sCmp != aName )
-    {
-        pStyle->SetName(aName);
-        if (pPool)
-            pPool->Reindex();
-    }
+        pStyle->SetName( aName );
     m_pNameRw->SetText( aName );
     m_pNameRw->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
 
@@ -547,8 +542,7 @@ int SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
         if ( m_pNameRw->HasFocus() )
             LoseFocusHdl( m_pNameRw );
 
-        bool bOk = pStyle->SetName(comphelper::string::stripStart(m_pNameRw->GetText(), ' '));
-        if (!bOk)
+        if (!pStyle->SetName(comphelper::string::stripStart(m_pNameRw->GetText(), ' ')))
         {
             InfoBox aBox( this, SfxResId( MSG_TABPAGE_INVALIDNAME ) );
             aBox.Execute();
@@ -556,8 +550,6 @@ int SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
             m_pNameRw->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
             return SfxTabPage::KEEP_PAGE;
         }
-        else if (pPool)
-            pPool->Reindex();
         bModified = true;
     }
 
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 175f7ce..40e8eee 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -155,7 +155,7 @@ const OUString& SfxStyleSheetBase::GetName() const
     return aName;
 }
 
-bool SfxStyleSheetBase::SetName( const OUString& rName )
+bool SfxStyleSheetBase::SetName(const OUString& rName, bool bReIndexNow)
 {
     if(rName.isEmpty())
         return false;
@@ -178,6 +178,8 @@ bool SfxStyleSheetBase::SetName( const OUString& rName )
         if ( aFollow == aName )
             aFollow = rName;
         aName = rName;
+        if (bReIndexNow)
+            pPool->Reindex();
         pPool->SetSearchMask(eTmpFam, nTmpMask);
         pPool->Broadcast( SfxStyleSheetHintExtended(
             SFX_STYLESHEET_MODIFIED, aOldName, *this ) );
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index fe2f411..3e3cb51 100644
--- a/sw/inc/docstyle.hxx
+++ b/sw/inc/docstyle.hxx
@@ -127,7 +127,7 @@ public:
     void                    PresetParent(const OUString& rName){ aParent = rName; }
     void                    PresetFollow(const OUString& rName){ aFollow = rName; }
 
-    virtual bool            SetName( const OUString& rStr) SAL_OVERRIDE;
+    virtual bool            SetName(const OUString& rNewName, bool bReindexNow = true) SAL_OVERRIDE;
     virtual bool            SetParent( const OUString& rStr) SAL_OVERRIDE;
     virtual bool            SetFollow( const OUString& rStr) SAL_OVERRIDE;
 
diff --git a/sw/source/core/uibase/app/docstyle.cxx b/sw/source/core/uibase/app/docstyle.cxx
index 848649c..d4c56b1 100644
--- a/sw/source/core/uibase/app/docstyle.cxx
+++ b/sw/source/core/uibase/app/docstyle.cxx
@@ -870,14 +870,14 @@ OUString  SwDocStyleSheet::GetDescription()
 }
 
 // Set names
-bool  SwDocStyleSheet::SetName( const OUString& rStr)
+bool  SwDocStyleSheet::SetName(const OUString& rStr, bool bReindexNow)
 {
     if( rStr.isEmpty() )
         return false;
 
     if( aName != rStr )
     {
-        if( !SfxStyleSheetBase::SetName( rStr ))
+        if( !SfxStyleSheetBase::SetName(rStr, bReindexNow))
             return false;
     }
     else if(!bPhysical)


More information about the Libreoffice-commits mailing list