[Libreoffice-commits] core.git: extensions/source extensions/uiconfig

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 18 08:06:18 UTC 2018


 extensions/source/propctrlr/controlfontdialog.cxx      |    6 -
 extensions/source/propctrlr/fontdialog.cxx             |   29 +-----
 extensions/source/propctrlr/fontdialog.hxx             |    9 -
 extensions/source/propctrlr/formcomponenthandler.cxx   |    6 -
 extensions/source/propctrlr/handlerhelper.cxx          |   16 +++
 extensions/source/propctrlr/handlerhelper.hxx          |    2 
 extensions/source/propctrlr/propertyhandler.cxx        |    5 +
 extensions/source/propctrlr/propertyhandler.hxx        |    2 
 extensions/uiconfig/spropctrlr/ui/controlfontdialog.ui |   78 ++++++++++++++---
 9 files changed, 105 insertions(+), 48 deletions(-)

New commits:
commit 65e7aedb06db332a6feedfcf08706ed97627d0d8
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Sep 17 12:59:25 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 18 10:05:48 2018 +0200

    weld ControlCharacterDialog
    
    Change-Id: Iac11d3ea29cc9529a786db3b91b79a9e7bcbd2cf
    Reviewed-on: https://gerrit.libreoffice.org/60581
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/extensions/source/propctrlr/controlfontdialog.cxx b/extensions/source/propctrlr/controlfontdialog.cxx
index 821c9ccbb722..51a3a1dc356e 100644
--- a/extensions/source/propctrlr/controlfontdialog.cxx
+++ b/extensions/source/propctrlr/controlfontdialog.cxx
@@ -137,7 +137,7 @@ namespace pcr
         return new ::cppu::OPropertyArrayHelper(aProps);
     }
 
-    svt::OGenericUnoDialog::Dialog OControlFontDialog::createDialog(vcl::Window* _pParent)
+    svt::OGenericUnoDialog::Dialog OControlFontDialog::createDialog(vcl::Window* pParent)
     {
         ControlCharacterDialog::createItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults);
 
@@ -148,7 +148,7 @@ namespace pcr
         // sets a new introspectee and re-executes us. In this case, the dialog returned here (upon the first
         // execute) will be re-used upon the second execute, and thus it won't be initialized correctly.
 
-        return svt::OGenericUnoDialog::Dialog(VclPtr<ControlCharacterDialog>::Create(_pParent, *m_pFontItems));
+        return svt::OGenericUnoDialog::Dialog(o3tl::make_unique<ControlCharacterDialog>(pParent ? pParent->GetFrameWeld() : nullptr, *m_pFontItems));
     }
 
     void OControlFontDialog::executedDialog(sal_Int16 _nExecutionResult)
@@ -156,7 +156,7 @@ namespace pcr
         OSL_ENSURE(m_aDialog, "OControlFontDialog::executedDialog: no dialog anymore?!!");
         if (m_aDialog && (RET_OK == _nExecutionResult) && m_xControlModel.is())
         {
-            const SfxItemSet* pOutput = static_cast<ControlCharacterDialog*>(m_aDialog.m_xVclDialog.get())->GetOutputItemSet();
+            const SfxItemSet* pOutput = static_cast<ControlCharacterDialog*>(m_aDialog.m_xWeldDialog.get())->GetOutputItemSet();
             if (pOutput)
                 ControlCharacterDialog::translateItemsToProperties( *pOutput, m_xControlModel );
         }
diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx
index c901bf7c2c7b..76854b0439d0 100644
--- a/extensions/source/propctrlr/fontdialog.cxx
+++ b/extensions/source/propctrlr/fontdialog.cxx
@@ -167,26 +167,19 @@ namespace pcr
             _rSet.InvalidateItem(_nItemId);
     }
 
-
     //= ControlCharacterDialog
-
-
-    ControlCharacterDialog::ControlCharacterDialog(vcl::Window* _pParent, const SfxItemSet& _rCoreSet)
-        : SfxTabDialog(_pParent, "ControlFontDialog",
-            "modules/spropctrlr/ui/controlfontdialog.ui", &_rCoreSet)
-        , m_nCharsId(0)
+    ControlCharacterDialog::ControlCharacterDialog(weld::Window* pParent, const SfxItemSet& _rCoreSet)
+        : SfxTabDialogController(pParent, "modules/spropctrlr/ui/controlfontdialog.ui", "ControlFontDialog", &_rCoreSet)
     {
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-        m_nCharsId = AddTabPage("font", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_NAME), nullptr );
+        AddTabPage("font", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_NAME), nullptr );
         AddTabPage("fonteffects", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_EFFECTS), nullptr );
     }
 
-
     ControlCharacterDialog::~ControlCharacterDialog()
     {
     }
 
-
     void ControlCharacterDialog::translatePropertiesToItems(const Reference< XPropertySet >& _rxModel, SfxItemSet* _pSet)
     {
         OSL_ENSURE(_pSet && _rxModel.is(), "ControlCharacterDialog::translatePropertiesToItems: invalid arguments!");
@@ -284,10 +277,8 @@ namespace pcr
         _pSet->DisableItem(SID_ATTR_CHAR_CASEMAP);
         _pSet->DisableItem(SID_ATTR_CHAR_CONTOUR);
         _pSet->DisableItem(SID_ATTR_CHAR_SHADOWED);
-
     }
 
-
     namespace
     {
         void lcl_pushBackPropertyValue( std::vector< NamedValue >& _out_properties, const OUString& _name, const Any& _value )
@@ -296,7 +287,6 @@ namespace pcr
         }
     }
 
-
     void ControlCharacterDialog::translateItemsToProperties( const SfxItemSet& _rSet, std::vector< NamedValue >& _out_properties )
     {
         _out_properties.clear();
@@ -453,7 +443,6 @@ namespace pcr
         }
     }
 
-
     void ControlCharacterDialog::translateItemsToProperties( const SfxItemSet& _rSet, const Reference< XPropertySet >& _rxModel)
     {
         OSL_ENSURE( _rxModel.is(), "ControlCharacterDialog::translateItemsToProperties: invalid arguments!" );
@@ -473,7 +462,6 @@ namespace pcr
         }
     }
 
-
     void ControlCharacterDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults)
     {
         // just to be sure ....
@@ -544,7 +532,6 @@ namespace pcr
         _rpSet.reset(new SfxItemSet(*_rpPool));
     }
 
-
     void ControlCharacterDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults)
     {
         // from the pool, get and remember the font list (needs to be deleted)
@@ -567,18 +554,16 @@ namespace pcr
         delete pFontList;
     }
 
-
-    void ControlCharacterDialog::PageCreated( sal_uInt16 _nId, SfxTabPage& _rPage )
+    void ControlCharacterDialog::PageCreated(const OString& rId, SfxTabPage& rPage)
     {
         SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
-        if ( _nId == m_nCharsId ) {
+        if (rId == "font")
+        {
             aSet.Put (SvxFontListItem(static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST))));
             aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_HIDE_LANGUAGE));
-            _rPage.PageCreated(aSet);
+            rPage.PageCreated(aSet);
         }
     }
-
-
 }   // namespace pcr
 
 
diff --git a/extensions/source/propctrlr/fontdialog.hxx b/extensions/source/propctrlr/fontdialog.hxx
index 92407401cda2..c0fa45e33d84 100644
--- a/extensions/source/propctrlr/fontdialog.hxx
+++ b/extensions/source/propctrlr/fontdialog.hxx
@@ -30,11 +30,10 @@ namespace pcr
 
 
     //= ControlCharacterDialog
-
-    class ControlCharacterDialog : public SfxTabDialog
+    class ControlCharacterDialog : public SfxTabDialogController
     {
     public:
-        ControlCharacterDialog(vcl::Window* _pParent, const SfxItemSet& _rCoreSet);
+        ControlCharacterDialog(weld::Window* pParent, const SfxItemSet& rCoreSet);
         virtual ~ControlCharacterDialog() override;
 
         /// creates an item set to be used with this dialog
@@ -61,9 +60,7 @@ namespace pcr
             std::vector< css::beans::NamedValue >& _out_properties );
 
     protected:
-        virtual void PageCreated(sal_uInt16 _nId, SfxTabPage& _rPage) override;
-    private:
-        sal_uInt16 m_nCharsId;
+        virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override;
     };
 
 }   // namespace pcr
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 803bc84abb49..5baaa7b5bbdd 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2785,11 +2785,11 @@ namespace pcr
 
         {   // do this in an own block. The dialog needs to be destroyed before we call
             // destroyItemSet
-            ScopedVclPtrInstance< ControlCharacterDialog > aDlg( impl_getDefaultDialogParent_nothrow(), *pSet );
+            ControlCharacterDialog aDlg(impl_getDefaultDialogFrame_nothrow(), *pSet);
             _rClearBeforeDialog.clear();
-            if ( RET_OK == aDlg->Execute() )
+            if (RET_OK == aDlg.execute())
             {
-                const SfxItemSet* pOut = aDlg->GetOutputItemSet();
+                const SfxItemSet* pOut = aDlg.GetOutputItemSet();
                 if ( pOut )
                 {
                     std::vector< NamedValue > aFontPropertyValues;
diff --git a/extensions/source/propctrlr/handlerhelper.cxx b/extensions/source/propctrlr/handlerhelper.cxx
index 0bf05ceb15d3..cdbefa2b994c 100644
--- a/extensions/source/propctrlr/handlerhelper.cxx
+++ b/extensions/source/propctrlr/handlerhelper.cxx
@@ -35,6 +35,7 @@
 #include <com/sun/star/inspection/XNumericControl.hpp>
 #include <tools/diagnose_ex.h>
 #include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
 
 #include <algorithm>
 
@@ -290,7 +291,20 @@ namespace pcr
         return pInspectorWindow;
     }
 
-
+    weld::Window* PropertyHandlerHelper::getDialogParentFrame(const Reference<XComponentContext>& _rContext)
+    {
+        weld::Window* pInspectorWindow = nullptr;
+        try
+        {
+            Reference< XWindow > xInspectorWindow( _rContext->getValueByName( "DialogParentWindow" ), UNO_QUERY_THROW );
+            pInspectorWindow = Application::GetFrameWeld(xInspectorWindow);
+        }
+        catch( const Exception& )
+        {
+            DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
+        }
+        return pInspectorWindow;
+    }
 } // namespace pcr
 
 
diff --git a/extensions/source/propctrlr/handlerhelper.hxx b/extensions/source/propctrlr/handlerhelper.hxx
index 63904bf776de..cd7705e8e542 100644
--- a/extensions/source/propctrlr/handlerhelper.hxx
+++ b/extensions/source/propctrlr/handlerhelper.hxx
@@ -31,6 +31,7 @@
 #include <vector>
 
 namespace vcl { class Window; }
+namespace weld { class Window; }
 namespace com { namespace sun { namespace star {
     namespace inspection {
         struct LineDescriptor;
@@ -199,6 +200,7 @@ namespace pcr
                 the component context which was used to create the component calling this method
         */
         static vcl::Window* getDialogParentWindow( const css::uno::Reference< css::uno::XComponentContext > & _rContext );
+        static weld::Window* getDialogParentFrame( const css::uno::Reference< css::uno::XComponentContext > & _rContext );
 
 
         /** determines whether given PropertyAttributes require a to-be-created
diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx
index 093ff3268637..6ea9864adcdd 100644
--- a/extensions/source/propctrlr/propertyhandler.cxx
+++ b/extensions/source/propctrlr/propertyhandler.cxx
@@ -310,6 +310,11 @@ namespace pcr
         return PropertyHandlerHelper::getDialogParentWindow( m_xContext );
     }
 
+    weld::Window* PropertyHandler::impl_getDefaultDialogFrame_nothrow() const
+    {
+        return PropertyHandlerHelper::getDialogParentFrame(m_xContext);
+    }
+
     PropertyId PropertyHandler::impl_getPropertyId_throwUnknownProperty( const OUString& _rPropertyName ) const
     {
         PropertyId nPropId = m_pInfoService->getPropertyId( _rPropertyName );
diff --git a/extensions/source/propctrlr/propertyhandler.hxx b/extensions/source/propctrlr/propertyhandler.hxx
index faad4b062f47..325f207a2312 100644
--- a/extensions/source/propctrlr/propertyhandler.hxx
+++ b/extensions/source/propctrlr/propertyhandler.hxx
@@ -53,6 +53,7 @@ namespace com { namespace sun { namespace star {
 } } }
 
 namespace vcl { class Window; }
+namespace weld { class Window; }
 
 namespace pcr
 {
@@ -136,6 +137,7 @@ namespace pcr
         /** retrieves a window which can be used as parent for dialogs
         */
         vcl::Window* impl_getDefaultDialogParent_nothrow() const;
+        weld::Window* impl_getDefaultDialogFrame_nothrow() const;
 
         /** retrieves the property id for a given property name
             @throw css::beans::UnknownPropertyException
diff --git a/extensions/uiconfig/spropctrlr/ui/controlfontdialog.ui b/extensions/uiconfig/spropctrlr/ui/controlfontdialog.ui
index 6ac06190f6a7..b1724e84a113 100644
--- a/extensions/uiconfig/spropctrlr/ui/controlfontdialog.ui
+++ b/extensions/uiconfig/spropctrlr/ui/controlfontdialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="pcr">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="ControlFontDialog">
@@ -7,6 +7,9 @@
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="controlfontdialog|ControlFontDialog">Character</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>
@@ -17,12 +20,10 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="ok">
-                <property name="label">gtk-ok</property>
+              <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="can_default">True</property>
-                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_stock">True</property>
               </object>
@@ -33,10 +34,12 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="cancel">
-                <property name="label">gtk-cancel</property>
+              <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>
@@ -47,8 +50,8 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="help">
-                <property name="label">gtk-help</property>
+              <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>
@@ -58,12 +61,11 @@
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">2</property>
-                <property name="secondary">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="reset">
-                <property name="label">gtk-revert-to-saved</property>
+              <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>
@@ -73,6 +75,7 @@
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">3</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -89,6 +92,7 @@
             <property name="can_focus">True</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
+            <property name="scrollable">True</property>
             <child>
               <object class="GtkGrid">
                 <property name="visible">True</property>
@@ -96,6 +100,30 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
             </child>
             <child type="tab">
@@ -115,6 +143,30 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
               <packing>
                 <property name="position">1</property>
@@ -141,10 +193,10 @@
       </object>
     </child>
     <action-widgets>
+      <action-widget response="0">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-widget response="0">reset</action-widget>
     </action-widgets>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list