[Libreoffice-commits] core.git: 2 commits - filter/source include/filter sd/source vcl/inc vcl/source

Caolán McNamara caolanm at redhat.com
Fri May 24 11:02:25 PDT 2013


 filter/source/msfilter/svdfppt.cxx  |  139 ++++++++++++++++++++++++++++++++++++
 include/filter/msfilter/svdfppt.hxx |    3 
 sd/source/filter/ppt/pptin.cxx      |    2 
 vcl/inc/window.h                    |    3 
 vcl/source/window/window.cxx        |    6 -
 vcl/source/window/window3.cxx       |   22 -----
 6 files changed, 147 insertions(+), 28 deletions(-)

New commits:
commit 5f88e8e6492cbd62b990cc18ebdb71a62be52c72
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 24 19:00:30 2013 +0100

    this themeing thing doesn't actually do anything
    
    both branches are the same and the set/get aren't
    called anyway.
    
    originally introduced with d02f75a8c36705924ddd6a5921fe3012fafce812
    
    Change-Id: I94399bba0fa259bfafcc214e2df15f172d32374f

diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 34fe78c..230e1b0 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -396,8 +396,7 @@ public:
                         mbVexpand:1,
                         mbExpand:1,
                         mbFill:1,
-                        mbSecondary:1,
-                        mbIsThemingEnabled:1;
+                        mbSecondary:1;
 
     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer;
 };
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b50ca25..e69dd35 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -297,7 +297,6 @@ WindowImpl::WindowImpl( WindowType nType )
     mbExpand = false;
     mbFill = true;
     mbSecondary = false;
-    mbIsThemingEnabled = true;
 }
 
 WindowImpl::~WindowImpl()
@@ -758,10 +757,7 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste
             nBorderTypeStyle |= BORDERWINDOW_STYLE_FRAME;
             nStyle |= WB_BORDER;
         }
-        ImplBorderWindow* pBorderWin =
-            mpWindowImpl->mbIsThemingEnabled
-            ? CreateBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle )
-            : new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle );
+        ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle );
         ((Window*)pBorderWin)->mpWindowImpl->mpClientWindow = this;
         pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
         mpWindowImpl->mpBorderWindow  = pBorderWin;
diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx
index fd656f96..00919ac 100644
--- a/vcl/source/window/window3.cxx
+++ b/vcl/source/window/window3.cxx
@@ -18,11 +18,9 @@
  */
 
 
-#include "vcl/button.hxx"
 #include "vcl/window.hxx"
 #include "vcl/waitobj.hxx"
-#include "brdwin.hxx"
-#include "window.h"
+#include "vcl/button.hxx"
 
 // -----------------------------------------------------------------------
 
@@ -65,22 +63,4 @@ void Window::ImplAdjustNWFSizes()
     }
 }
 
-void Window::EnableThemeSupport (void)
-{
-    mpWindowImpl->mbIsThemingEnabled = sal_True;
-}
-
-void Window::DisableThemeSupport (void)
-{
-    mpWindowImpl->mbIsThemingEnabled = sal_False;
-}
-
-ImplBorderWindow* Window::CreateBorderWindow (
-    Window* pParent,
-    const WinBits nStyle,
-    const sal_uInt16 nTypeStyle)
-{
-    return new ImplBorderWindow(pParent, nStyle, nTypeStyle);
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 54c679f481647890f18151f4db05cfc3eff5d98b
Author: Andre Fischer <af at apache.org>
Date:   Fri Jul 13 07:55:43 2012 +0000

    Resolves: #i119874 Fixed text alignment in RTL layout.
    
    Reported by: Li Feng Wang
    Patch by: Jianyuan Li
    Review by: Andre Fischer
    (cherry picked from commit 57fdcdd79d1682ee7d5e88fbab3803631496afa2)
    
    Conflicts:
    	filter/inc/filter/msfilter/svdfppt.hxx
    	filter/source/msfilter/svdfppt.cxx
    
    Change-Id: I6adae6d40ff106caeea2b9310a57228257d79404
    
    Related: #i119874# Missing part of patch.
    
    Patch by: Jianyuan Li
    (cherry picked from commit a7dc3e8b82c87b138c973f1434717d634ed8dc67)
    
    Change-Id: Icff3e1167ab780612ad47775aaa39c9baa99c70f

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index e4e1ae1..91891c9 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -7627,4 +7627,143 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab
     return pRet;
 }
 
+sal_Bool SdrPowerPointImport::IsVerticalText() const
+{
+    sal_Bool bVerticalText = sal_False;
+    if ( IsProperty( DFF_Prop_txflTextFlow ) )
+    {
+        MSO_TextFlow eTextFlow = (MSO_TextFlow)( GetPropertyValue( DFF_Prop_txflTextFlow ) & 0xFFFF );
+        switch( eTextFlow )
+        {
+        case mso_txflTtoBA :                    // Top to Bottom @-font, above -> below
+        case mso_txflTtoBN :                    // Top to Bottom non-@, above -> below
+        case mso_txflVertN :                    // Vertical, non-@, above -> below
+            bVerticalText = !bVerticalText;
+            break;
+        default: break;
+        }
+    }
+
+    return bVerticalText;
+}
+
+void    SdrPowerPointImport::ApplyTextAnchorAttributes( PPTTextObj& rTextObj, SfxItemSet& rSet ) const
+{
+    SdrTextVertAdjust eTVA;
+    SdrTextHorzAdjust eTHA;
+
+    sal_uInt32 nTextFlags = rTextObj.GetTextFlags();
+
+    nTextFlags &= PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT   | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT
+        | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK;
+
+    if ( IsVerticalText() )
+    {
+        eTVA = SDRTEXTVERTADJUST_BLOCK;
+        eTHA = SDRTEXTHORZADJUST_CENTER;
+
+        // Textverankerung lesen
+        MSO_Anchor eTextAnchor = (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop );
+
+        switch( eTextAnchor )
+        {
+        case mso_anchorTop:
+        case mso_anchorTopCentered:
+            eTHA = SDRTEXTHORZADJUST_RIGHT;
+            break;
+
+        case mso_anchorMiddle :
+        case mso_anchorMiddleCentered:
+            eTHA = SDRTEXTHORZADJUST_CENTER;
+            break;
+
+        case mso_anchorBottom:
+        case mso_anchorBottomCentered:
+            eTHA = SDRTEXTHORZADJUST_LEFT;
+            break;
+
+        default:
+            break;
+        }
+        // if there is a 100% use of following attributes, the textbox can been aligned also in vertical direction
+        switch ( eTextAnchor )
+        {
+        case mso_anchorTopCentered :
+        case mso_anchorMiddleCentered :
+        case mso_anchorBottomCentered :
+            {
+                // check if it is sensible to use the centered alignment
+                sal_uInt32 nMask = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT;
+                if ( ( nTextFlags & nMask ) != nMask )  // if the textobject has left or also right aligned pararagraphs
+                    eTVA = SDRTEXTVERTADJUST_CENTER;    // the text has to be displayed using the full width;
+            }
+            break;
+
+        default :
+            {
+                if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT )
+                    eTVA = SDRTEXTVERTADJUST_TOP;
+                else if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT )
+                    eTVA = SDRTEXTVERTADJUST_BOTTOM;
+            }
+            break;
+        }
+    }
+    else
+    {
+        eTVA = SDRTEXTVERTADJUST_CENTER;
+        eTHA = SDRTEXTHORZADJUST_BLOCK;
+
+        // Textverankerung lesen
+        MSO_Anchor eTextAnchor = (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop );
+
+        switch( eTextAnchor )
+        {
+        case mso_anchorTop:
+        case mso_anchorTopCentered:
+            eTVA = SDRTEXTVERTADJUST_TOP;
+            break;
+
+        case mso_anchorMiddle :
+        case mso_anchorMiddleCentered:
+            eTVA = SDRTEXTVERTADJUST_CENTER;
+            break;
+
+        case mso_anchorBottom:
+        case mso_anchorBottomCentered:
+            eTVA = SDRTEXTVERTADJUST_BOTTOM;
+            break;
+
+        default:
+            break;
+        }
+
+        // if there is a 100% usage of following attributes, the textbox can be aligned also in horizontal direction
+        switch ( eTextAnchor )
+        {
+        case mso_anchorTopCentered :
+        case mso_anchorMiddleCentered :
+        case mso_anchorBottomCentered :
+            {
+                // check if it is sensible to use the centered alignment
+                sal_uInt32 nMask = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT;
+                if ( ( nTextFlags & nMask ) != nMask )  // if the textobject has left or also right aligned pararagraphs
+                    eTHA = SDRTEXTHORZADJUST_CENTER;    // the text has to be displayed using the full width;
+            }
+            break;
+
+        default :
+            {
+                if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT )
+                    eTHA = SDRTEXTHORZADJUST_LEFT;
+                else if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT )
+                    eTHA = SDRTEXTHORZADJUST_RIGHT;
+            }
+            break;
+        }
+    }
+    rSet.Put( SdrTextVertAdjustItem( eTVA ) );
+    rSet.Put( SdrTextHorzAdjustItem( eTHA ) );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index c32b9de..4cba0ec 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -573,6 +573,9 @@ protected:
     SdrOutliner*            GetDrawOutliner( SdrTextObj* pSdrText ) const;
     void                    SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions );
 
+    void        ApplyTextAnchorAttributes( PPTTextObj& rTextObj, SfxItemSet& rSet ) const;
+    sal_Bool    IsVerticalText() const;
+
 public:
                             SdrPowerPointImport( PowerPointImportParam&, const OUString& rBaseURL );
     virtual                 ~SdrPowerPointImport();
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 9e3eab5..67a5e18 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2391,6 +2391,8 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
 
                             SfxItemSet aSet( pSdrModel->GetItemPool() );
                             ApplyAttributes( rStCtrl, aSet );
+                            pPresObj->SetLogicRect(pText->GetLogicRect());
+                            ApplyTextAnchorAttributes( *pTextObj, aSet );
                             pPresObj->SetMergedItemSet(aSet);
 
                             if ( ( eAktPageKind != PPT_NOTEPAGE ) && ( nPlacementId != 0xffffffff ) )


More information about the Libreoffice-commits mailing list