[Libreoffice-commits] core.git: 2 commits - include/vcl sfx2/source vcl/source

Noel Grandin noelgrandin at gmail.com
Mon May 30 06:41:04 UTC 2016


 include/vcl/texteng.hxx               |    2 +-
 sfx2/source/doc/saveastemplatedlg.cxx |    1 +
 vcl/source/edit/texteng.cxx           |   22 +++++++++++-----------
 vcl/source/edit/vclmedit.cxx          |    6 +++---
 4 files changed, 16 insertions(+), 15 deletions(-)

New commits:
commit f3fd69585db35dd0ba229b080705927733e8f949
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sun May 29 13:07:44 2016 +0200

    Convert TxtAlign to scoped enum
    
    Change-Id: I1f2c631fd77b772ccbf0763d168048fee8f3c910
    Reviewed-on: https://gerrit.libreoffice.org/25606
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 3a5c3c9..fc2f173 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -70,7 +70,7 @@ namespace i18n {
 
 class LocaleDataWrapper;
 
-enum TxtAlign { TXTALIGN_LEFT, TXTALIGN_CENTER, TXTALIGN_RIGHT };
+enum class TxtAlign { Left, Center, Right };
 
 typedef std::vector<TextView*> TextViews;
 
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index df1de5b..05e2e73 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -79,7 +79,7 @@ TextEngine::TextEngine()
     , mnCurTextWidth {-1}
     , mnCurTextHeight {0}
     , mnDefTab {0}
-    , meAlign {TXTALIGN_LEFT}
+    , meAlign {TxtAlign::Left}
     , mbIsFormatting {false}
     , mbFormatted {false}
     , mbUpdate {true}
@@ -1608,9 +1608,9 @@ void TextEngine::CreateAndInsertEmptyLine( sal_uInt32 nPara )
     aTmpLine.SetStart( pNode->GetText().getLength() );
     aTmpLine.SetEnd( aTmpLine.GetStart() );
 
-    if ( ImpGetAlign() == TXTALIGN_CENTER )
+    if ( ImpGetAlign() == TxtAlign::Center )
         aTmpLine.SetStartX( (short)(mnMaxTextWidth / 2) );
-    else if ( ImpGetAlign() == TXTALIGN_RIGHT )
+    else if ( ImpGetAlign() == TxtAlign::Right )
         aTmpLine.SetStartX( (short)mnMaxTextWidth );
     else
         aTmpLine.SetStartX( mpDoc->GetLeftMargin() );
@@ -2283,7 +2283,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
             ImpBreakLine( nPara, pLine, pPortion, nPortionStart, nRemainingWidth );
         }
 
-        if ( ( ImpGetAlign() == TXTALIGN_CENTER ) || ( ImpGetAlign() == TXTALIGN_RIGHT ) )
+        if ( ( ImpGetAlign() == TxtAlign::Center ) || ( ImpGetAlign() == TxtAlign::Right ) )
         {
             // adjust
             long nTextWidth = 0;
@@ -2295,9 +2295,9 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
             const long nSpace = mnMaxTextWidth - nTextWidth;
             if ( nSpace > 0 )
             {
-                if ( ImpGetAlign() == TXTALIGN_CENTER )
+                if ( ImpGetAlign() == TxtAlign::Center )
                     pLine->SetStartX( (sal_uInt16)(nSpace / 2) );
-                else    // TXTALIGN_RIGHT
+                else    // TxtAlign::Right
                     pLine->SetStartX( (sal_uInt16)nSpace );
             }
         }
@@ -2841,7 +2841,7 @@ void TextEngine::SetRightToLeft( bool bR2L )
     if ( mbRightToLeft != bR2L )
     {
         mbRightToLeft = bR2L;
-        meAlign = bR2L ? TXTALIGN_RIGHT : TXTALIGN_LEFT;
+        meAlign = bR2L ? TxtAlign::Right : TxtAlign::Left;
         FormatFullDoc();
         UpdateViews();
     }
@@ -2997,10 +2997,10 @@ TxtAlign TextEngine::ImpGetAlign() const
     TxtAlign eAlign = meAlign;
     if ( IsRightToLeft() )
     {
-        if ( eAlign == TXTALIGN_LEFT )
-            eAlign = TXTALIGN_RIGHT;
-        else if ( eAlign == TXTALIGN_RIGHT )
-            eAlign = TXTALIGN_LEFT;
+        if ( eAlign == TxtAlign::Left )
+            eAlign = TxtAlign::Right;
+        else if ( eAlign == TxtAlign::Right )
+            eAlign = TxtAlign::Left;
     }
     return eAlign;
 }
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 7f25066..cf224ce 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -338,11 +338,11 @@ void ImpVclMEdit::SetAlign( WinBits nWinStyle )
     mpTextWindow->GetTextEngine()->SetRightToLeft( bRTL );
 
     if ( nWinStyle & WB_CENTER )
-        mpTextWindow->GetTextEngine()->SetTextAlign( TXTALIGN_CENTER );
+        mpTextWindow->GetTextEngine()->SetTextAlign( TxtAlign::Center );
     else if ( nWinStyle & WB_RIGHT )
-        mpTextWindow->GetTextEngine()->SetTextAlign( !bRTL ? TXTALIGN_RIGHT : TXTALIGN_LEFT );
+        mpTextWindow->GetTextEngine()->SetTextAlign( !bRTL ? TxtAlign::Right : TxtAlign::Left );
     else if ( nWinStyle & WB_LEFT )
-        mpTextWindow->GetTextEngine()->SetTextAlign( !bRTL ? TXTALIGN_LEFT : TXTALIGN_RIGHT );
+        mpTextWindow->GetTextEngine()->SetTextAlign( !bRTL ? TxtAlign::Left : TxtAlign::Right );
 }
 
 void ImpVclMEdit::SetModified( bool bMod )
commit 395db598591edc123148770de42dac30bf505296
Author: Akshay Deep <akshaydeepiitr at gmail.com>
Date:   Sat May 28 20:52:34 2016 +0530

    Resolves: Error when overwriting a template in Template Save As Dialog
    
    After overwriting a template, overwritten template does not exist in the
    template manager because SfxDocumentTemplates is not updated..
    
    Change-Id: I7e8605091de71b921f8dbed5ab2022ac292fe4b2
    Reviewed-on: https://gerrit.libreoffice.org/25584
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/sfx2/source/doc/saveastemplatedlg.cxx b/sfx2/source/doc/saveastemplatedlg.cxx
index 1d46197..beef6e6 100644
--- a/sfx2/source/doc/saveastemplatedlg.cxx
+++ b/sfx2/source/doc/saveastemplatedlg.cxx
@@ -162,6 +162,7 @@ bool SfxSaveAsTemplateDialog::SaveTemplate()
     if(!mpDocTemplates->InsertTemplate( mnRegionPos, nDocId, msTemplateName, sURL))
         return false;
 
+    mpDocTemplates->Update();
     return true;
 }
 


More information about the Libreoffice-commits mailing list