implement small-size variant stock image buttons

Change-Id: I82d5a957b5c38b8aa19e28ceb8d6850c0bf7526e
diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index 3273f17..ebda427 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -119,7 +119,14 @@ private:
    typedef std::map<OString, OString> WidgetTranslations;
    typedef std::map<OString, WidgetTranslations> Translations;

    typedef std::map<OString, OString> StockMap;
    struct stockinfo
    {
        OString m_sStock;
        int m_nSize;
        stockinfo() : m_nSize(4) {}
    };

    typedef std::map<OString, stockinfo> StockMap;

    struct ParserState
    {
diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx
index af5d182..478ec9a 100644
--- a/vcl/inc/vcl/button.hxx
+++ b/vcl/inc/vcl/button.hxx
@@ -56,7 +56,6 @@ public:
    SAL_DLLPRIVATE void             ImplSetFocusRect( const Rectangle &rFocusRect );
    SAL_DLLPRIVATE const Rectangle& ImplGetFocusRect() const;
    SAL_DLLPRIVATE void             ImplSetSymbolAlign( SymbolAlign eAlign );
    SAL_DLLPRIVATE void             ImplSetSmallSymbol( sal_Bool bSmall = sal_True );
    /// The x-coordinate of the vertical separator line, use in MenuButton subclass only.
    SAL_DLLPRIVATE long             ImplGetSeparatorX() const;
    SAL_DLLPRIVATE void             ImplSetSeparatorX( long nX );
@@ -85,7 +84,8 @@ public:
    void                EnableTextDisplay( sal_Bool bEnable );

    void                SetFocusRect( const Rectangle& rFocusRect );
    bool IsSmallSymbol () const;
    bool IsSmallSymbol() const;
    void SetSmallSymbol(bool bSmall = true);
};

// --------------------
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 85c7b3f..82d0378 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -65,8 +65,8 @@ class ImplCommonButtonData
public:
    Rectangle       maFocusRect;
    long            mnSeparatorX;
    sal_uInt16          mnButtonState;
    sal_Bool            mbSmallSymbol;
    sal_uInt16      mnButtonState;
    bool            mbSmallSymbol;

    Image           maImage;
    ImageAlign      meImageAlign;
@@ -79,7 +79,7 @@ public:

// -----------------------------------------------------------------------
ImplCommonButtonData::ImplCommonButtonData() : maFocusRect(), mnSeparatorX(0), mnButtonState(0),
mbSmallSymbol(sal_False), maImage(), meImageAlign(IMAGEALIGN_TOP), meSymbolAlign(SYMBOLALIGN_LEFT)
mbSmallSymbol(false), maImage(), meImageAlign(IMAGEALIGN_TOP), meSymbolAlign(SYMBOLALIGN_LEFT)
{
}

@@ -580,7 +580,7 @@ void Button::ImplSetSymbolAlign( SymbolAlign eAlign )
}

// -----------------------------------------------------------------------
void Button::ImplSetSmallSymbol( sal_Bool bSmall )
void Button::SetSmallSymbol(bool bSmall)
{
    mpButtonData->mbSmallSymbol = bSmall;
}
diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx
index edf124a..6109045 100644
--- a/vcl/source/control/morebtn.cxx
+++ b/vcl/source/control/morebtn.cxx
@@ -53,8 +53,8 @@ void MoreButton::ImplInit( Window* pParent, WinBits nStyle )

    ShowState();

    SetSymbolAlign( SYMBOLALIGN_RIGHT );
    ImplSetSmallSymbol( sal_True );
    SetSymbolAlign(SYMBOLALIGN_RIGHT);
    SetSmallSymbol(true);

    if ( ! ( nStyle & ( WB_RIGHT | WB_LEFT ) ) )
    {
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index beb0449..52d57a1 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -228,19 +228,30 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
            continue;
        aImagesToBeRemoved.insert(aI->m_sValue);

        VclBuilder::stringmap::iterator aFind = m_pParserState->m_aStockMap.find(aI->m_sValue);
        VclBuilder::StockMap::iterator aFind = m_pParserState->m_aStockMap.find(aI->m_sValue);
        if (aFind == m_pParserState->m_aStockMap.end())
            pTarget->SetModeImage(pImage->GetImage());
        else
        {
            const OString &rImage = aFind->second;
            SymbolType eType = mapStockToSymbol(rImage);
            const stockinfo &rImageInfo = aFind->second;
            SymbolType eType = mapStockToSymbol(rImageInfo.m_sStock);
            SAL_WARN_IF(eType == SYMBOL_NOSYMBOL, "vcl", "missing stock image element for button");
            if (eType == SYMBOL_NOSYMBOL)
                continue;
            pTarget->SetSymbol(eType);
            if (eType == SYMBOL_IMAGE)
                pTarget->SetModeImage(Bitmap(VclResId(mapStockToImageResource(rImage))));
                pTarget->SetModeImage(Bitmap(VclResId(mapStockToImageResource(rImageInfo.m_sStock))));
            switch (rImageInfo.m_nSize)
            {
                case 1:
                    pTarget->SetSmallSymbol();
                    break;
                case 4:
                    break;
                default:
                    SAL_WARN("vcl.layout", "unsupported image size " << rImageInfo.m_nSize);
                    break;
            }
        }
    }

@@ -672,8 +683,16 @@ bool VclBuilder::extractStock(const OString &id, stringmap &rMap)
    VclBuilder::stringmap::iterator aFind = rMap.find(OString("stock"));
    if (aFind != rMap.end())
    {
        m_pParserState->m_aStockMap[id] = aFind->second;
        stockinfo aInfo;
        aInfo.m_sStock = aFind->second;
        rMap.erase(aFind);
        aFind = rMap.find(OString("icon-size"));
        if (aFind != rMap.end())
        {
            aInfo.m_nSize = aFind->second.toInt32();
            rMap.erase(aFind);
        }
        m_pParserState->m_aStockMap[id] = aInfo;
        return true;
    }
    return false;
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 0e63800f..7005257 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -591,12 +591,6 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont
    mpForwardBtn->SetStyle( mpForwardBtn->GetStyle() | WB_BEVELBUTTON );
    mpBackwardBtn->SetStyle( mpBackwardBtn->GetStyle() | WB_BEVELBUTTON );

    // set symbols on forward and backward button
    mpBackwardBtn->SetSymbol( SYMBOL_PREV );
    mpForwardBtn->SetSymbol( SYMBOL_NEXT );
    mpBackwardBtn->ImplSetSmallSymbol( sal_True );
    mpForwardBtn->ImplSetSmallSymbol( sal_True );

    maPageStr = mpNumPagesText->GetText();

    // init reverse print
diff --git a/vcl/uiconfig/ui/printdialog.ui b/vcl/uiconfig/ui/printdialog.ui
index a0204b5..4cdc1c2 100644
--- a/vcl/uiconfig/ui/printdialog.ui
+++ b/vcl/uiconfig/ui/printdialog.ui
@@ -36,12 +36,10 @@
            <child>
              <object class="GtkButton" id="ok">
                <property name="label">gtk-ok</property>
                <property name="use_action_appearance">False</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="has_default">True</property>
                <property name="receives_default">True</property>
                <property name="use_action_appearance">False</property>
                <property name="use_stock">True</property>
              </object>
              <packing>
@@ -53,11 +51,9 @@
            <child>
              <object class="GtkButton" id="cancel">
                <property name="label">gtk-cancel</property>
                <property name="use_action_appearance">False</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="use_action_appearance">False</property>
                <property name="use_stock">True</property>
              </object>
              <packing>
@@ -69,11 +65,9 @@
            <child>
              <object class="GtkButton" id="help">
                <property name="label">gtk-help</property>
                <property name="use_action_appearance">False</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="use_action_appearance">False</property>
                <property name="use_stock">True</property>
              </object>
              <packing>
@@ -146,13 +140,10 @@
                    </child>
                    <child>
                      <object class="GtkButton" id="forward">
                        <property name="label">gtk-media-next</property>
                        <property name="use_action_appearance">False</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="receives_default">True</property>
                        <property name="use_action_appearance">False</property>
                        <property name="use_stock">True</property>
                        <property name="image">image2</property>
                      </object>
                      <packing>
                        <property name="expand">False</property>
@@ -163,13 +154,10 @@
                    </child>
                    <child>
                      <object class="GtkButton" id="backward">
                        <property name="label">gtk-media-previous</property>
                        <property name="use_action_appearance">False</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="receives_default">True</property>
                        <property name="use_action_appearance">False</property>
                        <property name="use_stock">True</property>
                        <property name="image">image1</property>
                      </object>
                      <packing>
                        <property name="expand">False</property>
@@ -334,13 +322,11 @@
                                <child>
                                  <object class="GtkButton" id="setup">
                                    <property name="label" translatable="yes">Properties...</property>
                                    <property name="use_action_appearance">False</property>
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="receives_default">True</property>
                                    <property name="halign">end</property>
                                    <property name="valign">start</property>
                                    <property name="use_action_appearance">False</property>
                                  </object>
                                  <packing>
                                    <property name="left_attach">1</property>
@@ -461,13 +447,11 @@
                                    <child>
                                      <object class="GtkCheckButton" id="collate">
                                        <property name="label" translatable="yes">Collate</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="visible">True</property>
                                        <property name="sensitive">False</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">False</property>
                                        <property name="margin_right">7</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="xalign">0</property>
                                        <property name="draw_indicator">True</property>
                                      </object>
@@ -521,11 +505,9 @@
                                    <child>
                                      <object class="GtkRadioButton" id="printallsheets">
                                        <property name="label" translatable="yes">All sheets</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">False</property>
                                        <property name="no_show_all">True</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="xalign">0</property>
                                        <property name="active">True</property>
                                        <property name="draw_indicator">True</property>
@@ -540,11 +522,9 @@
                                    <child>
                                      <object class="GtkRadioButton" id="printselectedsheets">
                                        <property name="label" translatable="yes">Selected sheets</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">False</property>
                                        <property name="no_show_all">True</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="xalign">0</property>
                                        <property name="draw_indicator">True</property>
                                        <property name="group">printselectedcells</property>
@@ -558,11 +538,9 @@
                                    <child>
                                      <object class="GtkRadioButton" id="printselectedcells">
                                        <property name="label" translatable="yes">Selected cells</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">False</property>
                                        <property name="no_show_all">True</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="xalign">0</property>
                                        <property name="draw_indicator">True</property>
                                        <property name="group">printallsheets</property>
@@ -602,11 +580,9 @@
                                    <child>
                                      <object class="GtkRadioButton" id="printallpages">
                                        <property name="label" translatable="yes">All pages</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">False</property>
                                        <property name="no_show_all">True</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="xalign">0</property>
                                        <property name="draw_indicator">True</property>
                                        <property name="group">printpages</property>
@@ -624,11 +600,9 @@
                                        <child>
                                          <object class="GtkRadioButton" id="printpages">
                                            <property name="label" translatable="yes">Pages</property>
                                            <property name="use_action_appearance">False</property>
                                            <property name="can_focus">True</property>
                                            <property name="receives_default">False</property>
                                            <property name="no_show_all">True</property>
                                            <property name="use_action_appearance">False</property>
                                            <property name="xalign">0</property>
                                            <property name="draw_indicator">True</property>
                                            <property name="group">printselection</property>
@@ -662,11 +636,9 @@
                                    <child>
                                      <object class="GtkRadioButton" id="printselection">
                                        <property name="label" translatable="yes">Selection</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">False</property>
                                        <property name="no_show_all">True</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="xalign">0</property>
                                        <property name="draw_indicator">True</property>
                                        <property name="group">printallpages</property>
@@ -680,11 +652,9 @@
                                    <child>
                                      <object class="GtkCheckButton" id="reverseorder">
                                        <property name="label" translatable="yes">Print in reverse page order</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="visible">True</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">False</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="xalign">0</property>
                                        <property name="draw_indicator">True</property>
                                      </object>
@@ -993,11 +963,9 @@
                                    <child>
                                      <object class="GtkRadioButton" id="pagespersheetbtn">
                                        <property name="label" translatable="yes">Pages per sheet</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="visible">True</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">False</property>
                                        <property name="use_action_appearance">False</property>
                                        <property name="xalign">0</property>
                                        <property name="active">True</property>
                                        <property name="draw_indicator">True</property>
@@ -1030,11 +998,9 @@
                                <child>
                                  <object class="GtkRadioButton" id="brochure">
                                    <property name="label" translatable="yes">Brochure</property>
                                    <property name="use_action_appearance">False</property>
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="receives_default">False</property>
                                    <property name="use_action_appearance">False</property>
                                    <property name="xalign">0</property>
                                    <property name="active">True</property>
                                    <property name="draw_indicator">True</property>
@@ -1237,13 +1203,11 @@
                                <child>
                                  <object class="GtkCheckButton" id="bordercb">
                                    <property name="label" translatable="yes">Draw a border around each page</property>
                                    <property name="use_action_appearance">False</property>
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="receives_default">False</property>
                                    <property name="halign">start</property>
                                    <property name="margin_left">12</property>
                                    <property name="use_action_appearance">False</property>
                                    <property name="xalign">0</property>
                                    <property name="draw_indicator">True</property>
                                  </object>
@@ -1408,11 +1372,9 @@
                            <child>
                              <object class="GtkCheckButton" id="printtofile">
                                <property name="label" translatable="yes">Print to file</property>
                                <property name="use_action_appearance">False</property>
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="receives_default">False</property>
                                <property name="use_action_appearance">False</property>
                                <property name="xalign">0</property>
                                <property name="draw_indicator">True</property>
                              </object>
@@ -1426,11 +1388,9 @@
                            <child>
                              <object class="GtkCheckButton" id="singleprintjob">
                                <property name="label" translatable="yes">Create single print jobs for collated output</property>
                                <property name="use_action_appearance">False</property>
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="receives_default">False</property>
                                <property name="use_action_appearance">False</property>
                                <property name="xalign">0</property>
                                <property name="draw_indicator">True</property>
                              </object>
@@ -1444,10 +1404,8 @@
                            <child>
                              <object class="GtkCheckButton" id="printpaperfromsetup">
                                <property name="label" translatable="yes">Use only paper tray from printer preferences</property>
                                <property name="use_action_appearance">False</property>
                                <property name="can_focus">True</property>
                                <property name="receives_default">False</property>
                                <property name="use_action_appearance">False</property>
                                <property name="xalign">0</property>
                                <property name="draw_indicator">True</property>
                              </object>
@@ -1510,6 +1468,18 @@
      <action-widget response="0">help</action-widget>
    </action-widgets>
  </object>
  <object class="GtkImage" id="image1">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="stock">gtk-media-previous</property>
    <property name="icon-size">1</property>
  </object>
  <object class="GtkImage" id="image2">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="stock">gtk-media-next</property>
    <property name="icon-size">1</property>
  </object>
  <object class="GtkListStore" id="liststore1">
    <columns>
      <!-- column-name gchararray1 -->