RTF import: fix groupshape import when shapes don't contain text
Without this, the groupshape itself was created, not it had no child shapes. Change-Id: I5d3276498eb3ffe840f3d42dad16661849596da4
This commit is contained in:
parent
af1ce3de97
commit
e849f5d84a
71
sw/qa/extras/rtfimport/data/groupshape-notext.rtf
Normal file
71
sw/qa/extras/rtfimport/data/groupshape-notext.rtf
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0
|
||||||
|
{\shpgrp
|
||||||
|
{\*\shpinst\shpleft1058\shptop353\shpright3443\shpbottom1148\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026
|
||||||
|
{\sp
|
||||||
|
{\sn groupLeft}
|
||||||
|
{\sv 2475}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn groupTop}
|
||||||
|
{\sv 1770}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn groupRight}
|
||||||
|
{\sv 4860}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn groupBottom}
|
||||||
|
{\sv 2565}
|
||||||
|
}
|
||||||
|
{\shp
|
||||||
|
{\*\shpinst\shplid1027
|
||||||
|
{\sp
|
||||||
|
{\sn relLeft}
|
||||||
|
{\sv 2475}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn relTop}
|
||||||
|
{\sv 1770}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn relRight}
|
||||||
|
{\sv 3285}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn relBottom}
|
||||||
|
{\sv 2565}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn shapeType}
|
||||||
|
{\sv 2}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{\shp
|
||||||
|
{\*\shpinst\shplid1028
|
||||||
|
{\sp
|
||||||
|
{\sn relLeft}
|
||||||
|
{\sv 3900}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn relTop}
|
||||||
|
{\sv 1770}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn relRight}
|
||||||
|
{\sv 4860}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn relBottom}
|
||||||
|
{\sv 2565}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn shapeType}
|
||||||
|
{\sv 5}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\par
|
||||||
|
}
|
@ -294,6 +294,7 @@ void Test::run()
|
|||||||
{"fdo47802.rtf", &Test::testFdo47802},
|
{"fdo47802.rtf", &Test::testFdo47802},
|
||||||
{"fdo39001.rtf", &Test::testFdo39001},
|
{"fdo39001.rtf", &Test::testFdo39001},
|
||||||
{"groupshape.rtf", &Test::testGroupshape},
|
{"groupshape.rtf", &Test::testGroupshape},
|
||||||
|
{"groupshape-notext.rtf", &Test::testGroupshape},
|
||||||
{"fdo66565.rtf", &Test::testFdo66565},
|
{"fdo66565.rtf", &Test::testFdo66565},
|
||||||
{"fdo54900.rtf", &Test::testFdo54900},
|
{"fdo54900.rtf", &Test::testFdo54900},
|
||||||
{"fdo64637.rtf", &Test::testFdo64637},
|
{"fdo64637.rtf", &Test::testFdo64637},
|
||||||
|
@ -1327,6 +1327,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
|
|||||||
case RTF_SHP:
|
case RTF_SHP:
|
||||||
m_bNeedCrOrig = m_bNeedCr;
|
m_bNeedCrOrig = m_bNeedCr;
|
||||||
m_aStates.top().nDestinationState = DESTINATION_SHAPE;
|
m_aStates.top().nDestinationState = DESTINATION_SHAPE;
|
||||||
|
m_aStates.top().bInShape = true;
|
||||||
break;
|
break;
|
||||||
case RTF_SHPINST:
|
case RTF_SHPINST:
|
||||||
m_aStates.top().nDestinationState = DESTINATION_SHAPEINSTRUCTION;
|
m_aStates.top().nDestinationState = DESTINATION_SHAPEINSTRUCTION;
|
||||||
@ -3930,7 +3931,8 @@ int RTFDocumentImpl::popState()
|
|||||||
break;
|
break;
|
||||||
case DESTINATION_PICPROP:
|
case DESTINATION_PICPROP:
|
||||||
case DESTINATION_SHAPEINSTRUCTION:
|
case DESTINATION_SHAPEINSTRUCTION:
|
||||||
if (!m_bObject && !aState.bInListpicture && !m_aStates.top().bHadShapeText && !m_aStates.top().bInShapeGroup)
|
// Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself.
|
||||||
|
if (!m_bObject && !aState.bInListpicture && !aState.bHadShapeText && !(aState.bInShapeGroup && !aState.bInShape))
|
||||||
m_pSdrImport->resolve(m_aStates.top().aShape, true);
|
m_pSdrImport->resolve(m_aStates.top().aShape, true);
|
||||||
break;
|
break;
|
||||||
case DESTINATION_BOOKMARKSTART:
|
case DESTINATION_BOOKMARKSTART:
|
||||||
@ -4808,6 +4810,7 @@ RTFParserState::RTFParserState(RTFDocumentImpl *pDocumentImpl)
|
|||||||
bInBackground(false),
|
bInBackground(false),
|
||||||
bHadShapeText(false),
|
bHadShapeText(false),
|
||||||
bInShapeGroup(false),
|
bInShapeGroup(false),
|
||||||
|
bInShape(false),
|
||||||
bCreatedShapeGroup(false),
|
bCreatedShapeGroup(false),
|
||||||
bStartedTrackchange(false)
|
bStartedTrackchange(false)
|
||||||
{
|
{
|
||||||
|
@ -263,6 +263,7 @@ namespace writerfilter {
|
|||||||
|
|
||||||
bool bHadShapeText;
|
bool bHadShapeText;
|
||||||
bool bInShapeGroup; ///< If we're inside a \shpgrp group.
|
bool bInShapeGroup; ///< If we're inside a \shpgrp group.
|
||||||
|
bool bInShape; ///< If we're inside a \shp group.
|
||||||
bool bCreatedShapeGroup; ///< A GroupShape was created and pushed to the parent stack.
|
bool bCreatedShapeGroup; ///< A GroupShape was created and pushed to the parent stack.
|
||||||
bool bStartedTrackchange; ///< Track change is started, need to end it before popping.
|
bool bStartedTrackchange; ///< Track change is started, need to end it before popping.
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user