Kaydet (Commit) 53c376d3 authored tarafından Zolnai Tamás's avatar Zolnai Tamás

bnc#870237: wrong text position in grouped list

In grouped list text area does not cover the whole
shape but just a part of it at the top.
To get the same visual effect modify text distance
attribute.

Change-Id: I32f30d0afbc1975f940c4562ec65f46596e97060
üst 2b6f2bee
...@@ -37,8 +37,10 @@ struct TextBodyProperties ...@@ -37,8 +37,10 @@ struct TextBodyProperties
bool mbAnchorCtr; bool mbAnchorCtr;
OptValue< sal_Int32 > moVert; OptValue< sal_Int32 > moVert;
boost::optional< sal_Int32 > moInsets[4]; boost::optional< sal_Int32 > moInsets[4];
boost::optional< sal_Int32 > moTextOffX; boost::optional< sal_Int32 > moTextOffUpper;
boost::optional< sal_Int32 > moTextOffY; boost::optional< sal_Int32 > moTextOffLeft;
boost::optional< sal_Int32 > moTextOffLower;
boost::optional< sal_Int32 > moTextOffRight;
::com::sun::star::drawing::TextVerticalAdjust meVA; ::com::sun::star::drawing::TextVerticalAdjust meVA;
explicit TextBodyProperties(); explicit TextBodyProperties();
......
...@@ -81,8 +81,10 @@ void TextBodyProperties::pushRotationAdjustments( sal_Int32 nRotation ) ...@@ -81,8 +81,10 @@ void TextBodyProperties::pushRotationAdjustments( sal_Int32 nRotation )
// Hack for n#760986 // Hack for n#760986
// TODO: Preferred method would be to have a textbox on top // TODO: Preferred method would be to have a textbox on top
// of the shape and the place it according to the (off,ext) // of the shape and the place it according to the (off,ext)
if( nOff == 0 && moTextOffX && mbAnchorCtr ) nVal = *moTextOffX; if( nOff == 0 && moTextOffLeft && mbAnchorCtr ) nVal = *moTextOffLeft;
if( nOff == 1 && moTextOffY && mbAnchorCtr ) nVal = *moTextOffY; if( nOff == 1 && moTextOffUpper ) nVal = *moTextOffLeft;
if( nOff == 2 && moTextOffRight && mbAnchorCtr ) nVal = *moTextOffRight;
if( nOff == 3 && moTextOffLower ) nVal = *moTextOffLower;
if( nVal < 0 ) nVal = 0; if( nVal < 0 ) nVal = 0;
if( moInsets[i] ) if( moInsets[i] )
......
...@@ -62,12 +62,29 @@ ContextHandlerRef Transform2DContext::onCreateContext( sal_Int32 aElementToken, ...@@ -62,12 +62,29 @@ ContextHandlerRef Transform2DContext::onCreateContext( sal_Int32 aElementToken,
OUString sXValue = rAttribs.getString( XML_x ).get(); OUString sXValue = rAttribs.getString( XML_x ).get();
OUString sYValue = rAttribs.getString( XML_y ).get(); OUString sYValue = rAttribs.getString( XML_y ).get();
if( !sXValue.isEmpty() ) if( !sXValue.isEmpty() )
mrShape.getTextBody()->getTextProperties().moTextOffX = GetCoordinate( sXValue.toInt32() - mrShape.getPosition().X ); mrShape.getTextBody()->getTextProperties().moTextOffUpper = GetCoordinate( sXValue.toInt32() - mrShape.getPosition().X );
if( !sYValue.isEmpty() ) if( !sYValue.isEmpty() )
mrShape.getTextBody()->getTextProperties().moTextOffY = GetCoordinate( sYValue.toInt32() - mrShape.getPosition().Y ); mrShape.getTextBody()->getTextProperties().moTextOffLeft = GetCoordinate( sYValue.toInt32() - mrShape.getPosition().Y );
} }
break; break;
case A_TOKEN( ext ): case A_TOKEN( ext ):
{
const OUString sXValue = rAttribs.getString( XML_cx ).get();
const OUString sYValue = rAttribs.getString( XML_cy ).get();
if( !sXValue.isEmpty() )
{
mrShape.getTextBody()->getTextProperties().moTextOffRight = GetCoordinate(mrShape.getSize().Width - sXValue.toInt32());
if( mrShape.getTextBody()->getTextProperties().moTextOffLeft )
*mrShape.getTextBody()->getTextProperties().moTextOffRight -= *mrShape.getTextBody()->getTextProperties().moTextOffLeft;
}
if( !sYValue.isEmpty() )
{
mrShape.getTextBody()->getTextProperties().moTextOffLower = GetCoordinate(mrShape.getSize().Height - sYValue.toInt32());
if( mrShape.getTextBody()->getTextProperties().moTextOffUpper )
*mrShape.getTextBody()->getTextProperties().moTextOffLower -= *mrShape.getTextBody()->getTextProperties().moTextOffUpper;
}
}
break; break;
} }
return 0; return 0;
......
...@@ -73,6 +73,7 @@ public: ...@@ -73,6 +73,7 @@ public:
void testN862510_4(); void testN862510_4();
void testFdo71961(); void testFdo71961();
void testMediaEmbedding(); void testMediaEmbedding();
void testBnc870237();
CPPUNIT_TEST_SUITE(SdFiltersTest); CPPUNIT_TEST_SUITE(SdFiltersTest);
CPPUNIT_TEST(testDocumentLayout); CPPUNIT_TEST(testDocumentLayout);
...@@ -97,6 +98,7 @@ public: ...@@ -97,6 +98,7 @@ public:
CPPUNIT_TEST(testN862510_4); CPPUNIT_TEST(testN862510_4);
CPPUNIT_TEST(testFdo71961); CPPUNIT_TEST(testFdo71961);
CPPUNIT_TEST(testMediaEmbedding); CPPUNIT_TEST(testMediaEmbedding);
CPPUNIT_TEST(testBnc870237);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
}; };
...@@ -738,6 +740,26 @@ void SdFiltersTest::testMediaEmbedding() ...@@ -738,6 +740,26 @@ void SdFiltersTest::testMediaEmbedding()
CPPUNIT_ASSERT_EQUAL( OUString( "application/vnd.sun.star.media" ), pMediaObj->getMediaProperties().getMimeType()); CPPUNIT_ASSERT_EQUAL( OUString( "application/vnd.sun.star.media" ), pMediaObj->getMediaProperties().getMimeType());
} }
void SdFiltersTest::testBnc870237()
{
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870237.pptx"));
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
const SdrPage *pPage = pDoc->GetPage (1);
CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
// Simulate a:ext inside dsp:txXfrm with changing the lower distance
const SdrObjGroup* pObj = dynamic_cast<SdrObjGroup*>( pPage->GetObj( 1 ) );
CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrTextUpperDistItem& >(pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST))).GetValue());
CPPUNIT_ASSERT_EQUAL( sal_Int32(9919), (static_cast< const SdrTextLowerDistItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST))).GetValue());
CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrTextRightDistItem& >(pObj->GetMergedItem(SDRATTR_TEXT_RIGHTDIST))).GetValue());
CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrTextLeftDistItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LEFTDIST))).GetValue());
xDocShRef->DoClose();
}
CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest); CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment