summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-11-14 17:25:30 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-11-14 17:25:47 +0100
commitc1f416feda0ef4ef215ca587b9bac03659b48c7a (patch)
tree034acd437ef021c2580682b38bd5a8361618ce93 /sw
parenta1115a5983e126f872c6d7f14aef8ce5bba4010a (diff)
SvxBrushItem: Improve Referer from member to GetGraphic[Object] parameter
Change-Id: I034132c315b74d0ea5e03b7d5f7cc225a6c8164e
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/layout/paintfrm.cxx18
-rw-r--r--sw/source/core/unocore/unosett.cxx4
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx10
-rw-r--r--sw/source/ui/shells/grfsh.cxx16
4 files changed, 35 insertions, 13 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 9c0d1296a350..83c87aa279fe 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -19,6 +19,7 @@
#include <vcl/lazydelete.hxx>
#include <vcl/gradient.hxx>
+#include <sfx2/docfile.hxx>
#include <sfx2/progress.hxx>
#include <editeng/brushitem.hxx>
#include <editeng/opaqitem.hxx>
@@ -1835,7 +1836,12 @@ void DrawGraphic( const SvxBrushItem *pBrush,
else
((SvxBrushItem*)pBrush)->SetDoneLink( STATIC_LINK(
rSh.GetDoc(), SwDoc, BackgroundDone ) );
- const Graphic* pGrf = pBrush->GetGraphic();
+ OUString referer;
+ SfxObjectShell * sh = rSh.GetDoc()->GetPersist();
+ if (sh != 0 && sh->HasName()) {
+ referer = sh->GetMedium()->GetName();
+ }
+ const Graphic* pGrf = pBrush->GetGraphic(referer);
if( pGrf && GRAPHIC_NONE != pGrf->GetType() )
{
ePos = pBrush->GetGraphicPos();
@@ -7137,7 +7143,15 @@ const Color& SwPageFrm::GetDrawBackgrdColor() const
if ( GetBackgroundBrush( pBrushItem, pFillStyleItem, pFillGradientItem, pDummyColor, aDummyRect, true) )
{
- const Graphic* pGraphic = pBrushItem->GetGraphic();
+ OUString referer;
+ SwViewShell * sh1 = getRootFrm()->GetCurrShell();
+ if (sh1 != 0) {
+ SfxObjectShell * sh2 = sh1->GetDoc()->GetPersist();
+ if (sh2 != 0 && sh2->HasName()) {
+ referer = sh2->GetMedium()->GetName();
+ }
+ }
+ const Graphic* pGraphic = pBrushItem->GetGraphic(referer);
if(pGraphic)
{
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 9aae7dbb790a..cea2d9e26b84 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1991,7 +1991,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
pSetBrush = new SvxBrushItem(*pOrigBrush);
}
else
- pSetBrush = new SvxBrushItem(aEmptyOUStr, ""/*TODO?*/, aEmptyOUStr, GPOS_AREA, RES_BACKGROUND);
+ pSetBrush = new SvxBrushItem(aEmptyOUStr, aEmptyOUStr, GPOS_AREA, RES_BACKGROUND);
}
pSetBrush->PutValue( pData->aVal, MID_GRAPHIC_URL );
}
@@ -2010,7 +2010,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
pSetBrush = new SvxBrushItem(*pOrigBrush);
}
else
- pSetBrush = new SvxBrushItem(aEmptyOUStr, ""/*TODO?*/, aEmptyOUStr, GPOS_AREA, RES_BACKGROUND);
+ pSetBrush = new SvxBrushItem(aEmptyOUStr, aEmptyOUStr, GPOS_AREA, RES_BACKGROUND);
}
BitmapEx aBmp = VCLUnoHelper::GetBitmap( *pBitmap );
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index b6a06690c66c..de476b5ef73c 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2445,7 +2445,13 @@ void SwGrfExtPage::ActivatePage(const SfxItemSet& rSet)
aGrfName = aNewGrfName = rBrush.GetGraphicLink();
m_pConnectED->SetText( aNewGrfName );
}
- const Graphic* pGrf = rBrush.GetGraphic();
+ OUString referer;
+ SfxStringItem const * it = static_cast<SfxStringItem const *>(
+ rSet.GetItem(SID_REFERER));
+ if (it != 0) {
+ referer = it->GetValue();
+ }
+ const Graphic* pGrf = rBrush.GetGraphic(referer);
if( pGrf )
m_pBmpWin->SetGraphic( *pGrf );
}
@@ -2499,7 +2505,7 @@ sal_Bool SwGrfExtPage::FillItemSet( SfxItemSet &rSet )
{
bModified = sal_True;
aGrfName = m_pConnectED->GetText();
- rSet.Put( SvxBrushItem( aGrfName, ""/*TODO?*/, aFilterName, GPOS_LT,
+ rSet.Put( SvxBrushItem( aGrfName, aFilterName, GPOS_LT,
SID_ATTR_GRAF_GRAPHIC ));
}
return bModified;
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index c6dadbfbbe35..949c7e639701 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -209,6 +209,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
SID_DOCFRAME, SID_DOCFRAME,
SID_HTML_MODE, SID_HTML_MODE,
FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME,
+ SID_REFERER, SID_REFERER,
0);
sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
@@ -262,17 +263,11 @@ void SwGrfShell::Execute(SfxRequest &rReq)
rSh.GetGrfNms( &sGrfNm, &sFilterNm );
if( !sGrfNm.isEmpty() )
{
- OUString sReferer;
- SfxObjectShell * sh = rSh.GetDoc()->GetPersist();
- if (sh != 0 && sh->HasName())
- {
- sReferer = sh->GetMedium()->GetName();
- }
aSet.Put( SvxBrushItem( INetURLObject::decode( sGrfNm,
INET_HEX_ESCAPE,
INetURLObject::DECODE_UNAMBIGUOUS,
RTL_TEXTENCODING_UTF8 ),
- sReferer, sFilterNm, GPOS_LT,
+ sFilterNm, GPOS_LT,
SID_ATTR_GRAF_GRAPHIC ));
}
else
@@ -301,6 +296,13 @@ void SwGrfShell::Execute(SfxRequest &rReq)
aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame()));
+ SfxObjectShell * sh = rSh.GetDoc()->GetPersist();
+ if (sh != 0 && sh->HasName())
+ {
+ aSet.Put(
+ SfxStringItem(SID_REFERER, sh->GetMedium()->GetName()));
+ }
+
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "no dialog factory!");
SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog("PictureDialog",