improve subtyping when dealing with tools::WeakReference
tweak the templating to make it easier to declare a WeakReference that points to a subclass for a weak-capable class. Which lets us declare some fields with more specific types, and dump a lot of unnecessary casting. And make WeakBase be inherited from virtually, so we don't end up with weird states where two weak refernces could point to two different parts of the same object. Change-Id: I3213ea27e087038457b0761b5171c7bce96e71f3 Reviewed-on: https://gerrit.libreoffice.org/48650 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
2d8f17565e
commit
c95d91ee35
@ -116,7 +116,7 @@ public:
|
||||
bool isColumnSelected( sal_Int32 nColumn );
|
||||
bool isRowHeader();
|
||||
bool isColumnHeader();
|
||||
sdr::table::SdrTableObj* GetTableObj() { return dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() ); }
|
||||
sdr::table::SdrTableObj* GetTableObj() { return mxTableObj.get(); }
|
||||
private:
|
||||
SvxTableController(SvxTableController &) = delete;
|
||||
void operator =(SvxTableController &) = delete;
|
||||
@ -176,7 +176,7 @@ private:
|
||||
sdr::overlay::OverlayObjectList* mpSelectionOverlay;
|
||||
|
||||
SdrView* mpView;
|
||||
tools::WeakReference<SdrObject> mxTableObj;
|
||||
tools::WeakReference<SdrTableObj> mxTableObj;
|
||||
SdrModel* mpModel;
|
||||
|
||||
css::uno::Reference< css::util::XModifyListener > mxModifyListener;
|
||||
|
@ -74,7 +74,7 @@ class SVX_DLLPUBLIC SdrObjEditView: public SdrGlueEditView, public EditViewCallb
|
||||
|
||||
protected:
|
||||
// TextEdit
|
||||
tools::WeakReference<SdrObject>
|
||||
tools::WeakReference<SdrTextObj>
|
||||
mxTextEditObj; // current object in TextEdit
|
||||
SdrPageView* pTextEditPV;
|
||||
SdrOutliner* pTextEditOutliner; // outliner for the TextEdit
|
||||
@ -216,7 +216,7 @@ public:
|
||||
bool IsTextEditInSelectionMode() const;
|
||||
|
||||
// If sb needs the object out of the TextEdit:
|
||||
SdrObject* GetTextEditObject() const { return mxTextEditObj.get(); }
|
||||
SdrTextObj* GetTextEditObject() const { return mxTextEditObj.get(); }
|
||||
|
||||
// info about TextEditPageView. Default is 0L.
|
||||
virtual SdrPageView* GetTextEditPageView() const override;
|
||||
|
@ -141,7 +141,7 @@ public:
|
||||
|
||||
struct SdrModelImpl;
|
||||
|
||||
class SVX_DLLPUBLIC SdrModel : public SfxBroadcaster, public tools::WeakBase< SdrModel >
|
||||
class SVX_DLLPUBLIC SdrModel : public SfxBroadcaster, public virtual tools::WeakBase
|
||||
{
|
||||
protected:
|
||||
std::vector<SdrPage*> maMaPag; // master pages
|
||||
|
@ -268,7 +268,7 @@ public:
|
||||
/// Abstract DrawObject
|
||||
|
||||
class SvxShape;
|
||||
class SVX_DLLPUBLIC SdrObject: public SfxListener, public tools::WeakBase< SdrObject >
|
||||
class SVX_DLLPUBLIC SdrObject: public SfxListener, public virtual tools::WeakBase
|
||||
{
|
||||
friend class SdrObjListIter;
|
||||
friend class SdrVirtObj;
|
||||
|
@ -30,7 +30,7 @@ class SdrPage;
|
||||
class SVX_DLLPUBLIC SdrOutliner : public Outliner
|
||||
{
|
||||
protected:
|
||||
tools::WeakReference<SdrObject> mpTextObj;
|
||||
tools::WeakReference<SdrTextObj> mpTextObj;
|
||||
const SdrPage* mpVisualizedPage;
|
||||
|
||||
public:
|
||||
|
@ -350,7 +350,7 @@ public:
|
||||
Also it's possible to request and directly set the order number (ZOrder)
|
||||
of SdrObjects.
|
||||
*/
|
||||
class SVX_DLLPUBLIC SdrPage : public SdrObjList, public tools::WeakBase< SdrPage >
|
||||
class SVX_DLLPUBLIC SdrPage : public SdrObjList, public virtual tools::WeakBase
|
||||
{
|
||||
// #i9076#
|
||||
friend class SdrModel;
|
||||
|
@ -40,11 +40,11 @@ namespace sdr { namespace properties {
|
||||
*/
|
||||
|
||||
class SfxStyleSheet;
|
||||
class SVX_DLLPUBLIC SdrText : public tools::WeakBase< SdrText >
|
||||
class SVX_DLLPUBLIC SdrText : public virtual tools::WeakBase
|
||||
{
|
||||
public:
|
||||
SdrText( SdrTextObj& rObject, OutlinerParaObject* pOutlinerParaObject = nullptr );
|
||||
virtual ~SdrText();
|
||||
virtual ~SdrText() override;
|
||||
|
||||
virtual void SetModel(SdrModel* pNewModel);
|
||||
void ForceOutlinerParaObject( OutlinerMode nOutlMode );
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class SVX_DLLPUBLIC SdrView: public SdrCreateView, public tools::WeakBase< SdrView >
|
||||
class SVX_DLLPUBLIC SdrView: public SdrCreateView, public virtual tools::WeakBase
|
||||
{
|
||||
friend class SdrPageView;
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <sal/types.h>
|
||||
#include <osl/diagnose.h>
|
||||
#include <rtl/ref.hxx>
|
||||
#include <tools/toolsdllapi.h>
|
||||
|
||||
/** the template classes in this header are helper to implement weak references
|
||||
to implementation objects that are not refcounted.
|
||||
@ -54,15 +55,16 @@
|
||||
*/
|
||||
namespace tools
|
||||
{
|
||||
class WeakBase;
|
||||
|
||||
/** private connection helper, do not use directly */
|
||||
template <class reference_type>
|
||||
struct WeakConnection
|
||||
{
|
||||
sal_Int32 mnRefCount;
|
||||
reference_type* mpReference;
|
||||
WeakBase* mpReference;
|
||||
|
||||
WeakConnection( reference_type* pReference ) : mnRefCount( 0 ), mpReference( pReference ) {};
|
||||
WeakConnection() : mnRefCount( 0 ), mpReference( nullptr ) {};
|
||||
WeakConnection( WeakBase* pReference ) : mnRefCount( 0 ), mpReference( pReference ) {};
|
||||
void acquire() { mnRefCount++; }
|
||||
void release() { mnRefCount--; if( mnRefCount == 0 ) delete this; }
|
||||
};
|
||||
@ -118,19 +120,17 @@ public:
|
||||
inline WeakReference<reference_type>& operator= (WeakReference<reference_type> && handle);
|
||||
|
||||
private:
|
||||
rtl::Reference<WeakConnection< reference_type >> mpWeakConnection;
|
||||
rtl::Reference<WeakConnection> mpWeakConnection;
|
||||
};
|
||||
|
||||
/** derive your implementation classes from this class if you want them to support weak references */
|
||||
template <class reference_type>
|
||||
class WeakBase
|
||||
class TOOLS_DLLPUBLIC WeakBase
|
||||
{
|
||||
friend class WeakReference<reference_type>;
|
||||
template<typename T> friend class WeakReference;
|
||||
|
||||
public:
|
||||
inline WeakBase();
|
||||
|
||||
inline ~WeakBase();
|
||||
WeakBase() {}
|
||||
virtual ~WeakBase();
|
||||
/** clears the reference pointer in all living weak references for this instance.
|
||||
Further created weak references will also be invalid.
|
||||
You should call this method in the d'tor of your derived classes for an early
|
||||
@ -140,8 +140,8 @@ public:
|
||||
inline void clearWeak();
|
||||
|
||||
private:
|
||||
inline WeakConnection< reference_type >* getWeakConnection();
|
||||
rtl::Reference<WeakConnection< reference_type >> mpWeakConnection;
|
||||
inline WeakConnection* getWeakConnection();
|
||||
rtl::Reference<WeakConnection> mpWeakConnection;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -30,16 +30,13 @@ namespace tools
|
||||
template< class reference_type >
|
||||
inline WeakReference< reference_type >::WeakReference()
|
||||
{
|
||||
mpWeakConnection = new WeakConnection<reference_type>( 0 );
|
||||
mpWeakConnection = new WeakConnection;
|
||||
}
|
||||
|
||||
template< class reference_type >
|
||||
inline WeakReference< reference_type >::WeakReference( reference_type* pReference )
|
||||
{
|
||||
if( pReference )
|
||||
mpWeakConnection = pReference->getWeakConnection();
|
||||
else
|
||||
mpWeakConnection = new WeakConnection<reference_type>( 0 );
|
||||
reset( pReference );
|
||||
}
|
||||
|
||||
template< class reference_type >
|
||||
@ -57,13 +54,16 @@ inline WeakReference< reference_type >::WeakReference( WeakReference< reference_
|
||||
template< class reference_type >
|
||||
inline bool WeakReference< reference_type >::is() const
|
||||
{
|
||||
return mpWeakConnection->mpReference != 0;
|
||||
return mpWeakConnection->mpReference != nullptr;
|
||||
}
|
||||
|
||||
template< class reference_type >
|
||||
inline reference_type * WeakReference< reference_type >::get() const
|
||||
{
|
||||
return mpWeakConnection->mpReference;
|
||||
auto pWeakBase = mpWeakConnection->mpReference;
|
||||
auto pRet = dynamic_cast<reference_type *>(pWeakBase);
|
||||
assert((pWeakBase && pRet) || (!pWeakBase && !pRet));
|
||||
return pRet;
|
||||
}
|
||||
|
||||
template< class reference_type >
|
||||
@ -72,14 +72,13 @@ inline void WeakReference< reference_type >::reset( reference_type* pReference )
|
||||
if( pReference )
|
||||
mpWeakConnection = pReference->getWeakConnection();
|
||||
else
|
||||
mpWeakConnection = new WeakConnection<reference_type>( 0 );
|
||||
mpWeakConnection = new WeakConnection;
|
||||
}
|
||||
|
||||
template< class reference_type >
|
||||
inline reference_type * WeakReference< reference_type >::operator->() const
|
||||
{
|
||||
OSL_PRECOND(mpWeakConnection.is(), "tools::WeakReference::operator->() : null body");
|
||||
return mpWeakConnection->mpReference;
|
||||
return get();
|
||||
}
|
||||
|
||||
template< class reference_type >
|
||||
@ -117,9 +116,7 @@ inline WeakReference<reference_type>& WeakReference<reference_type>::operator= (
|
||||
const WeakReference<reference_type>& rReference)
|
||||
{
|
||||
if (&rReference != this)
|
||||
{
|
||||
mpWeakConnection = rReference.mpWeakConnection;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -131,34 +128,16 @@ inline WeakReference<reference_type>& WeakReference<reference_type>::operator= (
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class reference_type >
|
||||
inline WeakBase< reference_type >::WeakBase()
|
||||
{
|
||||
}
|
||||
|
||||
template< class reference_type >
|
||||
inline WeakBase< reference_type >::~WeakBase()
|
||||
inline void WeakBase::clearWeak()
|
||||
{
|
||||
if( mpWeakConnection.is() )
|
||||
{
|
||||
mpWeakConnection->mpReference = 0;
|
||||
}
|
||||
mpWeakConnection->mpReference = nullptr;
|
||||
}
|
||||
|
||||
template< class reference_type >
|
||||
inline void WeakBase< reference_type >::clearWeak()
|
||||
{
|
||||
if( mpWeakConnection.is() )
|
||||
mpWeakConnection->mpReference = 0;
|
||||
}
|
||||
|
||||
template< class reference_type >
|
||||
inline WeakConnection< reference_type >* WeakBase< reference_type >::getWeakConnection()
|
||||
inline WeakConnection* WeakBase::getWeakConnection()
|
||||
{
|
||||
if( !mpWeakConnection.is() )
|
||||
{
|
||||
mpWeakConnection = new WeakConnection< reference_type >( static_cast< reference_type* >( this ) );
|
||||
}
|
||||
mpWeakConnection = new WeakConnection( this );
|
||||
return mpWeakConnection.get();
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public:
|
||||
private:
|
||||
PresObjKind meOldKind;
|
||||
PresObjKind meNewKind;
|
||||
::tools::WeakReference<SdrPage> mxPage;
|
||||
::tools::WeakReference<SdPage> mxPage;
|
||||
::tools::WeakReference<SdrObject> mxSdrObject;
|
||||
};
|
||||
|
||||
@ -143,7 +143,7 @@ public:
|
||||
virtual void Redo() override;
|
||||
|
||||
private:
|
||||
::tools::WeakReference<SdrPage> mxPage;
|
||||
::tools::WeakReference<SdPage> mxPage;
|
||||
};
|
||||
|
||||
class UndoGeoObject final : public SdrUndoGeoObj
|
||||
@ -155,7 +155,7 @@ public:
|
||||
virtual void Redo() override;
|
||||
|
||||
private:
|
||||
::tools::WeakReference<SdrPage> mxPage;
|
||||
::tools::WeakReference<SdPage> mxPage;
|
||||
::tools::WeakReference<SdrObject> mxSdrObject;
|
||||
};
|
||||
|
||||
@ -168,7 +168,7 @@ public:
|
||||
virtual void Redo() override;
|
||||
|
||||
private:
|
||||
::tools::WeakReference<SdrPage> mxPage;
|
||||
::tools::WeakReference<SdPage> mxPage;
|
||||
::tools::WeakReference<SdrObject> mxSdrObject;
|
||||
};
|
||||
|
||||
|
@ -49,7 +49,7 @@ typedef std::map< OUString, rtl::Reference< SdStyleSheet > > PresStyleMap;
|
||||
|
||||
struct SdStyleFamilyImpl
|
||||
{
|
||||
tools::WeakReference<SdrPage> mxMasterPage;
|
||||
tools::WeakReference<SdPage> mxMasterPage;
|
||||
OUString maLayoutName;
|
||||
|
||||
PresStyleMap& getStyleSheets();
|
||||
@ -185,7 +185,7 @@ OUString SAL_CALL SdStyleFamily::getName()
|
||||
{
|
||||
if( mnFamily == SfxStyleFamily::Page )
|
||||
{
|
||||
SdPage* pPage = static_cast< SdPage* >( mpImpl->mxMasterPage.get() );
|
||||
SdPage* pPage = mpImpl->mxMasterPage.get();
|
||||
if( pPage == nullptr )
|
||||
throw DisposedException();
|
||||
|
||||
|
@ -254,20 +254,20 @@ UndoObjectPresentationKind::UndoObjectPresentationKind(SdrObject& rObject)
|
||||
: SdrUndoObj(rObject)
|
||||
, meOldKind(PRESOBJ_NONE)
|
||||
, meNewKind(PRESOBJ_NONE)
|
||||
, mxPage( rObject.GetPage() )
|
||||
, mxPage( static_cast<SdPage*>(rObject.GetPage()) )
|
||||
, mxSdrObject( &rObject )
|
||||
{
|
||||
DBG_ASSERT( mxPage.is(), "sd::UndoObjectPresentationKind::UndoObjectPresentationKind(), does not work for shapes without a slide!" );
|
||||
|
||||
if( mxPage.is() )
|
||||
meOldKind = static_cast< SdPage* >( mxPage.get() )->GetPresObjKind( &rObject );
|
||||
meOldKind = mxPage->GetPresObjKind( &rObject );
|
||||
}
|
||||
|
||||
void UndoObjectPresentationKind::Undo()
|
||||
{
|
||||
if( mxPage.is() && mxSdrObject.is() )
|
||||
{
|
||||
SdPage* pPage = static_cast< SdPage* >( mxPage.get() );
|
||||
SdPage* pPage = mxPage.get();
|
||||
meNewKind = pPage->GetPresObjKind( mxSdrObject.get() );
|
||||
if( meNewKind != PRESOBJ_NONE )
|
||||
pPage->RemovePresObj( mxSdrObject.get() );
|
||||
@ -280,7 +280,7 @@ void UndoObjectPresentationKind::Redo()
|
||||
{
|
||||
if( mxPage.is() && mxSdrObject.is() )
|
||||
{
|
||||
SdPage* pPage = static_cast< SdPage* >( mxPage.get() );
|
||||
SdPage* pPage = mxPage.get();
|
||||
if( meOldKind != PRESOBJ_NONE )
|
||||
pPage->RemovePresObj( mxSdrObject.get() );
|
||||
if( meNewKind != PRESOBJ_NONE )
|
||||
@ -300,14 +300,14 @@ void UndoAutoLayoutPosAndSize::Undo()
|
||||
|
||||
void UndoAutoLayoutPosAndSize::Redo()
|
||||
{
|
||||
SdPage* pPage = static_cast< SdPage* >( mxPage.get() );
|
||||
SdPage* pPage = mxPage.get();
|
||||
if( pPage )
|
||||
pPage->SetAutoLayout( pPage->GetAutoLayout() );
|
||||
}
|
||||
|
||||
UndoGeoObject::UndoGeoObject( SdrObject& rNewObj )
|
||||
: SdrUndoGeoObj( rNewObj )
|
||||
, mxPage( rNewObj.GetPage() )
|
||||
, mxPage( static_cast<SdPage*>(rNewObj.GetPage()) )
|
||||
, mxSdrObject( &rNewObj )
|
||||
{
|
||||
}
|
||||
@ -319,7 +319,7 @@ void UndoGeoObject::Undo()
|
||||
{
|
||||
if( mxPage.is() )
|
||||
{
|
||||
ScopeLockGuard aGuard( static_cast< SdPage* >( mxPage.get() )->maLockAutoLayoutArrangement );
|
||||
ScopeLockGuard aGuard( mxPage->maLockAutoLayoutArrangement );
|
||||
SdrUndoGeoObj::Undo();
|
||||
}
|
||||
else
|
||||
@ -336,7 +336,7 @@ void UndoGeoObject::Redo()
|
||||
{
|
||||
if( mxPage.is() )
|
||||
{
|
||||
ScopeLockGuard aGuard( static_cast< SdPage* >(mxPage.get())->maLockAutoLayoutArrangement );
|
||||
ScopeLockGuard aGuard( mxPage->maLockAutoLayoutArrangement );
|
||||
SdrUndoGeoObj::Redo();
|
||||
}
|
||||
else
|
||||
@ -348,7 +348,7 @@ void UndoGeoObject::Redo()
|
||||
|
||||
UndoAttrObject::UndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText )
|
||||
: SdrUndoAttrObj( rObject, bStyleSheet1, bSaveText )
|
||||
, mxPage( rObject.GetPage() )
|
||||
, mxPage( static_cast<SdPage*>(rObject.GetPage()) )
|
||||
, mxSdrObject( &rObject )
|
||||
{
|
||||
}
|
||||
@ -360,7 +360,7 @@ void UndoAttrObject::Undo()
|
||||
{
|
||||
if( mxPage.is() )
|
||||
{
|
||||
ScopeLockGuard aGuard( static_cast< SdPage* >( mxPage.get() )->maLockAutoLayoutArrangement );
|
||||
ScopeLockGuard aGuard( mxPage->maLockAutoLayoutArrangement );
|
||||
SdrUndoAttrObj::Undo();
|
||||
}
|
||||
else
|
||||
@ -377,7 +377,7 @@ void UndoAttrObject::Redo()
|
||||
{
|
||||
if( mxPage.is() )
|
||||
{
|
||||
ScopeLockGuard aGuard( static_cast< SdPage* >( mxPage.get() )->maLockAutoLayoutArrangement );
|
||||
ScopeLockGuard aGuard( mxPage->maLockAutoLayoutArrangement );
|
||||
SdrUndoAttrObj::Redo();
|
||||
}
|
||||
else
|
||||
|
@ -1132,7 +1132,7 @@ void FuText::SetInEditMode(const MouseEvent& rMEvt, bool bQuickDrag)
|
||||
}
|
||||
else
|
||||
{
|
||||
mpView->RestoreDefaultText(dynamic_cast< SdrTextObj* >( mxTextObj.get() ));
|
||||
mpView->RestoreDefaultText( mxTextObj.get() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1244,7 +1244,7 @@ void FuText::ReceiveRequest(SfxRequest& rReq)
|
||||
{
|
||||
// are we currently editing?
|
||||
if(!bTestText)
|
||||
mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetTextEditObject() ) );
|
||||
mxTextObj.reset( mpView->GetTextEditObject() );
|
||||
|
||||
if (!mxTextObj.is())
|
||||
{
|
||||
|
@ -288,7 +288,7 @@ private:
|
||||
ViewShellBase* mpBase;
|
||||
|
||||
::tools::Rectangle maLastVisArea;
|
||||
::tools::WeakReference<SdrPage> mpCurrentPage;
|
||||
::tools::WeakReference<SdPage> mpCurrentPage;
|
||||
bool mbMasterPageMode;
|
||||
bool mbLayerMode;
|
||||
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
|
||||
void SetInEditMode(const MouseEvent& rMEvt, bool bQuickDrag);
|
||||
void DeleteDefaultText();
|
||||
SdrTextObj* GetTextObj() { return static_cast< SdrTextObj* >( mxTextObj.get() ); }
|
||||
SdrTextObj* GetTextObj() { return mxTextObj.get(); }
|
||||
|
||||
virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) override;
|
||||
|
||||
@ -81,7 +81,7 @@ protected:
|
||||
private:
|
||||
virtual void disposing() override;
|
||||
|
||||
::tools::WeakReference<SdrObject>
|
||||
::tools::WeakReference<SdrTextObj>
|
||||
mxTextObj;
|
||||
bool bFirstObjCreated;
|
||||
bool bJustEndedEdit;
|
||||
|
@ -137,7 +137,7 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet,
|
||||
{
|
||||
SfxStyleSheetBasePool* pStShPool = mrDoc.GetStyleSheetPool();
|
||||
SdPage& rPage = *mpDrawViewShell->getCurrentPage();
|
||||
SdrTextObj* pEditObject = static_cast< SdrTextObj* >( GetTextEditObject() );
|
||||
SdrTextObj* pEditObject = GetTextEditObject();
|
||||
|
||||
if (pEditObject)
|
||||
{
|
||||
|
@ -761,9 +761,9 @@ SdrEndTextEditKind View::SdrEndTextEdit(bool bDontDeleteReally)
|
||||
{
|
||||
maMasterViewFilter.End();
|
||||
|
||||
::tools::WeakReference<SdrObject> xObj( GetTextEditObject() );
|
||||
::tools::WeakReference<SdrTextObj> xObj( GetTextEditObject() );
|
||||
|
||||
bool bDefaultTextRestored = RestoreDefaultText( dynamic_cast< SdrTextObj* >( GetTextEditObject() ) );
|
||||
bool bDefaultTextRestored = RestoreDefaultText( xObj.get() );
|
||||
|
||||
SdrEndTextEditKind eKind = FmFormView::SdrEndTextEdit(bDontDeleteReally);
|
||||
|
||||
@ -780,7 +780,7 @@ SdrEndTextEditKind View::SdrEndTextEdit(bool bDontDeleteReally)
|
||||
}
|
||||
else if( xObj.is() && xObj->IsEmptyPresObj() )
|
||||
{
|
||||
SdrTextObj* pObj = dynamic_cast< SdrTextObj* >( xObj.get() );
|
||||
SdrTextObj* pObj = xObj.get();
|
||||
if( pObj && pObj->HasText() )
|
||||
{
|
||||
SdrPage* pPage = pObj->GetPage();
|
||||
@ -1194,7 +1194,7 @@ void View::OnBeginPasteOrDrop( PasteOrDropInfos* /*pInfo*/ )
|
||||
void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfo )
|
||||
{
|
||||
/* Style Sheet handling */
|
||||
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetTextEditObject() );
|
||||
SdrTextObj* pTextObj = GetTextEditObject();
|
||||
SdrOutliner* pOutliner = GetTextEditOutliner();
|
||||
if( !pOutliner || !pTextObj || !pTextObj->GetPage() )
|
||||
return;
|
||||
|
@ -37,7 +37,7 @@ namespace drawinglayer
|
||||
class SdrOleContentPrimitive2D : public BufferedDecompositionPrimitive2D
|
||||
{
|
||||
private:
|
||||
tools::WeakReference<SdrObject> mpSdrOle2Obj;
|
||||
tools::WeakReference<SdrOle2Obj> mpSdrOle2Obj;
|
||||
basegfx::B2DHomMatrix maObjectTransform;
|
||||
|
||||
// #i104867# The GraphicVersion number to identify in operator== if
|
||||
|
@ -84,7 +84,7 @@ namespace drawinglayer
|
||||
const OutlinerParaObject& rOutlinerParaObjectPtr);
|
||||
|
||||
// get data
|
||||
const SdrText* getSdrText() const { return mrSdrText.get(); }
|
||||
const SdrText* getSdrText() const;
|
||||
const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; }
|
||||
|
||||
// compare operator
|
||||
|
@ -35,7 +35,7 @@ namespace drawinglayer
|
||||
{
|
||||
void SdrOleContentPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*aViewInformation*/) const
|
||||
{
|
||||
const SdrOle2Obj* pSource = (mpSdrOle2Obj.is() ? static_cast< SdrOle2Obj* >(mpSdrOle2Obj.get()) : nullptr);
|
||||
const SdrOle2Obj* pSource = mpSdrOle2Obj.get();
|
||||
bool bScaleContent(false);
|
||||
Graphic aGraphic;
|
||||
|
||||
|
@ -119,6 +119,8 @@ namespace drawinglayer
|
||||
|| rETO.HasField(SvxAuthorField::StaticClassId());
|
||||
}
|
||||
|
||||
const SdrText* SdrTextPrimitive2D::getSdrText() const { return mrSdrText.get(); }
|
||||
|
||||
bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
|
||||
{
|
||||
if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
|
||||
|
@ -241,7 +241,7 @@ void SdrObjEditView::ModelHasChanged()
|
||||
if (mxTextEditObj.is() && !mxTextEditObj->IsInserted()) SdrEndTextEdit(); // object deleted
|
||||
// TextEditObj changed?
|
||||
if (IsTextEdit()) {
|
||||
SdrTextObj* pTextObj=dynamic_cast<SdrTextObj*>( mxTextEditObj.get() );
|
||||
SdrTextObj* pTextObj= mxTextEditObj.get();
|
||||
if (pTextObj!=nullptr) {
|
||||
sal_uIntPtr nOutlViewCnt=pTextEditOutliner->GetViewCount();
|
||||
bool bAreaChg=false;
|
||||
@ -699,7 +699,7 @@ void SdrObjEditView::TextEditDrawing(SdrPaintWindow& rPaintWindow) const
|
||||
|
||||
void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const tools::Rectangle& rRect, OutputDevice& rTargetDevice) const
|
||||
{
|
||||
const SdrTextObj* pText = dynamic_cast<SdrTextObj*>( GetTextEditObject() );
|
||||
const SdrTextObj* pText = GetTextEditObject();
|
||||
bool bTextFrame(pText && pText->IsTextFrame());
|
||||
bool bFitToSize(pTextEditOutliner->GetControlWord() & EEControlBits::STRETCHING);
|
||||
bool bModifyMerk(pTextEditOutliner->IsModified());
|
||||
@ -764,7 +764,7 @@ void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView const & rOutlView) c
|
||||
|
||||
if(pWin)
|
||||
{
|
||||
const SdrTextObj* pText = dynamic_cast<SdrTextObj*>( GetTextEditObject() );
|
||||
const SdrTextObj* pText = GetTextEditObject();
|
||||
bool bTextFrame(pText && pText->IsTextFrame());
|
||||
bool bFitToSize(pText && pText->IsFitToSize());
|
||||
|
||||
@ -811,7 +811,7 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, OutlinerVie
|
||||
{
|
||||
// background
|
||||
Color aBackground(GetTextEditBackgroundColor(*this));
|
||||
SdrTextObj* pText = dynamic_cast< SdrTextObj * >( mxTextEditObj.get() );
|
||||
SdrTextObj* pText = mxTextEditObj.get();
|
||||
bool bTextFrame=pText!=nullptr && pText->IsTextFrame();
|
||||
bool bContourFrame=pText!=nullptr && pText->IsContourTextFrame();
|
||||
// create OutlinerView
|
||||
@ -863,7 +863,7 @@ IMPL_LINK(SdrObjEditView,ImpOutlinerStatusEventHdl, EditStatus&, rEditStat, void
|
||||
{
|
||||
if(pTextEditOutliner )
|
||||
{
|
||||
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj * >( mxTextEditObj.get() );
|
||||
SdrTextObj* pTextObj = mxTextEditObj.get();
|
||||
if( pTextObj )
|
||||
{
|
||||
pTextObj->onEditOutlinerStatusEvent( &rEditStat );
|
||||
@ -875,7 +875,7 @@ void SdrObjEditView::ImpChainingEventHdl()
|
||||
{
|
||||
if(pTextEditOutliner )
|
||||
{
|
||||
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj * >( mxTextEditObj.get() );
|
||||
SdrTextObj* pTextObj = mxTextEditObj.get();
|
||||
OutlinerView* pOLV = GetTextEditOutlinerView();
|
||||
if( pTextObj && pOLV)
|
||||
{
|
||||
@ -935,7 +935,7 @@ void SdrObjEditView::ImpChainingEventHdl()
|
||||
|
||||
IMPL_LINK_NOARG(SdrObjEditView,ImpAfterCutOrPasteChainingEventHdl, LinkParamNone*, void)
|
||||
{
|
||||
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj * >( GetTextEditObject());
|
||||
SdrTextObj* pTextObj = GetTextEditObject();
|
||||
if (!pTextObj)
|
||||
return;
|
||||
ImpChainingEventHdl();
|
||||
@ -948,7 +948,7 @@ void SdrObjEditView::ImpMoveCursorAfterChainingEvent(TextChainCursorManager *pCu
|
||||
if (!mxTextEditObj.is() || !pCursorManager)
|
||||
return;
|
||||
|
||||
SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(mxTextEditObj.get());
|
||||
SdrTextObj* pTextObj = mxTextEditObj.get();
|
||||
|
||||
// Check if it has links to move it to
|
||||
if (!pTextObj || !pTextObj->IsChainable())
|
||||
@ -971,7 +971,7 @@ IMPL_LINK(SdrObjEditView,ImpOutlinerCalcFieldValueHdl,EditFieldInfo*,pFI,void)
|
||||
bool bOk=false;
|
||||
OUString& rStr=pFI->GetRepresentation();
|
||||
rStr.clear();
|
||||
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
|
||||
SdrTextObj* pTextObj = mxTextEditObj.get();
|
||||
if (pTextObj!=nullptr) {
|
||||
Color* pTxtCol=nullptr;
|
||||
Color* pFldCol=nullptr;
|
||||
@ -1012,7 +1012,7 @@ SdrUndoManager* SdrObjEditView::getSdrUndoManagerForEnhancedTextEdit() const
|
||||
}
|
||||
|
||||
bool SdrObjEditView::SdrBeginTextEdit(
|
||||
SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin,
|
||||
SdrObject* pObj_, SdrPageView* pPV, vcl::Window* pWin,
|
||||
bool bIsNewObj, SdrOutliner* pGivenOutliner,
|
||||
OutlinerView* pGivenOutlinerView,
|
||||
bool bDontDeleteOutliner, bool bOnlyOneView,
|
||||
@ -1022,7 +1022,8 @@ bool SdrObjEditView::SdrBeginTextEdit(
|
||||
// FIXME this encourages all sorts of bad habits and should be removed
|
||||
SdrEndTextEdit();
|
||||
|
||||
if( dynamic_cast< SdrTextObj* >( pObj ) == nullptr )
|
||||
SdrTextObj* pObj = dynamic_cast< SdrTextObj* >( pObj_ );
|
||||
if( !pObj )
|
||||
return false; // currently only possible with text objects
|
||||
|
||||
if(bGrabFocus && pWin)
|
||||
@ -1037,14 +1038,8 @@ bool SdrObjEditView::SdrBeginTextEdit(
|
||||
const sal_uInt32 nWinCount(PaintWindowCount());
|
||||
sal_uInt32 i;
|
||||
bool bBrk(false);
|
||||
// break, when no object given
|
||||
|
||||
if(!pObj)
|
||||
{
|
||||
bBrk = true;
|
||||
}
|
||||
|
||||
if(!bBrk && !pWin)
|
||||
if(!pWin)
|
||||
{
|
||||
for(i = 0; i < nWinCount && !pWin; i++)
|
||||
{
|
||||
@ -1074,13 +1069,10 @@ bool SdrObjEditView::SdrBeginTextEdit(
|
||||
}
|
||||
}
|
||||
|
||||
if(pObj && pPV)
|
||||
// no TextEdit on objects in locked Layer
|
||||
if(pPV && pPV->GetLockedLayers().IsSet(pObj->GetLayer()))
|
||||
{
|
||||
// no TextEdit on objects in locked Layer
|
||||
if(pPV->GetLockedLayers().IsSet(pObj->GetLayer()))
|
||||
{
|
||||
bBrk = true;
|
||||
}
|
||||
bBrk = true;
|
||||
}
|
||||
|
||||
if(pTextEditOutliner)
|
||||
@ -1113,11 +1105,11 @@ bool SdrObjEditView::SdrBeginTextEdit(
|
||||
// It is just necessary to make the visualized page known. Set it.
|
||||
pTextEditOutliner->setVisualizedPage(pPV->GetPage());
|
||||
|
||||
pTextEditOutliner->SetTextObjNoInit( dynamic_cast< SdrTextObj* >( mxTextEditObj.get() ) );
|
||||
pTextEditOutliner->SetTextObjNoInit( mxTextEditObj.get() );
|
||||
|
||||
if(mxTextEditObj->BegTextEdit(*pTextEditOutliner))
|
||||
{
|
||||
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
|
||||
SdrTextObj* pTextObj = mxTextEditObj.get();
|
||||
DBG_ASSERT( pTextObj, "svx::SdrObjEditView::BegTextEdit(), no text object?" );
|
||||
if( !pTextObj )
|
||||
return false;
|
||||
@ -1179,7 +1171,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
|
||||
|
||||
const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
|
||||
const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
|
||||
const SdrTextObj* pText = dynamic_cast<SdrTextObj*>(GetTextEditObject());
|
||||
const SdrTextObj* pText = GetTextEditObject();
|
||||
const bool bTextFrame(pText && pText->IsTextFrame());
|
||||
const bool bFitToSize(pTextEditOutliner->GetControlWord() & EEControlBits::STRETCHING);
|
||||
const bool bVisualizeSurroundingFrame(bTextFrame && !bFitToSize);
|
||||
@ -1358,7 +1350,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
|
||||
SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
|
||||
{
|
||||
SdrEndTextEditKind eRet=SdrEndTextEditKind::Unchanged;
|
||||
SdrTextObj* pTEObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
|
||||
SdrTextObj* pTEObj = mxTextEditObj.get();
|
||||
vcl::Window* pTEWin =pTextEditWin;
|
||||
SdrOutliner* pTEOutliner =pTextEditOutliner;
|
||||
OutlinerView* pTEOutlinerView=pTextEditOutlinerView;
|
||||
@ -1700,7 +1692,7 @@ bool SdrObjEditView::IsTextEditFrameHit(const Point& rHit) const
|
||||
bool bOk=false;
|
||||
if(mxTextEditObj.is())
|
||||
{
|
||||
SdrTextObj* pText= dynamic_cast<SdrTextObj*>(mxTextEditObj.get());
|
||||
SdrTextObj* pText = mxTextEditObj.get();
|
||||
OutlinerView* pOLV=pTextEditOutliner->GetView(0);
|
||||
if( pOLV )
|
||||
{
|
||||
@ -1729,10 +1721,7 @@ TextChainCursorManager *SdrObjEditView::ImpHandleMotionThroughBoxesKeyInput(
|
||||
{
|
||||
*bOutHandled = false;
|
||||
|
||||
if (!mxTextEditObj.is())
|
||||
return nullptr;
|
||||
|
||||
SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(mxTextEditObj.get());
|
||||
SdrTextObj* pTextObj = mxTextEditObj.get();
|
||||
if (!pTextObj)
|
||||
return nullptr;
|
||||
|
||||
@ -2117,7 +2106,7 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
|
||||
// multiple portions exist with multiple formats. If a OutlinerParaObject
|
||||
// really exists and needs to be rescued is evaluated in the undo
|
||||
// implementation itself.
|
||||
bool bRescueText = dynamic_cast< SdrTextObj* >(mxTextEditObj.get());
|
||||
bool bRescueText = mxTextEditObj.get();
|
||||
|
||||
AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*mxTextEditObj.get(),false,!bNoEEItems || bRescueText));
|
||||
EndUndo();
|
||||
|
@ -736,7 +736,7 @@ Color GetTextEditBackgroundColor(const SdrObjEditView& rView)
|
||||
if(!rStyleSettings.GetHighContrastMode())
|
||||
{
|
||||
bool bFound(false);
|
||||
SdrTextObj* pText = dynamic_cast< SdrTextObj * >(rView.GetTextEditObject());
|
||||
SdrTextObj* pText = rView.GetTextEditObject();
|
||||
|
||||
if(pText && pText->IsClosedObj())
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara
|
||||
OUString aRet;
|
||||
|
||||
if(mpTextObj.is())
|
||||
bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, aRet);
|
||||
bOk = mpTextObj->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, aRet);
|
||||
|
||||
if (!bOk)
|
||||
aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
|
||||
@ -89,10 +89,7 @@ OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara
|
||||
|
||||
const SdrTextObj* SdrOutliner::GetTextObj() const
|
||||
{
|
||||
if( mpTextObj.is() )
|
||||
return static_cast< SdrTextObj* >( mpTextObj.get() );
|
||||
else
|
||||
return nullptr;
|
||||
return mpTextObj.get();
|
||||
}
|
||||
|
||||
bool SdrOutliner::hasEditViewCallbacks() const
|
||||
|
@ -1169,7 +1169,6 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage)
|
||||
|
||||
SdrPage::SdrPage(const SdrPage& rSrcPage)
|
||||
: SdrObjList(rSrcPage.pModel, this),
|
||||
tools::WeakBase< SdrPage >(),
|
||||
mpViewContact(nullptr),
|
||||
mnWidth(rSrcPage.mnWidth),
|
||||
mnHeight(rSrcPage.mnHeight),
|
||||
|
@ -174,10 +174,10 @@ SvxTableController::SvxTableController( SdrObjEditView* pView, const SdrObject*
|
||||
|
||||
if( mxTableObj.is() )
|
||||
{
|
||||
static_cast< const SdrTableObj* >( pObj )->getActiveCellPos( maCursorFirstPos );
|
||||
mxTableObj->getActiveCellPos( maCursorFirstPos );
|
||||
maCursorLastPos = maCursorFirstPos;
|
||||
|
||||
Reference< XTable > xTable( static_cast< const SdrTableObj* >( pObj )->getTable() );
|
||||
Reference< XTable > xTable( mxTableObj->getTable() );
|
||||
if( xTable.is() )
|
||||
{
|
||||
mxModifyListener = new SvxTableControllerModifyListener( this );
|
||||
@ -198,7 +198,7 @@ SvxTableController::~SvxTableController()
|
||||
|
||||
if( mxModifyListener.is() && mxTableObj.get() )
|
||||
{
|
||||
Reference< XTable > xTable( static_cast< SdrTableObj* >( mxTableObj.get() )->getTable() );
|
||||
Reference< XTable > xTable( mxTableObj->getTable() );
|
||||
if( xTable.is() )
|
||||
{
|
||||
xTable->removeModifyListener( mxModifyListener );
|
||||
@ -273,7 +273,7 @@ bool SvxTableController::onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window*
|
||||
if( !rMEvt.IsRight() && mpView->PickAnything(rMEvt,SdrMouseEventKind::BUTTONDOWN, aVEvt) == SdrHitKind::Handle )
|
||||
return false;
|
||||
|
||||
TableHitKind eHit = static_cast< SdrTableObj* >(mxTableObj.get())->CheckTableHit(pixelToLogic(rMEvt.GetPosPixel(), pWindow), maMouseDownPos.mnCol, maMouseDownPos.mnRow);
|
||||
TableHitKind eHit = mxTableObj->CheckTableHit(pixelToLogic(rMEvt.GetPosPixel(), pWindow), maMouseDownPos.mnCol, maMouseDownPos.mnRow);
|
||||
|
||||
mbLeftButtonDown = (rMEvt.GetClicks() == 1) && rMEvt.IsLeft();
|
||||
|
||||
@ -299,7 +299,7 @@ bool SvxTableController::onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window*
|
||||
}
|
||||
else
|
||||
{
|
||||
sdr::table::SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
sdr::table::SdrTableObj* pTableObj = mxTableObj.get();
|
||||
|
||||
if( !pWindow || !pTableObj || eHit == TableHitKind::NONE)
|
||||
{
|
||||
@ -350,7 +350,7 @@ bool SvxTableController::onMouseMove(const MouseEvent& rMEvt, vcl::Window* pWind
|
||||
if( !checkTableObject() )
|
||||
return false;
|
||||
|
||||
SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxTableObj.get() );
|
||||
SdrTableObj* pTableObj = mxTableObj.get();
|
||||
CellPos aPos;
|
||||
if (mbLeftButtonDown && pTableObj && pTableObj->CheckTableHit(pixelToLogic(rMEvt.GetPosPixel(), pWindow), aPos.mnCol, aPos.mnRow ) != TableHitKind::NONE)
|
||||
{
|
||||
@ -380,7 +380,7 @@ void SvxTableController::onSelectionHasChanged()
|
||||
{
|
||||
bool bSelected = false;
|
||||
|
||||
SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxTableObj.get() );
|
||||
SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( pTableObj && pTableObj->IsTextEditActive() )
|
||||
{
|
||||
pTableObj->getActiveCellPos( maCursorFirstPos );
|
||||
@ -512,7 +512,7 @@ void SvxTableController::GetState( SfxItemSet& rSet )
|
||||
|
||||
void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs )
|
||||
{
|
||||
sdr::table::SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
sdr::table::SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( !pTableObj )
|
||||
return;
|
||||
|
||||
@ -788,7 +788,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs )
|
||||
|
||||
void SvxTableController::onDelete( sal_uInt16 nSId )
|
||||
{
|
||||
sdr::table::SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
sdr::table::SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( !pTableObj )
|
||||
return;
|
||||
|
||||
@ -893,7 +893,7 @@ namespace
|
||||
|
||||
void SvxTableController::onFormatTable( SfxRequest const & rReq )
|
||||
{
|
||||
sdr::table::SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
sdr::table::SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( !pTableObj )
|
||||
return;
|
||||
|
||||
@ -1033,7 +1033,7 @@ void SvxTableController::Execute( SfxRequest& rReq )
|
||||
|
||||
void SvxTableController::SetTableStyle( const SfxItemSet* pArgs )
|
||||
{
|
||||
SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
SdrTableObj* pTableObj = mxTableObj.get();
|
||||
SdrModel* pModel = pTableObj ? pTableObj->GetModel() : nullptr;
|
||||
|
||||
if( !pTableObj || !pModel || !pArgs || (SfxItemState::SET != pArgs->GetItemState(SID_TABLE_STYLE, false)) )
|
||||
@ -1116,7 +1116,7 @@ void SvxTableController::SetTableStyle( const SfxItemSet* pArgs )
|
||||
|
||||
void SvxTableController::SetTableStyleSettings( const SfxItemSet* pArgs )
|
||||
{
|
||||
SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
SdrTableObj* pTableObj = mxTableObj.get();
|
||||
SdrModel* pModel = pTableObj ? pTableObj->GetModel() : nullptr;
|
||||
|
||||
if( !pTableObj || !pModel )
|
||||
@ -1163,7 +1163,7 @@ void SvxTableController::SetTableStyleSettings( const SfxItemSet* pArgs )
|
||||
|
||||
void SvxTableController::SetVertical( sal_uInt16 nSId )
|
||||
{
|
||||
SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( !mxTable.is() || !pTableObj )
|
||||
return;
|
||||
|
||||
@ -1222,7 +1222,7 @@ void SvxTableController::MergeMarkedCells()
|
||||
{
|
||||
CellPos aStart, aEnd;
|
||||
getSelectedCells( aStart, aEnd );
|
||||
SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( pTableObj )
|
||||
{
|
||||
if( pTableObj->IsTextEditActive() )
|
||||
@ -1256,7 +1256,7 @@ void SvxTableController::SplitMarkedCells()
|
||||
const sal_Int32 nColCount = mxTable->getColumnCount();
|
||||
|
||||
|
||||
SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxTableObj.get() );
|
||||
SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( pTableObj )
|
||||
{
|
||||
if( pTableObj->IsTextEditActive() )
|
||||
@ -1293,7 +1293,7 @@ void SvxTableController::SplitMarkedCells()
|
||||
|
||||
void SvxTableController::DistributeColumns()
|
||||
{
|
||||
SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxTableObj.get() );
|
||||
SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( pTableObj )
|
||||
{
|
||||
const bool bUndo = mpModel && mpModel->IsUndoEnabled();
|
||||
@ -1314,7 +1314,7 @@ void SvxTableController::DistributeColumns()
|
||||
|
||||
void SvxTableController::DistributeRows()
|
||||
{
|
||||
SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxTableObj.get() );
|
||||
SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( pTableObj )
|
||||
{
|
||||
const bool bUndo = mpModel && mpModel->IsUndoEnabled();
|
||||
@ -1456,7 +1456,7 @@ SvxTableController::TblAction SvxTableController::getKeyboardAction(const KeyEve
|
||||
|
||||
TblAction nAction = TblAction::HandledByView;
|
||||
|
||||
sdr::table::SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
sdr::table::SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( !pTableObj )
|
||||
return nAction;
|
||||
|
||||
@ -1637,7 +1637,7 @@ SvxTableController::TblAction SvxTableController::getKeyboardAction(const KeyEve
|
||||
|
||||
bool SvxTableController::executeAction(TblAction nAction, bool bSelect, vcl::Window* pWindow)
|
||||
{
|
||||
sdr::table::SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
sdr::table::SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( !pTableObj )
|
||||
return false;
|
||||
|
||||
@ -1746,14 +1746,14 @@ bool SvxTableController::executeAction(TblAction nAction, bool bSelect, vcl::Win
|
||||
|
||||
void SvxTableController::gotoCell(const CellPos& rPos, bool bSelect, vcl::Window* pWindow, TblAction nAction /*= TblAction::NONE */)
|
||||
{
|
||||
if( mxTableObj.is() && static_cast<SdrTableObj*>(mxTableObj.get())->IsTextEditActive() )
|
||||
if( mxTableObj.is() && mxTableObj->IsTextEditActive() )
|
||||
mpView->SdrEndTextEdit(true);
|
||||
|
||||
if( bSelect )
|
||||
{
|
||||
maCursorLastPos = rPos;
|
||||
if( mxTableObj.is() )
|
||||
static_cast< SdrTableObj* >( mxTableObj.get() )->setActiveCell( rPos );
|
||||
mxTableObj->setActiveCell( rPos );
|
||||
|
||||
if( !mbCellSelectionMode )
|
||||
{
|
||||
@ -1857,7 +1857,7 @@ void SvxTableController::EditCell(const CellPos& rPos, vcl::Window* pWindow, Tbl
|
||||
{
|
||||
SdrPageView* pPV = mpView->GetSdrPageView();
|
||||
|
||||
sdr::table::SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
sdr::table::SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( pTableObj && pTableObj->GetPage() == pPV->GetPage() )
|
||||
{
|
||||
bool bEmptyOutliner = false;
|
||||
@ -2123,7 +2123,7 @@ void SvxTableController::updateSelectionOverlay()
|
||||
destroySelectionOverlay();
|
||||
if( mbCellSelectionMode )
|
||||
{
|
||||
sdr::table::SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
sdr::table::SdrTableObj* pTableObj = mxTableObj.get();
|
||||
if( pTableObj )
|
||||
{
|
||||
sdr::overlay::OverlayObjectCell::RangeVector aRanges;
|
||||
@ -2595,7 +2595,7 @@ bool SvxTableController::GetMarkedObjModel( SdrPage* pNewPage )
|
||||
{
|
||||
if( mxTableObj.is() && mbCellSelectionMode && pNewPage ) try
|
||||
{
|
||||
sdr::table::SdrTableObj& rTableObj = *static_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
sdr::table::SdrTableObj& rTableObj = *mxTableObj.get();
|
||||
|
||||
CellPos aStart, aEnd;
|
||||
getSelectedCells( aStart, aEnd );
|
||||
@ -3084,7 +3084,7 @@ bool SvxTableController::isColumnSelected( sal_Int32 nColumn )
|
||||
|
||||
bool SvxTableController::isRowHeader()
|
||||
{
|
||||
SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
SdrTableObj* pTableObj = mxTableObj.get();
|
||||
SdrModel* pModel = pTableObj ? pTableObj->GetModel() : nullptr;
|
||||
|
||||
if( !pTableObj || !pModel )
|
||||
@ -3097,7 +3097,7 @@ bool SvxTableController::isRowHeader()
|
||||
|
||||
bool SvxTableController::isColumnHeader()
|
||||
{
|
||||
SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
|
||||
SdrTableObj* pTableObj = mxTableObj.get();
|
||||
SdrModel* pModel = pTableObj ? pTableObj->GetModel() : nullptr;
|
||||
|
||||
if( !pTableObj || !pModel )
|
||||
@ -3113,7 +3113,7 @@ bool SvxTableController::setCursorLogicPosition(const Point& rPosition, bool bPo
|
||||
if (mxTableObj->GetObjIdentifier() != OBJ_TABLE)
|
||||
return false;
|
||||
|
||||
SdrTableObj* pTableObj = static_cast<SdrTableObj*>(mxTableObj.get());
|
||||
SdrTableObj* pTableObj = mxTableObj.get();
|
||||
CellPos aCellPos;
|
||||
if (pTableObj->CheckTableHit(rPosition, aCellPos.mnCol, aCellPos.mnRow) != TableHitKind::NONE)
|
||||
{
|
||||
|
@ -499,7 +499,7 @@ void TableStyleUndo::Redo()
|
||||
|
||||
void TableStyleUndo::setData( const Data& rData )
|
||||
{
|
||||
SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxObjRef.get() );
|
||||
SdrTableObj* pTableObj = mxObjRef.get();
|
||||
if( pTableObj )
|
||||
{
|
||||
pTableObj->setTableStyle( rData.mxTableStyle );
|
||||
@ -509,7 +509,7 @@ void TableStyleUndo::setData( const Data& rData )
|
||||
|
||||
void TableStyleUndo::getData( Data& rData )
|
||||
{
|
||||
SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxObjRef.get() );
|
||||
SdrTableObj* pTableObj = mxObjRef.get();
|
||||
if( pTableObj )
|
||||
{
|
||||
rData.maSettings = pTableObj->getTableStyleSettings();
|
||||
|
@ -237,7 +237,7 @@ public:
|
||||
virtual void Redo() override;
|
||||
|
||||
private:
|
||||
tools::WeakReference<SdrObject> mxObjRef;
|
||||
tools::WeakReference<SdrTableObj> mxObjRef;
|
||||
|
||||
struct Data
|
||||
{
|
||||
|
@ -18,9 +18,16 @@
|
||||
*/
|
||||
|
||||
#include <tools/ref.hxx>
|
||||
#include <tools/weakbase.hxx>
|
||||
|
||||
SvRefBase::~SvRefBase() COVERITY_NOEXCEPT_FALSE
|
||||
{
|
||||
}
|
||||
|
||||
tools::WeakBase::~WeakBase()
|
||||
{
|
||||
if( mpWeakConnection.is() )
|
||||
mpWeakConnection->mpReference = nullptr;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
Loading…
x
Reference in New Issue
Block a user