[Libreoffice-commits] .: 2 commits - cui/source l10ntools/source

Andras Timar timar at kemper.freedesktop.org
Fri Oct 28 15:20:59 PDT 2011


 cui/source/inc/grfpage.hxx      |    1 
 cui/source/tabpages/grfpage.cxx |   32 +++++++++++++++++++++++++++---
 cui/source/tabpages/grfpage.hrc |    3 --
 cui/source/tabpages/grfpage.src |   42 ++++------------------------------------
 l10ntools/source/xrmmerge.cxx   |   10 ++++-----
 5 files changed, 41 insertions(+), 47 deletions(-)

New commits:
commit df6c97530ed394d60504523f55d7a21469a73625
Author: Andras Timar <atimar at suse.com>
Date:   Sat Oct 29 00:14:55 2011 +0200

    tweak handling of extension descriptions

diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index b158b35..9591c55 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -685,9 +685,8 @@ void XRMResMerge::WorkOnDesc(
                     sSearch = ByteString("xlink:href=\"");
                     sReplace = sSearch;
 
-                    ByteString sLocDescFilename = sCur;
-                    sLocDescFilename += ByteString("-");
-                    sLocDescFilename += sDescFilename;
+                    ByteString sLocDescFilename = sDescFilename;
+                    sLocDescFilename.SearchAndReplace( "en-US", sCur );
 
                     sSearch += sDescFilename;
                     sReplace += sLocDescFilename;
@@ -697,8 +696,9 @@ void XRMResMerge::WorkOnDesc(
 
                     DirEntry aEntry( String( sOutputFile, RTL_TEXTENCODING_ASCII_US ));
                     aEntry.ToAbs();
-                    ByteString sOutputDescFile( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
-                    sOutputDescFile.SearchAndReplaceAll( "description.xml", "" );
+                    ByteString sOutputDescFile( aEntry.GetPath().GetFull(), RTL_TEXTENCODING_ASCII_US );
+                    ByteString sDel( DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US );
+                    sOutputDescFile += sDel;
                     sOutputDescFile += sLocDescFilename;
                     sText.SearchAndReplaceAll( "\\n", "\n" );
                     ofstream file ( sOutputDescFile.GetBuffer() );
commit adb8868edaebb372a54140f84bf85ac9eef37918
Author: László Németh <nemeth at numbertext.org>
Date:   Sat Oct 29 00:12:25 2011 +0200

    Display original resolution in PPI in Writer's Picture/Crop tab

diff --git a/cui/source/inc/grfpage.hxx b/cui/source/inc/grfpage.hxx
index 9d53f2c..4840442 100644
--- a/cui/source/inc/grfpage.hxx
+++ b/cui/source/inc/grfpage.hxx
@@ -97,6 +97,7 @@ class SvxGrfCropPage : public SfxTabPage
     Timer           aTimer;
     String          aGraphicName;
     Size            aOrigSize;
+    Size            aOrigPixelSize;
     Size            aPageSize;
     const MetricField*  pLastCropField;
     long            nOldWidth;
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index 435345b..af27a6c 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -42,6 +42,7 @@
 #include <svx/dialogs.hrc> // for RID_SVXPAGE_GRFCROP
 
 #define CM_1_TO_TWIP        567
+#define TWIP_TO_INCH        1440
 
 
 inline long lcl_GetValue( MetricField& rMetric, FieldUnit eUnit )
@@ -214,8 +215,13 @@ void SvxGrfCropPage::Reset( const SfxItemSet &rSet )
     if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, sal_False, &pItem ) )
     {
         const Graphic* pGrf = ((SvxBrushItem*)pItem)->GetGraphic();
-        if( pGrf )
+        if( pGrf ) {
             aOrigSize = GetGrfOrigSize( *pGrf );
+            if (pGrf->GetType() == GRAPHIC_BITMAP && aOrigSize.Width() && aOrigSize.Height()) {
+                Bitmap aBitmap = pGrf->GetBitmap();
+                aOrigPixelSize = aBitmap.GetSizePixel();
+            }
+        }
 
         if( aOrigSize.Width() && aOrigSize.Height() )
         {
@@ -360,6 +366,10 @@ void SvxGrfCropPage::ActivatePage(const SfxItemSet& rSet)
         {
             aExampleWN.SetGraphic( *pGrf );
             aOrigSize = GetGrfOrigSize( *pGrf );
+            if (pGrf->GetType() == GRAPHIC_BITMAP && aOrigSize.Width() > 1 && aOrigSize.Height() > 1) {
+                Bitmap aBitmap = pGrf->GetBitmap();
+                aOrigPixelSize = aBitmap.GetSizePixel();
+            }
             aExampleWN.SetFrameSize(aOrigSize);
             GraphicHasChanged( aOrigSize.Width() && aOrigSize.Height() );
             CalcMinMaxBorder();
@@ -664,9 +674,25 @@ void SvxGrfCropPage::GraphicHasChanged( sal_Bool bFound )
         aFld.SetValue( aFld.Normalize( aOrigSize.Width() ), eUnit );
         String sTemp = aFld.GetText();
         aFld.SetValue( aFld.Normalize( aOrigSize.Height() ), eUnit );
-        sTemp += UniString::CreateFromAscii(" x ");
+        // multiplication sign (U+00D7)
+        sTemp += UniString("\xc3\x97", RTL_TEXTENCODING_UTF8);
         sTemp += aFld.GetText();
-        aOrigSizeFT.SetText(sTemp);
+
+        if ( aOrigPixelSize.Width() && aOrigPixelSize.Height() ) {
+             int ax = int(floor((float)aOrigPixelSize.Width() /
+                        ((float)aOrigSize.Width()/TWIP_TO_INCH)+0.5));
+             int ay = int(floor((float)aOrigPixelSize.Height() /
+                        ((float)aOrigSize.Height()/TWIP_TO_INCH)+0.5));
+             sTemp += UniString::CreateFromAscii(" ");
+             sTemp += CUI_RESSTR( STR_PPI );
+             String sPPI = UniString::CreateFromInt32(ax);
+             if (abs(ax - ay) > 1) {
+                sPPI += UniString("\xc3\x97", RTL_TEXTENCODING_UTF8);
+                sPPI += UniString::CreateFromInt32(ay);
+             }
+             sTemp.SearchAndReplaceAscii("%1", sPPI);
+        }
+        aOrigSizeFT.SetText( sTemp );
     }
     aLeftFT         .Enable(bFound);
     aLeftMF         .Enable(bFound);
diff --git a/cui/source/tabpages/grfpage.hrc b/cui/source/tabpages/grfpage.hrc
index 438e67a..67c7f0e 100644
--- a/cui/source/tabpages/grfpage.hrc
+++ b/cui/source/tabpages/grfpage.hrc
@@ -49,5 +49,4 @@
 #define RB_SIZECONST        23
 #define RB_ZOOMCONST        24
 #define WN_BSP              25
-
-
+#define STR_PPI             2600
diff --git a/cui/source/tabpages/grfpage.src b/cui/source/tabpages/grfpage.src
index 085e92f..6e1b5af 100644
--- a/cui/source/tabpages/grfpage.src
+++ b/cui/source/tabpages/grfpage.src
@@ -304,40 +304,8 @@ TabPage RID_SVXPAGE_GRFCROP
     };
 };
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+String STR_PPI
+{
+    Text [ x-comment ] = "PPI is pixel per inch, %1 is a number" ;
+    Text [ en-US ] = "(%1 PPI)" ;
+};


More information about the Libreoffice-commits mailing list