summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-12-16 13:15:45 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-12-16 13:15:45 +0100
commit658ddc59a57c7a5ad6a4287c34e9938881d6d75a (patch)
tree61084dc9aa090f9e0c3af97aca0e526a5cbe4f36
parentb6b620bf7cc82c6f60fe9d698e95c0b2902bf319 (diff)
parentd205c283bbe82bcff9efe638df41a944152bd663 (diff)
undoapi: merged DEV300m95
-rw-r--r--configmgr/source/childaccess.cxx18
-rw-r--r--drawinglayer/source/primitive2d/metafileprimitive2d.cxx12
-rw-r--r--editeng/inc/editeng/svxrtf.hxx2
-rw-r--r--editeng/source/items/flditem.cxx109
-rw-r--r--editeng/source/misc/svxacorr.cxx2
-rw-r--r--editeng/source/rtf/rtfitem.cxx12
-rw-r--r--editeng/source/rtf/svxrtf.cxx10
-rw-r--r--officecfg/registry/data/org/openoffice/Interaction.xcu12
-rw-r--r--officecfg/registry/data/org/openoffice/Office/Writer.xcu3
-rw-r--r--sfx2/inc/sfx2/docfile.hxx2
-rw-r--r--sfx2/inc/sfx2/passwd.hxx22
-rw-r--r--sfx2/inc/sfx2/sfxsids.hrc4
-rw-r--r--sfx2/inc/sfx2/sfxuno.hxx3
-rw-r--r--sfx2/sdi/sfx.sdi2
-rw-r--r--sfx2/source/appl/appopen.cxx49
-rw-r--r--sfx2/source/appl/appuno.cxx22
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx31
-rw-r--r--sfx2/source/dialog/mailmodelapi.cxx2
-rw-r--r--[-rwxr-xr-x]sfx2/source/dialog/makefile.mk2
-rw-r--r--sfx2/source/dialog/passwd.cxx179
-rw-r--r--sfx2/source/dialog/passwd.hrc5
-rw-r--r--sfx2/source/dialog/passwd.src30
-rw-r--r--sfx2/source/dialog/versdlg.cxx8
-rw-r--r--sfx2/source/doc/docfile.cxx14
-rw-r--r--sfx2/source/doc/guisaveas.cxx10
-rw-r--r--sfx2/source/doc/objserv.cxx3
-rw-r--r--sfx2/source/doc/objstor.cxx46
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx70
-rw-r--r--svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx9
-rw-r--r--svx/inc/svx/svdograf.hxx3
-rw-r--r--svx/source/sdr/contact/objectcontactofobjlistpainter.cxx19
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgraphic.cxx36
-rw-r--r--svx/source/svdraw/svdmodel.cxx2
-rw-r--r--svx/source/svdraw/svdograf.cxx192
-rw-r--r--xmloff/source/draw/XMLGraphicsDefaultStyle.cxx18
-rw-r--r--xmloff/source/text/XMLTextListAutoStylePool.cxx8
36 files changed, 663 insertions, 308 deletions
diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx
index c20fa49fb1..d387f351de 100644
--- a/configmgr/source/childaccess.cxx
+++ b/configmgr/source/childaccess.cxx
@@ -282,8 +282,8 @@ css::uno::Any ChildAccess::asValue() {
if (!Components::allLocales(locale)) {
// Find best match using an adaption of RFC 4647 lookup matching
// rules, removing "-" or "_" delimited segments from the end;
- // defaults are the empty string locale, the "en-US" locale, the
- // "en" locale, the first child (if any), or a nil value (even
+ // defaults are the "en-US" locale, the "en" locale, the empty
+ // string locale, the first child (if any), or a nil value (even
// though it may be illegal for the given property), in that
// order:
rtl::Reference< ChildAccess > child;
@@ -296,6 +296,9 @@ css::uno::Any ChildAccess::asValue() {
while (i > 0 && locale[i] != '-' && locale[i] != '_') {
--i;
}
+ if (i == 0) {
+ break;
+ }
locale = locale.copy(0, i);
}
if (!child.is()) {
@@ -305,10 +308,13 @@ css::uno::Any ChildAccess::asValue() {
child = getChild(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")));
if (!child.is()) {
- std::vector< rtl::Reference< ChildAccess > > all(
- getAllChildren());
- if (!all.empty()) {
- child = all.front();
+ child = getChild(rtl::OUString());
+ if (!child.is()) {
+ std::vector< rtl::Reference< ChildAccess > >
+ all(getAllChildren());
+ if (!all.empty()) {
+ child = all.front();
+ }
}
}
}
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index 269c5cfe06..6b1931d905 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -248,9 +248,12 @@ namespace
if(nPushFlags)
{
OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: PUSH with no property holders (!)");
- PropertyHolder* pNew = new PropertyHolder(*maPropertyHolders.back());
- pNew->setPushFlags(nPushFlags);
- maPropertyHolders.push_back(pNew);
+ if ( !maPropertyHolders.empty() )
+ {
+ PropertyHolder* pNew = new PropertyHolder(*maPropertyHolders.back());
+ pNew->setPushFlags(nPushFlags);
+ maPropertyHolders.push_back(pNew);
+ }
}
}
@@ -354,8 +357,9 @@ namespace
PropertyHolder& Current()
{
+ static PropertyHolder aDummy;
OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: CURRENT with no property holders (!)");
- return *maPropertyHolders.back();
+ return maPropertyHolders.empty() ? aDummy : *maPropertyHolders.back();
}
~PropertyHolders()
diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx
index c74f6c2a2a..c1039f9347 100644
--- a/editeng/inc/editeng/svxrtf.hxx
+++ b/editeng/inc/editeng/svxrtf.hxx
@@ -470,7 +470,7 @@ inline const Color& SvxRTFParser::GetColor( size_t nId ) const
inline SfxItemSet& SvxRTFParser::GetAttrSet()
{
SvxRTFItemStackTypePtr pTmp;
- if( bNewGroup || 0 == ( pTmp = aAttrStack.back()) )
+ if( bNewGroup || 0 == ( pTmp = aAttrStack.empty() ? 0 : aAttrStack.back()) )
pTmp = _GetAttrSet();
return pTmp->aAttrSet;
}
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index b5151dc71e..b6e2efb976 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -377,83 +377,46 @@ int SvxURLField::operator==( const SvxFieldData& rOther ) const
// -----------------------------------------------------------------------
-void SvxURLField::Load( SvPersistStream & rStm )
+static void write_unicode( SvPersistStream & rStm, const String& rString )
{
- USHORT nFormat;
- sal_uInt32 nFrameMarker, nCharSetMarker;
- long nUlongSize = (long)sizeof(sal_uInt32);
- String aTmpURL;
-
- rStm >> nFormat;
-
- // UNICODE: rStm >> aTmpURL;
- rStm.ReadByteString(aTmpURL);
-
- // UNICODE: rStm >> aRepresentation;
- // read to a temp string first, read text encoding and
- // convert later to stay compatible to fileformat
- ByteString aTempString;
- rtl_TextEncoding aTempEncoding = RTL_TEXTENCODING_MS_1252; // #101493# Init for old documents
- rStm.ReadByteString(aTempString);
+ USHORT nL = rString.Len();
+ rStm << nL;
+ rStm.Write( rString.GetBuffer(), nL*sizeof(sal_Unicode) );
+}
- rStm >> nFrameMarker;
- if ( nFrameMarker == FRAME_MARKER )
+static void read_unicode( SvPersistStream & rStm, String& rString )
+{
+ USHORT nL = 0;
+ rStm >> nL;
+ if ( nL )
{
- // UNICODE: rStm >> aTargetFrame;
- rStm.ReadByteString(aTargetFrame);
-
- rStm >> nCharSetMarker;
- if ( nCharSetMarker == CHARSET_MARKER )
- {
- USHORT nCharSet;
- rStm >> nCharSet;
-
- // remember encoding
- aTempEncoding = (rtl_TextEncoding)nCharSet;
- }
- else
- rStm.SeekRel( -nUlongSize );
+ rString.AllocBuffer( nL );
+ rStm.Read( rString.GetBufferAccess(), nL*sizeof(sal_Unicode) );
+ rString.ReleaseBufferAccess( nL );
}
- else
- rStm.SeekRel( -nUlongSize );
+}
- // now build representation string due to known encoding
- aRepresentation = String(aTempString, aTempEncoding);
+void SvxURLField::Load( SvPersistStream & rStm )
+{
+ USHORT nFormat = 0;
+ rStm >> nFormat;
eFormat= (SvxURLFormat)nFormat;
- // Relatives Speichern => Beim laden absolut machen.
- DBG_ERROR("No BaseURL!");
- // TODO/MBA: no BaseURL
- aURL = INetURLObject::GetAbsURL( String(), aTmpURL );
+ read_unicode( rStm, aURL );
+ read_unicode( rStm, aRepresentation );
+ read_unicode( rStm, aTargetFrame );
}
// -----------------------------------------------------------------------
void SvxURLField::Save( SvPersistStream & rStm )
{
- // Relatives Speichern der URL
- DBG_ERROR("No BaseURL!");
- // TODO/MBA: no BaseURL
- String aTmpURL = INetURLObject::GetRelURL( String(), aURL );
-
rStm << (USHORT)eFormat;
- // UNICODE: rStm << aTmpURL;
- rStm.WriteByteString(aTmpURL);
-
- // UNICODE: rStm << aRepresentation;
- rStm.WriteByteString(aRepresentation);
-
- rStm << FRAME_MARKER;
-
- // UNICODE: rStm << aTargetFrame;
- rStm.WriteByteString(aTargetFrame);
-
- rStm << CHARSET_MARKER;
-
- // #90477# rStm << (USHORT)GetStoreCharSet(gsl_getSystemTextEncoding(), rStm.GetVersion());
- rStm << (USHORT)GetSOStoreTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rStm.GetVersion());
+ write_unicode( rStm, aURL );
+ write_unicode( rStm, aRepresentation );
+ write_unicode( rStm, aTargetFrame );
}
MetaAction* SvxURLField::createBeginComment() const
@@ -921,16 +884,11 @@ int SvxAuthorField::operator==( const SvxFieldData& rOther ) const
void SvxAuthorField::Load( SvPersistStream & rStm )
{
- USHORT nType, nFormat;
-
- // UNICODE: rStm >> aName;
- rStm.ReadByteString(aName);
+ USHORT nType = 0, nFormat = 0;
- // UNICODE: rStm >> aFirstName;
- rStm.ReadByteString(aFirstName);
-
- // UNICODE: rStm >> aShortName;
- rStm.ReadByteString(aShortName);
+ read_unicode( rStm, aName );
+ read_unicode( rStm, aFirstName );
+ read_unicode( rStm, aShortName );
rStm >> nType;
rStm >> nFormat;
@@ -943,14 +901,9 @@ void SvxAuthorField::Load( SvPersistStream & rStm )
void SvxAuthorField::Save( SvPersistStream & rStm )
{
- // UNICODE: rStm << aName;
- rStm.WriteByteString(aName);
-
- // UNICODE: rStm << aFirstName;
- rStm.WriteByteString(aFirstName);
-
- // UNICODE: rStm << aShortName;
- rStm.WriteByteString(aShortName);
+ write_unicode( rStm, aName );
+ write_unicode( rStm, aFirstName );
+ write_unicode( rStm, aShortName );
rStm << (USHORT) eType;
rStm << (USHORT) eFormat;
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index c083f02fab..e3efca33ad 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -701,7 +701,7 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace(
bRunNext = true;
}
}
- else if ( cChar == '/' )
+ else if ( cChar == '/' && nEndPos > 1 && rTxt.Len() > (nEndPos - 1) )
{
// Remove the hardspace right before to avoid formatting URLs
sal_Unicode cPrevChar = rTxt.GetChar( nEndPos - 1 );
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index 4e68a841e7..4f0ecccef7 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -228,7 +228,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
RTF_CharTypeDef eCharType = NOTDEF_CHARTYPE;
USHORT nFontAlign;
- int bChkStkPos = !bNewGroup && aAttrStack.back();
+ int bChkStkPos = !bNewGroup && !aAttrStack.empty();
while( bWeiter && IsParserWorking() ) // solange bekannte Attribute erkannt werden
{
@@ -250,7 +250,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
if( !bChkStkPos )
break;
- SvxRTFItemStackType* pAkt = aAttrStack.back();
+ SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
if( !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() &&
pAkt->nSttCnt == pInsPos->GetCntIdx() ))
break;
@@ -269,7 +269,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
// alle bis hierher gueltigen Attribute "setzen"
AttrGroupEnd();
- pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd!
+ pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd!
pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 );
aAttrStack.push_back( pNew );
@@ -305,7 +305,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
nStyleNo = -1 == nTokenValue ? 0 : USHORT(nTokenValue);
// setze am akt. auf dem AttrStack stehenden Style die
// StyleNummer
- SvxRTFItemStackType* pAkt = aAttrStack.back();
+ SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
if( !pAkt )
break;
@@ -1869,7 +1869,7 @@ void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet,
// pard / plain abarbeiten
void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet )
{
- if( !bNewGroup && aAttrStack.back() ) // not at the beginning of a new group
+ if( !bNewGroup && !aAttrStack.empty() ) // not at the beginning of a new group
{
SvxRTFItemStackType* pAkt = aAttrStack.back();
@@ -1887,7 +1887,7 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet )
// alle bis hierher gueltigen Attribute "setzen"
AttrGroupEnd();
- pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd!
+ pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd!
pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 );
aAttrStack.push_back( pNew );
pAkt = pNew;
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 1fc96e45d7..83222c7033 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -875,7 +875,7 @@ const Font& SvxRTFParser::GetFont( USHORT nId )
SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( int bCopyAttr )
{
- SvxRTFItemStackType* pAkt = aAttrStack.back();
+ SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
SvxRTFItemStackType* pNew;
if( pAkt )
pNew = new SvxRTFItemStackType( *pAkt, *pInsPos, bCopyAttr );
@@ -941,9 +941,9 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen
{
if( !aAttrStack.empty() )
{
- SvxRTFItemStackType *pOld = aAttrStack.back();
+ SvxRTFItemStackType *pOld = aAttrStack.empty() ? 0 : aAttrStack.back();
aAttrStack.pop_back();
- SvxRTFItemStackType *pAkt = aAttrStack.back();
+ SvxRTFItemStackType *pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
do { // middle check loop
ULONG nOldSttNdIdx = pOld->pSttNd->GetIdx();
@@ -1118,7 +1118,7 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen
// alle bis hierher gueltigen Attribute "setzen"
AttrGroupEnd();
- pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd!
+ pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd!
pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 );
aAttrStack.push_back( pNew );
pAkt = pNew;
@@ -1181,7 +1181,7 @@ void SvxRTFParser::SetAttrSet( SvxRTFItemStackType &rSet )
// Is text wasn't inserted? (Get SttPos from the top of stack!)
int SvxRTFParser::IsAttrSttPos()
{
- SvxRTFItemStackType* pAkt = aAttrStack.back();
+ SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
return !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() &&
pAkt->nSttCnt == pInsPos->GetCntIdx());
}
diff --git a/officecfg/registry/data/org/openoffice/Interaction.xcu b/officecfg/registry/data/org/openoffice/Interaction.xcu
index 4269378c36..c359ea662b 100644
--- a/officecfg/registry/data/org/openoffice/Interaction.xcu
+++ b/officecfg/registry/data/org/openoffice/Interaction.xcu
@@ -52,5 +52,17 @@
<value>com.sun.star.comp.dbaccess.DatabaseInteractionHandler</value>
</prop>
</node>
+ <node oor:name="org.openoffice.Filter.PDFExport.Interactions" oor:op="replace">
+ <node oor:name="HandledRequestTypes">
+ <node oor:name="com.sun.star.task.PDFExportException" oor:op="replace">
+ <prop oor:name="Propagation" oor:type="xs:string">
+ <value>named-and-derived</value>
+ </prop>
+ </node>
+ </node>
+ <prop oor:name="ServiceName" oor:type="xs:string">
+ <value>com.sun.star.filter.pdfexport.PDFExportInteractionHandler</value>
+ </prop>
+ </node>
</node>
</oor:component-data>
diff --git a/officecfg/registry/data/org/openoffice/Office/Writer.xcu b/officecfg/registry/data/org/openoffice/Office/Writer.xcu
index 8add2a0aa1..5f3bd4e6e3 100644
--- a/officecfg/registry/data/org/openoffice/Office/Writer.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Writer.xcu
@@ -53,6 +53,9 @@
</node>
<node oor:name="Insert">
<node oor:name="Caption">
+ <prop oor:name="CaptionOrderNumberingFirst">
+ <value xml:lang="hu">true</value>
+ </prop>
<node oor:name="WriterObject">
<node oor:name="Table">
<node oor:name="Settings">
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index 8bed61e997..ccf5c7a353 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -112,7 +112,7 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
SAL_DLLPRIVATE void CloseStreams_Impl();
DECL_DLLPRIVATE_STATIC_LINK( SfxMedium, UCBHdl_Impl, sal_uInt32 * );
- SAL_DLLPRIVATE void SetPasswordToStorage_Impl();
+ SAL_DLLPRIVATE void SetEncryptionDataToStorage_Impl();
#endif
public:
diff --git a/sfx2/inc/sfx2/passwd.hxx b/sfx2/inc/sfx2/passwd.hxx
index f761a3965c..89648fbbef 100644
--- a/sfx2/inc/sfx2/passwd.hxx
+++ b/sfx2/inc/sfx2/passwd.hxx
@@ -39,29 +39,35 @@
// defines ---------------------------------------------------------------
-#define SHOWEXTRAS_NONE ((USHORT)0x0000)
-#define SHOWEXTRAS_USER ((USHORT)0x0001)
-#define SHOWEXTRAS_CONFIRM ((USHORT)0x0002)
-#define SHOWEXTRAS_ALL ((USHORT)(SHOWEXTRAS_USER | SHOWEXTRAS_CONFIRM))
+#define SHOWEXTRAS_NONE ((USHORT)0x0000)
+#define SHOWEXTRAS_USER ((USHORT)0x0001)
+#define SHOWEXTRAS_CONFIRM ((USHORT)0x0002)
+#define SHOWEXTRAS_PASSWORD2 ((USHORT)0x0004)
+#define SHOWEXTRAS_CONFIRM2 ((USHORT)0x0008)
+#define SHOWEXTRAS_ALL ((USHORT)(SHOWEXTRAS_USER | SHOWEXTRAS_CONFIRM))
// class SfxPasswordDialog -----------------------------------------------
class SFX2_DLLPUBLIC SfxPasswordDialog : public ModalDialog
{
private:
+ FixedLine maPasswordBox;
FixedText maUserFT;
Edit maUserED;
FixedText maPasswordFT;
Edit maPasswordED;
FixedText maConfirmFT;
Edit maConfirmED;
- FixedLine maPasswordBox;
+ FixedLine maPassword2Box;
+ FixedText maPassword2FT;
+ Edit maPassword2ED;
+ FixedText maConfirm2FT;
+ Edit maConfirm2ED;
OKButton maOKBtn;
CancelButton maCancelBtn;
HelpButton maHelpBtn;
- String maConfirmStr;
USHORT mnMinLen;
USHORT mnExtras;
@@ -75,6 +81,10 @@ public:
String GetUser() const { return maUserED.GetText(); }
String GetPassword() const { return maPasswordED.GetText(); }
String GetConfirm() const { return maConfirmED.GetText(); }
+
+ String GetPassword2() const { return maPassword2ED.GetText(); }
+ String GetConfirm2() const { return maConfirm2ED.GetText(); }
+ void SetGroup2Text( const String& i_rText ) { maPassword2Box.SetText( i_rText ); }
void SetMinLen( USHORT Len );
void SetMaxLen( USHORT Len );
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index 22bc162f40..c693a5e4d6 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -313,7 +313,9 @@
#define SID_RECOMMENDREADONLY (SID_SFX_START + 1719)
#define SID_SUGGESTEDSAVEASDIR (SID_SFX_START + 1720)
#define SID_SUGGESTEDSAVEASNAME (SID_SFX_START + 1721)
-#define SID_SFX_free_START (SID_SFX_START + 1722)
+#define SID_ENCRYPTIONDATA (SID_SFX_START + 1722)
+#define SID_PASSWORDINTERACTION (SID_SFX_START + 1723)
+#define SID_SFX_free_START (SID_SFX_START + 1724)
#define SID_SFX_free_END (SID_SFX_START + 3999)
#define SID_OPEN_NEW_VIEW (SID_SFX_START + 520)
diff --git a/sfx2/inc/sfx2/sfxuno.hxx b/sfx2/inc/sfx2/sfxuno.hxx
index f070dd4676..0b441b2f0f 100644
--- a/sfx2/inc/sfx2/sfxuno.hxx
+++ b/sfx2/inc/sfx2/sfxuno.hxx
@@ -37,6 +37,7 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
//________________________________________________________________________________________________________________________
@@ -104,7 +105,7 @@ SFX2_DLLPUBLIC void TransformItems( sal_uInt16 nSlotId ,
UNOSEQUENCE< UNOPROPERTYVALUE >& seqArgs ,
const SfxSlot* pSlot = 0 );
-sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, ::rtl::OUString& rPasswd );
+bool GetEncryptionData_Impl( const SfxItemSet* pSet, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData );
#define FrameSearchFlags sal_Int32
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index f19d1c4890..49e87baeea 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -5267,7 +5267,7 @@ SfxBoolItem SaveAll SID_SAVEDOCS
//--------------------------------------------------------------------------
SfxBoolItem SaveAs SID_SAVEASDOC
-(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem Password SID_PASSWORD,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxStringItem VersionAuthor SID_DOCINFO_AUTHOR,SfxBoolItem Overwrite SID_OVERWRITE,SfxBoolItem Unpacked SID_UNPACK,SfxBoolItem SaveTo SID_SAVETO)
+(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem Password SID_PASSWORD,SfxBoolItem PasswordInteraction SID_PASSWORDINTERACTION,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxStringItem VersionAuthor SID_DOCINFO_AUTHOR,SfxBoolItem Overwrite SID_OVERWRITE,SfxBoolItem Unpacked SID_UNPACK,SfxBoolItem SaveTo SID_SAVETO)
[
/* flags: */
AutoUpdate = FALSE,
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index b7cf7129bd..bee6eb25d7 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -239,8 +239,7 @@ void SetTemplate_Impl( const String &rFileName,
pDoc->ResetFromTemplate( rLongName, rFileName );
}
-//--------------------------------------------------------------------
-
+//====================================================================
class SfxDocPasswordVerifier : public ::comphelper::IDocPasswordVerifier
{
public:
@@ -248,21 +247,33 @@ public:
mxStorage( rxStorage ) {}
virtual ::comphelper::DocPasswordVerifierResult
- verifyPassword( const ::rtl::OUString& rPassword );
+ verifyPassword( const ::rtl::OUString& rPassword, uno::Sequence< beans::NamedValue >& o_rEncryptionData );
+ virtual ::comphelper::DocPasswordVerifierResult
+ verifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData );
+
private:
Reference< embed::XStorage > mxStorage;
};
-::comphelper::DocPasswordVerifierResult SfxDocPasswordVerifier::verifyPassword( const ::rtl::OUString& rPassword )
+//--------------------------------------------------------------------
+::comphelper::DocPasswordVerifierResult SfxDocPasswordVerifier::verifyPassword( const ::rtl::OUString& rPassword, uno::Sequence< beans::NamedValue >& o_rEncryptionData )
+{
+ o_rEncryptionData = ::comphelper::OStorageHelper::CreatePackageEncryptionData( rPassword );
+ return verifyEncryptionData( o_rEncryptionData );
+}
+
+
+//--------------------------------------------------------------------
+::comphelper::DocPasswordVerifierResult SfxDocPasswordVerifier::verifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData )
{
::comphelper::DocPasswordVerifierResult eResult = ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD;
try
{
- // check the password
- // if the password correct is the stream will be opened successfuly
+ // check the encryption data
+ // if the data correct is the stream will be opened successfuly
// and immediatelly closed
- ::comphelper::OStorageHelper::SetCommonStoragePassword( mxStorage, rPassword );
+ ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( mxStorage, rEncryptionData );
mxStorage->openStreamElement(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "content.xml" ) ),
@@ -283,6 +294,8 @@ private:
return eResult;
}
+//====================================================================
+
//--------------------------------------------------------------------
sal_uInt32 CheckPasswd_Impl
@@ -341,14 +354,28 @@ sal_uInt32 CheckPasswd_Impl
if( xInteractionHandler.is() )
{
// use the comphelper password helper to request a password
+ ::rtl::OUString aPassword;
+ SFX_ITEMSET_ARG( pSet, pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False);
+ if ( pPasswordItem )
+ aPassword = pPasswordItem->GetValue();
+
+ uno::Sequence< beans::NamedValue > aEncryptionData;
+ SFX_ITEMSET_ARG( pSet, pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False);
+ if ( pEncryptionDataItem )
+ pEncryptionDataItem->GetValue() >>= aEncryptionData;
+
::rtl::OUString aDocumentName = INetURLObject( pFile->GetOrigURL() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET );
+
SfxDocPasswordVerifier aVerifier( xStorage );
- ::rtl::OUString aPassword = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
- aVerifier, ::rtl::OUString(), xInteractionHandler, aDocumentName, comphelper::DocPasswordRequestType_STANDARD );
+ aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
+ aVerifier, aEncryptionData, aPassword, xInteractionHandler, aDocumentName, comphelper::DocPasswordRequestType_STANDARD );
+
+ pSet->ClearItem( SID_PASSWORD );
+ pSet->ClearItem( SID_ENCRYPTIONDATA );
- if ( aPassword.getLength() > 0 )
+ if ( aEncryptionData.getLength() > 0 )
{
- pSet->Put( SfxStringItem( SID_PASSWORD, aPassword ) );
+ pSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) );
try
{
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 356c65bc71..08c08851f0 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -193,6 +193,8 @@ static char const sBlackList[] = "BlackList";
static char const sModifyPasswordInfo[] = "ModifyPasswordInfo";
static char const sSuggestedSaveAsDir[] = "SuggestedSaveAsDir";
static char const sSuggestedSaveAsName[] = "SuggestedSaveAsName";
+static char const sEncryptionData[] = "EncryptionData";
+
void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot )
{
@@ -852,6 +854,10 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque
{
rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
}
+ else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sEncryptionData)) )
+ {
+ rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
+ }
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuggestedSaveAsDir)) )
{
::rtl::OUString sVal;
@@ -868,7 +874,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque
if (bOK)
rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) );
}
-#ifdef DBG_UTIL
+#ifdef DBG_UTIL
else
--nFoundArgs;
#endif
@@ -1082,9 +1088,12 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta
nAdditional++;
if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SFX_ITEM_SET )
nAdditional++;
- if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SFX_ITEM_SET )
+ if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SFX_ITEM_SET )
+ nAdditional++;
+ if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SFX_ITEM_SET )
nAdditional++;
- if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SFX_ITEM_SET )
+ nAdditional++;
+ if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SFX_ITEM_SET )
nAdditional++;
// consider additional arguments
@@ -1221,6 +1230,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta
continue;
if ( nId == SID_NOAUTOSAVE )
continue;
+ if ( nId == SID_ENCRYPTIONDATA )
+ continue;
// used only internally
if ( nId == SID_SAVETO )
@@ -1594,6 +1605,11 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModifyPasswordInfo));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
+ if ( rSet.GetItemState( SID_ENCRYPTIONDATA, sal_False, &pItem ) == SFX_ITEM_SET )
+ {
+ pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sEncryptionData));
+ pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
+ }
if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSuggestedSaveAsDir));
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 3114009fe2..74bef50f2f 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1522,8 +1522,8 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
// check password checkbox if the document had password before
if( mbHasPassword )
{
- SFX_ITEMSET_ARG( rpSet, pPassItem, SfxStringItem, SID_PASSWORD, FALSE );
- mbPwdCheckBoxState = ( pPassItem != NULL );
+ SFX_ITEMSET_ARG( rpSet, pPassItem, SfxBoolItem, SID_PASSWORDINTERACTION, FALSE );
+ mbPwdCheckBoxState = ( pPassItem != NULL && pPassItem->GetValue() );
// in case the document has password to modify, the dialog should be shown
SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUnoAnyItem, SID_MODIFYPASSWORDINFO, FALSE );
@@ -1537,7 +1537,9 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
mbSelectionEnabled = sal_False;
// the password will be set in case user decide so
+ rpSet->ClearItem( SID_PASSWORDINTERACTION );
rpSet->ClearItem( SID_PASSWORD );
+ rpSet->ClearItem( SID_ENCRYPTIONDATA );
rpSet->ClearItem( SID_RECOMMENDREADONLY );
rpSet->ClearItem( SID_MODIFYPASSWORDINFO );
@@ -1652,7 +1654,30 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
if ( pPasswordRequest->isPassword() )
{
if ( pPasswordRequest->getPassword().getLength() )
- rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) );
+ {
+ // TODO/LATER: The filters should show the password dialog themself in future
+ if ( bMSType )
+ {
+ // all the current MS-filters use MSCodec_Std97 implementation
+ uno::Sequence< sal_Int8 > aUniqueID = ::comphelper::DocPasswordHelper::GenerateRandomByteSequence( 16 );
+ uno::Sequence< sal_Int8 > aEncryptionKey = ::comphelper::DocPasswordHelper::GenerateStd97Key( pPasswordRequest->getPassword(), aUniqueID );
+
+ if ( aEncryptionKey.getLength() )
+ {
+ ::comphelper::SequenceAsHashMap aHashData;
+ aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97EncryptionKey" ) ) ] <<= aEncryptionKey;
+ aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97UniqueID" ) ) ] <<= aUniqueID;
+
+ rpSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aHashData.getAsConstNamedValueList() ) ) );
+ }
+ else
+ return ERRCODE_IO_NOTSUPPORTED;
+ }
+ else
+ {
+ rpSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( ::comphelper::OStorageHelper::CreatePackageEncryptionData( pPasswordRequest->getPassword() ) ) ) );
+ }
+ }
if ( pPasswordRequest->getRecommendReadOnly() )
rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) );
diff --git a/sfx2/source/dialog/mailmodelapi.cxx b/sfx2/source/dialog/mailmodelapi.cxx
index bedb057c7e..f7f222bbbd 100644
--- a/sfx2/source/dialog/mailmodelapi.cxx
+++ b/sfx2/source/dialog/mailmodelapi.cxx
@@ -79,8 +79,6 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/urlobj.hxx>
-extern sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, String& rPasswd );
-
// --------------------------------------------------------------
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame;
diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk
index 4c56cd683e..572053557e 100755..100644
--- a/sfx2/source/dialog/makefile.mk
+++ b/sfx2/source/dialog/makefile.mk
@@ -46,6 +46,7 @@ EXCEPTIONSFILES=\
$(SLO)$/templdlg.obj \
$(SLO)$/dinfdlg.obj \
$(SLO)$/dockwin.obj \
+ $(SLO)$/passwd.obj \
$(SLO)$/taskpane.obj
SLOFILES =\
@@ -58,7 +59,6 @@ SLOFILES =\
$(SLO)$/mgetempl.obj \
$(SLO)$/navigat.obj \
$(SLO)$/newstyle.obj \
- $(SLO)$/passwd.obj \
$(SLO)$/printopt.obj \
$(SLO)$/sfxdlg.obj \
$(SLO)$/splitwin.obj \
diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx
index 0999ae5436..8f04453638 100644
--- a/sfx2/source/dialog/passwd.cxx
+++ b/sfx2/source/dialog/passwd.cxx
@@ -41,14 +41,15 @@
#include "passwd.hrc"
#include "vcl/sound.hxx"
+#include "vcl/arrange.hxx"
// -----------------------------------------------------------------------
-IMPL_LINK_INLINE_START( SfxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG )
+IMPL_LINK_INLINE_START( SfxPasswordDialog, EditModifyHdl, Edit *, pEdit )
{
- if( mbAsciiOnly )
+ if( mbAsciiOnly && (pEdit == &maPasswordED || pEdit == &maPassword2ED) )
{
- rtl::OUString aTest( maPasswordED.GetText() );
+ rtl::OUString aTest( pEdit->GetText() );
const sal_Unicode* pTest = aTest.getStr();
sal_Int32 nLen = aTest.getLength();
rtl::OUStringBuffer aFilter( nLen );
@@ -64,12 +65,15 @@ IMPL_LINK_INLINE_START( SfxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG )
if( bReset )
{
Sound::Beep( SOUND_ERROR );
- maPasswordED.SetSelection( Selection( 0, nLen ) );
- maPasswordED.ReplaceSelected( aFilter.makeStringAndClear() );
+ pEdit->SetSelection( Selection( 0, nLen ) );
+ pEdit->ReplaceSelected( aFilter.makeStringAndClear() );
}
}
- maOKBtn.Enable( maPasswordED.GetText().Len() >= mnMinLen );
+ bool bEnable = maPasswordED.GetText().Len() >= mnMinLen;
+ if( maPassword2ED.IsVisible() )
+ bEnable = (bEnable && (maPassword2ED.GetText().Len() >= mnMinLen));
+ maOKBtn.Enable( bEnable );
return 0;
}
IMPL_LINK_INLINE_END( SfxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG )
@@ -78,8 +82,11 @@ IMPL_LINK_INLINE_END( SfxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG )
IMPL_LINK( SfxPasswordDialog, OKHdl, OKButton *, EMPTYARG )
{
- if ( ( ( mnExtras & SHOWEXTRAS_CONFIRM ) == SHOWEXTRAS_CONFIRM ) &&
- ( GetConfirm() != GetPassword() ) )
+ bool bConfirmFailed = ( ( mnExtras & SHOWEXTRAS_CONFIRM ) == SHOWEXTRAS_CONFIRM ) &&
+ ( GetConfirm() != GetPassword() );
+ if( ( mnExtras & SHOWEXTRAS_CONFIRM2 ) == SHOWEXTRAS_CONFIRM2 && ( GetConfirm2() != GetPassword2() ) )
+ bConfirmFailed = true;
+ if ( bConfirmFailed )
{
ErrorBox aBox( this, SfxResId( MSG_ERROR_WRONG_CONFIRM ) );
aBox.Execute();
@@ -97,27 +104,83 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText
ModalDialog( pParent, SfxResId ( DLG_PASSWD ) ),
+ maPasswordBox ( this, SfxResId( GB_PASSWD_PASSWORD ) ),
maUserFT ( this, SfxResId( FT_PASSWD_USER ) ),
maUserED ( this, SfxResId( ED_PASSWD_USER ) ),
maPasswordFT ( this, SfxResId( FT_PASSWD_PASSWORD ) ),
maPasswordED ( this, SfxResId( ED_PASSWD_PASSWORD ) ),
maConfirmFT ( this, SfxResId( FT_PASSWD_CONFIRM ) ),
maConfirmED ( this, SfxResId( ED_PASSWD_CONFIRM ) ),
- maPasswordBox ( this, SfxResId( GB_PASSWD_PASSWORD ) ),
+ maPassword2Box ( this, 0 ),
+ maPassword2FT ( this, SfxResId( FT_PASSWD_PASSWORD2 ) ),
+ maPassword2ED ( this, SfxResId( ED_PASSWD_PASSWORD2 ) ),
+ maConfirm2FT ( this, SfxResId( FT_PASSWD_CONFIRM2 ) ),
+ maConfirm2ED ( this, SfxResId( ED_PASSWD_CONFIRM2 ) ),
maOKBtn ( this, SfxResId( BTN_PASSWD_OK ) ),
maCancelBtn ( this, SfxResId( BTN_PASSWD_CANCEL ) ),
maHelpBtn ( this, SfxResId( BTN_PASSWD_HELP ) ),
- maConfirmStr ( SfxResId( STR_PASSWD_CONFIRM ) ),
- mnMinLen ( 5 ),
+ mnMinLen ( 1 ),
mnExtras ( 0 ),
mbAsciiOnly ( false )
{
FreeResource();
+
+ // setup layout
+ boost::shared_ptr<vcl::RowOrColumn> xLayout =
+ boost::dynamic_pointer_cast<vcl::RowOrColumn>( getLayout() );
+ xLayout->setOuterBorder( 0 );
+
+ // get edit size, should be used as minimum
+ Size aEditSize( maUserED.GetSizePixel() );
+
+ // add labelcolumn for the labeled edit fields
+ boost::shared_ptr<vcl::LabelColumn> xEdits( new vcl::LabelColumn( xLayout.get() ) );
+ size_t nChildIndex = xLayout->addChild( xEdits );
+ xLayout->setBorders( nChildIndex, -2, -2, -2, 0 );
+
+ // add group box
+ xEdits->addWindow( &maPasswordBox );
+
+ // add user line
+ xEdits->addRow( &maUserFT, &maUserED, -2, aEditSize );
+
+ // add password line
+ xEdits->addRow( &maPasswordFT, &maPasswordED, -2, aEditSize );
+
+ // add confirm line
+ xEdits->addRow( &maConfirmFT, &maConfirmED, -2, aEditSize );
+
+ // add second group box
+ xEdits->addWindow( &maPassword2Box );
+
+ // add second password line
+ xEdits->addRow( &maPassword2FT, &maPassword2ED, -2, aEditSize );
+
+ // add second confirm line
+ xEdits->addRow( &maConfirm2FT, &maConfirm2ED, -2, aEditSize );
+
+ // add a FixedLine
+ FixedLine* pLine = new FixedLine( this, 0 );
+ pLine->Show();
+ addWindow( pLine, true );
+ xLayout->addWindow( pLine );
+
+ // add button column
+ Size aBtnSize( maCancelBtn.GetSizePixel() );
+ boost::shared_ptr<vcl::RowOrColumn> xButtons( new vcl::RowOrColumn( xLayout.get(), false ) );
+ nChildIndex = xLayout->addChild( xButtons );
+ xLayout->setBorders( nChildIndex, -2, 0, -2, -2 );
+
+ size_t nBtnIndex = xButtons->addWindow( &maHelpBtn, 0, aBtnSize );
+ xButtons->addChild( new vcl::Spacer( xButtons.get() ) );
+ nBtnIndex = xButtons->addWindow( &maOKBtn, 0, aBtnSize );
+ nBtnIndex = xButtons->addWindow( &maCancelBtn, 0, aBtnSize );
Link aLink = LINK( this, SfxPasswordDialog, EditModifyHdl );
maPasswordED.SetModifyHdl( aLink );
+ maPassword2ED.SetModifyHdl( aLink );
aLink = LINK( this, SfxPasswordDialog, OKHdl );
maOKBtn.SetClickHdl( aLink );
@@ -146,65 +209,45 @@ void SfxPasswordDialog::SetMaxLen( USHORT nLen )
short SfxPasswordDialog::Execute()
{
- if ( mnExtras < SHOWEXTRAS_ALL )
+ maUserFT.Hide();
+ maUserED.Hide();
+ maConfirmFT.Hide();
+ maConfirmED.Hide();
+ maPasswordFT.Hide();
+ maPassword2Box.Hide();
+ maPassword2FT.Hide();
+ maPassword2ED.Hide();
+ maPassword2FT.Hide();
+ maConfirm2FT.Hide();
+ maConfirm2ED.Hide();
+
+ if( mnExtras != SHOWEXTRAS_NONE )
+ maPasswordFT.Show();
+ if( (mnExtras & SHOWEXTRAS_USER ) )
{
- Size a3Size = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
- Size a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT );
- long nMinHeight = maHelpBtn.GetPosPixel().Y() +
- maHelpBtn.GetSizePixel().Height() + a6Size.Height();
- USHORT nRowHided = 1;
-
- if ( SHOWEXTRAS_NONE == mnExtras )
- {
- maUserFT.Hide();
- maUserED.Hide();
- maConfirmFT.Hide();
- maConfirmED.Hide();
- maPasswordFT.Hide();
-
- Point aPos = maUserFT.GetPosPixel();
- long nEnd = maUserED.GetPosPixel().X() + maUserED.GetSizePixel().Width();
- maPasswordED.SetPosPixel( aPos );
- Size aSize = maPasswordED.GetSizePixel();
- aSize.Width() = nEnd - aPos.X();
- maPasswordED.SetSizePixel( aSize );
-
- nRowHided = 2;
- }
- else if ( SHOWEXTRAS_USER == mnExtras )
- {
- maConfirmFT.Hide();
- maConfirmED.Hide();
- }
- else if ( SHOWEXTRAS_CONFIRM == mnExtras )
- {
- maUserFT.Hide();
- maUserED.Hide();
-
- Point aPwdPos1 = maPasswordFT.GetPosPixel();
- Point aPwdPos2 = maPasswordED.GetPosPixel();
-
- Point aPos = maUserFT.GetPosPixel();
- maPasswordFT.SetPosPixel( aPos );
- aPos = maUserED.GetPosPixel();
- maPasswordED.SetPosPixel( aPos );
-
- maConfirmFT.SetPosPixel( aPwdPos1 );
- maConfirmED.SetPosPixel( aPwdPos2 );
- }
-
- Size aBoxSize = maPasswordBox.GetSizePixel();
- aBoxSize.Height() -= ( nRowHided * maUserED.GetSizePixel().Height() );
- aBoxSize.Height() -= ( nRowHided * a3Size.Height() );
- maPasswordBox.SetSizePixel( aBoxSize );
-
- long nDlgHeight = maPasswordBox.GetPosPixel().Y() + aBoxSize.Height() + a6Size.Height();
- if ( nDlgHeight < nMinHeight )
- nDlgHeight = nMinHeight;
- Size aDlgSize = GetOutputSizePixel();
- aDlgSize.Height() = nDlgHeight;
- SetOutputSizePixel( aDlgSize );
+ maUserFT.Show();
+ maUserED.Show();
+ }
+ if( (mnExtras & SHOWEXTRAS_CONFIRM ) )
+ {
+ maConfirmFT.Show();
+ maConfirmED.Show();
+ }
+ if( (mnExtras & SHOWEXTRAS_PASSWORD2) )
+ {
+ maPassword2Box.Show();
+ maPassword2FT.Show();
+ maPassword2ED.Show();
+ }
+ if( (mnExtras & SHOWEXTRAS_CONFIRM2 ) )
+ {
+ maConfirm2FT.Show();
+ maConfirm2ED.Show();
}
+
+ boost::shared_ptr<vcl::RowOrColumn> xLayout =
+ boost::dynamic_pointer_cast<vcl::RowOrColumn>( getLayout() );
+ SetSizePixel( xLayout->getOptimalSize( WINDOWSIZE_PREFERRED ) );
return ModalDialog::Execute();
}
diff --git a/sfx2/source/dialog/passwd.hrc b/sfx2/source/dialog/passwd.hrc
index 7c96e131d6..844de643f4 100644
--- a/sfx2/source/dialog/passwd.hrc
+++ b/sfx2/source/dialog/passwd.hrc
@@ -41,7 +41,10 @@
#define BTN_PASSWD_CANCEL 21
#define BTN_PASSWD_HELP 22
-#define STR_PASSWD_CONFIRM 30
+#define FT_PASSWD_PASSWORD2 25
+#define ED_PASSWD_PASSWORD2 26
+#define FT_PASSWD_CONFIRM2 27
+#define ED_PASSWD_CONFIRM2 28
#endif
diff --git a/sfx2/source/dialog/passwd.src b/sfx2/source/dialog/passwd.src
index 4111597e1c..1d1000c9db 100644
--- a/sfx2/source/dialog/passwd.src
+++ b/sfx2/source/dialog/passwd.src
@@ -86,6 +86,32 @@ ModalDialog DLG_PASSWD
Size = MAP_APPFONT( 132, 8 );
Text [ en-US ] = "Password" ;
};
+ FixedText FT_PASSWD_PASSWORD2
+ {
+ Pos = MAP_APPFONT( 12, 30 );
+ Size = MAP_APPFONT( 42, 10 );
+ Text [ en-US ] = "P~assword";
+ };
+ Edit ED_PASSWD_PASSWORD2
+ {
+ Border = TRUE;
+ PassWord = TRUE;
+ Pos = MAP_APPFONT( 57, 29 );
+ Size = MAP_APPFONT( 75, 12 );
+ };
+ FixedText FT_PASSWD_CONFIRM2
+ {
+ Pos = MAP_APPFONT( 12, 45 );
+ Size = MAP_APPFONT( 42, 10 );
+ Text [ en-US ] = "Confir~m";
+ };
+ Edit ED_PASSWD_CONFIRM2
+ {
+ Border = TRUE;
+ PassWord = TRUE;
+ Pos = MAP_APPFONT( 57, 44 );
+ Size = MAP_APPFONT( 75, 12 );
+ };
OKButton BTN_PASSWD_OK
{
Disable = TRUE;
@@ -103,10 +129,6 @@ ModalDialog DLG_PASSWD
Pos = MAP_APPFONT( 144, 43 );
Size = MAP_APPFONT( 50, 14 );
};
- String STR_PASSWD_CONFIRM
- {
- Text [ en-US ] = "Confirm password" ;
- };
};
// ********************************************************************** EOF
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index 7b97eafb03..93a3284421 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -329,13 +329,13 @@ void SfxVersionDialog::Open_Impl()
SfxStringItem aReferer( SID_REFERER, DEFINE_CONST_UNICODE("private:user") );
SfxStringItem aFile( SID_FILE_NAME, pObjShell->GetMedium()->GetName() );
- ::rtl::OUString aPassString;
- if ( GetPasswd_Impl( pObjShell->GetMedium()->GetItemSet(), aPassString ) )
+ uno::Sequence< beans::NamedValue > aEncryptionData;
+ if ( GetEncryptionData_Impl( pObjShell->GetMedium()->GetItemSet(), aEncryptionData ) )
{
// there is a password, it should be used during the opening
- SfxStringItem aPassItem( SID_PASSWORD, aPassString );
+ SfxUnoAnyItem aEncryptionDataItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) );
pViewFrame->GetDispatcher()->Execute(
- SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, &aFile, &aItem, &aTarget, &aReferer, &aPassItem, 0L );
+ SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, &aFile, &aItem, &aTarget, &aReferer, &aEncryptionDataItem, 0L );
}
else
pViewFrame->GetDispatcher()->Execute(
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index f0d3511716..69054c6363 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -881,17 +881,21 @@ uno::Reference < embed::XStorage > SfxMedium::GetOutputStorage()
}
//------------------------------------------------------------------
-void SfxMedium::SetPasswordToStorage_Impl()
+void SfxMedium::SetEncryptionDataToStorage_Impl()
{
// in case media-descriptor contains password it should be used on opening
if ( pImp->xStorage.is() && pSet )
{
- ::rtl::OUString aPasswd;
- if ( GetPasswd_Impl( pSet, aPasswd ) )
+ uno::Sequence< beans::NamedValue > aEncryptionData;
+ if ( GetEncryptionData_Impl( pSet, aEncryptionData ) )
{
+ // replace the password with encryption data
+ pSet->ClearItem( SID_PASSWORD );
+ pSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) );
+
try
{
- ::comphelper::OStorageHelper::SetCommonStoragePassword( pImp->xStorage, aPasswd );
+ ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( pImp->xStorage, aEncryptionData );
}
catch( uno::Exception& )
{
@@ -1326,7 +1330,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf
// TODO/LATER: Get versionlist on demand
if ( pImp->xStorage.is() )
{
- SetPasswordToStorage_Impl();
+ SetEncryptionDataToStorage_Impl();
GetVersionList();
}
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 1e0093ea22..43de830319 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -978,12 +978,11 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
NULL );
const SfxPoolItem* pItem = NULL;
- if ( bPreselectPassword && aDialogParams.GetItemState( SID_PASSWORD, sal_True, &pItem ) != SFX_ITEM_SET )
+ if ( bPreselectPassword && aDialogParams.GetItemState( SID_ENCRYPTIONDATA, sal_True, &pItem ) != SFX_ITEM_SET )
{
- // the file dialog preselects the password checkbox if the provided mediadescriptor has password entry
- // after dialog execution the password entry will be either removed or replaced with the password
- // entered by the user
- aDialogParams.Put( SfxStringItem( SID_PASSWORD, String() ) );
+ // the file dialog preselects the password checkbox if the provided mediadescriptor has encryption data entry
+ // after dialog execution the password interaction flag will be either removed or not
+ aDialogParams.Put( SfxBoolItem( SID_PASSWORDINTERACTION, sal_True ) );
}
// aStringTypeFN is a pure output parameter, pDialogParams is an in/out parameter
@@ -1590,6 +1589,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >&
DocumentSettingsGuard aSettingsGuard( aModelData.GetModel(), aModelData.IsRecommendReadOnly(), nStoreMode & EXPORT_REQUESTED );
+ OSL_ENSURE( aModelData.GetMediaDescr().find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) ) ) == aModelData.GetMediaDescr().end(), "The Password property of MediaDescriptor should not be used here!" );
if ( aOptions.IsDocInfoSave()
&& ( !aModelData.GetStorable()->hasLocation()
|| INetURLObject( aModelData.GetStorable()->getLocation() ) != aURL ) )
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index f778a51075..094c778c7a 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -599,8 +599,9 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
// ========================================================================================================
sal_Bool bPreselectPassword = sal_False;
+ SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pOldEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, FALSE );
SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pOldPasswordItem, SfxStringItem, SID_PASSWORD, FALSE );
- if ( pOldPasswordItem )
+ if ( pOldEncryptionDataItem || pOldPasswordItem )
bPreselectPassword = sal_True;
uno::Sequence< beans::PropertyValue > aDispatchArgs;
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 234c17b65c..0e641ad172 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -202,16 +202,30 @@ sal_Bool SfxObjectShell::QuerySlotExecutable( USHORT /*nSlotId*/ )
//-------------------------------------------------------------------------
-sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, ::rtl::OUString& rPasswd )
+bool GetEncryptionData_Impl( const SfxItemSet* pSet, uno::Sequence< beans::NamedValue >& o_rEncryptionData )
{
- const SfxPoolItem* pItem = NULL;
- if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_PASSWORD, sal_True, &pItem ) )
+ bool bResult = false;
+ if ( pSet )
{
- DBG_ASSERT( pItem->IsA( TYPE(SfxStringItem) ), "wrong item type" );
- rPasswd = ( (const SfxStringItem*)pItem )->GetValue();
- return sal_True;
+ SFX_ITEMSET_ARG( pSet, pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False);
+ if ( pEncryptionDataItem )
+ {
+ pEncryptionDataItem->GetValue() >>= o_rEncryptionData;
+ bResult = true;
+ }
+ else
+ {
+ SFX_ITEMSET_ARG( pSet, pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False);
+ if ( pPasswordItem )
+ {
+ ::rtl::OUString aPassword = pPasswordItem->GetValue();
+ o_rEncryptionData = ::comphelper::OStorageHelper::CreatePackageEncryptionData( aPassword );
+ bResult = true;
+ }
+ }
}
- return sal_False;
+
+ return bResult;
}
//-------------------------------------------------------------------------
@@ -996,15 +1010,15 @@ sal_Bool SfxObjectShell::DoSave()
pImp->bIsSaving = sal_True;
- ::rtl::OUString aPasswd;
+ uno::Sequence< beans::NamedValue > aEncryptionData;
if ( IsPackageStorageFormat_Impl( *GetMedium() ) )
{
- if ( GetPasswd_Impl( GetMedium()->GetItemSet(), aPasswd ) )
+ if ( GetEncryptionData_Impl( GetMedium()->GetItemSet(), aEncryptionData ) )
{
try
{
//TODO/MBA: GetOutputStorage?! Special mode, because it's "Save"?!
- ::comphelper::OStorageHelper::SetCommonStoragePassword( GetMedium()->GetStorage(), aPasswd );
+ ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( GetMedium()->GetStorage(), aEncryptionData );
bOk = sal_True;
}
catch( uno::Exception& )
@@ -1386,13 +1400,13 @@ sal_Bool SfxObjectShell::SaveTo_Impl
}
// transfer password from the parameters to the storage
- ::rtl::OUString aPasswd;
+ uno::Sequence< beans::NamedValue > aEncryptionData;
sal_Bool bPasswdProvided = sal_False;
- if ( GetPasswd_Impl( rMedium.GetItemSet(), aPasswd ) )
+ if ( GetEncryptionData_Impl( rMedium.GetItemSet(), aEncryptionData ) )
{
bPasswdProvided = sal_True;
try {
- ::comphelper::OStorageHelper::SetCommonStoragePassword( xMedStorage, aPasswd );
+ ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( xMedStorage, aEncryptionData );
bOk = sal_True;
}
catch( uno::Exception& )
@@ -3154,13 +3168,13 @@ sal_Bool SfxObjectShell::LoadOwnFormat( SfxMedium& rMedium )
SFX_ITEMSET_ARG( rMedium.GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False );
if ( pPasswdItem || ERRCODE_IO_ABORT != CheckPasswd_Impl( this, SFX_APP()->GetPool(), pMedium ) )
{
- ::rtl::OUString aPasswd;
- if ( GetPasswd_Impl(pMedium->GetItemSet(), aPasswd) )
+ uno::Sequence< beans::NamedValue > aEncryptionData;
+ if ( GetEncryptionData_Impl(pMedium->GetItemSet(), aEncryptionData) )
{
try
{
// the following code must throw an exception in case of failure
- ::comphelper::OStorageHelper::SetCommonStoragePassword( xStorage, aPasswd );
+ ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( xStorage, aEncryptionData );
}
catch( uno::Exception& )
{
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index e8e19d17d6..0f621a4988 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -993,6 +993,8 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString&
aArgs.remove( "InputStream" );
aArgs.remove( "URL" );
aArgs.remove( "Frame" );
+ aArgs.remove( "Password" );
+ aArgs.remove( "EncryptionData" );
// TODO/LATER: all the parameters that are accepted by ItemSet of the DocShell must be removed here
@@ -1707,6 +1709,11 @@ void SAL_CALL SfxBaseModel::storeAsURL( const ::rtl::OUString&
uno::Sequence< beans::PropertyValue > aSequence ;
TransformItems( SID_OPENDOC, *m_pData->m_pObjectShell->GetMedium()->GetItemSet(), aSequence );
attachResource( rURL, aSequence );
+
+#if OSL_DEBUG_LEVEL > 0
+ SFX_ITEMSET_ARG( m_pData->m_pObjectShell->GetMedium()->GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False);
+ OSL_ENSURE( !pPasswdItem, "There should be no Password property in the document MediaDescriptor!" );
+#endif
}
}
@@ -1976,6 +1983,11 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >&
SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False);
if ( pHidItem )
bHidden = pHidItem->GetValue();
+
+#if OSL_DEBUG_LEVEL > 0
+ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False);
+ OSL_ENSURE( !pPasswdItem, "There should be no Password property in the document MediaDescriptor!" );
+#endif
// !TODO: will be done by Framework!
pMedium->SetUpdatePickList( !bHidden );
}
@@ -2755,49 +2767,41 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
aArgHash.erase( aFilterString );
aArgHash.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) );
- // if the password is changed SaveAs should be done
- // no password for encrypted document is also a change here
- sal_Bool bPassChanged = sal_False;
-
- ::comphelper::SequenceAsHashMap::iterator aNewPassIter
- = aArgHash.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) ) );
- SFX_ITEMSET_ARG( pMedium->GetItemSet(), pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False );
- if ( pPasswordItem && aNewPassIter != aArgHash.end() )
+ try
{
- ::rtl::OUString aNewPass;
- aNewPassIter->second >>= aNewPass;
- bPassChanged = !aNewPass.equals( pPasswordItem->GetValue() );
+ storeSelf( aArgHash.getAsConstPropertyValueList() );
+ bSaved = sal_True;
}
- else if ( pPasswordItem || aNewPassIter != aArgHash.end() )
- bPassChanged = sal_True;
-
- if ( !bPassChanged )
+ catch( const lang::IllegalArgumentException& )
{
- try
- {
- storeSelf( aArgHash.getAsConstPropertyValueList() );
- bSaved = sal_True;
- }
- catch( const lang::IllegalArgumentException& )
+ // some additional arguments do not allow to use saving, SaveAs should be done
+ // but only for normal documents, the shared documents would be overwritten in this case
+ // that would mean an information loss
+ // TODO/LATER: need a new interaction for this case
+ if ( m_pData->m_pObjectShell->IsDocShared() )
{
- // some additional arguments do not allow to use saving, SaveAs should be done
- // but only for normal documents, the shared documents would be overwritten in this case
- // that would mean an information loss
- // TODO/LATER: need a new interaction for this case
- if ( m_pData->m_pObjectShell->IsDocShared() )
+ m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't store shared document!" ) ) );
+ m_pData->m_pObjectShell->StoreLog();
+
+ uno::Sequence< beans::NamedValue > aNewEncryptionData = aArgHash.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionData" ) ), uno::Sequence< beans::NamedValue >() );
+ if ( !aNewEncryptionData.getLength() )
{
- m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't store shared document!" ) ) );
- m_pData->m_pObjectShell->StoreLog();
+ ::rtl::OUString aNewPassword = aArgHash.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) ), ::rtl::OUString() );
+ aNewEncryptionData = ::comphelper::OStorageHelper::CreatePackageEncryptionData( aNewPassword );
+ }
+
+ uno::Sequence< beans::NamedValue > aOldEncryptionData;
+ GetEncryptionData_Impl( pMedium->GetItemSet(), aOldEncryptionData );
+ if ( !aOldEncryptionData.getLength() && !aNewEncryptionData.getLength() )
throw;
+ else
+ {
+ // if the password is changed a special error should be used in case of shared document
+ throw task::ErrorCodeIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cant change password for shared document." ) ), uno::Reference< uno::XInterface >(), ERRCODE_SFX_SHARED_NOPASSWORDCHANGE );
}
}
}
- else if ( m_pData->m_pObjectShell->IsDocShared() )
- {
- // if the password is changed a special error should be used in case of shared document
- throw task::ErrorCodeIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cant change password for shared document." ) ), uno::Reference< uno::XInterface >(), ERRCODE_SFX_SHARED_NOPASSWORDCHANGE );
- }
}
}
}
diff --git a/svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx b/svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx
index be2518a685..b34df0bffb 100644
--- a/svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx
+++ b/svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx
@@ -95,6 +95,15 @@ namespace sdr
// Process the whole displaying
virtual void ProcessDisplay(DisplayInfo& rDisplayInfo);
+ // VirtualDevice? Default is false
+ virtual bool isOutputToVirtualDevice() const;
+
+ // recording MetaFile? Default is false
+ virtual bool isOutputToRecordingMetaFile() const;
+
+ // pdf export? Default is false
+ virtual bool isOutputToPDFFile() const;
+
// access to OutputDevice. May return 0L like the default implementations do. Needs to be overloaded as needed.
virtual OutputDevice* TryToGetOutputDevice() const;
};
diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx
index 410a1a8375..e18e879b2d 100644
--- a/svx/inc/svx/svdograf.hxx
+++ b/svx/inc/svx/svdograf.hxx
@@ -120,7 +120,8 @@ protected:
void ImpLinkAnmeldung();
void ImpLinkAbmeldung();
- sal_Bool ImpUpdateGraphicLink() const;
+ sal_Bool ImpUpdateGraphicLink( sal_Bool bAsynchron = sal_True ) const;
+ void ImpSetLinkedGraphic( const Graphic& rGraphic );
DECL_LINK( ImpSwapHdl, GraphicObject* );
public:
diff --git a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
index e53d767512..d373063ad6 100644
--- a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
+++ b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
@@ -151,6 +151,25 @@ namespace sdr
}
}
+ // VirtualDevice?
+ bool ObjectContactOfObjListPainter::isOutputToVirtualDevice() const
+ {
+ return (OUTDEV_VIRDEV == mrTargetOutputDevice.GetOutDevType());
+ }
+
+ // recording MetaFile?
+ bool ObjectContactOfObjListPainter::isOutputToRecordingMetaFile() const
+ {
+ GDIMetaFile* pMetaFile = mrTargetOutputDevice.GetConnectMetaFile();
+ return (pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
+ }
+
+ // pdf export?
+ bool ObjectContactOfObjListPainter::isOutputToPDFFile() const
+ {
+ return (0 != mrTargetOutputDevice.GetPDFWriter());
+ }
+
OutputDevice* ObjectContactOfObjListPainter::TryToGetOutputDevice() const
{
return &mrTargetOutputDevice;
diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
index 57312df26a..6e80ea6ac5 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -177,7 +177,7 @@ namespace sdr
if(rGrafObj.IsLinkedGraphic())
{
// update graphic link
- rGrafObj.ImpUpdateGraphicLink();
+ rGrafObj.ImpUpdateGraphicLink( sal_False );
}
else
{
@@ -196,7 +196,7 @@ namespace sdr
rGrafObj.mbInsidePaint = sal_True;
rGrafObj.ForceSwapIn();
rGrafObj.mbInsidePaint = sal_False;
- }
+ }
bRetval = true;
}
@@ -252,19 +252,27 @@ namespace sdr
// prepare primitive generation with evtl. loading the graphic when it's swapped out
SdrGrafObj& rGrafObj = const_cast< ViewObjectContactOfGraphic* >(this)->getSdrGrafObj();
bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics());
- static bool bSuppressAsynchLoading(false);
bool bSwapInDone(false);
+ bool bSwapInExclusive(false);
- if(bDoAsynchronGraphicLoading
- && rGrafObj.IsSwappedOut()
- && rGrafObj.GetPage()
- && rGrafObj.GetPage()->IsMasterPage())
+ if( bDoAsynchronGraphicLoading && rGrafObj.IsSwappedOut() )
{
- // #i102380# force Swap-In for GraphicObjects on MasterPage to have a nicer visualisation
- bDoAsynchronGraphicLoading = false;
+ // sometimes it is needed that each graphic is completely available and swapped in
+ // for these cases a ForceSwapIn is called later at the graphic object
+ if ( rGrafObj.GetPage() && rGrafObj.GetPage()->IsMasterPage() )
+ {
+ // #i102380# force Swap-In for GraphicObjects on MasterPage to have a nicer visualisation
+ bDoAsynchronGraphicLoading = false;
+ }
+ else if ( GetObjectContact().isOutputToPrinter()
+ || GetObjectContact().isOutputToRecordingMetaFile()
+ || GetObjectContact().isOutputToPDFFile() )
+ {
+ bDoAsynchronGraphicLoading = false;
+ bSwapInExclusive = true;
+ }
}
-
- if(bDoAsynchronGraphicLoading && !bSuppressAsynchLoading)
+ if( bDoAsynchronGraphicLoading )
{
bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithAsynchroniousLoading();
}
@@ -293,10 +301,8 @@ namespace sdr
}
}
- // if swap in was forced only for printing, swap out again
- const bool bSwapInExclusiveForPrinting(bSwapInDone && GetObjectContact().isOutputToPrinter());
-
- if(bSwapInExclusiveForPrinting)
+ // if swap in was forced only for printing metafile and pdf, swap out again
+ if( bSwapInDone && bSwapInExclusive )
{
rGrafObj.ForceSwapOut();
}
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index c2d439858f..765bcd874a 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -207,6 +207,8 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe
else
nDefTextHgt = SdrEngineDefaults::GetFontHeight();
+ pItemPool->SetPoolDefaultItem( SdrTextWordWrapItem( sal_False ) );
+
SetTextDefaults();
pLayerAdmin=new SdrLayerAdmin;
pLayerAdmin->SetModel(this);
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 4225d599ff..6320512e67 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -45,6 +45,7 @@
#include <vcl/svapp.hxx>
#include <sfx2/linkmgr.hxx>
+#include <sfx2/docfile.hxx>
#include <svx/svdetc.hxx>
#include "svdglob.hxx"
#include "svdstr.hrc"
@@ -69,6 +70,8 @@
#include <svx/sdr/contact/viewcontactofgraphic.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <osl/thread.hxx>
+#include <vos/mutex.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::io;
@@ -80,13 +83,48 @@ using namespace ::com::sun::star::io;
#define GRAFSTREAMPOS_INVALID 0xffffffff
#define SWAPGRAPHIC_TIMEOUT 5000
+
// ------------------
// - SdrGraphicLink -
// ------------------
+
+const Graphic ImpLoadLinkedGraphic( const String& rFileName, const String& rFilterName )
+{
+ Graphic aGraphic;
+
+ SfxMedium xMed( rFileName, STREAM_STD_READ, TRUE );
+ xMed.DownLoad();
+
+ SvStream* pInStrm = xMed.GetInStream();
+ if ( pInStrm )
+ {
+ pInStrm->Seek( STREAM_SEEK_TO_BEGIN );
+ GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
+
+ const USHORT nFilter = rFilterName.Len() && pGF->GetImportFormatCount()
+ ? pGF->GetImportFormatNumber( rFilterName )
+ : GRFILTER_FORMAT_DONTKNOW;
+
+ String aEmptyStr;
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aFilterData( 1 );
+
+ // Room for improvment:
+ // As this is a linked graphic the GfxLink is not needed if saving/loading our own format.
+ // But this link is required by some filters to access the native graphic (pdf export/ms export),
+ // there we should create a new service to provide this data if needed
+ aFilterData[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CreateNativeLink" ) );
+ aFilterData[ 0 ].Value = Any( sal_True );
+ pGF->ImportGraphic( aGraphic, aEmptyStr, *pInStrm, nFilter, NULL, 0, &aFilterData );
+ }
+ return aGraphic;
+}
+
+class SdrGraphicUpdater;
class SdrGraphicLink : public sfx2::SvBaseLink
{
SdrGrafObj* pGrafObj;
+ SdrGraphicUpdater* pGraphicUpdater;
public:
SdrGraphicLink(SdrGrafObj* pObj);
@@ -95,16 +133,87 @@ public:
virtual void Closed();
virtual void DataChanged( const String& rMimeType,
const ::com::sun::star::uno::Any & rValue );
+ void DataChanged( const Graphic& rGraphic );
BOOL Connect() { return 0 != GetRealObject(); }
- void UpdateSynchron();
+ void UpdateAsynchron();
+ void RemoveGraphicUpdater();
};
+class SdrGraphicUpdater : public ::osl::Thread
+{
+public:
+ SdrGraphicUpdater( const String& rFileName, const String& rFilterName, SdrGraphicLink& );
+ virtual ~SdrGraphicUpdater( void );
+
+ void SAL_CALL Terminate( void );
+
+ sal_Bool GraphicLinkChanged( const String& rFileName ){ return mrFileName != rFileName; };
+
+protected:
+
+ /** is called from the inherited create method and acts as the
+ main function of this thread.
+ */
+ virtual void SAL_CALL run(void);
+
+ /** Called after the thread is terminated via the terminate
+ method. Used to kill the thread by calling delete on this.
+ */
+ virtual void SAL_CALL onTerminated(void);
+
+private:
+
+ ::osl::Mutex maMutex;
+ const String& mrFileName;
+ const String& mrFilterName;
+ SdrGraphicLink& mrGraphicLink;
+
+ volatile bool mbIsTerminated;
+};
+
+SdrGraphicUpdater::SdrGraphicUpdater( const String& rFileName, const String& rFilterName, SdrGraphicLink& rGraphicLink )
+: mrFileName( rFileName )
+, mrFilterName( rFilterName )
+, mrGraphicLink( rGraphicLink )
+, mbIsTerminated( sal_False )
+{
+ create();
+}
+
+SdrGraphicUpdater::~SdrGraphicUpdater( void )
+{
+}
+
+void SdrGraphicUpdater::Terminate()
+{
+ ::osl::MutexGuard aGuard( maMutex );
+ mbIsTerminated = sal_True;
+}
+
+void SAL_CALL SdrGraphicUpdater::onTerminated(void)
+{
+ delete this;
+}
+
+void SAL_CALL SdrGraphicUpdater::run(void)
+{
+ Graphic aGraphic( ImpLoadLinkedGraphic( mrFileName, mrFilterName ) );
+ ::osl::MutexGuard aGuard(maMutex);
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ if ( !mbIsTerminated )
+ {
+ mrGraphicLink.DataChanged( aGraphic );
+ mrGraphicLink.RemoveGraphicUpdater();
+ }
+}
+
// -----------------------------------------------------------------------------
-SdrGraphicLink::SdrGraphicLink(SdrGrafObj* pObj):
- ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, SOT_FORMATSTR_ID_SVXB ),
- pGrafObj(pObj)
+SdrGraphicLink::SdrGraphicLink(SdrGrafObj* pObj)
+: ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, SOT_FORMATSTR_ID_SVXB )
+, pGrafObj( pObj )
+, pGraphicUpdater( NULL )
{
SetSynchron( FALSE );
}
@@ -113,6 +222,22 @@ SdrGraphicLink::SdrGraphicLink(SdrGrafObj* pObj):
SdrGraphicLink::~SdrGraphicLink()
{
+ if ( pGraphicUpdater )
+ pGraphicUpdater->Terminate();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGraphicLink::DataChanged( const Graphic& rGraphic )
+{
+ pGrafObj->ImpSetLinkedGraphic( rGraphic );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGraphicLink::RemoveGraphicUpdater()
+{
+ pGraphicUpdater = NULL;
}
// -----------------------------------------------------------------------------
@@ -135,9 +260,8 @@ void SdrGraphicLink::DataChanged( const String& rMimeType,
}
else if( SotExchange::GetFormatIdFromMimeType( rMimeType ) != sfx2::LinkManager::RegisterStatusInfoId() )
{
- // only repaint, no objectchange
- pGrafObj->ActionChanged();
- // pGrafObj->BroadcastObjectChange();
+ // broadcasting, to update slidesorter
+ pGrafObj->BroadcastObjectChange();
}
}
}
@@ -155,14 +279,20 @@ void SdrGraphicLink::Closed()
// -----------------------------------------------------------------------------
-void SdrGraphicLink::UpdateSynchron()
+void SdrGraphicLink::UpdateAsynchron()
{
if( GetObj() )
{
- String aMimeType( SotExchange::GetFormatMimeType( GetContentType() ));
- ::com::sun::star::uno::Any aValue;
- GetObj()->GetData( aValue, aMimeType, TRUE );
- DataChanged( aMimeType, aValue );
+ if ( pGraphicUpdater )
+ {
+ if ( pGraphicUpdater->GraphicLinkChanged( pGrafObj->GetFileName() ) )
+ {
+ pGraphicUpdater->Terminate();
+ pGraphicUpdater = new SdrGraphicUpdater( pGrafObj->GetFileName(), pGrafObj->GetFilterName(), *this );
+ }
+ }
+ else
+ pGraphicUpdater = new SdrGraphicUpdater( pGrafObj->GetFileName(), pGrafObj->GetFilterName(), *this );
}
}
@@ -447,8 +577,10 @@ void SdrGrafObj::ForceSwapIn() const
const_cast< SdrGrafObj* >( this )->mbIsPreview = sal_False;
}
-
- pGraphic->FireSwapInRequest();
+ if ( pGraphicLink && pGraphic->IsSwappedOut() )
+ ImpUpdateGraphicLink( sal_False );
+ else
+ pGraphic->FireSwapInRequest();
if( pGraphic->IsSwappedOut() ||
( pGraphic->GetType() == GRAPHIC_NONE ) ||
@@ -558,24 +690,36 @@ UINT16 SdrGrafObj::GetObjIdentifier() const
// -----------------------------------------------------------------------------
-sal_Bool SdrGrafObj::ImpUpdateGraphicLink() const
+/* The graphic of the GraphicLink will be loaded. If it is called with
+ bAsynchron = true then the graphic will be set later via DataChanged
+*/
+sal_Bool SdrGrafObj::ImpUpdateGraphicLink( sal_Bool bAsynchron ) const
{
- sal_Bool bRet = sal_False;
-
+ sal_Bool bRet = sal_False;
if( pGraphicLink )
{
- const sal_Bool bIsChanged = pModel->IsChanged();
- pGraphicLink->UpdateSynchron();
- pModel->SetChanged( bIsChanged );
-
+ if ( bAsynchron )
+ pGraphicLink->UpdateAsynchron();
+ else
+ pGraphicLink->DataChanged( ImpLoadLinkedGraphic( aFileName, aFilterName ) );
bRet = sal_True;
}
-
return bRet;
}
// -----------------------------------------------------------------------------
+void SdrGrafObj::ImpSetLinkedGraphic( const Graphic& rGraphic )
+{
+ const sal_Bool bIsChanged = GetModel()->IsChanged();
+ NbcSetGraphic( rGraphic );
+ ActionChanged();
+ BroadcastObjectChange();
+ GetModel()->SetChanged( bIsChanged );
+}
+
+// -----------------------------------------------------------------------------
+
void SdrGrafObj::TakeObjNameSingul(XubString& rName) const
{
switch( pGraphic->GetType() )
@@ -1095,7 +1239,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
if( ( pGraphic->HasUserData() || pGraphicLink ) &&
( nSwapMode & SDR_SWAPGRAPHICSMODE_PURGE ) )
{
- pRet = NULL;
+ pRet = GRFMGR_AUTOSWAPSTREAM_LINK;
}
else if( nSwapMode & SDR_SWAPGRAPHICSMODE_TEMP )
{
@@ -1180,7 +1324,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
}
}
}
- else if( !ImpUpdateGraphicLink() )
+ else if( !ImpUpdateGraphicLink( sal_False ) )
{
pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
}
diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
index 184f855276..b21e45798b 100644
--- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
+++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
@@ -104,6 +104,24 @@ void XMLGraphicsDefaultStyle::SetDefaults()
Reference< XPropertySet > xDefaults( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults") ) ), UNO_QUERY );
if( !xDefaults.is() )
return;
+ // SJ: #i114750#
+ sal_Bool bWordWrapDefault = sal_True; // initializing with correct odf fo:wrap-option default
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild );
+ if ( bBuildIdFound && (
+ ((nUPD >= 600) && (nUPD < 700))
+ ||
+ ((nUPD == 300) && (nBuild <= 9535))
+ ||
+ ((nUPD > 300) && (nUPD <= 330))
+ ) )
+ bWordWrapDefault = sal_False;
+
+ const OUString sTextWordWrap( RTL_CONSTASCII_USTRINGPARAM( "TextWordWrap" ) );
+ Reference< XPropertySetInfo > xInfo( xDefaults->getPropertySetInfo() );
+ if ( xInfo->hasPropertyByName( sTextWordWrap ) )
+ xDefaults->setPropertyValue( sTextWordWrap, Any( bWordWrapDefault ) );
FillPropertySet( xDefaults );
}
diff --git a/xmloff/source/text/XMLTextListAutoStylePool.cxx b/xmloff/source/text/XMLTextListAutoStylePool.cxx
index c99f9111a6..ff46d49c3a 100644
--- a/xmloff/source/text/XMLTextListAutoStylePool.cxx
+++ b/xmloff/source/text/XMLTextListAutoStylePool.cxx
@@ -185,7 +185,15 @@ XMLTextListAutoStylePool::XMLTextListAutoStylePool( SvXMLExport& rExp ) :
XMLTextListAutoStylePool::~XMLTextListAutoStylePool()
{
+ // The XMLTextListAutoStylePoolEntry_Impl object in the pool need delete explicitly in dtor.
+ ULONG nCount = pPool->Count();
+ while ( nCount-- )
+ delete pPool->Remove(nCount);
delete pPool;
+
+ nCount = pNames->Count();
+ while ( nCount-- )
+ delete pNames->Remove(nCount);
delete pNames;
}