@@ -336,22 +336,18 @@ shapeHasId ns ident element
336336 nm == ident
337337 | otherwise = False
338338
339−-- The content shape in slideLayout2 (Title/Content) has id=3 In
340−-- slideLayout4 (two column) the left column is id=3, and the right
341−-- column is id=4.
342339getContentShape :: PandocMonad m => NameSpaces -> Element -> P m Element
343340getContentShape ns spTreeElem
344341 | isElem ns "p" "spTree" spTreeElem = do
345342 contentType <- asks envContentType
346− let idx = case contentType of
347− NormalContent -> "1"
348− TwoColumnLeftContent -> "1"
349− TwoColumnRightContent -> "2"
350− case getShapeByPlaceHolderIndex ns spTreeElem idx of
351− Just e -> return e
352− Nothing -> throwError $
353− PandocSomeError $
354− "Could not find shape for Powerpoint content"
343+ let contentShapes = getShapesByPlaceHolderType ns spTreeElem ObjType
344+ case contentType of
345+ NormalContent | (sp : _) <- contentShapes -> return sp
346+ TwoColumnLeftContent | (sp : _) <- contentShapes -> return sp
347+ TwoColumnRightContent | (_ : sp : _) <- contentShapes -> return sp
348+ _ -> throwError $
349+ PandocSomeError $
350+ "Could not find shape for Powerpoint content"
355351getContentShape _ _ = throwError $
356352 PandocSomeError $
357353 "Attempted to find content on non shapeTree"
@@ -1006,11 +1002,15 @@ findPHType ns spElem phType
10061002 Nothing -> False
10071003findPHType _ _ _ = False
10081004
1009−getShapeByPlaceHolderType :: NameSpaces -> Element -> PHType -> Maybe Element
1010−getShapeByPlaceHolderType ns spTreeElem phType
1005+getShapesByPlaceHolderType :: NameSpaces -> Element -> PHType -> [Element]
1006+getShapesByPlaceHolderType ns spTreeElem phType
10111007 | isElem ns "p" "spTree" spTreeElem =
1012− filterChild (\e -> findPHType ns e phType) spTreeElem
1013− | otherwise = Nothing
1008+ filterChildren (\e -> findPHType ns e phType) spTreeElem
1009+ | otherwise = []
1010+
1011+getShapeByPlaceHolderType :: NameSpaces -> Element -> PHType -> Maybe Element
1012+getShapeByPlaceHolderType ns spTreeElem phType =
1013+ listToMaybe $ getShapesByPlaceHolderType ns spTreeElem phType
10141014
10151015-- Like the above, but it tries a number of different placeholder types
10161016getShapeByPlaceHolderTypes :: NameSpaces -> Element -> [PHType] -> Maybe Element
@@ -1020,20 +1020,6 @@ getShapeByPlaceHolderTypes ns spTreeElem (s:ss) =
10201020 Just element -> Just element
10211021 Nothing -> getShapeByPlaceHolderTypes ns spTreeElem ss
10221022
1023−getShapeByPlaceHolderIndex :: NameSpaces -> Element -> String -> Maybe Element
1024−getShapeByPlaceHolderIndex ns spTreeElem phIdx
1025− | isElem ns "p" "spTree" spTreeElem =
1026− let findPhType element = isElem ns "p" "sp" element &&
1027− Just phIdx == (Just element >>=
1028− findChild (elemName ns "p" "nvSpPr") >>=
1029− findChild (elemName ns "p" "nvPr") >>=
1030− findChild (elemName ns "p" "ph") >>=
1031− findAttr (QName "idx" Nothing Nothing))
1032− in
1033− filterChild findPhType spTreeElem
1034− | otherwise = Nothing
1035−
1036−
10371023nonBodyTextToElement :: PandocMonad m => Element -> [PHType] -> [ParaElem] -> P m Element
10381024nonBodyTextToElement layout phTypes paraElements
10391025 | ns <- elemToNameSpaces layout