summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-03-08 18:14:29 +0100
committerJan Holesovsky <kendy@collabora.com>2017-05-15 21:58:57 +0200
commit961d286ea355feda57b3138cb8339d6e2200d98a (patch)
treec698e75bbaa69cf6d5dee97f8bc929a38fa33aa8 /sc
parent2401cac9ff2d219520079c93736a947b9e99bacf (diff)
let ScNoteUtil::CreateTempCaption() return ScCaptionPtr
Change-Id: Idcb7fc24a13d650d88bec9ba359d7c78006096ec
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/postit.hxx2
-rw-r--r--sc/source/core/data/postit.cxx7
-rw-r--r--sc/source/ui/inc/notemark.hxx4
-rw-r--r--sc/source/ui/view/notemark.cxx19
4 files changed, 15 insertions, 17 deletions
diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 0801b2493abc..e198870479f6 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -247,7 +247,7 @@ class SC_DLLPUBLIC ScNoteUtil
public:
/** Creates and returns a caption object for a temporary caption. */
- static SdrCaptionObj* CreateTempCaption( ScDocument& rDoc, const ScAddress& rPos,
+ static ScCaptionPtr CreateTempCaption( ScDocument& rDoc, const ScAddress& rPos,
SdrPage& rDrawPage, const OUString& rUserText,
const Rectangle& rVisRect, bool bTailFront );
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 4071bb45993b..2111b8ebb4e4 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -1078,7 +1078,7 @@ void ScPostIt::RemoveCaption()
maNoteData.mxCaption.reset(nullptr);
}
-SdrCaptionObj* ScNoteUtil::CreateTempCaption(
+ScCaptionPtr ScNoteUtil::CreateTempCaption(
ScDocument& rDoc, const ScAddress& rPos, SdrPage& rDrawPage,
const OUString& rUserText, const Rectangle& rVisRect, bool bTailFront )
{
@@ -1095,7 +1095,7 @@ SdrCaptionObj* ScNoteUtil::CreateTempCaption(
// create a caption if any text exists
if( !pNoteCaption && aBuffer.isEmpty() )
- return nullptr;
+ return ScCaptionPtr();
// prepare visible rectangle (add default distance to all borders)
Rectangle aVisRect(
@@ -1138,9 +1138,8 @@ SdrCaptionObj* ScNoteUtil::CreateTempCaption(
// move caption into visible area
aCreator.AutoPlaceCaption( &aVisRect );
- // The caption object returned is completely unmanaged and stored elsewhere.
// XXX Note it is already inserted to the draw page.
- return aCreator.GetCaption().release();
+ return aCreator.GetCaption();
}
ScPostIt* ScNoteUtil::CreateNoteFromCaption(
diff --git a/sc/source/ui/inc/notemark.hxx b/sc/source/ui/inc/notemark.hxx
index 2d83b8fe500e..b02bf812f623 100644
--- a/sc/source/ui/inc/notemark.hxx
+++ b/sc/source/ui/inc/notemark.hxx
@@ -24,9 +24,9 @@
#include <vcl/timer.hxx>
#include "global.hxx"
#include "address.hxx"
+#include "postit.hxx"
class SdrModel;
-class SdrObject;
class ScNoteMarker
{
@@ -46,7 +46,7 @@ private:
Rectangle aRect;
SdrModel* pModel;
- SdrObject* pObject;
+ ScCaptionPtr mxObject;
bool bVisible;
Point aGridOff;
DECL_LINK( TimeHdl, Timer*, void );
diff --git a/sc/source/ui/view/notemark.cxx b/sc/source/ui/view/notemark.cxx
index 9d5282e58a77..564d98d83329 100644
--- a/sc/source/ui/view/notemark.cxx
+++ b/sc/source/ui/view/notemark.cxx
@@ -48,7 +48,6 @@ ScNoteMarker::ScNoteMarker( vcl::Window* pWin, vcl::Window* pRight, vcl::Window*
bLeft( bLeftEdge ),
bByKeyboard( bKeyboard ),
pModel( nullptr ),
- pObject( nullptr ),
bVisible( false )
{
Size aSizePixel = pWindow->GetOutputSizePixel();
@@ -94,11 +93,11 @@ IMPL_LINK_NOARG(ScNoteMarker, TimeHdl, Timer *, void)
if( SdrPage* pPage = pModel->AllocPage( false ) )
{
- pObject = ScNoteUtil::CreateTempCaption( *pDoc, aDocPos, *pPage, aUserText, aVisRect, bLeft );
- if( pObject )
+ mxObject = ScNoteUtil::CreateTempCaption( *pDoc, aDocPos, *pPage, aUserText, aVisRect, bLeft );
+ if( mxObject )
{
- pObject->SetGridOffset( aGridOff );
- aRect = pObject->GetCurrentBoundRect();
+ mxObject->SetGridOffset( aGridOff );
+ aRect = mxObject->GetCurrentBoundRect();
}
// Insert page so that the model recognise it and also deleted
@@ -141,21 +140,21 @@ static MapMode lcl_MoveMapMode( const MapMode& rMap, const Size& rMove )
void ScNoteMarker::Draw()
{
- if ( pObject && bVisible )
+ if ( mxObject && bVisible )
{
- lcl_DrawWin( pObject, pWindow, aMapMode );
+ lcl_DrawWin( mxObject.get(), pWindow, aMapMode );
if ( pRightWin || pBottomWin )
{
Size aWinSize = pWindow->PixelToLogic( pWindow->GetOutputSizePixel(), aMapMode );
if ( pRightWin )
- lcl_DrawWin( pObject, pRightWin,
+ lcl_DrawWin( mxObject.get(), pRightWin,
lcl_MoveMapMode( aMapMode, Size( aWinSize.Width(), 0 ) ) );
if ( pBottomWin )
- lcl_DrawWin( pObject, pBottomWin,
+ lcl_DrawWin( mxObject.get(), pBottomWin,
lcl_MoveMapMode( aMapMode, Size( 0, aWinSize.Height() ) ) );
if ( pDiagWin )
- lcl_DrawWin( pObject, pDiagWin, lcl_MoveMapMode( aMapMode, aWinSize ) );
+ lcl_DrawWin( mxObject.get(), pDiagWin, lcl_MoveMapMode( aMapMode, aWinSize ) );
}
}
}