[Libreoffice-commits] core.git: cui/source editeng/source include/svl offapi/com sd/source sfx2/source svx/source

Armin Le Grand (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 8 08:45:01 UTC 2021


 cui/source/tabpages/align.cxx                  |   13 ++++++-------
 cui/source/tabpages/chardlg.cxx                |   21 +++++++++++----------
 editeng/source/uno/unotext.cxx                 |    7 +++----
 include/svl/poolitem.hxx                       |    3 ---
 offapi/com/sun/star/frame/status/ItemState.idl |   11 +++++++++++
 sd/source/core/stlsheet.cxx                    |    1 -
 sd/source/ui/unoidl/unopback.cxx               |    1 -
 sfx2/source/toolbox/tbxitem.cxx                |    2 +-
 svx/source/table/cell.cxx                      |    1 -
 svx/source/unodraw/unoshape.cxx                |    1 -
 10 files changed, 32 insertions(+), 29 deletions(-)

New commits:
commit f3b737ab76efaf1a70dfb22c6b60b08b340cf343
Author:     Armin Le Grand <Armin.Le.Grand at me.com>
AuthorDate: Sat Jun 5 21:30:30 2021 +0200
Commit:     Armin Le Grand <Armin.Le.Grand at me.com>
CommitDate: Tue Jun 8 10:44:21 2021 +0200

    Remove SfxItemState::READONLY
    
    As I experimented with redesigning the whole
    Item/ItemSet/ItemPool paradigm, I alredy checked that
    SfxItemState::READONLY is not used (and no one
    really knows what it should do or stands for).
    Since a removal of complexity is needed to get forward
    with that redesign and I already made some experiences
    in branch item_refactor2, I propose to remove this
    state. It is not really used (gets never set).
    It is mirrored/used in the UNO API in
    css::frame::status::ItemState as 'READ_ONLY', but also
    not used in the office's code. ItenmState itself is
    used in three places, but all set the Item involved
    by using a SfxVoidItem to state SfxItemState::DISABLED,
    which I described in ItemState.idl. This means that
    no state of READ_ONLY in UNO API is ever imported
    to office code as DISABLED state at all, so not
    used.
    I also marked it as deprecated in the *.idl file.
    
    I think - including the experimenting in the
    mentioned branch - that this is safe for now. I
    already run a full 'make check' on the changed stuff.
    
    Change-Id: I8c15cf7b4f803076ecaaea67659f6e022ac7ef70
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116752
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at me.com>

diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index 142a229f92eb..5ca1e49c8178 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -398,7 +398,6 @@ namespace
                 rTriState.bTriStateEnabled = false;
                 break;
             case SfxItemState::DISABLED:
-            case SfxItemState::READONLY:
                 rBtn.set_sensitive(false);
                 rTriState.bTriStateEnabled = false;
                 break;
@@ -437,7 +436,7 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
             m_xLbHorAlign->hide();
             break;
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_xLbHorAlign->set_sensitive(false);
             break;
         case SfxItemState::DONTCARE:
@@ -481,7 +480,7 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
             m_xFtIndent->hide();
             break;
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_xEdIndent->set_sensitive(false);
             break;
         case SfxItemState::DONTCARE:
@@ -505,7 +504,7 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
             m_xFtVerAlign->hide();
             break;
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_xLbVerAlign->set_sensitive(false);
             break;
         case SfxItemState::DONTCARE:
@@ -546,7 +545,7 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
             m_xCtrlDialWin->hide();
             break;
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_xNfRotate->set_sensitive(false);
             m_xCtrlDialWin->set_sensitive(false);
             break;
@@ -570,7 +569,7 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
             m_xVsRefEdge->hide();
             break;
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_xVsRefEdge->set_sensitive(false);
             break;
         case SfxItemState::DONTCARE:
@@ -609,7 +608,7 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
             m_xLbFrameDir->hide();
             break;
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_xLbFrameDir->set_sensitive(false);
             break;
         case SfxItemState::DONTCARE:
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 5a40fed3fc00..9755bb7024af 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -770,7 +770,7 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
     else
     {
         pSizeBox->set_active_or_entry_text(OUString());
-        if ( eState <= SfxItemState::READONLY )
+        if ( eState <= SfxItemState::DISABLED )
         {
             pSizeBox->set_sensitive(false);
             pSizeLabel->set_sensitive(false);
@@ -794,7 +794,7 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
             break;
 
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             pLangFT->set_sensitive(false);
             pLangBox->set_sensitive(false);
             break;
@@ -1521,7 +1521,7 @@ void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet )
             break;
 
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_xFontColorFT->set_sensitive(false);
             m_xFontColorLB->set_sensitive(false);
             break;
@@ -1806,7 +1806,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
             break;
 
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_aIndividualWordsState.bTriStateEnabled = false;
             m_xIndividualWordsBtn->set_sensitive(false);
             break;
@@ -1860,7 +1860,8 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
         m_xEmphasisFT->hide();
         m_xEmphasisLB->hide();
     }
-    else // SfxItemState::DISABLED or SfxItemState::READONLY
+//    else // SfxItemState::DISABLED or SfxItemState::READONLY
+    else // SfxItemState::DISABLED
     {
         m_xEmphasisFT->set_sensitive(false);
         m_xEmphasisLB->set_sensitive(false);
@@ -1884,7 +1885,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
             break;
 
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_xEffectsFT->set_sensitive(false);
             m_xEffectsLB->set_sensitive(false);
             break;
@@ -1914,7 +1915,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
             break;
 
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_xReliefFT->set_sensitive(false);
             m_xReliefLB->set_sensitive(false);
             break;
@@ -1944,7 +1945,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
             break;
 
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_aOutlineState.bTriStateEnabled = false;
             m_xOutlineBtn->set_sensitive(false);
             break;
@@ -1976,7 +1977,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
             break;
 
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_aShadowState.bTriStateEnabled = false;
             m_xShadowBtn->set_sensitive(false);
             break;
@@ -2008,7 +2009,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
             break;
 
         case SfxItemState::DISABLED:
-        case SfxItemState::READONLY:
+//        case SfxItemState::READONLY:
             m_aHiddenState.bTriStateEnabled = false;
             m_xHiddenBtn->set_sensitive(false);
             break;
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 09351574a13e..68f3319d1b69 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -964,7 +964,6 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert
                             }
                             break;
 
-                        case SfxItemState::READONLY:
                         case SfxItemState::SET:
                             if( eItemState != SfxItemState::SET )
                             {
@@ -1004,7 +1003,7 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert
             case SfxItemState::DONTCARE:
             case SfxItemState::DISABLED:
                 return beans::PropertyState_AMBIGUOUS_VALUE;
-            case SfxItemState::READONLY:
+//            case SfxItemState::READONLY:
             case SfxItemState::SET:
                 return beans::PropertyState_DIRECT_VALUE;
             case SfxItemState::DEFAULT:
@@ -1095,7 +1094,7 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const Sf
                             }
                             break;
 
-                        case SfxItemState::READONLY:
+//                        case SfxItemState::READONLY:
                         case SfxItemState::SET:
                             if( eItemState != SfxItemState::SET )
                             {
@@ -1131,7 +1130,7 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const Sf
 
         switch( eItemState )
         {
-                case SfxItemState::READONLY:
+//                case SfxItemState::READONLY:
                 case SfxItemState::SET:
                     rState = beans::PropertyState_DIRECT_VALUE;
                     break;
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
index 8ccf65e5565c..7dbd7d85c24b 100644
--- a/include/svl/poolitem.hxx
+++ b/include/svl/poolitem.hxx
@@ -86,9 +86,6 @@ enum class SfxItemState {
     /** Specifies that the property is currently disabled. */
     DISABLED = 0x0001,
 
-    /** Specifies that the property is currently read-only. */
-    READONLY = 0x0002,
-
     /** Specifies that the property is currently in a don't care state.
      * <br/>
      * This is normally used if a selection provides more than one state
diff --git a/offapi/com/sun/star/frame/status/ItemState.idl b/offapi/com/sun/star/frame/status/ItemState.idl
index 2b915be01705..e2de7538775a 100644
--- a/offapi/com/sun/star/frame/status/ItemState.idl
+++ b/offapi/com/sun/star/frame/status/ItemState.idl
@@ -41,6 +41,17 @@ constants ItemState
     const short DISABLED       = 1;
 
     /** specifies that the property is currently read-only.
+     *
+     * Deprecated: There is no equivalent in SfxItemState
+     * anymore due to not being used, so remove for simplification
+     * reasons and to prepare rework of Item/ItemSet/ItemPool stuff.
+     *
+     * There are only three usages of ::ItemState in the code which
+     * all set the internal SfxItem to SfxVoidItem when triggered,
+     * which is equlivalent to state SfxItemState::DISABLED (see
+     * e.g. SfxItemSet::GetItemState), so READ_ONLY gets not used
+     * in internal handling, even when eventually existing UNO API
+     * usages hand it over the office.
      */
     const short READ_ONLY      = 2;
 
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 81c047b70c8a..93bc3f0c8ac0 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -1194,7 +1194,6 @@ PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyN
 
         switch( rStyleSet.GetItemState( pEntry->nWID, false ) )
         {
-        case SfxItemState::READONLY:
         case SfxItemState::SET:
             eState = PropertyState_DIRECT_VALUE;
             break;
diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx
index 7a017b8d531a..573e22411066 100644
--- a/sd/source/ui/unoidl/unopback.cxx
+++ b/sd/source/ui/unoidl/unopback.cxx
@@ -321,7 +321,6 @@ beans::PropertyState SAL_CALL SdUnoPageBackground::getPropertyState( const OUStr
 
         switch( mpSet->GetItemState( pEntry->nWID, false ) )
         {
-        case SfxItemState::READONLY:
         case SfxItemState::SET:
             return beans::PropertyState_DIRECT_VALUE;
         case SfxItemState::DEFAULT:
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 2212494dc1d4..0ac302d49ce3 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -409,7 +409,7 @@ void SAL_CALL SfxToolBoxControl::statusChanged( const FeatureStateEvent& rEvent
                 SfxItemState tmpState = static_cast<SfxItemState>(aItemStatus.State);
                 // make sure no-one tries to send us a combination of states
                 if (tmpState != SfxItemState::UNKNOWN && tmpState != SfxItemState::DISABLED &&
-                    tmpState != SfxItemState::READONLY && tmpState != SfxItemState::DONTCARE &&
+                    tmpState != SfxItemState::DONTCARE &&
                     tmpState != SfxItemState::DEFAULT && tmpState != SfxItemState::SET)
                     throw css::uno::RuntimeException("unknown status");
                 eState = tmpState;
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 6e46f2a60ed6..eafaea0a1fa7 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -1415,7 +1415,6 @@ PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName )
 
             switch( rSet.GetItemState( pMap->nWID, false ) )
             {
-            case SfxItemState::READONLY:
             case SfxItemState::SET:
                 eState = PropertyState_DIRECT_VALUE;
                 break;
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 984356691261..fd5296007a1d 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1992,7 +1992,6 @@ beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName )
 
         switch( rSet.GetItemState( pMap->nWID, false ) )
         {
-        case SfxItemState::READONLY:
         case SfxItemState::SET:
             eState = beans::PropertyState_DIRECT_VALUE;
             break;


More information about the Libreoffice-commits mailing list