include/oox/helper/attributelist.hxx | 3 - libreofficekit/qa/unit/tiledrendering.cxx | 6 ++ oox/source/helper/attributelist.cxx | 5 -- sw/qa/extras/README | 9 +--- sw/qa/extras/inc/swmodeltestbase.hxx | 23 ---------- sw/qa/extras/rtfimport/data/tdf91074.rtf | 7 +++ sw/qa/extras/rtfimport/rtfimport.cxx | 7 +++ sw/source/core/access/accselectionhelper.cxx | 54 ++++++++++++------------- sw/source/core/access/accselectionhelper.hxx | 2 writerfilter/source/rtftok/rtfdocumentimpl.cxx | 6 ++ writerfilter/source/rtftok/rtfsdrimport.cxx | 45 ++++++++++++-------- writerfilter/source/rtftok/rtfsdrimport.hxx | 2 12 files changed, 84 insertions(+), 85 deletions(-)
New commits: commit 598b05f053a75abca920cafa208af2950bdcd1f7 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon May 11 11:59:06 2015 +0200 CppunitTest_libreofficekit_tiledrendering: add postUnoCommand() testcase This fails without commit d4a12421f2b0aafe97f8ab78017261969c36ae0e (desktop: pJSON may be 0 in jsonToPropertyValues(), 2015-04-29). Change-Id: I08fffe65eb6cdc94fcfc57c2b8f1ec9fa546f70d diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx index 0d33097..63eb756 100644 --- a/libreofficekit/qa/unit/tiledrendering.cxx +++ b/libreofficekit/qa/unit/tiledrendering.cxx @@ -125,7 +125,11 @@ void TiledRenderingTest::testDocumentTypes( Office* pOffice ) // FIXME: same comment as below wrt lockfile removal. remove( sTextLockFile.c_str() ); - CPPUNIT_ASSERT( getDocumentType( pOffice, sTextDocPath ) == LOK_DOCTYPE_TEXT ); + std::unique_ptr<Document> pDocument(pOffice->documentLoad( sTextDocPath.c_str())); + CPPUNIT_ASSERT(pDocument.get()); + CPPUNIT_ASSERT_EQUAL(LOK_DOCTYPE_TEXT, static_cast<LibreOfficeKitDocumentType>(pDocument->getDocumentType())); + // This crashed. + pDocument->postUnoCommand(".uno:Bold"); const string sPresentationDocPath = m_sSrcRoot + "/libreofficekit/qa/data/blank_presentation.odp"; const string sPresentationLockFile = m_sSrcRoot +"/libreofficekit/qa/data/.~lock.blank_presentation.odp#"; commit 38cb71ceae37f51d37a3c7c56734f2678e733e76 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon May 11 11:19:13 2015 +0200 Unused oox::AttributeConversion::decodeUnsignedHex() Change-Id: I26d52d4ba49216dd9c3d402dbd5480865e5351e1 diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx index 0e5eb5e..edcf194 100644 --- a/include/oox/helper/attributelist.hxx +++ b/include/oox/helper/attributelist.hxx @@ -59,9 +59,6 @@ public: /** Returns the 32-bit signed integer value from the passed string (hexadecimal). */ static sal_Int32 decodeIntegerHex( const OUString& rValue ); - - /** Returns the 32-bit unsigned integer value from the passed string (hexadecimal). */ - static sal_uInt32 decodeUnsignedHex( const OUString& rValue ); }; diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index e2e5f9a..160e3a9 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -105,11 +105,6 @@ sal_Int32 AttributeConversion::decodeIntegerHex( const OUString& rValue ) // cast, but that will have a ripple effect } -sal_uInt32 AttributeConversion::decodeUnsignedHex( const OUString& rValue ) -{ - return rValue.toUInt32( 16 ); -} - AttributeList::AttributeList( const Reference< XFastAttributeList >& rxAttribs ) : mxAttribs( rxAttribs ), mpAttribList( NULL ) commit c4a7e5bd6db0d682d6f7888b5b1828a10a392fc1 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon May 11 11:04:23 2015 +0200 sw: prefix members of SwAccessibleSelectionHelper Using rCtxt vs rContext to refer to the local vs member variable is suboptimal. Change-Id: I160cb923e1467c5a1e34d84c6c5d9061f637e3bd diff --git a/sw/source/core/access/accselectionhelper.cxx b/sw/source/core/access/accselectionhelper.cxx index c0dfed1..3211f0b 100644 --- a/sw/source/core/access/accselectionhelper.cxx +++ b/sw/source/core/access/accselectionhelper.cxx @@ -44,8 +44,8 @@ using ::com::sun::star::accessibility::XAccessibleSelection; using namespace ::sw::access; SwAccessibleSelectionHelper::SwAccessibleSelectionHelper( - SwAccessibleContext& rCtxt ) : - rContext( rCtxt ) + SwAccessibleContext& rContext ) : + m_rContext( rContext ) { } @@ -55,8 +55,8 @@ SwAccessibleSelectionHelper::~SwAccessibleSelectionHelper() SwFEShell* SwAccessibleSelectionHelper::GetFEShell() { - OSL_ENSURE( rContext.GetMap() != NULL, "no map?" ); - SwViewShell* pViewShell = rContext.GetMap()->GetShell(); + OSL_ENSURE( m_rContext.GetMap() != NULL, "no map?" ); + SwViewShell* pViewShell = m_rContext.GetMap()->GetShell(); OSL_ENSURE( pViewShell != NULL, "No view shell? Then what are you looking at?" ); @@ -72,7 +72,7 @@ SwFEShell* SwAccessibleSelectionHelper::GetFEShell() void SwAccessibleSelectionHelper::throwIndexOutOfBoundsException() throw ( lang::IndexOutOfBoundsException ) { - Reference < XAccessibleContext > xThis( &rContext ); + Reference < XAccessibleContext > xThis( &m_rContext ); Reference < XAccessibleSelection >xSelThis( xThis, UNO_QUERY ); lang::IndexOutOfBoundsException aExcept( OUString( "index out of bounds" ), @@ -89,7 +89,7 @@ void SwAccessibleSelectionHelper::selectAccessibleChild( SolarMutexGuard aGuard; // Get the respective child as SwFrm (also do index checking), ... - const SwAccessibleChild aChild = rContext.GetChild( *(rContext.GetMap()), + const SwAccessibleChild aChild = m_rContext.GetChild( *(m_rContext.GetMap()), nChildIndex ); if( !aChild.IsValid() ) throwIndexOutOfBoundsException(); @@ -101,7 +101,7 @@ void SwAccessibleSelectionHelper::selectAccessibleChild( { const SdrObject *pObj = aChild.GetDrawObject(); if( pObj ) - rContext.Select( const_cast< SdrObject *>( pObj ), 0==aChild.GetSwFrm()); + m_rContext.Select( const_cast< SdrObject *>( pObj ), 0==aChild.GetSwFrm()); } // no frame shell, or no frame, or no fly frame -> can't select } @@ -149,7 +149,7 @@ bool SwAccessibleSelectionHelper::isAccessibleChildSelected( SolarMutexGuard aGuard; // Get the respective child as SwFrm (also do index checking), ... - const SwAccessibleChild aChild = rContext.GetChild( *(rContext.GetMap()), + const SwAccessibleChild aChild = m_rContext.GetChild( *(m_rContext.GetMap()), nChildIndex ); if( !aChild.IsValid() ) throwIndexOutOfBoundsException(); @@ -170,7 +170,7 @@ bool SwAccessibleSelectionHelper::isAccessibleChildSelected( //If the SwFrmOrObj is not selected directly in the UI, we should check whether it is selected in the selection cursor. if( !bRet ) { - if( lcl_getSelectedState( aChild, &rContext, rContext.GetMap() ) ) + if( lcl_getSelectedState( aChild, &m_rContext, m_rContext.GetMap() ) ) bRet = true; } } @@ -190,7 +190,7 @@ void SwAccessibleSelectionHelper::selectAllAccessibleChildren( ) if( pFEShell ) { ::std::list< SwAccessibleChild > aChildren; - rContext.GetChildren( *(rContext.GetMap()), aChildren ); + m_rContext.GetChildren( *(m_rContext.GetMap()), aChildren ); ::std::list< SwAccessibleChild >::const_iterator aIter = aChildren.begin(); ::std::list< SwAccessibleChild >::const_iterator aEndIter = aChildren.end(); @@ -201,7 +201,7 @@ void SwAccessibleSelectionHelper::selectAllAccessibleChildren( ) const SwFrm* pFrm = rChild.GetSwFrm(); if( pObj && !(pFrm != 0 && pFEShell->IsObjSelected()) ) { - rContext.Select( const_cast< SdrObject *>( pObj ), 0==pFrm ); + m_rContext.Select( const_cast< SdrObject *>( pObj ), 0==pFrm ); if( pFrm ) break; } @@ -232,7 +232,7 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( ) if( nSelObjs > 0 ) { ::std::list< SwAccessibleChild > aChildren; - rContext.GetChildren( *(rContext.GetMap()), aChildren ); + m_rContext.GetChildren( *(m_rContext.GetMap()), aChildren ); ::std::list< SwAccessibleChild >::const_iterator aIter = aChildren.begin(); @@ -242,8 +242,8 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( ) { const SwAccessibleChild& rChild = *aIter; if( rChild.GetDrawObject() && !rChild.GetSwFrm() && - SwAccessibleFrame::GetParent(rChild, rContext.IsInPagePreview()) - == rContext.GetFrm() && + SwAccessibleFrame::GetParent(rChild, m_rContext.IsInPagePreview()) + == m_rContext.GetFrm() && pFEShell->IsObjSelected( *rChild.GetDrawObject() ) ) { nCount++; @@ -257,7 +257,7 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( ) if( nCount == 0 ) { ::std::list< SwAccessibleChild > aChildren; - rContext.GetChildren( *(rContext.GetMap()), aChildren ); + m_rContext.GetChildren( *(m_rContext.GetMap()), aChildren ); ::std::list< SwAccessibleChild >::const_iterator aIter = aChildren.begin(); ::std::list< SwAccessibleChild >::const_iterator aEndIter = @@ -265,7 +265,7 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( ) while( aIter != aEndIter ) { const SwAccessibleChild& aChild = *aIter; - if( lcl_getSelectedState( aChild, &rContext, rContext.GetMap() ) ) + if( lcl_getSelectedState( aChild, &m_rContext, m_rContext.GetMap() ) ) nCount++; ++aIter; } @@ -295,7 +295,7 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild( { if( 0 == nSelectedChildIndex ) { - if(SwAccessibleFrame::GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) == rContext.GetFrm() ) + if(SwAccessibleFrame::GetParent( SwAccessibleChild(pFlyFrm), m_rContext.IsInPagePreview()) == m_rContext.GetFrm() ) { aChild = pFlyFrm; } @@ -307,7 +307,7 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild( const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor(); if( pAnchor.GetAnchorId() == FLY_AS_CHAR ) { - const SwFrm *pParaFrm = SwAccessibleFrame::GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview() ); + const SwFrm *pParaFrm = SwAccessibleFrame::GetParent( SwAccessibleChild(pFlyFrm), m_rContext.IsInPagePreview() ); aChild = pParaFrm; } } @@ -321,7 +321,7 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild( throwIndexOutOfBoundsException(); ::std::list< SwAccessibleChild > aChildren; - rContext.GetChildren( *(rContext.GetMap()), aChildren ); + m_rContext.GetChildren( *(m_rContext.GetMap()), aChildren ); ::std::list< SwAccessibleChild >::const_iterator aIter = aChildren.begin(); ::std::list< SwAccessibleChild >::const_iterator aEndIter = aChildren.end(); @@ -329,8 +329,8 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild( { const SwAccessibleChild& rChild = *aIter; if( rChild.GetDrawObject() && !rChild.GetSwFrm() && - SwAccessibleFrame::GetParent(rChild, rContext.IsInPagePreview()) == - rContext.GetFrm() && + SwAccessibleFrame::GetParent(rChild, m_rContext.IsInPagePreview()) == + m_rContext.GetFrm() && pFEShell->IsObjSelected( *rChild.GetDrawObject() ) ) { if( 0 == nSelectedChildIndex ) @@ -345,24 +345,24 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild( if( !aChild.IsValid() ) throwIndexOutOfBoundsException(); - OSL_ENSURE( rContext.GetMap() != NULL, "We need the map." ); + OSL_ENSURE( m_rContext.GetMap() != NULL, "We need the map." ); Reference< XAccessible > xChild; if( aChild.GetSwFrm() ) { ::rtl::Reference < SwAccessibleContext > xChildImpl( - rContext.GetMap()->GetContextImpl( aChild.GetSwFrm(), + m_rContext.GetMap()->GetContextImpl( aChild.GetSwFrm(), true ) ); if( xChildImpl.is() ) { - xChildImpl->SetParent( &rContext ); + xChildImpl->SetParent( &m_rContext ); xChild = xChildImpl.get(); } } else if ( aChild.GetDrawObject() ) { ::rtl::Reference < ::accessibility::AccessibleShape > xChildImpl( - rContext.GetMap()->GetContextImpl( aChild.GetDrawObject(), - &rContext, true ) ); + m_rContext.GetMap()->GetContextImpl( aChild.GetDrawObject(), + &m_rContext, true ) ); if( xChildImpl.is() ) xChild = xChildImpl.get(); } @@ -378,7 +378,7 @@ void SwAccessibleSelectionHelper::deselectAccessibleChild( SolarMutexGuard g; if( nChildIndex < 0 || - nChildIndex >= rContext.GetChildCount( *(rContext.GetMap()) ) ) + nChildIndex >= m_rContext.GetChildCount( *(m_rContext.GetMap()) ) ) throwIndexOutOfBoundsException(); } diff --git a/sw/source/core/access/accselectionhelper.hxx b/sw/source/core/access/accselectionhelper.hxx index 48baaf5..5c189ff 100644 --- a/sw/source/core/access/accselectionhelper.hxx +++ b/sw/source/core/access/accselectionhelper.hxx @@ -28,7 +28,7 @@ class SwFEShell; class SwAccessibleSelectionHelper { /// the context on which this helper works - SwAccessibleContext& rContext; + SwAccessibleContext& m_rContext; /// get FE-Shell SwFEShell* GetFEShell(); commit 7007908df7681c75c1f13d8422c2bac56d952227 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon May 11 10:30:26 2015 +0200 sw/qa/extras doc: advertise CPPUNIT_TEST_NAME And get rid of the no longer needed hack. Change-Id: I275cbf212a6e6d3d28d136be9736dd1ac03a66ef diff --git a/sw/qa/extras/README b/sw/qa/extras/README index 1959f68..74d84da 100644 --- a/sw/qa/extras/README +++ b/sw/qa/extras/README @@ -140,12 +140,11 @@ actual value to `bool` as well before comparing. === Running only a single test If you want to run only a single test to allow quick development iteration, -then you need to do two things: +then use `CPPUNIT_TEST_NAME` to specify the name of the single test: -- change the `#if 1` in `inc/swmodeltestbase.hxx` to `#if 0` to define the test - macro with the `_ONLY` suffix -- change the used macro for the test you want to run, i.e. - `DECLARE_OOXMLEXPORT_TEST` -> `DECLARE_OOXMLEXPORT_TEST_ONLY` +---- +CPPUNIT_TEST_NAME="testTdf91074" make -sr CppunitTest_sw_rtfimport +---- == UNO, in more details, various tips: diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index f0d3428..fd94726 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -85,7 +85,6 @@ using namespace css; CPPUNIT_TEST_SUITE_REGISTRATION(TestName); \ void TestName::verify() -#if 1 #define DECLARE_OOXMLIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test) #define DECLARE_OOXMLEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test) #define DECLARE_RTFIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test) @@ -94,28 +93,6 @@ using namespace css; #define DECLARE_ODFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test) #define DECLARE_WW8EXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test) -// For testing during development of a test, you want to use -// DECLARE_OOXMLEXPORT_TEST_ONLY, and change the above to #if 0 -// Of course, don't forget to set back to #if 1 when you are done :-) -#else -#define DECLARE_OOXMLIMPORT_TEST_ONLY(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test) -#define DECLARE_OOXMLEXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test) -#define DECLARE_RTFIMPORT_TEST_ONLY(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test) -#define DECLARE_RTFEXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test) -#define DECLARE_ODFIMPORT_TEST_ONLY(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test) -#define DECLARE_ODFEXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test) -#define DECLARE_WW8EXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test) - -#undef DECLARE_OOXMLEXPORT_TEST -#define DECLARE_OOXMLIMPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled() -#define DECLARE_OOXMLEXPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled() -#define DECLARE_RTFIMPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled() -#define DECLARE_RTFEXPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled() -#define DECLARE_ODFIMPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled() -#define DECLARE_ODFEXPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled() -#define DECLARE_WW8EXPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled() -#endif - #define DECLARE_SW_IMPORT_TEST(TestName, filename, BaseClass) \ class TestName : public BaseClass { \ protected:\ commit ec1a96e79e3e6225706151cb72eb3df763b0598d Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon May 11 09:05:12 2015 +0200 tdf#91074 RTF import: handle \dplineco* for text frames RTFSdrImport::resolve() already had the logic to use the relevant API depending on if the shape is a text frame or not -- extract that to a separate member function and use it from RTFDocumentImpl::popState(), too. Change-Id: I663b372244f09f002447ece62587143b2a575795 diff --git a/sw/qa/extras/rtfimport/data/tdf91074.rtf b/sw/qa/extras/rtfimport/data/tdf91074.rtf new file mode 100644 index 0000000..ff3fe9b --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf91074.rtf @@ -0,0 +1,7 @@ +{\rtf1\ansi\ansicpg1252\deff0\deftab720 +{\*\do\dobxpage\dobypage\dodhgt8192\dptxbx +{\dptxbxtext\pard\plain +inner\par } +\dpx674\dpy725\dpxsize1875\dpysize1020\dplinecor255\dplinecog0\dplinecob0\dplinew40\dpfillfgcr0\dpfillfgcg0\dpfillfgcb0\dpfillbgcr0\dpfillbgcg0\dpfillbgcb0\dpfillpat0} +\par +outer\par} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 13c9d34..adbd74f 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2263,6 +2263,13 @@ DECLARE_RTFIMPORT_TEST(testWrapDistance, "wrap-distance.rtf") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), getProperty<sal_Int32>(xShape, "RightMargin") / 1000); } +DECLARE_RTFIMPORT_TEST(testTdf91074, "tdf91074.rtf") +{ + // The file failed to load, as the border color was imported using the LineColor UNO property. + uno::Reference<drawing::XShape> xShape = getShape(1); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_LIGHTRED), getProperty<table::BorderLine2>(xShape, "TopBorder").Color); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 2077d5d..72fc1fc 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -5480,7 +5480,11 @@ RTFError RTFDocumentImpl::popState() xShape->setSize(awt::Size(rDrawing.nRight, rDrawing.nBottom)); if (rDrawing.bHasLineColor) - xPropertySet->setPropertyValue("LineColor", uno::makeAny(sal_uInt32((rDrawing.nLineColorR<<16) + (rDrawing.nLineColorG<<8) + rDrawing.nLineColorB))); + { + uno::Any aLineColor = uno::makeAny(sal_uInt32((rDrawing.nLineColorR<<16) + (rDrawing.nLineColorG<<8) + rDrawing.nLineColorB)); + uno::Any aLineWidth; + RTFSdrImport::resolveLineColorAndWidth(bTextFrame, xPropertySet, aLineColor, aLineWidth); + } if (rDrawing.bHasFillColor) xPropertySet->setPropertyValue("FillColor", uno::makeAny(sal_uInt32((rDrawing.nFillColorR<<16) + (rDrawing.nFillColorG<<8) + rDrawing.nFillColorB))); else if (!bTextFrame) diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 400a26b..fcc20d4 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -125,6 +125,31 @@ void RTFSdrImport::resolveDhgt(uno::Reference<beans::XPropertySet> const& xPrope m_aGraphicZOrderHelper.addItem(xPropertySet, nZOrder); } +void RTFSdrImport::resolveLineColorAndWidth(bool bTextFrame, const uno::Reference<beans::XPropertySet>& xPropertySet, uno::Any& rLineColor, uno::Any& rLineWidth) +{ + if (!bTextFrame) + { + xPropertySet->setPropertyValue("LineColor", rLineColor); + xPropertySet->setPropertyValue("LineWidth", rLineWidth); + } + else + { + static const char* aBorders[] = + { + "TopBorder", "LeftBorder", "BottomBorder", "RightBorder" + }; + for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i) + { + table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(OUString::createFromAscii(aBorders[i])).get<table::BorderLine2>(); + if (rLineColor.hasValue()) + aBorderLine.Color = rLineColor.get<sal_Int32>(); + if (rLineWidth.hasValue()) + aBorderLine.LineWidth = rLineWidth.get<sal_Int32>(); + xPropertySet->setPropertyValue(OUString::createFromAscii(aBorders[i]), uno::makeAny(aBorderLine)); + } + } +} + void RTFSdrImport::resolveFLine(uno::Reference<beans::XPropertySet> const& xPropertySet, sal_Int32 const nFLine) { @@ -759,25 +784,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap if (xPropertySet.is()) { - if (!m_bTextFrame) - { - xPropertySet->setPropertyValue("LineColor", aLineColor); - xPropertySet->setPropertyValue("LineWidth", aLineWidth); - } - else - { - static const char* aBorders[] = - { - "TopBorder", "LeftBorder", "BottomBorder", "RightBorder" - }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i) - { - table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(OUString::createFromAscii(aBorders[i])).get<table::BorderLine2>(); - aBorderLine.Color = aLineColor.get<sal_Int32>(); - aBorderLine.LineWidth = aLineWidth.get<sal_Int32>(); - xPropertySet->setPropertyValue(OUString::createFromAscii(aBorders[i]), uno::makeAny(aBorderLine)); - } - } + resolveLineColorAndWidth(m_bTextFrame, xPropertySet, aLineColor, aLineWidth); if (rShape.oZ) resolveDhgt(xPropertySet, *rShape.oZ, /*bOldStyle=*/false); if (m_bTextFrame) diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx index 9605853..afbbe42 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.hxx +++ b/writerfilter/source/rtftok/rtfsdrimport.hxx @@ -35,6 +35,8 @@ public: /// Append property on the current parent. void appendGroupProperty(const OUString& aKey, const OUString& aValue); void resolveDhgt(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, sal_Int32 nZOrder, bool bOldStyle); + /// Set line color and line width on the shape, using the relevant API depending on if the shape is a text frame or not. + static void resolveLineColorAndWidth(bool bTextFrame, const css::uno::Reference<css::beans::XPropertySet>& xPropertySet, css::uno::Any& rLineColor, css::uno::Any& rLineWidth); static void resolveFLine(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, sal_Int32 nFLine); /** * These are the default in Word, but not in Writer. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits