include/sfx2/styledlg.hxx | 3 +++ sfx2/source/dialog/mgetempl.cxx | 16 +++++----------- sfx2/source/dialog/styledlg.cxx | 14 ++++++++++++++ sw/source/core/doc/docfmt.cxx | 38 ++++++++++++++++++++++++++------------ sw/source/core/inc/SwUndoFmt.hxx | 15 +++++++++++++++ sw/source/core/undo/SwUndoFmt.cxx | 22 ++++++++++++++++++++++ sw/source/uibase/app/docst.cxx | 6 +++++- sw/source/uibase/app/docstyle.cxx | 6 +++++- 8 files changed, 95 insertions(+), 25 deletions(-)
New commits: commit e904562af54545684b32d2042ded6bdb9459edca Author: Caolán McNamara <caol...@redhat.com> Date: Thu Jul 24 11:55:46 2014 +0100 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 Change-Id: Ida7a34410d5d7b05edcb86950aabb3c672b82c8f 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 61a5936..2a7aff7 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -96,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(); diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx index c9231d4..664468a 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/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 929919c..b9c27d8 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/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> @@ -291,6 +292,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; commit 965b2059cb6965df643d5245eb318c087bc251c4 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Jul 24 11:15:24 2014 +0100 frames are SFX_STYLE_FAMILY_FRAME not SFX_STYLE_FAMILY_PARA busted since initial commit Change-Id: Icb6a4eed4a4def26621489ae2b708696e04ce667 diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 605d6a9..055bc46 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -809,7 +809,7 @@ SwFrmFmt *SwDoc::MakeFrmFmt(const OUString &rFmtName, if (bBroadcast) { - BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA, + BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_FRAME, SFX_STYLESHEET_CREATED); } commit e08fc65e5fe716c838b0c0dc29d337967df5380f Author: Caolán McNamara <caol...@redhat.com> Date: Thu Jul 24 11:13:40 2014 +0100 enable undoing frame style creation like all the rest, do it in non-broadcast mode as well Change-Id: Iaf4f035e59b60737d92c3508e8e9f18d21b5a44a diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index ec74bc6..605d6a9 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -800,17 +800,17 @@ SwFrmFmt *SwDoc::MakeFrmFmt(const OUString &rFmtName, mpFrmFmtTbl->push_back( pFmt ); SetModified(); + if (GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo * pUndo = new SwUndoFrmFmtCreate(pFmt, pDerivedFrom, this); + + GetIDocumentUndoRedo().AppendUndo(pUndo); + } + if (bBroadcast) { BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA, SFX_STYLESHEET_CREATED); - - if (GetIDocumentUndoRedo().DoesUndo()) - { - SwUndo * pUndo = new SwUndoFrmFmtCreate(pFmt, pDerivedFrom, this); - - GetIDocumentUndoRedo().AppendUndo(pUndo); - } } return pFmt; commit 4681801f8515c18b6ecead39093effecbbc6df46 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Jul 24 10:51:50 2014 +0100 implement undo of character style rename Change-Id: Ie503cccbfdbce882a429fe25f29b5b7aaf6b38e9 diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index e6d208e..a7a778d 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -962,7 +962,11 @@ bool SwDocStyleSheet::SetName(const OUString& rStr, bool bReindexNow) OSL_ENSURE(pCharFmt, "SwCharFormat missing!"); if( pCharFmt && pCharFmt->GetName() != rStr ) { - pCharFmt->SetName( rStr ); + if (!pCharFmt->GetName().isEmpty()) + rDoc.RenameFmt(*pCharFmt, rStr); + else + pCharFmt->SetName(rStr); + bChg = true; } break; commit fb743559fb993d2d8d8b61354e734c27d9d13e1c Author: Caolán McNamara <caol...@redhat.com> Date: Thu Jul 24 10:44:12 2014 +0100 Families in SwDoc::RenameFmt the wrong way around busted since initial commit 9dc46dcbe9e89298022e8e5ea853ffd379ae271e Author: Jens-Heiner Rechtien <h...@openoffice.org> Date: Wed Sep 8 14:17:22 2004 +0000 INTEGRATION: CWS swundo03 (1.28.10); FILE MERGED 2004/07/15 07:28:43 hbrinkm 1.28.10.3: RESYNC: (1.28-1.29); FILE MERGED 2004/07/13 08:44:59 hbrinkm 1.28.10.2: #115575# 2004/07/07 16:50:38 hbrinkm 1.28.10.1: #115575# SwDoc::RenameFmt Change-Id: I5e817d7bf36870edfe4d8623808c0747c2899f45 diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index d70b460..ec74bc6 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1858,11 +1858,11 @@ void SwDoc::RenameFmt(SwFmt & rFmt, const OUString & sNewName, { case RES_CHRFMT: pUndo = new SwUndoRenameCharFmt(rFmt.GetName(), sNewName, this); - eFamily = SFX_STYLE_FAMILY_PARA; + eFamily = SFX_STYLE_FAMILY_CHAR; break; case RES_TXTFMTCOLL: pUndo = new SwUndoRenameFmtColl(rFmt.GetName(), sNewName, this); - eFamily = SFX_STYLE_FAMILY_CHAR; + eFamily = SFX_STYLE_FAMILY_PARA; break; case RES_FRMFMT: pUndo = new SwUndoRenameFrmFmt(rFmt.GetName(), sNewName, this); commit 183bde5bf5aa048792880292ac77777577fcd13b Author: Caolán McNamara <caol...@redhat.com> Date: Thu Jul 24 10:26:15 2014 +0100 Related: fdo#81641 implement undo of Conditional Text style creation and deletion Change-Id: I694ae8f917c74305cd30037c3c3833a980354948 diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 6053497..d70b460 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -907,6 +907,13 @@ SwConditionTxtFmtColl* SwDoc::MakeCondTxtFmtColl( const OUString &rFmtName, pFmtColl->SetAuto( false ); SetModified(); + if (GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo * pUndo = new SwUndoCondTxtFmtCollCreate(pFmtColl, pDerivedFrom, + this); + GetIDocumentUndoRedo().AppendUndo(pUndo); + } + if (bBroadcast) BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA, SFX_STYLESHEET_CREATED); @@ -942,8 +949,15 @@ void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, bool bBroadcast) if (GetIDocumentUndoRedo().DoesUndo()) { - SwUndoTxtFmtCollDelete * pUndo = - new SwUndoTxtFmtCollDelete(pDel, this); + SwUndoTxtFmtCollDelete * pUndo; + if (RES_CONDTXTFMTCOLL == pDel->Which()) + { + pUndo = new SwUndoCondTxtFmtCollDelete(pDel, this); + } + else + { + pUndo = new SwUndoTxtFmtCollDelete(pDel, this); + } GetIDocumentUndoRedo().AppendUndo(pUndo); } diff --git a/sw/source/core/inc/SwUndoFmt.hxx b/sw/source/core/inc/SwUndoFmt.hxx index 81289cd..cb20d7f 100644 --- a/sw/source/core/inc/SwUndoFmt.hxx +++ b/sw/source/core/inc/SwUndoFmt.hxx @@ -26,6 +26,7 @@ class SwDoc; class SwTxtFmtColl; +class SwConditionTxtFmtColl; class SwRewriter; class SfxItemSet; @@ -120,6 +121,20 @@ public: virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE; }; +class SwUndoCondTxtFmtCollCreate : public SwUndoTxtFmtCollCreate +{ +public: + SwUndoCondTxtFmtCollCreate(SwConditionTxtFmtColl * pNew, SwTxtFmtColl * pDerivedFrom, SwDoc * pDoc); + virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE; +}; + +class SwUndoCondTxtFmtCollDelete : public SwUndoTxtFmtCollDelete +{ +public: + SwUndoCondTxtFmtCollDelete(SwTxtFmtColl * pOld, SwDoc * pDoc); + virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE; +}; + class SwUndoRenameFmtColl : public SwUndoRenameFmt { public: diff --git a/sw/source/core/undo/SwUndoFmt.cxx b/sw/source/core/undo/SwUndoFmt.cxx index 96cbde7..626f1a5 100644 --- a/sw/source/core/undo/SwUndoFmt.cxx +++ b/sw/source/core/undo/SwUndoFmt.cxx @@ -232,6 +232,28 @@ SwFmt * SwUndoTxtFmtCollDelete::Find(const OUString & rName) const return pDoc->FindTxtFmtCollByName(rName); } +SwUndoCondTxtFmtCollCreate::SwUndoCondTxtFmtCollCreate(SwConditionTxtFmtColl *_pNew, + SwTxtFmtColl *_pDerivedFrom, SwDoc *_pDoc) + : SwUndoTxtFmtCollCreate(_pNew, _pDerivedFrom, _pDoc) +{ +} + +SwFmt * SwUndoCondTxtFmtCollCreate::Create(SwFmt * pDerivedFrom) +{ + return pDoc->MakeCondTxtFmtColl(sNewName, (SwTxtFmtColl *)pDerivedFrom, true); +} + +SwUndoCondTxtFmtCollDelete::SwUndoCondTxtFmtCollDelete(SwTxtFmtColl * _pOld, + SwDoc * _pDoc) + : SwUndoTxtFmtCollDelete(_pOld, _pDoc) +{ +} + +SwFmt * SwUndoCondTxtFmtCollDelete::Create(SwFmt * pDerivedFrom) +{ + return pDoc->MakeCondTxtFmtColl(sOldName, (SwTxtFmtColl *) pDerivedFrom, true); +} + SwUndoRenameFmtColl::SwUndoRenameFmtColl(const OUString & sInitOldName, const OUString & sInitNewName, SwDoc * _pDoc) commit 11fab6b705638359b2ca0e3e85590aa7cc70a03a Author: Caolán McNamara <caol...@redhat.com> Date: Thu Jul 24 10:12:08 2014 +0100 style category listbox depends on being unsorted regression from commit 6ecfbf153a7c11c63d208630ac6a27064058099d Author: Caolán McNamara <caol...@redhat.com> Date: Wed Mar 13 15:10:25 2013 +0000 drop unused resources and toggle label to activate replacement widget Change-Id: I65ca8ec58ed984120f3c2e7ba68507cbf8acf089 diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 7bc9c46..61a5936 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"); commit 2223ff6cb99df097a357674801835c7a260b551d Author: Caolán McNamara <caol...@redhat.com> Date: Thu Jul 24 10:05:23 2014 +0100 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 diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 41830a1..7bc9c46 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -193,6 +193,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 ); commit 1af0e46102350114dd5e854b7692c640dae2727f Author: Caolán McNamara <caol...@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.bosdon...@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.bosdon...@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 Change-Id: I7244d424765db0d5ed3aeaf380a8e1af56aa7eaf diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 4e9580d..929919c 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -634,7 +634,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;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits