/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 * only, as published by the Free Software Foundation. * * OpenOffice.org is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License version 3 for more details * (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU Lesser General Public License * version 3 along with OpenOffice.org. If not, see * * for a copy of the LGPLv3 License. * ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" #include #include #include #include #include #include #include #include ////////////////////////////////////////////////////////////////////////////// namespace sdr { namespace properties { // create a new itemset SfxItemSet& GroupProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { // Groups have in principle no ItemSet. To support methods like // GetMergedItemSet() the local one is used. Thus, all items in the pool // may be used and a pool itemset is created. return *(new SfxItemSet(rPool)); } GroupProperties::GroupProperties(SdrObject& rObj) : DefaultProperties(rObj) { } GroupProperties::GroupProperties(const GroupProperties& rProps, SdrObject& rObj) : DefaultProperties(rProps, rObj) { } GroupProperties::~GroupProperties() { } BaseProperties& GroupProperties::Clone(SdrObject& rObj) const { return *(new GroupProperties(*this, rObj)); } const SfxItemSet& GroupProperties::GetObjectItemSet() const { DBG_ASSERT(sal_False, "GroupProperties::GetObjectItemSet() should never be called (!)"); return DefaultProperties::GetObjectItemSet(); } const SfxItemSet& GroupProperties::GetMergedItemSet() const { // prepare ItemSet if(mpItemSet) { // clear local itemset for merge mpItemSet->ClearItem(); } else { // force local itemset DefaultProperties::GetObjectItemSet(); } // collect all ItemSets in mpItemSet const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList(); const sal_uInt32 nCount(pSub->GetObjCount()); for(sal_uInt32 a(0L); a < nCount; a++) { const SfxItemSet& rSet = pSub->GetObj(a)->GetMergedItemSet(); SfxWhichIter aIter(rSet); sal_uInt16 nWhich(aIter.FirstWhich()); while(nWhich) { if(SFX_ITEM_DONTCARE == rSet.GetItemState(nWhich, FALSE)) { mpItemSet->InvalidateItem(nWhich); } else { mpItemSet->MergeValue(rSet.Get(nWhich), TRUE); } nWhich = aIter.NextWhich(); } } // For group proerties, do not call parent since groups do // not have local ItemSets. return *mpItemSet; } void GroupProperties::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems) { // iterate over contained SdrObjects const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList(); const sal_uInt32 nCount(pSub->GetObjCount()); for(sal_uInt32 a(0L); a < nCount; a++) { SdrObject* pObj = pSub->GetObj(a); if(pObj) { // Set merged ItemSet at contained object pObj->SetMergedItemSet(rSet, bClearAllItems); } } // Do not call parent here. Group objects do not have local ItemSets // where items need to be set. // DefaultProperties::SetMergedItemSet(rSet, bClearAllItems); } void GroupProperties::SetObjectItem(const SfxPoolItem& /*rItem*/) { DBG_ASSERT(sal_False, "GroupProperties::SetObjectItem() should never be called (!)"); } void GroupProperties::SetObjectItemDirect(const SfxPoolItem& /*rItem*/) { DBG_ASSERT(sal_False, "GroupProperties::SetObjectItemDirect() should never be called (!)"); } void GroupProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/) { DBG_ASSERT(sal_False, "GroupProperties::ClearObjectItem() should never be called (!)"); } void GroupProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/) { DBG_ASSERT(sal_False, "GroupProperties::ClearObjectItemDirect() should never be called (!)"); } void GroupProperties::SetMergedItem(const SfxPoolItem& rItem) { const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList(); const sal_uInt32 nCount(pSub->GetObjCount()); for(sal_uInt32 a(0L); a < nCount; a++) { pSub->GetObj(a)->GetProperties().SetMergedItem(rItem); } } void GroupProperties::ClearMergedItem(const sal_uInt16 nWhich) { const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList(); const sal_uInt32 nCount(pSub->GetObjCount()); for(sal_uInt32 a(0L); a < nCount; a++) { pSub->GetObj(a)->GetProperties().ClearMergedItem(nWhich); } } void GroupProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/) { DBG_ASSERT(sal_False, "GroupProperties::SetObjectItemSet() should never be called (!)"); } void GroupProperties::ItemSetChanged(const SfxItemSet& /*rSet*/) { DBG_ASSERT(sal_False, "GroupProperties::ItemSetChanged() should never be called (!)"); } sal_Bool GroupProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const { DBG_ASSERT(sal_False, "GroupProperties::AllowItemChange() should never be called (!)"); return sal_False; } void GroupProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) { DBG_ASSERT(sal_False, "GroupProperties::ItemChange() should never be called (!)"); } void GroupProperties::PostItemChange(const sal_uInt16 /*nWhich*/) { DBG_ASSERT(sal_False, "GroupProperties::PostItemChange() should never be called (!)"); } SfxStyleSheet* GroupProperties::GetStyleSheet() const { SfxStyleSheet* pRetval = 0L; const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList(); const sal_uInt32 nCount(pSub->GetObjCount()); for(sal_uInt32 a(0L); a < nCount; a++) { SfxStyleSheet* pCandidate = pSub->GetObj(a)->GetStyleSheet(); if(pRetval) { if(pCandidate != pRetval) { // different StyleSheelts, return none return 0L; } } else { pRetval = pCandidate; } } return pRetval; } void GroupProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr) { const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList(); const sal_uInt32 nCount(pSub->GetObjCount()); for(sal_uInt32 a(0L); a < nCount; a++) { pSub->GetObj(a)->SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr); } } void GroupProperties::ForceDefaultAttributes() { // nothing to do here, groups have no items and thus no default items, too. } void GroupProperties::MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel) { if(pSrcPool && pDestPool && (pSrcPool != pDestPool)) { const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList(); const sal_uInt32 nCount(pSub->GetObjCount()); for(sal_uInt32 a(0L); a < nCount; a++) { pSub->GetObj(a)->GetProperties().MoveToItemPool(pSrcPool, pDestPool, pNewModel); } // also clear local ItemSet, it's only temporary for group objects anyways. if(mpItemSet) { // #121905# // copy/paste is still using clone operators and MoveToItemPool functionality. // Since SfxItemSet contains a pool pointer, ClearItem is not enough here. // The ItemSet for merge is constructed on demand, so it's enough here to // just delete it and set to 0L. // mpItemSet->ClearItem(); delete mpItemSet; mpItemSet = 0L; } } } void GroupProperties::ForceStyleToHardAttributes() { const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList(); const sal_uInt32 nCount(pSub->GetObjCount()); for(sal_uInt32 a(0L); a < nCount; a++) { pSub->GetObj(a)->GetProperties().ForceStyleToHardAttributes(); } } } // end of namespace properties } // end of namespace sdr ////////////////////////////////////////////////////////////////////////////// // eof e/allo_contract34185 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2014-06-06fixincludeguards: fix include guardsThomas Arnhold
2014-06-05various: remove SAL_THROW macroNoel Grandin
2014-05-29remove more unnecesary OUString constructor useNoel Grandin
2014-05-17Comment why it's not a copy paste errorJulien Nabet
2014-05-11Prefer cppu::UnoType<T>::get() to ::getCppuType((T*)0) part10Julien Nabet
2014-05-10Prefer cppu::UnoType<T>::get() to ::getCppuType((T*)0) part9Julien Nabet
2014-05-01Many spelling fixes: directories r* - z*.Pedro Giffuni
2014-04-19cpplint: [readability/utf8] Line contains invalid UTF-8Julien Nabet
2014-04-15xmloff: sal_Bool->boolNoel Grandin
2014-04-14typo: attribut -> attributeThomas Arnhold
2014-04-14typo: choosen -> chosenThomas Arnhold
2014-04-10It's "its", not "it's"Tor Lillqvist
2014-04-09Clean up function declarations and some unused functionsStephan Bergmann
2014-04-07Replace SV_DECL/IMPL_REF macros with SvRef templateStephan Bergmann
2014-04-03remove unnecessary scope qualifier from sal_Bool usesNoel Grandin
2014-04-01Explicitly mark overriding destructors as "virtual"Stephan Bergmann
2014-03-31xmloff: sal_Bool->boolNoel Grandin
2014-03-31xmloff: sal_Bool->boolNoel Grandin
2014-03-31xmloff: sal_Bool->boolNoel Grandin
2014-03-26First batch of adding SAL_OVERRRIDE to overriding function declarationsStephan Bergmann
2014-03-26Split TYPEINFO into plain and TYPEINFO_OVERRIDEStephan Bergmann
2014-03-13xmloff,vbahelper: prefer passing OUString and OString by referenceNoel Grandin
2014-02-26cppuhelper: retrofit std::exception into overriding exception specsStephan Bergmann
2014-02-26Remove visual noise from xmloffAlexander Wilms
2014-02-24Replace exisiting TriState, AutoState with more generic TriStateStephan Bergmann
2014-02-24Remove unnecessary bool2anyStephan Bergmann
2014-02-24Remove unnecessary extractInterfaceStephan Bergmann
2014-01-28bool improvementsStephan Bergmann
2014-01-23Let C++ inline functions return bool instead of sal_BoolStephan Bergmann
2014-01-07remove unnecessary sal_Unicode casts in OUStringBuffer::append callsNoel Grandin
2013-12-20added bool bForExport parameter to XMLPropertySetMapper ctorEike Rathke
2013-12-20prepared XMLPropertyMapEntry with mbImportOnly flagEike Rathke
2013-12-06Clean up includes of comphelper/stl_types.hxxStephan Bergmann
2013-12-06Get rid of DECLARE_STL_MAPStephan Bergmann
2013-12-06Get rid of DECLARE_STL_VECTORStephan Bergmann
2013-12-06Get rid of DECLARE_STL_USTRINGACCESS_MAPStephan Bergmann
2013-12-05Get rid of DECLARE_STL_STDKEY_SETStephan Bergmann
2013-11-11xmloff: include <> for external includesNorbert Thiebaud
2013-11-11convert OUString !compareToAscii to equalsAsciiNoel Grandin
2013-11-11convert OUString 0==compareToAscii to equalsAsciiNoel Grandin
2013-11-04remove redundant calls to OUString constructorNoel Grandin
2013-11-04Convert code that calls OUString::getStr()[] to use the [] operatorNoel Grandin
2013-10-23fixincludeguards.sh: xmloffThomas Arnhold
2013-10-22Bin comments that claim to say why some header is includedTor Lillqvist
2013-10-11loplugin if-body warningsStephan Bergmann
2013-09-16sal_Bool to boolEike Rathke
2013-09-12xmloff: fix Apple g++ 4.2.1 warningMichael Stahl