Related: #ii122198# added ColorValueSetColumnCount entry to configuration

default is 12

(cherry picked from commit dc9abefa2d01377b14bef15463e360d9a7e9bdc2)

Conflicts:
	officecfg/registry/schema/org/openoffice/Office/Common.xcs
	svtools/inc/svtools/accessibilityoptions.hxx
	svtools/source/inc/configitems/accessibilityoptions_const.hxx

Change-Id: Ic035b34bbcde426fa8fb76df16f84786908e18fa
diff --git a/include/svtools/accessibilityoptions.hxx b/include/svtools/accessibilityoptions.hxx
index 8760439..ccaff7e 100644
--- a/include/svtools/accessibilityoptions.hxx
+++ b/include/svtools/accessibilityoptions.hxx
@@ -57,6 +57,11 @@ public:
    // is in a ListBox, all will be shown, else a ScrollBar will be used
    sal_Int16   GetListBoxMaximumLineCount() const;

    // option to set the width of ColorValueSets in columns; this allows
    // adaption to own colr set layouts. The default layout is 12 columns and should
    // only be changed when the color palette is changed from the default
    sal_Int16   GetColorValueSetColumnCount() const;

    void        SetIsForPagePreviews(sal_Bool bSet);
    void        SetIsHelpTipsDisappear(sal_Bool bSet);
    void        SetIsAllowAnimatedGraphics(sal_Bool bSet);
@@ -69,6 +74,7 @@ public:

    void        SetEdgeBlending(sal_Int16 nSet);
    void        SetListBoxMaximumLineCount(sal_Int16 nSet);
    void        SetColorValueSetColumnCount(sal_Int16 nSet);

    sal_Bool                IsModified() const;
    void                    Commit();
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 000df4a3..314ee5c 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6238,6 +6238,19 @@
        </info>
        <value>25</value>
      </prop>
      <prop oor:name="ColorValueSetColumnCount" oor:type="xs:short">
        <info>
          <author>ALG</author>
          <desc>
            This option controls how many columns the ColorValueSets (the matrix-organized dialogs for color select)
            will have. The default is 12 and this is aligned with the layout of the standard color palette. thus, when you
            change this value, you should know what you do. This setting also influences some width-oriented layouts in
            dialogs where this ColorValueSets are used, e.g. FillStyle dialog.
          </desc>
          <label>Defines the number of columns that will be shown in a ColorValueSet.</label>
        </info>
        <value>12</value>
      </prop>
    </group>
    <group oor:name="ExternalApps" oor:extensible="true">
      <info>
diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx
index 35e612e..679d7ac 100644
--- a/svtools/source/config/accessibilityoptions.cxx
+++ b/svtools/source/config/accessibilityoptions.cxx
@@ -85,6 +85,7 @@ public:
    sal_Bool    IsSelectionInReadonly() const;
    sal_Int16   GetEdgeBlending() const;
    sal_Int16   GetListBoxMaximumLineCount() const;
    sal_Int16   GetColorValueSetColumnCount() const;

    void        SetAutoDetectSystemHC(sal_Bool bSet);
    void        SetIsForPagePreviews(sal_Bool bSet);
@@ -97,6 +98,7 @@ public:
    void        SetSelectionInReadonly(sal_Bool bSet);
    void        SetEdgeBlending(sal_Int16 nSet);
    void        SetListBoxMaximumLineCount(sal_Int16 nSet);
    void        SetColorValueSetColumnCount(sal_Int16 nSet);

    sal_Bool    IsModified() const { return bIsModified; };
};
@@ -337,6 +339,24 @@ sal_Int16 SvtAccessibilityOptions_Impl::GetListBoxMaximumLineCount() const
    return nRet;
}

sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() const
{
    css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
    sal_Int16 nRet = 12;

    try
    {
        if(xNode.is())
            xNode->getPropertyValue(s_sColorValueSetColumnCount) >>= nRet;
    }
    catch(const css::uno::Exception& ex)
    {
        SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
    }

    return nRet;
}

void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(sal_Bool bSet)
{
    css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
@@ -553,6 +573,16 @@ void SvtAccessibilityOptions_Impl::SetVCLSettings()
        StyleSettingsChanged = true;
    }

    const sal_Int16 nMaxColumnCountA(GetColorValueSetColumnCount());
    OSL_ENSURE(nMaxColumnCountA >= 0, "OOps, negative values for ColorValueSetColumnCount are not allowed (!)");
    const sal_uInt16 nMaxColumnCountB(static_cast< sal_uInt16 >(nMaxColumnCountA >= 0 ? nMaxColumnCountA : 0));

    if(aStyleSettings.GetColorValueSetColumnCount() != nMaxColumnCountB)
    {
        aStyleSettings.SetColorValueSetColumnCount(nMaxColumnCountB);
        StyleSettingsChanged = true;
    }

    if(StyleSettingsChanged)
    {
        aAllSettings.SetStyleSettings(aStyleSettings);
@@ -602,6 +632,26 @@ void SvtAccessibilityOptions_Impl::SetListBoxMaximumLineCount(sal_Int16 nSet)
    }
}

void SvtAccessibilityOptions_Impl::SetColorValueSetColumnCount(sal_Int16 nSet)
{
    css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);

    try
    {
        if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetColumnCount)!=nSet)
        {
            xNode->setPropertyValue(s_sColorValueSetColumnCount, css::uno::makeAny(nSet));
            ::comphelper::ConfigurationHelper::flush(m_xCfg);

            bIsModified = sal_True;
        }
    }
    catch(const css::uno::Exception& ex)
    {
        SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
    }
}

// -----------------------------------------------------------------------
// class SvtAccessibilityOptions --------------------------------------------------

@@ -702,6 +752,10 @@ sal_Int16 SvtAccessibilityOptions::GetListBoxMaximumLineCount() const
{
    return sm_pSingleImplConfig->GetListBoxMaximumLineCount();
}
sal_Int16 SvtAccessibilityOptions::GetColorValueSetColumnCount() const
{
    return sm_pSingleImplConfig->GetColorValueSetColumnCount();
}

// -----------------------------------------------------------------------
void SvtAccessibilityOptions::SetAutoDetectSystemHC(sal_Bool bSet)
@@ -752,6 +806,11 @@ void SvtAccessibilityOptions::SetListBoxMaximumLineCount(sal_Int16 nSet)
{
    sm_pSingleImplConfig->SetListBoxMaximumLineCount(nSet);
}
void SvtAccessibilityOptions::SetColorValueSetColumnCount(sal_Int16 nSet)
{
    sm_pSingleImplConfig->SetColorValueSetColumnCount(nSet);
}

// -----------------------------------------------------------------------

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */