[Libreoffice-commits] core.git: 3 commits - include/editeng include/tools starmath/inc starmath/source sw/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Jan 26 06:14:49 UTC 2017


 include/editeng/flditem.hxx      |   54 +++++++++++++++++++--------------------
 include/editeng/measfld.hxx      |    2 -
 include/tools/pstm.hxx           |    2 -
 starmath/inc/view.hxx            |    6 ++--
 starmath/source/view.cxx         |   18 +++++--------
 sw/source/uibase/inc/unoatxt.hxx |    8 +++--
 sw/source/uibase/uno/unoatxt.cxx |   28 +++++++++-----------
 7 files changed, 57 insertions(+), 61 deletions(-)

New commits:
commit 0d172a803054801ff42296c65cfca844ad5e8f6b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jan 25 16:09:23 2017 +0200

    use rtl::Reference in SmGraphicWindow
    
    instead of storing both a raw pointer and an uno::Reference
    
    Change-Id: Ib84809bee35c01fb590439174740d92bf4cd54bd

diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index cec85a1..b41f5a7 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -23,6 +23,7 @@
 
 #include <memory>
 
+#include <rtl/ref.hxx>
 #include <sfx2/dockwin.hxx>
 #include <sfx2/viewsh.hxx>
 #include <svtools/scrwin.hxx>
@@ -72,8 +73,7 @@ protected:
     bool IsInlineEditEnabled() const;
 
 private:
-    css::uno::Reference<css::accessibility::XAccessible> xAccessible;
-    SmGraphicAccessible* pAccessible;
+    rtl::Reference<SmGraphicAccessible> mxAccessible;
 
     SmViewShell* pViewShell;
     sal_uInt16 nZoom;
@@ -131,7 +131,7 @@ public:
     using Window::GetAccessible;
     SmGraphicAccessible* GetAccessible_Impl()
     {
-        return pAccessible;
+        return mxAccessible.get();
     }
 };
 
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index dc099f9..0e93bdd 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -95,7 +95,6 @@ using namespace css::uno;
 
 SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell)
     : ScrollableWindow(&pShell->GetViewFrame()->GetWindow())
-    , pAccessible(nullptr)
     , pViewShell(pShell)
     , nZoom(100)
 {
@@ -122,10 +121,8 @@ SmGraphicWindow::~SmGraphicWindow()
 
 void SmGraphicWindow::dispose()
 {
-    if (pAccessible)
-        pAccessible->ClearWin();    // make Accessible defunctional
-    // Note: memory for pAccessible will be freed when the reference
-    // xAccessible is released.
+    if (mxAccessible.is())
+        mxAccessible->ClearWin();    // make Accessible defunctional
     CaretBlinkStop();
     ScrollableWindow::dispose();
 }
@@ -235,12 +232,12 @@ void SmGraphicWindow::GetFocus()
 void SmGraphicWindow::LoseFocus()
 {
     ScrollableWindow::LoseFocus();
-    if (xAccessible.is())
+    if (mxAccessible.is())
     {
         uno::Any aOldValue, aNewValue;
         aOldValue <<= AccessibleStateType::FOCUSED;
         // aNewValue remains empty
-        pAccessible->LaunchEvent( AccessibleEventId::STATE_CHANGED,
+        mxAccessible->LaunchEvent( AccessibleEventId::STATE_CHANGED,
                 aOldValue, aNewValue );
     }
     if (!IsInlineEditEnabled())
@@ -614,12 +611,11 @@ void SmGraphicWindow::ZoomToFitInWindow()
 
 uno::Reference< XAccessible > SmGraphicWindow::CreateAccessible()
 {
-    if (!pAccessible)
+    if (!mxAccessible.is())
     {
-        pAccessible = new SmGraphicAccessible( this );
-        xAccessible = pAccessible;
+        mxAccessible = new SmGraphicAccessible( this );
     }
-    return xAccessible;
+    return mxAccessible.get();
 }
 
 /**************************************************************************/
commit f025255bf66394ec168ae4cfc4d048c202800d16
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jan 25 15:54:42 2017 +0200

    use rtl::Reference in SwXAutoTextEntry
    
    instead of storing both a raw pointer and an uno::Reference
    
    Change-Id: I52c8827446d999d0a34b91ab17c056d4237d71a7

diff --git a/sw/source/uibase/inc/unoatxt.hxx b/sw/source/uibase/inc/unoatxt.hxx
index feaf0ce..00d6bb0 100644
--- a/sw/source/uibase/inc/unoatxt.hxx
+++ b/sw/source/uibase/inc/unoatxt.hxx
@@ -34,7 +34,9 @@
 #include <cppuhelper/basemutex.hxx>
 #include <cppuhelper/compbase.hxx>
 #include <cppuhelper/implbase.hxx>
+#include <rtl/ref.hxx>
 #include <svtools/unoevent.hxx>
+
 class SwTextBlocks;
 class SwGlossaries;
 class SwDoc;
@@ -172,12 +174,12 @@ class SwXAutoTextEntry
     OUString        sGroupName;
     OUString        sEntryName;
     SwDocShellRef   xDocSh;
-    SwXBodyText*    pBodyText;
-    css::uno::Reference < css::lang::XServiceInfo> xBodyText;
+    rtl::Reference<SwXBodyText>
+                    mxBodyText;
 
     void EnsureBodyText ()
     {
-        if ( !pBodyText )
+        if ( !mxBodyText.is() )
             GetBodyText();
     }
     void GetBodyText ();
diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx
index f50550a..3b19d0f 100644
--- a/sw/source/uibase/uno/unoatxt.cxx
+++ b/sw/source/uibase/uno/unoatxt.cxx
@@ -721,8 +721,7 @@ SwXAutoTextEntry::SwXAutoTextEntry(SwGlossaries* pGlss, const OUString& rGroupNa
     WeakComponentImplHelper(m_aMutex),
     pGlossaries(pGlss),
     sGroupName(rGroupName),
-    sEntryName(rEntryName),
-    pBodyText ( nullptr )
+    sEntryName(rEntryName)
 {
 }
 
@@ -761,7 +760,7 @@ void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint )
             if (SfxEventHintId::PrepareCloseDoc == pEventHint->GetEventId())
             {
                 implFlushDocument();
-                xBodyText = nullptr;
+                mxBodyText.clear();
                 EndListening( *xDocSh );
                 xDocSh.Clear();
             }
@@ -791,8 +790,7 @@ void SwXAutoTextEntry::GetBodyText ()
     // start listening at the document
     StartListening( *xDocSh );
 
-    pBodyText = new SwXBodyText ( xDocSh->GetDoc() );
-    xBodyText.set( *pBodyText, uno::UNO_QUERY);
+    mxBodyText = new SwXBodyText ( xDocSh->GetDoc() );
 }
 
 void SwXAutoTextEntry::disposing()
@@ -805,7 +803,7 @@ uno::Reference< text::XTextCursor >  SwXAutoTextEntry::createTextCursor() throw(
 {
     SolarMutexGuard aGuard;
     EnsureBodyText();
-    return pBodyText->createTextCursor();
+    return mxBodyText->createTextCursor();
 }
 
 uno::Reference< text::XTextCursor >  SwXAutoTextEntry::createTextCursorByRange(
@@ -813,14 +811,14 @@ uno::Reference< text::XTextCursor >  SwXAutoTextEntry::createTextCursorByRange(
 {
     SolarMutexGuard aGuard;
     EnsureBodyText();
-    return pBodyText->createTextCursorByRange ( aTextPosition );
+    return mxBodyText->createTextCursorByRange ( aTextPosition );
 }
 
 void SwXAutoTextEntry::insertString(const uno::Reference< text::XTextRange > & xRange, const OUString& aString, sal_Bool bAbsorb) throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
     EnsureBodyText();
-    pBodyText->insertString ( xRange, aString, bAbsorb );
+    mxBodyText->insertString ( xRange, aString, bAbsorb );
 }
 
 void SwXAutoTextEntry::insertControlCharacter(const uno::Reference< text::XTextRange > & xRange,
@@ -829,7 +827,7 @@ void SwXAutoTextEntry::insertControlCharacter(const uno::Reference< text::XTextR
 {
     SolarMutexGuard aGuard;
     EnsureBodyText();
-    pBodyText->insertControlCharacter ( xRange, nControlCharacter, bAbsorb );
+    mxBodyText->insertControlCharacter ( xRange, nControlCharacter, bAbsorb );
 }
 
 void SwXAutoTextEntry::insertTextContent(
@@ -839,7 +837,7 @@ void SwXAutoTextEntry::insertTextContent(
 {
     SolarMutexGuard aGuard;
     EnsureBodyText();
-    pBodyText->insertTextContent ( xRange, xContent, bAbsorb );
+    mxBodyText->insertTextContent ( xRange, xContent, bAbsorb );
 }
 
 void SwXAutoTextEntry::removeTextContent(
@@ -848,7 +846,7 @@ void SwXAutoTextEntry::removeTextContent(
 {
     SolarMutexGuard aGuard;
     EnsureBodyText();
-    pBodyText->removeTextContent ( xContent );
+    mxBodyText->removeTextContent ( xContent );
 }
 
 uno::Reference< text::XText >  SwXAutoTextEntry::getText() throw( uno::RuntimeException, std::exception )
@@ -862,28 +860,28 @@ uno::Reference< text::XTextRange >  SwXAutoTextEntry::getStart() throw( uno::Run
 {
     SolarMutexGuard aGuard;
     EnsureBodyText();
-    return pBodyText->getStart();
+    return mxBodyText->getStart();
 }
 
 uno::Reference< text::XTextRange >  SwXAutoTextEntry::getEnd() throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
     EnsureBodyText();
-    return pBodyText->getEnd();
+    return mxBodyText->getEnd();
 }
 
 OUString SwXAutoTextEntry::getString() throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
     EnsureBodyText();
-    return pBodyText->getString();
+    return mxBodyText->getString();
 }
 
 void SwXAutoTextEntry::setString(const OUString& aString) throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
     EnsureBodyText();
-    pBodyText->setString( aString );
+    mxBodyText->setString( aString );
 }
 
 void SwXAutoTextEntry::applyTo(const uno::Reference< text::XTextRange > & xTextRange)throw( uno::RuntimeException, std::exception )
commit 12ff6d6c35f84f4e57e59274049b7ece4e3d0a37
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jan 25 15:54:12 2017 +0200

    drop unused param from SV_DECL_PERSIST1 macro
    
    Change-Id: Ie1a0a49effc2d88a4d57cf0e5f3608c6bbf4afb6

diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx
index 8e67332..eabb476 100644
--- a/include/editeng/flditem.hxx
+++ b/include/editeng/flditem.hxx
@@ -47,7 +47,7 @@ public:
 
     static SvxFieldData* Create(const css::uno::Reference<css::text::XTextContent>& xContent);
 
-    SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, css::text::textfield::Type::UNSPECIFIED)
+    SV_DECL_PERSIST1( SvxFieldData, css::text::textfield::Type::UNSPECIFIED)
 
                             SvxFieldData();
     virtual                 ~SvxFieldData() override;
@@ -111,7 +111,7 @@ class EDITENG_DLLPUBLIC SvxDateField : public SvxFieldData
     SvxDateFormat           eFormat;
 
 public:
-    SV_DECL_PERSIST1( SvxDateField, SvxFieldData, css::text::textfield::Type::DATE )
+    SV_DECL_PERSIST1( SvxDateField, css::text::textfield::Type::DATE )
 
                             SvxDateField();
     explicit                SvxDateField( const Date& rDate,
@@ -129,8 +129,8 @@ public:
 
                             // If eLanguage==LANGUAGE_DONTKNOW the language/country
                             // used in number formatter initialization is taken.
-    OUString           GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
-    static OUString    GetFormatted( Date& rDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+    OUString                GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
+    static OUString         GetFormatted( Date& rDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
 
     virtual SvxFieldData*   Clone() const override;
     virtual bool            operator==( const SvxFieldData& ) const override;
@@ -148,23 +148,23 @@ class EDITENG_DLLPUBLIC SvxURLField : public SvxFieldData
 {
 private:
     SvxURLFormat            eFormat;
-    OUString           aURL;               // URL-Address
-    OUString           aRepresentation;    // What is shown
-    OUString           aTargetFrame;       // In what Frame
+    OUString                aURL;               // URL-Address
+    OUString                aRepresentation;    // What is shown
+    OUString                aTargetFrame;       // In what Frame
 
 public:
-    SV_DECL_PERSIST1( SvxURLField, SvxFieldData, css::text::textfield::Type::URL )
+    SV_DECL_PERSIST1( SvxURLField, css::text::textfield::Type::URL )
 
                             SvxURLField();
                             SvxURLField( const OUString& rURL, const OUString& rRepres, SvxURLFormat eFmt = SVXURLFORMAT_URL );
 
-    const OUString&    GetURL() const { return aURL; }
+    const OUString&         GetURL() const { return aURL; }
     void                    SetURL( const OUString& rURL ) { aURL = rURL; }
 
-    const OUString&    GetRepresentation() const { return aRepresentation; }
+    const OUString&         GetRepresentation() const { return aRepresentation; }
     void                    SetRepresentation( const OUString& rRep ) { aRepresentation= rRep; }
 
-    const OUString&    GetTargetFrame() const { return aTargetFrame; }
+    const OUString&         GetTargetFrame() const { return aTargetFrame; }
     void                    SetTargetFrame( const OUString& rFrm ) { aTargetFrame = rFrm; }
 
     SvxURLFormat            GetFormat() const { return eFormat; }
@@ -179,7 +179,7 @@ public:
 class EDITENG_DLLPUBLIC SvxPageField final: public SvxFieldData
 {
 public:
-    SV_DECL_PERSIST1( SvxPageField, SvxFieldData, css::text::textfield::Type::PAGE )
+    SV_DECL_PERSIST1( SvxPageField, css::text::textfield::Type::PAGE )
     SvxPageField();
 
     virtual SvxFieldData*   Clone() const override;
@@ -191,7 +191,7 @@ public:
 class EDITENG_DLLPUBLIC SvxPageTitleField final: public SvxFieldData
 {
 public:
-    SV_DECL_PERSIST1( SvxPageTitleField, SvxFieldData, css::text::textfield::Type::PAGE_NAME )
+    SV_DECL_PERSIST1( SvxPageTitleField, css::text::textfield::Type::PAGE_NAME )
     SvxPageTitleField();
 
     virtual SvxFieldData*   Clone() const override;
@@ -203,7 +203,7 @@ public:
 class EDITENG_DLLPUBLIC SvxPagesField final: public SvxFieldData
 {
 public:
-    SV_DECL_PERSIST1( SvxPagesField, SvxFieldData, css::text::textfield::Type::PAGES )
+    SV_DECL_PERSIST1( SvxPagesField, css::text::textfield::Type::PAGES )
     SvxPagesField();
 
     virtual SvxFieldData*   Clone() const override;
@@ -213,7 +213,7 @@ public:
 class EDITENG_DLLPUBLIC SvxTimeField final: public SvxFieldData
 {
 public:
-    SV_DECL_PERSIST1( SvxTimeField, SvxFieldData, css::text::textfield::Type::TIME )
+    SV_DECL_PERSIST1( SvxTimeField, css::text::textfield::Type::TIME )
     SvxTimeField();
 
     virtual SvxFieldData*   Clone() const override;
@@ -225,7 +225,7 @@ public:
 class EDITENG_DLLPUBLIC SvxFileField final: public SvxFieldData
 {
 public:
-    SV_DECL_PERSIST1( SvxFileField, SvxFieldData, css::text::textfield::Type::DOCINFO_TITLE )
+    SV_DECL_PERSIST1( SvxFileField, css::text::textfield::Type::DOCINFO_TITLE )
     SvxFileField();
 
     virtual SvxFieldData*   Clone() const override;
@@ -236,7 +236,7 @@ class EDITENG_DLLPUBLIC SvxTableField final: public SvxFieldData
 {
     int mnTab;
 public:
-    SV_DECL_PERSIST1( SvxTableField, SvxFieldData, css::text::textfield::Type::TABLE )
+    SV_DECL_PERSIST1( SvxTableField, css::text::textfield::Type::TABLE )
     SvxTableField();
     explicit SvxTableField(int nTab);
 
@@ -271,14 +271,14 @@ private:
     SvxTimeFormat           eFormat;
 
 public:
-    SV_DECL_PERSIST1( SvxExtTimeField, SvxFieldData, css::text::textfield::Type::EXTENDED_TIME )
+    SV_DECL_PERSIST1( SvxExtTimeField, css::text::textfield::Type::EXTENDED_TIME )
                             SvxExtTimeField();
     explicit                SvxExtTimeField( const tools::Time& rTime,
                                 SvxTimeType eType,
                                 SvxTimeFormat eFormat = SVXTIMEFORMAT_STANDARD );
 
     sal_Int64               GetFixTime() const { return m_nFixTime; }
-    void SetFixTime( const tools::Time& rTime ) { m_nFixTime = rTime.GetTime(); }
+    void                    SetFixTime( const tools::Time& rTime ) { m_nFixTime = rTime.GetTime(); }
 
     SvxTimeType             GetType() const { return eType; }
     void                    SetType( SvxTimeType eTp ) { eType = eTp; }
@@ -288,8 +288,8 @@ public:
 
                             // If eLanguage==LANGUAGE_DONTKNOW the language/country
                             // used in number formatter initialization is taken.
-    OUString           GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
-    static OUString    GetFormatted( tools::Time& rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+    OUString                GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
+    static OUString         GetFormatted( tools::Time& rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
 
     virtual SvxFieldData*   Clone() const override;
     virtual bool            operator==( const SvxFieldData& ) const override;
@@ -314,7 +314,7 @@ private:
     SvxFileFormat           eFormat;
 
 public:
-    SV_DECL_PERSIST1( SvxExtFileField, SvxFieldData, css::text::textfield::Type::EXTENDED_FILE )
+    SV_DECL_PERSIST1( SvxExtFileField, css::text::textfield::Type::EXTENDED_FILE )
                             SvxExtFileField();
     explicit                SvxExtFileField( const OUString& rString,
                                 SvxFileType eType = SVXFILETYPE_VAR,
@@ -329,7 +329,7 @@ public:
     SvxFileFormat           GetFormat() const { return eFormat; }
     void                    SetFormat( SvxFileFormat eFmt ) { eFormat = eFmt; }
 
-    OUString           GetFormatted() const;
+    OUString                GetFormatted() const;
 
     virtual SvxFieldData*   Clone() const override;
     virtual bool            operator==( const SvxFieldData& ) const override;
@@ -353,7 +353,7 @@ private:
     SvxAuthorFormat eFormat;
 
 public:
-    SV_DECL_PERSIST1( SvxAuthorField, SvxFieldData, css::text::textfield::Type::AUTHOR )
+    SV_DECL_PERSIST1( SvxAuthorField, css::text::textfield::Type::AUTHOR )
                             SvxAuthorField();
                             SvxAuthorField(
                                 const OUString& rFirstName,
@@ -379,7 +379,7 @@ public:
 class EDITENG_DLLPUBLIC SvxHeaderField final: public SvxFieldData
 {
 public:
-    SV_DECL_PERSIST1( SvxHeaderField, SvxFieldData, css::text::textfield::Type::PRESENTATION_HEADER )
+    SV_DECL_PERSIST1( SvxHeaderField, css::text::textfield::Type::PRESENTATION_HEADER )
     SvxHeaderField();
 
     virtual SvxFieldData*   Clone() const override;
@@ -391,7 +391,7 @@ public:
 class EDITENG_DLLPUBLIC SvxFooterField final: public SvxFieldData
 {
 public:
-    SV_DECL_PERSIST1( SvxFooterField, SvxFieldData, css::text::textfield::Type::PRESENTATION_FOOTER )
+    SV_DECL_PERSIST1( SvxFooterField, css::text::textfield::Type::PRESENTATION_FOOTER )
     SvxFooterField();
     virtual SvxFieldData*   Clone() const override;
     virtual bool            operator==( const SvxFieldData& ) const override;
@@ -402,7 +402,7 @@ public:
 class EDITENG_DLLPUBLIC SvxDateTimeField final: public SvxFieldData
 {
 public:
-    SV_DECL_PERSIST1( SvxDateTimeField, SvxFieldData, css::text::textfield::Type::PRESENTATION_DATE_TIME )
+    SV_DECL_PERSIST1( SvxDateTimeField, css::text::textfield::Type::PRESENTATION_DATE_TIME )
     SvxDateTimeField();
 
     static OUString    GetFormatted( Date& rDate, tools::Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
diff --git a/include/editeng/measfld.hxx b/include/editeng/measfld.hxx
index 81e437f..844a1c9 100644
--- a/include/editeng/measfld.hxx
+++ b/include/editeng/measfld.hxx
@@ -40,7 +40,7 @@ enum SdrMeasureFieldKind {SDRMEASUREFIELD_VALUE,SDRMEASUREFIELD_UNIT,SDRMEASUREF
 class EDITENG_DLLPUBLIC SdrMeasureField: public SvxFieldData {
     SdrMeasureFieldKind eMeasureFieldKind;
 public:
-    SV_DECL_PERSIST1(SdrMeasureField,SvxFieldData,css::text::textfield::Type::MEASURE)
+    SV_DECL_PERSIST1(SdrMeasureField, css::text::textfield::Type::MEASURE)
     SdrMeasureField(): eMeasureFieldKind(SDRMEASUREFIELD_VALUE) {}
     SdrMeasureField(SdrMeasureFieldKind eNewKind): eMeasureFieldKind(eNewKind) {}
     virtual ~SdrMeasureField() override;
diff --git a/include/tools/pstm.hxx b/include/tools/pstm.hxx
index 1693ae7..26e86c7 100644
--- a/include/tools/pstm.hxx
+++ b/include/tools/pstm.hxx
@@ -50,7 +50,7 @@ class TOOLS_DLLPUBLIC SvRttiBase : public SvRefBase
 public:
 };
 
-#define SV_DECL_PERSIST1( Class, Super1, CLASS_ID )                 \
+#define SV_DECL_PERSIST1( Class, CLASS_ID )                 \
     static  sal_Int32  StaticClassId() { return CLASS_ID; }         \
     static  void *  CreateInstance( SvPersistBase ** ppBase );      \
     friend SvPersistStream& operator >> ( SvPersistStream & rStm,   \


More information about the Libreoffice-commits mailing list