summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2017-08-24 14:29:00 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-08-29 13:37:52 +0200
commit8b04a3245190844b07916481d73ed6d182593ed8 (patch)
treec7ab7ea18708fe686a468ff640974b1972b2068e
parentb5d67cdd697c1b094b7e0622a2f4a06c3499f3d0 (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. Reviewed-on: https://gerrit.libreoffice.org/41517 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit b766cab621690a3aaf4e10fcf925ebab1c1925b8) Change-Id: Iae185ac7e5d2505554692045516cc51dbdcd735b Reviewed-on: https://gerrit.libreoffice.org/41529 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-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.cxx323
3 files changed, 179 insertions, 163 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 42f35b845a88..cf7fd53f731c 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -164,6 +164,7 @@ public:
void testTdf108925();
void testTdf109223();
void testActiveXCheckbox();
+ void testTdf108926();
bool checkPattern(sd::DrawDocShellRef& rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
void testPatternImport();
@@ -235,6 +236,7 @@ public:
CPPUNIT_TEST(testTdf108925);
CPPUNIT_TEST(testTdf109223);
CPPUNIT_TEST(testActiveXCheckbox);
+ CPPUNIT_TEST(testTdf108926);
CPPUNIT_TEST_SUITE_END();
};
@@ -2287,6 +2289,23 @@ void SdImportTest::testActiveXCheckbox()
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 be701d617712..3b18699b2e9c 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2355,214 +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, (SdrPowerPointImport&)*this, pTextObj->GetDestinationInstance());
- }
+ pPor->ApplyTo(aSet, (SdrPowerPointImport&)*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;
}
}
}