/* -*- 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/.
*/
// self-destructing thread to make shell execute async class ExternalToolEditThread
: public ::salhelper::Thread
{ private:
OUString const m_aFileName;
// Move it to a file name with image extension properly set
aTempFileName = aTempFileBase + "." + fExtension; // FIXME: this is pretty stupid, need a better osl temp file API
rc = osl::File::move(aTempFileBase, aTempFileName); if (osl::FileBase::E_None != rc)
{
SAL_WARN("svx", "ExternalToolEdit::Edit: cannot move temp file"); return;
}
//Write Graphic to the Temp File
GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
sal_uInt16 nFilter(rGraphicFilter.GetExportFormatNumberForShortName(fExtension));
// Write the Graphic to the file now
XOutBitmap::WriteGraphic(aGraphic, aTempFileName, aFilter, XOutFlags::UseNativeIfPossible | XOutFlags::DontExpandFilename);
// There is a possibility that sPath extension might have been changed if the // provided extension is not writable
m_aFileName = aTempFileName;
//Create a thread
rtl::Reference<ExternalToolEditThread> const pThread( new ExternalToolEditThread(m_aFileName));
pThread->launch();
void SdrExternalToolEdit::Update(Graphic & rGraphic)
{
assert(m_pObj && m_pView); // timer should be deleted by Notify() too
SdrPageView *const pPageView = m_pView->GetSdrPageView(); if (!pPageView) return;
rtl::Reference<SdrGrafObj> pNewObj = SdrObject::Clone(*m_pObj, m_pObj->getSdrModelFromSdrObject());
assert(pNewObj);
OUString const description =
m_pView->GetMarkedObjectList().GetMarkDescription() + " External Edit";
m_pView->BegUndo(description);
pNewObj->SetGraphicObject(rGraphic); // set to new object before ReplaceObjectAtView() so that Notify() will // not delete the running timer and crash
rtl::Reference<SdrObject> pOldObj = m_pObj;
m_pObj = pNewObj;
m_pView->ReplaceObjectAtView(pOldObj.get(), *pPageView, pNewObj.get());
m_pView->EndUndo();
}
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.