[PATCH] fdo#47305: set digit language, before OutputDevice draw text...

navin patidar (via Code Review) gerrit at gerrit.libreoffice.org
Sat May 4 05:44:54 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3773

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/73/3773/1

fdo#47305: set digit language, before OutputDevice draw text.

Set ctl language as digit language when wrt direction is RTL and
numeral language is set to choose based on context.

Change-Id: Ie54193d938e0b6ab6bccb6decb9f245037aebb4b
---
M sc/source/ui/view/output2.cxx
1 file changed, 38 insertions(+), 3 deletions(-)



diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 76d3a5e..dcd6c92 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -38,6 +38,7 @@
 #include <editeng/unolingu.hxx>
 #include <editeng/fontitem.hxx>
 #include <svl/zforlist.hxx>
+#include <svl/ctloptions.hxx>
 #include <svl/zformat.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/metric.hxx>
@@ -1650,6 +1651,8 @@
                     bNeedEdit = aVars.HasEditCharacters() || (bFormulaCell && aCell.mpFormula->IsMultilineResult());
                 }
                 long nTotalMargin = 0;
+                const SfxPoolItem* pItem =  mpDoc->GetAttr( nCellX, nCellY, nTab, ATTR_WRITINGDIR );
+                const SvxFrameDirectionItem* pCurrentWritingMode = (const SvxFrameDirectionItem*) pItem;
                 if (bDoCell && !bNeedEdit)
                 {
                     CellType eCellType = aCell.meType;
@@ -1674,8 +1677,6 @@
 
                     if ( eOutHorJust == SVX_HOR_JUSTIFY_BLOCK || eOutHorJust == SVX_HOR_JUSTIFY_REPEAT )
                     {
-                        const SfxPoolItem* pItem =  mpDoc->GetAttr( nCellX, nCellY, nTab, ATTR_WRITINGDIR );
-                        const SvxFrameDirectionItem* pCurrentWritingMode = (const SvxFrameDirectionItem*) pItem;
                         if (pCurrentWritingMode->GetValue() == FRMDIR_HORI_LEFT_TOP)
                             eOutHorJust = SVX_HOR_JUSTIFY_LEFT;
                         else
@@ -1987,7 +1988,41 @@
                             if (bRightAdjusted)
                                 aDrawTextPos.X() -= aVars.GetOriginalWidth();
                         }
-
+                        SvtCTLOptions *pCTLOptions = new SvtCTLOptions;
+                        if (pCurrentWritingMode->GetValue() == FRMDIR_HORI_RIGHT_TOP && pCTLOptions->GetCTLTextNumerals() == SvtCTLOptions::NUMERALS_CONTEXT)
+                        {
+                            LanguageType ctl,cjk,latin;
+                            mpDoc->GetLanguage(latin,cjk,ctl);
+                            switch(ctl)
+                            {
+                                case LANGUAGE_ARABIC_SAUDI_ARABIA:
+                                {
+                                    mpDev->SetDigitLanguage(ctl);
+                                    break;
+                                }
+                                case LANGUAGE_FARSI:
+                                {
+                                    mpDev->SetDigitLanguage(ctl);
+                                    break;
+                                }
+                                case LANGUAGE_URDU_INDIA:
+                                {
+                                    mpDev->SetDigitLanguage(ctl);
+                                    break;
+                                }
+                                case LANGUAGE_URDU_PAKISTAN:
+                                {
+                                    mpDev->SetDigitLanguage(ctl);
+                                    break;
+                                }
+                                case LANGUAGE_URDU:
+                                {
+                                    mpDev->SetDigitLanguage(ctl);
+                                    break;
+                                }
+                            }
+                        }
+                        delete pCTLOptions;
                         //  in Metafiles immer DrawTextArray, damit die Positionen mit
                         //  aufgezeichnet werden (fuer nicht-proportionales Resize):
 

-- 
To view, visit https://gerrit.libreoffice.org/3773
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie54193d938e0b6ab6bccb6decb9f245037aebb4b
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: navin patidar <patidar at kacst.edu.sa>



More information about the LibreOffice mailing list