summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2016-04-22 11:20:02 +0200
committerOliver Specht <oliver.specht@cib.de>2016-04-22 13:18:40 +0000
commit8d41866f76ce3909b8d1bba6d0b74c4acb91202b (patch)
tree8cc312d7f4ebb3f02c854752bad86988bcc066b6 /unotools
parent334599030e7b45153107a3075f9049a7463aac80 (diff)
tdf#81833: form protection can be modified as compatibility option
ProtectForm is supported to prevent editing outside of form controls but could only be imported from doc and stored in odt but not changed. Now it is part of Writer's compatibility settings dialog. Change-Id: I7337fb3f0774d3c1d26cd8e1485958399b2a70e2 Reviewed-on: https://gerrit.libreoffice.org/24294 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Oliver Specht <oliver.specht@cib.de>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/compatibility.cxx31
1 files changed, 24 insertions, 7 deletions
diff --git a/unotools/source/config/compatibility.cxx b/unotools/source/config/compatibility.cxx
index 096a7f00663e..b7b34fa56e00 100644
--- a/unotools/source/config/compatibility.cxx
+++ b/unotools/source/config/compatibility.cxx
@@ -56,8 +56,9 @@ using namespace ::com::sun::star::beans;
#define PROPERTYNAME_USEOURTEXTWRAP COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING
#define PROPERTYNAME_CONSIDERWRAPSTYLE COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE
#define PROPERTYNAME_EXPANDWORDSPACE COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE
+#define PROPERTYNAME_PROTECTFORM COMPATIBILITY_PROPERTYNAME_PROTECTFORM
-#define PROPERTYCOUNT 13
+#define PROPERTYCOUNT 14
#define OFFSET_NAME 0
#define OFFSET_MODULE 1
@@ -72,6 +73,7 @@ using namespace ::com::sun::star::beans;
#define OFFSET_USEOURTEXTWRAPPING 10
#define OFFSET_CONSIDERWRAPPINGSTYLE 11
#define OFFSET_EXPANDWORDSPACE 12
+#define OFFSET_PROTECTFORM 13
// private declarations!
@@ -87,7 +89,7 @@ struct SvtCompatibilityEntry
bNoExtLeading( false ), bUseLineSpacing( false ),
bAddTableSpacing( false ), bUseObjPos( false ),
bUseOurTextWrapping( false ), bConsiderWrappingStyle( false ),
- bExpandWordSpace( true ) {}
+ bExpandWordSpace( true ), bProtectForm( false ) {}
SvtCompatibilityEntry(
const OUString& _rName, const OUString& _rNewModule ) :
sName( _rName ), sModule( _rNewModule ),
@@ -96,7 +98,7 @@ struct SvtCompatibilityEntry
bNoExtLeading( false ), bUseLineSpacing( false ),
bAddTableSpacing( false ), bUseObjPos( false ),
bUseOurTextWrapping( false ), bConsiderWrappingStyle( false ),
- bExpandWordSpace( true ) {}
+ bExpandWordSpace( true ), bProtectForm( false ) {}
inline void SetUsePrtMetrics( bool _bSet ) { bUsePrtMetrics = _bSet; }
inline void SetAddSpacing( bool _bSet ) { bAddSpacing = _bSet; }
@@ -109,6 +111,7 @@ struct SvtCompatibilityEntry
inline void SetUseOurTextWrapping( bool _bSet ) { bUseOurTextWrapping = _bSet; }
inline void SetConsiderWrappingStyle( bool _bSet ) { bConsiderWrappingStyle = _bSet; }
inline void SetExpandWordSpace( bool _bSet ) { bExpandWordSpace = _bSet; }
+ inline void SetProtectForm( bool _bSet ) { bProtectForm = _bSet; }
public:
OUString sName;
@@ -124,6 +127,7 @@ struct SvtCompatibilityEntry
bool bUseOurTextWrapping;
bool bConsiderWrappingStyle;
bool bExpandWordSpace;
+ bool bProtectForm;
};
/*-****************************************************************************************************************
@@ -256,7 +260,8 @@ class SvtCompatibilityOptions_Impl : public ConfigItem
bool _bUseObjPos,
bool _bUseOurTextWrapping,
bool _bConsiderWrappingStyle,
- bool _bExpandWordSpace );
+ bool _bExpandWordSpace,
+ bool _bProtectForm );
inline bool IsUsePrtDevice() const { return m_aDefOptions.bUsePrtMetrics; }
inline bool IsAddSpacing() const { return m_aDefOptions.bAddSpacing; }
@@ -269,6 +274,7 @@ class SvtCompatibilityOptions_Impl : public ConfigItem
inline bool IsUseOurTextWrapping() const { return m_aDefOptions.bUseOurTextWrapping; }
inline bool IsConsiderWrappingStyle() const { return m_aDefOptions.bConsiderWrappingStyle; }
inline bool IsExpandWordSpace() const { return m_aDefOptions.bExpandWordSpace; }
+ inline bool IsProtectForm() const { return m_aDefOptions.bProtectForm; }
// private methods
@@ -431,6 +437,7 @@ void SvtCompatibilityOptions_Impl::ImplCommit()
lPropertyValues[ OFFSET_USEOURTEXTWRAPPING - 1 ].Name = sNode + PROPERTYNAME_USEOURTEXTWRAP;
lPropertyValues[ OFFSET_CONSIDERWRAPPINGSTYLE - 1 ].Name = sNode + PROPERTYNAME_CONSIDERWRAPSTYLE;
lPropertyValues[ OFFSET_EXPANDWORDSPACE - 1 ].Name = sNode + PROPERTYNAME_EXPANDWORDSPACE;
+ lPropertyValues[ OFFSET_PROTECTFORM - 1 ].Name = sNode + PROPERTYNAME_PROTECTFORM;
lPropertyValues[ OFFSET_MODULE - 1 ].Value <<= aItem.sModule;
lPropertyValues[ OFFSET_USEPRTMETRICS - 1 ].Value <<= aItem.bUsePrtMetrics;
@@ -444,6 +451,7 @@ void SvtCompatibilityOptions_Impl::ImplCommit()
lPropertyValues[ OFFSET_USEOURTEXTWRAPPING - 1 ].Value <<= aItem.bUseOurTextWrapping;
lPropertyValues[ OFFSET_CONSIDERWRAPPINGSTYLE - 1 ].Value <<= aItem.bConsiderWrappingStyle;
lPropertyValues[ OFFSET_EXPANDWORDSPACE - 1 ].Value <<= aItem.bExpandWordSpace;
+ lPropertyValues[ OFFSET_PROTECTFORM - 1 ].Value <<= aItem.bProtectForm;
SetSetProperties( SETNODE_ALLFILEFORMATS, lPropertyValues );
}
@@ -480,7 +488,8 @@ void SvtCompatibilityOptions_Impl::AppendItem( const OUString& _sName,
bool _bUseObjPos,
bool _bUseOurTextWrapping,
bool _bConsiderWrappingStyle,
- bool _bExpandWordSpace )
+ bool _bExpandWordSpace,
+ bool _bProtectForm )
{
SvtCompatibilityEntry aItem( _sName, _sModule );
aItem.SetUsePrtMetrics( _bUsePrtMetrics );
@@ -494,6 +503,7 @@ void SvtCompatibilityOptions_Impl::AppendItem( const OUString& _sName,
aItem.SetUseOurTextWrapping( _bUseOurTextWrapping );
aItem.SetConsiderWrappingStyle( _bConsiderWrappingStyle );
aItem.SetExpandWordSpace( _bExpandWordSpace );
+ aItem.SetProtectForm( _bProtectForm );
m_aOptions.AppendEntry( aItem );
// default item reset?
@@ -638,14 +648,15 @@ void SvtCompatibilityOptions::AppendItem( const OUString& sName,
bool bUseObjPos,
bool bUseOurTextWrapping,
bool bConsiderWrappingStyle,
- bool bExpandWordSpace )
+ bool bExpandWordSpace,
+ bool bProtectForm )
{
MutexGuard aGuard( GetOwnStaticMutex() );
m_pDataContainer->AppendItem(
sName, sModule, bUsePrtMetrics, bAddSpacing,
bAddSpacingAtPages, bUseOurTabStops, bNoExtLeading,
bUseLineSpacing, bAddTableSpacing, bUseObjPos,
- bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace );
+ bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace, bProtectForm );
}
bool SvtCompatibilityOptions::IsUsePrtDevice() const
@@ -714,6 +725,12 @@ bool SvtCompatibilityOptions::IsExpandWordSpace() const
return m_pDataContainer->IsExpandWordSpace();
}
+bool SvtCompatibilityOptions::IsProtectForm() const
+{
+ MutexGuard aGuard( GetOwnStaticMutex() );
+ return m_pDataContainer->IsProtectForm();
+}
+
Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions::GetList() const
{
MutexGuard aGuard( GetOwnStaticMutex() );