summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-06-13 11:23:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-06-13 17:06:06 +0100
commit8a5b3971057237b178f7e65437deec766b56f9c4 (patch)
treea5215a4193ef8ff34b0da5f638de361af26714d9 /sd
parent05f90a9afe72c0fa7bcd7dbd30c27d4c41a556c4 (diff)
Resolves: fdo#78151 change style on toggling bullets on master page outliners
"do what I mean" In master pages prior to this if we toggle bullets on and off the that changes the *level* of the paragraph. And because the paragraph is effectively a preview of the equivalent style level, changing the level disconnects it from the style which is useless for us. So instead turn the numbering off at the given outline level. In order to toggle the numbering back split the defaults-setting into a reusable piece that sets the numbering indent which we can call to toggle numbering back on Also split out the broadcast style change *and explicit child* broadcast code into a reusable method, the absence of which left me stumped for well over an hour as to why my changes only worked on level 1 Change-Id: I311c7f35f1ca7dff1d151c6141ff5faa7f15c5a2
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/stlpool.hxx2
-rw-r--r--sd/inc/stlsheet.hxx8
-rw-r--r--sd/source/core/stlpool.cxx57
-rw-r--r--sd/source/core/stlsheet.cxx30
-rw-r--r--sd/source/ui/func/futempl.cxx21
-rw-r--r--sd/source/ui/view/drtxtob1.cxx76
6 files changed, 153 insertions, 41 deletions
diff --git a/sd/inc/stlpool.hxx b/sd/inc/stlpool.hxx
index 31cb81438cd0..7af9fe980c5e 100644
--- a/sd/inc/stlpool.hxx
+++ b/sd/inc/stlpool.hxx
@@ -42,6 +42,7 @@ class SdStyleSheet;
class SdDrawDocument;
class SdPage;
class SfxStyleSheetBase;
+class SvxNumberFormat;
typedef std::map< const SdPage*, SdStyleFamilyRef > SdStyleFamilyMap;
@@ -92,6 +93,7 @@ public:
static SdStyleSheetVector CreateChildList( SdStyleSheet* pSheet );
+ static void setDefaultOutlineNumberFormatBulletAndIndent(sal_uInt16 i, SvxNumberFormat &rNumberFormat);
public:
void throwIfDisposed() throw(::com::sun::star::uno::RuntimeException);
diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx
index 0811142fa1d2..c36d6e052140 100644
--- a/sd/inc/stlsheet.hxx
+++ b/sd/inc/stlsheet.hxx
@@ -39,6 +39,8 @@
#include <boost/scoped_ptr.hpp>
+#include "prlayout.hxx"
+
class ModifyListenerForewarder;
typedef cppu::ImplInheritanceHelper5< SfxUnoStyleSheet,
@@ -75,6 +77,12 @@ public:
static SdStyleSheet* CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily );
+ //Broadcast that a SdStyleSheet has changed, taking into account outline sublevels
+ //which need to be explicitly broadcast as changing if their parent style was
+ //the one that changed
+ static void BroadcastSdStyleSheetChange(SfxStyleSheetBase* pStyleSheet, PresentationObjects ePO,
+ SfxStyleSheetBasePool* pSSPool);
+
// XInterface
virtual void SAL_CALL release( ) throw () SAL_OVERRIDE;
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 3d1ee5627b1f..b4d262174483 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -1052,9 +1052,49 @@ void SdStyleSheetPool::UpdateStdNames()
}
}
-// Set new SvxNumBulletItem for the respective style sheet
+void SdStyleSheetPool::setDefaultOutlineNumberFormatBulletAndIndent(sal_uInt16 i, SvxNumberFormat &rNumberFormat)
+{
+ rNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
+ rNumberFormat.SetBulletRelSize(45);
+ const short nLSpace = (i + 1) * 1200;
+ rNumberFormat.SetLSpace(nLSpace);
+ rNumberFormat.SetAbsLSpace(nLSpace);
+ short nFirstLineOffset = -600;
+
+ switch(i)
+ {
+ case 0:
+ {
+ nFirstLineOffset = -900;
+ }
+ break;
+ case 1:
+ {
+ rNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
+ rNumberFormat.SetBulletRelSize(75);
+ nFirstLineOffset = -900;
+ }
+ break;
+ case 2:
+ {
+ nFirstLineOffset = -800;
+ }
+ break;
+
+ case 3:
+ {
+ rNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
+ rNumberFormat.SetBulletRelSize(75);
+ }
+ break;
+ }
+
+ rNumberFormat.SetFirstLineOffset(nFirstLineOffset);
+}
+
+// Set new SvxNumBulletItem for the respective style sheet
void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
Font& rBulletFont )
{
@@ -1134,12 +1174,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
SVX_MAX_NUM, false );
for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
{
- aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
- aNumberFormat.SetBulletRelSize(45);
- const short nLSpace = (i + 1) * 1200;
- aNumberFormat.SetLSpace(nLSpace);
- aNumberFormat.SetAbsLSpace(nLSpace);
- short nFirstLineOffset = -600;
+ setDefaultOutlineNumberFormatBulletAndIndent(i, aNumberFormat);
sal_uLong nFontSize = 20;
switch(i)
@@ -1147,36 +1182,28 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
case 0:
{
nFontSize = 32;
- nFirstLineOffset = -900;
}
break;
case 1:
{
- aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
- aNumberFormat.SetBulletRelSize(75);
nFontSize = 32;
- nFirstLineOffset = -900;
}
break;
case 2:
{
nFontSize = 28;
- nFirstLineOffset = -800;
}
break;
case 3:
{
- aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
- aNumberFormat.SetBulletRelSize(75);
nFontSize = 24;
}
break;
}
- aNumberFormat.SetFirstLineOffset(nFirstLineOffset);
nFontSize = (sal_uInt16)((nFontSize * 2540L) / 72); // Pt --> 1/100 mm
rBulletFont.SetSize(Size(0,846)); // 24 pt
aNumberFormat.SetBulletFont(&rBulletFont);
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index eb7862fa50fa..ec7512da3e7b 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -1352,12 +1352,38 @@ Any SAL_CALL SdStyleSheet::getPropertyDefault( const OUString& aPropertyName ) t
return aRet;
}
-
-
/** this is used because our property map is not sorted yet */
const SfxItemPropertySimpleEntry* SdStyleSheet::getPropertyMapEntry( const OUString& rPropertyName ) const throw (css::uno::RuntimeException)
{
return GetStylePropertySet().getPropertyMapEntry(rPropertyName);
}
+//Broadcast that a SdStyleSheet has changed, taking into account outline sublevels
+//which need to be explicitly broadcast as changing if their parent style was
+//the one that changed
+void SdStyleSheet::BroadcastSdStyleSheetChange(SfxStyleSheetBase* pStyleSheet,
+ PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool)
+{
+ SdStyleSheet* pRealSheet =((SdStyleSheet*)pStyleSheet)->GetRealStyleSheet();
+ pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+
+ if( (ePO >= PO_OUTLINE_1) && (ePO <= PO_OUTLINE_8) )
+ {
+ OUString sStyleName(SD_RESSTR(STR_PSEUDOSHEET_OUTLINE) + " ");
+
+ for( sal_uInt16 n = (sal_uInt16)(ePO - PO_OUTLINE_1 + 2); n < 10; n++ )
+ {
+ OUString aName( sStyleName + OUString::number(n) );
+
+ SfxStyleSheetBase* pSheet = pSSPool->Find( aName, SD_STYLE_FAMILY_PSEUDO);
+
+ if(pSheet)
+ {
+ SdStyleSheet* pRealStyleSheet = ((SdStyleSheet*)pSheet)->GetRealStyleSheet();
+ pRealStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+ }
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx
index c6d1b6d2c12a..0c5444c23cb7 100644
--- a/sd/source/ui/func/futempl.cxx
+++ b/sd/source/ui/func/futempl.cxx
@@ -429,27 +429,8 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
}
}
- OUString sStyleName(SD_RESSTR(STR_PSEUDOSHEET_OUTLINE) + " ");
-
pStyleSheet->GetItemSet().Put(aTempSet);
- SdStyleSheet* pRealSheet =((SdStyleSheet*)pStyleSheet)->GetRealStyleSheet();
- pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
-
- if( (ePO >= PO_OUTLINE_1) && (ePO <= PO_OUTLINE_8) )
- {
- for( sal_uInt16 n = (sal_uInt16)(ePO - PO_OUTLINE_1 + 2); n < 10; n++ )
- {
- OUString aName( sStyleName + OUString::number(n) );
-
- SfxStyleSheetBase* pSheet = pSSPool->Find( aName, SD_STYLE_FAMILY_PSEUDO);
-
- if(pSheet)
- {
- SdStyleSheet* pRealStyleSheet = ((SdStyleSheet*)pSheet)->GetRealStyleSheet();
- pRealStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
- }
- }
- }
+ SdStyleSheet::BroadcastSdStyleSheetChange(pStyleSheet, ePO, pSSPool);
}
SfxItemSet& rAttr = pStyleSheet->GetItemSet();
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index c51ab23c28f6..51cb6e5ddaed 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -57,10 +57,14 @@
#include <editeng/cmapitem.hxx>
#include "app.hrc"
-
+#include "glob.hrc"
+#include "sdresid.hxx"
+#include "prlayout.hxx"
#include "ViewShell.hxx"
#include "drawview.hxx"
#include "drawdoc.hxx"
+#include "stlpool.hxx"
+#include "stlsheet.hxx"
#include "OutlineView.hxx"
#include "Window.hxx"
#include "futempl.hxx"
@@ -316,10 +320,74 @@ void TextObjectBar::Execute( SfxRequest &rReq )
break;
case FN_NUM_BULLET_ON:
- if( pOLV )
- pOLV->ToggleBullets();
- break;
+ {
+ if (pOLV)
+ {
+ bool bMasterPage = false;
+ SdrPageView* pPageView = mpView->GetSdrPageView();
+ if (pPageView)
+ {
+ SdPage* pPage = (SdPage*)pPageView->GetPage();
+ bMasterPage = pPage && (pPage->GetPageKind() == PK_STANDARD) && pPage->IsMasterPage();
+ }
+ if (!bMasterPage)
+ pOLV->ToggleBullets();
+ else
+ {
+ //Resolves: fdo#78151 in master pages if we toggle bullets on
+ //and off then just disable/enable the bulleting, but do not
+ //change the *level* of the paragraph, because the paragraph is
+ //effectively a preview of the equivalent style level, and
+ //changing the level disconnects it from the style
+
+ ::Outliner* pOL = pOLV->GetOutliner();
+ if (pOL)
+ {
+ const SvxNumBulletItem *pItem = NULL;
+ SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool();
+ OUString sStyleName(SD_RESSTR(STR_PSEUDOSHEET_OUTLINE) + " 1");
+ SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find(sStyleName, SD_STYLE_FAMILY_PSEUDO);
+ if( pFirstStyleSheet )
+ pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, (const SfxPoolItem**)&pItem);
+
+ if (pItem )
+ {
+ SvxNumRule aNewRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+ ESelection aSel = pOLV->GetSelection();
+ aSel.Adjust();
+ sal_Int32 nStartPara = aSel.nStartPara;
+ sal_Int32 nEndPara = aSel.nEndPara;
+ for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara)
+ {
+ sal_uInt16 nLevel = pOL->GetDepth(nPara);
+ SvxNumberFormat aFmt(aNewRule.GetLevel(nLevel));
+
+ if (aFmt.GetNumberingType() == SVX_NUM_NUMBER_NONE)
+ {
+ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ SdStyleSheetPool::setDefaultOutlineNumberFormatBulletAndIndent(nLevel, aFmt);
+ }
+ else
+ {
+ aFmt.SetNumberingType(SVX_NUM_NUMBER_NONE);
+ aFmt.SetLSpace(0);
+ aFmt.SetAbsLSpace(0);
+ aFmt.SetFirstLineOffset(0);
+ }
+
+ aNewRule.SetLevel(nLevel, aFmt);
+ }
+
+ pFirstStyleSheet->GetItemSet().Put(SvxNumBulletItem(aNewRule, EE_PARA_NUMBULLET));
+
+ SdStyleSheet::BroadcastSdStyleSheetChange(pFirstStyleSheet, PO_OUTLINE_1, pSSPool);
+ }
+ }
+ }
+ }
+ break;
+ }
case SID_GROW_FONT_SIZE:
case SID_SHRINK_FONT_SIZE:
{