/* -*- 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 .
*/
// save group object
SwDrawFrameFormat* pFormat = m_pObjArray[0].pFormat;
pFormat->CallSwClientNotify(sw::ContactChangedHint(&m_pObjArray[0].pObj)); auto pObj = m_pObjArray[0].pObj;
pObj->SetUserCall(nullptr);
// This will store the textboxes what were owned by this group
std::vector<std::pair<SdrObject*, SwFrameFormat*>> vTextBoxes; if (auto pOldTextBoxNode = pFormat->GetOtherTextBoxFormats())
{ if (auto pChildren = pObj->getChildrenOfSdrObject())
{ for (const rtl::Reference<SdrObject>& pChild : *pChildren)
{ if (auto pTextBox = pOldTextBoxNode->GetTextBox(pChild.get()))
vTextBoxes.push_back(std::pair(pChild.get(), pTextBox));
}
}
}
// #i45952# - notify that position attributes are already set
OSL_ENSURE(pDrawFrameFormat, " - wrong type of frame format for drawing object"); if (pDrawFrameFormat)
pDrawFrameFormat->PosAttrSet();
}
}
// This will store the textboxes from the ex-group-shapes
std::vector<std::pair<SdrObject*, SwFrameFormat*>> vTextBoxes;
for( sal_uInt16 n = 1; n < m_nSize; ++n )
{
SwUndoGroupObjImpl& rSave = m_pObjArray[n];
SdrObject* pObj = rSave.pObj;
SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj)); if (!pContact) continue;
// Save the textboxes if (auto pOldTextBoxNode = rSave.pFormat->GetOtherTextBoxFormats())
{ if (auto pTextBox = pOldTextBoxNode->GetTextBox(pObj))
vTextBoxes.push_back(std::pair(pObj, pTextBox));
}
// Restore the textboxes if (vTextBoxes.size())
{ auto pNewTextBoxNode = std::make_shared<SwTextBoxNode>(SwTextBoxNode(m_pObjArray[0].pFormat)); for (auto& rElem : vTextBoxes)
{
pNewTextBoxNode->AddTextBox(rElem.first, rElem.second);
rElem.second->SetOtherTextBoxFormats(pNewTextBoxNode);
}
m_pObjArray[0].pFormat->SetOtherTextBoxFormats(pNewTextBoxNode);
}
// #i45952# - notify that position attributes are already set
OSL_ENSURE(pDrawFrameFormat, " - wrong type of frame format for drawing object"); if (pDrawFrameFormat)
pDrawFrameFormat->PosAttrSet();
}
// copy the textboxes for later use to this vector if (auto pTxBxNd = rSave.pFormat->GetOtherTextBoxFormats())
{ if (auto pGroupObj = m_pObjArray[0].pObj)
{ if (auto pChildren = pGroupObj->getChildrenOfSdrObject())
{ for (const rtl::Reference<SdrObject>& pChild : *pChildren)
{ if (auto pTextBox = pTxBxNd->GetTextBox(pChild.get()))
vTextBoxes.push_back(std::pair(pChild.get(), pTextBox));
}
}
}
}
// Restore the vector content for the new formats if (vTextBoxes.size())
{ auto pNewTxBxNd = std::make_shared<SwTextBoxNode>( SwTextBoxNode(m_pObjArray[0].pFormat)); for (auto& rElem : vTextBoxes)
{
pNewTxBxNd->AddTextBox(rElem.first, rElem.second);
rElem.second->SetOtherTextBoxFormats(pNewTxBxNd);
}
m_pObjArray[0].pFormat->SetOtherTextBoxFormats(pNewTxBxNd);
}
// #i45952# - notify that position attributes are already set
OSL_ENSURE(pDrawFrameFormat, " - wrong type of frame format for drawing object"); if (pDrawFrameFormat)
pDrawFrameFormat->PosAttrSet();
}
// Store the textboxes in this vector for later use.
std::vector<std::pair<SdrObject*, SwFrameFormat*>> vTextBoxes; if (auto pTextBoxNode = pFormat->GetOtherTextBoxFormats())
{ auto pMasterObj = m_pObjArray[0].pObj;
if (auto pObjList = pMasterObj->getChildrenOfSdrObject()) for (const rtl::Reference<SdrObject>& pObj : *pObjList)
{
vTextBoxes.push_back(std::pair(pObj.get(), pTextBoxNode->GetTextBox(pObj.get())));
}
}
// Restore the textboxes for the restored group shape. for (auto& pElem : vTextBoxes)
{ if (pElem.first == rSave.pObj)
{ auto pTmpTxBxNd = std::make_shared<SwTextBoxNode>(SwTextBoxNode(rSave.pFormat));
pTmpTxBxNd->AddTextBox(rSave.pObj, pElem.second);
pFormat->SetOtherTextBoxFormats(pTmpTxBxNd);
pElem.second->SetOtherTextBoxFormats(pTmpTxBxNd); break;
}
}
// #i45952# - notify that position attributes are already set
OSL_ENSURE(pDrawFrameFormat, " - wrong type of frame format for drawing object" ); if (pDrawFrameFormat)
pDrawFrameFormat->PosAttrSet();
}
}
// #i45952# - notify that position attributes are already set
OSL_ENSURE(pDrawFrameFormat, " - wrong type of frame format for drawing object"); if (pDrawFrameFormat)
pDrawFrameFormat->PosAttrSet();
}
rContext.SetSelections(nullptr, m_pMarkList.get());
}
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.