2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-21 22:06:52 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2001-11-05 13:02:01 +00:00
|
|
|
|
|
|
|
#include "svdoutlinercache.hxx"
|
2007-06-27 18:10:29 +00:00
|
|
|
#include <svx/svdoutl.hxx>
|
|
|
|
#include <svx/svdmodel.hxx>
|
2014-06-25 14:57:44 +02:00
|
|
|
#include <svx/svdetc.hxx>
|
2001-11-05 13:02:01 +00:00
|
|
|
|
|
|
|
SdrOutlinerCache::SdrOutlinerCache( SdrModel* pModel )
|
|
|
|
: mpModel( pModel ),
|
|
|
|
mpModeOutline( NULL ),
|
|
|
|
mpModeText( NULL )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SdrOutliner* SdrOutlinerCache::createOutliner( sal_uInt16 nOutlinerMode )
|
|
|
|
{
|
|
|
|
SdrOutliner* pOutliner = NULL;
|
|
|
|
|
|
|
|
if( (OUTLINERMODE_OUTLINEOBJECT == nOutlinerMode) && mpModeOutline )
|
|
|
|
{
|
|
|
|
pOutliner = mpModeOutline;
|
|
|
|
mpModeOutline = NULL;
|
|
|
|
}
|
|
|
|
else if( (OUTLINERMODE_TEXTOBJECT == nOutlinerMode) && mpModeText )
|
|
|
|
{
|
|
|
|
pOutliner = mpModeText;
|
|
|
|
mpModeText = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-10-29 09:08:21 +00:00
|
|
|
pOutliner = SdrMakeOutliner(nOutlinerMode, *mpModel);
|
2001-11-05 13:02:01 +00:00
|
|
|
Outliner& aDrawOutliner = mpModel->GetDrawOutliner();
|
|
|
|
pOutliner->SetCalcFieldValueHdl( aDrawOutliner.GetCalcFieldValueHdl() );
|
2014-10-17 15:03:34 +01:00
|
|
|
maActiveOutliners.push_back(pOutliner);
|
2001-11-05 13:02:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return pOutliner;
|
|
|
|
}
|
|
|
|
|
|
|
|
SdrOutlinerCache::~SdrOutlinerCache()
|
|
|
|
{
|
|
|
|
if( mpModeOutline )
|
|
|
|
{
|
|
|
|
delete mpModeOutline;
|
|
|
|
mpModeOutline = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( mpModeText )
|
|
|
|
{
|
|
|
|
delete mpModeText;
|
|
|
|
mpModeText = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SdrOutlinerCache::disposeOutliner( SdrOutliner* pOutliner )
|
|
|
|
{
|
|
|
|
if( pOutliner )
|
|
|
|
{
|
2011-01-10 16:11:35 +01:00
|
|
|
sal_uInt16 nOutlMode = pOutliner->GetOutlinerMode();
|
2001-11-05 13:02:01 +00:00
|
|
|
|
|
|
|
if( (OUTLINERMODE_OUTLINEOBJECT == nOutlMode) && (NULL == mpModeOutline) )
|
|
|
|
{
|
|
|
|
mpModeOutline = pOutliner;
|
|
|
|
pOutliner->Clear();
|
2002-03-20 09:07:58 +00:00
|
|
|
pOutliner->SetVertical( false );
|
2008-03-12 08:56:15 +00:00
|
|
|
|
2011-05-12 11:03:28 +02:00
|
|
|
// Deregister on outliner, might be reused from outliner cache
|
2015-04-30 10:20:00 +02:00
|
|
|
pOutliner->SetNotifyHdl( Link<>() );
|
2001-11-05 13:02:01 +00:00
|
|
|
}
|
|
|
|
else if( (OUTLINERMODE_TEXTOBJECT == nOutlMode) && (NULL == mpModeText) )
|
|
|
|
{
|
|
|
|
mpModeText = pOutliner;
|
|
|
|
pOutliner->Clear();
|
2002-03-20 09:07:58 +00:00
|
|
|
pOutliner->SetVertical( false );
|
2008-03-12 08:56:15 +00:00
|
|
|
|
2011-05-12 11:03:28 +02:00
|
|
|
// Deregister on outliner, might be reused from outliner cache
|
2015-04-30 10:20:00 +02:00
|
|
|
pOutliner->SetNotifyHdl( Link<>() );
|
2001-11-05 13:02:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-10-17 15:03:34 +01:00
|
|
|
maActiveOutliners.erase(std::remove(maActiveOutliners.begin(), maActiveOutliners.end(), pOutliner), maActiveOutliners.end());
|
2001-11-05 13:02:01 +00:00
|
|
|
delete pOutliner;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|