[Libreoffice-commits] core.git: include/sfx2 include/tools sfx2/source vcl/source

2018-06-18 Thread Caolán McNamara
 include/sfx2/securitypage.hxx   |7 -
 include/tools/wintypes.hxx  |3 
 sfx2/source/dialog/securitypage.cxx |  139 
 vcl/source/control/button.cxx   |5 -
 4 files changed, 65 insertions(+), 89 deletions(-)

New commits:
commit 2a99f3311829350a3287fda25661bc952d1646da
Author: Caolán McNamara 
Date:   Mon Jun 18 09:29:38 2018 +0100

weld SfxSecurityPage

and drop the sole use of WB_EARLYTOGGLE

Change-Id: I01e7d085eb3f9daf5a62a048178ab90defb4c5b1
Reviewed-on: https://gerrit.libreoffice.org/55983
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/include/sfx2/securitypage.hxx b/include/sfx2/securitypage.hxx
index 67d27d076b84..deb7fe6d8f8c 100644
--- a/include/sfx2/securitypage.hxx
+++ b/include/sfx2/securitypage.hxx
@@ -20,11 +20,8 @@
 #define INCLUDED_SFX2_SECURITYPAGE_HXX
 
 #include 
-#include 
-
 #include 
 
-
 struct SfxSecurityPage_Impl;
 
 class SfxSecurityPage : public SfxTabPage
@@ -36,11 +33,11 @@ protected:
 virtual voidReset( const SfxItemSet* ) override;
 
 public:
-SfxSecurityPage(vcl::Window* pParent, const SfxItemSet&);
+SfxSecurityPage(TabPageParent pParent, const SfxItemSet&);
 static VclPtr Create(TabPageParent pParent, const SfxItemSet*);
+weld::Builder& GetBuilder() const { return *m_xBuilder; }
 };
 
-
 #endif // INCLUDED_SFX2_SECURITYPAGE_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/wintypes.hxx b/include/tools/wintypes.hxx
index b9e7d007fc55..9f5229806e3f 100644
--- a/include/tools/wintypes.hxx
+++ b/include/tools/wintypes.hxx
@@ -191,9 +191,6 @@ WinBits const WB_PATHELLIPSIS = 0x0010;
 WinBits const WB_EXTRAOFFSET =  0x0200;
 WinBits const WB_NOMULTILINE =  0x1000;
 
-// Window-Bits for CheckBox
-WinBits const WB_EARLYTOGGLE =  SAL_CONST_INT64(0x40);
-
 // Window-Bits for Edit
 WinBits const WB_READONLY = 0x0200;
 WinBits const WB_NOHIDESELECTION =  SAL_CONST_INT64(0x10);
diff --git a/sfx2/source/dialog/securitypage.cxx 
b/sfx2/source/dialog/securitypage.cxx
index cea3583a98cc..0633292f3239 100644
--- a/sfx2/source/dialog/securitypage.cxx
+++ b/sfx2/source/dialog/securitypage.cxx
@@ -17,7 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
+#include 
 #include 
 
 #include 
@@ -40,10 +40,8 @@
 
 #include 
 
-
 using namespace ::com::sun::star;
 
-
 namespace
 {
 enum RedliningMode  { RL_NONE, RL_WRITER, RL_CALC };
@@ -134,15 +132,10 @@ static bool lcl_IsPasswordCorrect( const OUString 
&rPassword )
 return bRes;
 }
 
-
 struct SfxSecurityPage_Impl
 {
 SfxSecurityPage &   m_rMyTabPage;
 
-VclPtrm_pOpenReadonlyCB;
-VclPtrm_pRecordChangesCB; // for record changes
-VclPtr  m_pProtectPB;   // for record changes
-VclPtr  m_pUnProtectPB; // for record changes
 RedliningMode   m_eRedlingMode; // for record changes
 
 boolm_bOrigPasswordIsConfirmed;
@@ -152,8 +145,13 @@ struct SfxSecurityPage_Impl
 OUStringm_aEndRedliningWarning;
 boolm_bEndRedliningWarningDone;
 
-DECL_LINK( RecordChangesCBToggleHdl, CheckBox&, void );
-DECL_LINK( ChangeProtectionPBHdl, Button*, void );
+std::unique_ptr m_xOpenReadonlyCB;
+std::unique_ptr m_xRecordChangesCB; // for 
record changes
+std::unique_ptr m_xProtectPB;   // for record 
changes
+std::unique_ptr m_xUnProtectPB; // for record 
changes
+
+DECL_LINK(RecordChangesCBToggleHdl, weld::ToggleButton&, void);
+DECL_LINK(ChangeProtectionPBHdl, weld::Button&, void);
 
 SfxSecurityPage_Impl( SfxSecurityPage &rDlg );
 
@@ -161,29 +159,25 @@ struct SfxSecurityPage_Impl
 voidReset_Impl();
 };
 
-
-SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rTabPage ) :
-m_rMyTabPage(rTabPage),
-m_eRedlingMode  ( RL_NONE ),
-m_bOrigPasswordIsConfirmed  ( false ),
-m_bNewPasswordIsValid   ( false ),
-m_aEndRedliningWarning  ( 
SfxResId(RID_SVXSTR_END_REDLINING_WARNING) ),
-m_bEndRedliningWarningDone  ( false )
+SfxSecurityPage_Impl::SfxSecurityPage_Impl(SfxSecurityPage &rTabPage)
+: m_rMyTabPage(rTabPage)
+, m_eRedlingMode(RL_NONE)
+, m_bOrigPasswordIsConfirmed(false)
+, m_bNewPasswordIsValid(false)
+, m_aEndRedliningWarning(SfxResId(RID_SVXSTR_END_REDLINING_WARNING))
+, m_bEndRedliningWarningDone(false)
+, m_xOpenReadonlyCB(rTabPage.GetBuilder().weld_check_button("readonly"))
+, 
m_xRecordChangesCB(rTabPage.GetBuilder().weld_check_button("recordchanges"))
+, m_xProtectPB(rTabPage.GetBuilder().weld_button("protect"))
+, m_xUnProtectPB(rTabPage.GetBuilder().weld_button("unprotect"))
 {
-rTabPage.get(m_pOpenRe

[Libreoffice-commits] core.git: include/sfx2 include/tools sfx2/source

2014-07-25 Thread Noel Grandin
 include/sfx2/frame.hxx|6 +--
 include/tools/ref.hxx |   69 +++---
 sfx2/source/view/frame.cxx|6 ---
 sfx2/source/view/frame2.cxx   |3 +
 sfx2/source/view/impframe.hxx |5 +--
 5 files changed, 44 insertions(+), 45 deletions(-)

New commits:
commit 2295697df9c66f4b19d6874106729fede51ec93d
Author: Noel Grandin 
Date:   Thu Jul 10 17:05:19 2014 +0200

convert the weak reference macro in tools into a template

which required making SfxFrame subclass SvCompatWeakBase,
but that makes the relationships clearer anyhow.

Change-Id: I209d05359d50111eacac72c971bb46ccf569ba49
Reviewed-on: https://gerrit.libreoffice.org/10285
Tested-by: LibreOffice gerrit bot 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx
index 18bf6cd..7a64d9b 100644
--- a/include/sfx2/frame.hxx
+++ b/include/sfx2/frame.hxx
@@ -75,7 +75,6 @@ class SfxDispatcher;
 class Rectangle;
 class SfxRequest;
 class SfxUnoControllerItem;
-class SvCompatWeakHdl;
 class SystemWindow;
 
 class SfxFrame;
@@ -97,7 +96,7 @@ typedef ::std::vector TargetList;
 // from their parent frames.
 
 
-class SFX2_DLLPUBLIC SfxFrame
+class SFX2_DLLPUBLIC SfxFrame : public SvCompatWeakBase
 {
 friend class SfxFrameIterator;
 friend class SfxFrameWindow_Impl;
@@ -125,7 +124,6 @@ public:
 CreateBlankFrame();
 static SfxFrame*Create( SfxObjectShell& rDoc, Window& rWindow, 
sal_uInt16 nViewId, bool bHidden );
 
-SvCompatWeakHdl*GetHdl();
 Window& GetWindow() const { return *pWindow;}
 voidCancelTransfers( bool bCancelLoadEnv = true );
 boolDoClose();
@@ -209,7 +207,7 @@ private:
 SAL_DLLPRIVATE void Construct_Impl();
 };
 
-SV_DECL_COMPAT_WEAK_REF( SfxFrame )
+typedef SvCompatWeakRef SfxFrameWeakRef;
 
 class SfxFrameIterator
 {
diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx
index 98740f0..ed34f41 100644
--- a/include/tools/ref.hxx
+++ b/include/tools/ref.hxx
@@ -189,56 +189,63 @@ public:
 { return nRefCount; }
 };
 
-/** We only have one weak reference in LO, in include/sfx2/frame.hxx, class 
SfxFrameWeak.
-This acts as a intermediary between SfxFrameWeak and SfxFrame_Impl.
+template
+class SvCompatWeakBase;
+
+/** SvCompatWeakHdl acts as a intermediary between SvCompatWeakRef and T.
 */
+template
 class SvCompatWeakHdl : public SvRefBase
 {
-friend class SvCompatWeakBase;
-void* _pObj;
+friend class SvCompatWeakBase;
+T* _pObj;
 
-SvCompatWeakHdl( void* pObj ) : _pObj( pObj ) {}
+SvCompatWeakHdl( T* pObj ) : _pObj( pObj ) {}
 
 public:
 void  ResetWeakBase( ) { _pObj = 0; }
-void* GetObj(){ return _pObj; }
+T*GetObj(){ return _pObj; }
 };
 
-/** We only have one place that extends this, in 
sfx2/source/view/impframe.hxx, class SfxFrame_Impl,
-its function is to notify the SvCompatWeakHdl when an SfxFrame_Impl object 
is deleted.
+/** We only have one place that extends this, in include/sfx2/frame.hxx, class 
SfxFrame.
+Its function is to notify the SvCompatWeakHdl when an SfxFrame object is 
deleted.
 */
+template
 class SvCompatWeakBase
 {
-tools::SvRef _xHdl;
+tools::SvRef< SvCompatWeakHdl > _xHdl;
 
 public:
-// Does not use initializer due to compiler warnings,
-// because the lifetime of the _xHdl object can exceed the lifetime of 
this class.
-SvCompatWeakBase( void* pObj ) { _xHdl = new SvCompatWeakHdl( pObj ); }
+/** Does not use initializer due to compiler warnings,
+because the lifetime of the _xHdl object can exceed the lifetime of 
this class.
+ */
+SvCompatWeakBase( T* pObj ) { _xHdl = new SvCompatWeakHdl( pObj ); }
 
 ~SvCompatWeakBase() { _xHdl->ResetWeakBase(); }
 
-SvCompatWeakHdl* GetHdl() { return _xHdl; }
+SvCompatWeakHdl* GetHdl() { return _xHdl; }
 };
 
-#define SV_DECL_COMPAT_WEAK_REF( ClassName )\
-class ClassName##WeakRef\
-{   \
-tools::SvRef _xHdl;\
-public: \
-inline   ClassName##WeakRef( ) {}   \
-inline   ClassName##WeakRef( ClassName* pObj ) {\
-if( pObj ) _xHdl = pObj->GetHdl(); }\
-inline ClassName##WeakRef& operator = ( ClassName * pObj ) {\
-_xHdl = pObj ? pObj->GetHdl() : 0; return *this; }  \
-inline boolIs() const { \
-return _xHdl.Is() && _xHdl->GetObj(); } \
-inline ClassName * operator -> () const {   \
-return (ClassName*) ( _xHdl.Is() ? _xHdl->GetObj() : 0 ); } \
-inline Cl

[Libreoffice-commits] core.git: include/sfx2 include/tools sfx2/source

2014-07-17 Thread Noel Grandin
 include/sfx2/frame.hxx   |4 ++--
 include/tools/ref.hxx|   10 +-
 sfx2/source/doc/docfile.cxx  |2 +-
 sfx2/source/doc/sfxbasemodel.cxx |4 ++--
 sfx2/source/view/frame.cxx   |2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 490d30281726052bf4c36d4b79136ec7e7fd8395
Author: Noel Grandin 
Date:   Thu Jul 10 15:49:31 2014 +0200

rename the Weak stuff in tools/ref.hxx to WeakRef

.. which more accurately reflects it's purpose

Change-Id: Ibb87a47a3d1f3e35ac2820f14c71adf3b227c961
Reviewed-on: https://gerrit.libreoffice.org/10283
Reviewed-by: Thomas Arnhold 
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx
index 8730dbd..18bf6cd 100644
--- a/include/sfx2/frame.hxx
+++ b/include/sfx2/frame.hxx
@@ -209,7 +209,7 @@ private:
 SAL_DLLPRIVATE void Construct_Impl();
 };
 
-SV_DECL_COMPAT_WEAK( SfxFrame )
+SV_DECL_COMPAT_WEAK_REF( SfxFrame )
 
 class SfxFrameIterator
 {
@@ -229,7 +229,7 @@ public:
 class SFX2_DLLPUBLIC SfxFrameItem: public SfxPoolItem
 {
 SfxFrame*   pFrame;
-SfxFrameWeakwFrame;
+SfxFrameWeakRef wFrame;
 SAL_DLLPRIVATE void SetFramePtr_Impl( SfxFrame* /*pFrameP*/ ) { pFrame = 
wFrame; }
 
 public:
diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx
index 1cd1474..1d5a37a 100644
--- a/include/tools/ref.hxx
+++ b/include/tools/ref.hxx
@@ -221,16 +221,16 @@ public:
 SvCompatWeakHdl* GetHdl() { return _xHdl; }
 };
 
-#define SV_DECL_COMPAT_WEAK( ClassName )\
-class ClassName##Weak   \
+#define SV_DECL_COMPAT_WEAK_REF( ClassName )\
+class ClassName##WeakRef\
 {   \
 tools::SvRef _xHdl;\
 public: \
-inline   ClassName##Weak( ) {}  \
-inline   ClassName##Weak( ClassName* pObj ) {   \
+inline   ClassName##WeakRef( ) {}   \
+inline   ClassName##WeakRef( ClassName* pObj ) {\
 if( pObj ) _xHdl = pObj->GetHdl(); }\
 inline void  Clear() { _xHdl.Clear(); } \
-inline ClassName##Weak& operator = ( ClassName * pObj ) {   \
+inline ClassName##WeakRef& operator = ( ClassName * pObj ) {\
 _xHdl = pObj ? pObj->GetHdl() : 0; return *this; }  \
 inline boolIs() const { \
 return _xHdl.Is() && _xHdl->GetObj(); } \
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 4cb807d..67e7d10 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -207,7 +207,7 @@ public:
 const SfxFilter* pOrigFilter;
 OUStringaOrigURL;
 DateTime aExpireTime;
-SfxFrameWeak wLoadTargetFrame;
+SfxFrameWeakRef  wLoadTargetFrame;
 SvKeyValueIteratorRef xAttributes;
 
 svtools::AsynchronLink  aDoneLink;
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index eb50885..eac066e 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -4193,8 +4193,8 @@ namespace sfx { namespace intern {
 }
 
 private:
-boolm_bSuccess;
-SfxFrameWeakm_aWeakFrame;
+bool m_bSuccess;
+SfxFrameWeakRef  m_aWeakFrame;
 };
 } }
 
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index 1c2d447..63a82c8 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -310,7 +310,7 @@ void SfxFrame::CancelTransfers( bool /*bCancelLoadEnv*/ )
 GetChildFrame( n )->CancelTransfers();
 
 //  Check if StarOne-Loader should be canceled
-SfxFrameWeak wFrame( this );
+SfxFrameWeakRef wFrame( this );
 if (wFrame.Is())
 pImp->bInCancelTransfers = false;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits