/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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 .
*/
// it is difficult to find it later on bool bRbtGroupEnabled = m_xRbtGroup->get_sensitive(); bool bBtnGetAllObjectsEnabled = m_xBtnGetAllObjects->get_sensitive(); bool bBtnGetOneObjectEnabled = m_xBtnGetOneObject->get_sensitive();
// calculate overall time
::tools::Long nFullTime; if( m_xRbtBitmap->get_active() )
{
::tools::Time aTime(::tools::Time::EMPTY); for (size_t i = 0; i < nCount; ++i)
{
aTime += m_FrameList[i].second;
}
nFullTime = aTime.GetMSFromTime();
} else
{
nFullTime = nCount * 100;
}
// StatusBarManager from 1 second
std::unique_ptr<SfxProgress> pProgress; if( nFullTime >= 1000 )
{
bDisableCtrls = true;
m_xBtnStop->set_sensitive(true);
pProgress.reset(new SfxProgress( nullptr, u"Animator:"_ustr, nFullTime )); // "Animator:" here we should think about something smart
}
sal_uLong nTmpTime = 0;
size_t i = 0; bool bCount = i < nCount; if (bCount)
{ if( bReverse )
i = nCount - 1;
while (bMovie)
{ // make list and view consistent
assert(i < m_FrameList.size());
m_nCurrentFrame = i;
// tdf#95298 check m_nCurrentFrame for EMPTY_FRAMELIST to avoid out-of-bound array access if (&rBtn == m_xBtnRemoveBitmap.get() && EMPTY_FRAMELIST != m_nCurrentFrame)
{
m_FrameList.erase(m_FrameList.begin() + m_nCurrentFrame);
pObject = pPage->GetObj(m_nCurrentFrame); // Through acquisition of the AnimatedGIFs, objects does not need to // exist. if( pObject )
{
pObject = pPage->RemoveObject(m_nCurrentFrame);
DBG_ASSERT(pObject, "Clone not found during deletion");
pObject.clear();
pPage->RecalcObjOrdNums();
}
if (m_nCurrentFrame >= m_FrameList.size())
{ // tdf#95298 last frame was deleted, try to use the one before it or go on empty state
m_nCurrentFrame = m_FrameList.empty() ? EMPTY_FRAMELIST : m_FrameList.size() - 1;
}
} else// delete everything
{
std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::YesNo,
SdResId(STR_ASK_DELETE_ALL_PICTURES))); short nReturn = xWarn->run();
if( nReturn == RET_YES )
{ // clear frame list for (size_t i = m_FrameList.size(); i > 0; )
{
--i;
pObject = pPage->GetObj( i ); if( pObject )
{
pObject = pPage->RemoveObject( i );
DBG_ASSERT(pObject, "Clone not found during deletion");
pObject.clear(); //pPage->RecalcObjOrdNums();
}
}
m_FrameList.clear();
m_nCurrentFrame = EMPTY_FRAMELIST;
}
}
// can we create an animation group if (m_FrameList.empty())
{
m_xBtnCreateGroup->set_sensitive(false); // if previous disabled by acquisition of AnimatedGIFs: //m_xRbtBitmap->set_sensitive(true);
m_xRbtGroup->set_sensitive(true);
}
// calculate and set zoom for DisplayWin
Fraction aFrac(GetScale());
m_xCtlDisplay->SetScale(aFrac);
UpdateControl();
}
IMPL_LINK_NOARG(AnimationWindow, ClickCreateGroupHdl, weld::Button&, void)
{ // Code now in CreatePresObj()
SfxBoolItem aItem( SID_ANIMATOR_CREATE, true );
// if there is at least 1 object in the list
m_xBtnFirst->set_sensitive(true);
m_xBtnReverse->set_sensitive(true);
m_xBtnPlay->set_sensitive(true);
m_xBtnLast->set_sensitive(true);
m_xNumFldBitmap->set_sensitive(true);
m_xTimeField->set_sensitive(true);
m_xLbLoopCount->set_sensitive(true);
m_xBtnRemoveBitmap->set_sensitive(true);
m_xBtnRemoveAll->set_sensitive(true);
} else
{ // if no object is in the list
m_xBtnFirst->set_sensitive( false );
m_xBtnReverse->set_sensitive( false );
m_xBtnPlay->set_sensitive( false );
m_xBtnLast->set_sensitive( false );
m_xNumFldBitmap->set_sensitive( false );
m_xTimeField->set_sensitive( false );
m_xLbLoopCount->set_sensitive( false );
m_xBtnRemoveBitmap->set_sensitive( false );
m_xBtnRemoveAll->set_sensitive( false );
}
if( bMovie && bDisableCtrls )
{
m_xBtnGetOneObject->set_sensitive( false );
m_xBtnGetAllObjects->set_sensitive( false );
m_xRbtGroup->set_sensitive( false );
m_xRbtBitmap->set_sensitive( false );
m_xBtnCreateGroup->set_sensitive( false );
m_xFtAdjustment->set_sensitive( false );
m_xLbAdjustment->set_sensitive( false );
} else
{ // enable 'group object' only if it is not an Animated GIF if (m_FrameList.empty())
{
m_xRbtGroup->set_sensitive(true);
}
void AnimationWindow::AddObj (::sd::View& rView )
{ // finish text entry mode to ensure that bitmap is identical with object if( rView.IsTextEdit() )
rView.SdrEndTextEdit();
// clone object(s) and insert the clone(s) into the list const SdrMarkList& rMarkList = rView.GetMarkedObjectList(); const size_t nMarkCount = rMarkList.GetMarkCount();
SdPage* pPage = pMyDoc->GetSdPage(0, PageKind::Standard); const size_t nCloneCount = pPage->GetObjCount();
if (nMarkCount <= 0) return;
// If it is ONE animation object or one group object, which was // 'individually taken', we insert the objects separately bool bAnimObj = false; if( nMarkCount == 1 )
{
SdrMark* pMark = rMarkList.GetMark(0);
SdrObject* pObject = pMark->GetMarkedSdrObj();
SdAnimationInfo* pAnimInfo = SdDrawDocument::GetAnimationInfo( pObject );
SdrInventor nInv = pObject->GetObjInventor();
SdrObjKind nId = pObject->GetObjIdentifier();
// increment => next one inserted after this one
++m_nCurrentFrame;
} // if an animated GIF is taken, only such one can be created
m_xRbtBitmap->set_active(true);
m_xRbtGroup->set_sensitive( false );
bAnimObj = true;
}
} elseif( bAllObjects || ( pAnimInfo && pAnimInfo->mbIsMovie ) )
{ // several objects
SdrObjList* pObjList = static_cast<SdrObjGroup*>(pObject)->GetSubList();
// if there was nothing in the animator before but now is something // there, we can create an animation group if (nCloneCount == 0 && !m_FrameList.empty())
{
m_xBtnCreateGroup->set_sensitive(true);
}
// calculate and set zoom for DisplayWin
Fraction aFrac( GetScale() );
m_xCtlDisplay->SetScale(aFrac);
} // Unfortunately, SetSnapRect is not implemented for ellipses !!!
Point aMovePt( aWindowCenter + Point( aOffset.Width(), aOffset.Height() ) - aRect.TopLeft() );
Size aMoveSize( aMovePt.X(), aMovePt.Y() );
pClone->NbcMove( aMoveSize );
}
// #i42894# Caution(!) variable pPage looks right, but it is a page from the local // document the dialog is using (!), so get the target page from the target view
SdPage* pTargetSdPage = dynamic_cast< SdPage* >(rView.GetSdrPageView() ? rView.GetSdrPageView()->GetPage() : nullptr);
if(pTargetSdPage)
{ // create animation group
rtl::Reference<SdrObjGroup> pGroup = new SdrObjGroup(rView.getSdrModelFromSdrView());
SdrObjList* pObjList = pGroup->GetSubList();
for (size_t i = 0; i < nCount; ++i)
{ // the clone remains in the animation; we insert a clone of the // clone into the group
pClone = pPage->GetObj(i);
rtl::Reference<SdrObject> pCloneOfClone(pClone->CloneSdrObject(pTargetSdPage->getSdrModelFromSdrPage())); //SdrObject* pCloneOfClone = pPage->GetObj(i)->Clone();
pObjList->InsertObject(pCloneOfClone.get());
}
// until now the top left corner of the group is in the window center; // correct the position by half of the size of the group
aTemp = aMaxSizeLog;
aTemp.setHeight( - aTemp.Height() / 2 );
aTemp.setWidth( - aTemp.Width() / 2 );
pGroup->NbcMove(aTemp);
// #i42894# create needed SMIL stuff and move child objects to page directly (see // comments at EffectMigration::CreateAnimatedGroup why this has to be done).
EffectMigration::CreateAnimatedGroup(*pGroup, *pTargetSdPage);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.