[Libreoffice-commits] .: 3 commits - sc/sdi sc/source sd/sdi sd/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Oct 3 22:46:38 PDT 2012
sc/sdi/graphsh.sdi | 6 +
sc/source/ui/drawfunc/graphsh.cxx | 56 ++++++++++++++++-
sc/source/ui/drawfunc/objdraw.src | 1
sc/source/ui/inc/graphsh.hxx | 3
sd/sdi/_drvwsh.sdi | 5 +
sd/source/ui/app/popup2_tmpl.src | 1
sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx | 14 +---
sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx | 4 -
sd/source/ui/slidesorter/view/SlideSorterView.cxx | 2
sd/source/ui/view/drviews2.cxx | 47 ++++++++++++++
10 files changed, 126 insertions(+), 13 deletions(-)
New commits:
commit 6f221adc31e8323284720e7ccfe4818430a9bd66
Author: Tomaž Vajngerl <quikee at gmail.com>
Date: Thu Oct 4 07:40:24 2012 +0200
Improve quality of page previews in Impress/Draw with supersampling
Change-Id: I9c5b28fc32b73b2147162f74919b21d99401b501
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx
index 2d901ef..6b31439 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx
@@ -41,10 +41,6 @@
#include <vcl/bmpacc.hxx>
#include <vcl/pngwrite.hxx>
-const static sal_Int32 gnSuperSampleFactor (2);
-const static bool gbAllowSuperSampling (false);
-
-
namespace sd { namespace slidesorter { namespace view {
class SlideSorterView;
class PageObjectViewObjectContact;
@@ -73,10 +69,12 @@ Bitmap BitmapFactory::CreateBitmap (
const bool bDoSuperSampling)
{
Size aSize (rPixelSize);
- if (bDoSuperSampling && gbAllowSuperSampling)
+ if (bDoSuperSampling)
{
- aSize.Width() *= gnSuperSampleFactor;
- aSize.Height() *= gnSuperSampleFactor;
+ // Supersampling factor
+ int aSuperSamplingFactor = 2;
+ aSize.Width() *= aSuperSamplingFactor;
+ aSize.Height() *= aSuperSamplingFactor;
}
Bitmap aPreview (maRenderer.RenderPage (
@@ -85,7 +83,7 @@ Bitmap BitmapFactory::CreateBitmap (
String(),
true,
false).GetBitmapEx().GetBitmap());
- if (bDoSuperSampling && gbAllowSuperSampling)
+ if (bDoSuperSampling)
{
aPreview.Scale(rPixelSize, BMP_SCALE_BEST);
}
diff --git a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
index db3f12d..27c263d 100644
--- a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
@@ -147,7 +147,7 @@ Bitmap GenericPageCache::GetPreviewBitmap (
// i.e. the bitmap is not empty.
if (bResize && aBitmapSize.Width()>0 && aBitmapSize.Height()>0)
{
- aPreview.Scale(maPreviewSize, BMP_SCALE_FAST);
+ aPreview.Scale(maPreviewSize);
}
bMayBeUpToDate = false;
}
@@ -184,7 +184,7 @@ Bitmap GenericPageCache::GetMarkedPreviewBitmap (
// i.e. the bitmap is not empty.
if (aBitmapSize.Width()>0 && aBitmapSize.Height()>0)
{
- aMarkedPreview.Scale(maPreviewSize, BMP_SCALE_FAST);
+ aMarkedPreview.Scale(maPreviewSize);
}
}
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index 23516a9..66c3cdf 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -819,7 +819,7 @@ void SlideSorterView::ConfigurationChanged (
mpPreviewCache.reset(
new cache::PageCache(
mpLayouter->GetPageObjectSize(),
- false,
+ true,
cache::SharedCacheContext(new ViewCacheContext(mrSlideSorter))));
}
commit 1e6985da53b91fd0f2a3d44cd30dd3a73dcd6919
Author: Tomaž Vajngerl <quikee at gmail.com>
Date: Wed Oct 3 22:27:41 2012 +0200
Add "Compress Graphic" menu entry for bitmaps to Calc
Change-Id: I591c544f600361b5bc9c59b5627f6cdd9f9b09db
diff --git a/sc/sdi/graphsh.sdi b/sc/sdi/graphsh.sdi
index 6eb051b..6c9ae7a 100644
--- a/sc/sdi/graphsh.sdi
+++ b/sc/sdi/graphsh.sdi
@@ -140,6 +140,12 @@ interface GraphSelection
ExecMethod = ExecuteExternalEdit;
StateMethod = GetExternalEditState;
]
+
+ SID_COMPRESS_GRAPHIC
+ [
+ ExecMethod = ExecuteCompressGraphic;
+ StateMethod = GetCompressGraphicState;
+ ]
}
// ===========================================================================
diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx
index f2258e8..8ecbd7d 100644
--- a/sc/source/ui/drawfunc/graphsh.cxx
+++ b/sc/source/ui/drawfunc/graphsh.cxx
@@ -33,6 +33,8 @@
#include <svx/svdograf.hxx>
#include <svx/grfflt.hxx>
#include <svx/grafctrl.hxx>
+#include <svx/compressgraphicdialog.hxx>
+#include <vcl/msgbox.hxx>
#include "graphsh.hxx"
#include "sc.hrc"
@@ -48,11 +50,11 @@
class ScExternalToolEdit : public ExternalToolEdit
{
- ScDrawView* m_pView;
+ FmFormView* m_pView;
SdrObject* m_pObj;
public:
- ScExternalToolEdit ( ScDrawView* pView, SdrObject* pObj ) :
+ ScExternalToolEdit ( FmFormView* pView, SdrObject* pObj ) :
m_pView (pView),
m_pObj (pObj)
{}
@@ -204,4 +206,54 @@ void ScGraphicShell::ExecuteExternalEdit( SfxRequest& )
Invalidate();
}
+
+void ScGraphicShell::GetCompressGraphicState( SfxItemSet& rSet )
+{
+ ScDrawView* pView = GetViewData()->GetScDrawView();
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ bool bEnable = false;
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrGrafObj ) && ( ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP ) )
+ bEnable = true;
+ }
+
+ if( !bEnable )
+ rSet.DisableItem( SID_COMPRESS_GRAPHIC );
+}
+
+void ScGraphicShell::ExecuteCompressGraphic( SfxRequest& )
+{
+ ScDrawView* pView = GetViewData()->GetScDrawView();
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
+ {
+ GraphicObject aGraphicObject( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
+ CompressGraphicsDialog dialog( GetViewData()->GetDialogParent(), aGraphicObject.GetGraphic(), pObj->GetLogicRect().GetSize(), GetViewData()->GetBindings() );
+ if ( dialog.Execute() == RET_OK )
+ {
+ SdrGrafObj* pNewObject = (SdrGrafObj*) pObj->Clone();
+ const Graphic aNewGraphic = dialog.GetCompressedGraphic();
+ SdrPageView* pPageView = pView->GetSdrPageView();
+ pNewObject->SetEmptyPresObj( sal_False );
+ pNewObject->SetGraphic( aNewGraphic );
+ String aUndoString( pView->GetDescriptionOfMarkedObjects() );
+ aUndoString += (sal_Unicode) ' ';
+ aUndoString += String( "Compress" );
+ pView->BegUndo( aUndoString );
+ pView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
+ pView->EndUndo();
+ }
+ }
+ }
+
+ Invalidate();
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/drawfunc/objdraw.src b/sc/source/ui/drawfunc/objdraw.src
index 02fc435..a2ed29e 100644
--- a/sc/source/ui/drawfunc/objdraw.src
+++ b/sc/source/ui/drawfunc/objdraw.src
@@ -527,6 +527,7 @@ Menu RID_POPUP_GRAPHIC
MN_EDITLNK
MN_DELLNK
MenuItem { ITEM_OPEN_HYPERLINK };
+ MenuItem { ITEM_COMPRESS_GRAPHIC };
MenuItem { ITEM_EXTERNAL_EDIT };
};
};
diff --git a/sc/source/ui/inc/graphsh.hxx b/sc/source/ui/inc/graphsh.hxx
index 3c700c7..31d2d35 100644
--- a/sc/source/ui/inc/graphsh.hxx
+++ b/sc/source/ui/inc/graphsh.hxx
@@ -47,6 +47,9 @@ public:
void ExecuteExternalEdit(SfxRequest& rReq);
void GetExternalEditState(SfxItemSet &rSet);
+
+ void ExecuteCompressGraphic(SfxRequest& rReq);
+ void GetCompressGraphicState(SfxItemSet &rSet);
};
#endif
commit 7895ebdab0b0ed7d2a9b361d6d5ab02b0e9361d6
Author: Tomaž Vajngerl <quikee at gmail.com>
Date: Wed Oct 3 21:37:14 2012 +0200
Add "External Edit" menu function for bitmaps to Impress and Draw
Change-Id: I77f2c03d9e4aadebe2468c13f0a703eb389155d7
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 4b09d0c..cc811d5 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -80,6 +80,11 @@ interface DrawView
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
+ SID_EXTERNAL_EDIT
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
SID_CUT // ole : no, status : ?
[
ExecMethod = FuSupport ;
diff --git a/sd/source/ui/app/popup2_tmpl.src b/sd/source/ui/app/popup2_tmpl.src
index 6762879..4520e60 100644
--- a/sd/source/ui/app/popup2_tmpl.src
+++ b/sd/source/ui/app/popup2_tmpl.src
@@ -660,6 +660,7 @@
SEPARATOR
MenuItem { ITEM_SAVE_GRAPHIC };
MenuItem { ITEM_COMPRESS_GRAPHIC };
+ MenuItem { ITEM_EXTERNAL_EDIT };
};
};
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 75ff0f1..53e3a76 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -49,6 +49,7 @@
#include <svx/xlineit0.hxx>
#include <svx/graphichelper.hxx>
#include <svx/compressgraphicdialog.hxx>
+#include <svx/extedit.hxx>
#include <svx/svdoutl.hxx>
#include <svx/xlnwtit.hxx>
#include <svx/svdoattr.hxx>
@@ -93,6 +94,34 @@ using namespace ::com::sun::star::uno;
namespace sd {
+class SdExternalToolEdit : public ExternalToolEdit
+{
+ FmFormView* m_pView;
+ SdrObject* m_pObj;
+
+public:
+ SdExternalToolEdit ( FmFormView* pView, SdrObject* pObj ) :
+ m_pView (pView),
+ m_pObj (pObj)
+ {}
+
+ virtual void Update( Graphic& aGraphic )
+ {
+ SdrPageView* pPageView = m_pView->GetSdrPageView();
+ if( pPageView )
+ {
+ SdrGrafObj* pNewObj = (SdrGrafObj*) m_pObj->Clone();
+ String aStr( m_pView->GetDescriptionOfMarkedObjects() );
+ aStr.Append( sal_Unicode(' ') );
+ aStr.Append( String( "External Edit" ) );
+ m_pView->BegUndo( aStr );
+ pNewObj->SetGraphicObject( aGraphic );
+ m_pView->ReplaceObjectAtView( m_pObj, *pPageView, pNewObj );
+ m_pView->EndUndo();
+ }
+ }
+};
+
/*************************************************************************
|*
|* SfxRequests fuer temporaere Funktionen
@@ -950,6 +979,24 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
}
break;
+ case SID_EXTERNAL_EDIT:
+ {
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
+ {
+ GraphicObject aGraphicObject( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
+ SdExternalToolEdit* aExternalToolEdit = new SdExternalToolEdit( mpDrawView, pObj );
+ aExternalToolEdit->Edit( &aGraphicObject );
+ }
+ }
+ Cancel();
+ rReq.Ignore();
+ }
+ break;
+
case SID_COMPRESS_GRAPHIC:
{
const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
More information about the Libreoffice-commits
mailing list