[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - comphelper/inc comphelper/source editeng/inc editeng/source oox/source sw/inc sw/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Fri Feb 24 03:10:23 PST 2012


 comphelper/inc/comphelper/TypeGeneration.hxx  |    1 
 comphelper/source/property/TypeGeneration.cxx |    2 +
 editeng/inc/editeng/memberids.hrc             |    2 +
 editeng/source/items/frmitems.cxx             |   48 ++++++++++++++++++++++++++
 oox/source/vml/vmldrawing.cxx                 |   26 +++++++++++---
 sw/inc/unoprnms.hxx                           |    6 ++-
 sw/source/core/unocore/unoframe.cxx           |   11 +++++
 sw/source/core/unocore/unomap.cxx             |    4 +-
 sw/source/core/unocore/unoprnms.cxx           |    3 +
 9 files changed, 96 insertions(+), 7 deletions(-)

New commits:
commit e80d2ea82edf686bf92a6988c1a194a5fc5649d0
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Thu Feb 23 13:52:17 2012 +0100

    fdo#45560: Fixed docx textbox borders style and width import
    
    (cherry picked from commits e3e7623bf6cecf0e32912347a58e5a2c7297099d,
    2c7a532b7e2b8cf41792292610df96755b131987 and
    fda2c3639de6b673faf2ccd84b6d4318e592fbf0)
    
    Signed-off-by: Miklos Vajna <vmiklos at suse.cz>
    
    Conflicts:
    
    	sw/inc/unoprnms.hxx

diff --git a/comphelper/inc/comphelper/TypeGeneration.hxx b/comphelper/inc/comphelper/TypeGeneration.hxx
index c987b2a..9492ac8 100644
--- a/comphelper/inc/comphelper/TypeGeneration.hxx
+++ b/comphelper/inc/comphelper/TypeGeneration.hxx
@@ -71,6 +71,7 @@ namespace comphelper
         CPPUTYPE_SEQDEPTXTFLD,      //getCppuType( (Sequence<Reference<XDependentTextField> >*)0 )
         CPPUTYPE_TXTCNTANCHOR,      //getCppuType( (text::TextContentAnchorType*)0 )
         CPPUTYPE_WRAPTXTMODE,       //getCppuType( (text::WrapTextMode*)0 )
+        CPPUTYPE_LINESTYLE,         //getCppuType( (drawing::LineStyle*)0 )
         CPPUTYPE_COLORMODE,         //getCppuType( (drawing::ColorMode*)0 )
         CPPUTYPE_PAGESTYLELAY,      //getCppuType( (style::PageStyleLayout*)0 )
         CPPUTYPE_VERTALIGN,         //getCppuType( (style::VerticalAlignment*)0 )
diff --git a/comphelper/source/property/TypeGeneration.cxx b/comphelper/source/property/TypeGeneration.cxx
index 62c6d05..93c255c 100644
--- a/comphelper/source/property/TypeGeneration.cxx
+++ b/comphelper/source/property/TypeGeneration.cxx
@@ -128,6 +128,7 @@
 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
 
 using ::rtl::OUString;
 using namespace ::com::sun::star;
@@ -225,6 +226,7 @@ namespace comphelper
             case CPPUTYPE_REFXGRAPHIC:      pType = &::getCppuType( (Reference< graphic::XGraphic >*)0); break;
             case CPPUTYPE_TABLEBORDERDISTANCES:     pType = &::getCppuType( (table::TableBorderDistances*)0 ); break;
             case CPPUTPYE_REFEMBEDDEDOBJECT:        pType = &embed::XEmbeddedObject::static_type(); break;
+            case CPPUTYPE_LINESTYLE:        pType = &::getCppuType( (drawing::LineStyle*)0 ); break;
             default:
                 OSL_FAIL( "Unknown CPPU type" );
         }
diff --git a/editeng/inc/editeng/memberids.hrc b/editeng/inc/editeng/memberids.hrc
index fa57ab1..b53276c 100755
--- a/editeng/inc/editeng/memberids.hrc
+++ b/editeng/inc/editeng/memberids.hrc
@@ -168,6 +168,8 @@
 #define MID_RIGHT_BORDER            11
 #define MID_TOP_BORDER              12
 #define MID_BOTTOM_BORDER           13
+#define LINE_STYLE                  14
+#define LINE_WIDTH                  15
 
 //BrushItem
 #define MID_BACK_COLOR          0
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index cdf29de..f01f91e 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -29,6 +29,7 @@
 
 // include ---------------------------------------------------------------
 #include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/drawing/LineStyle.hpp>
 #include <com/sun/star/script/XTypeConverter.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/table/ShadowLocation.hpp>
@@ -1918,6 +1919,53 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
         case MID_TOP_BORDER:
             nLine = BOX_LINE_TOP;
             break;
+        case LINE_STYLE:
+            {
+                drawing::LineStyle eDrawingStyle;
+                rVal >>= eDrawingStyle;
+                editeng::SvxBorderStyle eBorderStyle = editeng::NO_STYLE;
+                switch ( eDrawingStyle )
+                {
+                    default:
+                    case drawing::LineStyle_NONE:
+                        eBorderStyle = editeng::NO_STYLE;
+                        break;
+                    case drawing::LineStyle_SOLID:
+                        eBorderStyle = editeng::SOLID;
+                        break;
+                    case drawing::LineStyle_DASH:
+                        eBorderStyle = editeng::DASHED;
+                        break;
+                }
+
+                // Set the line style on all borders
+                const sal_uInt16 aBorders[] = { BOX_LINE_LEFT, BOX_LINE_RIGHT, BOX_LINE_BOTTOM, BOX_LINE_TOP };
+                for (int n(0); n != SAL_N_ELEMENTS(aBorders); ++n)
+                {
+                    editeng::SvxBorderLine* pLine = const_cast< editeng::SvxBorderLine* >( GetLine( aBorders[n] ) );
+                    pLine->SetStyle( eBorderStyle );
+                }
+                return sal_True;
+            }
+            break;
+        case LINE_WIDTH:
+            {
+                // Set the line width on all borders
+                long nWidth(0);
+                rVal >>= nWidth;
+                if( bConvert )
+                    nWidth = MM100_TO_TWIP( nWidth );
+
+                // Set the line Width on all borders
+                const sal_uInt16 aBorders[] = { BOX_LINE_LEFT, BOX_LINE_RIGHT, BOX_LINE_BOTTOM, BOX_LINE_TOP };
+                for (int n(0); n != SAL_N_ELEMENTS(aBorders); ++n)
+                {
+                    editeng::SvxBorderLine* pLine = const_cast< editeng::SvxBorderLine* >( GetLine( aBorders[n] ) );
+                    pLine->SetWidth( nWidth );
+                }
+            }
+            return sal_True;
+            break;
     }
 
     if( bDistMember || nMemberId == BORDER_DISTANCE )
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 8df75ee..40cdc53 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -806,7 +806,11 @@ enum SwPropNameIds
 /* 0742 */  UNO_NAME_SEPARATOR_LINE_STYLE,
 /* 0743 */  UNO_NAME_FOOTNOTE_LINE_STYLE,
 /* 0744 */  UNO_NAME_EMBEDDED_OBJECT,
-/* 0745 */  SW_PROPNAME_END
+
+/* 0745 */  UNO_NAME_LINE_STYLE,
+/* 0746 */  UNO_NAME_LINE_WIDTH,
+
+/* 0747 */  SW_PROPNAME_END
 
 // new items in this array must match SwPropNameTab aPropNameTab
 };
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 141dabf..21bc5fa 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -386,8 +386,13 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
     GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER_DISTANCE,  pTopDistance);
     const ::uno::Any* pBottomDistance  = 0;
     GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE,   pBottomDistance);
+    const ::uno::Any* pLineStyle  = 0;
+    GetProperty(RES_BOX, LINE_STYLE,   pLineStyle);
+    const ::uno::Any* pLineWidth  = 0;
+    GetProperty(RES_BOX, LINE_WIDTH,   pLineWidth);
     if( pLeft || pRight || pTop ||  pBottom || pDistance ||
-        pLeftDistance  || pRightDistance || pTopDistance || pBottomDistance )
+        pLeftDistance  || pRightDistance || pTopDistance || pBottomDistance ||
+        pLineStyle || pLineWidth )
     {
         SvxBoxItem aBox ( static_cast < const :: SvxBoxItem & > ( rFromSet.Get ( RES_BOX ) ) );
         if( pLeft )
@@ -408,6 +413,10 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
             bRet &= ((SfxPoolItem&)aBox).PutValue(*pTopDistance, CONVERT_TWIPS|TOP_BORDER_DISTANCE);
         if( pBottomDistance )
             bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottomDistance, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE);
+        if( pLineStyle )
+            bRet &= ((SfxPoolItem&)aBox).PutValue(*pLineStyle, LINE_STYLE);
+        if( pLineWidth )
+            bRet &= ((SfxPoolItem&)aBox).PutValue(*pLineWidth, LINE_WIDTH|CONVERT_TWIPS);
         rToSet.Put(aBox);
     }
     {
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 1554fdc..40aa7da 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -348,7 +348,9 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
     { SW_PROP_NMID(UNO_NAME_WRAP_INFLUENCE_ON_POSITION), RES_WRAP_INFLUENCE_ON_OBJPOS, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, MID_WRAP_INFLUENCE}, \
     { SW_PROP_NMID(UNO_NAME_TITLE), FN_UNO_TITLE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, \
     { SW_PROP_NMID(UNO_NAME_DESCRIPTION), FN_UNO_DESCRIPTION, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, \
-    { SW_PROP_NMID(UNO_NAME_LAYOUT_SIZE), WID_LAYOUT_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PropertyAttribute::MAYBEVOID | PropertyAttribute::READONLY, 0 },
+    { SW_PROP_NMID(UNO_NAME_LAYOUT_SIZE), WID_LAYOUT_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PropertyAttribute::MAYBEVOID | PropertyAttribute::READONLY, 0 }, \
+    { SW_PROP_NMID(UNO_NAME_LINE_STYLE), RES_BOX, CPPU_E2T(CPPUTYPE_LINESTYLE),  0, LINE_STYLE }, \
+    { SW_PROP_NMID(UNO_NAME_LINE_WIDTH), RES_BOX, CPPU_E2T(CPPUTYPE_INT32),  0, LINE_WIDTH |CONVERT_TWIPS },
 
 
 
diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx
index 28e9d48..2efd7ac 100644
--- a/sw/source/core/unocore/unoprnms.cxx
+++ b/sw/source/core/unocore/unoprnms.cxx
@@ -782,6 +782,9 @@ const SwPropNameTab aPropNameTab = {
 /* 0743 UNO_NAME_FOOTNOTE_LINE_STYLE */ {MAP_CHAR_LEN("FootnoteLineStyle")},
 /* 0744 UNO_NAME_EMBEDDED_OBJECT */ {MAP_CHAR_LEN("EmbeddedObject")},
 
+/* 0745 UNO_NAME_LINE_STYLE */	         {MAP_CHAR_LEN("LineStyle")},
+/* 0746 UNO_NAME_LINE_WIDTH */	         {MAP_CHAR_LEN("LineWidth")},
+
 // new items in this array must match enum SwPropNameIds
 };
 
commit 8e1dbe2b4b1d36f9994ee23c8d6074d350d17508
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Thu Feb 23 13:51:21 2012 +0100

    fdo#45560: Fixed docx textbox position and size import
    (cherry picked from commit 94698d89f675da9b4da1143fa150bbd76def6ccf)
    
    Signed-off-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx
index 6483f20..a908875 100644
--- a/oox/source/vml/vmldrawing.cxx
+++ b/oox/source/vml/vmldrawing.cxx
@@ -29,9 +29,13 @@
 #include "oox/vml/vmldrawing.hxx"
 
 #include <algorithm>
+#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/drawing/XControlShape.hpp>
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <rtl/oustringostreaminserter.hxx>
 #include "oox/core/xmlfilterbase.hxx"
 #include "oox/helper/containerhelper.hxx"
 #include "oox/ole/axcontrol.hxx"
@@ -44,8 +48,10 @@ namespace vml {
 // ============================================================================
 
 using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::drawing;
 using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::text;
 using namespace ::com::sun::star::uno;
 
 using ::oox::core::XmlFilterBase;
@@ -217,13 +223,25 @@ Reference< XShape > Drawing::createAndInsertXShape( const OUString& rService,
     {
         Reference< XMultiServiceFactory > xModelFactory( mrFilter.getModelFactory(), UNO_SET_THROW );
         xShape.set( xModelFactory->createInstance( rService ), UNO_QUERY_THROW );
-        // insert shape into passed shape collection (maybe drawpage or group shape)
-        rxShapes->add( xShape );
-        xShape->setPosition( Point( rShapeRect.X, rShapeRect.Y ) );
+        if ( !rService.equalsAscii( "com.sun.star.text.TextFrame" ) )
+        {
+            // insert shape into passed shape collection (maybe drawpage or group shape)
+            rxShapes->add( xShape );
+            xShape->setPosition( Point( rShapeRect.X, rShapeRect.Y ) );
+        }
+        else
+        {
+            Reference< XPropertySet > xPropSet( xShape, UNO_QUERY_THROW );
+            xPropSet->setPropertyValue( OUString::createFromAscii( "HoriOrient" ), makeAny( HoriOrientation::NONE ) );
+            xPropSet->setPropertyValue( OUString::createFromAscii( "VertOrient" ), makeAny( VertOrientation::NONE ) );
+            xPropSet->setPropertyValue( OUString::createFromAscii( "HoriOrientPosition" ), makeAny( rShapeRect.X ) );
+            xPropSet->setPropertyValue( OUString::createFromAscii( "VertOrientPosition" ), makeAny( rShapeRect.Y ) );
+        }
         xShape->setSize( Size( rShapeRect.Width, rShapeRect.Height ) );
     }
-    catch( Exception& )
+    catch( Exception& e )
     {
+        SAL_WARN( "oox", "Drawing::createAndInsertXShape - error during shape object creation: " << e.Message );
     }
     OSL_ENSURE( xShape.is(), "Drawing::createAndInsertXShape - cannot instanciate shape object" );
     return xShape;


More information about the Libreoffice-commits mailing list