[Libreoffice-commits] core.git: include/sfx2 include/svx sc/Library_sc.mk sc/source sd/source sfx2/sdi svx/inc svx/Library_svxcore.mk svx/sdi svx/source sw/source
Ariel Constenla-Haile
arielch at apache.org
Mon Jul 1 08:47:26 PDT 2013
include/sfx2/sfxcommands.h | 1
include/svx/galbrws.hxx | 9
include/svx/gallery.hxx | 28 -
include/svx/galleryitem.hxx | 76 ++
include/svx/svxcommands.h | 2
sc/Library_sc.mk | 1
sc/source/ui/app/typemap.cxx | 1
sc/source/ui/view/galwrap.cxx | 64 --
sc/source/ui/view/tabvwsh9.cxx | 68 --
sd/source/core/typemap.cxx | 1
sd/source/ui/animations/CustomAnimationDialog.cxx | 2
sd/source/ui/animations/SlideTransitionPane.cxx | 2
sd/source/ui/view/drviews9.cxx | 199 +++----
sfx2/sdi/sfx.sdi | 28 -
svx/Library_svxcore.mk | 1
svx/inc/GalleryControl.hxx | 5
svx/inc/galbrws2.hxx | 24
svx/sdi/svx.sdi | 35 +
svx/sdi/svxitems.sdi | 2
svx/source/gallery2/GalleryControl.cxx | 34 -
svx/source/gallery2/galbrws.cxx | 28 -
svx/source/gallery2/galbrws2.cxx | 572 ++++++++++++++++------
svx/source/gallery2/galexpl.cxx | 105 ----
svx/source/items/galleryitem.cxx | 179 ++++++
sw/source/ui/shells/basesh.cxx | 68 +-
sw/source/ui/shells/slotadd.cxx | 1
26 files changed, 916 insertions(+), 620 deletions(-)
New commits:
commit b9ebdadf5a6ebf22b4df7589d86dd8fdfb675b1e
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Tue May 7 05:39:15 2013 +0000
Resolves: fdo#66027 #i122116# Remove GalleryExplorer member functions
(cherry picked from commit e94681fb47e3c5bdba486cd8feca92705d44840d)
Conflicts:
sc/source/ui/app/typemap.cxx
sc/source/ui/view/galwrap.cxx
sc/source/ui/view/makefile.mk
sc/source/ui/view/tabvwsh9.cxx
sd/source/ui/view/drviews9.cxx
svx/Package_inc.mk
svx/inc/GalleryControl.hxx
svx/inc/galbrws2.hxx
svx/inc/svx/galbrws.hxx
svx/inc/svx/gallery.hxx
svx/source/gallery2/GalleryControl.cxx
svx/source/gallery2/galbrws.cxx
svx/source/gallery2/galbrws2.cxx
svx/source/gallery2/galexpl.cxx
sw/source/ui/shells/basesh.cxx
Change-Id: I49c2b99ca551f058b852c0e5e28cc2fe8c205031
diff --git a/include/sfx2/sfxcommands.h b/include/sfx2/sfxcommands.h
index 3f4df5c..78cbd7a 100644
--- a/include/sfx2/sfxcommands.h
+++ b/include/sfx2/sfxcommands.h
@@ -41,6 +41,7 @@
#define CMD_SID_OBJECT ".uno:ObjectMenue"
#define CMD_SID_OPENDOC ".uno:Open"
#define CMD_SID_WEBHTML ".uno:WebHtml"
+#define CMD_SID_GALLERY_BG_BRUSH ".uno:BackgroundImage"
#define CMD_SID_OPENHYPERLINK ".uno:OpenHyperlink"
#define CMD_SID_DOCINFO_TITLE ".uno:DocInfoTitle"
#define CMD_SID_OPENTEMPLATE ".uno:OpenTemplate"
diff --git a/include/svx/galbrws.hxx b/include/svx/galbrws.hxx
index 3eebaf6..2dffc16 100644
--- a/include/svx/galbrws.hxx
+++ b/include/svx/galbrws.hxx
@@ -26,8 +26,6 @@
#include <tools/urlobj.hxx>
#include "svx/svxdllapi.h"
-#define GALLERYBROWSER() ((GalleryBrowser*)( SfxViewFrame::Current()->GetChildWindow(GalleryChildWindow::GetChildWindowId())->GetWindow()))
-
class SVX_DLLPUBLIC GalleryChildWindow : public SfxChildWindow
{
public:
@@ -76,12 +74,7 @@ public:
Window* pParent, const ResId& rResId );
~GalleryBrowser();
- INetURLObject GetURL() const;
- String GetFilterName() const;
- Graphic GetGraphic() const;
- sal_Bool IsLinkage() const;
-
- sal_Bool KeyInput( const KeyEvent& rKEvt, Window* pWindow );
+ sal_Bool KeyInput( const KeyEvent& rKEvt, Window* pWindow );
};
#endif // _SVX_GALBRWS_HXX_
diff --git a/include/svx/gallery.hxx b/include/svx/gallery.hxx
index 778474b..1fbec79 100644
--- a/include/svx/gallery.hxx
+++ b/include/svx/gallery.hxx
@@ -26,16 +26,6 @@
#include <vector>
#include "svx/svxdllapi.h"
-#define SGA_FORMAT_NONE 0x00000000L
-#define SGA_FORMAT_STRING 0x00000001L
-#define SGA_FORMAT_GRAPHIC 0x00000010L
-#define SGA_FORMAT_SOUND 0x00000100L
-#define SGA_FORMAT_OLE 0x00001000L
-#define SGA_FORMAT_SVDRAW 0x00010000L
-#define SGA_FORMAT_ALL 0xFFFFFFFFL
-
-#define SVX_GALLERY() (GalleryExplorer::GetGallery())
-
// Defines for preinstalled themes
// Has to be in sync with svx/inc/galtheme.hrc
#define GALLERY_THEME_3D 1
@@ -60,21 +50,8 @@ class OutputDevice;
class SVX_DLLPUBLIC GalleryExplorer
{
-private:
-
- SVX_DLLPRIVATE static Gallery* ImplGetGallery();
-
public:
- static GalleryExplorer* GetGallery();
-
-public:
-
- INetURLObject GetURL() const;
- String GetFilterName() const;
- Graphic GetGraphic() const;
- sal_Bool IsLinkage() const;
-
static bool FillThemeList( std::vector<String>& rThemeList );
// FillObjList is filling rObjList with Strings of the internal Gallery Object URL
@@ -88,11 +65,6 @@ public:
static sal_Bool InsertURL( const String& rThemeName, const String& rURL );
static sal_Bool InsertURL( sal_uIntPtr nThemeId, const String& rURL );
- static sal_Bool InsertURL( const String& rThemeName, const String& rURL,
- const sal_uIntPtr nSgaFormat /* = SGA_FORMAT_ALL */ );
- static sal_Bool InsertURL( sal_uIntPtr nThemeId, const String& rURL,
- const sal_uIntPtr nSgaFormat /* = SGA_FORMAT_ALL */ );
-
static sal_Bool GetGraphicObj( const String& rThemeName, sal_uIntPtr nPos,
Graphic* pGraphic = NULL, BitmapEx* pThumb = NULL,
sal_Bool bProgess = sal_False );
diff --git a/include/svx/galleryitem.hxx b/include/svx/galleryitem.hxx
new file mode 100644
index 0000000..738eede
--- /dev/null
+++ b/include/svx/galleryitem.hxx
@@ -0,0 +1,76 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_GALLERYITEMITEM_HXX
+#define _SVX_GALLERYITEMITEM_HXX
+
+#include <svx/svxdllapi.h>
+#include <svl/poolitem.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+// property names map those from css::gallery::GalleryItem
+// with exception of "AsLink" and "FilterName"
+#define SVXGALLERYITEM_TYPE "GalleryItemType"
+#define SVXGALLERYITEM_LINK "AsLink"
+#define SVXGALLERYITEM_URL "URL"
+#define SVXGALLERYITEM_FILTER "FilterName"
+#define SVXGALLERYITEM_DRAWING "Drawing"
+#define SVXGALLERYITEM_GRAPHIC "Graphic"
+#define SVXGALLERYITEM_PARAMS 6
+#define SVXGALLERYITEM_ARGNAME "GalleryItem"
+
+DBG_NAMEEX_VISIBILITY( SvxGalleryItem, SVX_DLLPUBLIC )
+
+class SVX_DLLPUBLIC SvxGalleryItem : public SfxPoolItem
+{
+ sal_Int8 m_nType;
+ sal_Bool m_bIsLink;
+ rtl::OUString m_aURL;
+ rtl::OUString m_aFilterName;
+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xDrawing;
+ com::sun::star::uno::Reference< com::sun::star::graphic::XGraphic > m_xGraphic;
+
+public:
+ TYPEINFO();
+
+ SvxGalleryItem();
+ SvxGalleryItem( const SvxGalleryItem& );
+ SvxGalleryItem( const sal_uInt16 nId );
+ ~SvxGalleryItem();
+
+ sal_Int8 GetType() const { return m_nType; }
+ sal_Bool IsLink() const { return m_bIsLink; }
+ const rtl::OUString GetURL() const { return m_aURL; }
+ const rtl::OUString GetFilterName() const { return m_aFilterName; }
+ const com::sun::star::uno::Reference< com::sun::star::lang::XComponent > GetDrawing() const { return m_xDrawing; }
+ const com::sun::star::uno::Reference< com::sun::star::graphic::XGraphic > GetGraphic() const { return m_xGraphic; }
+
+ // pure virtual methods from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ // bridge to UNO
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ // not implemented
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+};
+
+#endif
diff --git a/include/svx/svxcommands.h b/include/svx/svxcommands.h
index 266d3d6..61cbd2c 100644
--- a/include/svx/svxcommands.h
+++ b/include/svx/svxcommands.h
@@ -80,6 +80,8 @@
#define CMD_SID_ATTRIBUTES_LINE ".uno:FormatLine"
#define CMD_SID_FM_FORMATTEDFIELD ".uno:FormattedField"
#define CMD_SID_UNGROUP ".uno:FormatUngroup"
+#define CMD_SID_GALLERY_ENABLE_ADDCOPY ".uno:GalleryEnableAddCopy"
+#define CMD_SID_GALLERY_FORMATS ".uno:InsertGalleryPic"
#define CMD_SID_ATTR_GRAF_CROP ".uno:GrafAttrCrop"
#define CMD_SID_GRFFILTER_MOSAIC ".uno:GraphicFilterMosaic"
#define CMD_SID_GRFFILTER_POSTER ".uno:GraphicFilterPoster"
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index c1d12a2..836f87f 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -549,7 +549,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/view/drawview \
sc/source/ui/view/editsh \
sc/source/ui/view/formatsh \
- sc/source/ui/view/galwrap \
sc/source/ui/view/gridmerg \
sc/source/ui/view/gridwin \
sc/source/ui/view/gridwin2 \
diff --git a/sc/source/ui/app/typemap.cxx b/sc/source/ui/app/typemap.cxx
index b5e1d96..1972d52 100644
--- a/sc/source/ui/app/typemap.cxx
+++ b/sc/source/ui/app/typemap.cxx
@@ -88,6 +88,7 @@
#include <svx/xlncapit.hxx>
#include <svx/xlinjoit.hxx>
#include <svx/AffineMatrixItem.hxx>
+#include <svx/galleryitem.hxx>
// #i25616#
#include <svx/sdshitm.hxx>
diff --git a/sc/source/ui/view/galwrap.cxx b/sc/source/ui/view/galwrap.cxx
deleted file mode 100644
index 5c9deba..0000000
--- a/sc/source/ui/view/galwrap.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <vcl/graph.hxx>
-#include <svx/gallery.hxx>
-#include <sfx2/app.hxx>
-
-// -----------------------------------------------------------------------
-
-Graphic GalleryGetGraphic()
-{
- GalleryExplorer* pGal = SVX_GALLERY();
- OSL_ENSURE( pGal, "Wo ist die Gallery?" );
- return pGal->GetGraphic();
-}
-
-sal_uInt16 GallerySGA_FORMAT_GRAPHIC()
-{
- return SGA_FORMAT_GRAPHIC;
-}
-
-sal_Bool GalleryIsLinkage()
-{
- GalleryExplorer* pGal = SVX_GALLERY();
- OSL_ENSURE( pGal, "Wo ist die Gallery?" );
- return pGal->IsLinkage();
-}
-
-String GalleryGetFullPath()
-{
- GalleryExplorer* pGal = SVX_GALLERY();
- OSL_ENSURE( pGal, "Wo ist die Gallery?" );
-
- return pGal->GetURL().GetMainURL(INetURLObject::NO_DECODE);
- // URL as stored in GraphicLink must be encoded
-}
-
-String GalleryGetFilterName()
-{
- GalleryExplorer* pGal = SVX_GALLERY();
- OSL_ENSURE( pGal, "Wo ist die Gallery?" );
- return pGal->GetFilterName();
-}
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabvwsh9.cxx b/sc/source/ui/view/tabvwsh9.cxx
index 66a6000..b573b98 100644
--- a/sc/source/ui/view/tabvwsh9.cxx
+++ b/sc/source/ui/view/tabvwsh9.cxx
@@ -35,13 +35,8 @@
#include "userdat.hxx"
#include "docsh.hxx"
-// forwards (apparently because of ancient compiler limits not in headers!?)
-
-sal_uInt16 GallerySGA_FORMAT_GRAPHIC();
-Graphic GalleryGetGraphic ();
-sal_Bool GalleryIsLinkage ();
-String GalleryGetFullPath ();
-String GalleryGetFilterName ();
+#include <svx/galleryitem.hxx>
+#include <com/sun/star/gallery/GalleryItemType.hpp>
class SvxIMapDlg;
@@ -83,46 +78,33 @@ void ScTabViewShell::ExecGallery( SfxRequest& rReq )
{
const SfxItemSet* pArgs = rReq.GetArgs();
- if ( pArgs )
- {
- const SfxPoolItem* pItem = NULL;
- SfxItemState eState = pArgs->GetItemState(SID_GALLERY_FORMATS, sal_True, &pItem);
- if ( eState == SFX_ITEM_SET )
- {
- sal_uInt32 nFormats = ((const SfxUInt32Item*)pItem)->GetValue();
-
- /******************************************************************
- * Graphik einfuegen
- ******************************************************************/
- if ( nFormats & GallerySGA_FORMAT_GRAPHIC() )
- {
- MakeDrawLayer();
+ SFX_ITEMSET_ARG( pArgs, pGalleryItem, SvxGalleryItem, SID_GALLERY_FORMATS, sal_False );
+ if ( !pGalleryItem )
+ return;
- Graphic aGraphic = GalleryGetGraphic();
- Point aPos = GetInsertPos();
-
- String aPath, aFilter;
- if ( GalleryIsLinkage() ) // als Link einfuegen?
- {
- aPath = GalleryGetFullPath();
- aFilter = GalleryGetFilterName();
- }
+ sal_Int8 nType( pGalleryItem->GetType() );
+ if ( nType == com::sun::star::gallery::GalleryItemType::GRAPHIC )
+ {
+ MakeDrawLayer();
- PasteGraphic( aPos, aGraphic, aPath, aFilter );
- }
- else if ( nFormats & SGA_FORMAT_SOUND )
- {
- // for sounds (linked or not), insert a hyperlink button,
- // like in Impress and Writer
+ Graphic aGraphic( pGalleryItem->GetGraphic() );
+ Point aPos = GetInsertPos();
- GalleryExplorer* pGal = SVX_GALLERY();
- if ( pGal )
- {
- const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
- GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
- }
- }
+ String aPath, aFilter;
+ if ( pGalleryItem->IsLink() ) // als Link einfuegen?
+ {
+ aPath = pGalleryItem->GetURL();
+ aFilter = pGalleryItem->GetFilterName();
}
+
+ PasteGraphic( aPos, aGraphic, aPath, aFilter );
+ }
+ else if ( nType == com::sun::star::gallery::GalleryItemType::MEDIA )
+ {
+ // for sounds (linked or not), insert a hyperlink button,
+ // like in Impress and Writer
+ const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGalleryItem->GetURL() );
+ GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
}
}
diff --git a/sd/source/core/typemap.cxx b/sd/source/core/typemap.cxx
index cc029fc..0eabb41 100644
--- a/sd/source/core/typemap.cxx
+++ b/sd/source/core/typemap.cxx
@@ -98,6 +98,7 @@
#include <svx/xflftrit.hxx>
#include <svx/xlinjoit.hxx>
#include <svx/AffineMatrixItem.hxx>
+#include <svx/galleryitem.hxx>
#define SFX_TYPEMAP
#include "sdslots.hxx"
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 8a861c2..6f1ca05 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -1751,7 +1751,7 @@ void CustomAnimationEffectTabPage::openSoundFileDialog()
if( nPos < 0 ) // not in Soundliste
{
// try to insert in Gallery
- if( GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aFile, SGA_FORMAT_SOUND ) )
+ if( GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aFile ) )
{
clearSoundListBox();
fillSoundListBox();
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index bcb4af2..eb638b7 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -964,7 +964,7 @@ void SlideTransitionPane::openSoundFileDialog()
else // not in sound list
{
// try to insert into gallery
- if( GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aFile, SGA_FORMAT_SOUND ) )
+ if( GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aFile ) )
{
updateSoundList();
bValidSoundFile = lcl_findSoundInList( maSoundList, aFile, nPos );
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
index b69db95..b6ccd5e 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -57,6 +57,9 @@
#include "sdresid.hxx"
#include "fupoor.hxx"
+#include <svx/galleryitem.hxx>
+#include <com/sun/star/gallery/GalleryItemType.hpp>
+
namespace sd {
@@ -68,125 +71,121 @@ void DrawViewShell::ExecGallery(SfxRequest& rReq)
const SfxItemSet* pArgs = rReq.GetArgs();
- if ( pArgs )
- {
- const sal_uInt32 nFormats = ( (SfxUInt32Item&) pArgs->Get( SID_GALLERY_FORMATS ) ).GetValue();
- GalleryExplorer* pGal = SVX_GALLERY();
+ SFX_ITEMSET_ARG( pArgs, pGalleryItem, SvxGalleryItem, SID_GALLERY_FORMATS, sal_False );
+ if ( !pGalleryItem )
+ return;
- if ( pGal )
+ GetDocSh()->SetWaitCursor( sal_True );
+
+ sal_Int8 nType( pGalleryItem->GetType() );
+ // insert graphic
+ if (nType == com::sun::star::gallery::GalleryItemType::GRAPHIC)
+ {
+ Graphic aGraphic( pGalleryItem->GetGraphic() );
+
+ // reduce size if necessary
+ Window aWindow (GetActiveWindow());
+ aWindow.SetMapMode(aGraphic.GetPrefMapMode());
+ Size aSizePix = aWindow.LogicToPixel(aGraphic.GetPrefSize());
+ aWindow.SetMapMode( MapMode(MAP_100TH_MM) );
+ Size aSize = aWindow.PixelToLogic(aSizePix);
+
+ // constrain size to page size if necessary
+ SdrPage* pPage = mpDrawView->GetSdrPageView()->GetPage();
+ Size aPageSize = pPage->GetSize();
+ aPageSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder();
+ aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder();
+
+
+ // Falls Grafik zu gross, wird die Grafik
+ // in die Seite eingepasst
+ if ( ( ( aSize.Height() > aPageSize.Height() ) || ( aSize.Width() > aPageSize.Width() ) ) &&
+ aSize.Height() && aPageSize.Height() )
{
- GetDocSh()->SetWaitCursor( sal_True );
+ float fGrfWH = (float)aSize.Width() /
+ (float)aSize.Height();
+ float fWinWH = (float)aPageSize.Width() /
+ (float)aPageSize.Height();
- // insert graphic
- if (nFormats & SGA_FORMAT_GRAPHIC)
+ // constrain size to page size if necessary
+ if ((fGrfWH != 0.F) && (fGrfWH < fWinWH))
{
- Graphic aGraphic = pGal->GetGraphic();
-
- // reduce size if necessary
- Window aWindow (GetActiveWindow());
- aWindow.SetMapMode(aGraphic.GetPrefMapMode());
- Size aSizePix = aWindow.LogicToPixel(aGraphic.GetPrefSize());
- aWindow.SetMapMode( MapMode(MAP_100TH_MM) );
- Size aSize = aWindow.PixelToLogic(aSizePix);
-
- // constrain size to page size if necessary
- SdrPage* pPage = mpDrawView->GetSdrPageView()->GetPage();
- Size aPageSize = pPage->GetSize();
- aPageSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder();
- aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder();
-
-
- // if the graphic is to big, we fit it into the page
- if ( ( ( aSize.Height() > aPageSize.Height() ) || ( aSize.Width() > aPageSize.Width() ) ) &&
- aSize.Height() && aPageSize.Height() )
- {
- float fGrfWH = (float)aSize.Width() /
- (float)aSize.Height();
- float fWinWH = (float)aPageSize.Width() /
- (float)aPageSize.Height();
+ aSize.Width() = (long)(aPageSize.Height() * fGrfWH);
+ aSize.Height()= aPageSize.Height();
+ }
+ else
+ {
+ aSize.Width() = aPageSize.Width();
+ aSize.Height()= (long)(aPageSize.Width() / fGrfWH);
+ }
+ }
- // adjust graphic to page size (scales)
- if ((fGrfWH != 0.F) && (fGrfWH < fWinWH))
- {
- aSize.Width() = (long)(aPageSize.Height() * fGrfWH);
- aSize.Height()= aPageSize.Height();
- }
- else
- {
- aSize.Width() = aPageSize.Width();
- aSize.Height()= (long)(aPageSize.Width() / fGrfWH);
- }
- }
+ // set output rectangle for graphic
+ Point aPnt ((aPageSize.Width() - aSize.Width()) / 2,
+ (aPageSize.Height() - aSize.Height()) / 2);
+ aPnt += Point(pPage->GetLftBorder(), pPage->GetUppBorder());
+ Rectangle aRect (aPnt, aSize);
+ SdrGrafObj* pGrafObj = NULL;
- // set output rectangle for graphic
- Point aPnt ((aPageSize.Width() - aSize.Width()) / 2,
- (aPageSize.Height() - aSize.Height()) / 2);
- aPnt += Point(pPage->GetLftBorder(), pPage->GetUppBorder());
- Rectangle aRect (aPnt, aSize);
+ sal_Bool bInsertNewObject = sal_True;
- SdrGrafObj* pGrafObj = NULL;
+ if ( mpDrawView->AreObjectsMarked() )
+ {
+ // is there a empty graphic object?
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
- sal_Bool bInsertNewObject = sal_True;
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
- if ( mpDrawView->AreObjectsMarked() )
+ if (pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF)
{
- // is there a empty graphic object?
- const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ pGrafObj = (SdrGrafObj*) pObj;
- if (rMarkList.GetMarkCount() == 1)
+ if( pGrafObj->IsEmptyPresObj() )
{
- SdrMark* pMark = rMarkList.GetMark(0);
- SdrObject* pObj = pMark->GetMarkedSdrObj();
-
- if (pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF)
- {
- pGrafObj = (SdrGrafObj*) pObj;
-
- if( pGrafObj->IsEmptyPresObj() )
- {
- // the empty graphic object gets a new graphic
- bInsertNewObject = sal_False;
-
- SdrGrafObj* pNewGrafObj = (SdrGrafObj*) pGrafObj->Clone();
- pNewGrafObj->SetEmptyPresObj(sal_False);
- pNewGrafObj->SetOutlinerParaObject(NULL);
- pNewGrafObj->SetGraphic(aGraphic);
-
- String aStr(mpDrawView->GetDescriptionOfMarkedObjects());
- aStr += sal_Unicode(' ');
- aStr += String(SdResId(STR_UNDO_REPLACE));
- mpDrawView->BegUndo(aStr);
- SdrPageView* pPV = mpDrawView->GetSdrPageView();
- mpDrawView->ReplaceObjectAtView(pGrafObj, *pPV, pNewGrafObj);
- mpDrawView->EndUndo();
- }
- }
+ // the empty graphic object gets a new graphic
+ bInsertNewObject = sal_False;
+
+ SdrGrafObj* pNewGrafObj = (SdrGrafObj*) pGrafObj->Clone();
+ pNewGrafObj->SetEmptyPresObj(sal_False);
+ pNewGrafObj->SetOutlinerParaObject(NULL);
+ pNewGrafObj->SetGraphic(aGraphic);
+
+ String aStr(mpDrawView->GetDescriptionOfMarkedObjects());
+ aStr += sal_Unicode(' ');
+ aStr += String(SdResId(STR_UNDO_REPLACE));
+ mpDrawView->BegUndo(aStr);
+ SdrPageView* pPV = mpDrawView->GetSdrPageView();
+ mpDrawView->ReplaceObjectAtView(pGrafObj, *pPV, pNewGrafObj);
+ mpDrawView->EndUndo();
}
}
-
-
- if( bInsertNewObject )
- {
- pGrafObj = new SdrGrafObj(aGraphic, aRect);
- SdrPageView* pPV = mpDrawView->GetSdrPageView();
- mpDrawView->InsertObjectAtView(pGrafObj, *pPV, SDRINSERT_SETDEFLAYER);
- }
-
- // should we just use a link?
- if( pGrafObj && pGal->IsLinkage() )
- pGrafObj->SetGraphicLink( pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ), pGal->GetFilterName() );
- }
- // insert sound
- else if( nFormats & SGA_FORMAT_SOUND )
- {
- const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
- GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
}
+ }
+
- GetDocSh()->SetWaitCursor( sal_False );
+ if( bInsertNewObject )
+ {
+ pGrafObj = new SdrGrafObj(aGraphic, aRect);
+ SdrPageView* pPV = mpDrawView->GetSdrPageView();
+ mpDrawView->InsertObjectAtView(pGrafObj, *pPV, SDRINSERT_SETDEFLAYER);
}
+
+ // Soll nur ein Link benutzt werden?
+ if( pGrafObj && pGalleryItem->IsLink() )
+ pGrafObj->SetGraphicLink( pGalleryItem->GetURL(), pGalleryItem->GetFilterName() );
}
+ // insert sound
+ else if( nType == com::sun::star::gallery::GalleryItemType::MEDIA )
+ {
+ const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGalleryItem->GetURL() );
+ GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
+ }
+
+ GetDocSh()->SetWaitCursor( sal_False );
}
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 63ab2fc..e777230 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -469,34 +469,6 @@ SfxVoidItem AutoPilotMenu SID_AUTOPILOTMENU
]
//--------------------------------------------------------------------------
-SfxVoidItem BackgroundImage SID_GALLERY_BG_BRUSH
-(SfxStringItem ImageFile SID_FILE_NAME)
-[
- /* flags: */
- AutoUpdate = FALSE,
- Cachable = Cachable,
- FastCall = TRUE,
- HasCoreId = FALSE,
- HasDialog = FALSE,
- ReadOnlyDoc = FALSE,
- Toggle = FALSE,
- Container = FALSE,
- RecordAbsolute = FALSE,
- RecordPerSet;
- Synchron;
-
- /* status: */
- SlotType = SfxStringItem
-
- /* config: */
- AccelConfig = FALSE,
- MenuConfig = FALSE,
- StatusBarConfig = FALSE,
- ToolBoxConfig = FALSE,
- GroupId = GID_INSERT;
-]
-
-//--------------------------------------------------------------------------
SfxVoidItem Backspace SID_BACKSPACE
()
[
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 30a33a4..299768d 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -135,6 +135,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/items/customshapeitem \
svx/source/items/drawitem \
svx/source/items/e3ditem \
+ svx/source/items/galleryitem \
svx/source/items/grfitem \
svx/source/sdr/animation/scheduler \
svx/source/sdr/animation/objectanimator \
diff --git a/svx/inc/GalleryControl.hxx b/svx/inc/GalleryControl.hxx
index 0617bf1..6a88991 100644
--- a/svx/inc/GalleryControl.hxx
+++ b/svx/inc/GalleryControl.hxx
@@ -63,11 +63,6 @@ private:
protected:
void ThemeSelectionHasChanged (void);
-
- INetURLObject GetURL (void) const;
- String GetFilterName (void) const;
- Graphic GetGraphic (void) const;
- sal_Bool IsLinkage (void) const;
};
} } // end of namespace svx::sidebar
diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx
index a3be597..f347bf2 100644
--- a/svx/inc/galbrws2.hxx
+++ b/svx/inc/galbrws2.hxx
@@ -30,6 +30,9 @@
#include <svtools/miscopt.hxx>
#include "svx/galbrws.hxx"
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+
// ----------------------
// - GalleryBrowserMode -
// ----------------------
@@ -90,6 +93,7 @@ class GalleryListView;
class GalleryPreview;
class Menu;
class SgaObject;
+struct DispatchInfo;
namespace svx { namespace sidebar { class GalleryControl; } }
@@ -115,7 +119,9 @@ private:
sal_uIntPtr mnCurActionPos;
GalleryBrowserMode meMode;
GalleryBrowserMode meLastMode;
- sal_Bool mbCurActionIsLinkage;
+
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
+ com::sun::star::uno::Reference< com::sun::star::util::XURLTransformer > m_xTransformer;
void InitSettings();
@@ -123,7 +129,6 @@ private:
void ImplUpdateInfoBar();
sal_uIntPtr ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos );
void ImplSelectItemId( sal_uIntPtr nItemId );
- void ImplExecute( sal_uInt16 nId );
// Control
virtual void Resize();
@@ -132,7 +137,6 @@ private:
// SfxListener
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
- DECL_LINK( MenuSelectHdl, Menu* pMenu );
DECL_LINK( SelectObjectHdl, void* );
DECL_LINK( SelectTbxHdl, ToolBox* );
DECL_LINK( MiscHdl, void* );
@@ -162,14 +166,24 @@ public:
INetURLObject GetURL() const;
String GetFilterName() const;
Graphic GetGraphic() const;
- sal_Bool IsLinkage() const;
sal_Int8 AcceptDrop( DropTargetHelper& rTarget, const AcceptDropEvent& rEvt );
sal_Int8 ExecuteDrop( DropTargetHelper& rTarget, const ExecuteDropEvent& rEvt );
void StartDrag( Window* pWindow, const Point* pDragPoint = NULL );
void TogglePreview( Window* pWindow, const Point* pPreviewPoint = NULL );
void ShowContextMenu( Window* pWindow, const Point* pContextPoint = NULL );
- sal_Bool KeyInput( const KeyEvent& rEvt, Window* pWindow );
+ sal_Bool KeyInput( const KeyEvent& rEvt, Window* pWindow );
+
+ com::sun::star::uno::Reference< com::sun::star::frame::XFrame > GetFrame() const;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > GetUNOContext() const { return m_xContext; }
+ com::sun::star::uno::Reference< com::sun::star::util::XURLTransformer > GetURLTransformer() const { return m_xTransformer; }
+
+ void Execute( sal_uInt16 nId );
+ void Dispatch( sal_uInt16 nId,
+ const com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > &rxDispatch = com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >(),
+ const com::sun::star::util::URL &rURL = com::sun::star::util::URL() );
+
+ DECL_STATIC_LINK( GalleryBrowser2, AsyncDispatch_Impl, DispatchInfo* );
};
#endif
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 7f286fd..4b410e3 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -405,6 +405,35 @@ SfxVoidItem AutoFormat SID_AUTOFORMAT
//--------------------------------------------------------------------------
+SfxVoidItem BackgroundImage SID_GALLERY_BG_BRUSH
+(SvxBrushItem Background SID_GALLERY_BG_BRUSH, SfxUInt16Item Position SID_GALLERY_BG_POS)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+
SfxStringItem TableStyle SID_TABLE_STYLE
()
[
@@ -6338,13 +6367,13 @@ SfxVoidItem PreviousAnnotation SID_PREVIOUS_POSTIT
]
//--------------------------------------------------------------------------
-SfxUInt32Item InsertGalleryPic SID_GALLERY_FORMATS
-()
+SfxVoidItem InsertGalleryPic SID_GALLERY_FORMATS
+(SvxGalleryItem GalleryItem SID_GALLERY_FORMATS)
[
/* flags: */
AutoUpdate = FALSE,
Cachable = Cachable,
- FastCall = TRUE,
+ FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi
index 174af90..6d1c954 100644
--- a/svx/sdi/svxitems.sdi
+++ b/svx/sdi/svxitems.sdi
@@ -681,3 +681,5 @@ struct ZoomSlider
INT16 SvxMaxZoom MID_ZOOMSLIDER_MAXZOOM;
};
item ZoomSlider SvxZoomSliderItem;
+
+item String SvxGalleryItem; // dummy for sequence
diff --git a/svx/source/gallery2/GalleryControl.cxx b/svx/source/gallery2/GalleryControl.cxx
index 9c6356b..bb1090c 100644
--- a/svx/source/gallery2/GalleryControl.cxx
+++ b/svx/source/gallery2/GalleryControl.cxx
@@ -236,40 +236,6 @@ void GalleryControl::ThemeSelectionHasChanged (void)
}
-
-
-INetURLObject GalleryControl::GetURL (void) const
-{
- return mpBrowser2->GetURL();
-}
-
-
-
-
-String GalleryControl::GetFilterName (void) const
-{
- return mpBrowser2->GetFilterName();
-}
-
-
-
-
-Graphic GalleryControl::GetGraphic(void) const
-{
- return mpBrowser2->GetGraphic();
-}
-
-
-
-
-sal_Bool GalleryControl::IsLinkage (void) const
-{
- return mpBrowser2->IsLinkage();
-}
-
-
-
-
IMPL_LINK( GalleryControl, SplitHdl, void*, EMPTYARG )
{
if(mpSplitter->IsHorizontal())
diff --git a/svx/source/gallery2/galbrws.cxx b/svx/source/gallery2/galbrws.cxx
index 7435788..85647f4 100644
--- a/svx/source/gallery2/galbrws.cxx
+++ b/svx/source/gallery2/galbrws.cxx
@@ -260,34 +260,6 @@ void GalleryBrowser::ThemeSelectionHasChanged()
// -----------------------------------------------------------------------------
-INetURLObject GalleryBrowser::GetURL() const
-{
- return mpBrowser2->GetURL();
-}
-
-// -----------------------------------------------------------------------------
-
-String GalleryBrowser::GetFilterName() const
-{
- return mpBrowser2->GetFilterName();
-}
-
-// -----------------------------------------------------------------------------
-
-Graphic GalleryBrowser::GetGraphic() const
-{
- return mpBrowser2->GetGraphic();
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool GalleryBrowser::IsLinkage() const
-{
- return mpBrowser2->IsLinkage();
-}
-
-// -----------------------------------------------------------------------------
-
IMPL_LINK_NOARG(GalleryBrowser, SplitHdl)
{
if(mpSplitter->IsHorizontal())
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 7ca1a74..fa960a3 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -48,115 +48,202 @@
#include <svx/dialogs.hrc>
#include "GalleryControl.hxx"
+#include <svx/svxcommands.h>
+#include <svx/galleryitem.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/gallery/GalleryItemType.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/style/GraphicLocation.hpp>
+#include <map>
+
#undef GALLERY_USE_CLIPBOARD
#define TBX_ID_ICON 1
#define TBX_ID_LIST 2
+namespace css = ::com::sun::star;
+using rtl::OUString;
+
GalleryBrowserMode GalleryBrowser2::meInitMode = GALLERYBROWSERMODE_ICON;
-class GalleryBackgroundPopup : public PopupMenu, public SfxControllerItem
+struct DispatchInfo
+{
+ css::util::URL TargetURL;
+ css::uno::Sequence< css::beans::PropertyValue > Arguments;
+ css::uno::Reference< css::frame::XDispatch > Dispatch;
+};
+
+IMPL_STATIC_LINK_NOINSTANCE( GalleryBrowser2, AsyncDispatch_Impl, DispatchInfo*, pDispatchInfo )
{
+ if ( pDispatchInfo && pDispatchInfo->Dispatch.is() )
+ {
+ try
+ {
+ pDispatchInfo->Dispatch->dispatch( pDispatchInfo->TargetURL,
+ pDispatchInfo->Arguments );
+ }
+ catch ( const css::uno::Exception& )
+ {
+ }
+ }
+
+ delete pDispatchInfo;
+ return 0;
+}
+
+namespace
+{
+
+struct CommandInfo
+{
+ css::util::URL URL;
+ css::uno::Reference< css::frame::XDispatch > Dispatch;
+
+ CommandInfo( const OUString &rURL )
+ {
+ URL.Complete = rURL;
+ }
+};
+
+class GalleryThemePopup : public ::cppu::WeakImplHelper1< css::frame::XStatusListener >
+{
+private:
const GalleryTheme* mpTheme;
- sal_uIntPtr mnObjectPos;
+ sal_uIntPtr mnObjectPos;
+ sal_Bool mbPreview;
+ PopupMenu maPopupMenu;
+ PopupMenu maBackgroundPopup;
+ GalleryBrowser2* mpBrowser;
- virtual void Select();
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ typedef std::map< int, CommandInfo > CommandInfoMap;
+ CommandInfoMap m_aCommandInfo;
+ void Execute( const CommandInfo &rCmdInfo,
+ const css::uno::Sequence< css::beans::PropertyValue > &rArguments );
+
+ DECL_LINK( MenuSelectHdl, Menu* pMenu );
+ DECL_LINK( BackgroundMenuSelectHdl, Menu* pMenu );
public:
+ GalleryThemePopup( const GalleryTheme* pTheme,
+ sal_uIntPtr nObjectPos,
+ sal_Bool bPreview,
+ GalleryBrowser2* pBrowser );
+ ~GalleryThemePopup();
+
+ void ExecutePopup( Window *pParent, const ::Point &aPos );
- GalleryBackgroundPopup( const GalleryTheme* pTheme, sal_uIntPtr nObjectPos );
- ~GalleryBackgroundPopup();
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent &rEvent) throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL disposing( const css::lang::EventObject &rSource) throw ( css::uno::RuntimeException );
};
-DBG_NAME(GalleryBackgroundPopup)
+DBG_NAME(GalleryThemePopup)
-GalleryBackgroundPopup::GalleryBackgroundPopup( const GalleryTheme* pTheme, sal_uIntPtr nObjectPos ) :
- SfxControllerItem ( SID_GALLERY_BG_BRUSH, SfxViewFrame::Current()->GetBindings() ),
- mpTheme ( pTheme ),
- mnObjectPos ( nObjectPos )
+GalleryThemePopup::GalleryThemePopup(
+ const GalleryTheme* pTheme,
+ sal_uIntPtr nObjectPos,
+ sal_Bool bPreview,
+ GalleryBrowser2* pBrowser )
+ : mpTheme( pTheme )
+ , mnObjectPos( nObjectPos )
+ , mbPreview( bPreview )
+ , maPopupMenu( GAL_RES( RID_SVXMN_GALLERY2 ) )
+ , maBackgroundPopup()
+ , mpBrowser( pBrowser )
{
- DBG_CTOR(GalleryBackgroundPopup,NULL);
- SfxViewFrame::Current()->GetBindings().Update( SID_GALLERY_BG_BRUSH );
- RemoveDisabledEntries();
+ DBG_CTOR(GalleryThemePopup,NULL);
+
+ // SID_GALLERY_ENABLE_ADDCOPY
+ m_aCommandInfo.insert(
+ CommandInfoMap::value_type(
+ SID_GALLERY_ENABLE_ADDCOPY,
+ CommandInfo( OUString(CMD_SID_GALLERY_ENABLE_ADDCOPY ))));
+ // SID_GALLERY_BG_BRUSH
+ m_aCommandInfo.insert(
+ CommandInfoMap::value_type(
+ SID_GALLERY_BG_BRUSH,
+ CommandInfo(OUString(CMD_SID_GALLERY_BG_BRUSH ))));
+ // SID_GALLERY_FORMATS
+ m_aCommandInfo.insert(
+ CommandInfoMap::value_type(
+ SID_GALLERY_FORMATS,
+ CommandInfo(OUString(CMD_SID_GALLERY_FORMATS ))));
+
}
-GalleryBackgroundPopup::~GalleryBackgroundPopup()
+GalleryThemePopup::~GalleryThemePopup()
{
- DBG_DTOR(GalleryBackgroundPopup,NULL);
+ DBG_DTOR(GalleryThemePopup,NULL);
}
-void GalleryBackgroundPopup::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pItem )
+void SAL_CALL GalleryThemePopup::statusChanged(
+ const css::frame::FeatureStateEvent &rEvent )
+throw ( css::uno::RuntimeException )
{
- if ( ( nSID == SID_GALLERY_BG_BRUSH ) && pItem && ( eState != SFX_ITEM_DISABLED ) )
+ const OUString &rURL = rEvent.FeatureURL.Complete;
+ if ( rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( CMD_SID_GALLERY_ENABLE_ADDCOPY ) ) )
{
- SfxStringListItem* pStrLstItem;
-
- PopupMenu::Clear();
-
- if ( ( pStrLstItem = PTR_CAST( SfxStringListItem, pItem ) ) != NULL )
+ if ( !rEvent.IsEnabled )
{
- const std::vector<OUString> &aList = pStrLstItem->GetList();
-
- for ( sal_uIntPtr i = 0, nCount = aList.size(); i < nCount; i++ )
- InsertItem( (sal_uInt16) i + 1, aList[i]);
- return;
+ PopupMenu *pAddMenu = maPopupMenu.GetPopupMenu( MN_ADDMENU );
+ pAddMenu->EnableItem( MN_ADD, sal_False );
+ pAddMenu->EnableItem( MN_ADD_LINK, sal_False );
}
- SfxStringItem* pStrItem = PTR_CAST( SfxStringItem, pItem );
- if (pStrItem)
- InsertItem( 1, pStrItem->GetValue() );
- else
+ }
+ else if ( rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( CMD_SID_GALLERY_BG_BRUSH ) ) )
+ {
+ maBackgroundPopup.Clear();
+ if ( rEvent.IsEnabled )
{
- OSL_FAIL( "SgaBGPopup::StateChanged(...): Wrong item type!" );
+ OUString sItem;
+ css::uno::Sequence< OUString > sItems;
+ if ( ( rEvent.State >>= sItem ) && sItem.getLength() )
+ {
+ maBackgroundPopup.InsertItem( 1, sItem );
+ }
+ else if ( ( rEvent.State >>= sItems ) && sItems.getLength() )
+ {
+ const OUString *pStr = sItems.getConstArray();
+ const OUString *pEnd = pStr + sItems.getLength();
+ for ( sal_uInt16 nId = 1; pStr != pEnd; pStr++, nId++ )
+ {
+ maBackgroundPopup.InsertItem( nId, *pStr );
+ }
+ }
}
}
}
-void GalleryBackgroundPopup::Select()
+void SAL_CALL GalleryThemePopup::disposing(
+ const css::lang::EventObject &/*rSource*/)
+throw ( css::uno::RuntimeException )
{
- Menu::Select();
-
- const INetURLObject aURL( mpTheme->GetObjectURL( mnObjectPos ) );
- const SvxBrushItem aBrushItem( aURL.GetMainURL( INetURLObject::NO_DECODE ), String(), GPOS_TILED, SID_GALLERY_BG_BRUSH );
- const SfxUInt16Item aPosItem( SID_GALLERY_BG_POS, GetCurItemId() - 1 );
- const SfxStringItem aPathItem( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::NO_DECODE ) );
-
- SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_GALLERY_BG_BRUSH,
- SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
- &aBrushItem, &aPosItem, &aPathItem, 0L );
}
-class GalleryThemePopup : public PopupMenu, public SfxControllerItem
+void GalleryThemePopup::Execute(
+ const CommandInfo &rCmdInfo,
+ const css::uno::Sequence< css::beans::PropertyValue > &rArguments )
{
- GalleryBackgroundPopup maBackgroundPopup;
- const GalleryTheme* mpTheme;
- sal_uIntPtr mnObjectPos;
- sal_Bool mbPreview;
-
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
-
-public:
-
- GalleryThemePopup( const GalleryTheme* pTheme, sal_uIntPtr nObjectPos, sal_Bool bPreview );
- ~GalleryThemePopup();
-};
-
-DBG_NAME(GalleryThemePopup)
+ if ( rCmdInfo.Dispatch.is() )
+ {
+ DispatchInfo *pInfo = new DispatchInfo;
+ pInfo->TargetURL = rCmdInfo.URL;
+ pInfo->Arguments = rArguments;
+ pInfo->Dispatch = rCmdInfo.Dispatch;
+
+ if ( !Application::PostUserEvent(
+ STATIC_LINK( 0, GalleryBrowser2, AsyncDispatch_Impl), pInfo ) )
+ delete pInfo;
+ }
+}
-GalleryThemePopup::GalleryThemePopup( const GalleryTheme* pTheme, sal_uIntPtr nObjectPos, sal_Bool bPreview ) :
- PopupMenu ( GAL_RES( RID_SVXMN_GALLERY2 ) ),
- SfxControllerItem ( SID_GALLERY_ENABLE_ADDCOPY, SfxViewFrame::Current()->GetBindings() ),
- maBackgroundPopup ( pTheme, nObjectPos ),
- mpTheme ( pTheme ),
- mnObjectPos ( nObjectPos ),
- mbPreview ( bPreview )
+void GalleryThemePopup::ExecutePopup( Window *pWindow, const ::Point &aPos )
{
- DBG_CTOR(GalleryThemePopup,NULL);
+ css::uno::Reference< css::frame::XStatusListener > xThis( this );
- const SgaObjKind eObjKind = mpTheme->GetObjectKind( mnObjectPos );
- PopupMenu* pAddMenu = GetPopupMenu( MN_ADDMENU );
- SfxBindings& rBindings = SfxViewFrame::Current()->GetBindings();
- INetURLObject aURL;
+ const SgaObjKind eObjKind = mpTheme->GetObjectKind( mnObjectPos );
+ PopupMenu* pAddMenu = maPopupMenu.GetPopupMenu( MN_ADDMENU );
+ INetURLObject aURL;
const_cast< GalleryTheme* >( mpTheme )->GetURL( mnObjectPos, aURL );
const sal_Bool bValidURL = ( aURL.GetProtocol() != INET_PROT_NOT_VALID );
@@ -164,35 +251,35 @@ GalleryThemePopup::GalleryThemePopup( const GalleryTheme* pTheme, sal_uIntPtr nO
pAddMenu->EnableItem( MN_ADD, bValidURL && SGA_OBJ_SOUND != eObjKind );
pAddMenu->EnableItem( MN_ADD_LINK, bValidURL && SGA_OBJ_SVDRAW != eObjKind );
- EnableItem( MN_ADDMENU, pAddMenu->IsItemEnabled( MN_ADD ) || pAddMenu->IsItemEnabled( MN_ADD_LINK ) );
- EnableItem( MN_PREVIEW, bValidURL );
+ maPopupMenu.EnableItem( MN_ADDMENU, pAddMenu->IsItemEnabled( MN_ADD ) || pAddMenu->IsItemEnabled( MN_ADD_LINK ) );
+ maPopupMenu.EnableItem( MN_PREVIEW, bValidURL );
- CheckItem( MN_PREVIEW, mbPreview );
+ maPopupMenu.CheckItem( MN_PREVIEW, mbPreview );
if( mpTheme->IsReadOnly() || !mpTheme->GetObjectCount() )
{
- EnableItem( MN_DELETE, sal_False );
- EnableItem( MN_TITLE, sal_False );
+ maPopupMenu.EnableItem( MN_DELETE, sal_False );
+ maPopupMenu.EnableItem( MN_TITLE, sal_False );
if( mpTheme->IsReadOnly() )
- EnableItem( MN_PASTECLIPBOARD, sal_False );
+ maPopupMenu.EnableItem( MN_PASTECLIPBOARD, sal_False );
if( !mpTheme->GetObjectCount() )
- EnableItem( MN_COPYCLIPBOARD, sal_False );
+ maPopupMenu.EnableItem( MN_COPYCLIPBOARD, sal_False );
}
else
{
- EnableItem( MN_DELETE, !bPreview );
- EnableItem( MN_TITLE, sal_True );
- EnableItem( MN_COPYCLIPBOARD, sal_True );
- EnableItem( MN_PASTECLIPBOARD, sal_True );
+ maPopupMenu.EnableItem( MN_DELETE, !mbPreview );
+ maPopupMenu.EnableItem( MN_TITLE, sal_True );
+ maPopupMenu.EnableItem( MN_COPYCLIPBOARD, sal_True );
+ maPopupMenu.EnableItem( MN_PASTECLIPBOARD, sal_True );
}
#ifdef GALLERY_USE_CLIPBOARD
- if( IsItemEnabled( MN_PASTECLIPBOARD ) )
+ if( maPopupMenu.IsItemEnabled( MN_PASTECLIPBOARD ) )
{
- TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( this ) );
- sal_Bool bEnable = sal_False;
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( this ) );
+ sal_Bool bEnable = sal_False;
if( aDataHelper.GetFormatCount() )
{
@@ -208,43 +295,121 @@ GalleryThemePopup::GalleryThemePopup( const GalleryTheme* pTheme, sal_uIntPtr nO
}
if( !bEnable )
- EnableItem( MN_PASTECLIPBOARD, sal_False );
+ maPopupMenu.EnableItem( MN_PASTECLIPBOARD, sal_False );
}
#else
- EnableItem( MN_COPYCLIPBOARD, sal_False );
- EnableItem( MN_PASTECLIPBOARD, sal_False );
+ maPopupMenu.EnableItem( MN_COPYCLIPBOARD, sal_False );
+ maPopupMenu.EnableItem( MN_PASTECLIPBOARD, sal_False );
#endif
+ // update status
+ css::uno::Reference< css::frame::XDispatchProvider> xDispatchProvider(
+ mpBrowser->GetFrame(), css::uno::UNO_QUERY );
+ css::uno::Reference< css::util::XURLTransformer > xTransformer(
+ mpBrowser->GetURLTransformer() );
+ for ( CommandInfoMap::iterator it = m_aCommandInfo.begin();
+ it != m_aCommandInfo.end(); it++ )
+ {
+ try
+ {
+ CommandInfo &rCmdInfo = it->second;
+ if ( xTransformer.is() )
+ xTransformer->parseStrict( rCmdInfo.URL );
+
+ if ( xDispatchProvider.is() )
+ {
+ rCmdInfo.Dispatch = xDispatchProvider->queryDispatch(
+ rCmdInfo.URL,
+ OUString( "_self" ),
+ css::frame::FrameSearchFlag::SELF );
+ }
+
+ if ( rCmdInfo.Dispatch.is() )
+ {
+ rCmdInfo.Dispatch->addStatusListener( this, rCmdInfo.URL );
+ rCmdInfo.Dispatch->removeStatusListener( this, rCmdInfo.URL );
+ }
+ }
+ catch ( ... )
+ {}
+ }
+
if( !maBackgroundPopup.GetItemCount() || ( eObjKind == SGA_OBJ_SVDRAW ) || ( eObjKind == SGA_OBJ_SOUND ) )
pAddMenu->EnableItem( MN_BACKGROUND, sal_False );
else
{
pAddMenu->EnableItem( MN_BACKGROUND, sal_True );
pAddMenu->SetPopupMenu( MN_BACKGROUND, &maBackgroundPopup );
+ maBackgroundPopup.SetSelectHdl( LINK( this, GalleryThemePopup, BackgroundMenuSelectHdl ) );
}
- rBindings.Update( SID_GALLERY_ENABLE_ADDCOPY );
- RemoveDisabledEntries();
-}
+ pAddMenu->RemoveDisabledEntries();
+ if ( !pAddMenu->GetItemCount() )
+ maPopupMenu.EnableItem( MN_ADDMENU, sal_False );
+ maPopupMenu.RemoveDisabledEntries();
-GalleryThemePopup::~GalleryThemePopup()
-{
- DBG_DTOR(GalleryThemePopup,NULL);
+ maPopupMenu.SetSelectHdl( LINK( this, GalleryThemePopup, MenuSelectHdl ) );
+ maPopupMenu.Execute( pWindow, aPos );
}
-void GalleryThemePopup::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pItem )
+IMPL_LINK( GalleryThemePopup, MenuSelectHdl, Menu*, pMenu )
{
- if( ( nSID == SID_GALLERY_ENABLE_ADDCOPY ) && pItem && ( eState != SFX_ITEM_DISABLED ) )
- {
- SfxBoolItem* pBoolItem = PTR_CAST( SfxBoolItem, pItem );
- const SgaObjKind eObjKind = mpTheme->GetObjectKind( mnObjectPos );
+ if( !pMenu )
+ return 0;
- DBG_ASSERT( pBoolItem || pBoolItem == 0, "SfxBoolItem erwartet!");
+ sal_uInt16 nId( pMenu->GetCurItemId() );
+ switch ( nId )
+ {
+ case( MN_ADD ):
+ case( MN_ADD_LINK ):
+ {
+ const CommandInfoMap::const_iterator it = m_aCommandInfo.find( SID_GALLERY_FORMATS );
+ if ( it != m_aCommandInfo.end() )
+ mpBrowser->Dispatch( nId,
+ it->second.Dispatch,
+ it->second.URL );
+ }
+ break;
- GetPopupMenu( MN_ADDMENU )->EnableItem( MN_ADD, pBoolItem->GetValue() && ( eObjKind != SGA_OBJ_SOUND ) );
+ default:
+ mpBrowser->Execute( nId );
}
+
+ return 0;
}
+IMPL_LINK( GalleryThemePopup, BackgroundMenuSelectHdl, Menu*, pMenu )
+{
+ if( !pMenu )
+ return 0;
+
+ sal_uInt16 nPos( pMenu->GetCurItemId() - 1 );
+ OUString aURL( mpBrowser->GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
+ OUString aFilterName( mpBrowser->GetFilterName() );
+
+ css::uno::Sequence< css::beans::PropertyValue > aArgs( 6 );
+ aArgs[0].Name = OUString( "Background.Transparent" );
+ aArgs[0].Value <<= sal_Int32( 0 ); // 0 - 100
+ aArgs[1].Name = OUString( "Background.BackColor" );
+ aArgs[1].Value <<= sal_Int32( - 1 );
+ aArgs[2].Name = OUString( "Background.URL" );
+ aArgs[2].Value <<= aURL;
+ aArgs[3].Name = OUString( "Background.Filtername" ); // FIXME should be FilterName
+ aArgs[3].Value <<= aFilterName;
+ aArgs[4].Name = OUString( "Background.Position" );
+ aArgs[4].Value <<= css::style::GraphicLocation_TILED;
+ aArgs[5].Name = OUString( "Position" );
+ aArgs[5].Value <<= nPos;
+
+ const CommandInfoMap::const_iterator it = m_aCommandInfo.find( SID_GALLERY_BG_BRUSH );
+ if ( it != m_aCommandInfo.end() )
+ Execute( it->second, aArgs );
+
+ return 0;
+}
+
+} // end anonymous namespace
+
DBG_NAME(GalleryToolBox)
GalleryToolBox::GalleryToolBox( GalleryBrowser2* pParent ) :
@@ -278,11 +443,17 @@ GalleryBrowser2::GalleryBrowser2( Window* pParent, const ResId& rResId, Gallery*
maInfoBar ( this, WB_LEFT | WB_VCENTER ),
mnCurActionPos ( 0xffffffff ),
meMode ( GALLERYBROWSERMODE_NONE ),
- meLastMode ( GALLERYBROWSERMODE_NONE ),
- mbCurActionIsLinkage( sal_False )
+ meLastMode ( GALLERYBROWSERMODE_NONE )
{
DBG_CTOR(GalleryBrowser2,NULL);
+ m_xContext.set( ::comphelper::getProcessComponentContext() );
+
+ m_xTransformer.set(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ OUString( "com.sun.star.util.URLTransformer" ), m_xContext ),
+ css::uno::UNO_QUERY );
+
Image aDummyImage;
const Link aSelectHdl( LINK( this, GalleryBrowser2, SelectObjectHdl ) );
Font aInfoFont( maInfoBar.GetControlFont() );
@@ -478,22 +649,24 @@ void GalleryBrowser2::TogglePreview( Window*, const Point* )
void GalleryBrowser2::ShowContextMenu( Window*, const Point* pContextPoint )
{
- Point aSelPos;
+ Point aSelPos;
const sal_uIntPtr nItemId = ImplGetSelectedItemId( pContextPoint, aSelPos );
if( mpCurTheme && nItemId && ( nItemId <= mpCurTheme->GetObjectCount() ) )
{
ImplSelectItemId( nItemId );
- SfxViewFrame* pCurrentViewFrame = SfxViewFrame::Current();
- if ( pCurrentViewFrame )
+ css::uno::Reference< css::frame::XFrame > xFrame( GetFrame() );
+ if ( xFrame.is() )
{
- SfxBindings& rBindings = pCurrentViewFrame->GetBindings();
- rBindings.ENTERREGISTRATIONS();
- GalleryThemePopup aMenu( mpCurTheme, nItemId - 1, GALLERYBROWSERMODE_PREVIEW == GetMode() );
- rBindings.LEAVEREGISTRATIONS();
- aMenu.SetSelectHdl( LINK( this, GalleryBrowser2, MenuSelectHdl ) );
- aMenu.Execute( this, aSelPos );
+ mnCurActionPos = nItemId - 1;
+ rtl::Reference< GalleryThemePopup > rPopup(
+ new GalleryThemePopup(
+ mpCurTheme,
+ mnCurActionPos,
+ GALLERYBROWSERMODE_PREVIEW == GetMode(),
+ this ) );
+ rPopup->ExecutePopup( this, aSelPos );
}
}
}
@@ -551,10 +724,16 @@ sal_Bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, Window* pWindow )
case( KEY_INSERT ):
case( KEY_I ):
{
+ // Inserting a gallery item in the document must be dispatched
if( bAddLink && rKEvt.GetKeyCode().IsShift() && rKEvt.GetKeyCode().IsMod1() )
nExecuteId = MN_ADD_LINK;
else if( bAdd )
nExecuteId = MN_ADD;
+ if( nExecuteId )
+ {
+ Dispatch( nExecuteId );
+ return sal_True;
+ }
}
break;
@@ -579,7 +758,7 @@ sal_Bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, Window* pWindow )
if( nExecuteId )
{
- ImplExecute( nExecuteId );
+ Execute( nExecuteId );
bRet = sal_True;
}
}
@@ -900,50 +1079,144 @@ void GalleryBrowser2::ImplSelectItemId( sal_uIntPtr nItemId )
}
}
-void GalleryBrowser2::ImplExecute( sal_uInt16 nId )
+css::uno::Reference< css::frame::XFrame >
+GalleryBrowser2::GetFrame() const
{
- Point aSelPos;
+ css::uno::Reference< css::frame::XFrame > xFrame;
+ SfxViewFrame* pCurrentViewFrame = SfxViewFrame::Current();
+ if ( pCurrentViewFrame )
+ {
+ SfxBindings& rBindings = pCurrentViewFrame->GetBindings();
+ xFrame.set( rBindings.GetActiveFrame() );
+ }
+
+ return xFrame;
+}
+
+void GalleryBrowser2::Dispatch(
+ sal_uInt16 nId,
+ const css::uno::Reference< css::frame::XDispatch > &rxDispatch,
+ const css::util::URL &rURL )
+{
+ Point aSelPos;
const sal_uIntPtr nItemId = ImplGetSelectedItemId( NULL, aSelPos );
- if( mpCurTheme && nItemId )
- {
- mnCurActionPos = nItemId - 1;
+ if( !mpCurTheme || !nItemId )
+ return;
- switch( nId )
+ mnCurActionPos = nItemId - 1;
+
+ switch( nId )
+ {
+ case( MN_ADD ):
+ case( MN_ADD_LINK ):
{
- case( MN_ADD ):
- case( MN_ADD_LINK ):
+ css::uno::Reference< css::frame::XDispatch > xDispatch( rxDispatch );
+ css::util::URL aURL = rURL;
+
+ if ( !xDispatch.is() )
{
- sal_uInt32 nFormat = 0;
+ css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(
+ GetFrame(), css::uno::UNO_QUERY );
+ if ( !xDispatchProvider.is() || !m_xTransformer.is() )
+ return;
+
+ aURL.Complete = OUString( CMD_SID_GALLERY_FORMATS );
+ m_xTransformer->parseStrict( aURL );
+ xDispatch = xDispatchProvider->queryDispatch(
+ aURL,
+ OUString( "_self" ),
+ css::frame::FrameSearchFlag::SELF );
+ }
- mbCurActionIsLinkage = ( MN_ADD_LINK == nId );
+ if ( !xDispatch.is() )
+ return;
- switch( mpCurTheme->GetObjectKind( mnCurActionPos ) )
- {
- case( SGA_OBJ_BMP ):
- case( SGA_OBJ_ANIM ):
- case( SGA_OBJ_INET ):
- nFormat = SGA_FORMAT_GRAPHIC | SGA_FORMAT_STRING;
- break;
+ sal_Int8 nType = 0;
+ sal_Bool bIsLink( MN_ADD_LINK == nId );
+ OUString aFileURL, aFilterName;
+ css::uno::Reference< css::lang::XComponent > xDrawing;
+ css::uno::Reference< css::graphic::XGraphic > xGraphic;
- case ( SGA_OBJ_SOUND ) :
- nFormat = SGA_FORMAT_SOUND | SGA_FORMAT_STRING;
- break;
+ aFilterName = GetFilterName();
- case( SGA_OBJ_SVDRAW ):
- nFormat = SGA_FORMAT_GRAPHIC | SGA_FORMAT_SVDRAW | SGA_FORMAT_STRING;
- break;
+ switch( mpCurTheme->GetObjectKind( mnCurActionPos ) )
+ {
+ case( SGA_OBJ_BMP ):
+ case( SGA_OBJ_ANIM ):
+ case( SGA_OBJ_INET ):
+ // TODO drawing objects are inserted as drawings only via drag&drop
+ case( SGA_OBJ_SVDRAW ):
+ nType = css::gallery::GalleryItemType::GRAPHIC;
+ break;
- default :
- break;
- }
+ case ( SGA_OBJ_SOUND ) :
+ nType = css::gallery::GalleryItemType::MEDIA;
+ break;
- const SfxUInt32Item aItem( SID_GALLERY_FORMATS, nFormat );
- SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute(
- SID_GALLERY_FORMATS, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+ default:
+ nType = css::gallery::GalleryItemType::EMPTY;
+ break;
}
- break;
+ if ( bIsLink )
+ {
+ aFileURL = mpCurTheme->GetObjectURL( mnCurActionPos ).GetMainURL( INetURLObject::NO_DECODE );
+ OSL_ENSURE( aFileURL.getLength(), "gallery item is link but no URL!" );
+ }
+
+ Graphic aGraphic;
+ sal_Bool bGraphic = mpCurTheme->GetGraphic( mnCurActionPos, aGraphic );
+ if ( bGraphic && !!aGraphic )
+ xGraphic.set( aGraphic.GetXGraphic() );
+ OSL_ENSURE( xGraphic.is(), "gallery item is graphic, but the reference is invalid!" );
+
+ css::uno::Sequence< css::beans::PropertyValue > aSeq( SVXGALLERYITEM_PARAMS );
+
+ aSeq[0].Name = OUString( SVXGALLERYITEM_TYPE );
+ aSeq[0].Value <<= nType;
+ aSeq[1].Name = OUString( SVXGALLERYITEM_LINK );
+ aSeq[1].Value <<= bIsLink;
+ aSeq[2].Name = OUString( SVXGALLERYITEM_URL );
+ aSeq[2].Value <<= aFileURL;
+ aSeq[3].Name = OUString( SVXGALLERYITEM_FILTER );
+ aSeq[3].Value <<= aFilterName;
+ aSeq[4].Name = OUString( SVXGALLERYITEM_DRAWING );
+ aSeq[4].Value <<= xDrawing;
+ aSeq[5].Name = OUString( SVXGALLERYITEM_GRAPHIC );
+ aSeq[5].Value <<= xGraphic;
+
+ css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = OUString( SVXGALLERYITEM_ARGNAME );
+ aArgs[0].Value <<= aSeq;
+
+ DispatchInfo *pInfo = new DispatchInfo;
+ pInfo->TargetURL = aURL;
+ pInfo->Arguments = aArgs;
+ pInfo->Dispatch = xDispatch;
+
+ if ( !Application::PostUserEvent(
+ STATIC_LINK( 0, GalleryBrowser2, AsyncDispatch_Impl), pInfo ) )
+ delete pInfo;
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void GalleryBrowser2::Execute( sal_uInt16 nId )
+{
+ Point aSelPos;
+ const sal_uIntPtr nItemId = ImplGetSelectedItemId( NULL, aSelPos );
+
+ if( mpCurTheme && nItemId )
+ {
+ mnCurActionPos = nItemId - 1;
+
+ switch( nId )
+ {
case( MN_PREVIEW ):
SetMode( ( GALLERYBROWSERMODE_PREVIEW != GetMode() ) ? GALLERYBROWSERMODE_PREVIEW : meLastMode );
break;
@@ -1113,19 +1386,6 @@ Graphic GalleryBrowser2::GetGraphic() const
return aGraphic;
}
-sal_Bool GalleryBrowser2::IsLinkage() const
-{
- return mbCurActionIsLinkage;
-}
-
-IMPL_LINK( GalleryBrowser2, MenuSelectHdl, Menu*, pMenu )
-{
- if( pMenu )
- ImplExecute( pMenu->GetCurItemId() );
-
- return 0;
-}
-
IMPL_LINK_NOARG(GalleryBrowser2, SelectObjectHdl)
{
ImplUpdateInfoBar();
diff --git a/svx/source/gallery2/galexpl.cxx b/svx/source/gallery2/galexpl.cxx
index 13899ad..79fbbd4 100644
--- a/svx/source/gallery2/galexpl.cxx
+++ b/svx/source/gallery2/galexpl.cxx
@@ -36,64 +36,9 @@ namespace
// - GalleryExplorer -
// -------------------
-Gallery* GalleryExplorer::ImplGetGallery()
-{
- static Gallery* pGallery = NULL;
-
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-
- if( !pGallery )
- pGallery = Gallery::GetGalleryInstance();
-
- return pGallery;
-}
-
-// ------------------------------------------------------------------------
-
-GalleryExplorer* GalleryExplorer::GetGallery()
-{
- static GalleryExplorer* pThis = NULL;
-
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-
- // only create a dummy object which can be accessed
- if( !pThis )
- pThis = new GalleryExplorer;
-
- return pThis;
-}
-
-// ------------------------------------------------------------------------
-
-INetURLObject GalleryExplorer::GetURL() const
-{
- return GALLERYBROWSER()->GetURL();
-}
-
-String GalleryExplorer::GetFilterName() const
-{
- return GALLERYBROWSER()->GetFilterName();
-}
-
-// ------------------------------------------------------------------------
-
-Graphic GalleryExplorer::GetGraphic() const
-{
- return GALLERYBROWSER()->GetGraphic();
-}
-
-// ------------------------------------------------------------------------
-
-sal_Bool GalleryExplorer::IsLinkage() const
-{
- return GALLERYBROWSER()->IsLinkage();
-}
-
-// ------------------------------------------------------------------------
-
bool GalleryExplorer::FillThemeList( std::vector<String>& rThemeList )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
if( pGal )
{
@@ -113,7 +58,7 @@ bool GalleryExplorer::FillThemeList( std::vector<String>& rThemeList )
sal_Bool GalleryExplorer::FillObjList( const String& rThemeName, std::vector<String> &rObjList )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
if( pGal )
{
@@ -136,7 +81,7 @@ sal_Bool GalleryExplorer::FillObjList( const String& rThemeName, std::vector<Str
sal_Bool GalleryExplorer::FillObjList( const sal_uInt32 nThemeId, std::vector<String> &rObjList )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
if (!pGal)
return false;
@@ -164,7 +109,7 @@ bool GalleryExplorer::FillObjList( const sal_uInt32 nThemeId, std::vector<OUStri
sal_Bool GalleryExplorer::FillObjListTitle( const sal_uInt32 nThemeId, std::vector< OUString >& rList )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
if( pGal )
{
SfxListener aListener;
@@ -192,21 +137,7 @@ sal_Bool GalleryExplorer::FillObjListTitle( const sal_uInt32 nThemeId, std::vect
sal_Bool GalleryExplorer::InsertURL( const String& rThemeName, const String& rURL )
{
- return InsertURL( rThemeName, rURL, SGA_FORMAT_ALL );
-}
-
-// ------------------------------------------------------------------------
-
-sal_Bool GalleryExplorer::InsertURL( sal_uIntPtr nThemeId, const String& rURL )
-{
- return InsertURL( nThemeId, rURL, SGA_FORMAT_ALL );
-}
-
-// ------------------------------------------------------------------------
-
-sal_Bool GalleryExplorer::InsertURL( const String& rThemeName, const String& rURL, const sal_uIntPtr )
-{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
sal_Bool bRet = sal_False;
if( pGal )
@@ -228,10 +159,10 @@ sal_Bool GalleryExplorer::InsertURL( const String& rThemeName, const String& rUR
// ------------------------------------------------------------------------
-sal_Bool GalleryExplorer::InsertURL( sal_uIntPtr nThemeId, const String& rURL, const sal_uIntPtr nSgaFormat )
+sal_Bool GalleryExplorer::InsertURL( sal_uIntPtr nThemeId, const String& rURL )
{
- Gallery* pGal = ImplGetGallery();
- return( pGal ? InsertURL( pGal->GetThemeName( nThemeId ), rURL, nSgaFormat ) : sal_False );
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
+ return( pGal ? InsertURL( pGal->GetThemeName( nThemeId ), rURL ) : sal_False );
}
// ------------------------------------------------------------------------
@@ -240,7 +171,7 @@ sal_Bool GalleryExplorer::GetGraphicObj( const String& rThemeName, sal_uIntPtr n
Graphic* pGraphic, BitmapEx* pThumb,
sal_Bool bProgress )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
sal_Bool bRet = sal_False;
if( pGal )
@@ -269,7 +200,7 @@ sal_Bool GalleryExplorer::GetGraphicObj( sal_uIntPtr nThemeId, sal_uIntPtr nPos,
Graphic* pGraphic, BitmapEx* pThumb,
sal_Bool bProgress )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
return( pGal ? GetGraphicObj( pGal->GetThemeName( nThemeId ), nPos, pGraphic, pThumb, bProgress ) : sal_False );
}
@@ -277,7 +208,7 @@ sal_Bool GalleryExplorer::GetGraphicObj( sal_uIntPtr nThemeId, sal_uIntPtr nPos,
sal_uIntPtr GalleryExplorer::GetSdrObjCount( const String& rThemeName )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
sal_uIntPtr nRet = 0;
if( pGal )
@@ -302,7 +233,7 @@ sal_uIntPtr GalleryExplorer::GetSdrObjCount( const String& rThemeName )
sal_uIntPtr GalleryExplorer::GetSdrObjCount( sal_uIntPtr nThemeId )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
return( pGal ? GetSdrObjCount( pGal->GetThemeName( nThemeId ) ) : sal_False );
}
@@ -311,7 +242,7 @@ sal_uIntPtr GalleryExplorer::GetSdrObjCount( sal_uIntPtr nThemeId )
sal_Bool GalleryExplorer::GetSdrObj( const String& rThemeName, sal_uIntPtr nSdrModelPos,
SdrModel* pModel, BitmapEx* pThumb )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
sal_Bool bRet = sal_False;
if( pGal )
@@ -348,7 +279,7 @@ sal_Bool GalleryExplorer::GetSdrObj( const String& rThemeName, sal_uIntPtr nSdrM
sal_Bool GalleryExplorer::GetSdrObj( sal_uIntPtr nThemeId, sal_uIntPtr nSdrModelPos,
SdrModel* pModel, BitmapEx* pThumb )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
return( pGal ? GetSdrObj( pGal->GetThemeName( nThemeId ), nSdrModelPos, pModel, pThumb ) : sal_False );
}
@@ -356,7 +287,7 @@ sal_Bool GalleryExplorer::GetSdrObj( sal_uIntPtr nThemeId, sal_uIntPtr nSdrModel
sal_Bool GalleryExplorer::BeginLocking( const String& rThemeName )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
sal_Bool bRet = sal_False;
if( pGal )
@@ -377,7 +308,7 @@ sal_Bool GalleryExplorer::BeginLocking( const String& rThemeName )
sal_Bool GalleryExplorer::BeginLocking( sal_uIntPtr nThemeId )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
return( pGal ? BeginLocking( pGal->GetThemeName( nThemeId ) ) : sal_False );
}
@@ -385,7 +316,7 @@ sal_Bool GalleryExplorer::BeginLocking( sal_uIntPtr nThemeId )
sal_Bool GalleryExplorer::EndLocking( const String& rThemeName )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
sal_Bool bRet = sal_False;
if( pGal )
@@ -416,7 +347,7 @@ sal_Bool GalleryExplorer::EndLocking( const String& rThemeName )
sal_Bool GalleryExplorer::EndLocking( sal_uIntPtr nThemeId )
{
- Gallery* pGal = ImplGetGallery();
+ Gallery* pGal = ::Gallery::GetGalleryInstance();
return( pGal ? EndLocking( pGal->GetThemeName( nThemeId ) ) : sal_False );
}
diff --git a/svx/source/items/galleryitem.cxx b/svx/source/items/galleryitem.cxx
new file mode 100644
index 0000000..18a73f7
--- /dev/null
+++ b/svx/source/items/galleryitem.cxx
@@ -0,0 +1,179 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/galleryitem.hxx>
+#include <com/sun/star/gallery/GalleryItemType.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace css = ::com::sun::star;
+
+DBG_NAMEEX( SvxGalleryItem )
+DBG_NAME( SvxGalleryItem )
+
+TYPEINIT1_AUTOFACTORY( SvxGalleryItem, SfxPoolItem );
+
+SvxGalleryItem::SvxGalleryItem()
+ : m_nType( css::gallery::GalleryItemType::EMPTY )
+ , m_bIsLink( sal_False )
+{
+ DBG_CTOR(SvxGalleryItem, 0);
+}
+
+SvxGalleryItem::SvxGalleryItem( const SvxGalleryItem &rItem )
+ : SfxPoolItem( rItem )
+ , m_nType( rItem.m_nType )
+ , m_bIsLink( rItem.m_bIsLink )
+ , m_aURL( rItem.m_aURL )
+ , m_xDrawing( rItem.m_xDrawing )
+ , m_xGraphic( rItem.m_xGraphic )
+{
+ DBG_CTOR(SvxGalleryItem, 0);
+}
+
+SvxGalleryItem::SvxGalleryItem(
+ const ::sal_uInt16 nId )
+ : SfxPoolItem( nId )
+ , m_nType( css::gallery::GalleryItemType::EMPTY )
+ , m_bIsLink( sal_False )
+{
+ DBG_CTOR(SvxGalleryItem, 0);
+}
+
+SvxGalleryItem::~SvxGalleryItem()
+{
+ DBG_DTOR(SvxGalleryItem, 0);
+}
+
+bool SvxGalleryItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /* nMemberId */ ) const
+{
+ css::uno::Sequence< css::beans::PropertyValue > aSeq( SVXGALLERYITEM_PARAMS );
+
+ aSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVXGALLERYITEM_TYPE ));
+ aSeq[0].Value <<= m_nType;
+ aSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVXGALLERYITEM_LINK ));
+ aSeq[1].Value <<= m_bIsLink;
+ aSeq[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVXGALLERYITEM_URL ));
+ aSeq[2].Value <<= m_aURL;
+ aSeq[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVXGALLERYITEM_FILTER ));
+ aSeq[3].Value <<= m_aURL;
+ aSeq[4].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVXGALLERYITEM_DRAWING ));
+ aSeq[4].Value <<= m_xDrawing;
+ aSeq[5].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVXGALLERYITEM_GRAPHIC ));
+ aSeq[5].Value <<= m_xGraphic;
+
+ rVal <<= aSeq;
+
+ return true;
+}
+
+bool SvxGalleryItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /* nMemberId */)
+{
+ css::uno::Sequence< css::beans::PropertyValue > aSeq;
+
+ if ( !( rVal >>= aSeq ) || ( aSeq.getLength() < SVXGALLERYITEM_PARAMS ) )
+ return false;
+
+ int nConverted(0);
+ sal_Bool bAllConverted( sal_True );
+ sal_Bool bIsSetType( sal_False );
+
+ sal_Int8 nType(0);
+ sal_Bool bIsLink( sal_False );
+ rtl::OUString aURL, aFilterName;
+ css::uno::Reference< css::lang::XComponent > xDrawing;
+ css::uno::Reference< css::graphic::XGraphic > xGraphic;
+
+ const css::beans::PropertyValue *pProp = aSeq.getConstArray();
+ const css::beans::PropertyValue *pEnd = pProp + aSeq.getLength();
+ for ( ; pProp != pEnd; pProp++ )
+ {
+ if ( pProp->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SVXGALLERYITEM_TYPE ) ) )
+ {
+ bAllConverted &= bIsSetType = ( pProp->Value >>= nType );
+ ++nConverted;
+ }
+ else if ( pProp->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SVXGALLERYITEM_LINK ) ) )
+ {
+ bAllConverted &= ( pProp->Value >>= bIsLink );
+ ++nConverted;
+ }
+ else if ( pProp->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SVXGALLERYITEM_URL ) ) )
+ {
+ bAllConverted &= ( pProp->Value >>= aURL );
+ ++nConverted;
+ }
+ else if ( pProp->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SVXGALLERYITEM_FILTER ) ) )
+ {
+ bAllConverted &= ( pProp->Value >>= aFilterName );
+ ++nConverted;
+ }
+ else if ( pProp->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SVXGALLERYITEM_DRAWING ) ) )
+ {
+ bAllConverted &= ( pProp->Value >>= xDrawing );
+ ++nConverted;
+ }
+ else if ( pProp->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SVXGALLERYITEM_GRAPHIC ) ) )
+ {
+ bAllConverted &= ( pProp->Value >>= xGraphic );
+ ++nConverted;
+ }
+ }
+
+ if ( !bAllConverted || nConverted != SVXGALLERYITEM_PARAMS )
+ return false;
+
+ m_nType = nType;
+ m_bIsLink = bIsLink;
+ m_aURL = aURL;
+ m_aFilterName = aFilterName;
+ m_xDrawing = xDrawing;
+ m_xGraphic = xGraphic;
+
+ return true;
+}
+
+int SvxGalleryItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+
+ const SvxGalleryItem& rItem = static_cast<const SvxGalleryItem&>(rAttr);
+
+ int bRet = m_nType == rItem.m_nType &&
+ m_bIsLink == rItem.m_bIsLink &&
+ m_aURL == rItem.m_aURL &&
+ m_xDrawing == rItem.m_xDrawing &&
+ m_xGraphic == rItem.m_xGraphic;
+
+ return bRet;
+}
+
+SfxPoolItem* SvxGalleryItem::Clone( SfxItemPool * ) const
+{
+ return new SvxGalleryItem( *this );
+}
+
+SvStream& SvxGalleryItem::Store( SvStream& rStream, sal_uInt16 /*nItemVersion*/ ) const
+{
+ return rStream;
+}
+
+SfxPoolItem* SvxGalleryItem::Create(SvStream& , sal_uInt16) const
+{
+ return 0;
+}
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index dc54ec3..ea1f6a6 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -106,6 +106,8 @@
#include <comcore.hrc>
#include <unomid.h>
+#include <svx/galleryitem.hxx>
+#include <com/sun/star/gallery/GalleryItemType.hpp>
FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END;
@@ -690,38 +692,40 @@ void SwBaseShell::Execute(SfxRequest &rReq)
break;
case SID_GALLERY_FORMATS:
{
- const int nSelType = rSh.GetSelectionType();
- if(SFX_ITEM_SET == pArgs->GetItemState( nSlot, sal_True, &pItem))
- {
- GalleryExplorer* pGal = 0;
- if ( (!rSh.IsSelFrmMode() || nSelType & nsSelectionType::SEL_GRF) &&
- 0!= (pGal = SVX_GALLERY())&&
- 0 != (SGA_FORMAT_GRAPHIC & ((SfxUInt32Item*)pItem)->GetValue()))
- {
- SwWait aWait( *rView.GetDocShell(), sal_True );
+ SFX_ITEMSET_ARG( pArgs, pGalleryItem, SvxGalleryItem, SID_GALLERY_FORMATS, sal_False );
+ if ( !pGalleryItem )
+ break;
- String aGrfName, aFltName;
- const Graphic aGrf( pGal->GetGraphic() );
+ const int nSelType = rSh.GetSelectionType();
+ sal_Int8 nGalleryItemType( pGalleryItem->GetType() );
- if( pGal->IsLinkage() )
- {
- // Linked
- aGrfName = pGal->GetURL().GetMainURL(INetURLObject::NO_DECODE);
- aFltName = pGal->GetFilterName();
- }
+ if ( (!rSh.IsSelFrmMode() || nSelType & nsSelectionType::SEL_GRF) &&
+ nGalleryItemType == com::sun::star::gallery::GalleryItemType::GRAPHIC )
+ {
+ SwWait aWait( *rView.GetDocShell(), sal_True );
- if ( nSelType & nsSelectionType::SEL_GRF )
- rSh.ReRead( aGrfName, aFltName, &aGrf );
- else
- rSh.Insert( aGrfName, aFltName, aGrf );
+ String aGrfName, aFltName;
+ const Graphic aGrf( pGalleryItem->GetGraphic() );
- GetView().GetEditWin().GrabFocus();
- }
- else if(!rSh.IsSelFrmMode() && SGA_FORMAT_SOUND & ((SfxUInt32Item*)pItem)->GetValue())
+ if( pGalleryItem->IsLink() )
{
- const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
- GetView().GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
+ // Linked
+ aGrfName = pGalleryItem->GetURL();
+ aFltName = pGalleryItem->GetFilterName();
}
+
+ if ( nSelType & nsSelectionType::SEL_GRF )
+ rSh.ReRead( aGrfName, aFltName, &aGrf );
+ else
+ rSh.Insert( aGrfName, aFltName, aGrf );
+
+ GetView().GetEditWin().GrabFocus();
+ }
+ else if(!rSh.IsSelFrmMode() &&
+ nGalleryItemType == com::sun::star::gallery::GalleryItemType::MEDIA )
+ {
+ const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGalleryItem->GetURL() );
+ GetView().GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
}
}
break;
@@ -2731,14 +2735,22 @@ void SwBaseShell::ExecuteGallery(SfxRequest &rReq)
{
case SID_GALLERY_BG_BRUSH:
{
+ if ( !pArgs )
+ break;
+
int nSel = rSh.GetSelectionType();
if ( nSel & nsSelectionType::SEL_DRW_TXT )
break;
- sal_uInt8 nPos = (sal_uInt8)((SfxUInt16Item &)pArgs->Get(SID_GALLERY_BG_POS)).GetValue();
+ SFX_REQUEST_ARG( rReq, pPos, SfxUInt16Item, SID_GALLERY_BG_POS, sal_False );
+ SFX_REQUEST_ARG( rReq, pBrush, SvxBrushItem, SID_GALLERY_BG_BRUSH, sal_False );
+ if ( !pPos || !pBrush )
+ break;
+
+ sal_uInt8 nPos = pPos->GetValue();
++nPos;
- SvxBrushItem aBrush( (SvxBrushItem&)pArgs->Get(SID_GALLERY_BG_BRUSH));
+ SvxBrushItem aBrush( *pBrush );
aBrush.SetWhich( RES_BACKGROUND );
if ( nPos == nParagraphPos )
rSh.SetAttr( aBrush );
diff --git a/sw/source/ui/shells/slotadd.cxx b/sw/source/ui/shells/slotadd.cxx
index fd9bf51..7d6b301 100644
--- a/sw/source/ui/shells/slotadd.cxx
+++ b/sw/source/ui/shells/slotadd.cxx
@@ -130,6 +130,7 @@
#include <svx/xlncapit.hxx>
#include <svx/xlinjoit.hxx>
#include <svx/AffineMatrixItem.hxx>
+#include <svx/galleryitem.hxx>
#define SFX_TYPEMAP
#include <sfx2/msg.hxx>
More information about the Libreoffice-commits
mailing list