Add new customize and position merged dialog

Change-Id: I898fb0830a9f53da4a7917cb5900f082e3a9d6b7
Reviewed-on: https://gerrit.libreoffice.org/71944
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index 629da3f..2d46420 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_Library_set_precompiled_header,cui,$(SRCDIR)/cui/inc/pch/precom

$(eval $(call gb_Library_add_defs,cui,\
    $(if $(filter TRUE,$(ENABLE_GTK)),-DENABLE_GTK) \
    -DCUI_DLLIMPLEMENTATION \
))

$(eval $(call gb_Library_use_custom_headers,cui,\
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index 4b087d9..a20d96e 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
	cui/uiconfig/ui/borderareatransparencydialog \
	cui/uiconfig/ui/borderbackgrounddialog \
	cui/uiconfig/ui/borderpage \
	cui/uiconfig/ui/bulletandposition \
	cui/uiconfig/ui/breaknumberoption \
	cui/uiconfig/ui/calloutdialog \
	cui/uiconfig/ui/calloutpage \
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index 48cd29e..7999aab 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -37,7 +37,7 @@
#include <comphelper/dispatchcommand.hxx>

#include <dialmgr.hxx>
#include <cuicharmap.hxx>
#include <cui/cuicharmap.hxx>
#include <sfx2/request.hxx>
#include <sfx2/sfxsids.hrc>
#include <sfx2/app.hxx>
diff --git a/cui/source/factory/cuiexp.cxx b/cui/source/factory/cuiexp.cxx
index e3c1332..7c46eee 100644
--- a/cui/source/factory/cuiexp.cxx
+++ b/cui/source/factory/cuiexp.cxx
@@ -38,7 +38,7 @@
#include <postdlg.hxx>
#include <passwdomdlg.hxx>
#include <screenshotannotationdlg.hxx>
#include <cuicharmap.hxx>
#include <cui/cuicharmap.hxx>
#include <cuihyperdlg.hxx>
#include <cfgutil.hxx>
#include <SignatureLineDialog.hxx>
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 7cb8b43..ca48341 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -32,7 +32,7 @@
#include <dstribut.hxx>
#include <cuiimapwnd.hxx>
#include <hlmarkwn.hxx>
#include <cuicharmap.hxx>
#include <cui/cuicharmap.hxx>
#include <srchxtra.hxx>
#include <textanim.hxx>
#include <autocdlg.hxx>
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index f0e7fc9..1a64bc9 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -775,7 +775,6 @@ public:
    // #i68101#
    virtual VclPtr<AbstractSvxObjectNameDialog> CreateSvxObjectNameDialog(weld::Window* pParent, const OUString& rName) override;
    virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription) override;

    virtual VclPtr<AbstractSvxMultiPathDialog>    CreateSvxMultiPathDialog(weld::Window* pParent) override;
    virtual VclPtr<AbstractSvxMultiPathDialog>    CreateSvxPathSelectDialog(weld::Window* pParent) override;
    virtual VclPtr<AbstractSvxHpLinkDlg>          CreateSvxHpLinkDlg(vcl::Window* pParent, SfxBindings* pBindings) override;
diff --git a/cui/source/factory/init.cxx b/cui/source/factory/init.cxx
index f4b0b67..eb3a99d 100644
--- a/cui/source/factory/init.cxx
+++ b/cui/source/factory/init.cxx
@@ -17,7 +17,7 @@
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#include <cuicharmap.hxx>
#include <cui/cuicharmap.hxx>

// hook to call special character dialog for edits
// caution: needs C-Linkage since dynamically loaded via symbol name
diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx
deleted file mode 100644
index 95e65f1..0000000
--- a/cui/source/inc/cuicharmap.hxx
+++ /dev/null
@@ -1,177 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */
#ifndef INCLUDED_CUI_SOURCE_INC_CUICHARMAP_HXX
#define INCLUDED_CUI_SOURCE_INC_CUICHARMAP_HXX

#include <vcl/customweld.hxx>
#include <vcl/weld.hxx>
#include <vcl/virdev.hxx>
#include <sfx2/basedlgs.hxx>
#include <svl/itemset.hxx>
#include <svx/charmap.hxx>
#include <svx/searchcharmap.hxx>
#include <sfx2/charwin.hxx>

using namespace ::com::sun::star;
class SubsetMap;

#define CHARMAP_MAXLEN  32

namespace svx
{
    struct SvxShowCharSetItem;
}

class SvxShowText : public weld::CustomWidgetController
{
private:
    ScopedVclPtr<VirtualDevice> m_xVirDev;
    OUString m_sText;
    long mnY;
    bool mbCenter;
    vcl::Font m_aFont;

    virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
    virtual void Resize() override;
    virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
public:
    SvxShowText(const VclPtr<VirtualDevice>& rVirDev);

    void            SetFont(const vcl::Font& rFont);
    vcl::Font const & GetFont() const { return m_aFont; }
    void            SetText(const OUString& rText);
    OUString const & GetText() const { return m_sText; }
    void            SetCentered(bool bCenter) { mbCenter = bCenter; }

    Size            get_preferred_size() const { return GetDrawingArea()->get_preferred_size(); }
};

/** The main purpose of this dialog is to enable the use of characters
    that are not easily accessible from the keyboard. */
class SvxCharacterMap : public SfxDialogController
{
private:

    void            init();

    ScopedVclPtr<VirtualDevice> m_xVirDev;
    vcl::Font           aFont;
    std::unique_ptr<const SubsetMap> pSubsetMap;
    bool                isSearchMode;
    css::uno::Reference<css::frame::XFrame> m_xFrame;
    std::deque<OUString> maRecentCharList;
    std::deque<OUString> maRecentCharFontList;
    std::deque<OUString> maFavCharList;
    std::deque<OUString> maFavCharFontList;
    uno::Reference< uno::XComponentContext > mxContext;

    SvxCharView m_aRecentCharView[16];
    SvxCharView m_aFavCharView[16];
    SvxShowText m_aShowChar;

    std::unique_ptr<weld::Button>   m_xOKBtn;
    std::unique_ptr<weld::Label>    m_xFontText;
    std::unique_ptr<weld::ComboBox> m_xFontLB;
    std::unique_ptr<weld::Label>    m_xSubsetText;
    std::unique_ptr<weld::ComboBox> m_xSubsetLB;
    std::unique_ptr<weld::Entry>    m_xSearchText;
    std::unique_ptr<weld::Entry>    m_xHexCodeText;
    std::unique_ptr<weld::Entry>    m_xDecimalCodeText;
    std::unique_ptr<weld::Button>   m_xFavouritesBtn;
    std::unique_ptr<weld::Label>    m_xCharName;
    std::unique_ptr<weld::Widget>   m_xRecentGrid;
    std::unique_ptr<weld::Widget>   m_xFavGrid;
    std::unique_ptr<weld::CustomWeld> m_xShowChar;
    std::unique_ptr<weld::CustomWeld> m_xRecentCharView[16];
    std::unique_ptr<weld::CustomWeld>    m_xFavCharView[16];
    std::unique_ptr<SvxShowCharSet> m_xShowSet;
    std::unique_ptr<weld::CustomWeld> m_xShowSetArea;
    std::unique_ptr<SvxSearchCharSet> m_xSearchSet;
    std::unique_ptr<weld::CustomWeld> m_xSearchSetArea;

    std::unique_ptr<SfxAllItemSet>  m_xOutputSet;

    enum class Radix : sal_Int16 {decimal = 10, hexadecimal=16};

    DECL_LINK(FontSelectHdl, weld::ComboBox&, void);
    DECL_LINK(SubsetSelectHdl, weld::ComboBox&, void);
    DECL_LINK(CharDoubleClickHdl, SvxShowCharSet*,void);
    DECL_LINK(CharSelectHdl, SvxShowCharSet*, void);
    DECL_LINK(CharHighlightHdl, SvxShowCharSet*, void);
    DECL_LINK(CharPreSelectHdl, SvxShowCharSet*, void);
    DECL_LINK(FavClickHdl, SvxShowCharSet*,void);
    DECL_LINK(SearchCharDoubleClickHdl, SvxShowCharSet*,void);
    DECL_LINK(SearchCharSelectHdl, SvxShowCharSet*, void);
    DECL_LINK(SearchCharHighlightHdl, SvxShowCharSet*, void);
    DECL_LINK(SearchCharPreSelectHdl, SvxShowCharSet*, void);
    DECL_LINK(DecimalCodeChangeHdl, weld::Entry&, void);
    DECL_LINK(HexCodeChangeHdl, weld::Entry&, void);
    DECL_LINK(CharClickHdl, SvxCharView*, void);
    DECL_LINK(RecentClearClickHdl, SvxCharView*, void);
    DECL_LINK(FavClearClickHdl, SvxCharView*, void);
    DECL_LINK(RecentClearAllClickHdl, SvxCharView*, void);
    DECL_LINK(FavClearAllClickHdl, SvxCharView*, void);
    DECL_LINK(InsertClickHdl, weld::Button&, void);
    DECL_LINK(FavSelectHdl, weld::Button&, void);
    DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
    DECL_LINK(SearchFieldGetFocusHdl, weld::Widget&, void);

    static void fillAllSubsets(weld::ComboBox& rListBox);
    void selectCharByCode(Radix radix);

public:
    SvxCharacterMap(weld::Window* pParent, const SfxItemSet* pSet,
                    const css::uno::Reference<css::frame::XFrame>& rFrame);
    virtual short run() override;

    void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }

    const SfxItemSet* GetOutputItemSet() const { return m_xOutputSet.get(); }

    void            DisableFontSelection();

    const vcl::Font&     GetCharFont() const { return aFont;}
    void            SetCharFont( const vcl::Font& rFont );

    void            SetChar( sal_UCS4 );
    sal_UCS4        GetChar() const;

    void            getRecentCharacterList(); //gets both recent char and recent char font list
    void            updateRecentCharacterList(const OUString& rChar, const OUString& rFont);

    void            getFavCharacterList(); //gets both Fav char and Fav char font list
    void            updateFavCharacterList(const OUString& rChar, const OUString& rFont);
    void            deleteFavCharacterFromList(const OUString& rChar, const OUString& rFont);
    bool            isFavChar(const OUString& sTitle, const OUString& rFont);

    void            updateRecentCharControl();
    void            insertCharToDoc(const OUString& sChar);

    void            updateFavCharControl();
    void            setFavButtonState(const OUString& sTitle, const OUString& rFont);

    void            setCharName(sal_UCS4 nDecimalValue);

    void            toggleSearchView(bool state);
};

#endif


/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index dda1de5..183f1d7 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -28,6 +28,7 @@
#include <editeng/svxenum.hxx>
#include <svtools/ctrlbox.hxx>
#include <vcl/customweld.hxx>
#include <cui/numberingpreview.hxx>

#define MN_GALLERY_ENTRY 100

@@ -38,27 +39,6 @@ class SvxBmpNumValueSet;
class SvxBrushItem;
class ValueSet;

class SvxNumberingPreview : public weld::CustomWidgetController
{
    const SvxNumRule*   pActNum;
    vcl::Font           aStdFont;
    bool                bPosition;
    sal_uInt16          nActLevel;

protected:
    virtual void  Paint( vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect ) override;

public:
    SvxNumberingPreview();

    void    SetNumRule(const SvxNumRule* pNum)
                {pActNum = pNum; Invalidate();};
    void    SetPositionMode()
                    { bPosition = true;}
    void    SetLevel(sal_uInt16 nSet) {nActLevel = nSet;}

};

struct SvxNumSettings_Impl
{
    SvxNumType nNumberType;
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 00c4099..9245e87 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -48,7 +48,7 @@
#include <autocdlg.hxx>
#include <editeng/acorrcfg.hxx>
#include <editeng/svxacorr.hxx>
#include <cuicharmap.hxx>
#include <cui/cuicharmap.hxx>
#include <strings.hrc>
#include <editeng/unolingu.hxx>
#include <dialmgr.hxx>
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 1422602..de5d7e2 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -55,7 +55,7 @@
#include <svx/dlgutil.hxx>
#include <dialmgr.hxx>
#include <sfx2/htmlmode.hxx>
#include <cuicharmap.hxx>
#include <cui/cuicharmap.hxx>
#include "chardlg.h"
#include <editeng/emphasismarkitem.hxx>
#include <editeng/charreliefitem.hxx>
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 4c8a9bd..eb43563 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -38,7 +38,7 @@
#include <sfx2/objsh.hxx>
#include <vcl/graph.hxx>
#include <vcl/settings.hxx>
#include <cuicharmap.hxx>
#include <cui/cuicharmap.hxx>
#include <editeng/flstitem.hxx>
#include <svx/dlgutil.hxx>
#include <svx/xtable.hxx>
diff --git a/cui/uiconfig/ui/bulletandposition.ui b/cui/uiconfig/ui/bulletandposition.ui
new file mode 100644
index 0000000..0dbbe04
--- /dev/null
+++ b/cui/uiconfig/ui/bulletandposition.ui
@@ -0,0 +1,1047 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="sd">
  <requires lib="gtk+" version="3.18"/>
  <object class="GtkAdjustment" id="adjustment1">
    <property name="upper">19.989999999999998</property>
    <property name="step_increment">0.050000000000000003</property>
    <property name="page_increment">1</property>
  </object>
  <object class="GtkAdjustment" id="adjustment2">
    <property name="upper">65535</property>
    <property name="step_increment">1</property>
    <property name="page_increment">10</property>
  </object>
  <object class="GtkAdjustment" id="adjustment3">
    <property name="lower">1</property>
    <property name="upper">10</property>
    <property name="step_increment">1</property>
    <property name="page_increment">1</property>
  </object>
  <object class="GtkAdjustment" id="adjustment4">
    <property name="lower">1</property>
    <property name="upper">250</property>
    <property name="step_increment">1</property>
    <property name="page_increment">10</property>
  </object>
  <object class="GtkAdjustment" id="adjustment5">
    <property name="upper">19.989999999999998</property>
    <property name="step_increment">0.050000000000000003</property>
    <property name="page_increment">1</property>
  </object>
  <object class="GtkAdjustment" id="adjustment6">
    <property name="lower">-19.989999999999998</property>
    <property name="upper">19.989999999999998</property>
    <property name="step_increment">0.050000000000000003</property>
    <property name="page_increment">10</property>
  </object>
  <object class="GtkAdjustment" id="adjustment7">
    <property name="upper">19.989999999999998</property>
    <property name="step_increment">0.050000000000000003</property>
    <property name="page_increment">10</property>
  </object>
  <object class="GtkMenu" id="bitmapmenu">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <child>
      <object class="GtkMenuItem" id="fromfile">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label" translatable="yes" context="bulletandposition|fromfile">From file...</property>
        <property name="use_underline">True</property>
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id="gallery">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label" translatable="yes" context="bulletandposition|gallery">Gallery</property>
        <property name="use_underline">True</property>
        <child type="submenu">
          <object class="GtkMenu" id="gallerysubmenu">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
          </object>
        </child>
      </object>
    </child>
  </object>
  <object class="GtkTreeStore" id="liststore1">
    <columns>
      <!-- column-name text -->
      <column type="gchararray"/>
      <!-- column-name id -->
      <column type="gchararray"/>
    </columns>
  </object>
  <object class="GtkDialog" id="BulletAndPosition">
    <property name="height_request">300</property>
    <property name="can_focus">False</property>
    <property name="border_width">6</property>
    <property name="title" translatable="yes" context="bulletandposition|DrawPRTLDialog">Bullets and Numbering</property>
    <property name="modal">True</property>
    <property name="default_width">0</property>
    <property name="default_height">0</property>
    <property name="type_hint">dialog</property>
    <child>
      <placeholder/>
    </child>
    <child internal-child="vbox">
      <object class="GtkBox" id="dialog-vbox1">
        <property name="can_focus">False</property>
        <property name="orientation">vertical</property>
        <property name="spacing">12</property>
        <child internal-child="action_area">
          <object class="GtkButtonBox" id="dialog-action_area1">
            <property name="can_focus">False</property>
            <property name="layout_style">end</property>
            <child>
              <object class="GtkButton" id="reset">
                <property name="label">gtk-revert-to-saved</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="use_stock">True</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkButton" id="ok">
                <property name="label">gtk-ok</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="can_default">True</property>
                <property name="has_default">True</property>
                <property name="receives_default">True</property>
                <property name="use_stock">True</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkButton" id="cancel">
                <property name="label">gtk-cancel</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="use_stock">True</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkButton" id="help">
                <property name="label">gtk-help</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="use_stock">True</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">3</property>
                <property name="secondary">True</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="pack_type">end</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkBox" id="NumberingOptionsPage">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="border_width">6</property>
            <property name="spacing">12</property>
            <child>
              <object class="GtkFrame" id="frame1">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label_xalign">0</property>
                <property name="shadow_type">none</property>
                <child>
                  <object class="GtkAlignment" id="alignment1">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="top_padding">6</property>
                    <child>
                      <object class="GtkScrolledWindow">
                        <property name="width_request">78</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="shadow_type">in</property>
                        <child>
                          <object class="GtkTreeView" id="levellb">
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="vexpand">True</property>
                            <property name="model">liststore1</property>
                            <property name="headers_visible">False</property>
                            <property name="headers_clickable">False</property>
                            <property name="search_column">0</property>
                            <property name="show_expanders">False</property>
                            <child internal-child="selection">
                              <object class="GtkTreeSelection"/>
                            </child>
                            <child>
                              <object class="GtkTreeViewColumn" id="treeviewcolumn1">
                                <child>
                                  <object class="GtkCellRendererText" id="cellrenderertext1"/>
                                  <attributes>
                                    <attribute name="text">0</attribute>
                                  </attributes>
                                </child>
                              </object>
                            </child>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>
                <child type="label">
                  <object class="GtkLabel" id="label1">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="label" translatable="yes" context="bulletandposition|label1">Level</property>
                    <attributes>
                      <attribute name="weight" value="bold"/>
                    </attributes>
                  </object>
                </child>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkBox" id="box1">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="halign">start</property>
                <property name="orientation">vertical</property>
                <property name="spacing">12</property>
                <child>
                  <object class="GtkFrame" id="frame2">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="label_xalign">0</property>
                    <property name="shadow_type">none</property>
                    <child>
                      <object class="GtkAlignment" id="alignment2">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="top_padding">6</property>
                        <property name="left_padding">12</property>
                        <child>
                          <object class="GtkBox" id="box2">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <property name="orientation">vertical</property>
                            <property name="spacing">12</property>
                            <child>
                              <object class="GtkGrid" id="grid3">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="halign">start</property>
                                <property name="column_homogeneous">True</property>
                                <child>
                                  <object class="GtkLabel" id="label4">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="halign">start</property>
                                    <property name="label" translatable="yes" context="bulletandposition|label4">Type:</property>
                                    <property name="use_underline">True</property>
                                    <property name="mnemonic_widget">numfmtlb</property>
                                    <property name="xalign">1</property>
                                  </object>
                                  <packing>
                                    <property name="left_attach">0</property>
                                    <property name="top_attach">0</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkComboBoxText" id="numfmtlb">
                                    <property name="width_request">174</property>
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="halign">start</property>
                                    <property name="valign">start</property>
                                  </object>
                                  <packing>
                                    <property name="left_attach">1</property>
                                    <property name="top_attach">0</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkLabel" id="startatft">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="halign">start</property>
                                    <property name="label" translatable="yes" context="bulletandposition|startatft">Start at:</property>
                                    <property name="use_underline">True</property>
                                    <property name="mnemonic_widget">startat</property>
                                    <property name="xalign">1</property>
                                  </object>
                                  <packing>
                                    <property name="left_attach">0</property>
                                    <property name="top_attach">1</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkSpinButton" id="startat">
                                    <property name="width_request">174</property>
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="halign">start</property>
                                    <property name="activates_default">True</property>
                                    <property name="text" translatable="yes" context="bulletandposition|startat">1</property>
                                    <property name="adjustment">adjustment2</property>
                                    <property name="value">1</property>
                                  </object>
                                  <packing>
                                    <property name="left_attach">1</property>
                                    <property name="top_attach">1</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkLabel" id="bulletft">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="halign">start</property>
                                    <property name="label" translatable="yes" context="bulletandposition|bulletft">Character:</property>
                                    <property name="use_underline">True</property>
                                    <property name="mnemonic_widget">bullet</property>
                                    <property name="xalign">1</property>
                                  </object>
                                  <packing>
                                    <property name="left_attach">0</property>
                                    <property name="top_attach">2</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkButton" id="bullet">
                                    <property name="label" translatable="yes" context="bulletandposition|bullet">Select...</property>
                                    <property name="width_request">174</property>
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="receives_default">True</property>
                                    <property name="halign">start</property>
                                  </object>
                                  <packing>
                                    <property name="left_attach">1</property>
                                    <property name="top_attach">2</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkMenuButton" id="bitmap">
                                    <property name="label" translatable="yes" context="bulletandposition|bitmap">Select image...</property>
                                    <property name="width_request">174</property>
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="receives_default">True</property>
                                    <property name="halign">start</property>
                                    <property name="draw_indicator">True</property>
                                    <property name="popup">bitmapmenu</property>
                                    <child>
                                      <placeholder/>
                                    </child>
                                  </object>
                                  <packing>
                                    <property name="left_attach">1</property>
                                    <property name="top_attach">3</property>
                                  </packing>
                                </child>
                                <child>
                                  <placeholder/>
                                </child>
                              </object>
                              <packing>
                                <property name="expand">False</property>
                                <property name="fill">True</property>
                                <property name="position">0</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkGrid" id="grid2">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="row_spacing">6</property>
                                <property name="column_spacing">2</property>
                                <child>
                                  <object class="GtkBox" id="whbox">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="orientation">vertical</property>
                                    <child>
                                      <object class="GtkGrid">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <child>
                                          <object class="GtkLabel" id="widthft">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label" translatable="yes" context="bulletandposition|widthft">Width:</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">widthmf</property>
                                            <property name="xalign">0</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">0</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkLabel" id="heightft">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label" translatable="yes" context="bulletandposition|heightft">Height:</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">heightmf</property>
                                            <property name="ellipsize">end</property>
                                            <property name="width_chars">7</property>
                                            <property name="xalign">0</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">1</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkSpinButton" id="widthmf">
                                            <property name="visible">True</property>
                                            <property name="can_focus">True</property>
                                            <property name="activates_default">True</property>
                                            <property name="adjustment">adjustment1</property>
                                            <property name="digits">2</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">0</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkSpinButton" id="heightmf">
                                            <property name="visible">True</property>
                                            <property name="can_focus">True</property>
                                            <property name="activates_default">True</property>
                                            <property name="adjustment">adjustment5</property>
                                            <property name="digits">2</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">1</property>
                                          </packing>
                                        </child>
                                      </object>
                                      <packing>
                                        <property name="expand">False</property>
                                        <property name="fill">True</property>
                                        <property name="position">0</property>
                                      </packing>
                                    </child>
                                  </object>
                                  <packing>
                                    <property name="left_attach">0</property>
                                    <property name="top_attach">2</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkBox" id="keepratiobox">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="orientation">vertical</property>
                                    <child>
                                      <object class="GtkCheckButton" id="keepratio">
                                        <property name="label" translatable="yes" context="bulletandposition|keepratio">Keep ratio</property>
                                        <property name="visible">True</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">False</property>
                                        <property name="margin_top">23</property>
                                        <property name="hexpand">True</property>
                                        <property name="use_underline">True</property>
                                        <property name="xalign">0</property>
                                        <property name="draw_indicator">True</property>
                                      </object>
                                      <packing>
                                        <property name="expand">False</property>
                                        <property name="fill">True</property>
                                        <property name="position">0</property>
                                      </packing>
                                    </child>
                                  </object>
                                  <packing>
                                    <property name="left_attach">1</property>
                                    <property name="top_attach">2</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkExpander" id="beforeafter">
                                    <property name="name">beforeafter</property>
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="halign">start</property>
                                    <property name="expanded">True</property>
                                    <child>
                                      <object class="GtkBox">
                                        <property name="width_request">350</property>
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="halign">start</property>
                                        <property name="margin_top">6</property>
                                        <property name="spacing">17</property>
                                        <child>
                                          <object class="GtkLabel" id="prefixft">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label" translatable="yes" context="bulletandposition|prefixft">Before:</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">prefix</property>
                                            <property name="xalign">0</property>
                                          </object>
                                          <packing>
                                            <property name="expand">False</property>
                                            <property name="fill">True</property>
                                            <property name="position">0</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkEntry" id="prefix">
                                            <property name="visible">True</property>
                                            <property name="can_focus">True</property>
                                            <property name="activates_default">True</property>
                                          </object>
                                          <packing>
                                            <property name="expand">False</property>
                                            <property name="fill">True</property>
                                            <property name="position">1</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkLabel" id="suffixft">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label" translatable="yes" context="bulletandposition|suffixft">After:</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">suffix</property>
                                            <property name="xalign">0</property>
                                          </object>
                                          <packing>
                                            <property name="expand">False</property>
                                            <property name="fill">True</property>
                                            <property name="position">2</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkEntry" id="suffix">
                                            <property name="visible">True</property>
                                            <property name="can_focus">True</property>
                                            <property name="activates_default">True</property>
                                          </object>
                                          <packing>
                                            <property name="expand">False</property>
                                            <property name="fill">True</property>
                                            <property name="position">3</property>
                                          </packing>
                                        </child>
                                      </object>
                                    </child>
                                    <child type="label">
                                      <object class="GtkLabel">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="label" translatable="yes" context="bulletandposition|beforeafter">Separator</property>
                                        <attributes>
                                          <attribute name="weight" value="bold"/>
                                        </attributes>
                                      </object>
                                    </child>
                                  </object>
                                  <packing>
                                    <property name="left_attach">0</property>
                                    <property name="top_attach">1</property>
                                    <property name="width">2</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkBox">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="halign">start</property>
                                    <property name="spacing">27</property>
                                    <child>
                                      <object class="GtkLabel" id="colorft">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="label" translatable="yes" context="bulletandposition|colorft">Color:</property>
                                        <property name="use_underline">True</property>
                                        <property name="mnemonic_widget">color</property>
                                        <property name="xalign">1</property>
                                      </object>
                                      <packing>
                                        <property name="expand">False</property>
                                        <property name="fill">True</property>
                                        <property name="position">0</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkMenuButton" id="color">
                                        <property name="visible">True</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">False</property>
                                        <property name="xalign">0</property>
                                        <property name="draw_indicator">True</property>
                                        <child>
                                          <placeholder/>
                                        </child>
                                      </object>
                                      <packing>
                                        <property name="expand">True</property>
                                        <property name="fill">True</property>
                                        <property name="position">1</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkLabel" id="relsizeft">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="label" translatable="yes" context="bulletandposition|relsizeft">_Rel. size:</property>
                                        <property name="use_underline">True</property>
                                        <property name="mnemonic_widget">relsize</property>
                                        <property name="xalign">1</property>
                                      </object>
                                      <packing>
                                        <property name="expand">False</property>
                                        <property name="fill">True</property>
                                        <property name="position">2</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkSpinButton" id="relsize">
                                        <property name="visible">True</property>
                                        <property name="can_focus">True</property>
                                        <property name="activates_default">True</property>
                                        <property name="text" translatable="yes" context="bulletandposition|relsize">100</property>
                                        <property name="adjustment">adjustment4</property>
                                        <property name="value">100</property>
                                      </object>
                                      <packing>
                                        <property name="expand">True</property>
                                        <property name="fill">True</property>
                                        <property name="position">3</property>
                                      </packing>
                                    </child>
                                  </object>
                                  <packing>
                                    <property name="left_attach">0</property>
                                    <property name="top_attach">0</property>
                                    <property name="width">2</property>
                                  </packing>
                                </child>
                              </object>
                              <packing>
                                <property name="expand">False</property>
                                <property name="fill">True</property>
                                <property name="position">1</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkBox">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="orientation">vertical</property>
                                <child>
                                  <object class="GtkExpander">
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="expanded">True</property>
                                    <child>
                                      <object class="GtkGrid">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="margin_top">7</property>
                                        <property name="row_spacing">2</property>
                                        <property name="column_spacing">11</property>
                                        <child>
                                          <object class="GtkLabel" id="indent">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="halign">start</property>
                                            <property name="label" translatable="yes" context="bulletandposition|indent">Indent:</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">indentmf</property>
                                            <property name="xalign">1</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">0</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkLabel" id="numberingwidth">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="halign">start</property>
                                            <property name="label" translatable="yes" context="bulletandposition|numberingwidth">Width:</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">numberingwidthmf</property>
                                            <property name="xalign">1</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">1</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkSpinButton" id="indentmf">
                                            <property name="width_request">170</property>
                                            <property name="visible">True</property>
                                            <property name="can_focus">True</property>
                                            <property name="activates_default">True</property>
                                            <property name="text" translatable="yes" context="bulletandposition|indentmf">0,00</property>
                                            <property name="adjustment">adjustment6</property>
                                            <property name="digits">2</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">0</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkSpinButton" id="numberingwidthmf">
                                            <property name="visible">True</property>
                                            <property name="can_focus">True</property>
                                            <property name="activates_default">True</property>
                                            <property name="text" translatable="yes" context="bulletandposition|numberingwidthmf">0,00</property>
                                            <property name="adjustment">adjustment7</property>
                                            <property name="digits">2</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">1</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkCheckButton" id="relative">
                                            <property name="label" translatable="yes" context="bulletandposition|relative">Relati_ve</property>
                                            <property name="visible">True</property>
                                            <property name="can_focus">True</property>
                                            <property name="receives_default">False</property>
                                            <property name="halign">end</property>
                                            <property name="use_underline">True</property>
                                            <property name="xalign">0</property>
                                            <property name="draw_indicator">True</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">2</property>
                                            <property name="top_attach">0</property>
                                            <property name="height">2</property>
                                          </packing>
                                        </child>
                                      </object>
                                    </child>
                                    <child type="label">
                                      <object class="GtkLabel" id="position">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="label" translatable="yes" context="bulletandposition|position">Position</property>
                                        <attributes>
                                          <attribute name="weight" value="bold"/>
                                        </attributes>
                                      </object>
                                    </child>
                                  </object>
                                  <packing>
                                    <property name="expand">False</property>
                                    <property name="fill">True</property>
                                    <property name="position">0</property>
                                  </packing>
                                </child>
                              </object>
                              <packing>
                                <property name="expand">False</property>
                                <property name="fill">True</property>
                                <property name="position">2</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkExpander">
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="expanded">True</property>
                                <child>
                                  <object class="GtkGrid">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="margin_top">7</property>
                                    <property name="column_spacing">6</property>
                                    <child>
                                      <object class="GtkToggleButton" id="center">
                                        <property name="visible">True</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">True</property>
                                        <property name="always_show_image">True</property>
                                        <child>
                                          <object class="GtkImage">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="stock">gtk-justify-center</property>
                                          </object>
                                        </child>
                                      </object>
                                      <packing>
                                        <property name="left_attach">1</property>
                                        <property name="top_attach">0</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkToggleButton" id="left">
                                        <property name="visible">True</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">True</property>
                                        <property name="margin_left">88</property>
                                        <property name="always_show_image">True</property>
                                        <child>
                                          <object class="GtkImage">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="stock">gtk-justify-left</property>
                                          </object>
                                        </child>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
                                        <property name="top_attach">0</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkToggleButton" id="right">
                                        <property name="visible">True</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">True</property>
                                        <property name="always_show_image">True</property>
                                        <child>
                                          <object class="GtkImage">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="stock">gtk-justify-right</property>
                                          </object>
                                        </child>
                                      </object>
                                      <packing>
                                        <property name="left_attach">2</property>
                                        <property name="top_attach">0</property>
                                      </packing>
                                    </child>
                                  </object>
                                </child>
                                <child type="label">
                                  <object class="GtkLabel" id="ALlabel">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="label" translatable="yes" context="bulletandposition|ALlabel">Alignment</property>
                                    <attributes>
                                      <attribute name="weight" value="bold"/>
                                    </attributes>
                                  </object>
                                </child>
                              </object>
                              <packing>
                                <property name="expand">False</property>
                                <property name="fill">True</property>
                                <property name="position">3</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkExpander">
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="expanded">True</property>
                                <child>
                                  <object class="GtkGrid">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="margin_top">7</property>
                                    <property name="row_spacing">16</property>
                                    <property name="column_spacing">93</property>
                                    <child>
                                      <object class="GtkRadioButton" id="sliderb">
                                        <property name="label" translatable="yes" context="bulletandposition|sliderb">Slide</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="active">True</property>
                                        <property name="draw_indicator">True</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
                                        <property name="top_attach">0</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkRadioButton" id="selectionrb">
                                        <property name="label" translatable="yes" context="bulletandposition|selectionrb">Selection</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="active">True</property>
                                        <property name="draw_indicator">True</property>
                                        <property name="group">sliderb</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
                                        <property name="top_attach">1</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkToggleButton" id="applytomaster">
                                        <property name="label" translatable="yes" context="bulletandposition|applytomaster">Apply to Master</property>
                                        <property name="height_request">34</property>
                                        <property name="visible">True</property>
                                        <property name="can_focus">True</property>
                                        <property name="receives_default">True</property>
                                        <property name="valign">center</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">1</property>
                                        <property name="top_attach">0</property>
                                        <property name="height">2</property>
                                      </packing>
                                    </child>
                                  </object>
                                </child>
                                <child type="label">
                                  <object class="GtkLabel" id="scopelb">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="label" translatable="yes" context="bulletandposition|scopelb">Scope</property>
                                    <attributes>
                                      <attribute name="weight" value="bold"/>
                                    </attributes>
                                  </object>
                                </child>
                              </object>
                              <packing>
                                <property name="expand">False</property>
                                <property name="fill">True</property>
                                <property name="position">4</property>
                              </packing>
                            </child>
                          </object>
                        </child>
                      </object>
                    </child>
                    <child type="label">
                      <object class="GtkLabel" id="label2">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="label" translatable="yes" context="bulletandposition|label2">Properties</property>
                        <attributes>
                          <attribute name="weight" value="bold"/>
                        </attributes>
                      </object>
                    </child>
                  </object>
                  <packing>
                    <property name="expand">False</property>
                    <property name="fill">True</property>
                    <property name="position">0</property>
                  </packing>
                </child>
              </object>
              <packing>
                <property name="expand">True</property>
                <property name="fill">True</property>
                <property name="position">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkFrame" id="frame3">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label_xalign">0</property>
                <property name="shadow_type">none</property>
                <child>
                  <object class="GtkAlignment">
                    <property name="width_request">0</property>
                    <property name="height_request">0</property>
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <child>
                      <object class="GtkScrolledWindow">
                        <property name="width_request">150</property>
                        <property name="height_request">300</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="shadow_type">in</property>
                        <child>
                          <object class="GtkViewport">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <child>
                              <object class="GtkDrawingArea" id="preview">
                                <property name="width_request">150</property>
                                <property name="height_request">300</property>
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                              </object>
                            </child>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>
                <child type="label">
                  <object class="GtkLabel">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="label" translatable="yes" context="bulletandposition|label">Preview</property>
                    <attributes>
                      <attribute name="weight" value="bold"/>
                    </attributes>
                  </object>
                </child>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">2</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">1</property>
          </packing>
        </child>
      </object>
    </child>
    <action-widgets>
      <action-widget response="101">reset</action-widget>
      <action-widget response="-5">ok</action-widget>
      <action-widget response="-6">cancel</action-widget>
      <action-widget response="-11">help</action-widget>
    </action-widgets>
  </object>
</interface>
diff --git a/include/cui/cuicharmap.hxx b/include/cui/cuicharmap.hxx
new file mode 100644
index 0000000..cfe472e
--- /dev/null
+++ b/include/cui/cuicharmap.hxx
@@ -0,0 +1,181 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */
#ifndef INCLUDED_CUI_CUICHARMAP_HXX
#define INCLUDED_CUI_CUICHARMAP_HXX

#include <vcl/customweld.hxx>
#include <vcl/weld.hxx>
#include <vcl/virdev.hxx>
#include <sfx2/basedlgs.hxx>
#include <svl/itemset.hxx>
#include <svx/charmap.hxx>
#include <svx/searchcharmap.hxx>
#include <sfx2/charwin.hxx>
#include <cui/cuidllapi.h>

using namespace ::com::sun::star;
class SubsetMap;

#define CHARMAP_MAXLEN 32

namespace svx
{
struct SvxShowCharSetItem;
}

class CUI_DLLPUBLIC SvxShowText : public weld::CustomWidgetController
{
private:
    ScopedVclPtr<VirtualDevice> m_xVirDev;
    OUString m_sText;
    long mnY;
    bool mbCenter;
    vcl::Font m_aFont;

    virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
    virtual void Resize() override;
    virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;

public:
    SvxShowText(const VclPtr<VirtualDevice>& rVirDev);

    void SetFont(const vcl::Font& rFont);
    vcl::Font const& GetFont() const { return m_aFont; }
    void SetText(const OUString& rText);
    OUString const& GetText() const { return m_sText; }
    void SetCentered(bool bCenter) { mbCenter = bCenter; }

    Size get_preferred_size() const { return GetDrawingArea()->get_preferred_size(); }
};

/** The main purpose of this dialog is to enable the use of characters
    that are not easily accessible from the keyboard. */
class CUI_DLLPUBLIC SvxCharacterMap : public SfxDialogController
{
private:
    void init();

    ScopedVclPtr<VirtualDevice> m_xVirDev;
    vcl::Font aFont;
    std::unique_ptr<const SubsetMap> pSubsetMap;
    bool isSearchMode;
    css::uno::Reference<css::frame::XFrame> m_xFrame;
    std::deque<OUString> maRecentCharList;
    std::deque<OUString> maRecentCharFontList;
    std::deque<OUString> maFavCharList;
    std::deque<OUString> maFavCharFontList;
    uno::Reference<uno::XComponentContext> mxContext;

    SvxCharView m_aRecentCharView[16];
    SvxCharView m_aFavCharView[16];
    SvxShowText m_aShowChar;

    std::unique_ptr<weld::Button> m_xOKBtn;
    std::unique_ptr<weld::Label> m_xFontText;
    std::unique_ptr<weld::ComboBox> m_xFontLB;
    std::unique_ptr<weld::Label> m_xSubsetText;
    std::unique_ptr<weld::ComboBox> m_xSubsetLB;
    std::unique_ptr<weld::Entry> m_xSearchText;
    std::unique_ptr<weld::Entry> m_xHexCodeText;
    std::unique_ptr<weld::Entry> m_xDecimalCodeText;
    std::unique_ptr<weld::Button> m_xFavouritesBtn;
    std::unique_ptr<weld::Label> m_xCharName;
    std::unique_ptr<weld::Widget> m_xRecentGrid;
    std::unique_ptr<weld::Widget> m_xFavGrid;
    std::unique_ptr<weld::CustomWeld> m_xShowChar;
    std::unique_ptr<weld::CustomWeld> m_xRecentCharView[16];
    std::unique_ptr<weld::CustomWeld> m_xFavCharView[16];
    std::unique_ptr<SvxShowCharSet> m_xShowSet;
    std::unique_ptr<weld::CustomWeld> m_xShowSetArea;
    std::unique_ptr<SvxSearchCharSet> m_xSearchSet;
    std::unique_ptr<weld::CustomWeld> m_xSearchSetArea;

    std::unique_ptr<SfxAllItemSet> m_xOutputSet;

    enum class Radix : sal_Int16
    {
        decimal = 10,
        hexadecimal = 16
    };

    DECL_LINK(FontSelectHdl, weld::ComboBox&, void);
    DECL_LINK(SubsetSelectHdl, weld::ComboBox&, void);
    DECL_LINK(CharDoubleClickHdl, SvxShowCharSet*, void);
    DECL_LINK(CharSelectHdl, SvxShowCharSet*, void);
    DECL_LINK(CharHighlightHdl, SvxShowCharSet*, void);
    DECL_LINK(CharPreSelectHdl, SvxShowCharSet*, void);
    DECL_LINK(FavClickHdl, SvxShowCharSet*, void);
    DECL_LINK(SearchCharDoubleClickHdl, SvxShowCharSet*, void);
    DECL_LINK(SearchCharSelectHdl, SvxShowCharSet*, void);
    DECL_LINK(SearchCharHighlightHdl, SvxShowCharSet*, void);
    DECL_LINK(SearchCharPreSelectHdl, SvxShowCharSet*, void);
    DECL_LINK(DecimalCodeChangeHdl, weld::Entry&, void);
    DECL_LINK(HexCodeChangeHdl, weld::Entry&, void);
    DECL_LINK(CharClickHdl, SvxCharView*, void);
    DECL_LINK(RecentClearClickHdl, SvxCharView*, void);
    DECL_LINK(FavClearClickHdl, SvxCharView*, void);
    DECL_LINK(RecentClearAllClickHdl, SvxCharView*, void);
    DECL_LINK(FavClearAllClickHdl, SvxCharView*, void);
    DECL_LINK(InsertClickHdl, weld::Button&, void);
    DECL_LINK(FavSelectHdl, weld::Button&, void);
    DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
    DECL_LINK(SearchFieldGetFocusHdl, weld::Widget&, void);

    static void fillAllSubsets(weld::ComboBox& rListBox);
    void selectCharByCode(Radix radix);

public:
    SvxCharacterMap(weld::Window* pParent, const SfxItemSet* pSet,
                    const css::uno::Reference<css::frame::XFrame>& rFrame);
    virtual short run() override;

    void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }

    const SfxItemSet* GetOutputItemSet() const { return m_xOutputSet.get(); }

    void DisableFontSelection();

    const vcl::Font& GetCharFont() const { return aFont; }
    void SetCharFont(const vcl::Font& rFont);

    void SetChar(sal_UCS4);
    sal_UCS4 GetChar() const;

    void getRecentCharacterList(); //gets both recent char and recent char font list
    void updateRecentCharacterList(const OUString& rChar, const OUString& rFont);

    void getFavCharacterList(); //gets both Fav char and Fav char font list
    void updateFavCharacterList(const OUString& rChar, const OUString& rFont);
    void deleteFavCharacterFromList(const OUString& rChar, const OUString& rFont);
    bool isFavChar(const OUString& sTitle, const OUString& rFont);

    void updateRecentCharControl();
    void insertCharToDoc(const OUString& sChar);

    void updateFavCharControl();
    void setFavButtonState(const OUString& sTitle, const OUString& rFont);

    void setCharName(sal_UCS4 nDecimalValue);

    void toggleSearchView(bool state);
};

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cui/cuidllapi.h b/include/cui/cuidllapi.h
new file mode 100644
index 0000000..12277c6
--- /dev/null
+++ b/include/cui/cuidllapi.h
@@ -0,0 +1,23 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef INCLUDED_CUI_CUIDLLAPI_H
#define INCLUDED_CUI_CUIDLLAPI_H

#include <sal/types.h>

#if defined(CUI_DLLIMPLEMENTATION)
#define CUI_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
#else
#define CUI_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
#endif

#endif // INCLUDED_CUI_CUIDLLAPI_H

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cui/numberingpreview.hxx b/include/cui/numberingpreview.hxx
new file mode 100644
index 0000000..0d6d01d
--- /dev/null
+++ b/include/cui/numberingpreview.hxx
@@ -0,0 +1,31 @@
#ifndef INCLUDED_CUI_NUMBERINGPREVIEW_HXX
#define INCLUDED_CUI_NUMBERINGPREVIEW_HXX

#include <cui/cuidllapi.h>
#include <editeng/numitem.hxx>
#include <vcl/customweld.hxx>

class CUI_DLLPUBLIC SvxNumberingPreview : public weld::CustomWidgetController
{
    const SvxNumRule* pActNum;
    vcl::Font aStdFont;
    bool bPosition;
    sal_uInt16 nActLevel;

protected:
    virtual void Paint(vcl::RenderContext& rRenderContext,
                       const ::tools::Rectangle& rRect) override;

public:
    SvxNumberingPreview();

    void SetNumRule(const SvxNumRule* pNum)
    {
        pActNum = pNum;
        Invalidate();
    };
    void SetPositionMode() { bPosition = true; }
    void SetLevel(sal_uInt16 nSet) { nActLevel = nSet; }
};

#endif
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index 266eb4c..8469d9f 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -31,6 +31,10 @@
#include <svx/svxdllapi.h>
#include <vector>

namespace sd {
    class View;
}

namespace com{namespace sun{namespace star{
namespace linguistic2{
    class XDictionary;
@@ -202,6 +206,16 @@ public:
    virtual void GetDescription(OUString& rDescription) = 0;
};

class AbstractSvxBulletAndPositionDlg :public VclAbstractDialog
{
protected:
    virtual ~AbstractSvxBulletAndPositionDlg() override = default;
public:
    virtual const SfxItemSet*   GetOutputItemSet( SfxItemSet* pSet) const = 0 ;
    virtual bool IsApplyToMaster() = 0;
    virtual bool IsSlideScope() = 0;
};

class AbstractSvxMessDialog :public VclAbstractDialog
{
protected:
@@ -391,7 +405,6 @@ public:
    // #i68101#
    virtual VclPtr<AbstractSvxObjectNameDialog> CreateSvxObjectNameDialog(weld::Window* pParent, const OUString& rName) = 0;
    virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription) = 0;

    virtual VclPtr<AbstractSvxMultiPathDialog>    CreateSvxMultiPathDialog(weld::Window* pParent) = 0 ;
    virtual VclPtr<AbstractSvxMultiPathDialog>    CreateSvxPathSelectDialog(weld::Window* pParent) = 0 ;
    virtual VclPtr<AbstractSvxHpLinkDlg>  CreateSvxHpLinkDlg(vcl::Window* pParent, SfxBindings* pBindings)=0;
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 4c40a79..ac2fadf 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -287,6 +287,7 @@ class SfxStringItem;
#define SID_PRESENTATION                                ( SID_SVX_START + 157 )
#define SID_PRESENTATION_CURRENT_SLIDE                  ( SID_SVX_START + 158 )
#define SID_REHEARSE_TIMINGS                            ( SID_SVX_START + 159 )
#define SID_NUMBERING_AND_POSITION                      ( SID_SVX_START + 160 )
#define SID_HIDE_SLIDE                                  ( SID_SVX_START + 161 )
#define SID_ATTR_FILL_STYLE                             ( SID_SVX_START + 164 )
#define SID_ATTR_FILL_COLOR                             ( SID_SVX_START + 165 )
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index ee1f797..dbd6912 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -2879,6 +2879,14 @@
          <value>7</value>
        </prop>
      </node>
      <node oor:name=".uno:NumberingAndPosition" oor:op="replace">
        <prop oor:name="Label" oor:type="xs:string">
          <value xml:lang="en-US">Numbering and Position...</value>
        </prop>
        <prop oor:name="Properties" oor:type="xs:int">
          <value>7</value>
        </prop>
      </node>
      <node oor:name=".uno:EditDoc" oor:op="replace">
        <prop oor:name="Label" oor:type="xs:string">
          <value xml:lang="en-US">E~dit Mode</value>
diff --git a/sd/Library_sdui.mk b/sd/Library_sdui.mk
index c2ca40f..73abad7 100644
--- a/sd/Library_sdui.mk
+++ b/sd/Library_sdui.mk
@@ -60,6 +60,7 @@ $(eval $(call gb_Library_use_libraries,sdui,\
    tl \
    utl \
    vcl \
    cui \
))

$(eval $(call gb_Library_add_exception_objects,sdui,\
@@ -91,6 +92,7 @@ $(eval $(call gb_Library_add_exception_objects,sdui,\
    sd/source/ui/dlg/tpoption \
    sd/source/ui/dlg/vectdlg \
    sd/source/ui/dlg/PhotoAlbumDialog \
    sd/source/ui/dlg/BulletAndPositionDlg \
))

# $(WORKDIR)/inc/sd/sddll0.hxx :
diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx
index bdfdaef..90d18bf 100644
--- a/sd/inc/sdabstdlg.hxx
+++ b/sd/inc/sdabstdlg.hxx
@@ -26,6 +26,7 @@
#include <svl/itemset.hxx>
#include <tools/solar.h>
#include <vcl/abstdlg.hxx>
#include <svx/svxdlg.hxx>

#include <com/sun/star/beans/PropertyValue.hpp>

@@ -170,6 +171,7 @@ class SdAbstractDialogFactory
public:
    SD_DLLPUBLIC static SdAbstractDialogFactory*     Create();

    virtual VclPtr<AbstractSvxBulletAndPositionDlg> CreateSvxBulletAndPositionDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) = 0;
    virtual VclPtr<VclAbstractDialog>          CreateBreakDlg(weld::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount ) = 0;
    virtual VclPtr<AbstractCopyDlg>            CreateCopyDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView ) = 0;
    virtual VclPtr<AbstractSdCustomShowDlg>    CreateSdCustomShowDlg(weld::Window* pWindow, SdDrawDocument& rDrawDoc) = 0;
diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc
index 02f7094..38b9491 100644
--- a/sd/inc/strings.hrc
+++ b/sd/inc/strings.hrc
@@ -489,6 +489,8 @@
#define STR_CTRLCLICKHYPERLINK                          NC_("STR_CTRLCLICKHYPERLINK", "%s-click to follow hyperlink: ")
#define STR_CLICKHYPERLINK                              NC_("STR_CLICKHYPERLINK", "Click to open hyperlink: ")

#define RID_SVXSTR_EDIT_GRAPHIC                     NC_("RID_SVXSTR_EDIT_GRAPHIC", "Link")

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 93a30e6..1b0171d 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -710,6 +710,12 @@ interface DrawView
        StateMethod = GetMenuState ;
        MenuConfig = TRUE;
    ]
    SID_NUMBERING_AND_POSITION // ole : no, status : ?
    [
        ExecMethod = FuTemporary ;
        StateMethod = GetMenuState ;
        MenuConfig = TRUE;
    ]
    FN_SVX_SET_BULLET
    [
        ExecMethod = FuTemporary ;
diff --git a/sd/source/ui/dlg/BulletAndPositionDlg.cxx b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
new file mode 100644
index 0000000..a9fc0ad
--- /dev/null
+++ b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
@@ -0,0 +1,1361 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/RelOrientation.hpp>

#include <tools/mapunit.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <editeng/numitem.hxx>
#include <svl/eitem.hxx>
#include <vcl/svapp.hxx>
#include <svx/colorbox.hxx>
#include <svx/strarray.hxx>
#include <svx/gallery.hxx>
#include <svl/urihelper.hxx>
#include <editeng/brushitem.hxx>
#include <svl/intitem.hxx>
#include <sfx2/objsh.hxx>
#include <vcl/graph.hxx>
#include <vcl/settings.hxx>
#include <editeng/flstitem.hxx>
#include <svx/dlgutil.hxx>
#include <svx/xtable.hxx>
#include <svx/drawitem.hxx>
#include <svx/numvset.hxx>
#include <sfx2/htmlmode.hxx>
#include <unotools/pathoptions.hxx>
#include <svtools/ctrltool.hxx>
#include <svtools/unitconv.hxx>
#include <editeng/unolingu.hxx>
#include <com/sun/star/style/NumberingType.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/text/DefaultNumberingProvider.hpp>
#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
#include <com/sun/star/text/XNumberingFormatter.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/text/XNumberingTypeInfo.hpp>
#include <svx/dialogs.hrc>
#include <svx/svxids.hrc>

#include <algorithm>
#include <memory>
#include <vector>
#include <sfx2/opengrf.hxx>

#include <strings.hrc>
#include <sfx2/request.hxx>
#include <svl/aeitem.hxx>
#include <svl/stritem.hxx>
#include <svl/slstitm.hxx>
#include <sfx2/filedlghelper.hxx>
#include <svx/gallery1.hxx>
#include <svx/galtheme.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <rtl/ustring.h>
#include <sal/log.hxx>
#include <vcl/cvtgrf.hxx>
#include <vcl/graphicfilter.hxx>
#include <vcl/virdev.hxx>
#include <svx/SvxNumOptionsTabPageHelper.hxx>
#include <View.hxx>
#include <drawdoc.hxx>
#include <cui/cuicharmap.hxx>
#include <BulletAndPositionDlg.hxx>
#include <sdmod.hxx>
#include <sdpage.hxx>
#include <sdresid.hxx>

#define SHOW_NUMBERING 0
#define SHOW_BULLET 1
#define SHOW_BITMAP 2

#define MAX_BMP_WIDTH 16
#define MAX_BMP_HEIGHT 16

static bool bLastRelative = false;

static const vcl::Font& lcl_GetDefaultBulletFont()
{
    static vcl::Font aDefBulletFont = [&]() {
        vcl::Font tmp("OpenSymbol", "", Size(0, 14));
        tmp.SetCharSet(RTL_TEXTENCODING_SYMBOL);
        tmp.SetFamily(FAMILY_DONTKNOW);
        tmp.SetPitch(PITCH_DONTKNOW);
        tmp.SetWeight(WEIGHT_DONTKNOW);
        tmp.SetTransparent(true);
        return tmp;
    }();
    return aDefBulletFont;
}

class SdDrawDocument;

SvxBulletAndPositionDlg::SvxBulletAndPositionDlg(weld::Window* pWindow, const SfxItemSet& rSet,
                                                 ::sd::View* pView)
    : GenericDialogController(pWindow, "cui/ui/bulletandposition.ui", "BulletAndPosition")
    , bLastWidthModified(false)
    , bModified(false)
    , bPreset(false)
    , bAutomaticCharStyles(true)
    , bHTMLMode(false)
    , bInInitControl(false)
    , bLabelAlignmentPosAndSpaceModeActive(false)
    , bApplyToMaster(false)
    , bIsSlideScope(false)
    , nBullet(0xff)
    , nActNumLvl(1)
    , p_Window(pWindow)
    , nNumItemId(SID_ATTR_NUMBERING_RULE)
    , m_xGrid(m_xBuilder->weld_widget("grid2"))
    , m_xLevelLB(m_xBuilder->weld_tree_view("levellb"))
    , m_xFmtLB(m_xBuilder->weld_combo_box("numfmtlb"))
    , m_xPrefixFT(m_xBuilder->weld_label("prefixft"))
    , m_xPrefixED(m_xBuilder->weld_entry("prefix"))
    , m_xSuffixFT(m_xBuilder->weld_label("suffixft"))
    , m_xSuffixED(m_xBuilder->weld_entry("suffix"))
    , m_xBeforeAfter(m_xBuilder->weld_expander("beforeafter"))
    , m_xBulColorFT(m_xBuilder->weld_label("colorft"))
    , m_xBulColLB(new ColorListBox(m_xBuilder->weld_menu_button("color"), pWindow))
    , m_xBulRelSizeFT(m_xBuilder->weld_label("relsizeft"))
    , m_xBulRelSizeMF(m_xBuilder->weld_metric_spin_button("relsize", FieldUnit::PERCENT))
    , m_xStartFT(m_xBuilder->weld_label("startatft"))
    , m_xStartED(m_xBuilder->weld_spin_button("startat"))
    , m_xBulletFT(m_xBuilder->weld_label("bulletft"))
    , m_xBulletPB(m_xBuilder->weld_button("bullet"))
    , m_xBitmapMB(m_xBuilder->weld_menu_button("bitmap"))
    , m_xWidthFT(m_xBuilder->weld_label("widthft"))
    , m_xWidthMF(m_xBuilder->weld_metric_spin_button("widthmf", FieldUnit::CM))
    , m_xHeightFT(m_xBuilder->weld_label("heightft"))
    , m_xHeightMF(m_xBuilder->weld_metric_spin_button("heightmf", FieldUnit::CM))
    , m_xRatioCB(m_xBuilder->weld_check_button("keepratio"))
    , m_xPreviewWIN(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWIN))
    , m_xDistBorderFT(m_xBuilder->weld_label("indent"))
    , m_xDistBorderMF(m_xBuilder->weld_metric_spin_button("indentmf", FieldUnit::CM))
    , m_xRelativeCB(m_xBuilder->weld_check_button("relative"))
    , m_xIndentFT(m_xBuilder->weld_label("numberingwidth"))
    , m_xIndentMF(m_xBuilder->weld_metric_spin_button("numberingwidthmf", FieldUnit::CM))
    , m_xLeftTB(m_xBuilder->weld_toggle_button("left"))
    , m_xCenterTB(m_xBuilder->weld_toggle_button("center"))
    , m_xRightTB(m_xBuilder->weld_toggle_button("right"))
    , m_xSlideRB(m_xBuilder->weld_radio_button("sliderb"))
    , m_xSelectionRB(m_xBuilder->weld_radio_button("selectionrb"))
    , m_xApplyToMaster(m_xBuilder->weld_toggle_button("applytomaster"))
{
    m_xBulColLB->SetSlotId(SID_ATTR_CHAR_COLOR);
    m_xBulRelSizeMF->set_min(SVX_NUM_REL_SIZE_MIN, FieldUnit::PERCENT);
    m_xBulRelSizeMF->set_increments(5, 50, FieldUnit::PERCENT);
    aActBulletFont = lcl_GetDefaultBulletFont();

    m_xBulletPB->connect_clicked(LINK(this, SvxBulletAndPositionDlg, BulletHdl_Impl));
    m_xFmtLB->connect_changed(LINK(this, SvxBulletAndPositionDlg, NumberTypeSelectHdl_Impl));
    m_xBitmapMB->connect_selected(LINK(this, SvxBulletAndPositionDlg, GraphicHdl_Impl));
    m_xBitmapMB->connect_toggled(LINK(this, SvxBulletAndPositionDlg, PopupActivateHdl_Impl));
    m_xLevelLB->set_selection_mode(SelectionMode::Multiple);
    m_xLevelLB->connect_changed(LINK(this, SvxBulletAndPositionDlg, LevelHdl_Impl));
    m_xWidthMF->connect_value_changed(LINK(this, SvxBulletAndPositionDlg, SizeHdl_Impl));
    m_xHeightMF->connect_value_changed(LINK(this, SvxBulletAndPositionDlg, SizeHdl_Impl));
    m_xRatioCB->connect_toggled(LINK(this, SvxBulletAndPositionDlg, RatioHdl_Impl));
    m_xStartED->connect_changed(LINK(this, SvxBulletAndPositionDlg, EditModifyHdl_Impl));
    m_xPrefixED->connect_changed(LINK(this, SvxBulletAndPositionDlg, EditModifyHdl_Impl));
    m_xSuffixED->connect_changed(LINK(this, SvxBulletAndPositionDlg, EditModifyHdl_Impl));
    m_xBulRelSizeMF->connect_value_changed(LINK(this, SvxBulletAndPositionDlg, BulRelSizeHdl_Impl));
    m_xBulColLB->SetSelectHdl(LINK(this, SvxBulletAndPositionDlg, BulColorHdl_Impl));
    m_xLeftTB->connect_toggled(LINK(this, SvxBulletAndPositionDlg, SelectLeftAlignmentHdl_Impl));
    m_xCenterTB->connect_toggled(
        LINK(this, SvxBulletAndPositionDlg, SelectCenterAlignmentHdl_Impl));
    m_xRightTB->connect_toggled(LINK(this, SvxBulletAndPositionDlg, SelectRightAlignmentHdl_Impl));
    m_xApplyToMaster->connect_toggled(LINK(this, SvxBulletAndPositionDlg, ApplyToMasterHdl_Impl));

    aInvalidateTimer.SetInvokeHandler(
        LINK(this, SvxBulletAndPositionDlg, PreviewInvalidateHdl_Impl));
    aInvalidateTimer.SetTimeout(50);

    eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));

    // Fill ListBox with predefined / translated numbering types.
    sal_uInt32 nCount = SvxNumberingTypeTable::Count();
    for (sal_uInt32 i = 0; i < nCount; ++i)
    {
        m_xFmtLB->append(OUString::number(SvxNumberingTypeTable::GetValue(i)),
                         SvxNumberingTypeTable::GetString(i));
    }

    // Get advanced numbering types from the component.
    // Watch out for the ugly
    // 136 == 0x88 == SVX_NUM_BITMAP|0x80 == SVX_NUM_BITMAP|LINK_TOKEN
    // to not remove that.
    SvxNumOptionsTabPageHelper::GetI18nNumbering(*m_xFmtLB, (SVX_NUM_BITMAP | LINK_TOKEN));

    m_xFmtLB->set_active(0);
    m_xRelativeCB->set_active(true);

    Link<weld::MetricSpinButton&, void> aLk3
        = LINK(this, SvxBulletAndPositionDlg, DistanceHdl_Impl);
    m_xDistBorderMF->connect_value_changed(aLk3);
    m_xIndentMF->connect_value_changed(aLk3);

    m_xRelativeCB->connect_toggled(LINK(this, SvxBulletAndPositionDlg, RelativeHdl_Impl));
    m_xRelativeCB->set_active(bLastRelative);

    Size aSize(m_xGrid->get_preferred_size());
    m_xGrid->set_size_request(aSize.Width(), -1);

    // PageCreated
    FieldUnit eMetric = pView->GetDoc().GetUIUnit();
    SfxAllItemSet aSet(*(rSet.GetPool()));
    aSet.Put(SfxAllEnumItem(SID_METRIC_ITEM, static_cast<sal_uInt16>(eMetric)));

    const SfxStringItem* pNumCharFmt = aSet.GetItem<SfxStringItem>(SID_NUM_CHAR_FMT, false);
    const SfxStringItem* pBulletCharFmt = aSet.GetItem<SfxStringItem>(SID_BULLET_CHAR_FMT, false);
    const SfxAllEnumItem* pMetricItem = aSet.GetItem<SfxAllEnumItem>(SID_METRIC_ITEM, false);

    if (pNumCharFmt && pBulletCharFmt)
        SetCharFmts(pNumCharFmt->GetValue(), pBulletCharFmt->GetValue());

    if (pMetricItem)
        SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));

    // End PageCreated

    Reset(&rSet);

    // ActivatePage part

    const SfxPoolItem* pItem;
    const SfxItemSet* pExampleSet = &rSet;
    sal_uInt16 nTmpNumLvl = 1;
    if (pExampleSet)
    {
        if (SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
            bPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
        if (SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
            nTmpNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
    }
    if (SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
    {
        pSaveNum.reset(new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()));
    }

    bModified = (!pActNum->Get(0) || bPreset);
    if (*pActNum != *pSaveNum || nActNumLvl != nTmpNumLvl)
    {
        nActNumLvl = nTmpNumLvl;
        sal_uInt16 nMask = 1;
        if (nActNumLvl == SAL_MAX_UINT16)
            m_xLevelLB->select(pActNum->GetLevelCount());
        if (nActNumLvl != SAL_MAX_UINT16)
        {
            for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
            {
                if (nActNumLvl & nMask)
                    m_xLevelLB->select(i);
                nMask <<= 1;
            }
        }
        *pActNum = *pSaveNum;

        m_xRelativeCB->set_sensitive(nActNumLvl != 1);

        InitPosAndSpaceMode();
        InitControls();
    }

    m_aPreviewWIN.SetLevel(nActNumLvl);
    m_aPreviewWIN.Invalidate();

    // End of the ActivatePage part
}

SvxBulletAndPositionDlg::~SvxBulletAndPositionDlg() {}

void SvxBulletAndPositionDlg::dispose()
{
    m_xPreviewWIN.reset();
    m_xBulColLB.reset();
    pActNum.reset();
    pSaveNum.reset();
}

void SvxBulletAndPositionDlg::SetMetric(FieldUnit eMetric)
{
    if (eMetric == FieldUnit::MM)
    {
        m_xWidthMF->set_digits(1);
        m_xHeightMF->set_digits(1);
        m_xDistBorderMF->set_digits(1);
        m_xIndentMF->set_digits(1);
    }
    m_xWidthMF->set_unit(eMetric);
    m_xHeightMF->set_unit(eMetric);
    m_xDistBorderMF->set_unit(eMetric);
    m_xIndentMF->set_unit(eMetric);
}

SfxItemSet* SvxBulletAndPositionDlg::GetOutputItemSet(SfxItemSet* pSet)
{
    pSet->Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl));
    if (bModified && pActNum)
    {
        *pSaveNum = *pActNum;
        pSet->Put(SvxNumBulletItem(*pSaveNum, nNumItemId));
        pSet->Put(SfxBoolItem(SID_PARAM_NUM_PRESET, false));
    }
    return pSet;
};

bool SvxBulletAndPositionDlg::IsApplyToMaster() { return bApplyToMaster; }
bool SvxBulletAndPositionDlg::IsSlideScope() { return m_xSlideRB->get_active(); }

void SvxBulletAndPositionDlg::Reset(const SfxItemSet* rSet)
{
    const SfxPoolItem* pItem;
    // in Draw the item exists as WhichId, in Writer only as SlotId
    SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
    if (eState != SfxItemState::SET)
    {
        nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
        eState = rSet->GetItemState(nNumItemId, false, &pItem);

        if (eState != SfxItemState::SET)
        {
            pItem = &static_cast<const SvxNumBulletItem&>(rSet->Get(nNumItemId));
            eState = SfxItemState::SET;
        }
    }
    DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
    pSaveNum.reset(new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()));

    // insert levels
    if (!m_xLevelLB->n_children())
    {
        for (sal_uInt16 i = 1; i <= pSaveNum->GetLevelCount(); i++)
            m_xLevelLB->append_text(OUString::number(i));
        if (pSaveNum->GetLevelCount() > 1)
        {
            OUString sEntry = "1 - " + OUString::number(pSaveNum->GetLevelCount());
            m_xLevelLB->append_text(sEntry);
            m_xLevelLB->select_text(sEntry);
        }
        else
            m_xLevelLB->select(0);
    }
    else
        m_xLevelLB->select(m_xLevelLB->n_children() - 1);

    sal_uInt16 nMask = 1;
    m_xLevelLB->unselect_all();
    if (nActNumLvl == SAL_MAX_UINT16)
    {
        m_xLevelLB->select(pSaveNum->GetLevelCount());
    }
    else
    {
        for (sal_uInt16 i = 0; i < pSaveNum->GetLevelCount(); i++)
        {
            if (nActNumLvl & nMask)
                m_xLevelLB->select(i);
            nMask <<= 1;
        }
    }

    if (!pActNum)
        pActNum.reset(new SvxNumRule(*pSaveNum));
    else if (*pSaveNum != *pActNum)
        *pActNum = *pSaveNum;
    m_aPreviewWIN.SetNumRule(pActNum.get());

    SfxObjectShell* pShell;
    if (SfxItemState::SET == rSet->GetItemState(SID_HTML_MODE, false, &pItem)
        || (nullptr != (pShell = SfxObjectShell::Current())
            && nullptr != (pItem = pShell->GetItem(SID_HTML_MODE))))
    {
        sal_uInt16 nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
        bHTMLMode = 0 != (nHtmlMode & HTMLMODE_ON);
    }

    bool bContinuous = pActNum->IsFeatureSupported(SvxNumRuleFlags::CONTINUOUS);

    // again misusage: in Draw there is numeration only until the bitmap
    // without SVX_NUM_NUMBER_NONE
    //remove types that are unsupported by Draw/Impress
    if (!bContinuous)
    {
        sal_Int32 nFmtCount = m_xFmtLB->get_count();
        for (sal_Int32 i = nFmtCount; i; i--)
        {
            sal_uInt16 nEntryData = m_xFmtLB->get_id(i - 1).toUInt32();
            if (/*SVX_NUM_NUMBER_NONE == nEntryData ||*/
                (SVX_NUM_BITMAP | LINK_TOKEN) == nEntryData)
                m_xFmtLB->remove(i - 1);
        }
    }
    //one must be enabled
    if (!pActNum->IsFeatureSupported(SvxNumRuleFlags::ENABLE_LINKED_BMP))
    {
        auto nPos = m_xFmtLB->find_id(OUString::number(SVX_NUM_BITMAP | LINK_TOKEN));
        if (nPos != -1)
            m_xFmtLB->remove(nPos);
    }
    else if (!pActNum->IsFeatureSupported(SvxNumRuleFlags::ENABLE_EMBEDDED_BMP))
    {
        auto nPos = m_xFmtLB->find_id(OUString::number(SVX_NUM_BITMAP));
        if (nPos != -1)
            m_xFmtLB->remove(nPos);
    }

    // MegaHack: because of a not-fixable 'design mistake/error' in Impress
    // delete all kinds of numeric enumerations
    if (pActNum->IsFeatureSupported(SvxNumRuleFlags::NO_NUMBERS))
    {
        sal_Int32 nFmtCount = m_xFmtLB->get_count();
        for (sal_Int32 i = nFmtCount; i; i--)
        {
            sal_uInt16 nEntryData = m_xFmtLB->get_id(i - 1).toUInt32();
            if (/*nEntryData >= SVX_NUM_CHARS_UPPER_LETTER &&*/ nEntryData <= SVX_NUM_NUMBER_NONE)
                m_xFmtLB->remove(i - 1);
        }
    }

    InitPosAndSpaceMode();

    InitControls();
    bModified = false;
}

void SvxBulletAndPositionDlg::InitControls()
{
    bInInitControl = true;

    const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive && m_xRelativeCB->get_sensitive()
                           && m_xRelativeCB->get_active();
    const bool bSingleSelection
        = m_xLevelLB->count_selected_rows() == 1 && SAL_MAX_UINT16 != nActNumLvl;

    m_xDistBorderMF->set_sensitive(!bLabelAlignmentPosAndSpaceModeActive
                                   && (bSingleSelection || bRelative));
    m_xDistBorderFT->set_sensitive(!bLabelAlignmentPosAndSpaceModeActive
                                   && (bSingleSelection || bRelative));

    bool bShowBullet = true;
    bool bShowBitmap = true;
    bool bSameType = true;
    bool bSameStart = true;
    bool bSamePrefix = true;
    bool bSameSuffix = true;
    bool bAllLevel = true;
    bool bSameCharFmt = true;
    bool bSameVOrient = true;
    bool bSameSize = true;
    bool bSameBulColor = true;
    bool bSameBulRelSize = true;
    bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive;
    bool bSetDistEmpty = false;
    bool bSameIndent = !bLabelAlignmentPosAndSpaceModeActive;

    const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
    OUString sFirstCharFmt;
    sal_Int16 eFirstOrient = text::VertOrientation::NONE;
    SvxAdjust eFirstAdjust = SvxAdjust::Left;
    Size aFirstSize(0, 0);
    sal_uInt16 nMask = 1;
    sal_uInt16 nLvl = SAL_MAX_UINT16;
    sal_uInt16 nHighestLevel = 0;
    (void)nHighestLevel;

    bool bBullColor = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_COLOR);
    bool bBullRelSize = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_REL_SIZE);
    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    {
        if (nActNumLvl & nMask)
        {
            aNumFmtArr[i] = &pActNum->GetLevel(i);
            bShowBullet &= aNumFmtArr[i]->GetNumberingType() == SVX_NUM_CHAR_SPECIAL;
            bShowBitmap &= (aNumFmtArr[i]->GetNumberingType() & (~LINK_TOKEN)) == SVX_NUM_BITMAP;
            eFirstAdjust = aNumFmtArr[i]->GetNumAdjust();
            if (SAL_MAX_UINT16 == nLvl)
            {
                nLvl = i;
                sFirstCharFmt = aNumFmtArr[i]->GetCharFormatName();
                eFirstOrient = aNumFmtArr[i]->GetVertOrient();
                if (bShowBitmap)
                    aFirstSize = aNumFmtArr[i]->GetGraphicSize();
            }
            if (i > nLvl)
            {
                bSameType
                    &= aNumFmtArr[i]->GetNumberingType() == aNumFmtArr[nLvl]->GetNumberingType();
                bSameStart = aNumFmtArr[i]->GetStart() == aNumFmtArr[nLvl]->GetStart();

                bSamePrefix = aNumFmtArr[i]->GetPrefix() == aNumFmtArr[nLvl]->GetPrefix();
                bSameSuffix = aNumFmtArr[i]->GetSuffix() == aNumFmtArr[nLvl]->GetSuffix();
                bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels()
                             == aNumFmtArr[nLvl]->GetIncludeUpperLevels();
                bSameCharFmt &= sFirstCharFmt == aNumFmtArr[i]->GetCharFormatName();
                bSameVOrient &= eFirstOrient == aNumFmtArr[i]->GetVertOrient();
                //bSameAdjust &= eFirstAdjust == aNumFmtArr[i]->GetNumAdjust();
                if (bShowBitmap && bSameSize)
                    bSameSize &= aNumFmtArr[i]->GetGraphicSize() == aFirstSize;
                bSameBulColor
                    &= aNumFmtArr[i]->GetBulletColor() == aNumFmtArr[nLvl]->GetBulletColor();
                bSameBulRelSize
                    &= aNumFmtArr[i]->GetBulletRelSize() == aNumFmtArr[nLvl]->GetBulletRelSize();
                bSameIndent //?
                    &= aNumFmtArr[i]->GetFirstLineOffset()
                       == aNumFmtArr[nLvl]->GetFirstLineOffset();
            }
            nHighestLevel = i;
        }
        else
            aNumFmtArr[i] = nullptr;

        nMask <<= 1;
    }
    SwitchNumberType(bShowBullet ? 1 : bShowBitmap ? 2 : 0);

    sal_uInt16 nNumberingType;
    if (nLvl != SAL_MAX_UINT16)
        nNumberingType = aNumFmtArr[nLvl]->GetNumberingType();
    else
    {
        nNumberingType = SVX_NUM_NUMBER_NONE;
        bAllLevel = false;
        bSameBulRelSize = false;
        bSameBulColor = false;
        bSameStart = false;
        bSamePrefix = false;
        bSameSuffix = false;
    }

    CheckForStartValue_Impl(nNumberingType);

    if (bShowBitmap)
    {
        if (bSameSize)
        {
            SetMetricValue(*m_xHeightMF, aFirstSize.Height(), eCoreUnit);
            SetMetricValue(*m_xWidthMF, aFirstSize.Width(), eCoreUnit);
        }
        else
        {
            m_xHeightMF->set_text("");
            m_xWidthMF->set_text("");
        }
    }

    if (bSameType)
    {
        sal_uInt16 nLBData = nNumberingType;
        m_xFmtLB->set_active_id(OUString::number(nLBData));
    }
    else
        m_xFmtLB->set_active(-1);

    if (bBullRelSize)
    {
        if (bSameBulRelSize)
            m_xBulRelSizeMF->set_value(aNumFmtArr[nLvl]->GetBulletRelSize(), FieldUnit::PERCENT);
        else
            m_xBulRelSizeMF->set_text("");
    }
    if (bBullColor)
    {
        if (bSameBulColor)
            m_xBulColLB->SelectEntry(aNumFmtArr[nLvl]->GetBulletColor());
        else
            m_xBulColLB->SetNoSelection();
    }
    switch (nBullet)
    {
        case SHOW_NUMBERING:
            if (bSameStart)
            {
                m_xStartED->set_value(aNumFmtArr[nLvl]->GetStart());
            }
            else
                m_xStartED->set_text("");
            break;
        case SHOW_BULLET:
            break;
        case SHOW_BITMAP:
            break;
    }

    switch (eFirstAdjust)
    {
        case SvxAdjust::Left:
            m_xLeftTB->set_active(true);
            m_xCenterTB->set_active(false);
            m_xRightTB->set_active(false);
            break;
        case SvxAdjust::Center:
            m_xLeftTB->set_active(false);
            m_xCenterTB->set_active(true);
            m_xRightTB->set_active(false);
            break;
        case SvxAdjust::Right:
            m_xLeftTB->set_active(false);
            m_xCenterTB->set_active(false);
            m_xRightTB->set_active(true);
            break;
        default:
            break;
    }

    if (bSamePrefix)
        m_xPrefixED->set_text(aNumFmtArr[nLvl]->GetPrefix());
    else
        m_xPrefixED->set_text("");
    if (bSameSuffix)
        m_xSuffixED->set_text(aNumFmtArr[nLvl]->GetSuffix());
    else
        m_xSuffixED->set_text("");

    if (bSameDistBorderNum)
    {
        long nDistBorderNum;
        if (bRelative)
        {
            nDistBorderNum = static_cast<long>(aNumFmtArr[nLvl]->GetAbsLSpace())
                             + aNumFmtArr[nLvl]->GetFirstLineOffset();
            if (nLvl)
                nDistBorderNum -= static_cast<long>(aNumFmtArr[nLvl - 1]->GetAbsLSpace())
                                  + aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
        }
        else
        {
            nDistBorderNum = static_cast<long>(aNumFmtArr[nLvl]->GetAbsLSpace())
                             + aNumFmtArr[nLvl]->GetFirstLineOffset();
        }
        SetMetricValue(*m_xDistBorderMF, nDistBorderNum, eCoreUnit);
    }
    else
        bSetDistEmpty = true;

    if (bSetDistEmpty)
        m_xDistBorderMF->set_text("");

    if (bSameIndent)
        SetMetricValue(*m_xIndentMF, -aNumFmtArr[nLvl]->GetFirstLineOffset(), eCoreUnit);
    else
        m_xIndentMF->set_text("");

    m_xSelectionRB->set_active(true);

    m_aPreviewWIN.SetLevel(nActNumLvl);
    m_aPreviewWIN.Invalidate();
    bInInitControl = false;
}

// 0 - Number; 1 - Bullet; 2 - Bitmap
void SvxBulletAndPositionDlg::SwitchNumberType(sal_uInt8 nType)
{
    if (nBullet == nType)
        return;
    nBullet = nType;
    bool bBullet = (nType == SHOW_BULLET);
    bool bBitmap = (nType == SHOW_BITMAP);
    bool bEnableBitmap = (nType == SHOW_BITMAP);
    bool bNumeric = !(bBitmap || bBullet);
    m_xPrefixFT->set_visible(bNumeric);
    m_xPrefixED->set_visible(bNumeric);
    m_xSuffixFT->set_visible(bNumeric);
    m_xSuffixED->set_visible(bNumeric);
    m_xBeforeAfter->set_visible(bNumeric);

    m_xStartFT->set_visible(!(bBullet || bBitmap));
    m_xStartED->set_visible(!(bBullet || bBitmap));

    m_xBulletFT->set_visible(bBullet);
    m_xBulletPB->set_visible(bBullet);
    bool bBullColor = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_COLOR);
    m_xBulColorFT->set_visible(!bBitmap && bBullColor);
    m_xBulColLB->set_visible(!bBitmap && bBullColor);
    bool bBullResSize = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_REL_SIZE);
    m_xBulRelSizeFT->set_visible(!bBitmap && bBullResSize);
    m_xBulRelSizeMF->set_visible(!bBitmap && bBullResSize);

    m_xBitmapMB->set_visible(bBitmap);

    m_xWidthFT->set_visible(bBitmap);
    m_xWidthMF->set_visible(bBitmap);
    m_xHeightFT->set_visible(bBitmap);
    m_xHeightMF->set_visible(bBitmap);
    m_xRatioCB->set_visible(bBitmap);

    m_xWidthFT->set_sensitive(bEnableBitmap);
    m_xWidthMF->set_sensitive(bEnableBitmap);
    m_xHeightFT->set_sensitive(bEnableBitmap);
    m_xHeightMF->set_sensitive(bEnableBitmap);
    m_xRatioCB->set_sensitive(bEnableBitmap);
}

void SvxBulletAndPositionDlg::CheckForStartValue_Impl(sal_uInt16 nNumberingType)
{
    bool bIsNull = m_xStartED->get_value() == 0;
    bool bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC
                          || SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType
                          || SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType;
    m_xStartED->set_min(bNoZeroAllowed ? 1 : 0);
    if (bIsNull && bNoZeroAllowed)
        EditModifyHdl_Impl(*m_xStartED);
}

IMPL_LINK(SvxBulletAndPositionDlg, LevelHdl_Impl, weld::TreeView&, rBox, void)
{
    sal_uInt16 nSaveNumLvl = nActNumLvl;
    nActNumLvl = 0;
    auto aSelectedRows = rBox.get_selected_rows();
    if (std::find(aSelectedRows.begin(), aSelectedRows.end(), pActNum->GetLevelCount())
            != aSelectedRows.end()
        && (aSelectedRows.size() == 1 || nSaveNumLvl != 0xffff))
    {
        nActNumLvl = 0xFFFF;
        for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
            rBox.unselect(i);
    }
    else if (!aSelectedRows.empty())
    {
        sal_uInt16 nMask = 1;
        for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
        {
            if (std::find(aSelectedRows.begin(), aSelectedRows.end(), i) != aSelectedRows.end())
                nActNumLvl |= nMask;
            nMask <<= 1;
        }
        rBox.unselect(pActNum->GetLevelCount());
    }
    else
    {
        nActNumLvl = nSaveNumLvl;
        sal_uInt16 nMask = 1;
        for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
        {
            if (nActNumLvl & nMask)
            {
                rBox.select(i);
                break;
            }
            nMask <<= 1;
        }
    }
    InitControls();
}

IMPL_LINK_NOARG(SvxBulletAndPositionDlg, PreviewInvalidateHdl_Impl, Timer*, void)
{
    m_aPreviewWIN.Invalidate();
}

IMPL_LINK(SvxBulletAndPositionDlg, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox, void)
{
    OUString sSelectStyle;
    bool bBmp = false;
    sal_uInt16 nMask = 1;
    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    {
        if (nActNumLvl & nMask)
        {
            SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
            // PAGEDESC does not exist
            SvxNumType nNumType = static_cast<SvxNumType>(rBox.get_active_id().toUInt32());
            aNumFmt.SetNumberingType(nNumType);
            sal_uInt16 nNumberingType = aNumFmt.GetNumberingType();
            if (SVX_NUM_BITMAP == (nNumberingType & (~LINK_TOKEN)))
            {
                bBmp |= nullptr != aNumFmt.GetBrush();
                aNumFmt.SetIncludeUpperLevels(0);
                aNumFmt.SetSuffix("");
                aNumFmt.SetPrefix("");
                if (!bBmp)
                    aNumFmt.SetGraphic("");
                pActNum->SetLevel(i, aNumFmt);
                SwitchNumberType(SHOW_BITMAP);
            }
            else if (SVX_NUM_CHAR_SPECIAL == nNumberingType)
            {
                aNumFmt.SetIncludeUpperLevels(0);
                aNumFmt.SetSuffix("");
                aNumFmt.SetPrefix("");
                if (!aNumFmt.GetBulletFont())
                    aNumFmt.SetBulletFont(&aActBulletFont);
                if (!aNumFmt.GetBulletChar())
                    aNumFmt.SetBulletChar(SVX_DEF_BULLET);
                pActNum->SetLevel(i, aNumFmt);
                SwitchNumberType(SHOW_BULLET);
                // allocation of the drawing pattern is automatic
                if (bAutomaticCharStyles)
                {
                    sSelectStyle = m_sBulletCharFormatName;
                }
            }
            else
            {
                aNumFmt.SetPrefix(m_xPrefixED->get_text());
                aNumFmt.SetSuffix(m_xSuffixED->get_text());
                SwitchNumberType(SHOW_NUMBERING);
                pActNum->SetLevel(i, aNumFmt);
                CheckForStartValue_Impl(nNumberingType);

                // allocation of the drawing pattern is automatic
                if (bAutomaticCharStyles)
                {
                    sSelectStyle = m_sNumCharFmtName;
                }
            }
        }
        nMask <<= 1;
    }

    SetModified();
}

IMPL_LINK(SvxBulletAndPositionDlg, BulColorHdl_Impl, ColorListBox&, rColorBox, void)
{
    Color nSetColor = rColorBox.GetSelectEntryColor();

    sal_uInt16 nMask = 1;
    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    {
        if (nActNumLvl & nMask)
        {
            SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
            aNumFmt.SetBulletColor(nSetColor);
            pActNum->SetLevel(i, aNumFmt);
        }
        nMask <<= 1;
    }
    SetModified();
}

IMPL_LINK(SvxBulletAndPositionDlg, BulRelSizeHdl_Impl, weld::MetricSpinButton&, rField, void)
{
    sal_uInt16 nRelSize = rField.get_value(FieldUnit::PERCENT);

    sal_uInt16 nMask = 1;
    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    {
        if (nActNumLvl & nMask)
        {
            SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
            aNumFmt.SetBulletRelSize(nRelSize);
            pActNum->SetLevel(i, aNumFmt);
        }
        nMask <<= 1;
    }
    SetModified();
}

IMPL_LINK(SvxBulletAndPositionDlg, GraphicHdl_Impl, const OString&, rIdent, void)
{
    OUString aGrfName;
    Size aSize;
    bool bSucc(false);
    SvxOpenGraphicDialog aGrfDlg(SdResId(RID_SVXSTR_EDIT_GRAPHIC), p_Window);

    OString sNumber;
    if (rIdent.startsWith("gallery", &sNumber))
    {
        auto idx = sNumber.toUInt32();
        if (idx < aGrfNames.size())
        {
            aGrfName = aGrfNames[idx];
            Graphic aGraphic;
            if (GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, idx, &aGraphic))
            {
                aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
                bSucc = true;
            }
        }
    }
    else if (rIdent == "fromfile")
    {
        aGrfDlg.EnableLink(false);
        aGrfDlg.AsLink(false);
        if (!aGrfDlg.Execute())
        {
            // memorize selected filter
            aGrfName = aGrfDlg.GetPath();

            Graphic aGraphic;
            if (!aGrfDlg.GetGraphic(aGraphic))
            {
                aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
                bSucc = true;
            }
        }
    }
    if (bSucc)
    {
        aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(eCoreUnit));

        sal_uInt16 nMask = 1;
        for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
        {
            if (nActNumLvl & nMask)
            {
                SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
                aNumFmt.SetCharFormatName(m_sNumCharFmtName);
                aNumFmt.SetGraphic(aGrfName);

                // set size for a later comparison
                const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
                // initiate asynchronous loading
                sal_Int16 eOrient = aNumFmt.GetVertOrient();
                aNumFmt.SetGraphicBrush(pBrushItem, &aSize, &eOrient);
                aInitSize[i] = aNumFmt.GetGraphicSize();

                pActNum->SetLevel(i, aNumFmt);
            }
            nMask <<= 1;
        }
        m_xRatioCB->set_sensitive(true);
        m_xWidthFT->set_sensitive(true);
        m_xHeightFT->set_sensitive(true);
        m_xWidthMF->set_sensitive(true);
        m_xHeightMF->set_sensitive(true);
        SetMetricValue(*m_xWidthMF, aSize.Width(), eCoreUnit);
        SetMetricValue(*m_xHeightMF, aSize.Height(), eCoreUnit);

        SetModified();
        //needed due to asynchronous loading of graphics in the SvxBrushItem
        aInvalidateTimer.Start();
    }
}

IMPL_LINK_NOARG(SvxBulletAndPositionDlg, PopupActivateHdl_Impl, weld::ToggleButton&, void)
{
    if (!m_xGalleryMenu)
    {
        m_xGalleryMenu = m_xBuilder->weld_menu("gallerysubmenu");
        weld::WaitObject aWait(p_Window);

        if (GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames))
        {
            GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);

            Graphic aGraphic;
            OUString sGrfName;
            ScopedVclPtrInstance<VirtualDevice> pVD;
            size_t i = 0;
            for (auto& grfName : aGrfNames)
            {
                sGrfName = grfName;
                OUString sItemId = "gallery" + OUString::number(i);
                INetURLObject aObj(sGrfName);
                if (aObj.GetProtocol() == INetProtocol::File)
                    sGrfName = aObj.PathToFileName();
                if (GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, i, &aGraphic))
                {
                    BitmapEx aBitmap(aGraphic.GetBitmapEx());
                    Size aSize(aBitmap.GetSizePixel());
                    if (aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
                    {
                        bool bWidth = aSize.Width() > aSize.Height();
                        double nScale
                            = bWidth ? double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width())
                                     : double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height());
                        aBitmap.Scale(nScale, nScale);
                    }
                    pVD->SetOutputSizePixel(aBitmap.GetSizePixel(), false);
                    pVD->DrawBitmapEx(Point(), aBitmap);
                    m_xGalleryMenu->append(sItemId, sGrfName, *pVD);
                }
                else
                {
                    m_xGalleryMenu->append(sItemId, sGrfName);
                }
                ++i;
            }
            GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
        }
    }
}

IMPL_LINK_NOARG(SvxBulletAndPositionDlg, BulletHdl_Impl, weld::Button&, void)
{
    SvxCharacterMap aMap(p_Window, nullptr, nullptr);

    sal_uInt16 nMask = 1;
    const vcl::Font* pFmtFont = nullptr;
    bool bSameBullet = true;
    sal_Unicode cBullet = 0;
    bool bFirst = true;
    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    {
        if (nActNumLvl & nMask)
        {
            const SvxNumberFormat& rCurFmt = pActNum->GetLevel(i);
            if (bFirst)
            {
                cBullet = rCurFmt.GetBulletChar();
            }
            else if (rCurFmt.GetBulletChar() != cBullet)
            {
                bSameBullet = false;
                break;
            }
            if (!pFmtFont)
                pFmtFont = rCurFmt.GetBulletFont();
            bFirst = false;
        }
        nMask <<= 1;
    }

    if (pFmtFont)
        aMap.SetCharFont(*pFmtFont);
    else
        aMap.SetCharFont(aActBulletFont);
    if (bSameBullet)
        aMap.SetChar(cBullet);
    if (aMap.run() == RET_OK)
    {
        // change Font Numrules
        aActBulletFont = aMap.GetCharFont();

        sal_uInt16 _nMask = 1;
        for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
        {
            if (nActNumLvl & _nMask)
            {
                SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
                aNumFmt.SetBulletFont(&aActBulletFont);
                aNumFmt.SetBulletChar(static_cast<sal_Unicode>(aMap.GetChar()));
                pActNum->SetLevel(i, aNumFmt);
            }
            _nMask <<= 1;
        }

        SetModified();
    }
}

IMPL_LINK(SvxBulletAndPositionDlg, SizeHdl_Impl, weld::MetricSpinButton&, rField, void)
{
    bool bWidth = &rField == m_xWidthMF.get();
    bLastWidthModified = bWidth;
    bool bRatio = m_xRatioCB->get_active();
    long nWidthVal
        = static_cast<long>(m_xWidthMF->denormalize(m_xWidthMF->get_value(FieldUnit::MM_100TH)));
    long nHeightVal
        = static_cast<long>(m_xHeightMF->denormalize(m_xHeightMF->get_value(FieldUnit::MM_100TH)));
    nWidthVal = OutputDevice::LogicToLogic(nWidthVal, MapUnit::Map100thMM, eCoreUnit);
    nHeightVal = OutputDevice::LogicToLogic(nHeightVal, MapUnit::Map100thMM, eCoreUnit);
    double fSizeRatio;

    bool bRepaint = false;
    sal_uInt16 nMask = 1;
    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    {
        if (nActNumLvl & nMask)
        {
            SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
            if (SVX_NUM_BITMAP == (aNumFmt.GetNumberingType() & (~LINK_TOKEN)))
            {
                Size aSize(aNumFmt.GetGraphicSize());
                Size aSaveSize(aSize);

                if (aInitSize[i].Height())
                    fSizeRatio = static_cast<double>(aInitSize[i].Width())
                                 / static_cast<double>(aInitSize[i].Height());
                else
                    fSizeRatio = double(1);

                if (bWidth)
                {
                    long nDelta = nWidthVal - aInitSize[i].Width();
                    aSize.setWidth(nWidthVal);
                    if (bRatio)
                    {
                        aSize.setHeight(
                            aInitSize[i].Height()
                            + static_cast<long>(static_cast<double>(nDelta) / fSizeRatio));
                        m_xHeightMF->set_value(m_xHeightMF->normalize(OutputDevice::LogicToLogic(
                                                   aSize.Height(), eCoreUnit, MapUnit::Map100thMM)),
                                               FieldUnit::MM_100TH);
                    }
                }
                else
                {
                    long nDelta = nHeightVal - aInitSize[i].Height();
                    aSize.setHeight(nHeightVal);
                    if (bRatio)
                    {
                        aSize.setWidth(
                            aInitSize[i].Width()
                            + static_cast<long>(static_cast<double>(nDelta) * fSizeRatio));
                        m_xWidthMF->set_value(m_xWidthMF->normalize(OutputDevice::LogicToLogic(
                                                  aSize.Width(), eCoreUnit, MapUnit::Map100thMM)),
                                              FieldUnit::MM_100TH);
                    }
                }
                const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
                sal_Int16 eOrient = aNumFmt.GetVertOrient();
                if (aSize != aSaveSize)
                    bRepaint = true;
                aNumFmt.SetGraphicBrush(pBrushItem, &aSize, &eOrient);
                pActNum->SetLevel(i, aNumFmt);
            }
        }
        nMask <<= 1;
    }
    SetModified(bRepaint);
}

IMPL_LINK(SvxBulletAndPositionDlg, RatioHdl_Impl, weld::ToggleButton&, rBox, void)
{
    if (rBox.get_active())
    {
        if (bLastWidthModified)
            SizeHdl_Impl(*m_xWidthMF);
        else
            SizeHdl_Impl(*m_xHeightMF);
    }
}

IMPL_LINK(SvxBulletAndPositionDlg, SelectLeftAlignmentHdl_Impl, weld::ToggleButton&, rButton, void)
{
    if (rButton.get_active())
    {
        SetAlignmentHdl_Impl(SvxAdjust::Left);

        m_xCenterTB->set_active(false);
        m_xRightTB->set_active(false);

        SetModified();
    }
}

IMPL_LINK(SvxBulletAndPositionDlg, SelectCenterAlignmentHdl_Impl, weld::ToggleButton&, rButton,
          void)
{
    if (rButton.get_active())
    {
        SetAlignmentHdl_Impl(SvxAdjust::Center);

        m_xLeftTB->set_active(false);
        m_xRightTB->set_active(false);

        SetModified();
    }
}

IMPL_LINK(SvxBulletAndPositionDlg, SelectRightAlignmentHdl_Impl, weld::ToggleButton&, rButton, void)
{
    if (rButton.get_active())
    {
        SetAlignmentHdl_Impl(SvxAdjust::Right);

        m_xLeftTB->set_active(false);
        m_xCenterTB->set_active(false);

        SetModified();
    }
}

void SvxBulletAndPositionDlg::SetAlignmentHdl_Impl(SvxAdjust eAdjust)
{
    sal_uInt16 nMask = 1;
    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    {
        if (nActNumLvl & nMask)
        {
            SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
            aNumFmt.SetNumAdjust(eAdjust);
            pActNum->SetLevel(i, aNumFmt);
        }
        nMask <<= 1;
    }
}

IMPL_LINK(SvxBulletAndPositionDlg, ApplyToMasterHdl_Impl, weld::ToggleButton&, rButton, void)
{
    bApplyToMaster = rButton.get_active();
}

IMPL_LINK(SvxBulletAndPositionDlg, EditModifyHdl_Impl, weld::Entry&, rEdit, void)
{
    EditModifyHdl_Impl(&rEdit);
}

IMPL_LINK(SvxBulletAndPositionDlg, DistanceHdl_Impl, weld::MetricSpinButton&, rFld, void)
{
    if (bInInitControl)
        return;
    long nValue = GetCoreValue(rFld, eCoreUnit);
    sal_uInt16 nMask = 1;
    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    {
        if (nActNumLvl & nMask)
        {
            SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
            if (&rFld == m_xDistBorderMF.get())
            {
                if (m_xRelativeCB->get_active())
                {
                    if (0 == i)
                    {
                        auto const nTmp = aNumFmt.GetFirstLineOffset();
                        aNumFmt.SetAbsLSpace(nValue - nTmp);
                    }
                    else
                    {
                        long nTmp = pActNum->GetLevel(i - 1).GetAbsLSpace()
                                    + pActNum->GetLevel(i - 1).GetFirstLineOffset()
                                    - pActNum->GetLevel(i).GetFirstLineOffset();

                        aNumFmt.SetAbsLSpace(nValue + nTmp);
                    }
                }
                else
                {
                    aNumFmt.SetAbsLSpace(nValue - aNumFmt.GetFirstLineOffset());
                }
            }
            else if (&rFld == m_xIndentMF.get())
            {
                // together with the FirstLineOffset the AbsLSpace must be changed, too
                long nDiff = nValue + aNumFmt.GetFirstLineOffset();
                auto const nAbsLSpace = aNumFmt.GetAbsLSpace();
                aNumFmt.SetAbsLSpace(nAbsLSpace + nDiff);
                aNumFmt.SetFirstLineOffset(-nValue);
            }

            pActNum->SetLevel(i, aNumFmt);
        }
        nMask <<= 1;
    }

    SetModified();
    if (!m_xDistBorderMF->get_sensitive())
    {
        m_xDistBorderMF->set_text("");
    }
}

IMPL_LINK(SvxBulletAndPositionDlg, RelativeHdl_Impl, weld::ToggleButton&, rBox, void)
{
    bool bOn = rBox.get_active();
    bool bSingleSelection = m_xLevelLB->count_selected_rows() == 1 && SAL_MAX_UINT16 != nActNumLvl;
    bool bSetValue = false;
    long nValue = 0;
    if (bOn || bSingleSelection)
    {
        sal_uInt16 nMask = 1;
        bool bFirst = true;
        bSetValue = true;
        for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
        {
            if (nActNumLvl & nMask)
            {
                const SvxNumberFormat& rNumFmt = pActNum->GetLevel(i);
                if (bFirst)
                {
                    nValue = rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset();
                    if (bOn && i)
                        nValue -= (pActNum->GetLevel(i - 1).GetAbsLSpace()
                                   + pActNum->GetLevel(i - 1).GetFirstLineOffset());
                }
                else
                    bSetValue = nValue
                                == (rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset())
                                       - (pActNum->GetLevel(i - 1).GetAbsLSpace()
                                          + pActNum->GetLevel(i - 1).GetFirstLineOffset());
                bFirst = false;
            }
            nMask <<= 1;
        }
    }
    if (bSetValue)
        SetMetricValue(*m_xDistBorderMF, nValue, eCoreUnit);
    else
        m_xDistBorderMF->set_text("");
    m_xDistBorderMF->set_sensitive(bOn || bSingleSelection);
    m_xDistBorderFT->set_sensitive(bOn || bSingleSelection);
    bLastRelative = bOn;
}

void SvxBulletAndPositionDlg::EditModifyHdl_Impl(const weld::Entry* pEdit)
{
    bool bPrefix = pEdit == m_xPrefixED.get();
    bool bSuffix = pEdit == m_xSuffixED.get();
    bool bStart = pEdit == m_xStartED.get();
    sal_uInt16 nMask = 1;
    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    {
        if (nActNumLvl & nMask)
        {
            SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
            if (bPrefix)
                aNumFmt.SetPrefix(m_xPrefixED->get_text());
            else if (bSuffix)
                aNumFmt.SetSuffix(m_xSuffixED->get_text());
            else if (bStart)
                aNumFmt.SetStart(m_xStartED->get_value());
            pActNum->SetLevel(i, aNumFmt);
        }
        nMask <<= 1;
    }
    SetModified();
}

void SvxBulletAndPositionDlg::SetModified(bool bRepaint)
{
    bModified = true;
    if (bRepaint)
    {
        m_aPreviewWIN.SetLevel(nActNumLvl);
        m_aPreviewWIN.Invalidate();
    }
}

void SvxBulletAndPositionDlg::InitPosAndSpaceMode()
{
    if (pActNum == nullptr)
    {
        SAL_WARN("cui.tabpages", "<SvxNumPositionTabPage::InitPosAndSpaceMode()> - misusage of "
                                 "method -> <pAktNum> has to be already set!");
        return;
    }

    SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode = SvxNumberFormat::LABEL_ALIGNMENT;
    sal_uInt16 nMask = 1;
    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i)
    {
        if (nActNumLvl & nMask)
        {
            SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
            ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode();
            if (ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT)
            {
                break;
            }
        }
        nMask <<= 1;
    }

    bLabelAlignmentPosAndSpaceModeActive = ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
index 0f8507b..05353b7 100644
--- a/sd/source/ui/dlg/sddlgfact.cxx
+++ b/sd/source/ui/dlg/sddlgfact.cxx
@@ -46,11 +46,31 @@

IMPL_ABSTDLG_BASE(SdVclAbstractDialog_Impl);

short AbstractSvxBulletAndPositionDlg_Impl::Execute()
{
    return m_xDlg->run();
}

short SdAbstractGenericDialog_Impl::Execute()
{
    return m_xDlg->run();
}

const SfxItemSet* AbstractSvxBulletAndPositionDlg_Impl::GetOutputItemSet( SfxItemSet* pSet ) const
{
    return m_xDlg->GetOutputItemSet( pSet );
}

bool AbstractSvxBulletAndPositionDlg_Impl::IsApplyToMaster()
{
    return m_xDlg->IsApplyToMaster();
}

bool AbstractSvxBulletAndPositionDlg_Impl::IsSlideScope()
{
    return m_xDlg->IsSlideScope();
}

short AbstractCopyDlg_Impl::Execute()
{
    return m_xDlg->run();
@@ -362,6 +382,11 @@ void AbstractSdPublishingDlg_Impl::GetParameterSequence( css::uno::Sequence< css

//-------------- SdAbstractDialogFactory implementation--------------

VclPtr<AbstractSvxBulletAndPositionDlg> SdAbstractDialogFactory_Impl::CreateSvxBulletAndPositionDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView)
{
    return VclPtr<AbstractSvxBulletAndPositionDlg_Impl>::Create(std::make_unique<SvxBulletAndPositionDlg>(pParent, *pAttr, pView));
}

VclPtr<VclAbstractDialog> SdAbstractDialogFactory_Impl::CreateBreakDlg(
                                            weld::Window* pParent,
                                            ::sd::DrawView* pDrView,
diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx
index b14705c5..389211e 100644
--- a/sd/source/ui/dlg/sddlgfact.hxx
+++ b/sd/source/ui/dlg/sddlgfact.hxx
@@ -22,6 +22,7 @@
#include <sdabstdlg.hxx>
#include <sfx2/basedlgs.hxx>
#include <sfx2/sfxdlg.hxx>
#include <svx/svxdlg.hxx>

#include <morphdlg.hxx>
#include <copydlg.hxx>
@@ -38,6 +39,7 @@
#include <dlgsnap.hxx>
#include <present.hxx>
#include <vectdlg.hxx>
#include <BulletAndPositionDlg.hxx>

#define DECL_ABSTDLG_BASE(Class,DialogClass)            \
    ScopedVclPtr<DialogClass> pDlg;                     \
@@ -79,6 +81,23 @@ bool Class::StartExecuteAsync(AsyncContext &ctx) \
//    class MasterLayoutDialog;
//}

class SvxBulletAndPositionDlg;

class AbstractSvxBulletAndPositionDlg_Impl :public AbstractSvxBulletAndPositionDlg
{
    std::unique_ptr<SvxBulletAndPositionDlg> m_xDlg;
public:
    explicit AbstractSvxBulletAndPositionDlg_Impl(std::unique_ptr<SvxBulletAndPositionDlg> p)
        : m_xDlg(std::move(p))
    {
    }
    virtual short Execute() override;
    virtual const SfxItemSet*   GetOutputItemSet( SfxItemSet* ) const override ;
    virtual bool IsApplyToMaster() override;
    virtual bool IsSlideScope() override;
};


class SdVclAbstractDialog_Impl : public VclAbstractDialog
{
    DECL_ABSTDLG_BASE(SdVclAbstractDialog_Impl,Dialog)
@@ -343,6 +362,7 @@ class SdAbstractDialogFactory_Impl : public SdAbstractDialogFactory
public:
    virtual ~SdAbstractDialogFactory_Impl() {}

    virtual VclPtr<AbstractSvxBulletAndPositionDlg> CreateSvxBulletAndPositionDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) override;
    virtual VclPtr<VclAbstractDialog>          CreateBreakDlg(weld::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount) override;
    virtual VclPtr<AbstractCopyDlg>            CreateCopyDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override;
    virtual VclPtr<AbstractSdCustomShowDlg>    CreateSdCustomShowDlg(weld::Window* pParent, SdDrawDocument& rDrawDoc) override;
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index 7c1322b..df5aa72 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -37,7 +37,9 @@
#include <svx/nbdtmg.hxx>
#include <svx/nbdtmgfact.hxx>
#include <svx/svdoutl.hxx>
#include <sdabstdlg.hxx>
#include <memory>
#include <sdpage.hxx>

using namespace svx::sidebar;
namespace sd {
@@ -362,6 +364,306 @@ const SfxPoolItem* FuOutlineBullet::GetNumBulletItem(SfxItemSet& aNewAttr, sal_u
    return pTmpItem;
}


// New merged dialog


FuBulletAndPosition::FuBulletAndPosition(ViewShell* pViewShell, ::sd::Window* pWindow,
                                 ::sd::View* pView, SdDrawDocument* pDoc,
                                 SfxRequest& rReq)
       : FuPoor(pViewShell, pWindow, pView, pDoc, rReq)
{
}

rtl::Reference<FuPoor> FuBulletAndPosition::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
{
    rtl::Reference<FuPoor> xFunc( new FuBulletAndPosition( pViewSh, pWin, pView, pDoc, rReq ) );
    xFunc->DoExecute(rReq);
    return xFunc;
}

void FuBulletAndPosition::DoExecute( SfxRequest& rReq )
{
    const sal_uInt16 nSId = rReq.GetSlot();
    if ( nSId == FN_SVX_SET_BULLET || nSId == FN_SVX_SET_NUMBER )
    {
        SetCurrentBulletsNumbering(rReq);
        return;
    }

    const SfxItemSet* pArgs = rReq.GetArgs();
    const SfxStringItem* pPageItem = SfxItemSet::GetItem<SfxStringItem>(pArgs, FN_PARAM_1, false);

    if ( pArgs && !pPageItem )
    {
        /* not direct to pOlView; therefore, SdDrawView::SetAttributes can catch
           changes to master page and redirect to a template */
        mpView->SetAttributes(*pArgs);
        return;
    }

    // fill ItemSet for Dialog
    SfxItemSet aEditAttr( mpDoc->GetPool() );
    mpView->GetAttributes( aEditAttr );

    SfxItemSet aNewAttr( mpViewShell->GetPool(),
                             svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} );
    aNewAttr.Put( aEditAttr, false );

    auto pView = mpView;

    // create and execute dialog
    SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
    ScopedVclPtr<AbstractSvxBulletAndPositionDlg> pDlg(pFact->CreateSvxBulletAndPositionDlg(mpViewShell->GetFrameWeld(), &aNewAttr, mpView));
    sal_uInt16 nResult = pDlg->Execute();

    if( nResult == RET_OK )
    {
        const SfxItemSet pOutputSet( *pDlg->GetOutputItemSet( &aNewAttr ) );
        pView->SetAttributes(pOutputSet, /*bReplaceAll=*/false, /*bSlide*/ pDlg->IsSlideScope(), /*bMaster=*/pDlg->IsApplyToMaster());
    }

    rReq.Done();
}

void FuBulletAndPosition::SetCurrentBulletsNumbering(SfxRequest& rReq)
{
    if (!mpDoc || !mpView)
        return;

    const sal_uInt16 nSId = rReq.GetSlot();
    if ( nSId != FN_SVX_SET_BULLET && nSId != FN_SVX_SET_NUMBER )
    {
        // unexpected SfxRequest
        return;
    }

    const SfxUInt16Item* pItem = rReq.GetArg<SfxUInt16Item>(nSId);
    if ( !pItem )
    {
        rReq.Done();
        return;
    }

    SfxItemSet aNewAttr( mpViewShell->GetPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} );
    {
        SfxItemSet aEditAttr( mpDoc->GetPool() );
        mpView->GetAttributes( aEditAttr );
        aNewAttr.Put( aEditAttr, false );
    }

    const DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >(mpViewShell);
    //Init bullet level in "Customize" tab page in bullet dialog in master page view
    const bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EditMode::MasterPage;
    if ( bInMasterView )
    {
        SdrObject* pObj = mpView->GetTextEditObject();
        if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
        {
            const sal_uInt16 nLevel = mpView->GetSelectionLevel();
            if( nLevel != 0xFFFF )
            {
                //save the itemset value
                SfxItemSet aStoreSet( aNewAttr );
                aNewAttr.ClearItem();
                //extend range
                aNewAttr.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL );
                aNewAttr.Put( aStoreSet );
                //put current level user selected
                aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) );
            }
        }
    }

    sal_uInt16 nIdx = pItem->GetValue();
    bool bToggle = false;
    if( nIdx == sal_uInt16(0xFFFF) )
    {
        // If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off
        nIdx = 1;
        bToggle = true;
    }
    nIdx--;

    sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE;
    const SfxPoolItem* pTmpItem = GetNumBulletItem( aNewAttr, nNumItemId );
    std::unique_ptr<SvxNumRule> pNumRule;
    if ( pTmpItem )
    {
        pNumRule.reset(new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pTmpItem)->GetNumRule()));

        // get numbering rule corresponding to <nIdx> and apply the needed number formats to <pNumRule>
        NBOTypeMgrBase* pNumRuleMgr =
            NBOutlineTypeMgrFact::CreateInstance(
                nSId == FN_SVX_SET_BULLET ? NBOType::Bullets : NBOType::Numbering );
        if ( pNumRuleMgr )
        {
            sal_uInt16 nActNumLvl = sal_uInt16(0xFFFF);
            const SfxPoolItem* pNumLevelItem = nullptr;
            if(SfxItemState::SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pNumLevelItem))
                nActNumLvl = static_cast<const SfxUInt16Item*>(pNumLevelItem)->GetValue();

            pNumRuleMgr->SetItems(&aNewAttr);
            SvxNumRule aTmpRule( *pNumRule );
            if ( nSId == FN_SVX_SET_BULLET && bToggle && nIdx==0 )
            {
                // for toggling bullets get default numbering rule
                pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl, true );
            }
            else
            {
                pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl );
            }

            sal_uInt16 nMask = 1;
            for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++)
            {
                if(nActNumLvl & nMask)
                {
                    const SvxNumberFormat& aFmt(aTmpRule.GetLevel(i));
                    pNumRule->SetLevel(i, aFmt);
                }
                nMask <<= 1;
            }
        }
    }

    OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
    std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
    if (OutlineView* pView = dynamic_cast<OutlineView*>(mpView))
    {
        pOLV = pView->GetViewByWindow(mpViewShell->GetActiveWindow());
        aGuard.reset(new OutlineViewModelChangeGuard(*pView));
    }

    SdrOutliner* pOwner = bInMasterView ? mpView->GetTextEditOutliner() : nullptr;
    const bool bOutlinerUndoEnabled = pOwner && !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
    SdrModel* pSdrModel = bInMasterView ? mpView->GetModel() : nullptr;
    const bool bModelUndoEnabled = pSdrModel && pSdrModel->IsUndoEnabled();

    if ( bOutlinerUndoEnabled )
    {
        pOwner->UndoActionStart( OLUNDO_ATTR );
    }
    else if ( bModelUndoEnabled )
    {
        pSdrModel->BegUndo();
    }

    if ( pOLV )
    {
        pOLV->ToggleBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? nullptr : pNumRule.get() );
    }
    else
    {
        mpView->ChangeMarkedObjectsBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? nullptr : pNumRule.get() );
    }

    if (bInMasterView && pNumRule)
    {
        SfxItemSet aSetAttr( mpViewShell->GetPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} );
        aSetAttr.Put(SvxNumBulletItem( *pNumRule, nNumItemId ));
        mpView->SetAttributes(aSetAttr);
    }

    if( bOutlinerUndoEnabled )
    {
        pOwner->UndoActionEnd();
    }
    else if ( bModelUndoEnabled )
    {
        pSdrModel->EndUndo();
    }

    pNumRule.reset();
    rReq.Done();
}

const SfxPoolItem* FuBulletAndPosition::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId)
{
    //SvxNumBulletItem* pRetItem = NULL;
    const SfxPoolItem* pTmpItem = nullptr;

    if(aNewAttr.GetItemState(nNumItemId, false, &pTmpItem) == SfxItemState::SET)
    {
        return pTmpItem;
    }
    else
    {
        nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
        SfxItemState eState = aNewAttr.GetItemState(nNumItemId, false, &pTmpItem);
        if (eState == SfxItemState::SET)
            return pTmpItem;
        else
        {
            bool bOutliner = false;
            bool bTitle = false;

            if( mpView )
            {
                const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
                const size_t nCount = rMarkList.GetMarkCount();

                for(size_t nNum = 0; nNum < nCount; ++nNum)
                {
                    SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
                    if( pObj->GetObjInventor() == SdrInventor::Default )
                    {
                        switch(pObj->GetObjIdentifier())
                        {
                        case OBJ_TITLETEXT:
                            bTitle = true;
                            break;
                        case OBJ_OUTLINETEXT:
                            bOutliner = true;
                            break;
                        }
                    }
                }
            }

            const SvxNumBulletItem *pItem = nullptr;
            if(bOutliner)
            {
                SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool();
                SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( STR_LAYOUT_OUTLINE " 1", SfxStyleFamily::Pseudo);
                if( pFirstStyleSheet )
                    pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pItem));
            }

            if( pItem == nullptr )
                pItem = aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);

            //DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in the Pool!" );

            std::unique_ptr<SfxPoolItem> pNewItem(pItem->CloneSetWhich(EE_PARA_NUMBULLET));
            aNewAttr.Put(*pNewItem);

            if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET )
            {
                const SvxNumBulletItem* pBulletItem = aNewAttr.GetItem(EE_PARA_NUMBULLET);
                SvxNumRule* pLclRule = pBulletItem->GetNumRule();
                if(pLclRule)
                {
                    SvxNumRule aNewRule( *pLclRule );
                    aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS );

                    SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
                    aNewAttr.Put(aNewItem);
                }
            }

            SfxItemState eItemState = aNewAttr.GetItemState(nNumItemId, false, &pTmpItem);
            if (eItemState == SfxItemState::SET)
                return pTmpItem;

        }
        //DBG_ASSERT(eState == SfxItemState::SET, "No item found");
    }
    return pTmpItem;
}


} // end of namespace sd

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/BulletAndPositionDlg.hxx b/sd/source/ui/inc/BulletAndPositionDlg.hxx
new file mode 100644
index 0000000..3ddaff6
--- /dev/null
+++ b/sd/source/ui/inc/BulletAndPositionDlg.hxx
@@ -0,0 +1,171 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef INCLUDED_SD_SOURCE_UI_INC_BULLETANDPOSITIONDIALOG_HXX
#define INCLUDED_SD_SOURCE_UI_INC_BULLETANDPOSITIONDIALOG_HXX

#include <vector>
#include <memory>

#include <sfx2/tabdlg.hxx>
#include <svx/Palette.hxx>
#include <editeng/numdef.hxx>
#include <editeng/svxenum.hxx>
#include <svtools/ctrlbox.hxx>
#include <vcl/weld.hxx>
#include "View.hxx"
#include <cui/numberingpreview.hxx>

#define MN_GALLERY_ENTRY 100

class ColorListBox;
class NumValueSet;
class SvxNumRule;
class SvxBmpNumValueSet;
class SvxBrushItem;
class ValueSet;
class SdDrawDocument;

namespace sd
{
class View;
}

class SvxBulletAndPositionDlg : public weld::GenericDialogController
{
    OUString m_sNumCharFmtName;
    OUString m_sBulletCharFormatName;

    Timer aInvalidateTimer;

    std::unique_ptr<SvxNumRule> pActNum;
    std::unique_ptr<SvxNumRule> pSaveNum;

    Size aInitSize[SVX_MAX_NUM];

    bool bLastWidthModified : 1;
    bool bModified : 1;
    bool bPreset : 1;
    bool bAutomaticCharStyles : 1;
    bool bHTMLMode : 1;
    bool bInInitControl : 1; // workaround for Modify-error, is said to be corrected from 391 on
    bool bLabelAlignmentPosAndSpaceModeActive;
    bool bApplyToMaster;
    bool bIsSlideScope;

    std::vector<OUString> aGrfNames;
    vcl::Font aActBulletFont;

    sal_uInt8 nBullet;
    sal_uInt16 nActNumLvl;
    weld::Window* p_Window;
    sal_uInt16 nNumItemId;
    MapUnit eCoreUnit;
    ::sd::View* p_View;

    SvxNumberingPreview m_aPreviewWIN;
    std::unique_ptr<weld::Widget> m_xGrid;
    std::unique_ptr<weld::TreeView> m_xLevelLB;
    std::unique_ptr<weld::ComboBox> m_xFmtLB;
    std::unique_ptr<weld::Label> m_xPrefixFT;
    std::unique_ptr<weld::Entry> m_xPrefixED;
    std::unique_ptr<weld::Label> m_xSuffixFT;
    std::unique_ptr<weld::Entry> m_xSuffixED;
    std::unique_ptr<weld::Expander> m_xBeforeAfter;
    std::unique_ptr<weld::Label> m_xBulColorFT;
    std::unique_ptr<ColorListBox> m_xBulColLB;
    std::unique_ptr<weld::Label> m_xBulRelSizeFT;
    std::unique_ptr<weld::MetricSpinButton> m_xBulRelSizeMF;
    std::unique_ptr<weld::Label> m_xStartFT;
    std::unique_ptr<weld::SpinButton> m_xStartED;
    std::unique_ptr<weld::Label> m_xBulletFT;
    std::unique_ptr<weld::Button> m_xBulletPB;
    std::unique_ptr<weld::MenuButton> m_xBitmapMB;
    std::unique_ptr<weld::Label> m_xWidthFT;
    std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
    std::unique_ptr<weld::Label> m_xHeightFT;
    std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
    std::unique_ptr<weld::CheckButton> m_xRatioCB;
    std::unique_ptr<weld::Menu> m_xGalleryMenu;
    std::unique_ptr<weld::CustomWeld> m_xPreviewWIN;
    std::unique_ptr<weld::Label> m_xDistBorderFT;
    std::unique_ptr<weld::MetricSpinButton> m_xDistBorderMF;
    std::unique_ptr<weld::CheckButton> m_xRelativeCB;
    std::unique_ptr<weld::Label> m_xIndentFT;
    std::unique_ptr<weld::MetricSpinButton> m_xIndentMF;
    std::unique_ptr<weld::ToggleButton> m_xLeftTB;
    std::unique_ptr<weld::ToggleButton> m_xCenterTB;
    std::unique_ptr<weld::ToggleButton> m_xRightTB;
    std::unique_ptr<weld::RadioButton> m_xSlideRB;
    std::unique_ptr<weld::RadioButton> m_xSelectionRB;
    std::unique_ptr<weld::ToggleButton> m_xApplyToMaster;

    void InitControls();
    /** To switch between the numbering type
        0 - Number;
        1 - Bullet;
        2 - Bitmap; */
    void SwitchNumberType(sal_uInt8 nType);
    void CheckForStartValue_Impl(sal_uInt16 nNumberingType);

    DECL_LINK(NumberTypeSelectHdl_Impl, weld::ComboBox&, void);
    DECL_LINK(LevelHdl_Impl, weld::TreeView&, void);
    DECL_LINK(PopupActivateHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(GraphicHdl_Impl, const OString&, void);
    DECL_LINK(BulletHdl_Impl, weld::Button&, void);
    DECL_LINK(SizeHdl_Impl, weld::MetricSpinButton&, void);
    DECL_LINK(RatioHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void);
    DECL_LINK(SameLevelHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(BulColorHdl_Impl, ColorListBox&, void);
    DECL_LINK(BulRelSizeHdl_Impl, weld::MetricSpinButton&, void);
    DECL_LINK(PreviewInvalidateHdl_Impl, Timer*, void);
    DECL_LINK(DistanceHdl_Impl, weld::MetricSpinButton&, void);
    DECL_LINK(RelativeHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(SelectLeftAlignmentHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(SelectCenterAlignmentHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(SelectRightAlignmentHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(ApplyToMasterHdl_Impl, weld::ToggleButton&, void);
    void EditModifyHdl_Impl(const weld::Entry*);
    void InitPosAndSpaceMode();
    void SetAlignmentHdl_Impl(SvxAdjust);

public:
    SvxBulletAndPositionDlg(weld::Window* pWindow, const SfxItemSet& rSet, ::sd::View* pView);
    virtual ~SvxBulletAndPositionDlg() override;
    virtual void dispose();

    SfxItemSet* GetOutputItemSet(SfxItemSet* rSet);
    bool IsApplyToMaster();
    bool IsSlideScope();
    void Reset(const SfxItemSet* rSet);

    void SetCharFmts(const OUString& rNumName, const OUString& rBulletName)
    {
        m_sNumCharFmtName = rNumName;
        m_sBulletCharFormatName = rBulletName;
    }
    void SetMetric(FieldUnit eSet);

    void SetModified(bool bRepaint = true);
};

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/OutlineView.hxx b/sd/source/ui/inc/OutlineView.hxx
index e02f8a5..c915184 100644
--- a/sd/source/ui/inc/OutlineView.hxx
+++ b/sd/source/ui/inc/OutlineView.hxx
@@ -110,7 +110,7 @@ public:
    void              PrepareClose();

    virtual void    GetAttributes( SfxItemSet& rTargetSet, bool bOnlyHardAttr = false ) const override;
    virtual bool    SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false) override;
    virtual bool    SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false, bool bSlide = false, bool bMaster = false) override;

    void               FillOutliner();
    void               SetLinks();
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index e884241..2c4bf3b 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -79,7 +79,7 @@ public:
    void                    CompleteRedraw( OutputDevice* pOutDev, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr) override;

    virtual void            GetAttributes( SfxItemSet& rTargetSet, bool bOnlyHardAttr = false ) const;
    virtual bool            SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false);
    virtual bool            SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false, bool bSlide = false, bool bMaster = false);
    virtual void            MarkListHasChanged() override;
    void                    SelectAll();
    void                    DoCut();
diff --git a/sd/source/ui/inc/drawview.hxx b/sd/source/ui/inc/drawview.hxx
index 1a15b37..3e410c1 100644
--- a/sd/source/ui/inc/drawview.hxx
+++ b/sd/source/ui/inc/drawview.hxx
@@ -43,7 +43,8 @@ public:
    virtual void MarkListHasChanged() override;
    void CompleteRedraw(OutputDevice* pOutDev, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr) override;

    virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false) override;
    virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false, bool bSlide = false, bool bMaster = false) override;
    void SetMasterAttributes(SdrObject* pObject, SdPage& rPage, SfxItemSet rSet, SfxStyleSheetBasePool* pStShPool, bool& bOk, bool bMaster, bool bSlide);

    virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;

diff --git a/sd/source/ui/inc/fuolbull.hxx b/sd/source/ui/inc/fuolbull.hxx
index 383cd2d..7a5ff9b 100644
--- a/sd/source/ui/inc/fuolbull.hxx
+++ b/sd/source/ui/inc/fuolbull.hxx
@@ -56,6 +56,30 @@ private:
    const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId);
};

/**
 * New merged bullet and position functions in outline mode
 */
class FuBulletAndPosition
    : public FuPoor
{
public:

    static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
    virtual void DoExecute( SfxRequest& rReq ) override;

private:
    FuBulletAndPosition (
        ViewShell* pViewShell,
        ::sd::Window* pWin,
        ::sd::View* pView,
        SdDrawDocument* pDoc,
        SfxRequest& rReq);

    void SetCurrentBulletsNumbering(SfxRequest& rReq);

    const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId);
};

} // end of namespace sd

#endif
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index eb5613c..b67fb35 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -132,12 +132,38 @@ void DrawView::ModelHasChanged()
 */

bool DrawView::SetAttributes(const SfxItemSet& rSet,
                             bool bReplaceAll)
                             bool bReplaceAll, bool bSlide, bool bMaster)
{
    bool bOk = false;

    if (mpDrawViewShell && bMaster)
    {
        SfxStyleSheetBasePool* pStShPool = mrDoc.GetStyleSheetPool();
        SdPage& rPage = *mpDrawViewShell->getCurrentPage();
        SdrPage& rMasterPage = rPage.TRG_GetMasterPage();
        size_t nObjCount = rMasterPage.GetObjCount();
        for (size_t nObj = 0; nObj < nObjCount; ++nObj)
        {
            SdrObject* pObject = rMasterPage.GetObj(nObj);
            SetMasterAttributes(pObject, rPage, rSet, pStShPool, bOk, bMaster, bSlide);
        }
        return bOk;
    }
    if (mpDrawViewShell && bSlide)
    {
        SfxStyleSheetBasePool* pStShPool = mrDoc.GetStyleSheetPool();
        SdPage& rPage = *mpDrawViewShell->getCurrentPage();
        size_t nObjCount = rPage.GetObjCount();
        for (size_t nObj = 0; nObj < nObjCount; ++nObj)
        {
            SdrObject* pObject = rPage.GetObj(nObj);
            SetMasterAttributes(pObject, rPage, rSet, pStShPool, bOk, bMaster, bSlide);
        }
        return bOk;
    }

    // is there a masterpage edit?
    if ( mpDrawViewShell && mpDrawViewShell->GetEditMode() == EditMode::MasterPage )
    if ( mpDrawViewShell && (mpDrawViewShell->GetEditMode() == EditMode::MasterPage) )
    {
        SfxStyleSheetBasePool* pStShPool = mrDoc.GetStyleSheetPool();
        SdPage& rPage = *mpDrawViewShell->getCurrentPage();
@@ -274,88 +300,7 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet,
            for (size_t nMark = 0; nMark < nMarkCount; ++nMark)
            {
                SdrObject*  pObject = rList.GetMark(nMark)->GetMarkedSdrObj();
                SdrInventor nInv    = pObject->GetObjInventor();

                if (nInv == SdrInventor::Default)
                {
                    sal_uInt16 eObjKind = pObject->GetObjIdentifier();
                    PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);

                    if (ePresObjKind == PRESOBJ_TITLE ||
                        ePresObjKind == PRESOBJ_NOTES)
                    {
                        // Presentation object (except outline)
                        SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
                        DBG_ASSERT(pSheet, "StyleSheet not found");

                        SfxItemSet aTempSet( pSheet->GetItemSet() );
                        aTempSet.Put( rSet );
                        aTempSet.ClearInvalidItems();

                        // Undo-Action
                        mpDocSh->GetUndoManager()->AddUndoAction(
                            std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));

                        pSheet->GetItemSet().Put(aTempSet,false);
                        pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
                        bOk = true;
                    }
                    else if (eObjKind == OBJ_OUTLINETEXT)
                    {
                        // Presentation object outline
                        for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
                        {
                            OUString aName = rPage.GetLayoutName() + " " +
                                OUString::number(nLevel);
                            SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pStShPool->
                                                Find(aName, SfxStyleFamily::Page));
                            DBG_ASSERT(pSheet, "StyleSheet not found");

                            SfxItemSet aTempSet( pSheet->GetItemSet() );

                            if( nLevel > 1 )
                            {
                                // for all levels over 1, clear all items that will be
                                // hard set to level 1
                                SfxWhichIter aWhichIter(rSet);
                                sal_uInt16 nWhich(aWhichIter.FirstWhich());
                                while( nWhich )
                                {
                                    if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
                                        aTempSet.ClearItem( nWhich );
                                    nWhich = aWhichIter.NextWhich();
                                }

                            }
                            else
                            {
                                // put the items hard into level one
                                aTempSet.Put( rSet );
                            }

                            aTempSet.ClearInvalidItems();

                            // Undo-Action
                            mpDocSh->GetUndoManager()->AddUndoAction(
                                std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));

                            pSheet->GetItemSet().Set(aTempSet,false);
                            pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
                        }

                        // remove all hard set items from shape that are now set in style
                        SfxWhichIter aWhichIter(rSet);
                        sal_uInt16 nWhich(aWhichIter.FirstWhich());
                        while( nWhich )
                        {
                            if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
                                pObject->ClearMergedItem( nWhich );
                            nWhich = aWhichIter.NextWhich();
                        }

                        bOk = true;
                    }
                }
                SetMasterAttributes(pObject, rPage, rSet, pStShPool, bOk, bMaster, bSlide);
            }

            if(!bOk)
@@ -370,6 +315,111 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet,
    return bOk;
}

void DrawView::SetMasterAttributes( SdrObject* pObject, SdPage& rPage, SfxItemSet rSet, SfxStyleSheetBasePool* pStShPool, bool& bOk, bool /*bMaster*/, bool bSlide )
{
   SdrInventor nInv    = pObject->GetObjInventor();

   if (nInv == SdrInventor::Default)
   {
        sal_uInt16 eObjKind = pObject->GetObjIdentifier();
        PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
        if (bSlide && eObjKind == OBJ_TEXT)
        {
            // Presentation object (except outline)
            SfxStyleSheet* pSheet = rPage.GetTextStyleSheetForObject(pObject);
            DBG_ASSERT(pSheet, "StyleSheet not found");

            SfxItemSet aTempSet( pSheet->GetItemSet() );
            aTempSet.Put( rSet );
            aTempSet.ClearInvalidItems();

            // Undo-Action
            mpDocSh->GetUndoManager()->AddUndoAction(
                std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));

            pSheet->GetItemSet().Put(aTempSet,false);
            pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
            bOk = true;
        }

        if (!bSlide &&
            (ePresObjKind == PRESOBJ_TITLE ||
             ePresObjKind == PRESOBJ_NOTES))
        {
            // Presentation object (except outline)
            SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
            DBG_ASSERT(pSheet, "StyleSheet not found");

            SfxItemSet aTempSet( pSheet->GetItemSet() );
            aTempSet.Put( rSet );
            aTempSet.ClearInvalidItems();

            // Undo-Action
            mpDocSh->GetUndoManager()->AddUndoAction(
                std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));

            pSheet->GetItemSet().Put(aTempSet,false);
            pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
            bOk = true;
        }
        else if (eObjKind == OBJ_OUTLINETEXT)
        {
            // Presentation object outline
            for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
            {
                OUString aName = rPage.GetLayoutName() + " " +
                    OUString::number(nLevel);
                SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pStShPool->
                                    Find(aName, SfxStyleFamily::Page));
                DBG_ASSERT(pSheet, "StyleSheet not found");

                SfxItemSet aTempSet( pSheet->GetItemSet() );

                if( nLevel > 1 )
                {
                    // for all levels over 1, clear all items that will be
                    // hard set to level 1
                    SfxWhichIter aWhichIter(rSet);
                    sal_uInt16 nWhich(aWhichIter.FirstWhich());
                    while( nWhich )
                    {
                        if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
                            aTempSet.ClearItem( nWhich );
                        nWhich = aWhichIter.NextWhich();
                    }

                }
                else
                {
                    // put the items hard into level one
                    aTempSet.Put( rSet );
                }

                aTempSet.ClearInvalidItems();

                // Undo-Action
                mpDocSh->GetUndoManager()->AddUndoAction(
                    std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));

                pSheet->GetItemSet().Set(aTempSet,false);
                pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
            }

            // remove all hard set items from shape that are now set in style
            SfxWhichIter aWhichIter(rSet);
            sal_uInt16 nWhich(aWhichIter.FirstWhich());
            while( nWhich )
            {
                if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
                    pObject->ClearMergedItem( nWhich );
                nWhich = aWhichIter.NextWhich();
            }

            bOk = true;
        }
   }
}

/**
 * Notify for change of site arrangement
 */
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 2c5df1a..5ad0e0b 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1449,6 +1449,13 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
        }
        break;

        case SID_NUMBERING_AND_POSITION:
        {
            SetCurrentFunction( FuBulletAndPosition::Create( this, GetActiveWindow(), mpDrawView.get(), GetDoc(), rReq ) );
            Cancel();
        }
        break;

        case FN_INSERT_SOFT_HYPHEN:
        case FN_INSERT_HARDHYPHEN:
        case FN_INSERT_HARD_SPACE:
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index 9cfb5ae..da0a60c 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -980,7 +980,7 @@ void OutlineView::PrepareClose()
/**
 * Set attributes of the selected text
 */
bool OutlineView::SetAttributes(const SfxItemSet& rSet, bool )
bool OutlineView::SetAttributes(const SfxItemSet& rSet, bool /*bSlide*/, bool /*bReplaceAll*/, bool /*bMaster*/)
{
    bool bOk = false;

diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index d5d986d..4793063 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -498,7 +498,7 @@ void View::MarkListHasChanged()
        maSmartTags.deselect();
}

bool View::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
bool View::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll, bool /*bSlide*/, bool /*bMaster*/)
{
    bool bOk = FmFormView::SetAttributes(rSet, bReplaceAll);
    return bOk;
diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml
index 1aaa0978..7e20197 100644
--- a/sd/uiconfig/simpress/menubar/menubar.xml
+++ b/sd/uiconfig/simpress/menubar/menubar.xml
@@ -393,6 +393,7 @@
      <menu:menuitem menu:id=".uno:FontDialog"/>
      <menu:menuitem menu:id=".uno:ParagraphDialog"/>
      <menu:menuitem menu:id=".uno:OutlineBullet"/>
      <menu:menuitem menu:id=".uno:NumberingAndPosition"/>
      <menu:menuseparator/>
      <menu:menu menu:id=".uno:TableMenu">
        <menu:menupopup>
diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr
index 4279ed5..95aa21b 100644
--- a/solenv/sanitizers/ui/cui.suppr
+++ b/solenv/sanitizers/ui/cui.suppr
@@ -466,3 +466,6 @@ cui/uiconfig/ui/twolinespage.ui://GtkTreeView[@id='endbracket'] no-labelled-by
cui/uiconfig/ui/wordcompletionpage.ui://GtkTreeView[@id='entries'] no-labelled-by
cui/uiconfig/ui/wordcompletionpage.ui://GtkSpinButton[@id='maxentries'] duplicate-mnemonic
cui/uiconfig/ui/wordcompletionpage.ui://GtkSpinButton[@id='minwordlen'] no-labelled-by
cui/uiconfig/ui/bulletandposition.ui://GtkToggleButton[@id='left'] button-no-label
cui/uiconfig/ui/bulletandposition.ui://GtkToggleButton[@id='center'] button-no-label
cui/uiconfig/ui/bulletandposition.ui://GtkToggleButton[@id='right'] button-no-label
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 3aaf07b..62f7fc7 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -5894,6 +5894,23 @@ SfxVoidItem OutlineBullet SID_OUTLINE_BULLET
    GroupId = SfxGroupId::Format;
]

SfxVoidItem NumberingAndPosition SID_NUMBERING_AND_POSITION
(SfxStringItem Page FN_PARAM_1)
[
    AutoUpdate = FALSE,
    FastCall = FALSE,
    ReadOnlyDoc = FALSE,
    Toggle = FALSE,
    Container = FALSE,
    RecordAbsolute = FALSE,
    RecordPerSet;

    AccelConfig = FALSE,
    MenuConfig = FALSE,
    ToolBoxConfig = TRUE,
    GroupId = SfxGroupId::Format;
]

SfxUInt16Item SetNumber FN_SVX_SET_NUMBER
[
    AutoUpdate = TRUE,