[PATCH] comments and code reformat
Maxime de Roucy (via Code Review)
gerrit at gerrit.libreoffice.org
Tue Apr 23 08:48:28 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3582
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/82/3582/1
comments and code reformat
Change-Id: Ib4e45cb85c9e5e5ffa6476c939300c6795412b1a
---
M sw/inc/doc.hxx
M sw/inc/redline.hxx
M sw/source/core/doc/docfmt.cxx
M xmloff/inc/xmloff/txtimp.hxx
M xmloff/inc/xmloff/xmlictxt.hxx
M xmloff/source/text/XMLChangeElementImportContext.cxx
M xmloff/source/text/XMLChangeElementImportContext.hxx
M xmloff/source/text/XMLChangedRegionImportContext.cxx
M xmloff/source/text/XMLChangedRegionImportContext.hxx
M xmloff/source/text/txtimp.cxx
10 files changed, 153 insertions(+), 111 deletions(-)
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 5dfb6df..1e77cac 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -878,7 +878,7 @@
virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*);
virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
- //Add a para for the char attribute exp...
+ /// Add a para for the char attribute exp...
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
const SetAttrMode nFlags,bool bExpandCharToPara=false);
virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
@@ -1183,9 +1183,11 @@
const bool bSendDataChangedEvents = true );
void RstTxtAttrs(const SwPaM &rRg, bool bInclRefToxMark = false );
- /** Set attribute in given format.
- If Undo is activated, the old one is listed in Undo-History. */
+ /** Set attribute in given format.1y
+ * If Undo is enabled, the old values is added to the Undo history. */
void SetAttr( const SfxPoolItem&, SwFmt& );
+ /** Set attribute in given format.1y
+ * If Undo is enabled, the old values is added to the Undo history. */
void SetAttr( const SfxItemSet&, SwFmt& );
/// method to reset a certain attribute at the given format
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index f9fc926..2c54a2e 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -203,7 +203,7 @@
if( !pEndPtr ) pEndPtr = End();
*pEndPtr = rPos;
}
- // Do we have a valid selection?
+ /// Do we have a valid selection?
sal_Bool HasValidRange() const;
const SwRedlineData& GetRedlineData(sal_uInt16 nPos = 0) const;
@@ -224,8 +224,8 @@
void SetComment( const String& rS ) { pRedlineData->SetComment( rS ); }
- // ExtraData gets copied, the pointer is therefor not taken over by
- // the RedLineObject.
+ /** ExtraData gets copied, the pointer is therefor not taken over by
+ * the RedLineObject.*/
void SetExtraData( const SwRedlineExtraData* pData )
{ pRedlineData->SetExtraData( pData ); }
const SwRedlineExtraData* GetExtraData() const
@@ -246,10 +246,11 @@
void Hide( sal_uInt16 nLoop = 0 );
void ShowOriginal( sal_uInt16 nLoop = 0 );
- // Calculates the intersection with text node number nNdIdx.
+ /// Calculates the intersection with text node number nNdIdx.
void CalcStartEnd( sal_uLong nNdIdx, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
- void InvalidateRange(); // Initiate the layout.
+ /// Initiate the layout.
+ void InvalidateRange();
sal_Bool IsOwnRedline( const SwRedline& rRedl ) const
{ return GetAuthor() == rRedl.GetAuthor(); }
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 332c44a..702156f 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -97,7 +97,6 @@
bool bResetListAttrs; // #i62575#
bool bResetAll;
bool bInclRefToxMark;
-
bool bKeepOutlineLevelAttr;
ParaRstFmt( const SwPosition* pStt, const SwPosition* pEnd,
@@ -126,7 +125,7 @@
bResetListAttrs( false ), // #i62675#
bResetAll( true ),
bInclRefToxMark( false ),
- bKeepOutlineLevelAttr( false )
+ bKeepOutlineLevelAttr( false )
{}
};
@@ -1637,74 +1636,74 @@
static bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
{
- // ParaSetFmtColl * pPara = (ParaSetFmtColl*)pArgs;
- SwCntntNode* pCNd = (SwCntntNode*)rpNode->GetTxtNode();
- if( pCNd )
+ SwCntntNode* pCNd = static_cast<SwCntntNode*>(rpNode->GetTxtNode());
+
+ if( pCNd == NULL)
+ return true;
+
+ ParaRstFmt* pPara = reinterpret_cast<ParaRstFmt*>(pArgs);
+
+ SwTxtFmtColl* pFmt = static_cast<SwTxtFmtColl*>(pPara->pFmtColl);
+ if ( pPara->bReset )
{
- ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
- SwTxtFmtColl* pFmt = static_cast<SwTxtFmtColl*>(pPara->pFmtColl);
- if ( pPara->bReset )
+ if( pFmt->GetAttrOutlineLevel() == 0 && pPara )
+ pPara->bKeepOutlineLevelAttr = true;
+
+ lcl_RstAttr( pCNd, pPara );
+
+ // #i62675# check, if paragraph style has changed
+ if ( pPara->bResetListAttrs &&
+ pFmt != pCNd->GetFmtColl() &&
+ pFmt->GetItemState( RES_PARATR_NUMRULE ) == SFX_ITEM_SET )
{
-
- if( pFmt->GetAttrOutlineLevel() == 0 && pPara )
- pPara->bKeepOutlineLevelAttr = true;
-
- lcl_RstAttr( pCNd, pPara );
-
- // #i62675# check, if paragraph style has changed
- if ( pPara->bResetListAttrs &&
- pFmt != pCNd->GetFmtColl() &&
- pFmt->GetItemState( RES_PARATR_NUMRULE ) == SFX_ITEM_SET )
+ // Check, if the list style of the paragraph will change.
+ bool bChangeOfListStyleAtParagraph( true );
+ SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) );
+ OSL_ENSURE( pTNd, "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" );
{
- // Check, if the list style of the paragraph will change.
- bool bChangeOfListStyleAtParagraph( true );
- SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) );
- OSL_ENSURE( pTNd,
- "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" );
+ SwNumRule* pNumRuleAtParagraph( pTNd->GetNumRule() );
+ if ( pNumRuleAtParagraph )
{
- SwNumRule* pNumRuleAtParagraph( pTNd->GetNumRule() );
- if ( pNumRuleAtParagraph )
+ const SwNumRuleItem& rNumRuleItemAtParagraphStyle =
+ pFmt->GetNumRule();
+ if ( rNumRuleItemAtParagraphStyle.GetValue() ==
+ pNumRuleAtParagraph->GetName() )
{
- const SwNumRuleItem& rNumRuleItemAtParagraphStyle =
- pFmt->GetNumRule();
- if ( rNumRuleItemAtParagraphStyle.GetValue() ==
- pNumRuleAtParagraph->GetName() )
- {
- bChangeOfListStyleAtParagraph = false;
- }
+ bChangeOfListStyleAtParagraph = false;
}
- }
-
- if ( bChangeOfListStyleAtParagraph )
- {
- std::auto_ptr< SwRegHistory > pRegH;
- if ( pPara->pHistory )
- {
- pRegH.reset( new SwRegHistory( pTNd, *pTNd, pPara->pHistory ) );
- }
-
- pCNd->ResetAttr( RES_PARATR_NUMRULE );
-
- // reset all list attributes
- pCNd->ResetAttr( RES_PARATR_LIST_LEVEL );
- pCNd->ResetAttr( RES_PARATR_LIST_ISRESTART );
- pCNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE );
- pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED );
- pCNd->ResetAttr( RES_PARATR_LIST_ID );
}
}
+
+ if ( bChangeOfListStyleAtParagraph )
+ {
+ std::auto_ptr< SwRegHistory > pRegH;
+ if ( pPara->pHistory )
+ {
+ pRegH.reset( new SwRegHistory( pTNd, *pTNd, pPara->pHistory ) );
+ }
+
+ pCNd->ResetAttr( RES_PARATR_NUMRULE );
+
+ // reset all list attributes
+ pCNd->ResetAttr( RES_PARATR_LIST_LEVEL );
+ pCNd->ResetAttr( RES_PARATR_LIST_ISRESTART );
+ pCNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE );
+ pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED );
+ pCNd->ResetAttr( RES_PARATR_LIST_ID );
+ }
}
-
- // add to History so that old data is saved, if necessary
- if( pPara->pHistory )
- pPara->pHistory->Add( pCNd->GetFmtColl(), pCNd->GetIndex(),
- ND_TEXTNODE );
-
- pCNd->ChgFmtColl( pFmt );
-
- pPara->nWhich++;
}
+
+ // add to History so that old data is saved, if necessary
+ if( pPara->pHistory )
+ pPara->pHistory->Add( pCNd->GetFmtColl(), pCNd->GetIndex(),
+ ND_TEXTNODE );
+
+ pCNd->ChgFmtColl( pFmt );
+
+ pPara->nWhich++;
+
return true;
}
diff --git a/xmloff/inc/xmloff/txtimp.hxx b/xmloff/inc/xmloff/txtimp.hxx
index 2ac668d..ad84752 100644
--- a/xmloff/inc/xmloff/txtimp.hxx
+++ b/xmloff/inc/xmloff/txtimp.hxx
@@ -674,36 +674,53 @@
// (to be implemented in sw/filter/xml/txtparai.hxx)
virtual void RedlineAdd(
- const OUString& rType, /// redline type (insert, del,... )
- const OUString& rId, /// use to identify this redline
- const OUString& rAuthor, /// name of the author
- const OUString& rComment, /// redline comment
- const ::com::sun::star::util::DateTime& rDateTime, /// date+time
- sal_Bool bMergeLastParagraph); /// merge last paras
+ /// redline type (insert, del,... )
+ const OUString& rType,
+ /// use to identify this redline
+ const OUString& rId,
+ /// name of the author
+ const OUString& rAuthor,
+ /// redline comment
+ const OUString& rComment,
+ /// date+time
+ const ::com::sun::star::util::DateTime& rDateTime,
+ /// merge last paras
+ sal_Bool bMergeLastParagraph);
+
virtual ::com::sun::star::uno::Reference<
::com::sun::star::text::XTextCursor> RedlineCreateText(
- ::com::sun::star::uno::Reference< /// needed to get the document
- ::com::sun::star::text::XTextCursor> & rOldCursor,
- const OUString& rId); /// ID used to RedlineAdd() call
+ /// needed to get the document
+ ::com::sun::star::uno::Reference<::com::sun::star::text::XTextCursor> & rOldCursor,
+ /// ID used to RedlineAdd() call
+ const OUString& rId);
+
virtual void RedlineSetCursor(
- const OUString& rId, /// ID used to RedlineAdd() call
- sal_Bool bStart, /// start or end Cursor
- sal_Bool bIsOutsideOfParagraph); /// range is not within <text:p>
- virtual void RedlineAdjustStartNodeCursor(
- sal_Bool bStart);
+ /// ID used to RedlineAdd() call
+ const OUString& rId,
+ /// start or end Cursor
+ sal_Bool bStart,
+ /// range is not within <text:p>
+ sal_Bool bIsOutsideOfParagraph);
+
+ virtual void RedlineAdjustStartNodeCursor( sal_Bool bStart );
virtual void SetShowChanges( sal_Bool bShowChanges );
virtual void SetRecordChanges( sal_Bool bRecordChanges );
virtual void SetChangesProtectionKey(
const ::com::sun::star::uno::Sequence<sal_Int8> & rProtectionKey );
- // access to the last open redline ID:
+ /// get the last open redline ID
OUString GetOpenRedlineId();
+ /// modify the last open redline ID
void SetOpenRedlineId( OUString& rId);
+ /// reset the last open redline ID
void ResetOpenRedlineId();
// #107848#
- // Access methods to the inside_deleted_section flag (redlining)
+ /** redlining : Setter to remember the fact we are inside/outside
+ * a <text:deletion> element (deleted redline section) */
void SetInsideDeleteContext(bool const bNew);
+ /** redlining : Getter to know if we are inside
+ * a <text:deletion> element (deleted redline section) */
bool IsInsideDeleteContext() const;
SvXMLImport & GetXMLImport();
diff --git a/xmloff/inc/xmloff/xmlictxt.hxx b/xmloff/inc/xmloff/xmlictxt.hxx
index 37903e4..2ed80c1 100644
--- a/xmloff/inc/xmloff/xmlictxt.hxx
+++ b/xmloff/inc/xmloff/xmlictxt.hxx
@@ -58,37 +58,37 @@
sal_uInt16 GetPrefix() const { return mnPrefix; }
const OUString& GetLocalName() const { return maLocalName; }
- // A contexts constructor does anything that is required if an element
- // starts. Namespace processing has been done already.
- // Note that virtual methods cannot be used inside constructors. Use
- // StartElement instead if this is required.
+ /** A contexts constructor does anything that is required if an element
+ * starts. Namespace processing has been done already.
+ * Note that virtual methods cannot be used inside constructors. Use
+ * StartElement instead if this is required. */
SvXMLImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName );
- // A contexts destructor does anything that is required if an element
- // ends. By default, nothing is done.
- // Note that virtual methods cannot be used inside destructors. Use
- // EndElement instead if this is required.
+ /** A contexts destructor does anything that is required if an element
+ * ends. By default, nothing is done.
+ * Note that virtual methods cannot be used inside destructors. Use
+ * EndElement instead if this is required. */
virtual ~SvXMLImportContext();
- // Create a children element context. By default, the import's
- // CreateContext method is called to create a new default context.
+ /** Create a children element context. By default, the import's
+ * CreateContext method is called to create a new default context. */
virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
- // StartElement is called after a context has been constructed and
- // before a elements context is parsed. It may be used for actions that
- // require virtual methods. The default is to do nothing.
+ /** StartElement is called after a context has been constructed and
+ * before a elements context is parsed. It may be used for actions that
+ * require virtual methods. The default is to do nothing. */
virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
- // EndElement is called before a context will be destructed, but
- // after a elements context has been parsed. It may be used for actions
- // that require virtual methods. The default is to do nothing.
+ /** EndElement is called before a context will be destructed, but
+ * after a elements context has been parsed. It may be used for actions
+ * that require virtual methods. The default is to do nothing. */
virtual void EndElement();
- // This method is called for all characters that are contained in the
- // current element. The default is to ignore them.
+ /** This method is called for all characters that are contained in the
+ * current element. The default is to ignore them. */
virtual void Characters( const OUString& rChars );
};
diff --git a/xmloff/source/text/XMLChangeElementImportContext.cxx b/xmloff/source/text/XMLChangeElementImportContext.cxx
index 551729b..5502a46 100644
--- a/xmloff/source/text/XMLChangeElementImportContext.cxx
+++ b/xmloff/source/text/XMLChangeElementImportContext.cxx
@@ -71,14 +71,13 @@
if (NULL == pContext)
{
- // no text element -> use default
+ // no text element
+ // illegal element content! TODO: discard this redline!
+ // for the moment -> use default
pContext = SvXMLImportContext::CreateChildContext(
nPrefix, rLocalName, xAttrList);
-
- // illegal element content! TODO: discard this redline!
}
}
-
return pContext;
}
diff --git a/xmloff/source/text/XMLChangeElementImportContext.hxx b/xmloff/source/text/XMLChangeElementImportContext.hxx
index 80a0b78..c9b230f 100644
--- a/xmloff/source/text/XMLChangeElementImportContext.hxx
+++ b/xmloff/source/text/XMLChangeElementImportContext.hxx
@@ -40,7 +40,21 @@
*/
class XMLChangeElementImportContext : public SvXMLImportContext
{
+ /**
+ * accept text content (paragraphs) in element as redline content?
+ *
+ * From the "5.5.4 <text:deletion>" section of the ODF 1.2 standard :
+ * The <text:deletion> element may also contain content that was
+ * deleted while change tracking was enabled.
+ *
+ * No other section in the "5.5 Change Tracking" chapter contain
+ * this sentence.
+ *
+ * So if bAcceptContent is true, we are importing a <text:deletion> element
+ */
sal_Bool bAcceptContent;
+
+ /// context of enclosing <text:changed-region> element
XMLChangedRegionImportContext& rChangedRegion;
public:
diff --git a/xmloff/source/text/XMLChangedRegionImportContext.cxx b/xmloff/source/text/XMLChangedRegionImportContext.cxx
index 4d857501..bb4e451 100644
--- a/xmloff/source/text/XMLChangedRegionImportContext.cxx
+++ b/xmloff/source/text/XMLChangedRegionImportContext.cxx
@@ -104,6 +104,9 @@
if (XML_NAMESPACE_TEXT == nPrefix)
{
+ // from the ODF 1.2 standard :
+ // The <text:changed-region> element has the following child elements:
+ // <text:deletion>, <text:format-change> and <text:insertion>.
if ( IsXMLToken( rLocalName, XML_INSERTION ) ||
IsXMLToken( rLocalName, XML_DELETION ) ||
IsXMLToken( rLocalName, XML_FORMAT_CHANGE ) )
@@ -119,10 +122,13 @@
if (NULL == pContext)
{
+ // illegal element content! TODO: discard the redlines
+ // for the moment -> use text
+
pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
xAttrList);
- // was it a text element? If not, use default!
+ // or default if text fail
if (NULL == pContext)
{
pContext = SvXMLImportContext::CreateChildContext(
diff --git a/xmloff/source/text/XMLChangedRegionImportContext.hxx b/xmloff/source/text/XMLChangedRegionImportContext.hxx
index e35ceb0..51b1870 100644
--- a/xmloff/source/text/XMLChangedRegionImportContext.hxx
+++ b/xmloff/source/text/XMLChangedRegionImportContext.hxx
@@ -34,7 +34,10 @@
} }
} } }
-
+/**
+ * Import <text:changed-region> elements contained in a
+ * <text:tracked-changes> element.
+ */
class XMLChangedRegionImportContext : public SvXMLImportContext
{
const OUString sEmpty;
@@ -44,9 +47,11 @@
::com::sun::star::uno::Reference<
::com::sun::star::text::XTextCursor> xOldCursor;
- OUString sID; /// redline-ID
+ /// redline-ID
+ OUString sID;
- sal_Bool bMergeLastPara; /// merge-last-paragraph flag
+ /// merge-last-paragraph flag
+ sal_Bool bMergeLastPara;
public:
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 1a4bb7a..67cb1c7 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -561,7 +561,7 @@
bool m_bBodyContentStarted : 1;
// #107848#
- // One more flag to remember if we are inside a deleted redline section
+ /// Are we inside a <text:deletion> element (deleted redline section)
bool m_bInsideDeleteContext : 1;
typedef ::std::pair< OUString, OUString> field_name_type_t;
@@ -604,7 +604,6 @@
, m_bProgress( bProgress )
, m_bOrganizerMode( bOrganizerMode )
, m_bBodyContentStarted( true )
- // #107848# Initialize inside_deleted_section flag correctly
, m_bInsideDeleteContext( false )
{
}
--
To view, visit https://gerrit.libreoffice.org/3582
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4e45cb85c9e5e5ffa6476c939300c6795412b1a
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Maxime de Roucy <mderoucy at linagora.com>
More information about the LibreOffice
mailing list