Kaydet (Commit) 50a0ddb9 authored tarafından Charu Tyagi's avatar Charu Tyagi Kaydeden (comit) Stephan Bergmann

fdo#87441-Send document as Email removes invisible content

Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, plus trivial
modifications for -Werror,-Wlogical-op-parentheses and loplugin:bodynotinblock

Change-Id: I149681b3743eaf96e98419bd568f88b451e9ba01
üst 08983ca2
......@@ -938,6 +938,7 @@ class MailerProgramCfg_Impl : public utl::ConfigItem
OUString sProgram;
// readonly states
bool bROProgram;
bool bHidden;
const Sequence<OUString> GetPropertyNames();
......@@ -973,6 +974,12 @@ MailerProgramCfg_Impl::MailerProgramCfg_Impl() :
bROProgram = pROStates[nProp];
}
break;
case 1 :
{
pValues[nProp] >>= bHidden;;
}
break;
}
}
}
......@@ -988,9 +995,10 @@ MailerProgramCfg_Impl::~MailerProgramCfg_Impl()
const Sequence<OUString> MailerProgramCfg_Impl::GetPropertyNames()
{
Sequence<OUString> aRet(1);
Sequence<OUString> aRet(2);
OUString* pRet = aRet.getArray();
pRet[0] = "Program";
pRet[1] = "Hidden";
return aRet;
}
......@@ -1019,6 +1027,13 @@ void MailerProgramCfg_Impl::ImplCommit()
}
}
break;
case 1:
{
aNames[nRealCount] = aOrgNames[nProp];
aValues[nRealCount] <<= bHidden;;
++nRealCount;
}
break;
}
}
......@@ -1046,6 +1061,7 @@ SvxEMailTabPage::SvxEMailTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
get(m_pMailerURLFI, "lockemail");
get(m_pMailerURLED, "url");
get(m_pMailerURLPB, "browse");
get(m_pSuppressHidden, "suppressHidden");
m_sDefaultFilterName = get<FixedText>("browsetitle")->GetText();
m_pMailerURLPB->SetClickHdl( LINK( this, SvxEMailTabPage, FileDialogHdl_Impl ) );
}
......@@ -1069,9 +1085,10 @@ SfxTabPage* SvxEMailTabPage::Create( vcl::Window* pParent, const SfxItemSet* rA
bool SvxEMailTabPage::FillItemSet( SfxItemSet* )
{
bool bMailModified = false;
if(!pImpl->aMailConfig.bROProgram && m_pMailerURLED->IsValueChangedFromSaved())
if((!pImpl->aMailConfig.bROProgram && m_pMailerURLED->IsValueChangedFromSaved()) || m_pSuppressHidden->IsValueChangedFromSaved())
{
pImpl->aMailConfig.sProgram = m_pMailerURLED->GetText();
pImpl->aMailConfig.bHidden = m_pSuppressHidden->GetState();
bMailModified = true;
}
if ( bMailModified )
......@@ -1093,6 +1110,12 @@ void SvxEMailTabPage::Reset( const SfxItemSet* )
m_pMailerURLED->SetText(pImpl->aMailConfig.sProgram);
m_pMailerURLED->SaveValue();
if(pImpl->aMailConfig.bHidden)
m_pSuppressHidden->SetState(TRISTATE_TRUE);
else
m_pSuppressHidden->SetState(TRISTATE_FALSE);
m_pSuppressHidden->SaveValue();
m_pMailContainer->Enable(!pImpl->aMailConfig.bROProgram);
}
......
......@@ -186,6 +186,7 @@ class SvxEMailTabPage : public SfxTabPage
FixedImage* m_pMailerURLFI;
Edit* m_pMailerURLED;
PushButton* m_pMailerURLPB;
CheckBox* m_pSuppressHidden;
OUString m_sDefaultFilterName;
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkFrame" id="OptEmailPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -32,6 +31,8 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
......@@ -46,19 +47,25 @@
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="browse">
<property name="label" translatable="yes">Browse...</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
......@@ -72,6 +79,8 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
......@@ -84,8 +93,47 @@
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">4</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="suppress">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Suppress hidden elements of documents</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="suppressHidden">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
......
......@@ -6394,6 +6394,12 @@
</info>
<value/>
</prop>
<prop oor:name="Hidden" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Specifies whether invisible content should be hidden or not.</desc>
</info>
<value>true</value>
</prop>
</group>
<group oor:name="I18N">
<info>
......
......@@ -115,6 +115,9 @@
#include <com/sun/star/script/vba/VBAEventId.hpp>
#include <editeng/acorrcfg.hxx>
#include <SwStyleNameMapper.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <sfx2/fcontnr.hxx>
......@@ -130,6 +133,9 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
using namespace ::sfx2;
using com::sun::star::container::XNameAccess;
using com::sun::star::beans::PropertyValue;
using namespace com::sun::star::configuration;
// create DocInfo (virtual)
SfxDocumentInfoDialog* SwDocShell::CreateDocumentInfoDialog(
......@@ -835,7 +841,26 @@ void SwDocShell::Execute(SfxRequest& rReq)
mpWrtShell->StartAllAction();
mpDoc->getIDocumentFieldsAccess().UpdateFlds( NULL, false );
mpDoc->getIDocumentLinksAdministration().EmbedAllLinks();
mpDoc->RemoveInvisibleContent();
OUString aConfigRoot = "org.openoffice.Office.Common/ExternalMailer";
PropertyValue aProperty;
aProperty.Name = "nodepath";
aProperty.Value = makeAny( aConfigRoot );
Sequence< Any > aArgumentList( 1 );
aArgumentList[0] = makeAny( aProperty );
uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigurationProvider;
m_xConfigurationProvider = theDefaultProvider::get(xContext);
Reference< XNameAccess > xNameAccess =
Reference< XNameAccess > (m_xConfigurationProvider->createInstanceWithArguments(
OUString("com.sun.star.configuration.ConfigurationAccess"),
aArgumentList ),
UNO_QUERY );
bool bRemoveInvisible;
xNameAccess->getByName("Hidden") >>= bRemoveInvisible;
if(bRemoveInvisible)
mpDoc->RemoveInvisibleContent();
if(mpWrtShell)
mpWrtShell->EndAllAction();
}
......
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