Kaydet (Commit) 4e3f7d32 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt Kaydeden (comit) Luboš Luňák

fdo#67274 Always embed images from gallery

This patch removes the options to link images from the gallery.
Users should never link to the gallery. The links wouldn't work anymore if you just change the operating system, because the gallery is on a different place.

Changes:
* Removed option in "Bullets and Numbering" dialog to link graphical bullets
* Change the Gallery image context menu.
Before:
  Insert
    Copy
    Link
    Background
      Page
      Paragraph
  ...

Now:
  Insert
  Insert as Background
    Page
    Paragraph
  ...

Change-Id: I699042a7d7a27369775f9ee4c14c4a6964489a92
Reviewed-on: https://gerrit.libreoffice.org/5141Reviewed-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
Tested-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
üst 15dc66c8
......@@ -212,7 +212,6 @@ class SvxBitmapPickTabPage : public SfxTabPage
FixedText* m_pErrorText;
SvxBmpNumValueSet* m_pExamplesVS;
CheckBox* m_pLinkedCB;
std::vector<String> aGrfNames;
String sNumCharFmtName;
......
......@@ -792,11 +792,9 @@ SvxBitmapPickTabPage::SvxBitmapPickTabPage(Window* pParent,
{
SetExchangeSupport();
get(m_pErrorText, "errorft");
get(m_pLinkedCB, "linkgraphics");
get(m_pExamplesVS, "valueset");
m_pExamplesVS->SetSelectHdl(LINK(this, SvxBitmapPickTabPage, NumSelectHdl_Impl));
m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBitmapPickTabPage, DoubleClickHdl_Impl));
m_pLinkedCB->SetClickHdl(LINK(this, SvxBitmapPickTabPage, LinkBmpHdl_Impl));
eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
......@@ -921,16 +919,6 @@ void SvxBitmapPickTabPage::Reset( const SfxItemSet& rSet )
pActNum = new SvxNumRule(*pSaveNum);
else if(*pSaveNum != *pActNum)
*pActNum = *pSaveNum;
if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP))
{
m_pLinkedCB->Check(sal_False);
m_pLinkedCB->Enable(sal_False);
}
else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP))
{
m_pLinkedCB->Check(sal_True);
m_pLinkedCB->Enable(sal_False);
}
}
IMPL_LINK_NOARG(SvxBitmapPickTabPage, NumSelectHdl_Impl)
......@@ -944,8 +932,6 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, NumSelectHdl_Impl)
sal_uInt16 nMask = 1;
String aEmptyStr;
sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP;
if(m_pLinkedCB->IsChecked())
nSetNumberingType |= LINK_TOKEN;
for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
{
if(nActNumLvl & nMask)
......@@ -984,15 +970,6 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, DoubleClickHdl_Impl)
return 0;
}
IMPL_LINK_NOARG(SvxBitmapPickTabPage, LinkBmpHdl_Impl)
{
if(!m_pExamplesVS->IsNoSelection())
{
NumSelectHdl_Impl(m_pExamplesVS);
}
return 0;
}
// static
void SvxNumOptionsTabPage::GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 nDoNotRemove )
{
......
......@@ -24,23 +24,6 @@
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkCheckButton" id="linkgraphics">
<property name="label" translatable="yes">_Link graphics</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="svxlo-SvxBmpNumValueSet" id="valueset">
<property name="visible">True</property>
......
......@@ -28,12 +28,11 @@
// 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_PARAMS 5
#define SVXGALLERYITEM_ARGNAME "GalleryItem"
DBG_NAMEEX_VISIBILITY( SvxGalleryItem, SVX_DLLPUBLIC )
......@@ -41,7 +40,6 @@ 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;
......@@ -56,7 +54,6 @@ public:
~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; }
......
......@@ -91,12 +91,6 @@ void ScTabViewShell::ExecGallery( SfxRequest& rReq )
Point aPos = GetInsertPos();
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 )
......
......@@ -173,10 +173,6 @@ void DrawViewShell::ExecGallery(SfxRequest& rReq)
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 )
......
......@@ -107,7 +107,6 @@
#define WND_BRSPRV 1
#define MN_ADDMENU 2
#define MN_ADD 6
#define MN_ADD_LINK 8
#define MN_PREVIEW 10
#define MN_DELETE 12
#define MN_BACKGROUND 14
......
......@@ -185,9 +185,7 @@ throw ( css::uno::RuntimeException )
{
if ( !rEvent.IsEnabled )
{
PopupMenu *pAddMenu = maPopupMenu.GetPopupMenu( MN_ADDMENU );
pAddMenu->EnableItem( MN_ADD, sal_False );
pAddMenu->EnableItem( MN_ADD_LINK, sal_False );
maPopupMenu.EnableItem( MN_ADD, sal_False );
}
}
else if ( rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( CMD_SID_GALLERY_BG_BRUSH ) ) )
......@@ -242,16 +240,13 @@ void GalleryThemePopup::ExecutePopup( Window *pWindow, const ::Point &aPos )
css::uno::Reference< css::frame::XStatusListener > xThis( this );
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 );
pAddMenu->EnableItem( MN_ADD, bValidURL && SGA_OBJ_SOUND != eObjKind );
pAddMenu->EnableItem( MN_ADD_LINK, bValidURL && SGA_OBJ_SVDRAW != eObjKind );
maPopupMenu.EnableItem( MN_ADD, bValidURL && SGA_OBJ_SOUND != eObjKind );
maPopupMenu.EnableItem( MN_ADDMENU, pAddMenu->IsItemEnabled( MN_ADD ) || pAddMenu->IsItemEnabled( MN_ADD_LINK ) );
maPopupMenu.EnableItem( MN_PREVIEW, bValidURL );
maPopupMenu.CheckItem( MN_PREVIEW, mbPreview );
......@@ -335,17 +330,14 @@ void GalleryThemePopup::ExecutePopup( Window *pWindow, const ::Point &aPos )
}
if( !maBackgroundPopup.GetItemCount() || ( eObjKind == SGA_OBJ_SVDRAW ) || ( eObjKind == SGA_OBJ_SOUND ) )
pAddMenu->EnableItem( MN_BACKGROUND, sal_False );
maPopupMenu.EnableItem( MN_BACKGROUND, sal_False );
else
{
pAddMenu->EnableItem( MN_BACKGROUND, sal_True );
pAddMenu->SetPopupMenu( MN_BACKGROUND, &maBackgroundPopup );
maPopupMenu.EnableItem( MN_BACKGROUND, sal_True );
maPopupMenu.SetPopupMenu( MN_BACKGROUND, &maBackgroundPopup );
maBackgroundPopup.SetSelectHdl( LINK( this, GalleryThemePopup, BackgroundMenuSelectHdl ) );
}
pAddMenu->RemoveDisabledEntries();
if ( !pAddMenu->GetItemCount() )
maPopupMenu.EnableItem( MN_ADDMENU, sal_False );
maPopupMenu.RemoveDisabledEntries();
maPopupMenu.SetSelectHdl( LINK( this, GalleryThemePopup, MenuSelectHdl ) );
......@@ -361,7 +353,6 @@ IMPL_LINK( GalleryThemePopup, MenuSelectHdl, Menu*, pMenu )
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() )
......@@ -688,16 +679,13 @@ sal_Bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, Window* pWindow )
if( !bRet && !maViewBox.HasFocus() && nItemId && mpCurTheme )
{
sal_uInt16 nExecuteId = 0;
const SgaObjKind eObjKind = mpCurTheme->GetObjectKind( nItemId - 1 );
sal_uInt16 nExecuteId = 0;
INetURLObject aURL;
const_cast< GalleryTheme* >( mpCurTheme )->GetURL( nItemId - 1, aURL );
const sal_Bool bValidURL = ( aURL.GetProtocol() != INET_PROT_NOT_VALID );
sal_Bool bPreview = bValidURL;
sal_Bool bAdd = bValidURL;
sal_Bool bAddLink = ( bValidURL && SGA_OBJ_SVDRAW != eObjKind );
sal_Bool bDelete = sal_False;
sal_Bool bTitle = sal_False;
......@@ -725,13 +713,9 @@ sal_Bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, Window* pWindow )
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 )
if( bValidURL )
{
Dispatch( nExecuteId );
Dispatch( MN_ADD );
return sal_True;
}
}
......@@ -1109,7 +1093,6 @@ void GalleryBrowser2::Dispatch(
switch( nId )
{
case( MN_ADD ):
case( MN_ADD_LINK ):
{
css::uno::Reference< css::frame::XDispatch > xDispatch( rxDispatch );
css::util::URL aURL = rURL;
......@@ -1133,7 +1116,6 @@ void GalleryBrowser2::Dispatch(
return;
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;
......@@ -1159,12 +1141,6 @@ void GalleryBrowser2::Dispatch(
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 )
......@@ -1175,16 +1151,14 @@ void GalleryBrowser2::Dispatch(
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;
aSeq[1].Name = OUString( SVXGALLERYITEM_URL );
aSeq[1].Value <<= aFileURL;
aSeq[2].Name = OUString( SVXGALLERYITEM_FILTER );
aSeq[2].Value <<= aFilterName;
aSeq[3].Name = OUString( SVXGALLERYITEM_DRAWING );
aSeq[3].Value <<= xDrawing;
aSeq[4].Name = OUString( SVXGALLERYITEM_GRAPHIC );
aSeq[4].Value <<= xGraphic;
css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 );
aArgs[0].Name = OUString( SVXGALLERYITEM_ARGNAME );
......
......@@ -302,37 +302,15 @@ Menu RID_SVXMN_GALLERY2
{
MenuItem
{
Identifier = MN_ADDMENU ;
HelpId = HID_GALLERY_MN_ADDMENU ;
Identifier = MN_ADD ;
HelpId = HID_GALLERY_MN_ADD ;
Text [ en-US ] = "~Insert" ;
SubMenu = Menu
{
ItemList =
{
MenuItem
{
Identifier = MN_ADD ;
HelpId = HID_GALLERY_MN_ADD ;
Text [ en-US ] = "~Copy" ;
};
MenuItem
{
Identifier = MN_ADD_LINK ;
HelpId = HID_GALLERY_MN_ADD_LINK ;
Text [ en-US ] = "Link" ;
};
MenuItem
{
Separator = TRUE ;
};
MenuItem
{
Identifier = MN_BACKGROUND ;
HelpId = HID_GALLERY_MN_BACKGROUND ;
Text [ en-US ] = "Bac~kground" ;
};
};
};
};
MenuItem
{
Identifier = MN_BACKGROUND ;
HelpId = HID_GALLERY_MN_BACKGROUND ;
Text [ en-US ] = "Insert as Bac~kground" ;
};
MenuItem
{
......
......@@ -30,7 +30,6 @@ TYPEINIT1_AUTOFACTORY( SvxGalleryItem, SfxPoolItem );
SvxGalleryItem::SvxGalleryItem()
: m_nType( css::gallery::GalleryItemType::EMPTY )
, m_bIsLink( sal_False )
{
DBG_CTOR(SvxGalleryItem, 0);
}
......@@ -38,7 +37,6 @@ SvxGalleryItem::SvxGalleryItem()
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 )
......@@ -50,7 +48,6 @@ SvxGalleryItem::SvxGalleryItem(
const ::sal_uInt16 nId )
: SfxPoolItem( nId )
, m_nType( css::gallery::GalleryItemType::EMPTY )
, m_bIsLink( sal_False )
{
DBG_CTOR(SvxGalleryItem, 0);
}
......@@ -66,16 +63,14 @@ bool SvxGalleryItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /* nMemberId */
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[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVXGALLERYITEM_URL ));
aSeq[1].Value <<= m_aURL;
aSeq[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVXGALLERYITEM_FILTER ));
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;
aSeq[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVXGALLERYITEM_DRAWING ));
aSeq[3].Value <<= m_xDrawing;
aSeq[4].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVXGALLERYITEM_GRAPHIC ));
aSeq[4].Value <<= m_xGraphic;
rVal <<= aSeq;
......@@ -94,7 +89,6 @@ bool SvxGalleryItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /* nMemberId
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;
......@@ -108,11 +102,6 @@ bool SvxGalleryItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /* nMemberId
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 );
......@@ -139,7 +128,6 @@ bool SvxGalleryItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /* nMemberId
return false;
m_nType = nType;
m_bIsLink = bIsLink;
m_aURL = aURL;
m_aFilterName = aFilterName;
m_xDrawing = xDrawing;
......@@ -155,7 +143,6 @@ int SvxGalleryItem::operator==( const SfxPoolItem& rAttr ) const
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;
......
......@@ -707,13 +707,6 @@ void SwBaseShell::Execute(SfxRequest &rReq)
String aGrfName, aFltName;
const Graphic aGrf( pGalleryItem->GetGraphic() );
if( pGalleryItem->IsLink() )
{
// Linked
aGrfName = pGalleryItem->GetURL();
aFltName = pGalleryItem->GetFilterName();
}
if ( nSelType & nsSelectionType::SEL_GRF )
rSh.ReRead( aGrfName, aFltName, &aGrf );
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment