[Libreoffice-commits] core.git: cui/source editeng/source include/editeng include/svx sd/qa sd/source svx/source sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 22 16:39:29 UTC 2020


 cui/source/tabpages/autocdlg.cxx          |    4 ++--
 cui/source/tabpages/numpages.cxx          |    3 ++-
 editeng/source/uno/unonrule.cxx           |    5 +++--
 include/editeng/swafopt.hxx               |    5 +++--
 include/svx/nbdtmg.hxx                    |    2 +-
 sd/qa/unit/import-tests.cxx               |    4 ++--
 sd/source/ui/dlg/BulletAndPositionDlg.cxx |    2 +-
 svx/source/sidebar/nbdtmg.cxx             |   26 ++++++++++++++++----------
 sw/source/core/edit/autofmt.cxx           |    4 ++--
 sw/source/filter/ww8/ww8par2.cxx          |    5 ++++-
 sw/source/filter/ww8/ww8par3.cxx          |    5 +++--
 11 files changed, 39 insertions(+), 26 deletions(-)

New commits:
commit 8898955456ce6a6dc0ce9401ee05ce9d04e13668
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 22 10:34:21 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 22 18:38:44 2020 +0200

    Related: tdf#132970 handle more places with potentially utf16 bullets
    
    Change-Id: Iac6b319700d610b5a1debff0a633172b2411c40e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103161
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index a51ed1f32b6b..211b131f3f9c 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -534,10 +534,10 @@ void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet* )
     const ACFlags nFlags = pAutoCorrect->GetFlags();
 
     aBulletFont = pOpt->aBulletFont;
-    sBulletChar = OUString(pOpt->cBullet);
+    sBulletChar = OUString(&pOpt->cBullet, 1);
 
     aByInputBulletFont = pOpt->aByInputBulletFont;
-    sByInputBulletChar = OUString( pOpt->cByInputBullet );
+    sByInputBulletChar = OUString(&pOpt->cByInputBullet, 1);
 
     nPercent = pOpt->nRightMargin;
     sMargin = unicode::formatPercent(nPercent, Application::GetSettings().GetUILanguageTag());
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 141021652ac4..4eb04ec24b40 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -688,8 +688,9 @@ IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
             else
                 aFmt.SetBulletFont( &rActBulletFont );
 
+            sal_Int32 nIndexUtf16 = 0;
             aFmt.SetBulletChar( !pLevelSettings->sBulletChar.isEmpty()
-                                    ? pLevelSettings->sBulletChar[0]
+                                    ? pLevelSettings->sBulletChar.iterateCodePoints(&nIndexUtf16)
                                     : 0 );
             aFmt.SetCharFormatName( sBulletCharFormatName );
             aFmt.SetBulletRelSize(45);
diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index 57b68a0de1d3..03b766d446d7 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -206,7 +206,7 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex(sal
 
     if(SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
     {
-        sal_Unicode nCode = rFmt.GetBulletChar();
+        sal_UCS4 nCode = rFmt.GetBulletChar();
         OUString aStr( &nCode, 1 );
         aVal <<= aStr;
         beans::PropertyValue aBulletProp( "BulletChar", -1, aVal, beans::PropertyState_DIRECT_VALUE);
@@ -324,7 +324,8 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex(const Sequence<beans::Propert
             {
                 if(!aStr.isEmpty())
                 {
-                    aFmt.SetBulletChar(aStr[0]);
+                    sal_Int32 nIndexUtf16 = 0;
+                    aFmt.SetBulletChar(aStr.iterateCodePoints(&nIndexUtf16));
                 }
                 else
                 {
diff --git a/include/editeng/swafopt.hxx b/include/editeng/swafopt.hxx
index 4fd1207cefb4..ccdcf9955982 100644
--- a/include/editeng/swafopt.hxx
+++ b/include/editeng/swafopt.hxx
@@ -26,6 +26,7 @@
 #include <o3tl/sorted_vector.hxx>
 #include <rtl/ustring.hxx>
 #include <vcl/font.hxx>
+#include <vcl/vclenum.hxx>
 
 class SmartTagMgr;
 
@@ -81,8 +82,8 @@ struct EDITENG_DLLPUBLIC SvxSwAutoFormatFlags
     const editeng::SortedAutoCompleteStrings * m_pAutoCompleteList;
     SmartTagMgr* pSmartTagMgr;
 
-    sal_Unicode cBullet;
-    sal_Unicode cByInputBullet;
+    sal_UCS4 cBullet;
+    sal_UCS4 cByInputBullet;
 
     sal_uInt16 nAutoCmpltWordLen, nAutoCmpltListLen;
     sal_uInt16 nAutoCmpltExpandKey;
diff --git a/include/svx/nbdtmg.hxx b/include/svx/nbdtmg.hxx
index fbecb2719ba0..eceb96b8337e 100644
--- a/include/svx/nbdtmg.hxx
+++ b/include/svx/nbdtmg.hxx
@@ -73,7 +73,7 @@ class  SVX_DLLPUBLIC BulletsSettings
 public:
     vcl::Font       aFont;
     OUString        sDescription;
-    sal_Unicode     cBulletChar;
+    sal_UCS4        cBulletChar;
     bool            bIsCustomized;
     BulletsSettings() : cBulletChar(0), bIsCustomized(false)  {}
 };
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index ccb45ce56695..91d796bc40a8 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -3225,9 +3225,9 @@ void SdImportTest::testTdf49856()
     const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     const SvxNumBulletItem *pNumFmt = aEdit.GetParaAttribs(2).GetItem(EE_PARA_NUMBULLET);
     CPPUNIT_ASSERT(pNumFmt);
-    const sal_Unicode aBullet = pNumFmt->GetNumRule()->GetLevel(0).GetBulletChar();
+    const sal_UCS4 aBullet = pNumFmt->GetNumRule()->GetLevel(0).GetBulletChar();
     CPPUNIT_ASSERT_EQUAL(OUString("More level 2"), aEdit.GetText(2));
-    CPPUNIT_ASSERT_EQUAL(u'\x2022', aBullet);
+    CPPUNIT_ASSERT_EQUAL(sal_UCS4(0x2022), aBullet);
 
     xDocShRef->DoClose();
 }
diff --git a/sd/source/ui/dlg/BulletAndPositionDlg.cxx b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
index 4fa14144beae..45e2a1dffc41 100644
--- a/sd/source/ui/dlg/BulletAndPositionDlg.cxx
+++ b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
@@ -920,7 +920,7 @@ IMPL_LINK_NOARG(SvxBulletAndPositionDlg, BulletHdl_Impl, weld::Button&, void)
     sal_uInt16 nMask = 1;
     const vcl::Font* pFmtFont = nullptr;
     bool bSameBullet = true;
-    sal_Unicode cBullet = 0;
+    sal_UCS4 cBullet = 0;
     bool bFirst = true;
     for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
     {
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index 3d995028bb99..b36e58b6fad1 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -282,7 +282,7 @@ sal_uInt16 BulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLe
         return sal_uInt16(0xFFFF);
 
     const SvxNumberFormat& aFmt(aNum.GetLevel(nActLv));
-    sal_Unicode cChar = aFmt.GetBulletChar();
+    sal_UCS4 cChar = aFmt.GetBulletChar();
     for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++)
     {
         if ( (cChar == pActualBullets[i]->cBulletChar) ||
@@ -310,7 +310,7 @@ void BulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uI
         return;
 
     SvxNumberFormat aFmt(aNum.GetLevel(nActLv));
-    sal_Unicode cChar = aFmt.GetBulletChar();
+    sal_UCS4 cChar = aFmt.GetBulletChar();
     const vcl::Font* pFont = aFmt.GetBulletFont();
     if ( nIndex >= DEFAULT_BULLET_TYPES )
         return;
@@ -325,7 +325,7 @@ void BulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt1
 {
     if ( nIndex >= DEFAULT_BULLET_TYPES )
         return;
-    sal_Unicode cChar = pActualBullets[nIndex]->cBulletChar;
+    sal_UCS4 cChar = pActualBullets[nIndex]->cBulletChar;
     const vcl::Font& rActBulletFont = pActualBullets[nIndex]->aFont;
 
     sal_uInt16 nMask = 1;
@@ -337,7 +337,7 @@ void BulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt1
             SvxNumberFormat aFmt(aNum.GetLevel(i));
             aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL );
             aFmt.SetBulletFont(&rActBulletFont);
-            aFmt.SetBulletChar(cChar );
+            aFmt.SetBulletChar(cChar);
             aFmt.SetCharFormatName(sBulletCharFormatName);
             aFmt.SetPrefix( "" );
             aFmt.SetSuffix( "" );
@@ -648,8 +648,11 @@ sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 /*m
             sal_Int16 eNumType = aFmt.GetNumberingType();
             if( eNumType == SVX_NUM_CHAR_SPECIAL)
             {
-                sal_Unicode cChar = aFmt.GetBulletChar();
-                sal_Unicode ccChar = _pSet->sBulletChar[0];
+                sal_UCS4 cChar = aFmt.GetBulletChar();
+
+                sal_Int32 nIndexUtf16 = 0;
+                sal_UCS4 ccChar = _pSet->sBulletChar.iterateCodePoints(&nIndexUtf16);
+
                 if ( !((cChar == ccChar) &&
                     _pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() &&
                     _pSet->nTabValue == aFmt.GetListtabPos() &&
@@ -726,8 +729,8 @@ void OutlineTypeMgr::RelplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uI
 
         if( eNumType == SVX_NUM_CHAR_SPECIAL)
         {
-            sal_Unicode cChar = aFmt.GetBulletChar();
-            OUString sChar(cChar);
+            sal_UCS4 cChar = aFmt.GetBulletChar();
+            OUString sChar(&cChar, 1);
             _pSet->sBulletChar = sChar;
             if ( aFmt.GetBulletFont() )
                 _pSet->sBulletFont = aFmt.GetBulletFont()->GetFamilyName();
@@ -822,9 +825,12 @@ void OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt1
             }else
                 aFmt.SetBulletFont( &rActBulletFont );
 
-            sal_Unicode cChar = 0;
+            sal_UCS4 cChar = 0;
             if( !pLevelSettings->sBulletChar.isEmpty() )
-                cChar = pLevelSettings->sBulletChar[0];
+            {
+                sal_Int32 nIndexUtf16 = 0;
+                cChar = pLevelSettings->sBulletChar.iterateCodePoints(&nIndexUtf16);
+            }
             if( AllSettings::GetLayoutRTL() )
             {
                 if( 0 == i && cChar == BulletsTypeMgr::aDynamicBulletTypes[5] )
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 48d5befd6308..696d26a2d901 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1527,7 +1527,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
                 if( !aRule.GetNumFormat( nLvl ) )
                 {
                     int nBulletPos = pFndBulletChr - pBulletChar;
-                    sal_Unicode cBullChar;
+                    sal_UCS4 cBullChar;
                     const vcl::Font* pBullFnt( nullptr );
                     if( nBulletPos < cnPosEnDash )
                     {
@@ -1726,7 +1726,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
         {
             OUString sChgStr('\t');
             if( bChgBullet )
-                sChgStr = OUStringChar( m_aFlags.cBullet ) + sChgStr;
+                sChgStr = OUString(&m_aFlags.cBullet, 1) + sChgStr;
             m_pDoc->getIDocumentContentOperations().InsertString( m_aDelPam, sChgStr );
 
             SfxItemSet aSet( m_pDoc->GetAttrPool(), aTextNodeSetRange );
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 292de278ff14..d689ab36acb6 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -669,7 +669,10 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, WW8_ANLV const &rAV,
 
                 // take only the very first character
                 if (rAV.cbTextBefore || rAV.cbTextAfter)
-                    rNum.SetBulletChar( sText[ 0 ] );
+                {
+                    sal_Int32 nIndexUtf16 = 0;
+                    rNum.SetBulletChar(sText.toString().iterateCodePoints(&nIndexUtf16));
+                }
                 else
                     rNum.SetBulletChar( 0x2190 );
             }
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 3fbe650cb51f..6ce373838e23 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -622,7 +622,7 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet
     sal_uInt8       aBits1(0);
     SvxNumType      nType(SVX_NUM_ARABIC);
     SvxAdjust       eAdj;               // Alignment (Left/right/centered)
-    sal_Unicode     cBullet(0x2190);    // default safe bullet
+    sal_UCS4        cBullet(0x2190);    // default safe bullet
 
     sal_Unicode     cGrfBulletCP(USHRT_MAX);
 
@@ -832,7 +832,8 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet
 
     if (style::NumberingType::CHAR_SPECIAL == nType)
     {
-        cBullet = !sNumString.isEmpty() ? sNumString[0] : 0x2190;
+        sal_Int32 nIndexUtf16 = 0;
+        cBullet = !sNumString.isEmpty() ? sNumString.iterateCodePoints(&nIndexUtf16) : 0x2190;
 
         if (!cBullet)  // unsave control code?
             cBullet = 0x2190;


More information about the Libreoffice-commits mailing list