39class SdTransformOOo2xDocument
46 void transformMasterPages();
47 void transformDrawPages();
49 void transformStyles();
53 void transformShapes(
SdrObjList const & rShapes );
56 void transformTextShape(
SdrTextObj& rTextShape );
59 static bool getBulletState(
const SfxItemSet& rSet, sal_uInt16 nWhich,
bool& rState );
61 static bool transformItemSet(
SfxItemSet& rSet,
bool bNumbering );
63 static bool removeAlienAttributes(
SfxItemSet& rSet );
64 static bool removeAlienAttributes(
SfxItemSet& rSet, sal_uInt16 nWhich );
79 SdTransformOOo2xDocument aTransformer( *pDocument );
80 aTransformer.transform();
85constexpr OUStringLiteral
gsTextNamespace( u
"urn:oasis:names:tc:opendocument:xmlns:text:1.0" );
86constexpr OUStringLiteral
gsTrue( u
"true" );
88SdTransformOOo2xDocument::SdTransformOOo2xDocument(
SdDrawDocument& rDocument )
89: mrDocument( rDocument )
90, mrOutliner( rDocument.GetDrawOutliner() )
94void SdTransformOOo2xDocument::transform()
96 transformMasterPages();
101void SdTransformOOo2xDocument::transformMasterPages()
103 sal_uInt16 nMasterPageCount = mrDocument.GetMasterPageCount();
104 for( sal_uInt16 nMasterPage = 0; nMasterPage < nMasterPageCount; nMasterPage++ )
106 SdrObjList* pPage = mrDocument.GetMasterPage( nMasterPage );
108 transformShapes( *pPage );
112void SdTransformOOo2xDocument::transformDrawPages()
114 sal_uInt16 nPageCount = mrDocument.GetPageCount();
115 for( sal_uInt16 nPage = 0; nPage < nPageCount; nPage++ )
117 SdrObjList* pPage = mrDocument.GetPage( nPage );
119 transformShapes( *pPage );
123void SdTransformOOo2xDocument::transformStyles()
125 transformStyles( SfxStyleFamily::Para );
126 transformStyles( SfxStyleFamily::Page );
129void SdTransformOOo2xDocument::transformStyles(
SfxStyleFamily eFam )
139 transformStyle( *pSheet );
140 pSheet = aIter.Next();
151 transformItemSet( rSet, bState );
152 removeAlienAttributes( rSet );
155void SdTransformOOo2xDocument::transformShapes(
SdrObjList const & rShapes )
158 for(
size_t nShape = 0; nShape < nShapeCount; ++nShape )
162 transformShape( *pObj );
166void SdTransformOOo2xDocument::transformShape(
SdrObject& rObj )
171 transformTextShape( *pTextShape );
180 transformShapes( *pObjList );
185void SdTransformOOo2xDocument::transformTextShape(
SdrTextObj& rTextShape )
195 mrOutliner.SetText( *pOPO );
197 sal_Int32
nCount = mrOutliner.GetParagraphCount();
199 bool bChange =
false;
201 for(sal_Int32 nPara = 0; nPara <
nCount; nPara++)
203 SfxItemSet aParaSet( mrOutliner.GetParaAttribs( nPara ) );
205 bool bItemChange =
false;
208 const sal_Int16 nDepth = mrOutliner.GetDepth( nPara );
209 if( (nDepth != -1) && (!getBulletState( aParaSet, mrOutliner.GetStyleSheet( nPara ), bState ) || !bState) )
215 SfxStyleSheet* pStyleSheet = mrOutliner.GetStyleSheet( nPara );
223 sal_uInt16 nWhich(aIter.FirstWhich());
228 if(SfxItemState::SET != aIter.GetItemState())
230 aParaSet.Put(rStyleSet.
Get(nWhich));
234 nWhich = aIter.NextWhich();
239 mrOutliner.SetDepth( mrOutliner.GetParagraph( nPara ), -1 );
244 bItemChange |= transformItemSet( aParaSet, bState );
246 bItemChange |= removeAlienAttributes( aParaSet );
250 mrOutliner.SetParaAttribs( nPara, aParaSet );
263 if( getBulletState( rSet, EE_PARA_XMLATTRIBS, rState ) )
266 if( getBulletState( rSet, SDRATTR_XMLATTRIBUTES, rState ) )
275bool SdTransformOOo2xDocument::getBulletState(
const SfxItemSet& rSet, sal_uInt16 nWhich,
bool& rState )
282 for( sal_uInt16 nItem = 0; nItem <
nCount; nItem++ )
287 rState = sValue ==
gsTrue;
296bool SdTransformOOo2xDocument::transformItemSet(
SfxItemSet& rSet,
bool bNumbering )
303 if( (aItem.GetLeft() != 0) || (aItem.GetTextFirstLineOffset() != 0) )
305 aItem.SetLeftValue( 0 );
306 aItem.SetTextFirstLineOffset( 0 );
315bool SdTransformOOo2xDocument::removeAlienAttributes(
SfxItemSet& rSet )
317 bool b = removeAlienAttributes( rSet, EE_PARA_XMLATTRIBS );
318 b |= removeAlienAttributes( rSet, SDRATTR_XMLATTRIBUTES );
322bool SdTransformOOo2xDocument::removeAlienAttributes(
SfxItemSet& rSet, sal_uInt16 nWhich )
329 for( sal_uInt16 nItem = 0; nItem <
nCount; nItem++ )
341 const sal_uInt16 nFound = nItem;
342 for( nItem = 0; nItem <
nCount; nItem++ )
344 if( nItem != nFound )
348 if (rPrefix.isEmpty())
virtual SdrObjList * GetSubList() const override
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
void SetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject)
virtual SdrInventor GetObjInventor() const
bool IsEmptyPresObj() const
virtual OutlinerParaObject * GetOutlinerParaObject() const override
virtual SdrObjKind GetObjIdentifier() const override
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual const OUString & GetParent() const
SfxStyleFamily GetFamily() const
virtual SfxItemSet & GetItemSet()
SfxStyleSheetBasePool * GetPool()
OUString GetAttrPrefix(sal_uInt16 i) const
const OUString & GetAttrValue(sal_uInt16 i) const
OUString GetAttrNamespace(sal_uInt16 i) const
sal_uInt16 GetAttrCount() const
const OUString & GetAttrLName(sal_uInt16 i) const
constexpr TypedWhichId< SvxLRSpaceItem > EE_PARA_LRSPACE(EE_PARA_START+13)
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)