summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2017-08-24 14:29:00 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2017-08-24 16:04:53 +0200
commitb766cab621690a3aaf4e10fcf925ebab1c1925b8 (patch)
tree37baa80815d5b792fa8697f5696daaf141cb94d7
parent04e719efbdb551d7c72fd0cc690f76c96bb66960 (diff)
tdf#108926: Notes placeholder text boxes not shown in PPTs
Regression from: acb2943c8125f4ceed74f35f31776929dedeb8d8 Call this placeholder related code not only for normal slide pages. Change-Id: Iae185ac7e5d2505554692045516cc51dbdcd735b Reviewed-on: https://gerrit.libreoffice.org/41517 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rwxr-xr-xsd/qa/unit/data/pptx/tdf108926.pptbin0 -> 164864 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx19
-rw-r--r--sd/source/filter/ppt/pptin.cxx324
3 files changed, 179 insertions, 164 deletions
diff --git a/sd/qa/unit/data/pptx/tdf108926.ppt b/sd/qa/unit/data/pptx/tdf108926.ppt
new file mode 100755
index 000000000000..c8455e226e1b
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf108926.ppt
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 7546689852a5..f9177c6493d3 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -171,6 +171,7 @@ public:
void testSmartArtRotation();
void testTdf109223();
void testTdf109187();
+ void testTdf108926();
bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
void testPatternImport();
@@ -250,6 +251,7 @@ public:
CPPUNIT_TEST(testSmartArtRotation);
CPPUNIT_TEST(testTdf109223);
CPPUNIT_TEST(testTdf109187);
+ CPPUNIT_TEST(testTdf108926);
CPPUNIT_TEST_SUITE_END();
};
@@ -2431,6 +2433,23 @@ void SdImportTest::testTdf109187()
xDocShRef->DoClose();
}
+void SdImportTest::testTdf108926()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf108926.ppt"), PPT);
+ uno::Reference< presentation::XPresentationPage > xPage (getPage(0, xDocShRef), uno::UNO_QUERY_THROW);
+ uno::Reference< drawing::XDrawPage > xNotesPage (xPage->getNotesPage(), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xNotesPage->getCount());
+
+ // Second object should be imported as an empty presentation shape
+ uno::Reference< beans::XPropertySet > xPresentationShape(xNotesPage->getByIndex(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xPresentationShape.is());
+ bool bIsEmptyPresObject = false;
+ xPresentationShape->getPropertyValue( "IsEmptyPresentationObject" ) >>= bIsEmptyPresObject;
+ CPPUNIT_ASSERT(bIsEmptyPresObject);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 7bec40a94c6c..ce06ae52a268 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2355,215 +2355,211 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
{
sal_uInt32 nPlacementId = pPlaceHolder->nPlacementId;
PptPlaceholder nPlaceholderId = pPlaceHolder->nPlaceholderId;
-
- if ( eAktPageKind == PPT_SLIDEPAGE )
+ PresObjKind ePresObjKind = PRESOBJ_NONE;
+ bool bEmptyPresObj = true;
+ bool bVertical = false;
+ if ( ( pTextObj->GetShapeType() == mso_sptRectangle ) || ( pTextObj->GetShapeType() == mso_sptTextBox ) )
{
- PresObjKind ePresObjKind = PRESOBJ_NONE;
- bool bEmptyPresObj = true;
- bool bVertical = false;
- if ( ( pTextObj->GetShapeType() == mso_sptRectangle ) || ( pTextObj->GetShapeType() == mso_sptTextBox ) )
+ //if a placeholder with some custom attribute,the pTextObj will keep those attr,whose text size is zero,
+ //so sdPage should renew a PresObj to process placeholder.
+ bEmptyPresObj = ( pTextObj->Count() == 0 ) || ( pTextObj->Count() == 1 && pTextObj->First()->GetTextSize() == 0 );
+ switch ( nPlaceholderId )
{
- //if a placeholder with some custom attribute,the pTextObj will keep those attr,whose text size is zero,
- //so sdPage should renew a PresObj to process placeholder.
- bEmptyPresObj = ( pTextObj->Count() == 0 ) || ( pTextObj->Count() == 1 && pTextObj->First()->GetTextSize() == 0 );
- switch ( nPlaceholderId )
+ case PptPlaceholder::NOTESBODY : ePresObjKind = PRESOBJ_NOTES; break;
+ case PptPlaceholder::VERTICALTEXTTITLE :
+ bVertical = true;
+ SAL_FALLTHROUGH;
+ case PptPlaceholder::TITLE : ePresObjKind = PRESOBJ_TITLE; break;
+ case PptPlaceholder::VERTICALTEXTBODY :
+ bVertical = true;
+ SAL_FALLTHROUGH;
+ case PptPlaceholder::BODY : ePresObjKind = PRESOBJ_OUTLINE; break;
+ case PptPlaceholder::CENTEREDTITLE : ePresObjKind = PRESOBJ_TITLE; break;
+ case PptPlaceholder::SUBTITLE : ePresObjKind = PRESOBJ_TEXT; break; // PRESOBJ_OUTLINE
+
+ default :
{
- case PptPlaceholder::NOTESBODY : ePresObjKind = PRESOBJ_NOTES; break;
- case PptPlaceholder::VERTICALTEXTTITLE :
- bVertical = true;
- SAL_FALLTHROUGH;
- case PptPlaceholder::TITLE : ePresObjKind = PRESOBJ_TITLE; break;
- case PptPlaceholder::VERTICALTEXTBODY :
- bVertical = true;
- SAL_FALLTHROUGH;
- case PptPlaceholder::BODY : ePresObjKind = PRESOBJ_OUTLINE; break;
- case PptPlaceholder::CENTEREDTITLE : ePresObjKind = PRESOBJ_TITLE; break;
- case PptPlaceholder::SUBTITLE : ePresObjKind = PRESOBJ_TEXT; break; // PRESOBJ_OUTLINE
-
- default :
+ if ( pTextObj->Count() == 0 )
{
- if ( pTextObj->Count() == 0 )
+ switch ( nPlaceholderId )
{
- switch ( nPlaceholderId )
- {
- case PptPlaceholder::MEDIACLIP :
- case PptPlaceholder::OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
- case PptPlaceholder::GRAPH : ePresObjKind = PRESOBJ_CHART; break;
- case PptPlaceholder::TABLE : ePresObjKind = PRESOBJ_TABLE; break;
- case PptPlaceholder::CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
- case PptPlaceholder::ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
- default: break;
- }
+ case PptPlaceholder::MEDIACLIP :
+ case PptPlaceholder::OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
+ case PptPlaceholder::GRAPH : ePresObjKind = PRESOBJ_CHART; break;
+ case PptPlaceholder::TABLE : ePresObjKind = PRESOBJ_TABLE; break;
+ case PptPlaceholder::CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
+ case PptPlaceholder::ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
+ default: break;
}
- };
- }
+ }
+ };
}
- else if ( pTextObj->GetShapeType() == mso_sptPictureFrame )
+ }
+ else if ( pTextObj->GetShapeType() == mso_sptPictureFrame )
+ {
+ if ( !pTextObj->Count() && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr )
{
- if ( !pTextObj->Count() && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr )
+ bEmptyPresObj = false;
+ switch ( nPlaceholderId )
{
- bEmptyPresObj = false;
- switch ( nPlaceholderId )
- {
- case PptPlaceholder::MEDIACLIP :
- case PptPlaceholder::OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
- case PptPlaceholder::GRAPH : ePresObjKind = PRESOBJ_CHART; break;
- case PptPlaceholder::TABLE : ePresObjKind = PRESOBJ_CALC; break;
- case PptPlaceholder::CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
- case PptPlaceholder::ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
- default: break;
- }
+ case PptPlaceholder::MEDIACLIP :
+ case PptPlaceholder::OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
+ case PptPlaceholder::GRAPH : ePresObjKind = PRESOBJ_CHART; break;
+ case PptPlaceholder::TABLE : ePresObjKind = PRESOBJ_CALC; break;
+ case PptPlaceholder::CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
+ case PptPlaceholder::ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
+ default: break;
}
}
- if ( ePresObjKind != PRESOBJ_NONE )
+ }
+ if ( ePresObjKind != PRESOBJ_NONE )
+ {
+ if ( !bEmptyPresObj )
{
- if ( !bEmptyPresObj )
- {
- pPage->InsertPresObj( pRet, ePresObjKind );
- }
- else
+ pPage->InsertPresObj( pRet, ePresObjKind );
+ }
+ else
+ {
+ SdrObject* pPresObj = pPage->CreatePresObj( ePresObjKind, bVertical, pText->GetLogicRect() );
+ pPresObj->SetUserCall( pPage );
+
+ SfxItemSet aSet( pSdrModel->GetItemPool() );
+ ApplyAttributes( rStCtrl, aSet );
+ pPresObj->SetLogicRect(pText->GetLogicRect());
+ ApplyTextAnchorAttributes( *pTextObj, aSet );
+ //set custom font attribute of the placeholder
+ if ( pTextObj->Count() == 1 )
{
- SdrObject* pPresObj = pPage->CreatePresObj( ePresObjKind, bVertical, pText->GetLogicRect() );
- pPresObj->SetUserCall( pPage );
-
- SfxItemSet aSet( pSdrModel->GetItemPool() );
- ApplyAttributes( rStCtrl, aSet );
- pPresObj->SetLogicRect(pText->GetLogicRect());
- ApplyTextAnchorAttributes( *pTextObj, aSet );
- //set custom font attribute of the placeholder
- if ( pTextObj->Count() == 1 )
+ PPTParagraphObj* pPara = pTextObj->First();
+ if ( pPara && pPara->GetTextSize() == 0 )
{
- PPTParagraphObj* pPara = pTextObj->First();
- if ( pPara && pPara->GetTextSize() == 0 )
+ if ( PPTPortionObj * pPor = pPara->First() )
{
- if ( PPTPortionObj * pPor = pPara->First() )
- {
- pPor->ApplyTo(aSet, const_cast<SdrPowerPointImport&>(static_cast<SdrPowerPointImport const &>(*this)), pTextObj->GetDestinationInstance());
- }
+ pPor->ApplyTo(aSet, const_cast<SdrPowerPointImport&>(static_cast<SdrPowerPointImport const &>(*this)), pTextObj->GetDestinationInstance());
}
}
- pPresObj->SetMergedItemSet(aSet);
+ }
+ pPresObj->SetMergedItemSet(aSet);
- if ((eAktPageKind != PPT_NOTEPAGE) && (nPlacementId != 0xffffffff) && pPage->TRG_HasMasterPage())
- {
- SdrObject* pTitleObj = static_cast<SdPage&>(pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_TITLE );
- SdrObject* pOutlineObj = static_cast<SdPage&>(pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_OUTLINE );
+ if ((eAktPageKind != PPT_NOTEPAGE) && (nPlacementId != 0xffffffff) && pPage->TRG_HasMasterPage())
+ {
+ SdrObject* pTitleObj = static_cast<SdPage&>(pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_TITLE );
+ SdrObject* pOutlineObj = static_cast<SdPage&>(pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_OUTLINE );
- ::tools::Rectangle aTitleRect;
- ::tools::Rectangle aOutlineRect;
- Size aOutlineSize;
+ ::tools::Rectangle aTitleRect;
+ ::tools::Rectangle aOutlineRect;
+ Size aOutlineSize;
- if ( pTitleObj )
- aTitleRect = pTitleObj->GetLogicRect();
- if ( pOutlineObj )
+ if ( pTitleObj )
+ aTitleRect = pTitleObj->GetLogicRect();
+ if ( pOutlineObj )
+ {
+ aOutlineRect = pOutlineObj->GetLogicRect();
+ aOutlineSize = aOutlineRect.GetSize();
+ }
+ ::tools::Rectangle aLogicRect( pPresObj->GetLogicRect() );
+ Size aLogicSize( aLogicRect.GetSize() );
+
+ switch ( nPlacementId )
+ {
+ case 0 : // position in title area
{
- aOutlineRect = pOutlineObj->GetLogicRect();
- aOutlineSize = aOutlineRect.GetSize();
+ if ( aLogicRect != aTitleRect )
+ pPresObj->SetUserCall( nullptr );
}
- ::tools::Rectangle aLogicRect( pPresObj->GetLogicRect() );
- Size aLogicSize( aLogicRect.GetSize() );
+ break;
- switch ( nPlacementId )
+ case 1:
{
- case 0 : // position in title area
- {
- if ( aLogicRect != aTitleRect )
+ if ( pSlideLayout->eLayout == PptSlideLayout::TITLEANDBODYSLIDE )
+ { // position in outline area
+ if ( aLogicRect != aOutlineRect )
pPresObj->SetUserCall( nullptr );
}
- break;
-
- case 1:
- {
- if ( pSlideLayout->eLayout == PptSlideLayout::TITLEANDBODYSLIDE )
- { // position in outline area
- if ( aLogicRect != aOutlineRect )
- pPresObj->SetUserCall( nullptr );
- }
- else if ( pSlideLayout->eLayout == PptSlideLayout::TWOCOLUMNSANDTITLE )
- { // position in outline area left
- if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
- std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
- std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
- (double)aLogicSize.Width() / aOutlineSize.Width() < 0.48 ||
- (double)aLogicSize.Width() / aOutlineSize.Width() > 0.5)
- {
- pPresObj->SetUserCall(nullptr);
- }
- }
- else if ( pSlideLayout->eLayout == PptSlideLayout::TWOROWSANDTITLE )
- { // position in outline area top
- if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
- std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
- std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
- {
- pPresObj->SetUserCall( nullptr );
- }
+ else if ( pSlideLayout->eLayout == PptSlideLayout::TWOCOLUMNSANDTITLE )
+ { // position in outline area left
+ if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
+ std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
+ std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
+ (double)aLogicSize.Width() / aOutlineSize.Width() < 0.48 ||
+ (double)aLogicSize.Width() / aOutlineSize.Width() > 0.5)
+ {
+ pPresObj->SetUserCall(nullptr);
}
- else if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
- std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE)
- { // position in outline area top left
+ }
+ else if ( pSlideLayout->eLayout == PptSlideLayout::TWOROWSANDTITLE )
+ { // position in outline area top
+ if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
+ std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
+ std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
+ {
pPresObj->SetUserCall( nullptr );
}
}
- break;
+ else if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
+ std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE)
+ { // position in outline area top left
+ pPresObj->SetUserCall( nullptr );
+ }
+ }
+ break;
- case 2:
- {
- if ( pSlideLayout->eLayout == PptSlideLayout::TWOCOLUMNSANDTITLE )
- { // position in outline area right
- if (std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
- std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
- std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
- (double)aLogicSize.Width() / aOutlineSize.Width() < 0.48 ||
- (double)aLogicSize.Width() / aOutlineSize.Width() > 0.5)
- {
- pPresObj->SetUserCall( nullptr );
- }
- }
- else if ( pSlideLayout->eLayout == PptSlideLayout::TWOROWSANDTITLE )
- { // position in outline area bottom
- if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
- std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
- std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
- {
- pPresObj->SetUserCall( nullptr );
- }
- }
- else if (std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
- std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE)
- { // position in outline area top right
- pPresObj->SetUserCall(nullptr);
+ case 2:
+ {
+ if ( pSlideLayout->eLayout == PptSlideLayout::TWOCOLUMNSANDTITLE )
+ { // position in outline area right
+ if (std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
+ std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
+ std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
+ (double)aLogicSize.Width() / aOutlineSize.Width() < 0.48 ||
+ (double)aLogicSize.Width() / aOutlineSize.Width() > 0.5)
+ {
+ pPresObj->SetUserCall( nullptr );
}
}
- break;
-
- case 3:
- { // position in outline area bottom left
+ else if ( pSlideLayout->eLayout == PptSlideLayout::TWOROWSANDTITLE )
+ { // position in outline area bottom
if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
- std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
+ std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
+ std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
{
pPresObj->SetUserCall( nullptr );
}
}
- break;
+ else if (std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
+ std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE)
+ { // position in outline area top right
+ pPresObj->SetUserCall(nullptr);
+ }
+ }
+ break;
- case 4:
- { // position in outline area bottom right
- if (std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
- std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
- {
- pObj->SetUserCall( nullptr );
- }
+ case 3:
+ { // position in outline area bottom left
+ if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
+ std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
+ {
+ pPresObj->SetUserCall( nullptr );
+ }
+ }
+ break;
+
+ case 4:
+ { // position in outline area bottom right
+ if (std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
+ std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
+ {
+ pObj->SetUserCall( nullptr );
}
- break;
}
+ break;
}
- pRet = nullptr; // return zero cause this obj was already inserted by CreatePresObj
}
+ pRet = nullptr; // return zero cause this obj was already inserted by CreatePresObj
}
- else if ( !pTextObj->Count() )
- pRet = nullptr;
}
+ else if ( !pTextObj->Count() )
+ pRet = nullptr;
}
}
}